From 57d05eef588414d7928119e11fd2de40a64f7607 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 24 Oct 2023 22:23:46 +0200 Subject: [PATCH] updates --- client/tx/tx.go | 7 ++----- client/v2/autocli/msg.go | 7 ++++--- client/v2/go.mod | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/client/tx/tx.go b/client/tx/tx.go index b9335ee8cc0e..f71111829627 100644 --- a/client/tx/tx.go +++ b/client/tx/tx.go @@ -126,8 +126,7 @@ func BroadcastTx(clientCtx client.Context, txf Factory, msgs ...sdk.Msg) error { } } - err = Sign(clientCtx.CmdContext, txf, clientCtx.FromName, tx, true) - if err != nil { + if err = Sign(clientCtx.CmdContext, txf, clientCtx.FromName, tx, true); err != nil { return err } @@ -323,9 +322,7 @@ func Sign(ctx context.Context, txf Factory, name string, txBuilder client.TxBuil return err } - bytesToSign, err := authsigning.GetSignBytesAdapter( - ctx, txf.txConfig.SignModeHandler(), - signMode, signerData, txBuilder.GetTx()) + bytesToSign, err := authsigning.GetSignBytesAdapter(ctx, txf.txConfig.SignModeHandler(), signMode, signerData, txBuilder.GetTx()) if err != nil { return err } diff --git a/client/v2/autocli/msg.go b/client/v2/autocli/msg.go index 8b484382002f..5bad6e1817ff 100644 --- a/client/v2/autocli/msg.go +++ b/client/v2/autocli/msg.go @@ -6,7 +6,6 @@ import ( "github.com/cockroachdb/errors" "github.com/spf13/cobra" - "golang.org/x/exp/slices" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/types/dynamicpb" @@ -118,8 +117,10 @@ func (b *Builder) BuildMsgMethodCommand(descriptor protoreflect.MethodDescriptor clientCtx = clientCtx.WithCmdContext(cmd.Context()) clientCtx = clientCtx.WithOutput(cmd.OutOrStdout()) - // enable sign mode textual and config tx options if not already enabled - if !clientCtx.Offline && !slices.Contains(b.TxConfigOpts.EnabledSignModes, signing.SignMode_SIGN_MODE_TEXTUAL) { + // enable sign mode textual + // the config is always overwritten as we need to have set the flags to the client context + // this ensures that the context has the correct client. + if !clientCtx.Offline { b.TxConfigOpts.EnabledSignModes = append(b.TxConfigOpts.EnabledSignModes, signing.SignMode_SIGN_MODE_TEXTUAL) b.TxConfigOpts.TextualCoinMetadataQueryFn = authtxconfig.NewGRPCCoinMetadataQueryFn(clientCtx) diff --git a/client/v2/go.mod b/client/v2/go.mod index 35e3f2a5837e..35a3aa9a6d29 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -13,7 +13,6 @@ require ( github.com/cosmos/gogoproto v1.4.11 github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 - golang.org/x/exp v0.0.0-20231006140011-7918f672742d google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 gotest.tools/v3 v3.5.1 @@ -140,6 +139,7 @@ require ( go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.14.0 // indirect + golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.13.0 // indirect