Skip to content

Commit

Permalink
feat(cli): add confirm flag/step to burn (iron-fish#2973)
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-if authored Jan 18, 2023
1 parent f9d71f9 commit e6506e3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions ironfish-cli/src/commands/wallet/burn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export class Burn extends IronfishCommand {
char: 'i',
description: 'Identifier for the asset',
}),
confirm: Flags.boolean({
default: false,
description: 'Confirm without asking',
}),
}

async start(): Promise<void> {
Expand Down Expand Up @@ -104,6 +108,25 @@ export class Burn extends IronfishCommand {
fee = CurrencyUtils.decodeIron(input)
}

if (!flags.confirm) {
this.log(`
You are about to burn:
${CurrencyUtils.renderIron(
amount,
true,
assetId,
)} plus a transaction fee of ${CurrencyUtils.renderIron(fee, true)} with the account ${account}
* This action is NOT reversible *
`)

const confirm = await CliUx.ux.confirm('Do you confirm (Y/N)?')
if (!confirm) {
this.log('Transaction aborted.')
this.exit(0)
}
}

const bar = CliUx.ux.progress({
barCompleteChar: '\u2588',
barIncompleteChar: '\u2591',
Expand Down

0 comments on commit e6506e3

Please sign in to comment.