2020-02-20 06:24:26 -08:00
|
|
|
package types
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
2020-05-05 07:28:20 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec/types"
|
2020-06-04 03:38:24 -07:00
|
|
|
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
2020-05-12 10:35:05 -07:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2020-04-20 08:22:12 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/bank/exported"
|
2020-02-20 06:24:26 -08:00
|
|
|
)
|
|
|
|
|
2020-04-20 08:22:12 -07:00
|
|
|
// RegisterCodec registers the necessary x/bank interfaces and concrete types
|
|
|
|
// on the provided Amino codec. These types are used for Amino JSON serialization.
|
2020-08-10 12:41:21 -07:00
|
|
|
func RegisterCodec(cdc *codec.LegacyAmino) {
|
2020-04-20 08:22:12 -07:00
|
|
|
cdc.RegisterInterface((*exported.SupplyI)(nil), nil)
|
|
|
|
cdc.RegisterConcrete(&Supply{}, "cosmos-sdk/Supply", nil)
|
2020-06-03 12:52:05 -07:00
|
|
|
cdc.RegisterConcrete(&MsgSend{}, "cosmos-sdk/MsgSend", nil)
|
|
|
|
cdc.RegisterConcrete(&MsgMultiSend{}, "cosmos-sdk/MsgMultiSend", nil)
|
2020-02-20 06:24:26 -08:00
|
|
|
}
|
|
|
|
|
2020-05-12 10:35:05 -07:00
|
|
|
func RegisterInterfaces(registry types.InterfaceRegistry) {
|
|
|
|
registry.RegisterImplementations((*sdk.Msg)(nil),
|
|
|
|
&MsgSend{},
|
|
|
|
&MsgMultiSend{},
|
|
|
|
)
|
|
|
|
|
|
|
|
registry.RegisterInterface(
|
2020-08-11 04:49:45 -07:00
|
|
|
"cosmos.bank.v1beta1.SupplyI",
|
2020-05-12 10:35:05 -07:00
|
|
|
(*exported.SupplyI)(nil),
|
|
|
|
&Supply{},
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:24:26 -08:00
|
|
|
var (
|
|
|
|
amino = codec.New()
|
|
|
|
|
|
|
|
// ModuleCdc references the global x/staking module codec. Note, the codec should
|
|
|
|
// ONLY be used in certain instances of tests and for JSON encoding as Amino is
|
|
|
|
// still used for that purpose.
|
|
|
|
//
|
|
|
|
// The actual codec used for serialization should be provided to x/staking and
|
|
|
|
// defined at the application level.
|
2020-08-13 06:20:02 -07:00
|
|
|
ModuleCdc = codec.NewAminoCodec(amino)
|
2020-02-20 06:24:26 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
RegisterCodec(amino)
|
2020-06-04 03:38:24 -07:00
|
|
|
cryptocodec.RegisterCrypto(amino)
|
2020-02-20 06:24:26 -08:00
|
|
|
amino.Seal()
|
|
|
|
}
|