diff --git a/src/client/lcd/api/IbcAPI.ts b/src/client/lcd/api/IbcAPI.ts index c64176c..55fa60c 100644 --- a/src/client/lcd/api/IbcAPI.ts +++ b/src/client/lcd/api/IbcAPI.ts @@ -229,4 +229,32 @@ export class IbcAPI extends BaseAPI { d.pagination, ]); } + + public async unreceivedPackets( + portId: string, + channelId: string, + sequences: number[], + params: APIParams = {} + ): Promise<{ sequences: string[]; height: Height }> { + return this.c.get<{ sequences: string[]; height: Height }>( + `/ibc/core/channel/v1/channels/${channelId}/ports/${portId}/packet_commitments/${sequences.join( + ',' + )}/unreceived_packets`, + params + ); + } + + public async unreceivedAcks( + portId: string, + channelId: string, + sequences: number[], + params: APIParams = {} + ): Promise<{ sequences: string[]; height: Height }> { + return this.c.get<{ sequences: string[]; height: Height }>( + `/ibc/core/channel/v1/channels/${channelId}/ports/${portId}/packet_commitments/${sequences.join( + ',' + )}/unreceived_acks`, + params + ); + } } diff --git a/src/core/Block.ts b/src/core/Block.ts index fe0e606..0bb8c70 100644 --- a/src/core/Block.ts +++ b/src/core/Block.ts @@ -60,7 +60,7 @@ export interface LastCommit { } export interface Signature { - block_id_flag: number; + block_id_flag: string; validator_address: string; timestamp: string; signature: string; diff --git a/src/core/ibc/core/channel/Packet.ts b/src/core/ibc/core/channel/Packet.ts index b2dc5cf..ff8fb6e 100644 --- a/src/core/ibc/core/channel/Packet.ts +++ b/src/core/ibc/core/channel/Packet.ts @@ -21,7 +21,7 @@ export class Packet extends JSONSerializable< public destination_channel: string, public data: string, public timeout_height: Height | undefined, - public timeout_timestamp: number + public timeout_timestamp: string ) { super(); } @@ -92,7 +92,7 @@ export class Packet extends JSONSerializable< destination_channel, data, timeout_height ? Height.fromData(timeout_height) : undefined, - Number.parseInt(timeout_timestamp) + timeout_timestamp ); } @@ -115,7 +115,7 @@ export class Packet extends JSONSerializable< destination_channel, data, timeout_height: timeout_height?.toData(), - timeout_timestamp: timeout_timestamp.toFixed(), + timeout_timestamp: timeout_timestamp, }; return res; } @@ -129,7 +129,7 @@ export class Packet extends JSONSerializable< proto.destinationChannel, Buffer.from(proto.data).toString('base64'), proto.timeoutHeight ? Height.fromProto(proto.timeoutHeight) : undefined, - proto.timeoutTimestamp.toNumber() + proto.timeoutTimestamp.toString() ); } @@ -152,7 +152,7 @@ export class Packet extends JSONSerializable< destinationChannel: destination_channel, data: Buffer.from(data, 'base64'), timeoutHeight: timeout_height?.toProto(), - timeoutTimestamp: Long.fromNumber(timeout_timestamp), + timeoutTimestamp: Long.fromString(timeout_timestamp), }); } } @@ -166,7 +166,7 @@ export namespace Packet { destination_channel: string; data: string; timeout_height?: Height.Amino; - timeout_timestamp: number; + timeout_timestamp: string; } export interface Data { diff --git a/src/core/ibc/core/client/msgs/tendermint/types.ts b/src/core/ibc/core/client/msgs/tendermint/types.ts index 2b92f83..bb63e79 100644 --- a/src/core/ibc/core/client/msgs/tendermint/types.ts +++ b/src/core/ibc/core/client/msgs/tendermint/types.ts @@ -154,7 +154,7 @@ export class Header extends JSONSerializable { Buffer.from(appHash).toString('base64'), Buffer.from(lastResultsHash).toString('base64'), Buffer.from(evidenceHash).toString('base64'), - proposerAddress.toString() + Buffer.from(proposerAddress).toString('base64') ); } @@ -189,7 +189,7 @@ export class Header extends JSONSerializable { appHash: Buffer.from(appHash, 'base64'), lastResultsHash: Buffer.from(lastResultsHash, 'base64'), evidenceHash: Buffer.from(evidenceHash, 'base64'), - proposerAddress: Buffer.from(proposerAddress), + proposerAddress: Buffer.from(proposerAddress, 'base64'), }); } }