Skip to content

Commit

Permalink
Standardizing post CLI command (#4911)
Browse files Browse the repository at this point in the history
Adds a -f flag to specify the account the transaction is being sent from
The raw transaction input is not optional and can be entered using a long prompt
  • Loading branch information
patnir authored Apr 18, 2024
1 parent 695087c commit 4c54d96
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ironfish-cli/src/commands/wallet/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { CliUx, Flags } from '@oclif/core'
import { IronfishCommand } from '../../command'
import { RemoteFlags } from '../../flags'
import { longPrompt } from '../../utils/longPrompt'

export class PostCommand extends IronfishCommand {
static summary = 'Post a raw transaction'
Expand All @@ -26,6 +27,7 @@ export class PostCommand extends IronfishCommand {
...RemoteFlags,
account: Flags.string({
description: 'The account that created the raw transaction',
char: 'f',
required: false,
}),
confirm: Flags.boolean({
Expand All @@ -42,14 +44,19 @@ export class PostCommand extends IronfishCommand {
static args = [
{
name: 'transaction',
required: true,
description: 'The raw transaction in hex encoding',
},
]

async start(): Promise<void> {
const { flags, args } = await this.parse(PostCommand)
const transaction = args.transaction as string
let transaction = args.transaction as string | undefined

if (!transaction) {
transaction = await longPrompt('Enter the raw transaction in hex encoding', {
required: true,
})
}

const serialized = Buffer.from(transaction, 'hex')
const raw = RawTransactionSerde.deserialize(serialized)
Expand Down

0 comments on commit 4c54d96

Please sign in to comment.