32 lines
1.0 KiB
Go
32 lines
1.0 KiB
Go
package encoding
|
|
|
|
import (
|
|
amino "github.com/cosmos/cosmos-sdk/codec"
|
|
"github.com/cosmos/cosmos-sdk/codec/types"
|
|
"github.com/cosmos/cosmos-sdk/simapp/params"
|
|
"github.com/cosmos/cosmos-sdk/types/module"
|
|
"github.com/cosmos/cosmos-sdk/x/auth/tx"
|
|
|
|
enccodec "github.com/evmos/ethermint/encoding/codec"
|
|
)
|
|
|
|
// MakeConfig creates an EncodingConfig for testing
|
|
func MakeConfig(mb module.BasicManager) params.EncodingConfig {
|
|
cdc := amino.NewLegacyAmino()
|
|
interfaceRegistry := types.NewInterfaceRegistry()
|
|
marshaler := amino.NewProtoCodec(interfaceRegistry)
|
|
|
|
encodingConfig := params.EncodingConfig{
|
|
InterfaceRegistry: interfaceRegistry,
|
|
Marshaler: marshaler,
|
|
TxConfig: tx.NewTxConfig(marshaler, tx.DefaultSignModes),
|
|
Amino: cdc,
|
|
}
|
|
|
|
enccodec.RegisterLegacyAminoCodec(encodingConfig.Amino)
|
|
mb.RegisterLegacyAminoCodec(encodingConfig.Amino)
|
|
enccodec.RegisterInterfaces(encodingConfig.InterfaceRegistry)
|
|
mb.RegisterInterfaces(encodingConfig.InterfaceRegistry)
|
|
return encodingConfig
|
|
}
|