Skip to content

Commit

Permalink
Make balance output consistent (#5309)
Browse files Browse the repository at this point in the history
Also remove things that are not visible in `wallet:status`
  • Loading branch information
NullSoldier committed Aug 19, 2024
1 parent 0567590 commit 00e7750
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
6 changes: 2 additions & 4 deletions ironfish-cli/src/commands/wallet/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
}),
)
}
Expand Down
30 changes: 11 additions & 19 deletions ironfish-cli/src/commands/wallet/balances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class BalancesCommand extends IronfishCommand {

let columns: TableColumns<AssetBalancePairs> = {
assetName: {
header: 'Asset Name',
header: 'Asset',
get: ({ asset }) =>
renderAssetWithVerificationStatus(
BufferUtils.toHuman(Buffer.from(asset.name, 'hex')),
Expand All @@ -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),
},
Expand All @@ -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,
},
}
}
Expand Down

0 comments on commit 00e7750

Please sign in to comment.