-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1752]: Clean up codec.go by getting rid of the amino codec stuff and…
… switching to the allRequestMsgs pattern used in other modules.
- Loading branch information
1 parent
0c2ac07
commit 77e8535
Showing
2 changed files
with
14 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,19 @@ | ||
package quarantine | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
"github.com/gogo/protobuf/proto" | ||
|
||
codectypes "github.com/cosmos/cosmos-sdk/codec/types" | ||
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/msgservice" | ||
) | ||
|
||
func RegisterInterfaces(registry codectypes.InterfaceRegistry) { | ||
registry.RegisterImplementations((*sdk.Msg)(nil), | ||
&MsgOptIn{}, | ||
&MsgOptOut{}, | ||
&MsgAccept{}, | ||
&MsgDecline{}, | ||
&MsgUpdateAutoResponses{}, | ||
) | ||
messages := make([]proto.Message, len(allRequestMsgs)) | ||
for i, msg := range allRequestMsgs { | ||
messages[i] = msg | ||
} | ||
registry.RegisterImplementations((*sdk.Msg)(nil), messages...) | ||
|
||
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) | ||
} | ||
|
||
var ( | ||
amino = codec.NewLegacyAmino() | ||
|
||
// ModuleCdc references the global x/quarantine 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/quarantine and | ||
// defined at the application level. | ||
ModuleCdc = codec.NewAminoCodec(amino) | ||
) | ||
|
||
func init() { | ||
cryptocodec.RegisterCrypto(amino) | ||
sdk.RegisterLegacyAminoCodec(amino) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters