From 5f71e93b1e0f9a7d9617f5ea88f5c18b73361a7b Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Mon, 15 Mar 2021 12:18:46 +0000 Subject: [PATCH] add --output-document to multisign-batch (#8873) Closes: #8870 Co-authored-by: SaReN --- x/auth/client/cli/tx_multisign.go | 12 +++++++++++- x/auth/client/cli/tx_sign.go | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/x/auth/client/cli/tx_multisign.go b/x/auth/client/cli/tx_multisign.go index c04d37123c2..7fdcace968f 100644 --- a/x/auth/client/cli/tx_multisign.go +++ b/x/auth/client/cli/tx_multisign.go @@ -217,6 +217,7 @@ The SIGN_MODE_DIRECT sign mode is not supported.' flagMultisig, "", "Address of the multisig account that the transaction signs on behalf of", ) + cmd.Flags().String(flags.FlagOutputDocument, "", "The document is written to the given file instead of STDOUT") flags.AddTxFlagsToCmd(cmd) return cmd @@ -277,6 +278,15 @@ func makeBatchMultisignCmd() func(cmd *cobra.Command, args []string) error { txFactory = txFactory.WithAccountNumber(accnum).WithSequence(seq) } + // prepare output document + closeFunc, err := setOutputFile(cmd) + if err != nil { + return err + } + + defer closeFunc() + clientCtx.WithOutput(cmd.OutOrStdout()) + for i := 0; scanner.Scan(); i++ { txBldr, err := txCfg.WrapTxBuilder(scanner.Tx()) if err != nil { @@ -350,7 +360,7 @@ func makeBatchMultisignCmd() func(cmd *cobra.Command, args []string) error { txFactory = txFactory.WithSequence(sequence) } - return nil + return scanner.UnmarshalErr() } } diff --git a/x/auth/client/cli/tx_sign.go b/x/auth/client/cli/tx_sign.go index 95555451212..f814f9b99a4 100644 --- a/x/auth/client/cli/tx_sign.go +++ b/x/auth/client/cli/tx_sign.go @@ -137,7 +137,7 @@ func makeSignBatchCmd() func(cmd *cobra.Command, args []string) error { return err } - return scanner.Err() + return scanner.UnmarshalErr() } }