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

NFT count are all 0 in wallet tab

Open seabornlee opened this issue 2 years ago • 9 comments

image

seabornlee avatar Jul 12 '22 03:07 seabornlee

If you haven't, when you see that, hit the OpenSea API from the same IP address to see if it's rate limited to help narrow it down

hboon avatar Jul 12 '22 03:07 hboon

Thanks Boon!

I got rate limited error with Ether Scan API:

2022-07-12 15:30:59.490 20669-22059/io.stormbird.wallet E/TransactionsNetworkClient: org.json.JSONException: Value Max rate limit reached, please use API Key for higher rate limit at result of type java.lang.String cannot be converted to JSONArray
        at org.json.JSON.typeMismatch(JSON.java:101)
        at org.json.JSONObject.getJSONArray(JSONObject.java:598)
        at com.alphawallet.app.service.TransactionsNetworkClient.getEtherscanTransactions(TransactionsNetworkClient.java:319)
        at com.alphawallet.app.service.TransactionsNetworkClient.readTransactions(TransactionsNetworkClient.java:451)
        at com.alphawallet.app.service.TransactionsNetworkClient.syncUpwards(TransactionsNetworkClient.java:274)
        at com.alphawallet.app.service.TransactionsNetworkClient.lambda$storeNewTransactions$1$com-alphawallet-app-service-TransactionsNetworkClient(TransactionsNetworkClient.java:181)
        at com.alphawallet.app.service.TransactionsNetworkClient$$ExternalSyntheticLambda8.call(Unknown Source:10)

I checked the OpenSea API key is configured properly, does rate limit happend even with a production API key?

seabornlee avatar Jul 12 '22 07:07 seabornlee

You are right. I am blocked to access assets API on mainnet, but not blocked from accessing matic assets.

seabornlee avatar Jul 12 '22 07:07 seabornlee

I checked the OpenSea API key is configured properly, does rate limit happend even with a production API key?

I think so.

hboon avatar Jul 13 '22 03:07 hboon

@seabornlee "It's not a bug, it's a feature"

This stems from when we decided to display all known contracts, so if you open up a new wallet it will show zero balance. There used to be an option in 'Add/Hide Tokens' to not show zero balance tokens but for some reason we removed it (maybe people didn't understand what it did). It has nothing to do with Opensea API key (to save you some time).

If it's an account with the NFT, but without the Opensea API key, it will gradually discover the NFTs in your account using the node directly, scanning the event list.

If you click on the NFT it will discover them from the event list.

The process looks like this:

  • scan transaction list for interaction with NFT. If found, populate the NFT. It should check balance from the contract before it displays.
  • Once clicked on, the app narrows down the scan to that NFT and it finds all NFTs on on that contract.

So, to fix this, maybe add the 'show zero balance tokens' option back into the add/hide tokens menu, and default to 'show'.

It's not a bug, it's a feature; at the moment.

JamesSmartCell avatar Jul 13 '22 09:07 JamesSmartCell

As an aside, are we being etherscan rate limited now? It makes sense. They will want to monetise their API.

We do have an Etherscan API key but it's free tier.

JamesSmartCell avatar Jul 13 '22 09:07 JamesSmartCell

Thanks @JamesSmartCell When the balance is 0, I click the collection, it shows my NFTs, so should we update the balance before user clicking the collection?

seabornlee avatar Jul 14 '22 01:07 seabornlee

It should do a balance update before it even displays in the wallet view.

I've spent a lot of time in that area, it should be perfect (almost) - we haven't seen any issues like this for some time.

Edit: Actually I need to check if it does do the check balance before it adds to the wallet view. If there's data from opensea and it's displaying then it should show the balance correctly.

Is this in your wallet? This could also be a result of the API call failing.

JamesSmartCell avatar Jul 14 '22 20:07 JamesSmartCell

When I switched to Oppo ColorOS, it performs much better than my Huawei with Harmony OS.

  1. Assets fetch is much faster
  2. When refreshing the assets list, some assets disappeared on Huawei and come back in a very long time

seabornlee avatar Jul 18 '22 12:07 seabornlee