Remove TxBuilder references to viper. (#6653)

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
This commit is contained in:
Jonathan Gimeno
2020-07-10 11:05:35 +02:00
committed by GitHub
co-authored by Alexander Bezobchuk Federico Kunze Alessio Treglia
parent 255ed06eb4
commit 6ceedc9e4f
6 changed files with 24 additions and 38 deletions
+5 -1
View File
@@ -15,6 +15,7 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/crypto/types/multisig"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/version"
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
"github.com/cosmos/cosmos-sdk/x/auth/types"
@@ -83,7 +84,10 @@ func makeMultiSignCmd(clientCtx client.Context) func(cmd *cobra.Command, args []
multisigPub := multisigInfo.GetPubKey().(multisig.PubKeyMultisigThreshold)
multisigSig := multisig.NewMultisig(len(multisigPub.PubKeys))
txBldr := types.NewTxBuilderFromCLI(inBuf)
txBldr, err := types.NewTxBuilderFromFlags(inBuf, cmd.Flags(), homeDir)
if err != nil {
return errors.Wrap(err, "error creating tx builder from flags")
}
if !clientCtx.Offline {
accnum, seq, err := types.NewAccountRetriever(authclient.Codec).GetAccountNumberSequence(clientCtx, multisigInfo.GetAddress())
+8 -3
View File
@@ -63,12 +63,16 @@ account key. It implies --signature-only.
func makeSignBatchCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) error {
return func(cmd *cobra.Command, args []string) error {
inBuf := bufio.NewReader(cmd.InOrStdin())
clientCtx := client.NewContextWithInput(inBuf).WithCodec(cdc)
txBldr := types.NewTxBuilderFromCLI(inBuf)
clientCtx := client.GetClientContextFromCmd(cmd)
txBldr, err := types.NewTxBuilderFromFlags(inBuf, cmd.Flags(), clientCtx.HomeDir)
if err != nil {
return err
}
generateSignatureOnly, _ := cmd.Flags().GetBool(flagSigOnly)
var (
err error
multisigAddr sdk.AccAddress
infile = os.Stdin
)
@@ -184,6 +188,7 @@ be generated via the 'multisign' command.
)
cmd.Flags().Bool(flagSigOnly, false, "Print only the generated signature, then exit")
cmd.Flags().String(flags.FlagOutputDocument, "", "The document will be written to the given file instead of STDOUT")
cmd.Flags().String(flags.FlagHome, "", "The application home directory")
cmd = flags.PostCommands(cmd)[0]
cmd.MarkFlagRequired(flags.FlagFrom)
+6 -2
View File
@@ -142,8 +142,12 @@ func readStdTxAndInitContexts(clientCtx client.Context, cmd *cobra.Command, file
}
inBuf := bufio.NewReader(cmd.InOrStdin())
clientCtx = clientCtx.InitWithInput(inBuf)
txBldr := types.NewTxBuilderFromCLI(inBuf)
clientCtx = clientCtx.WithInput(inBuf)
txBldr, err := types.NewTxBuilderFromFlags(inBuf, cmd.Flags(), clientCtx.HomeDir)
if err != nil {
return client.Context{}, types.TxBuilder{}, types.StdTx{}, err
}
return clientCtx, txBldr, stdTx, nil
}