@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.
@@ -10312,26 +10312,27 @@ var PostRequestClient = class {
10312
10312
  * accompanying timeout-proof calldata.
10313
10313
  */
10314
10314
  async addTimeoutFinalityEvents(request) {
10315
- const destChain = this.ctx.config.dest;
10316
- const hyperbridge = this.ctx.config.hyperbridge;
10317
10315
  const events = [];
10318
- const commitment = postRequestCommitment(request).commitment;
10319
- const receipt = await destChain.queryRequestReceipt(commitment);
10320
- const destTimestamp = await destChain.timestamp();
10321
10316
  const commit = (req) => {
10322
10317
  this.logger.trace(`Added ${events.length} timeout events`, events);
10323
10318
  request.statuses = [...req.statuses, ...events];
10324
10319
  return request;
10325
10320
  };
10326
10321
  if (request.timeoutTimestamp === 0n) return commit(request);
10322
+ if (request.statuses.some(
10323
+ (item) => item.status === RequestStatus.DESTINATION || item.status === TimeoutStatus.TIMED_OUT
10324
+ ))
10325
+ return commit(request);
10326
+ const destChain = this.ctx.config.dest;
10327
+ const hyperbridge = this.ctx.config.hyperbridge;
10328
+ const commitment = postRequestCommitment(request).commitment;
10329
+ const receipt = await destChain.queryRequestReceipt(commitment);
10330
+ const destTimestamp = await destChain.timestamp();
10327
10331
  if (receipt || request.timeoutTimestamp > destTimestamp) return commit(request);
10328
- const is_finished = request.statuses.find((item) => item.status === RequestStatus.DESTINATION);
10329
- if (!is_finished) {
10330
- events.push({
10331
- status: TimeoutStatus.PENDING_TIMEOUT,
10332
- metadata: { blockHash: "0x", blockNumber: 0, transactionHash: "0x" }
10333
- });
10334
- }
10332
+ events.push({
10333
+ status: TimeoutStatus.PENDING_TIMEOUT,
10334
+ metadata: { blockHash: "0x", blockNumber: 0, transactionHash: "0x" }
10335
+ });
10335
10336
  const delivered = request.statuses.find((item) => item.status === RequestStatus.HYPERBRIDGE_DELIVERED);
10336
10337
  let hyperbridgeFinalized;
10337
10338
  if (!delivered) {