33 lines
1.0 KiB
Go
33 lines
1.0 KiB
Go
package encoding
|
|
|
|
import (
|
|
"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/tharsis/ethermint/encoding/codec"
|
|
)
|
|
|
|
// MakeConfig creates an EncodingConfig for testing
|
|
func MakeConfig(mb module.BasicManager) params.EncodingConfig {
|
|
amino := codec.NewLegacyAmino()
|
|
interfaceRegistry := types.NewInterfaceRegistry()
|
|
marshaler := codec.NewProtoCodec(interfaceRegistry)
|
|
txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes)
|
|
|
|
encodingConfig := params.EncodingConfig{
|
|
InterfaceRegistry: interfaceRegistry,
|
|
Codec: marshaler,
|
|
TxConfig: txCfg,
|
|
Amino: amino,
|
|
}
|
|
|
|
enccodec.RegisterLegacyAminoCodec(encodingConfig.Amino)
|
|
mb.RegisterLegacyAminoCodec(encodingConfig.Amino)
|
|
enccodec.RegisterInterfaces(encodingConfig.InterfaceRegistry)
|
|
mb.RegisterInterfaces(encodingConfig.InterfaceRegistry)
|
|
return encodingConfig
|
|
}
|