Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ export function parsePacket({ type, attributes }: Event): Packet {
{},
);

console.log(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we need log here

'packet_data_hex: ' + attributesObj.packet_data_hex + '\n'
);
return Packet.fromPartial({
sequence: may(BigInt, attributesObj.packet_sequence),
/** identifies the port on the sending chain. */
Expand All @@ -256,8 +259,8 @@ export function parsePacket({ type, attributes }: Event): Packet {
/** identifies the channel end on the receiving chain. */
destinationChannel: attributesObj.packet_dst_channel,
/** actual opaque bytes transferred directly to the application module */
data: attributesObj.packet_data
? toUtf8(attributesObj.packet_data)
data: attributesObj.packet_data_hex
? Uint8Array.from(Buffer.from(attributesObj.packet_data_hex.replace(/^0x/, ''), 'hex'))
: undefined,
/** block height after which the packet times out */
timeoutHeight: parseHeightAttribute(attributesObj.packet_timeout_height),
Expand Down Expand Up @@ -294,7 +297,8 @@ export function parseAck({ type, attributes }: Event): Ack {
/** identifies the channel end on the receiving chain. */
destinationChannel: attributesObj.packet_dst_channel,
/** actual opaque bytes transferred directly to the application module */
data: toUtf8(attributesObj.packet_data ?? ""),
data: attributesObj.packet_data_hex ?
Uint8Array.from(Buffer.from(attributesObj.packet_data_hex.replace(/^0x/, ''), 'hex')) : toUtf8(""),
/** block height after which the packet times out */
timeoutHeight: parseHeightAttribute(attributesObj.packet_timeout_height),
/** block timestamp (in nanoseconds) after which the packet times out */
Expand Down