Skip to content

Commit

Permalink
parse data for the packet from the packet_data_hex attribute (#1077)
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim authored Apr 19, 2024
1 parent 97a1561 commit c8b7416
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions chain/cosmos/cosmos_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,19 @@ func (c *CosmosChain) SendIBCTransfer(
dstChan, _ = tendermint.AttributeValue(events, evType, "packet_dst_channel")
timeoutHeight, _ = tendermint.AttributeValue(events, evType, "packet_timeout_height")
timeoutTs, _ = tendermint.AttributeValue(events, evType, "packet_timeout_timestamp")
data, _ = tendermint.AttributeValue(events, evType, "packet_data")
dataHex, _ = tendermint.AttributeValue(events, evType, "packet_data_hex")
)
tx.Packet.SourcePort = srcPort
tx.Packet.SourceChannel = srcChan
tx.Packet.DestPort = dstPort
tx.Packet.DestChannel = dstChan
tx.Packet.TimeoutHeight = timeoutHeight
tx.Packet.Data = []byte(data)

data, err := hex.DecodeString(dataHex)
if err != nil {
return tx, fmt.Errorf("malformed data hex %s: %w", dataHex, err)
}
tx.Packet.Data = data

seqNum, err := strconv.ParseUint(seq, 10, 64)
if err != nil {
Expand Down

0 comments on commit c8b7416

Please sign in to comment.