forked from mrsone40/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodec.go
More file actions
56 lines (46 loc) · 1.37 KB
/
codec.go
File metadata and controls
56 lines (46 loc) · 1.37 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package testdata
import (
amino "github.com/tendermint/go-amino"
"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
tx "github.com/cosmos/cosmos-sdk/types/tx"
)
func NewTestInterfaceRegistry() types.InterfaceRegistry {
registry := types.NewInterfaceRegistry()
RegisterInterfaces(registry)
return registry
}
func RegisterInterfaces(registry types.InterfaceRegistry) {
registry.RegisterImplementations((*sdk.Msg)(nil), &TestMsg{})
registry.RegisterInterface("Animal", (*Animal)(nil))
registry.RegisterImplementations(
(*Animal)(nil),
&Dog{},
&Cat{},
)
registry.RegisterImplementations(
(*HasAnimalI)(nil),
&HasAnimal{},
)
registry.RegisterImplementations(
(*HasHasAnimalI)(nil),
&HasHasAnimal{},
)
registry.RegisterImplementations(
(*tx.TxExtensionOptionI)(nil),
&Cat{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}
func NewTestAmino() *amino.Codec {
cdc := amino.NewCodec()
cdc.RegisterInterface((*Animal)(nil), nil)
cdc.RegisterConcrete(&Dog{}, "testpb/Dog", nil)
cdc.RegisterConcrete(&Cat{}, "testpb/Cat", nil)
cdc.RegisterInterface((*HasAnimalI)(nil), nil)
cdc.RegisterConcrete(&HasAnimal{}, "testpb/HasAnimal", nil)
cdc.RegisterInterface((*HasHasAnimalI)(nil), nil)
cdc.RegisterConcrete(&HasHasAnimal{}, "testpb/HasHasAnimal", nil)
return cdc
}