Skip to content

Commit

Permalink
add constructor for MsgRecvPacket
Browse files Browse the repository at this point in the history
  • Loading branch information
bznein committed Sep 19, 2024
1 parent 213e5ad commit 3ba3b6f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
7 changes: 1 addition & 6 deletions modules/apps/transfer/transfer_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,7 @@ func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() {
packetV2 := channeltypesv2.NewPacketV2(1, pathAToB.EndpointB.ChannelID, pathAToB.EndpointA.ChannelID, timeoutTimestamp,
*channeltypes.NewPacketData("transfer", "transfer", *channeltypes.NewPayload(types.V2, "json", bz)))

msgRecvPacket := &channeltypesv2.MsgRecvPacket{
Packet: packetV2,
ProofCommitment: proof,
ProofHeight: proofHeight,
Signer: suite.chainA.SenderAccount.GetAddress().String(),
}
msgRecvPacket := channeltypesv2.NewMsgRecvPacket(packetV2, proof, proofHeight, suite.chainA.SenderAccount.GetAddress().String())

res, err = suite.chainA.SendMsgs(msgRecvPacket)
suite.Require().NoError(err)
Expand Down
12 changes: 12 additions & 0 deletions modules/core/04-channel/v2/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package types

import (
sdk "github.com/cosmos/cosmos-sdk/types"

clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types"
v1types "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types"
)

Expand All @@ -16,3 +18,13 @@ func NewMsgSendPacket(sourceID string, timeoutTimestamp uint64, signer string, p
Signer: signer,
}
}

// NewMsgRecvPacket constructs and returns a new MsgRecvPacket
func NewMsgRecvPacket(packet v1types.PacketV2, proofCommitment []byte, proofHeight clienttypes.Height, signer string) *MsgRecvPacket {
return &MsgRecvPacket{
Packet: packet,
ProofCommitment: proofCommitment,
ProofHeight: proofHeight,
Signer: signer,
}
}

0 comments on commit 3ba3b6f

Please sign in to comment.