Skip to content

Commit

Permalink
fix: miss handler SignMode_SIGN_MODE_TEXTUAL (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoank101 committed Jun 7, 2024
1 parent faacee9 commit 70dbbc1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions cmd/picad/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import (
"io"
"os"

"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/tx"

"github.com/cosmos/cosmos-sdk/crypto/keyring"
txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config"

"cosmossdk.io/log"
tmcli "github.com/cometbft/cometbft/libs/cli"
Expand Down Expand Up @@ -91,6 +95,25 @@ func NewRootCmd() (*cobra.Command, app.EncodingConfig) {
return err
}

// This needs to go after ReadFromClientConfig, as that function
// sets the RPC client needed for SIGN_MODE_TEXTUAL. This sign mode
// is only available if the client is online.
if !initClientCtx.Offline {
txConfigOpts := tx.ConfigOptions{
EnabledSignModes: append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL),
TextualCoinMetadataQueryFn: txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx),
}
txConfig, err := tx.NewTxConfigWithOptions(
initClientCtx.Codec,
txConfigOpts,
)
if err != nil {
return err
}

initClientCtx = initClientCtx.WithTxConfig(txConfig)
}

if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil {
return err
}
Expand Down

0 comments on commit 70dbbc1

Please sign in to comment.