@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.
@@ -10262,26 +10262,27 @@ var PostRequestClient = class {
10262
10262
  * accompanying timeout-proof calldata.
10263
10263
  */
10264
10264
  async addTimeoutFinalityEvents(request) {
10265
- const destChain = this.ctx.config.dest;
10266
- const hyperbridge = this.ctx.config.hyperbridge;
10267
10265
  const events = [];
10268
- const commitment = postRequestCommitment(request).commitment;
10269
- const receipt = await destChain.queryRequestReceipt(commitment);
10270
- const destTimestamp = await destChain.timestamp();
10271
10266
  const commit = (req) => {
10272
10267
  this.logger.trace(`Added ${events.length} timeout events`, events);
10273
10268
  request.statuses = [...req.statuses, ...events];
10274
10269
  return request;
10275
10270
  };
10276
10271
  if (request.timeoutTimestamp === 0n) return commit(request);
10272
+ if (request.statuses.some(
10273
+ (item) => item.status === RequestStatus.DESTINATION || item.status === TimeoutStatus.TIMED_OUT
10274
+ ))
10275
+ return commit(request);
10276
+ const destChain = this.ctx.config.dest;
10277
+ const hyperbridge = this.ctx.config.hyperbridge;
10278
+ const commitment = postRequestCommitment(request).commitment;
10279
+ const receipt = await destChain.queryRequestReceipt(commitment);
10280
+ const destTimestamp = await destChain.timestamp();
10277
10281
  if (receipt || request.timeoutTimestamp > destTimestamp) return commit(request);
10278
- const is_finished = request.statuses.find((item) => item.status === RequestStatus.DESTINATION);
10279
- if (!is_finished) {
10280
- events.push({
10281
- status: TimeoutStatus.PENDING_TIMEOUT,
10282
- metadata: { blockHash: "0x", blockNumber: 0, transactionHash: "0x" }
10283
- });
10284
- }
10282
+ events.push({
10283
+ status: TimeoutStatus.PENDING_TIMEOUT,
10284
+ metadata: { blockHash: "0x", blockNumber: 0, transactionHash: "0x" }
10285
+ });
10285
10286
  const delivered = request.statuses.find((item) => item.status === RequestStatus.HYPERBRIDGE_DELIVERED);
10286
10287
  let hyperbridgeFinalized;
10287
10288
  if (!delivered) {