[SOLVED] Recommendations for reSync calling pattern

I am wondering if there are recommendations for how to use the resync API.

For example, I am developing an application that will display the nfts in a users’ wallets. I am currently calling the get NFTs for wallet API. But there are some instances where the metatdata or token_uri are missing. Example: [SOLVED] Problem missing metadata and token_uri

It looks like I can can call resync when this happens. What are the recommended ways to call this?

For example, I can call resync, with the contract and the token id, for each nft that is missing data.

---- This could result in a lot of API calls
---- This could also result in API calls where the nft intentionally don’t include this information

Should the token id be made optional? This would enable a resync api call for each contract/collection, instead of each nft.

Or is there a way to force a sync when listing the nfts by wallet?

In your app, for each token (e.g. on each NFT page) you could have a refresh button that resyncs the metadata (similar to OpenSea) so the user can request it.

If the NFT doesn’t have a valid token URI then you can display something appropriate like a message.

Thanks, I can do that. Unfortunately, it looks like I can’t reliably show a message if the token_uri isn’t valid, as it seems that there are instances where token_uri is missing, and it can be fixed by doing a a resync. (see: the example in the original post)

But the refresh button seems that it should address the majority of the cases

You can use metadata first. In some cases, that is out of sync (or null) with the token URI as you have noticed - that is when you can use token URI (the original source of any metadata if it exists) as a backup source.

If that is also null (or the token URI isn’t reachable in time which sometimes happens due to IPFS or it was taken down), then you can handle that gracefully.

It is up to you if you want to run your own resync call as well with those cases or just leave it up to the user.

Yes, that is exactly what I am doing.

If metadata is present, I use that. If not, and the token uri is present, I load that information.

I am most worried about the case where both metadata and token uri are null. Hopefully this case should be rare enough that a user initiated resync could work.

If that doesn’t work, I will look into scheduling resync calls myself