/
codec.go
61 lines (52 loc) · 1.85 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
"github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
)
// RegisterLegacyAminoCodec registers the account interfaces and concrete types on the
// provided LegacyAmino codec. These types are used for Amino JSON serialization
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterInterface((*sdk.ModuleAccountI)(nil), nil)
cdc.RegisterInterface((*GenesisAccount)(nil), nil)
cdc.RegisterInterface((*sdk.AccountI)(nil), nil)
cdc.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/BaseAccount", nil)
cdc.RegisterConcrete(&ModuleAccount{}, "cosmos-sdk/ModuleAccount", nil)
cdc.RegisterConcrete(Params{}, "cosmos-sdk/x/auth/Params", nil)
cdc.RegisterConcrete(&ModuleCredential{}, "cosmos-sdk/GroupAccountCredential", nil)
legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/auth/MsgUpdateParams")
legacytx.RegisterLegacyAminoCodec(cdc)
}
// RegisterInterfaces associates protoName with AccountI interface
// and creates a registry of it's concrete implementations
func RegisterInterfaces(registry types.InterfaceRegistry) {
registry.RegisterInterface(
"cosmos.auth.v1beta1.AccountI",
(*AccountI)(nil),
&BaseAccount{},
&ModuleAccount{},
)
registry.RegisterInterface(
"cosmos.auth.v1beta1.AccountI",
(*sdk.AccountI)(nil),
&BaseAccount{},
&ModuleAccount{},
)
registry.RegisterInterface(
"cosmos.auth.v1beta1.GenesisAccount",
(*GenesisAccount)(nil),
&BaseAccount{},
&ModuleAccount{},
)
registry.RegisterInterface(
"cosmos.auth.v1.ModuleCredential",
(*cryptotypes.PubKey)(nil),
&ModuleCredential{},
)
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgUpdateParams{},
)
}