laconicd-deprecated/encoding/config.go

32 lines
1013 B
Go
Raw Permalink Normal View History

package encoding
2021-04-17 10:00:07 +00:00
import (
2022-10-10 10:38:33 +00:00
amino "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"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
2021-04-17 10:00:07 +00:00
enccodec "github.com/cerc-io/laconicd/encoding/codec"
2021-04-17 10:00:07 +00:00
)
// MakeConfig creates an EncodingConfig for testing
func MakeConfig(mb module.BasicManager) params.EncodingConfig {
2022-10-10 10:38:33 +00:00
cdc := amino.NewLegacyAmino()
2021-04-17 10:00:07 +00:00
interfaceRegistry := types.NewInterfaceRegistry()
2022-10-10 10:38:33 +00:00
codec := amino.NewProtoCodec(interfaceRegistry)
2021-04-17 10:00:07 +00:00
encodingConfig := params.EncodingConfig{
InterfaceRegistry: interfaceRegistry,
2022-10-10 10:38:33 +00:00
Codec: codec,
TxConfig: tx.NewTxConfig(codec, tx.DefaultSignModes),
Amino: cdc,
2021-04-17 10:00:07 +00:00
}
2021-06-04 13:45:37 +00:00
enccodec.RegisterLegacyAminoCodec(encodingConfig.Amino)
mb.RegisterLegacyAminoCodec(encodingConfig.Amino)
2021-06-04 13:45:37 +00:00
enccodec.RegisterInterfaces(encodingConfig.InterfaceRegistry)
mb.RegisterInterfaces(encodingConfig.InterfaceRegistry)
2021-04-17 10:00:07 +00:00
return encodingConfig
}