-
Notifications
You must be signed in to change notification settings - Fork 29
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
Token added functionality,balance and price of all tokens #118
Conversation
sajalbnl
commented
Oct 27, 2024
- issue [feat] Fetch account token balances #107 [feat] Update hardcoded token price fetching to use currenly stored tokens #106 [feat] Add a way to save and access token information in the wallet app #87
- follows contribution guide
// TODO(#106): use the accounts stored tokens instead of hardcoding | ||
coinViewModel.getTokenPrices(ids = tokens.joinToString(",") { it.name.toLowerCase() }, vsCurrencies = "usd") | ||
|
||
// TODO(#107): fetch all token balances |
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.
remove todos please
withContext(Dispatchers.Main) { | ||
balance = weiToEther(getBalance).toDoubleWithTwoDecimal() | ||
// TODO(#106): use the accounts stored tokens instead of hardcoding | ||
coinViewModel.getTokenPrices(ids = tokens.joinToString(",") { it.name.toLowerCase() }, vsCurrencies = "usd") |
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.
'toLowerCase(): String' is deprecated. Use lowercase() instead.
balance = balances.firstOrNull { balanceMap -> | ||
balanceMap.containsKey(tokens[index].name) | ||
}?.get(tokens[index].name)?: "0.0", | ||
type = tokens[index].symbol.toUpperCase() |
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.
'toUpperCase(): String' is deprecated. Use uppercase() instead.
items(tokens.size) { index-> | ||
WalletCard( | ||
icon = painterResource(id = R.drawable.ic_ethereum), | ||
amount = coinsPrices[tokens[index].name]?.let { "$ $it" } ?: "", |
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 just showing the price per token, it should show the dollar value of the users balance. So this should simply be multiplied by the balance.
LazyColumn(modifier=Modifier.height(screenHeight)) { | ||
items(tokens.size) { index-> | ||
WalletCard( | ||
icon = painterResource(id = R.drawable.ic_ethereum), |
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.
can we use an image from coingecko? otherwise we should be looking up the correct image based on the symbol
closes #125 |
Thank you! great job |