AlphaWallet / alpha-wallet-android

An advanced Ethereum mobile wallet
https://www.alphawallet.com
MIT License
601 stars 535 forks source link

In Assets list group by tokens instead of blockchain #3294

Open tab00 opened 1 year ago

tab00 commented 1 year ago

Innovative blockchains have been increasingly arising, so tokens are becoming multi-blockchain, and token holders have a choice of which blockchains they want their tokens on.

Withdrawal pages on centralized exchanges often provide a list of many blockchain options:

photo_2023-09-12_22-36-31

photo_2023-09-12_22-36-38

Tether lists some of the blockchains that USDT officially exists on at Supported Protocols and Integration Guidelines. e.g.: Ethereum: https://etherscan.io/token/0xdac17f958d2ee523a2206206994597c13d831ec7 Avalanche: https://snowtrace.io/token/0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7 Polygon: https://polygonscan.com/address/0x170a18b9190669cda08965562745a323c907e5ec Kava: https://explorer.kava.io/address/0x919C1c267BC06a7039e03fcc2eF738525769109c Tron: https://tronscan.org/#/token20/TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t EOS: https://bloks.io/account/tethertether

A wallet may hold various quantities of a token on multiple blockchains. Currently, AlphaWallet would show each in separate rows, in sections separated by blockchain.

It'd make more sense to list a token only once in the Assets list, and then show how much of the token is held on each blockchain, and then maybe a total quantity across all enabled blockchains. i.e. group by logical token instead of by blockhain.

JamesSmartCell commented 1 year ago

I see, how would you propose that this is shown? Maybe under defi we can show a 'conglomerate' view that bunches together the corresponding tokens, for a start at least.

I like the idea.

tab00 commented 1 year ago

Here are some of my ideas:

Each row in the assets list can have: On left show the logo of the logical token (as it already does, but without any small blockchain logo on it), then in the middle part show small icons of the blockchains on which the user has such tokens, then on right the total quantity across all blockchains.

There could be a dropdown button near the total, that when clicked, expands a subsection under the row that shows the breakdown of how much of the token the user has on each blockchain.

tab00 commented 1 year ago

Behind the scenes there'd need to be a data structure that maps a logical token to a set of addresses on blockchains.

JamesSmartCell commented 1 year ago

@tab00 do you know if there's a resource or API with a list of common tokens?

I can see on (for example) the Tether Coingecko page there's a drop down that shows the address for every chain:

https://www.coingecko.com/en/coins/tether

however I couldn't find the corresponding API call to fetch this.

tab00 commented 1 year ago

See https://api.coingecko.com/api/v3/coins/list?include_platform=true

I'm surprised to see that USDT is on 43 different blockchains. They'll need to be checked.

The Polygon address is different from the one published on Tether's official web site. I think the address in CoinGecko is the correct one based on the activity on PolygonScan. It's weird that the official web site shows an address with almost no activity.

tab00 commented 1 year ago

In the token details panes (e.g. Token Info, Activity) you'd need to add blockchain names.

JamesSmartCell commented 1 year ago

See https://api.coingecko.com/api/v3/coins/list?include_platform=true

I'm surprised to see that USDT is on 43 different blockchains. They'll need to be checked.

The Polygon address is different from the one published on Tether's official web site. I think the address in CoinGecko is the correct one based on the activity on PolygonScan. It's weird that the official web site shows an address with almost no activity.

Wow that's an epic API call! Nice find.

tab00 commented 1 year ago

For individual logical tokens see https://api.coingecko.com/api/v3/coins/tether which has keys platforms and detail_platforms (which has decimal_place which could be important).