From 00e7750e9a93c3cc9c244d103d591232c197d46e Mon Sep 17 00:00:00 2001 From: Jason Spafford Date: Mon, 19 Aug 2024 12:57:10 -0700 Subject: [PATCH] Make balance output consistent (#5309) Also remove things that are not visible in `wallet:status` --- ironfish-cli/src/commands/wallet/balance.ts | 6 ++-- ironfish-cli/src/commands/wallet/balances.ts | 30 +++++++------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/ironfish-cli/src/commands/wallet/balance.ts b/ironfish-cli/src/commands/wallet/balance.ts index 213ba1343c..c2a7c117d6 100644 --- a/ironfish-cli/src/commands/wallet/balance.ts +++ b/ironfish-cli/src/commands/wallet/balance.ts @@ -102,9 +102,7 @@ Balance is your coins from all of your transactions, even if they are on forks o this.log( ui.card({ Account: response.content.account, - 'Head Hash': response.content.blockHash || 'NULL', - 'Head Sequence': response.content.sequence || 'NULL', - Available: renderedAvailable, + Balance: renderedAvailable, Confirmed: renderedConfirmed, Unconfirmed: renderedUnconfirmed, Pending: renderedPending, @@ -116,7 +114,7 @@ Balance is your coins from all of your transactions, even if they are on forks o this.log( ui.card({ Account: response.content.account, - 'Available Balance': renderedAvailable, + Balance: renderedAvailable, }), ) } diff --git a/ironfish-cli/src/commands/wallet/balances.ts b/ironfish-cli/src/commands/wallet/balances.ts index b5eeba3e65..b5073e09f7 100644 --- a/ironfish-cli/src/commands/wallet/balances.ts +++ b/ironfish-cli/src/commands/wallet/balances.ts @@ -66,7 +66,7 @@ export class BalancesCommand extends IronfishCommand { let columns: TableColumns = { assetName: { - header: 'Asset Name', + header: 'Asset', get: ({ asset }) => renderAssetWithVerificationStatus( BufferUtils.toHuman(Buffer.from(asset.name, 'hex')), @@ -76,12 +76,8 @@ export class BalancesCommand extends IronfishCommand { }, ), }, - 'asset.id': { - header: 'Asset Id', - get: ({ asset }) => asset.id, - }, available: { - header: 'Available Balance', + header: 'Balance', get: ({ asset, balance }) => CurrencyUtils.render(balance.available, false, asset.id, asset.verification), }, @@ -90,32 +86,28 @@ export class BalancesCommand extends IronfishCommand { if (flags.all) { columns = { ...columns, - availableNotes: { - header: 'Available Notes', - get: ({ balance }) => balance.availableNoteCount, - }, confirmed: { - header: 'Confirmed Balance', + header: 'Confirmed', get: ({ asset, balance }) => CurrencyUtils.render(balance.confirmed, false, asset.id, asset.verification), }, unconfirmed: { - header: 'Unconfirmed Balance', + header: 'Unconfirmed', get: ({ asset, balance }) => CurrencyUtils.render(balance.unconfirmed, false, asset.id, asset.verification), }, pending: { - header: 'Pending Balance', + header: 'Pending', get: ({ asset, balance }) => CurrencyUtils.render(balance.pending, false, asset.id, asset.verification), }, - blockHash: { - header: 'Head Hash', - get: ({ balance }) => balance.blockHash || 'NULL', + availableNotes: { + header: 'Notes', + get: ({ balance }) => balance.availableNoteCount, }, - sequence: { - header: 'Head Sequence', - get: ({ balance }) => balance.sequence || 'NULL', + 'asset.id': { + header: 'Asset Id', + get: ({ asset }) => asset.id, }, } }