2021-06-04 13:14:45 +00:00
|
|
|
package encoding
|
2021-04-17 10:00:07 +00:00
|
|
|
|
|
|
|
import (
|
2022-04-11 08:09:39 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
2021-04-17 10:00:07 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec/types"
|
|
|
|
"github.com/cosmos/cosmos-sdk/simapp/params"
|
2021-06-04 13:14:45 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/types/module"
|
2021-11-02 10:24:24 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/auth/tx"
|
2021-04-17 10:00:07 +00:00
|
|
|
|
2021-06-22 10:49:18 +00:00
|
|
|
enccodec "github.com/tharsis/ethermint/encoding/codec"
|
2021-04-17 10:00:07 +00:00
|
|
|
)
|
|
|
|
|
2021-06-25 09:18:37 +00:00
|
|
|
// MakeConfig creates an EncodingConfig for testing
|
2021-06-04 13:14:45 +00:00
|
|
|
func MakeConfig(mb module.BasicManager) params.EncodingConfig {
|
2022-04-26 10:39:18 +00:00
|
|
|
amino := codec.NewLegacyAmino()
|
2021-04-17 10:00:07 +00:00
|
|
|
interfaceRegistry := types.NewInterfaceRegistry()
|
2022-04-26 10:39:18 +00:00
|
|
|
marshaler := codec.NewProtoCodec(interfaceRegistry)
|
|
|
|
txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes)
|
2021-04-17 10:00:07 +00:00
|
|
|
|
|
|
|
encodingConfig := params.EncodingConfig{
|
|
|
|
InterfaceRegistry: interfaceRegistry,
|
2022-04-26 10:39:18 +00:00
|
|
|
Codec: marshaler,
|
|
|
|
TxConfig: txCfg,
|
|
|
|
Amino: amino,
|
2021-04-17 10:00:07 +00:00
|
|
|
}
|
|
|
|
|
2021-06-04 13:45:37 +00:00
|
|
|
enccodec.RegisterLegacyAminoCodec(encodingConfig.Amino)
|
2021-06-04 13:14:45 +00:00
|
|
|
mb.RegisterLegacyAminoCodec(encodingConfig.Amino)
|
2021-06-04 13:45:37 +00:00
|
|
|
enccodec.RegisterInterfaces(encodingConfig.InterfaceRegistry)
|
2021-06-04 13:14:45 +00:00
|
|
|
mb.RegisterInterfaces(encodingConfig.InterfaceRegistry)
|
2021-04-17 10:00:07 +00:00
|
|
|
return encodingConfig
|
|
|
|
}
|