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

Account name for balance command is arg #5666

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions ironfish-cli/src/commands/wallet/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import { CurrencyUtils, GetBalanceResponse, isNativeIdentifier, RpcAsset } from '@ironfish/sdk'
import { Flags } from '@oclif/core'
import { Args, Flags } from '@oclif/core'
import { IronfishCommand } from '../../command'
import { RemoteFlags } from '../../flags'
import * as ui from '../../ui'
Expand All @@ -27,12 +27,15 @@ Balance is your coins from all of your transactions, even if they are on forks o
},
]

static flags = {
...RemoteFlags,
account: Flags.string({
char: 'a',
static args = {
account: Args.string({
required: false,
description: 'Name of the account to get balance for',
}),
}

static flags = {
...RemoteFlags,
explain: Flags.boolean({
default: false,
description: 'Explain your balance',
Expand All @@ -50,12 +53,12 @@ Balance is your coins from all of your transactions, even if they are on forks o
}

async start(): Promise<void> {
const { flags } = await this.parse(BalanceCommand)
const { flags, args } = await this.parse(BalanceCommand)

const client = await this.connectRpc()
await ui.checkWalletUnlocked(client)

const account = await useAccount(client, flags.account)
const account = await useAccount(client, args.account)

const response = await client.wallet.getAccountBalance({
account,
Expand Down