Skip to content

Commit

Permalink
move args to be above flags in wallet command definitions (#5259)
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-if authored Aug 14, 2024
1 parent abbf3f9 commit ab0847b
Show file tree
Hide file tree
Showing 15 changed files with 100 additions and 100 deletions.
8 changes: 4 additions & 4 deletions ironfish-cli/src/commands/wallet/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ export class AddressCommand extends IronfishCommand {
The address for an account is the accounts public key, see more here: https://ironfish.network/docs/whitepaper/5_account`

static flags = {
...RemoteFlags,
}

static args = {
account: Args.string({
required: false,
description: 'Name of the account to get the address for',
}),
}

static flags = {
...RemoteFlags,
}

async start(): Promise<void> {
const { args } = await this.parse(AddressCommand)
const { account } = args
Expand Down
14 changes: 7 additions & 7 deletions ironfish-cli/src/commands/wallet/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ const MIN_ASSET_NAME_COLUMN_WIDTH = ASSET_NAME_LENGTH / 2 + 1
export class AssetsCommand extends IronfishCommand {
static description = `Display the wallet's assets`

static args = {
account: Args.string({
required: false,
description: 'Name of the account. DEPRECATED: use --account flag',
}),
}

static flags = {
...RemoteFlags,
...TableFlags,
Expand All @@ -34,13 +41,6 @@ export class AssetsCommand extends IronfishCommand {
}),
}

static args = {
account: Args.string({
required: false,
description: 'Name of the account. DEPRECATED: use --account flag',
}),
}

async start(): Promise<void> {
const { flags, args } = await this.parse(AssetsCommand)
// TODO: remove account arg
Expand Down
14 changes: 7 additions & 7 deletions ironfish-cli/src/commands/wallet/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ export class BalanceCommand extends IronfishCommand {
Available to spend balance is your coins from transactions that have been mined on blocks on your main chain.\n\
Balance is your coins from all of your transactions, even if they are on forks or not yet included as part of a mined block.'

static args = {
account: Args.string({
required: false,
description: 'Name of the account to get balance for. DEPRECATED: use --account flag',
}),
}

static flags = {
...RemoteFlags,
account: Flags.string({
Expand All @@ -39,13 +46,6 @@ export class BalanceCommand extends IronfishCommand {
}),
}

static args = {
account: Args.string({
required: false,
description: 'Name of the account to get balance for. DEPRECATED: use --account flag',
}),
}

async start(): Promise<void> {
const { flags, args } = await this.parse(BalanceCommand)
// TODO: remove account arg
Expand Down
14 changes: 7 additions & 7 deletions ironfish-cli/src/commands/wallet/balances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ type AssetBalancePairs = { asset: RpcAsset; balance: GetBalancesResponse['balanc
export class BalancesCommand extends IronfishCommand {
static description = `Display the account's balances for all assets`

static args = {
account: Args.string({
required: false,
description: 'Name of the account to get balances for. DEPRECATED: use --account flag',
}),
}

static flags = {
...RemoteFlags,
...TableFlags,
Expand All @@ -30,13 +37,6 @@ export class BalancesCommand extends IronfishCommand {
}),
}

static args = {
account: Args.string({
required: false,
description: 'Name of the account to get balances for. DEPRECATED: use --account flag',
}),
}

async start(): Promise<void> {
const { flags, args } = await this.parse(BalancesCommand)
const client = await this.connectRpc()
Expand Down
14 changes: 7 additions & 7 deletions ironfish-cli/src/commands/wallet/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ export class ExportCommand extends IronfishCommand {
static description = `Export an account`
static enableJsonFlag = true

static args = {
account: Args.string({
required: false,
description: 'Name of the account to export',
}),
}

static flags = {
...RemoteFlags,
...JsonFlags,
Expand All @@ -39,13 +46,6 @@ export class ExportCommand extends IronfishCommand {
}),
}

static args = {
account: Args.string({
required: false,
description: 'Name of the account to export',
}),
}

async start(): Promise<unknown> {
const { flags, args } = await this.parse(ExportCommand)
const { local, path: exportPath, viewonly: viewOnly } = flags
Expand Down
14 changes: 7 additions & 7 deletions ironfish-cli/src/commands/wallet/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ import { Ledger } from '../../utils/ledger'
export class ImportCommand extends IronfishCommand {
static description = `Import an account`

static args = {
blob: Args.string({
required: false,
description: 'The copy-pasted output of wallet:export; or, a raw spending key',
}),
}

static flags = {
...RemoteFlags,
rescan: Flags.boolean({
Expand All @@ -40,13 +47,6 @@ export class ImportCommand extends IronfishCommand {
}),
}

static args = {
blob: Args.string({
required: false,
description: 'The copy-pasted output of wallet:export; or, a raw spending key',
}),
}

async start(): Promise<void> {
const { flags, args } = await this.parse(ImportCommand)
const { blob } = args
Expand Down
14 changes: 7 additions & 7 deletions ironfish-cli/src/commands/wallet/notes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ const { sort: _, ...tableFlags } = TableFlags
export class NotesCommand extends IronfishCommand {
static description = `Display the account notes`

static args = {
account: Args.string({
required: false,
description: 'Name of the account to get notes for. DEPRECATED: use --account flag',
}),
}

static flags = {
...RemoteFlags,
...tableFlags,
Expand All @@ -21,13 +28,6 @@ export class NotesCommand extends IronfishCommand {
}),
}

static args = {
account: Args.string({
required: false,
description: 'Name of the account to get notes for. DEPRECATED: use --account flag',
}),
}

async start(): Promise<void> {
const { flags, args } = await this.parse(NotesCommand)
// TODO: remove account arg
Expand Down
14 changes: 7 additions & 7 deletions ironfish-cli/src/commands/wallet/reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import { confirmOrQuit } from '../../ui'
export class ResetCommand extends IronfishCommand {
static description = `Resets the transaction of an account but keeps all keys.`

static args = {
account: Args.string({
required: true,
description: 'Name of the account to reset',
}),
}

static flags = {
...RemoteFlags,
resetCreated: Flags.boolean({
Expand All @@ -26,13 +33,6 @@ export class ResetCommand extends IronfishCommand {
}),
}

static args = {
account: Args.string({
required: true,
description: 'Name of the account to reset',
}),
}

async start(): Promise<void> {
const { args, flags } = await this.parse(ResetCommand)
const { account } = args
Expand Down
8 changes: 4 additions & 4 deletions ironfish-cli/src/commands/wallet/scanning/off.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import { RemoteFlags } from '../../../flags'
export class ScanningOffCommand extends IronfishCommand {
static description = `Turn off scanning for an account. The wallet will no longer scan the blockchain for new account transactions.`

static flags = {
...RemoteFlags,
}

static args = {
account: Args.string({
required: true,
description: 'Name of the account to update',
}),
}

static flags = {
...RemoteFlags,
}

async start(): Promise<void> {
const { args } = await this.parse(ScanningOffCommand)
const { account } = args
Expand Down
8 changes: 4 additions & 4 deletions ironfish-cli/src/commands/wallet/scanning/on.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import { RemoteFlags } from '../../../flags'
export class ScanningOnCommand extends IronfishCommand {
static description = `Turn on scanning for an account. Scanning is on by default. The wallet will scan the blockchain for new account transactions.`

static flags = {
...RemoteFlags,
}

static args = {
account: Args.string({
required: true,
description: 'Name of the account to update',
}),
}

static flags = {
...RemoteFlags,
}

async start(): Promise<void> {
const { args } = await this.parse(ScanningOnCommand)
const { account } = args
Expand Down
14 changes: 7 additions & 7 deletions ironfish-cli/src/commands/wallet/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ const { sort: _, ...tableFlags } = TableFlags
export class TransactionsCommand extends IronfishCommand {
static description = `Display the account transactions`

static args = {
account: Args.string({
required: false,
description: 'Name of the account. DEPRECATED: use --account flag',
}),
}

static flags = {
...RemoteFlags,
...tableFlags,
Expand Down Expand Up @@ -52,13 +59,6 @@ export class TransactionsCommand extends IronfishCommand {
}),
}

static args = {
account: Args.string({
required: false,
description: 'Name of the account. DEPRECATED: use --account flag',
}),
}

async start(): Promise<void> {
const { flags, args } = await this.parse(TransactionsCommand)
// TODO: remove account arg
Expand Down
14 changes: 7 additions & 7 deletions ironfish-cli/src/commands/wallet/transactions/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ export class TransactionsImportCommand extends IronfishCommand {

static hiddenAliases = ['wallet:transaction:add', 'wallet:transaction:import']

static args = {
transaction: Args.string({
required: false,
description: 'The transaction in hex encoding',
}),
}

static flags = {
...RemoteFlags,
path: Flags.string({
Expand All @@ -23,13 +30,6 @@ export class TransactionsImportCommand extends IronfishCommand {
}),
}

static args = {
transaction: Args.string({
required: false,
description: 'The transaction in hex encoding',
}),
}

async start(): Promise<void> {
const { flags, args } = await this.parse(TransactionsImportCommand)
const { transaction: txArg } = args
Expand Down
16 changes: 8 additions & 8 deletions ironfish-cli/src/commands/wallet/transactions/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ export class TransactionInfoCommand extends IronfishCommand {

static hiddenAliases = ['wallet:transaction']

static flags = {
...RemoteFlags,
account: Flags.string({
char: 'a',
description: 'Name of the account to get transaction details for',
}),
}

static args = {
hash: Args.string({
required: true,
Expand All @@ -45,6 +37,14 @@ export class TransactionInfoCommand extends IronfishCommand {
}),
}

static flags = {
...RemoteFlags,
account: Flags.string({
char: 'a',
description: 'Name of the account to get transaction details for',
}),
}

async start(): Promise<void> {
const { flags, args } = await this.parse(TransactionInfoCommand)
const { hash } = args
Expand Down
12 changes: 6 additions & 6 deletions ironfish-cli/src/commands/wallet/transactions/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ export class TransactionsPostCommand extends IronfishCommand {

static hiddenAliases = ['wallet:post']

static args = {
transaction: Args.string({
description: 'The raw transaction in hex encoding',
}),
}

static flags = {
...RemoteFlags,
account: Flags.string({
Expand All @@ -40,12 +46,6 @@ export class TransactionsPostCommand extends IronfishCommand {
}),
}

static args = {
transaction: Args.string({
description: 'The raw transaction in hex encoding',
}),
}

async start(): Promise<void> {
const { flags, args } = await this.parse(TransactionsPostCommand)
let transaction = args.transaction
Expand Down
Loading

0 comments on commit ab0847b

Please sign in to comment.