Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(x/bank): use cosmossdk.io/core/codec instead of github.com/cosmos/cosmos-sdk/codec #23301

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions x/bank/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import (
"errors"
"fmt"

"github.com/cosmos/cosmos-sdk/codec"
"cosmossdk.io/core/codec"

sdk "github.com/cosmos/cosmos-sdk/types"
)

Expand Down Expand Up @@ -101,7 +102,9 @@ func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.R
var genesisState GenesisState

if appState[ModuleName] != nil {
cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState)
if err := cdc.UnmarshalJSON(appState[ModuleName], &genesisState); err != nil {
panic(err)
}
}

return &genesisState
Expand Down
9 changes: 6 additions & 3 deletions x/bank/v2/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import (
"github.com/spf13/cobra"

appmodulev2 "cosmossdk.io/core/appmodule/v2"
"cosmossdk.io/core/codec"
"cosmossdk.io/core/registry"
"cosmossdk.io/x/bank/v2/client/cli"
"cosmossdk.io/x/bank/v2/keeper"
"cosmossdk.io/x/bank/v2/types"

"github.com/cosmos/cosmos-sdk/codec"
)

// ConsensusVersion defines the current x/bank/v2 module consensus version.
Expand Down Expand Up @@ -58,7 +57,11 @@ func (AppModule) RegisterInterfaces(registrar registry.InterfaceRegistrar) {

// DefaultGenesis returns default genesis state as raw bytes for the bank module.
func (am AppModule) DefaultGenesis() json.RawMessage {
return am.cdc.MustMarshalJSON(types.DefaultGenesisState())
data, err := am.cdc.MarshalJSON(types.DefaultGenesisState())
if err != nil {
panic(err)
}
return data
}

// ValidateGenesis performs genesis state validation for the bank module.
Expand Down
Loading