FuelLabs/forc-wallet

Convert asset balance to human readable format

Braqzen opened this issue · 2 comments

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}");
}
}

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.

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