2022-12-16 09:48:38 +00:00
|
|
|
// Copyright 2021 Evmos Foundation
|
|
|
|
// This file is part of Evmos' Ethermint library.
|
|
|
|
//
|
|
|
|
// The Ethermint library is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// The Ethermint library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
|
2021-06-04 13:14:45 +00:00
|
|
|
package encoding
|
2021-04-17 10:00:07 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
amino "github.com/cosmos/cosmos-sdk/codec"
|
|
|
|
"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
|
|
|
|
2022-06-19 09:43:41 +00:00
|
|
|
enccodec "github.com/evmos/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 {
|
2021-04-17 10:00:07 +00:00
|
|
|
cdc := amino.NewLegacyAmino()
|
|
|
|
interfaceRegistry := types.NewInterfaceRegistry()
|
2022-07-28 13:43:49 +00:00
|
|
|
codec := amino.NewProtoCodec(interfaceRegistry)
|
2021-04-17 10:00:07 +00:00
|
|
|
|
|
|
|
encodingConfig := params.EncodingConfig{
|
|
|
|
InterfaceRegistry: interfaceRegistry,
|
2022-07-28 13:43:49 +00:00
|
|
|
Codec: codec,
|
|
|
|
TxConfig: tx.NewTxConfig(codec, tx.DefaultSignModes),
|
2021-04-17 10:00:07 +00:00
|
|
|
Amino: cdc,
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
}
|