Skip to content

Commit

Permalink
fix autocli options
Browse files Browse the repository at this point in the history
  • Loading branch information
pwnfoo committed Jan 23, 2025
1 parent 9fd7f3a commit dc124ba
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ This repository hosts `nyxd`, a Cosmos zone with wasm smart contracts enabled. I
This code was forked from the `cosmwasm/wasmd` repository, which was itself forked from `cosmos/gaiad` as a basis by the CosmWasm project. They then added `x/wasm` and cleaned up
many gaia-specific files. However, the `nyxd` binary should function just like `gaiad` except for the addition of the `x/wasm` module.

**Note**: Requires [Go 1.20.10](https://golang.org/dl/)

**Note**: The mainnet binary in the releases is built with `Go 1.20.10` so if you plan on building from source please use that version!
**Note**: Requires [Go 1.23.5](https://golang.org/dl/). The mainnet binary in the releases is built with `Go 1.23.5` so if you plan on building from source please use that version!

⚠️ Using other versions of Go may result in non-determinism (app-hash issues)

Expand Down
29 changes: 16 additions & 13 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ import (
"cosmossdk.io/x/upgrade"
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
upgradetypes "cosmossdk.io/x/upgrade/types"
signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing"
txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -395,19 +397,20 @@ func NewWasmApp(
)

// enable sign mode textual by overwriting the default tx config (after setting the bank keeper)
// enabledSignModes := append(tx.DefaultSignModes, sigtypes.SignMode_SIGN_MODE_TEXTUAL)
// txConfigOpts := tx.ConfigOptions{
// EnabledSignModes: enabledSignModes,
// TextualCoinMetadataQueryFn: txmodule.NewBankKeeperCoinMetadataQueryFn(app.BankKeeper),
// }
// txConfig, err := tx.NewTxConfigWithOptions(
// appCodec,
// txConfigOpts,
// )
// if err != nil {
// panic(err)
// }
// app.txConfig = txConfig
enabledSignModes := append(authtx.DefaultSignModes, signingtypes.SignMode_SIGN_MODE_TEXTUAL)

txConfigOpts := authtx.ConfigOptions{
EnabledSignModes: enabledSignModes,
TextualCoinMetadataQueryFn: txmodule.NewBankKeeperCoinMetadataQueryFn(app.BankKeeper),
}
txConfig, err = authtx.NewTxConfigWithOptions(
appCodec,
txConfigOpts,
)
if err != nil {
panic(err)
}
app.txConfig = txConfig

app.StakingKeeper = stakingkeeper.NewKeeper(
appCodec,
Expand Down
8 changes: 6 additions & 2 deletions cmd/nyxd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
authtxconfig "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
Expand Down Expand Up @@ -86,7 +86,7 @@ func NewRootCmd() *cobra.Command {
enabledSignModes := append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL)
txConfigOpts := tx.ConfigOptions{
EnabledSignModes: enabledSignModes,
TextualCoinMetadataQueryFn: txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx),
TextualCoinMetadataQueryFn: authtxconfig.NewGRPCCoinMetadataQueryFn(initClientCtx),
}
txConfig, err := tx.NewTxConfigWithOptions(
initClientCtx.Codec,
Expand Down Expand Up @@ -117,6 +117,10 @@ func NewRootCmd() *cobra.Command {
initClientCtx, _ = config.ReadFromClientConfig(initClientCtx)
autoCliOpts.Keyring, _ = keyring.NewAutoCLIKeyring(initClientCtx.Keyring)
autoCliOpts.ClientCtx = initClientCtx
autoCliOpts.TxConfigOpts = tx.ConfigOptions{
EnabledSignModes: tx.DefaultSignModes,
TextualCoinMetadataQueryFn: authtxconfig.NewGRPCCoinMetadataQueryFn(initClientCtx),
}

if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil {
panic(err)
Expand Down

0 comments on commit dc124ba

Please sign in to comment.