forked from cosmos/relayer
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcodec.go
37 lines (32 loc) · 1.04 KB
/
codec.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
30
31
32
33
34
35
36
37
package archway
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/cosmos-sdk/types/module"
ibc "github.com/cosmos/ibc-go/v7/modules/core"
archway_module "github.com/cosmos/relayer/v2/relayer/chains/archway/module"
)
var ModuleBasics = []module.AppModuleBasic{
ibc.AppModuleBasic{},
archway_module.AppModuleBasic{},
}
type Codec struct {
InterfaceRegistry types.InterfaceRegistry
Marshaler codec.Codec
}
func MakeCodec(moduleBasics []module.AppModuleBasic, extraCodecs []string) Codec {
modBasic := module.NewBasicManager(moduleBasics...)
encodingConfig := MakeCodecConfig()
std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
modBasic.RegisterInterfaces(encodingConfig.InterfaceRegistry)
return encodingConfig
}
func MakeCodecConfig() Codec {
interfaceRegistry := types.NewInterfaceRegistry()
marshaler := codec.NewProtoCodec(interfaceRegistry)
return Codec{
InterfaceRegistry: interfaceRegistry,
Marshaler: marshaler,
}
}