Skip to content

Commit

Permalink
fix(NFT Images): Support array image types for CIP-68
Browse files Browse the repository at this point in the history
Per the recommendation of the pool.pm team and in compliance with
metadata standards, we sometimes see NFT IPFS links represented as
arrays of strings.  These arrays are meant to be concatenated directly
to produce the IPFS link (or data scheme, etc.).

Because the image is retrieved in the send assets page, without
this change users are UNABLE to send assets in CIP-68 format (since the
decimals do not get properly set in `nami/src/api/extension/index.js#1762`).

[ Testing: npm test, manually built and submitted tx from Nami ]
[ Test Artifacts: txn 5e342b856efa596da433e3eec4256809cfe9bd9c4c9c39eb316328080ced13f1 ]
  • Loading branch information
thaddeusdiamond committed Feb 11, 2024
1 parent 5370783 commit f9cf637
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api/extension/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ export const getAsset = async (unit) => {
const metadata = metadataDatum && Data.toJson(metadataDatum.fields[0]);

asset.displayName = metadata.name;
asset.image = metadata.image ? linkToSrc(metadata.image) : '';
asset.image = metadata.image ? linkToSrc(convertMetadataPropToString(metadata.image)) : '';
asset.decimals = 0;
} catch (_e) {
asset.displayName = asset.name;
Expand All @@ -1785,7 +1785,7 @@ export const getAsset = async (unit) => {
const metadata = metadataDatum && Data.toJson(metadataDatum.fields[0]);

asset.displayName = metadata.name;
asset.image = linkToSrc(metadata.logo) || '';
asset.image = linkToSrc(convertMetadataPropToString(metadata.logo)) || '';
asset.decimals = metadata.decimals || 0;
} catch (_e) {
asset.displayName = asset.name;
Expand Down

0 comments on commit f9cf637

Please sign in to comment.