Skip to content

Commit

Permalink
fix(#6): code issue of keys add recover (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeNinjaX authored Nov 13, 2024
1 parent 011eabd commit a151dbc
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/codec.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package app

import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdktypes "github.com/cosmos/cosmos-sdk/types"

crypto "github.com/artela-network/artela-rollkit/ethereum/crypto/codec"
"github.com/artela-network/artela-rollkit/ethereum/types"
Expand All @@ -12,3 +14,10 @@ func RegisterInterfaces(interfaceRegistry codectypes.InterfaceRegistry) {
crypto.RegisterInterfaces(interfaceRegistry)
types.RegisterInterfaces(interfaceRegistry)
}

// RegisterLegacyAminoCodec registers Interfaces from types, crypto, and SDK std.
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
sdktypes.RegisterLegacyAminoCodec(cdc)
crypto.RegisterCrypto(cdc)
codec.RegisterEvidences(cdc)
}
30 changes: 30 additions & 0 deletions app/encoding.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package app

import (
amino "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth/tx"

"github.com/artela-network/artela-rollkit/app/params"
)

// MakeConfig creates an EncodingConfig for testing
func MakeConfig(mb module.BasicManager) params.EncodingConfig {
cdc := amino.NewLegacyAmino()
interfaceRegistry := types.NewInterfaceRegistry()
codec := amino.NewProtoCodec(interfaceRegistry)

encodingConfig := params.EncodingConfig{
InterfaceRegistry: interfaceRegistry,
Marshaler: codec,
TxConfig: tx.NewTxConfig(codec, tx.DefaultSignModes),
Amino: cdc,
}

RegisterLegacyAminoCodec(encodingConfig.Amino)
mb.RegisterLegacyAminoCodec(encodingConfig.Amino)
RegisterInterfaces(encodingConfig.InterfaceRegistry)
mb.RegisterInterfaces(encodingConfig.InterfaceRegistry)
return encodingConfig
}
3 changes: 3 additions & 0 deletions cmd/artrolld/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ func NewRootCmd() *cobra.Command {
autoCliOpts.Modules[name] = mod
}

// RegisterInterfaces & RegisterLegacyAminoCodec
app.MakeConfig(moduleBasicManager)

initRootCmd(rootCmd, clientCtx.TxConfig, moduleBasicManager)

overwriteFlagDefaults(rootCmd, map[string]string{
Expand Down

0 comments on commit a151dbc

Please sign in to comment.