JoinSEEDS / seeds_light_wallet

http://www.joinseeds.earth/
MIT License
42 stars 22 forks source link

Token List #1916

Open n13 opened 2 years ago

n13 commented 2 years ago

Is your feature request related to a problem? Please describe. Moving from hard coded tokens to master token contract, and potentially 100s of tokens in the ecosystem.

Our current Token List implementation is nice, but doesn't work for more than maybe a dozen tokens.

So we have to change as follows

Current Token management on wallet UI

Main screen loads balances for ALL tokens - if any of them has balance > 0, they show in the cards. If they showed in the cards before, they also show in the cards even if balance is 0 - ie, if I have 1 HYPHA, and I send the 1 HYPHA to someone, then I still have a card with 0 HYPHA

Upside: No token management for user Downside: Does not scale to 100s of potential tokens since balances are loaded for every single token every time we refresh.

Describe the solution you'd like A clear and concise description of what you want to happen.

New Token Management

There's a list of always-showing tokens - currently just SEEDS

We may populate the list looking at a user's recent 100 transactions and adding any active tokens to their initial default list.

Settings contains a list of all available tokens, with a switch to turn them on and off

Users need to go to settings to enable tokens

Each user then has a whitelist of tokens, stored on firebase, and these are the tokens that are on the main screen.

We could also store them on a wallet contract and use that as a backend. We only need to store IDs.

Token Cards Change

Each token card loads balance when it appears on screen.

The system never loads all token balances by itself.

The cards are responsible for loading balances, and they only do so when showing.

This way a user can select 100s of tokens as their cards, and we don't overwhelm the network connection - we only load them as needed, and as they are visible.

This is a standard way of handling indefinite lists in mobile apps; the only reason we're not doing it now is that, due to our system of checking all balances, we already have to load all balances.

A token card may have a ... menu to quickly remove token cards from the list

chuck-h commented 2 years ago

New token & card scheme sounds good. As noted above, UI to set tokens individually as visible/not is needed; long list might be handled like a mobile app contacts list. Perhaps could be accessed thru card's ... menu. That ... menu might also expose some of the other token JSON fields (e.g. project website).

Do we need to be concerned about the order cards appear on the carousel? With PR#1880 it will be the order they were added to the tmastr.seeds contract.

Possible enhancement: allow groups of tokens to be made visible/not with one click. Groups could be user-defined (e.g. for different use contexts). Systemwide groups & classifications could be managed thru tokensmaster contract, ref. https://discord.com/channels/722537361480613950/736193477397708831/987395318188478484 on "token labelling".

Not too relevant, but interesting: if the token population explosion comes from Rainbow contract, loading all balances can be pretty efficient. You can get all the Rainbow balances for your account in one api call image

n13 commented 2 years ago

As noted above, UI to set tokens individually

(I had some thoughts here on the ... menu, but I think the design below is superior and more mobile native, so deleting the previous ideas)

Token List Design

Edit Token List actually shows only the visible tokens in a list with standard list editing functions, such as delete and drag to change the list order.

Drag handles so they can be dragged up and down

See video of weather app on iOS - drag to move, swipe to delete

Then have a + ADD button - clicking the button shows the list of all token and allows user to add one.

Typical use case will be to add one token, not to go through and add multiple ones

https://user-images.githubusercontent.com/65412/176621672-719c0fb6-3960-45dc-8452-b28bae21ffb2.mov

I like this best so far.. better than one long list with on/off buttons.

UI Elements

Action Sheet "Edit Token List" "Cancel"

Token List Screen

Add Token Screen

chuck-h commented 2 years ago

Liking this.

Is there a clean interface for a "filter" function on the Add Token screen? Right now we have only two tags implemented - "experimental" and "seeds ecosystem", but this is an extensible tagging system and new ones may be added over time.

chuck-h commented 2 years ago

The schema for token metadata has an optional slot for "project website url". If this field is present, we could offer "visit website" as another item on the Action Sheet.