-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
frontend simpler coinbalance #2714
frontend simpler coinbalance #2714
Conversation
tested, nice I would name testnet coins so these names are consistent with the names in It will be nice to have it sorted as Bitcoin, Litecoin, and Ethereum... Are all the other coins in the |
9d3d59f
to
b2d2c47
Compare
@strmci I address your feedback, it should use correct names i.e. "Bitcoin Testnet" for tbtc etc. I think the other tokens would be needed but the backend doesn't return those for total coin balance I think. So I removed those for now. But probably the backend should return all coins and tokens for the total coin balance. also it sorts now correctly... but it sorts in the frontend. Other places we keep the sort as it is coming from backend (accounts), but here we don't use accounts anymore (and we shouldn't imo). If that all is good as is, I'd like to also get feedback from @Beerosagos |
actully on master it shows tokens.. need to figure out how I broke it... |
b2d2c47
to
a1fa9a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But probably the backend should return all coins and tokens for the total coin balance.
I think it should return coins only from active accounts as it currently does.
tested on both testnet and mainnet, LGTM
yes is does, I somehow thought backend doesn't show tokens totals. |
'eth-erc20-wbtc', | ||
'eth-erc20-paxg', | ||
'eth-erc20-dai0x6b17', | ||
] as accountApi.CoinCode[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not correct as type CoinCode does not include the tokens. Type casting is not ideal here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added another commit that properly types CoinOrTokenCode ... but now it's huge.
But I could remove this type cast here. 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we could also drop the 3rd crazy typescript commit and I open a separate PR, let me know
opened a new PR #2717 so that this can be merged.
Coin balance needs a list of coinCodes and some way to display the coin name. Before this change it first constructed a map that contains accounts per coin, as the name of the coin is only included in IAccount interface. Using a dedicated utils function to derive the coin name from coin codes simplifies CoinBalance component.
Before the key was just of type string, but in these cases we have proper types.
9b4e582
to
a71be33
Compare
rebased |
a71be33
to
17fb979
Compare
@strmci ack to merge? 😇 |
tACK |
The code looks good to me, but I feel like we should rely on the backend sorting if possible to avoid duplicates. CCing @benma as he also had an opinion about leaving sorting in the backend, iirc |
I also checked that option. Do you mean to add it to the |
I was thinking about enclosing the formattedAmount inside a |
I think we should re-consider doing both (visual-coin-order-sort & coin-name) in the frontend. Coin name lookup by coinCode is very simple, see this PR. Not sure the backend needs to know about human readable coinName at all. Sorting in the frontend seems to me is much easier than in the backend. Is the sorting in the backend used for anything else that showing this order in the frontend? Note: Some api's return items in an array |
I think there is some good typescript improvements in this PR. I'll try to make a separate smaller one. Backend should keep controlling sort and provide coin names, this should come from backends for example if we ever had a different UI. |
closing in favor of only typscript improvements #2733 |
Coin balance needs a list of coinCodes and some way to display the
coin name.
Before this change it first constructed a map that contains accounts
per coin, as the name of the coin is only included in IAccount
interface.
Using a dedicated utils function to derive the coin name from coin
codes simplifies CoinBalance component.
Also cleanup and type keys of various maps in 2nd commit
Before the key was just of type string, but in these cases
we have proper types.