diff --git a/x/nexus/keeper/wasm_message_route.go b/x/nexus/keeper/wasm_message_route.go index 251579ca8..9395d0188 100644 --- a/x/nexus/keeper/wasm_message_route.go +++ b/x/nexus/keeper/wasm_message_route.go @@ -10,6 +10,10 @@ import ( types "github.com/axelarnetwork/axelar-core/x/nexus/types" ) +type req struct { + RouteMessages []exported.WasmMessage `json:"route_messages"` +} + // NewMessageRoute creates a new message route func NewMessageRoute(nexus types.Nexus, account types.AccountKeeper, wasm types.WasmKeeper) exported.MessageRoute { return func(ctx sdk.Context, _ exported.RoutingContext, msg exported.GeneralMessage) error { @@ -22,7 +26,7 @@ func NewMessageRoute(nexus types.Nexus, account types.AccountKeeper, wasm types. return fmt.Errorf("gateway is not set") } - bz, err := json.Marshal(exported.FromGeneralMessage(msg)) + bz, err := json.Marshal(req{RouteMessages: []exported.WasmMessage{exported.FromGeneralMessage(msg)}}) if err != nil { return nil } diff --git a/x/nexus/keeper/wasm_message_route_test.go b/x/nexus/keeper/wasm_message_route_test.go index d1ed09efc..4ead139eb 100644 --- a/x/nexus/keeper/wasm_message_route_test.go +++ b/x/nexus/keeper/wasm_message_route_test.go @@ -86,9 +86,14 @@ func TestNewMessageRoute(t *testing.T) { assert.Equal(t, wasmK.ExecuteCalls()[0].Caller, moduleAddr) assert.Empty(t, wasmK.ExecuteCalls()[0].Coins) - var actual nexus.WasmMessage + type req struct { + RouteMessages []nexus.WasmMessage `json:"route_messages"` + } + + var actual req assert.NoError(t, json.Unmarshal(wasmK.ExecuteCalls()[0].Msg, &actual)) - assert.Equal(t, nexus.FromGeneralMessage(msg), actual) + assert.Len(t, actual.RouteMessages, 1) + assert.Equal(t, nexus.FromGeneralMessage(msg), actual.RouteMessages[0]) }), ). Run(t)