add --output-document to multisign-batch (#8873)

Closes: #8870

Co-authored-by: SaReN <sahithnarahari@gmail.com>
This commit is contained in:
Alessio Treglia 2021-03-15 12:18:46 +00:00 committed by GitHub
parent d02a39739b
commit 5f71e93b1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -217,6 +217,7 @@ The SIGN_MODE_DIRECT sign mode is not supported.'
flagMultisig, "", flagMultisig, "",
"Address of the multisig account that the transaction signs on behalf of", "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) flags.AddTxFlagsToCmd(cmd)
return cmd return cmd
@ -277,6 +278,15 @@ func makeBatchMultisignCmd() func(cmd *cobra.Command, args []string) error {
txFactory = txFactory.WithAccountNumber(accnum).WithSequence(seq) 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++ { for i := 0; scanner.Scan(); i++ {
txBldr, err := txCfg.WrapTxBuilder(scanner.Tx()) txBldr, err := txCfg.WrapTxBuilder(scanner.Tx())
if err != nil { if err != nil {
@ -350,7 +360,7 @@ func makeBatchMultisignCmd() func(cmd *cobra.Command, args []string) error {
txFactory = txFactory.WithSequence(sequence) txFactory = txFactory.WithSequence(sequence)
} }
return nil return scanner.UnmarshalErr()
} }
} }

View File

@ -137,7 +137,7 @@ func makeSignBatchCmd() func(cmd *cobra.Command, args []string) error {
return err return err
} }
return scanner.Err() return scanner.UnmarshalErr()
} }
} }