Skip to content

Commit

Permalink
Check EurekaMsg serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
jawoznia committed Jan 27, 2025
1 parent 6cda85e commit b6d0a44
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ type WasmMsg struct {

// These are messages in the IBC lifecycle using the new Eureka approach. Only usable by IBC-enabled contracts
type EurekaMsg struct {
SendPacket *EurekaSendPacketMsg `json:"execute,omitempty"`
SendPacket *EurekaSendPacketMsg `json:"send_packet,omitempty"`
}

// Sends an IBC packet with given payloads over the existing channel.
Expand Down
11 changes: 9 additions & 2 deletions types/msg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,18 @@ func TestMsgFundCommunityPoolSerialization(t *testing.T) {
}

func TestMsgEurekaSendPacketSerialization(t *testing.T) {
document := []byte(`{"send_packet":{"amount":[{"amount":"300","denom":"adenom"},{"amount":"400","denom":"bdenom"}]}}`)
document := []byte(`{"send_packet":{"channel_id":"channel-432", "payloads": [{"destination_port": "wasm.123", "version": "random_version", "encoding": "json", "value": ""}], "timeout": "0"}}`)

var msg EurekaMsg
err := json.Unmarshal(document, &msg)
require.NoError(t, err)

require.Equal(t, Array[Coin]{{"adenom", "300"}, {"bdenom", "400"}}, msg.FundCommunityPool.Amount)
require.Equal(t, "channel-432", msg.SendPacket.ChannelID)
require.Equal(t, []EurekaPayload{{
DestinationPort: "wasm.123",
Version: "random_version",
Encoding: "json",
Value: []byte(""),
}}, msg.SendPacket.Payloads)
require.Equal(t, uint64(0), msg.SendPacket.Timeout)
}

0 comments on commit b6d0a44

Please sign in to comment.