Skip to content

Commit

Permalink
SIGN_MODE_TEXTUAL
Browse files Browse the repository at this point in the history
  • Loading branch information
valli0x committed Oct 15, 2024
1 parent 074cba5 commit bd34d55
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions cmd/galacticad/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ import (
// ethertypes "github.com/evmos/ethermint/types"

"github.com/Galactica-corp/galactica/app"
authtxconfig "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
txsign "github.com/cosmos/cosmos-sdk/types/tx/signing"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
"slices"
appparams "github.com/Galactica-corp/galactica/app/params"
"github.com/Galactica-corp/galactica/cmd/galacticad/cmd/ethkeys"
dbm "github.com/cosmos/cosmos-db"
Expand Down Expand Up @@ -120,6 +124,27 @@ func NewRootCmd() (*cobra.Command, appparams.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 {
enabledSignModes := slices.Clone(authtx.DefaultSignModes)
enabledSignModes = append(enabledSignModes, txsign.SignMode_SIGN_MODE_TEXTUAL)
txConfigOpts := authtx.ConfigOptions{
EnabledSignModes: enabledSignModes,
TextualCoinMetadataQueryFn: authtxconfig.NewGRPCCoinMetadataQueryFn(initClientCtx),
}
txConfig, err := authtx.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 bd34d55

Please sign in to comment.