0

I use Polakdot.js library to show all of my assets on the Westend testnet in my dapp.

It takes around 5 seconds to load/show all my assets.

For now it seems to me that this library doesn't have the function to show all assets on wallet address immediately.

How i fetch all my assets from Westend:

  • fetch all assets on Westend
  • check for each asset if my balance is bigger than 0
  • show list of all assets where i have balance more than 0

The problem here is that i loop every time over all the assets on the chain and check for each of them if i have any balance and that is slow.

is there a way to check all the assets i have in my wallet without having to loop over all the assets on the chain ?

app -> https://app.dotacp.mvpworkshop.co/swap?network=westend

1 Answer 1

0

This is a common bottleneck when interacting with wallets in general, most wallets don't have a built-in index of all assets you hold. You can see if Subscan API meets your needs or you'll just need to cache it locally and have a background worker to periodically refresh the data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.