-
Notifications
You must be signed in to change notification settings - Fork 613
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(x/swaprouter): register amino and interfaces (finalizing merge …
…to main #1) (#3912) * refactor(x/swaprouter): register amino and interfaces * Update x/swaprouter/types/codec.go * Update x/swaprouter/types/codec.go * lint * amino * Revert "amino" This reverts commit a946a21. * remove obsolete comment
- Loading branch information
Showing
4 changed files
with
50 additions
and
20 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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package types | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
"github.com/cosmos/cosmos-sdk/codec/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/msgservice" | ||
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" | ||
) | ||
|
||
// RegisterLegacyAminoCodec registers the necessary x/gamm interfaces and concrete types | ||
// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. | ||
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { | ||
cdc.RegisterConcrete(&MsgSwapExactAmountIn{}, "osmosis/swaprouter/swap-exact-amount-in", nil) | ||
cdc.RegisterConcrete(&MsgSwapExactAmountOut{}, "osmosis/swaprouter/swap-exact-amount-out", nil) | ||
} | ||
|
||
func RegisterInterfaces(registry types.InterfaceRegistry) { | ||
registry.RegisterImplementations( | ||
(*sdk.Msg)(nil), | ||
&MsgSwapExactAmountIn{}, | ||
&MsgSwapExactAmountOut{}, | ||
) | ||
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) | ||
} | ||
|
||
var ( | ||
amino = codec.NewLegacyAmino() | ||
ModuleCdc = codec.NewAminoCodec(amino) | ||
) | ||
|
||
func init() { | ||
RegisterLegacyAminoCodec(amino) | ||
// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be | ||
// used to properly serialize MsgGrant and MsgExec instances | ||
sdk.RegisterLegacyAminoCodec(amino) | ||
RegisterLegacyAminoCodec(authzcodec.Amino) | ||
|
||
amino.Seal() | ||
} |
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
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