forked from classic-terra/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
encoding.go
29 lines (23 loc) · 906 Bytes
/
encoding.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package app
import (
"github.com/cosmos/cosmos-sdk/codec/legacy"
"github.com/cosmos/cosmos-sdk/std"
"github.com/classic-terra/core/v2/app/params"
)
var legacyCodecRegistered = false
// MakeEncodingConfig creates an EncodingConfig for testing
func MakeEncodingConfig() params.EncodingConfig {
encodingConfig := params.MakeEncodingConfig()
std.RegisterLegacyAminoCodec(encodingConfig.Amino)
std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry)
if !legacyCodecRegistered {
// authz module use this codec to get signbytes.
// authz MsgExec can execute all message types,
// so legacy.Cdc need to register all amino messages to get proper signature
ModuleBasics.RegisterLegacyAminoCodec(legacy.Cdc)
legacyCodecRegistered = true
}
return encodingConfig
}