From 4c54d96e40ddf6476e4433286a6c777662d609a7 Mon Sep 17 00:00:00 2001 From: Rahul Patni Date: Thu, 18 Apr 2024 16:04:31 -0500 Subject: [PATCH] Standardizing post CLI command (#4911) 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 --- ironfish-cli/src/commands/wallet/post.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ironfish-cli/src/commands/wallet/post.ts b/ironfish-cli/src/commands/wallet/post.ts index 69b862c4b1..4235410d19 100644 --- a/ironfish-cli/src/commands/wallet/post.ts +++ b/ironfish-cli/src/commands/wallet/post.ts @@ -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' @@ -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({ @@ -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 { 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)