Skip to content

Commit

Permalink
fix metaplex metadata already parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
swaggymarie committed Jun 7, 2024
1 parent 553b122 commit 3c2cc60
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions lib/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,14 @@ async function getMetaplexMetadataForToken(
const decodedMetadata = deserializeMetadata(
tokenMetaDataAccount as unknown as RpcAccount
);
const uriRes = await fetch(decodedMetadata.uri);
const jsonMetadata = (await uriRes.json()) as JsonMetadata;
return !!jsonMetadata
? {
symbol: jsonMetadata.symbol ?? "",
publicKey: tokenAddress.toString(),
url: jsonMetadata.image ?? null,
decimals: mint.decimals ?? 6,
name: jsonMetadata.name ?? null
}
: null;
return (
{
symbol: decodedMetadata.symbol ?? "",
publicKey: tokenAddress.toString(),
url: decodedMetadata.uri ?? null,
decimals: mint.decimals ?? 6,
name: decodedMetadata.name ?? null
})
}
return null;
} catch (e) {
Expand Down

0 comments on commit 3c2cc60

Please sign in to comment.