Skip to content

Commit

Permalink
fix(wallet): stringify json nft metadata to avoid nft details crash (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
begonaalvarezd authored Nov 3, 2024
1 parent 94732f6 commit 2578ffe
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions apps/wallet/src/ui/app/pages/home/nft-details/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,26 @@ function NFTDetailsPage() {
navigate(`/nft-transfer/${nftId}`);
}

function formatMetaValue(value: string) {
if (value.includes('http')) {
function formatMetaValue(value: string | object) {
if (typeof value === 'object') {
return {
value: value.startsWith('http')
? truncateString(value, 20, 8)
: formatAddress(value),
valueLink: value,
value: JSON.stringify(value),
valueLink: undefined,
};
} else {
if (value.includes('http')) {
return {
value: value.startsWith('http')
? truncateString(value, 20, 8)
: formatAddress(value),
valueLink: value,
};
}
return {
value: value,
valueLink: undefined,
};
}
return {
value: value,
valueLink: undefined,
};
}

return (
Expand Down

0 comments on commit 2578ffe

Please sign in to comment.