extension icon indicating copy to clipboard operation
extension copied to clipboard

Token balance support on non-Alchemy-supported networks

Open itsrachelfish opened this issue 4 years ago • 6 comments

In order to implement swaps we're going to need to figure out some way to determine what tokens an account has without relying on alchemy_getAssetTransfers.

asset-transfer-error

alchemy_getAssetTransfers does not yet support kovan

itsrachelfish avatar Oct 27 '21 20:10 itsrachelfish

We don't rely soley on alchemy_getAssetTransfers now thankfully :) See #309

We do, however, still rely on alchemy_getTokenBalances in its absence. I don't know whether that has support on Kovan.

mhluongo avatar Oct 27 '21 21:10 mhluongo

I wonder how will you consider to track token balances in non-Alchemy-networks.

alchemy_getAssetTransfers alchemy_getTokenBalances alchemy_getTokenMetadata

When user select the network which is not supported by Alchemy, are you assuming to get the same output as Alchemy? I'm planning to investigate for RSK network but I'm not sure how to achieve this in your codebase. Does it make sense to obtain the same output by fetching and mapping the data from an external API? It sounds heavy work in the client side or maybe you have something different in your mind.

7alip avatar Dec 22 '21 15:12 7alip

The plan is to fall back to manual balance checking per-token. It is indeed to a heavy client lift.

mhluongo avatar Dec 22 '21 16:12 mhluongo

Let's start this by:

  • [ ] Implementing getERC20TokenBalance (singular!) using a normal Ethers provider and the ERC20 ABI at lib/erc20.ts.

Then we need a way to do some good batching in ChainService so we can do a fallback version of getTokenBalances even for larger numbers of tokens.

It's probably already not good that there's an Alchemy-specific implementation in lib/erc20.ts, tbh.

Shadowfiend avatar Jan 27 '22 21:01 Shadowfiend

Implementing getERC20TokenBalance (singular!)

We have this already ☺️

mhluongo avatar Jan 27 '22 22:01 mhluongo

Ayyyy you right. getBalance!

There goes the easy part 😂

Shadowfiend avatar Jan 28 '22 01:01 Shadowfiend

Closed by https://github.com/tallycash/extension/pull/2423

0xDaedalus avatar Nov 11 '22 18:11 0xDaedalus