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

Convert asset balance to human readable format #142

Open
Braqzen opened this issue Nov 6, 2023 · 2 comments
Open

Convert asset balance to human readable format #142

Braqzen opened this issue Nov 6, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Braqzen
Copy link
Contributor

Braqzen commented Nov 6, 2023

After creating a new account and getting funds from the beta-4 faucet the balance on my account 0.5 ETH.

Running the command

forc wallet account 0 balance

The balance of the 0th account is shown as seen in the attached image.
The asset is 0x00... and the displayed balance is 500000000 instead of something like 0.500000...

1

In the following code snippet we should perform a check and format the value instead of iterating and directly displaying the value to the user.

forc-wallet/src/account.rs

Lines 259 to 266 in d6a4798

pub(crate) fn print_balance(balance: &BTreeMap<String, u128>) {
let asset_id_header = "Asset ID";
let amount_header = "Amount";
println!(" {asset_id_header:66} {amount_header}");
for (asset_id, amount) in balance {
println!(" {asset_id} {amount}");
}
}

@Braqzen Braqzen added the enhancement New feature or request label Nov 6, 2023
@HoTandy
Copy link

HoTandy commented Feb 20, 2024

Hi there, I've also noticed this problem, thanks for raising it. I would add:

  • A unit should be given for the amount, for example Gwei, microETH or ETH.
  • Asset ID should provide more clarity, not just 64 '0's. Maybe it should be Asset Name so the user understand what the asset is.
  • Is there any point in having Asset ID?

I would also suggest that this is a bug, not an enhancement.

@HoTandy
Copy link

HoTandy commented Mar 19, 2024

@luizstacio is this, or should it be, classed as Edge? Users see this as they're stepping through the Online Guides.

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

No branches or pull requests

2 participants