alpha-wallet-ios icon indicating copy to clipboard operation
alpha-wallet-ios copied to clipboard

Token on Polygon Mumbai testnet shows collection image, but not token image

Open hboon opened this issue 2 years ago • 11 comments

Token: https://mumbai.polygonscan.com/address/0xC9419ebd3DcBdFf2FaD35a8e13AcA24C26E9A38d Wallet: hweeboon.eth

It could be because the token's tokenURI(tokenId) value was invalid when it was downloaded, but it has now been fixed

Screenshot 2023-04-25 at 10 25 20 AM

hboon avatar Apr 25 '23 02:04 hboon

yes, it might be, but just tried and i able to see token images Screenshot 2023-04-25 at 08 22 07

oa-s avatar Apr 25 '23 05:04 oa-s

Ok. Can you help do a quick check to see if we just save the URL once and not overwrite it? Don’t have to fix it yet. (But that means maybe we just need a single refresh button on this screen)

hboon avatar Apr 25 '23 05:04 hboon

yes, right, i tried with with simulating rate limitted error, and able to see same issue, looks like we override existed data with fallback, when we are now able to resolve json

oa-s avatar Apr 25 '23 06:04 oa-s

maybe it better to remove this line? .catch { _ in return strongSelf.generateTokenJsonFallback(for: tokenId, tokenType: tokenType, address: address) }

oa-s avatar Apr 25 '23 06:04 oa-s

@oa-s Hmm.. but no matter what we do/use as fallback, when the tokenUri() returns a URL that works, wouldn't it replace what we stored earlier?

hboon avatar Apr 25 '23 10:04 hboon

even if tokenUri() returns a url that works, the request with that url might fail, in this case we replace failure response with fallback data. we actually replace failure case of fetchJsonFromTokenUri JsonFromTokenUri with fallback data.

oa-s avatar Apr 25 '23 10:04 oa-s

the request with that url might fail, in this case we replace failure response with fallback data. we actually replace failure case of fetchJsonFromTokenUri JsonFromTokenUri with fallback data.

But if it eventually succeed, what happens? Am I seeing that it doesn't work on my side because it failed the first time because the tokenUri() returned URI is invalid, and:

A) the result is stored, we never call tokenUri()again to get the updated URI (they fixed it) and get the JSON B) the result is stored, we call tokenUri() to get the updated URI (they fixed it), but it fails because of network issues and it keeps failing?

I thought it is A, and that's why I thought maybe a refresh button to force a refresh would fix it. But it sounds like you are describing B, but B sound like it would fail very often?

hboon avatar Apr 25 '23 12:04 hboon

A) the result is stored, we never call tokenUri()again to get the updated URI (they fixed it) and get the JSON

we always call tokenUri() when trying to get json for token id, url don't caching

oa-s avatar Apr 25 '23 12:04 oa-s

So if we always call tokenUri() to get the current URL, it should work for me right?

hboon avatar Apr 25 '23 13:04 hboon

But if you’d like and it’s a simple, try pushing a PR and I can test against mine state to see if it fixes it?

hboon avatar Apr 25 '23 13:04 hboon

So if we always call tokenUri() to get the current URL, it should work for me right?

yes

oa-s avatar Apr 25 '23 13:04 oa-s