diff --git a/x/swingset/codec.go b/x/swingset/codec.go index ea3824c82ba..a5a7d523e90 100644 --- a/x/swingset/codec.go +++ b/x/swingset/codec.go @@ -4,7 +4,10 @@ import ( "github.com/cosmos/cosmos-sdk/codec" ) +var ModuleCdc *codec.Codec + // RegisterCodec registers concrete types on the Amino codec func RegisterCodec(cdc *codec.Codec) { + ModuleCdc = cdc cdc.RegisterConcrete(MsgDeliverInbound{}, "swingset/DeliverInbound", nil) } diff --git a/x/swingset/msgs.go b/x/swingset/msgs.go index 11ada37a413..3157ff6aaa4 100644 --- a/x/swingset/msgs.go +++ b/x/swingset/msgs.go @@ -1,8 +1,6 @@ package swingset import ( - "encoding/json" - sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -65,11 +63,7 @@ func (msg MsgDeliverInbound) GetSignBytes() []byte { if msg.Nums == nil { msg.Nums = []int{} } - b, err := json.Marshal(msg) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) } // GetSigners defines whose signature is required