From 22f5d82b2a08fcbeb9ffc63cb77d128d02ac1c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Lambert?= <44363395+lambertkevin@users.noreply.github.com> Date: Fri, 8 Apr 2022 13:15:24 +0200 Subject: [PATCH] Fix new architecture nftsResolvers in cli (#1872) --- cli/src/commands/sync.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cli/src/commands/sync.ts b/cli/src/commands/sync.ts index 58c60a77b8..1f8e58ad5c 100644 --- a/cli/src/commands/sync.ts +++ b/cli/src/commands/sync.ts @@ -21,14 +21,19 @@ export default { } ) => scan(opts).pipe( - switchMap(async (account) => - account.nfts?.length + switchMap(async (account) => { + const { currencyId } = decodeAccountId(account.id); + const currency = getCryptoCurrencyById(currencyId); + const currencyBridge = getCurrencyBridge(currency); + const { nftResolvers } = currencyBridge; + + return account.nfts?.length && nftResolvers?.nftMetadata ? { ...account, nfts: await Promise.all( account.nfts.map(async (nft) => { - const { result: metadata } = await metadataCallBatcher.load({ - contract: nft.collection.contract, + const { result: metadata } = await nftResolvers?.nftMetadata({ + contract: nft.contract, tokenId: nft.tokenId, });