fix: set from address in cli context (#695)

This commit is contained in:
Kevin Davis 2020-10-16 15:42:09 -04:00 committed by GitHub
parent 6a0cc6c49d
commit 9654f9d086
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,16 +38,16 @@ func getCmdClaim(cdc *codec.Codec) *cobra.Command {
Use: "claim [owner] [denom]", Use: "claim [owner] [denom]",
Short: "claim rewards for owner and denom", Short: "claim rewards for owner and denom",
Long: strings.TrimSpace( Long: strings.TrimSpace(
fmt.Sprintf(`Claim any outstanding rewards owned by owner for the input denom, fmt.Sprintf(`Claim any outstanding rewards owned by owner for the input collateral-type and multiplier,
Example: Example:
$ %s tx %s claim kava15qdefkmwswysgg4qxgqpqr35k3m49pkx2jdfnw bnb $ %s tx %s claim kava15qdefkmwswysgg4qxgqpqr35k3m49pkx2jdfnw bnb-a large
`, version.ClientName, types.ModuleName), `, version.ClientName, types.ModuleName),
), ),
Args: cobra.ExactArgs(3), Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
inBuf := bufio.NewReader(cmd.InOrStdin()) inBuf := bufio.NewReader(cmd.InOrStdin())
cliCtx := context.NewCLIContext().WithCodec(cdc) cliCtx := context.NewCLIContextWithInputAndFrom(inBuf, args[0]).WithCodec(cdc)
txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc))
owner, err := sdk.AccAddressFromBech32(args[0]) owner, err := sdk.AccAddressFromBech32(args[0])
if err != nil { if err != nil {