Skip to content
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

Merged
merged 5 commits into from
Nov 2, 2024

Conversation

// 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
Copy link
Collaborator

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")
Copy link
Collaborator

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()
Copy link
Collaborator

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" } ?: "",
Copy link
Collaborator

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),
Copy link
Collaborator

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

@trbutler4
Copy link
Collaborator

closes #125

@trbutler4 trbutler4 merged commit d393991 into keep-starknet-strange:main Nov 2, 2024
1 check failed
@trbutler4
Copy link
Collaborator

Thank you! great job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants