@hyperbridge/sdk 2.2.2 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10272,26 +10272,27 @@ var PostRequestClient = class {
10272
10272
  * accompanying timeout-proof calldata.
10273
10273
  */
10274
10274
  async addTimeoutFinalityEvents(request) {
10275
- const destChain = this.ctx.config.dest;
10276
- const hyperbridge = this.ctx.config.hyperbridge;
10277
10275
  const events = [];
10278
- const commitment = postRequestCommitment(request).commitment;
10279
- const receipt = await destChain.queryRequestReceipt(commitment);
10280
- const destTimestamp = await destChain.timestamp();
10281
10276
  const commit = (req) => {
10282
10277
  this.logger.trace(`Added ${events.length} timeout events`, events);
10283
10278
  request.statuses = [...req.statuses, ...events];
10284
10279
  return request;
10285
10280
  };
10286
10281
  if (request.timeoutTimestamp === 0n) return commit(request);
10282
+ if (request.statuses.some(
10283
+ (item) => item.status === RequestStatus.DESTINATION || item.status === TimeoutStatus.TIMED_OUT
10284
+ ))
10285
+ return commit(request);
10286
+ const destChain = this.ctx.config.dest;
10287
+ const hyperbridge = this.ctx.config.hyperbridge;
10288
+ const commitment = postRequestCommitment(request).commitment;
10289
+ const receipt = await destChain.queryRequestReceipt(commitment);
10290
+ const destTimestamp = await destChain.timestamp();
10287
10291
  if (receipt || request.timeoutTimestamp > destTimestamp) return commit(request);
10288
- const is_finished = request.statuses.find((item) => item.status === RequestStatus.DESTINATION);
10289
- if (!is_finished) {
10290
- events.push({
10291
- status: TimeoutStatus.PENDING_TIMEOUT,
10292
- metadata: { blockHash: "0x", blockNumber: 0, transactionHash: "0x" }
10293
- });
10294
- }
10292
+ events.push({
10293
+ status: TimeoutStatus.PENDING_TIMEOUT,
10294
+ metadata: { blockHash: "0x", blockNumber: 0, transactionHash: "0x" }
10295
+ });
10295
10296
  const delivered = request.statuses.find((item) => item.status === RequestStatus.HYPERBRIDGE_DELIVERED);
10296
10297
  let hyperbridgeFinalized;
10297
10298
  if (!delivered) {