@across-protocol/sdk 4.0.0-beta.18 → 4.0.0-beta.2

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.
Files changed (93) hide show
  1. package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +4 -5
  2. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +146 -241
  3. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  4. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.d.ts +1 -3
  5. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +1 -33
  6. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  7. package/dist/cjs/clients/SpokePoolClient.d.ts +0 -1
  8. package/dist/cjs/clients/SpokePoolClient.js +4 -13
  9. package/dist/cjs/clients/SpokePoolClient.js.map +1 -1
  10. package/dist/cjs/constants.d.ts +0 -1
  11. package/dist/cjs/constants.js +1 -2
  12. package/dist/cjs/constants.js.map +1 -1
  13. package/dist/cjs/providers/index.d.ts +0 -1
  14. package/dist/cjs/providers/index.js +0 -2
  15. package/dist/cjs/providers/index.js.map +1 -1
  16. package/dist/cjs/utils/AddressUtils.d.ts +0 -1
  17. package/dist/cjs/utils/AddressUtils.js +1 -14
  18. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  19. package/dist/cjs/utils/CachingUtils.js +1 -1
  20. package/dist/cjs/utils/CachingUtils.js.map +1 -1
  21. package/dist/cjs/utils/DepositUtils.d.ts +1 -2
  22. package/dist/cjs/utils/DepositUtils.js +3 -12
  23. package/dist/cjs/utils/DepositUtils.js.map +1 -1
  24. package/dist/cjs/utils/NetworkUtils.d.ts +0 -1
  25. package/dist/cjs/utils/NetworkUtils.js +1 -6
  26. package/dist/cjs/utils/NetworkUtils.js.map +1 -1
  27. package/dist/cjs/utils/SpokeUtils.js +3 -3
  28. package/dist/cjs/utils/SpokeUtils.js.map +1 -1
  29. package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +4 -5
  30. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +181 -305
  31. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  32. package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +1 -3
  33. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +1 -42
  34. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  35. package/dist/esm/clients/SpokePoolClient.d.ts +0 -8
  36. package/dist/esm/clients/SpokePoolClient.js +4 -20
  37. package/dist/esm/clients/SpokePoolClient.js.map +1 -1
  38. package/dist/esm/constants.d.ts +0 -1
  39. package/dist/esm/constants.js +1 -2
  40. package/dist/esm/constants.js.map +1 -1
  41. package/dist/esm/providers/index.d.ts +0 -1
  42. package/dist/esm/providers/index.js +0 -2
  43. package/dist/esm/providers/index.js.map +1 -1
  44. package/dist/esm/utils/AddressUtils.d.ts +0 -1
  45. package/dist/esm/utils/AddressUtils.js +0 -16
  46. package/dist/esm/utils/AddressUtils.js.map +1 -1
  47. package/dist/esm/utils/CachingUtils.js +1 -1
  48. package/dist/esm/utils/CachingUtils.js.map +1 -1
  49. package/dist/esm/utils/DepositUtils.d.ts +1 -2
  50. package/dist/esm/utils/DepositUtils.js +3 -12
  51. package/dist/esm/utils/DepositUtils.js.map +1 -1
  52. package/dist/esm/utils/NetworkUtils.d.ts +0 -6
  53. package/dist/esm/utils/NetworkUtils.js +0 -10
  54. package/dist/esm/utils/NetworkUtils.js.map +1 -1
  55. package/dist/esm/utils/SpokeUtils.js +4 -4
  56. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  57. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +4 -5
  58. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  59. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +1 -3
  60. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
  61. package/dist/types/clients/SpokePoolClient.d.ts +0 -8
  62. package/dist/types/clients/SpokePoolClient.d.ts.map +1 -1
  63. package/dist/types/constants.d.ts +0 -1
  64. package/dist/types/constants.d.ts.map +1 -1
  65. package/dist/types/providers/index.d.ts +0 -1
  66. package/dist/types/providers/index.d.ts.map +1 -1
  67. package/dist/types/utils/AddressUtils.d.ts +0 -1
  68. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  69. package/dist/types/utils/DepositUtils.d.ts +1 -2
  70. package/dist/types/utils/DepositUtils.d.ts.map +1 -1
  71. package/dist/types/utils/NetworkUtils.d.ts +0 -6
  72. package/dist/types/utils/NetworkUtils.d.ts.map +1 -1
  73. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  74. package/package.json +1 -1
  75. package/src/clients/BundleDataClient/BundleDataClient.ts +132 -251
  76. package/src/clients/BundleDataClient/utils/FillUtils.ts +2 -47
  77. package/src/clients/SpokePoolClient.ts +6 -19
  78. package/src/constants.ts +1 -3
  79. package/src/providers/index.ts +0 -1
  80. package/src/utils/AddressUtils.ts +0 -16
  81. package/src/utils/CachingUtils.ts +1 -1
  82. package/src/utils/DepositUtils.ts +3 -12
  83. package/src/utils/NetworkUtils.ts +0 -11
  84. package/src/utils/SpokeUtils.ts +5 -6
  85. package/dist/cjs/providers/mockProvider.d.ts +0 -19
  86. package/dist/cjs/providers/mockProvider.js +0 -70
  87. package/dist/cjs/providers/mockProvider.js.map +0 -1
  88. package/dist/esm/providers/mockProvider.d.ts +0 -23
  89. package/dist/esm/providers/mockProvider.js +0 -73
  90. package/dist/esm/providers/mockProvider.js.map +0 -1
  91. package/dist/types/providers/mockProvider.d.ts +0 -24
  92. package/dist/types/providers/mockProvider.d.ts.map +0 -1
  93. package/src/providers/mockProvider.ts +0 -77
@@ -6,13 +6,9 @@ var lodash_1 = tslib_1.__importDefault(require("lodash"));
6
6
  var interfaces_1 = require("../../interfaces");
7
7
  var utils_1 = require("../../utils");
8
8
  var utils_2 = require("./utils");
9
- var constants_1 = require("../../constants");
10
9
  exports.INFINITE_FILL_DEADLINE = utils_1.bnUint32Max;
11
10
  function updateExpiredDepositsV3(dict, deposit) {
12
11
  var _a;
13
- if ((0, utils_1.chainIsEvm)(deposit.originChainId) && !(0, utils_1.isValidEvmAddress)(deposit.depositor)) {
14
- return;
15
- }
16
12
  var originChainId = deposit.originChainId, inputToken = deposit.inputToken;
17
13
  if (!((_a = dict === null || dict === void 0 ? void 0 : dict[originChainId]) === null || _a === void 0 ? void 0 : _a[inputToken])) {
18
14
  (0, utils_1.assign)(dict, [originChainId, inputToken], []);
@@ -27,11 +23,8 @@ function updateBundleDepositsV3(dict, deposit) {
27
23
  }
28
24
  dict[originChainId][inputToken].push(deposit);
29
25
  }
30
- function updateBundleFillsV3(dict, fill, lpFeePct, repaymentChainId, repaymentToken, repaymentAddress) {
26
+ function updateBundleFillsV3(dict, fill, lpFeePct, repaymentChainId, repaymentToken) {
31
27
  var _a, _b;
32
- if ((0, utils_1.chainIsEvm)(repaymentChainId) && !(0, utils_1.isValidEvmAddress)(repaymentAddress)) {
33
- return;
34
- }
35
28
  if (!((_a = dict === null || dict === void 0 ? void 0 : dict[repaymentChainId]) === null || _a === void 0 ? void 0 : _a[repaymentToken])) {
36
29
  (0, utils_1.assign)(dict, [repaymentChainId, repaymentToken], {
37
30
  fills: [],
@@ -40,22 +33,22 @@ function updateBundleFillsV3(dict, fill, lpFeePct, repaymentChainId, repaymentTo
40
33
  refunds: {},
41
34
  });
42
35
  }
43
- var bundleFill = tslib_1.__assign(tslib_1.__assign({}, fill), { lpFeePct: lpFeePct, relayer: repaymentAddress });
36
+ var bundleFill = tslib_1.__assign(tslib_1.__assign({}, fill), { lpFeePct: lpFeePct });
44
37
  (0, utils_1.assign)(dict, [repaymentChainId, repaymentToken, "fills"], [bundleFill]);
45
38
  var refundObj = dict[repaymentChainId][repaymentToken];
46
- var realizedLpFee = bundleFill.inputAmount.mul(bundleFill.lpFeePct).div(utils_1.fixedPointAdjustment);
39
+ var realizedLpFee = fill.inputAmount.mul(bundleFill.lpFeePct).div(utils_1.fixedPointAdjustment);
47
40
  refundObj.realizedLpFees = refundObj.realizedLpFees ? refundObj.realizedLpFees.add(realizedLpFee) : realizedLpFee;
48
- if (!(0, utils_1.isSlowFill)(bundleFill)) {
49
- var refundAmount = bundleFill.inputAmount.mul(utils_1.fixedPointAdjustment.sub(lpFeePct)).div(utils_1.fixedPointAdjustment);
41
+ if (!(0, utils_1.isSlowFill)(fill)) {
42
+ var refundAmount = fill.inputAmount.mul(utils_1.fixedPointAdjustment.sub(lpFeePct)).div(utils_1.fixedPointAdjustment);
50
43
  refundObj.totalRefundAmount = refundObj.totalRefundAmount
51
44
  ? refundObj.totalRefundAmount.add(refundAmount)
52
45
  : refundAmount;
53
46
  (_b = refundObj.refunds) !== null && _b !== void 0 ? _b : (refundObj.refunds = {});
54
- if (refundObj.refunds[bundleFill.relayer]) {
55
- refundObj.refunds[bundleFill.relayer] = refundObj.refunds[bundleFill.relayer].add(refundAmount);
47
+ if (refundObj.refunds[fill.relayer]) {
48
+ refundObj.refunds[fill.relayer] = refundObj.refunds[fill.relayer].add(refundAmount);
56
49
  }
57
50
  else {
58
- refundObj.refunds[bundleFill.relayer] = refundAmount;
51
+ refundObj.refunds[fill.relayer] = refundAmount;
59
52
  }
60
53
  }
61
54
  }
@@ -195,107 +188,64 @@ var BundleDataClient = (function () {
195
188
  return [4, this.loadArweaveData(bundleEvaluationBlockRanges)];
196
189
  case 1:
197
190
  arweaveData = _a.sent();
198
- if (!(arweaveData === undefined)) return [3, 3];
199
- return [4, this.getApproximateRefundsForBlockRange(chainIds, bundleEvaluationBlockRanges)];
200
- case 2:
201
- combinedRefunds = _a.sent();
202
- return [3, 4];
203
- case 3:
204
- bundleFillsV3 = arweaveData.bundleFillsV3, expiredDepositsToRefundV3 = arweaveData.expiredDepositsToRefundV3;
205
- combinedRefunds = (0, utils_2.getRefundsFromBundle)(bundleFillsV3, expiredDepositsToRefundV3);
206
- Object.keys(combinedRefunds).forEach(function (chainId) {
207
- if (_this.spokePoolClients[Number(chainId)] === undefined) {
208
- delete combinedRefunds[Number(chainId)];
209
- }
210
- });
211
- _a.label = 4;
212
- case 4: return [2, this.deductExecutedRefunds(combinedRefunds, bundle)];
191
+ if (arweaveData === undefined) {
192
+ combinedRefunds = this.getApproximateRefundsForBlockRange(chainIds, bundleEvaluationBlockRanges);
193
+ }
194
+ else {
195
+ bundleFillsV3 = arweaveData.bundleFillsV3, expiredDepositsToRefundV3 = arweaveData.expiredDepositsToRefundV3;
196
+ combinedRefunds = (0, utils_2.getRefundsFromBundle)(bundleFillsV3, expiredDepositsToRefundV3);
197
+ Object.keys(combinedRefunds).forEach(function (chainId) {
198
+ if (_this.spokePoolClients[Number(chainId)] === undefined) {
199
+ delete combinedRefunds[Number(chainId)];
200
+ }
201
+ });
202
+ }
203
+ return [2, this.deductExecutedRefunds(combinedRefunds, bundle)];
213
204
  }
214
205
  });
215
206
  });
216
207
  };
217
208
  BundleDataClient.prototype.getApproximateRefundsForBlockRange = function (chainIds, blockRanges) {
218
- return tslib_1.__awaiter(this, void 0, void 0, function () {
219
- var refundsForChain, _loop_1, this_1, _i, chainIds_1, chainId;
220
- var _this = this;
221
- return tslib_1.__generator(this, function (_a) {
222
- switch (_a.label) {
223
- case 0:
224
- refundsForChain = {};
225
- _loop_1 = function (chainId) {
226
- var chainIndex, fillsToCount;
227
- return tslib_1.__generator(this, function (_b) {
228
- switch (_b.label) {
229
- case 0:
230
- if (this_1.spokePoolClients[chainId] === undefined) {
231
- return [2, "continue"];
232
- }
233
- chainIndex = chainIds.indexOf(chainId);
234
- return [4, (0, utils_1.filterAsync)(this_1.spokePoolClients[chainId].getFills(), function (fill) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
235
- var matchingDeposit, hasMatchingDeposit, validRepayment;
236
- return tslib_1.__generator(this, function (_a) {
237
- switch (_a.label) {
238
- case 0:
239
- if (fill.blockNumber < blockRanges[chainIndex][0] ||
240
- fill.blockNumber > blockRanges[chainIndex][1] ||
241
- (0, utils_1.isZeroValueFillOrSlowFillRequest)(fill)) {
242
- return [2, false];
243
- }
244
- if (this.spokePoolClients[fill.originChainId] === undefined) {
245
- return [2, false];
246
- }
247
- matchingDeposit = this.spokePoolClients[fill.originChainId].getDeposit(fill.depositId);
248
- hasMatchingDeposit = matchingDeposit !== undefined &&
249
- this.getRelayHashFromEvent(fill) === this.getRelayHashFromEvent(matchingDeposit);
250
- if (!hasMatchingDeposit) return [3, 2];
251
- return [4, (0, utils_2.verifyFillRepayment)(fill, this.spokePoolClients[fill.destinationChainId].spokePool.provider, matchingDeposit, this.clients.configStoreClient
252
- .getChainIdIndicesForBlock(blockRanges[0][1])
253
- .filter(function (_chainId, i) { return !(0, utils_2.isChainDisabled)(blockRanges[i]); }))];
254
- case 1:
255
- validRepayment = _a.sent();
256
- if (!(0, utils_1.isDefined)(validRepayment)) {
257
- return [2, false];
258
- }
259
- _a.label = 2;
260
- case 2: return [2, hasMatchingDeposit];
261
- }
262
- });
263
- }); })];
264
- case 1:
265
- fillsToCount = _b.sent();
266
- fillsToCount.forEach(function (fill) {
267
- var _a, _b, _c;
268
- var _d;
269
- var matchingDeposit = _this.spokePoolClients[fill.originChainId].getDeposit(fill.depositId);
270
- (0, utils_1.assert)((0, utils_1.isDefined)(matchingDeposit), "Deposit not found for fill.");
271
- var _e = (0, utils_2.getRefundInformationFromFill)(fill, _this.clients.hubPoolClient, blockRanges, _this.chainIdListForBundleEvaluationBlockNumbers, matchingDeposit.fromLiteChain), chainToSendRefundTo = _e.chainToSendRefundTo, repaymentToken = _e.repaymentToken;
272
- var relayer = fill.relayer, refundAmount = fill.inputAmount;
273
- (_a = refundsForChain[chainToSendRefundTo]) !== null && _a !== void 0 ? _a : (refundsForChain[chainToSendRefundTo] = {});
274
- (_b = (_d = refundsForChain[chainToSendRefundTo])[repaymentToken]) !== null && _b !== void 0 ? _b : (_d[repaymentToken] = {});
275
- var existingRefundAmount = (_c = refundsForChain[chainToSendRefundTo][repaymentToken][relayer]) !== null && _c !== void 0 ? _c : utils_1.bnZero;
276
- refundsForChain[chainToSendRefundTo][repaymentToken][relayer] = existingRefundAmount.add(refundAmount);
277
- });
278
- return [2];
279
- }
280
- });
281
- };
282
- this_1 = this;
283
- _i = 0, chainIds_1 = chainIds;
284
- _a.label = 1;
285
- case 1:
286
- if (!(_i < chainIds_1.length)) return [3, 4];
287
- chainId = chainIds_1[_i];
288
- return [5, _loop_1(chainId)];
289
- case 2:
290
- _a.sent();
291
- _a.label = 3;
292
- case 3:
293
- _i++;
294
- return [3, 1];
295
- case 4: return [2, refundsForChain];
209
+ var _this = this;
210
+ var refundsForChain = {};
211
+ var _loop_1 = function (chainId) {
212
+ if (this_1.spokePoolClients[chainId] === undefined) {
213
+ return "continue";
214
+ }
215
+ var chainIndex = chainIds.indexOf(chainId);
216
+ this_1.spokePoolClients[chainId]
217
+ .getFills()
218
+ .filter(function (fill) {
219
+ if (fill.blockNumber < blockRanges[chainIndex][0] || fill.blockNumber > blockRanges[chainIndex][1]) {
220
+ return false;
221
+ }
222
+ if (_this.spokePoolClients[fill.originChainId] === undefined) {
223
+ return false;
296
224
  }
225
+ var matchingDeposit = _this.spokePoolClients[fill.originChainId].getDeposit(fill.depositId);
226
+ var hasMatchingDeposit = matchingDeposit !== undefined &&
227
+ _this.getRelayHashFromEvent(fill) === _this.getRelayHashFromEvent(matchingDeposit);
228
+ return hasMatchingDeposit;
229
+ })
230
+ .forEach(function (fill) {
231
+ var _a, _b, _c;
232
+ var _d;
233
+ var matchingDeposit = _this.spokePoolClients[fill.originChainId].getDeposit(fill.depositId);
234
+ (0, utils_1.assert)((0, utils_1.isDefined)(matchingDeposit), "Deposit not found for fill.");
235
+ var _e = (0, utils_2.getRefundInformationFromFill)(fill, _this.clients.hubPoolClient, blockRanges, _this.chainIdListForBundleEvaluationBlockNumbers, matchingDeposit.fromLiteChain), chainToSendRefundTo = _e.chainToSendRefundTo, repaymentToken = _e.repaymentToken;
236
+ var relayer = fill.relayer, refundAmount = fill.inputAmount;
237
+ (_a = refundsForChain[chainToSendRefundTo]) !== null && _a !== void 0 ? _a : (refundsForChain[chainToSendRefundTo] = {});
238
+ (_b = (_d = refundsForChain[chainToSendRefundTo])[repaymentToken]) !== null && _b !== void 0 ? _b : (_d[repaymentToken] = {});
239
+ var existingRefundAmount = (_c = refundsForChain[chainToSendRefundTo][repaymentToken][relayer]) !== null && _c !== void 0 ? _c : utils_1.bnZero;
240
+ refundsForChain[chainToSendRefundTo][repaymentToken][relayer] = existingRefundAmount.add(refundAmount);
297
241
  });
298
- });
242
+ };
243
+ var this_1 = this;
244
+ for (var _i = 0, chainIds_1 = chainIds; _i < chainIds_1.length; _i++) {
245
+ var chainId = chainIds_1[_i];
246
+ _loop_1(chainId);
247
+ }
248
+ return refundsForChain;
299
249
  };
300
250
  BundleDataClient.prototype.getUpcomingDepositAmount = function (chainId, l2Token, latestBlockToSearch) {
301
251
  if (this.spokePoolClients[chainId] === undefined) {
@@ -367,39 +317,32 @@ var BundleDataClient = (function () {
367
317
  return [initialBlockRange[1] + 1, blockRange[1]];
368
318
  });
369
319
  }
370
- var hubPoolClient, nextBundleMainnetStartBlock, chainIds, combinedRefunds, widestBundleBlockRanges, pendingBundleBlockRanges, arweaveData, _a, _b, bundleFillsV3, expiredDepositsToRefundV3, start, _c, _d;
371
- return tslib_1.__generator(this, function (_e) {
372
- switch (_e.label) {
320
+ var hubPoolClient, nextBundleMainnetStartBlock, chainIds, combinedRefunds, widestBundleBlockRanges, pendingBundleBlockRanges, arweaveData, bundleFillsV3, expiredDepositsToRefundV3, start;
321
+ return tslib_1.__generator(this, function (_a) {
322
+ switch (_a.label) {
373
323
  case 0:
374
324
  hubPoolClient = this.clients.hubPoolClient;
375
325
  nextBundleMainnetStartBlock = hubPoolClient.getNextBundleStartBlockNumber(this.chainIdListForBundleEvaluationBlockNumbers, hubPoolClient.latestBlockSearched, hubPoolClient.chainId);
376
326
  chainIds = this.clients.configStoreClient.getChainIdIndicesForBlock(nextBundleMainnetStartBlock);
377
327
  combinedRefunds = [];
378
328
  widestBundleBlockRanges = (0, utils_2.getWidestPossibleExpectedBlockRange)(chainIds, this.spokePoolClients, (0, utils_2.getEndBlockBuffers)(chainIds, this.blockRangeEndBlockBuffer), this.clients, this.clients.hubPoolClient.latestBlockSearched, this.clients.configStoreClient.getEnabledChains(this.clients.hubPoolClient.latestBlockSearched));
379
- if (!hubPoolClient.hasPendingProposal()) return [3, 5];
329
+ if (!hubPoolClient.hasPendingProposal()) return [3, 2];
380
330
  pendingBundleBlockRanges = (0, utils_1.getImpliedBundleBlockRanges)(hubPoolClient, this.clients.configStoreClient, hubPoolClient.getLatestProposedRootBundle());
381
331
  return [4, this.loadArweaveData(pendingBundleBlockRanges)];
382
332
  case 1:
383
- arweaveData = _e.sent();
384
- if (!(arweaveData === undefined)) return [3, 3];
385
- _b = (_a = combinedRefunds).push;
386
- return [4, this.getApproximateRefundsForBlockRange(chainIds, pendingBundleBlockRanges)];
387
- case 2:
388
- _b.apply(_a, [_e.sent()]);
389
- return [3, 4];
390
- case 3:
391
- bundleFillsV3 = arweaveData.bundleFillsV3, expiredDepositsToRefundV3 = arweaveData.expiredDepositsToRefundV3;
392
- combinedRefunds.push((0, utils_2.getRefundsFromBundle)(bundleFillsV3, expiredDepositsToRefundV3));
393
- _e.label = 4;
394
- case 4:
333
+ arweaveData = _a.sent();
334
+ if (arweaveData === undefined) {
335
+ combinedRefunds.push(this.getApproximateRefundsForBlockRange(chainIds, pendingBundleBlockRanges));
336
+ }
337
+ else {
338
+ bundleFillsV3 = arweaveData.bundleFillsV3, expiredDepositsToRefundV3 = arweaveData.expiredDepositsToRefundV3;
339
+ combinedRefunds.push((0, utils_2.getRefundsFromBundle)(bundleFillsV3, expiredDepositsToRefundV3));
340
+ }
395
341
  widestBundleBlockRanges = getBlockRangeDelta(pendingBundleBlockRanges);
396
- _e.label = 5;
397
- case 5:
342
+ _a.label = 2;
343
+ case 2:
398
344
  start = performance.now();
399
- _d = (_c = combinedRefunds).push;
400
- return [4, this.getApproximateRefundsForBlockRange(chainIds, widestBundleBlockRanges)];
401
- case 6:
402
- _d.apply(_c, [_e.sent()]);
345
+ combinedRefunds.push(this.getApproximateRefundsForBlockRange(chainIds, widestBundleBlockRanges));
403
346
  this.logger.debug({
404
347
  at: "BundleDataClient#getNextBundleRefunds",
405
348
  message: "Loading approximate refunds for next bundle in ".concat(Math.round(performance.now() - start) / 1000, "s."),
@@ -530,7 +473,7 @@ var BundleDataClient = (function () {
530
473
  };
531
474
  BundleDataClient.prototype.loadDataFromScratch = function (blockRangesForChains, spokePoolClients) {
532
475
  return tslib_1.__awaiter(this, void 0, void 0, function () {
533
- var start, key, chainIds, bundleDepositsV3, bundleFillsV3, bundleInvalidFillsV3, bundleSlowFillsV3, expiredDepositsToRefundV3, unexecutableSlowFills, _isChainDisabled, _canCreateSlowFillLeaf, _depositIsExpired, _getFillStatusForDeposit, allChainIds, _cachedBundleTimestamps, bundleBlockTimestamps, v3RelayHashes, bundleDepositHashes, olderDepositHashes, startBlockForMainnet, versionAtProposalBlock, canRefundPrefills, depositCounter, _loop_2, _i, allChainIds_1, originChainId, validatedBundleV3Fills, validatedBundleSlowFills, validatedBundleUnexecutableSlowFills, fillCounter, _loop_3, _a, allChainIds_2, originChainId, promises, _b, v3FillLpFees, v3SlowFillLpFees, v3UnexecutableSlowFillLpFees, v3SpokeEventsReadable;
476
+ var start, key, chainIds, bundleDepositsV3, bundleFillsV3, bundleInvalidFillsV3, bundleSlowFillsV3, expiredDepositsToRefundV3, unexecutableSlowFills, _isChainDisabled, _canCreateSlowFillLeaf, _getFillStatusForDeposit, allChainIds, _cachedBundleTimestamps, bundleBlockTimestamps, v3RelayHashes, bundleDepositHashes, olderDepositHashes, depositCounter, _loop_2, _i, allChainIds_1, originChainId, validatedBundleV3Fills, validatedBundleSlowFills, validatedBundleUnexecutableSlowFills, fillCounter, _loop_3, _a, allChainIds_2, originChainId, promises, _b, v3FillLpFees, v3SlowFillLpFees, v3UnexecutableSlowFillLpFees, v3SpokeEventsReadable;
534
477
  var _this = this;
535
478
  return tslib_1.__generator(this, function (_c) {
536
479
  switch (_c.label) {
@@ -562,9 +505,6 @@ var BundleDataClient = (function () {
562
505
  !deposit.fromLiteChain &&
563
506
  !deposit.toLiteChain);
564
507
  };
565
- _depositIsExpired = function (deposit) {
566
- return deposit.fillDeadline < bundleBlockTimestamps[deposit.destinationChainId][1];
567
- };
568
508
  _getFillStatusForDeposit = function (deposit, queryBlock) {
569
509
  return spokePoolClients[deposit.destinationChainId].relayFillStatus(deposit, Math.min(queryBlock, spokePoolClients[deposit.destinationChainId].latestBlockSearched), deposit.destinationChainId);
570
510
  };
@@ -598,9 +538,6 @@ var BundleDataClient = (function () {
598
538
  v3RelayHashes = {};
599
539
  bundleDepositHashes = [];
600
540
  olderDepositHashes = [];
601
- startBlockForMainnet = (0, utils_1.getBlockRangeForChain)(blockRangesForChains, this.clients.hubPoolClient.chainId, this.chainIdListForBundleEvaluationBlockNumbers)[0];
602
- versionAtProposalBlock = this.clients.configStoreClient.getConfigStoreVersionForBlock(startBlockForMainnet);
603
- canRefundPrefills = versionAtProposalBlock >= constants_1.PRE_FILL_MIN_CONFIG_STORE_VERSION || process.env.FORCE_REFUND_PREFILLS === "true";
604
541
  depositCounter = 0;
605
542
  _loop_2 = function (originChainId) {
606
543
  var originClient = spokePoolClients[originChainId];
@@ -611,7 +548,7 @@ var BundleDataClient = (function () {
611
548
  continue;
612
549
  }
613
550
  originClient.getDepositsForDestinationChainWithDuplicates(destinationChainId).forEach(function (deposit) {
614
- if (deposit.blockNumber > originChainBlockRange[1] || (0, utils_1.isZeroValueDeposit)(deposit)) {
551
+ if ((0, utils_1.isZeroValueDeposit)(deposit) || deposit.blockNumber > originChainBlockRange[1]) {
615
552
  return;
616
553
  }
617
554
  depositCounter++;
@@ -656,7 +593,7 @@ var BundleDataClient = (function () {
656
593
  case 0:
657
594
  originClient = spokePoolClients[originChainId];
658
595
  _loop_4 = function (destinationChainId) {
659
- var destinationClient, destinationChainBlockRange, fastFillsReplacingSlowFills;
596
+ var destinationClient, destinationChainBlockRange, fastFillsReplacingSlowFills, originBlockRange;
660
597
  return tslib_1.__generator(this, function (_g) {
661
598
  switch (_g.label) {
662
599
  case 0:
@@ -669,76 +606,56 @@ var BundleDataClient = (function () {
669
606
  return [4, (0, utils_1.forEachAsync)(destinationClient
670
607
  .getFillsForOriginChain(originChainId)
671
608
  .filter(function (fill) { return fill.blockNumber <= destinationChainBlockRange[1] && !(0, utils_1.isZeroValueFillOrSlowFillRequest)(fill); }), function (fill) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
672
- var relayDataHash, fillToRefund, duplicateDeposits, historicalDeposit, matchedDeposit, fillToRefund;
609
+ var relayDataHash, historicalDeposit, matchedDeposit;
673
610
  return tslib_1.__generator(this, function (_a) {
674
611
  switch (_a.label) {
675
612
  case 0:
676
- fillCounter++;
677
613
  relayDataHash = this.getRelayHashFromEvent(fill);
678
- if (!v3RelayHashes[relayDataHash]) return [3, 5];
679
- if (!!v3RelayHashes[relayDataHash].fill) return [3, 3];
680
- (0, utils_1.assert)((0, utils_1.isDefined)(v3RelayHashes[relayDataHash].deposit), "Deposit should exist in relay hash dictionary.");
681
- v3RelayHashes[relayDataHash].fill = fill;
682
- if (!(fill.blockNumber >= destinationChainBlockRange[0])) return [3, 2];
683
- return [4, (0, utils_2.verifyFillRepayment)(fill, destinationClient.spokePool.provider, v3RelayHashes[relayDataHash].deposit, allChainIds)];
684
- case 1:
685
- fillToRefund = _a.sent();
686
- if (!(0, utils_1.isDefined)(fillToRefund)) {
687
- bundleInvalidFillsV3.push(fill);
688
- }
689
- else {
690
- v3RelayHashes[relayDataHash].fill = fillToRefund;
691
- validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({}, fillToRefund), { quoteTimestamp: v3RelayHashes[relayDataHash].deposit.quoteTimestamp }));
692
- }
693
- if (fill.relayExecutionInfo.fillType === interfaces_1.FillType.ReplacedSlowFill &&
694
- _canCreateSlowFillLeaf(v3RelayHashes[relayDataHash].deposit)) {
695
- fastFillsReplacingSlowFills.push(relayDataHash);
614
+ fillCounter++;
615
+ if (v3RelayHashes[relayDataHash]) {
616
+ if (!v3RelayHashes[relayDataHash].fill) {
617
+ (0, utils_1.assert)((0, utils_1.isDefined)(v3RelayHashes[relayDataHash].deposit), "Deposit should exist in relay hash dictionary.");
618
+ v3RelayHashes[relayDataHash].fill = fill;
619
+ if (fill.blockNumber >= destinationChainBlockRange[0]) {
620
+ validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({}, fill), { quoteTimestamp: v3RelayHashes[relayDataHash].deposit.quoteTimestamp }));
621
+ if (fill.relayExecutionInfo.fillType === interfaces_1.FillType.ReplacedSlowFill &&
622
+ !v3RelayHashes[relayDataHash].deposit.fromLiteChain &&
623
+ !v3RelayHashes[relayDataHash].deposit.toLiteChain) {
624
+ fastFillsReplacingSlowFills.push(relayDataHash);
625
+ }
626
+ }
627
+ }
628
+ return [2];
696
629
  }
697
- duplicateDeposits = originClient.getDuplicateDeposits(v3RelayHashes[relayDataHash].deposit);
698
- duplicateDeposits.forEach(function (duplicateDeposit) {
699
- updateExpiredDepositsV3(expiredDepositsToRefundV3, duplicateDeposit);
700
- });
701
- _a.label = 2;
702
- case 2: return [3, 4];
703
- case 3: throw new Error("Duplicate fill detected.");
704
- case 4: return [2];
705
- case 5:
706
630
  v3RelayHashes[relayDataHash] = {
707
631
  deposit: undefined,
708
632
  fill: fill,
709
633
  slowFillRequest: undefined,
710
634
  };
711
- if (!(fill.blockNumber >= destinationChainBlockRange[0])) return [3, 9];
635
+ if (!(fill.blockNumber >= destinationChainBlockRange[0])) return [3, 2];
712
636
  if (!exports.INFINITE_FILL_DEADLINE.eq(fill.fillDeadline)) {
713
637
  bundleInvalidFillsV3.push(fill);
714
638
  return [2];
715
639
  }
716
640
  return [4, (0, utils_1.queryHistoricalDepositForFill)(originClient, fill)];
717
- case 6:
641
+ case 1:
718
642
  historicalDeposit = _a.sent();
719
- if (!!historicalDeposit.found) return [3, 7];
720
- bundleInvalidFillsV3.push(fill);
721
- return [3, 9];
722
- case 7:
723
- matchedDeposit = historicalDeposit.deposit;
724
- v3RelayHashes[relayDataHash].deposit = matchedDeposit;
725
- return [4, (0, utils_2.verifyFillRepayment)(fill, destinationClient.spokePool.provider, matchedDeposit, allChainIds)];
726
- case 8:
727
- fillToRefund = _a.sent();
728
- if (!(0, utils_1.isDefined)(fillToRefund)) {
643
+ if (!historicalDeposit.found) {
729
644
  bundleInvalidFillsV3.push(fill);
730
645
  }
731
646
  else {
647
+ matchedDeposit = historicalDeposit.deposit;
732
648
  (0, utils_1.assert)(this.getRelayHashFromEvent(matchedDeposit) === relayDataHash, "Relay hashes should match.");
733
649
  validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({}, fill), { quoteTimestamp: matchedDeposit.quoteTimestamp }));
734
- v3RelayHashes[relayDataHash].fill = fillToRefund;
735
- }
736
- if (fill.relayExecutionInfo.fillType === interfaces_1.FillType.ReplacedSlowFill &&
737
- _canCreateSlowFillLeaf(matchedDeposit)) {
738
- fastFillsReplacingSlowFills.push(relayDataHash);
650
+ v3RelayHashes[relayDataHash].deposit = matchedDeposit;
651
+ if (fill.relayExecutionInfo.fillType === interfaces_1.FillType.ReplacedSlowFill &&
652
+ !matchedDeposit.fromLiteChain &&
653
+ !matchedDeposit.toLiteChain) {
654
+ fastFillsReplacingSlowFills.push(relayDataHash);
655
+ }
739
656
  }
740
- _a.label = 9;
741
- case 9: return [2];
657
+ _a.label = 2;
658
+ case 2: return [2];
742
659
  }
743
660
  });
744
661
  }); })];
@@ -762,15 +679,14 @@ var BundleDataClient = (function () {
762
679
  }
763
680
  (0, utils_1.assert)((0, utils_1.isDefined)(v3RelayHashes[relayDataHash].deposit), "Deposit should exist in relay hash dictionary.");
764
681
  matchedDeposit = v3RelayHashes[relayDataHash].deposit;
682
+ if (!_canCreateSlowFillLeaf(matchedDeposit)) {
683
+ return [2];
684
+ }
765
685
  if (slowFillRequest.blockNumber >= destinationChainBlockRange[0] &&
766
- _canCreateSlowFillLeaf(matchedDeposit) &&
767
- !_depositIsExpired(matchedDeposit)) {
686
+ slowFillRequest.fillDeadline >= bundleBlockTimestamps[destinationChainId][1]) {
768
687
  validatedBundleSlowFills.push(matchedDeposit);
769
688
  }
770
689
  }
771
- else {
772
- throw new Error("Duplicate slow fill request detected.");
773
- }
774
690
  return [2];
775
691
  }
776
692
  v3RelayHashes[relayDataHash] = {
@@ -790,7 +706,7 @@ var BundleDataClient = (function () {
790
706
  (0, utils_1.assert)(this.getRelayHashFromEvent(matchedDeposit) === relayDataHash, "Deposit relay hashes should match.");
791
707
  v3RelayHashes[relayDataHash].deposit = matchedDeposit;
792
708
  if (!_canCreateSlowFillLeaf(matchedDeposit) ||
793
- _depositIsExpired(matchedDeposit)) {
709
+ slowFillRequest.fillDeadline < bundleBlockTimestamps[destinationChainId][1]) {
794
710
  return [2];
795
711
  }
796
712
  validatedBundleSlowFills.push(matchedDeposit);
@@ -801,11 +717,17 @@ var BundleDataClient = (function () {
801
717
  }); })];
802
718
  case 2:
803
719
  _g.sent();
720
+ originBlockRange = (0, utils_1.getBlockRangeForChain)(blockRangesForChains, originChainId, chainIds);
804
721
  return [4, (0, utils_1.mapAsync)(bundleDepositHashes.filter(function (depositHash) {
805
722
  var deposit = v3RelayHashes[depositHash].deposit;
806
- return (deposit && deposit.originChainId === originChainId && deposit.destinationChainId === destinationChainId);
723
+ return (deposit &&
724
+ deposit.originChainId === originChainId &&
725
+ deposit.destinationChainId === destinationChainId &&
726
+ deposit.blockNumber >= originBlockRange[0] &&
727
+ deposit.blockNumber <= originBlockRange[1] &&
728
+ !(0, utils_1.isZeroValueDeposit)(deposit));
807
729
  }), function (depositHash) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
808
- var _a, deposit, fill, slowFillRequest, fillStatus, prefill, verifiedFill;
730
+ var _a, deposit, fill, slowFillRequest, fillStatus, prefill;
809
731
  return tslib_1.__generator(this, function (_b) {
810
732
  switch (_b.label) {
811
733
  case 0:
@@ -813,18 +735,17 @@ var BundleDataClient = (function () {
813
735
  if (!deposit)
814
736
  throw new Error("Deposit should exist in relay hash dictionary.");
815
737
  if (fill) {
816
- if (canRefundPrefills && fill.blockNumber < destinationChainBlockRange[0] && !(0, utils_1.isSlowFill)(fill)) {
738
+ if (!(0, utils_1.isSlowFill)(fill) && fill.blockNumber < destinationChainBlockRange[0]) {
817
739
  validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({}, fill), { quoteTimestamp: deposit.quoteTimestamp }));
818
740
  }
819
741
  return [2];
820
742
  }
821
743
  if (slowFillRequest) {
822
- if (_depositIsExpired(deposit)) {
744
+ if (deposit.fillDeadline < bundleBlockTimestamps[destinationChainId][1]) {
823
745
  updateExpiredDepositsV3(expiredDepositsToRefundV3, deposit);
824
746
  }
825
- else if (canRefundPrefills &&
826
- slowFillRequest.blockNumber < destinationChainBlockRange[0] &&
827
- _canCreateSlowFillLeaf(deposit)) {
747
+ else if (_canCreateSlowFillLeaf(deposit) &&
748
+ slowFillRequest.blockNumber < destinationChainBlockRange[0]) {
828
749
  validatedBundleSlowFills.push(deposit);
829
750
  }
830
751
  return [2];
@@ -832,30 +753,25 @@ var BundleDataClient = (function () {
832
753
  return [4, _getFillStatusForDeposit(deposit, destinationChainBlockRange[1])];
833
754
  case 1:
834
755
  fillStatus = _b.sent();
835
- if (!(fillStatus === interfaces_1.FillStatus.Filled)) return [3, 4];
836
- return [4, this.findMatchingFillEvent(deposit, destinationClient)];
756
+ if (!(fillStatus === interfaces_1.FillStatus.Filled)) return [3, 3];
757
+ return [4, (0, utils_1.findFillEvent)(destinationClient.spokePool, deposit, destinationClient.deploymentBlock, destinationClient.latestBlockSearched)];
837
758
  case 2:
838
- prefill = _b.sent();
839
- (0, utils_1.assert)((0, utils_1.isDefined)(prefill), "findFillEvent# Cannot find prefill: ".concat(depositHash));
840
- (0, utils_1.assert)(this.getRelayHashFromEvent(prefill) === depositHash, "Relay hashes should match.");
841
- return [4, (0, utils_2.verifyFillRepayment)(prefill, destinationClient.spokePool.provider, deposit, allChainIds)];
842
- case 3:
843
- verifiedFill = _b.sent();
844
- if (canRefundPrefills && (0, utils_1.isDefined)(verifiedFill) && !(0, utils_1.isSlowFill)(verifiedFill)) {
845
- validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({}, verifiedFill), { quoteTimestamp: deposit.quoteTimestamp }));
759
+ prefill = (_b.sent());
760
+ if (!(0, utils_1.isSlowFill)(prefill)) {
761
+ validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({}, prefill), { quoteTimestamp: deposit.quoteTimestamp }));
846
762
  }
847
- return [3, 5];
848
- case 4:
849
- if (_depositIsExpired(deposit)) {
763
+ return [3, 4];
764
+ case 3:
765
+ if (deposit.fillDeadline < bundleBlockTimestamps[destinationChainId][1]) {
850
766
  updateExpiredDepositsV3(expiredDepositsToRefundV3, deposit);
851
767
  }
852
768
  else if (fillStatus === interfaces_1.FillStatus.RequestedSlowFill) {
853
- if (canRefundPrefills && _canCreateSlowFillLeaf(deposit)) {
769
+ if (_canCreateSlowFillLeaf(deposit)) {
854
770
  validatedBundleSlowFills.push(deposit);
855
771
  }
856
772
  }
857
- _b.label = 5;
858
- case 5: return [2];
773
+ _b.label = 4;
774
+ case 4: return [2];
859
775
  }
860
776
  });
861
777
  }); })];
@@ -867,10 +783,10 @@ var BundleDataClient = (function () {
867
783
  if (!deposit) {
868
784
  throw new Error("Deposit should exist in relay hash dictionary.");
869
785
  }
870
- (0, utils_1.assert)(_canCreateSlowFillLeaf(deposit), "fastFillsReplacingSlowFills should contain only deposits that can be slow filled");
786
+ (0, utils_1.assert)(!deposit.fromLiteChain && !deposit.toLiteChain, "fastFillsReplacingSlowFills should not contain lite chain deposits");
871
787
  var destinationBlockRange = (0, utils_1.getBlockRangeForChain)(blockRangesForChains, destinationChainId, chainIds);
872
- if (!slowFillRequest ||
873
- slowFillRequest.blockNumber < destinationBlockRange[0]) {
788
+ if (_this.clients.hubPoolClient.areTokensEquivalent(deposit.inputToken, deposit.originChainId, deposit.outputToken, deposit.destinationChainId, deposit.quoteBlockNumber) &&
789
+ (!slowFillRequest || slowFillRequest.blockNumber < destinationBlockRange[0])) {
874
790
  validatedBundleUnexecutableSlowFills.push(deposit);
875
791
  }
876
792
  });
@@ -923,7 +839,7 @@ var BundleDataClient = (function () {
923
839
  destinationBlockRange = (0, utils_1.getBlockRangeForChain)(blockRangesForChains, destinationChainId, chainIds);
924
840
  if (!(!fill &&
925
841
  (0, utils_1.isDefined)(deposit) &&
926
- _depositIsExpired(deposit) &&
842
+ deposit.fillDeadline < bundleBlockTimestamps[destinationChainId][1] &&
927
843
  deposit.fillDeadline >= bundleBlockTimestamps[destinationChainId][0] &&
928
844
  spokePoolClients[destinationChainId] !== undefined)) return [3, 2];
929
845
  return [4, _getFillStatusForDeposit(deposit, destinationBlockRange[1])];
@@ -932,10 +848,11 @@ var BundleDataClient = (function () {
932
848
  if (fillStatus !== interfaces_1.FillStatus.Filled) {
933
849
  updateExpiredDepositsV3(expiredDepositsToRefundV3, deposit);
934
850
  }
935
- if (fillStatus !== interfaces_1.FillStatus.RequestedSlowFill || !_canCreateSlowFillLeaf(deposit)) {
851
+ if (fillStatus !== interfaces_1.FillStatus.RequestedSlowFill || deposit.fromLiteChain || deposit.toLiteChain) {
936
852
  return [2];
937
853
  }
938
- if (!slowFillRequest || slowFillRequest.blockNumber < destinationBlockRange[0]) {
854
+ if (this.clients.hubPoolClient.areTokensEquivalent(deposit.inputToken, deposit.originChainId, deposit.outputToken, deposit.destinationChainId, deposit.quoteBlockNumber) &&
855
+ (!slowFillRequest || slowFillRequest.blockNumber < destinationBlockRange[0])) {
939
856
  validatedBundleUnexecutableSlowFills.push(deposit);
940
857
  }
941
858
  _b.label = 2;
@@ -979,7 +896,7 @@ var BundleDataClient = (function () {
979
896
  var associatedDeposit = v3RelayHashes[_this.getRelayHashFromEvent(fill)].deposit;
980
897
  (0, utils_1.assert)((0, utils_1.isDefined)(associatedDeposit), "Deposit should exist in relay hash dictionary.");
981
898
  var _b = (0, utils_2.getRefundInformationFromFill)(fill, _this.clients.hubPoolClient, blockRangesForChains, chainIds, associatedDeposit.fromLiteChain), chainToSendRefundTo = _b.chainToSendRefundTo, repaymentToken = _b.repaymentToken;
982
- updateBundleFillsV3(bundleFillsV3, fill, realizedLpFeePct, chainToSendRefundTo, repaymentToken, fill.relayer);
899
+ updateBundleFillsV3(bundleFillsV3, fill, realizedLpFeePct, chainToSendRefundTo, repaymentToken);
983
900
  });
984
901
  v3SlowFillLpFees.forEach(function (_a, idx) {
985
902
  var lpFeePct = _a.realizedLpFeePct;
@@ -1018,17 +935,7 @@ var BundleDataClient = (function () {
1018
935
  });
1019
936
  };
1020
937
  BundleDataClient.prototype.getRelayHashFromEvent = function (event) {
1021
- return "".concat(event.depositor, "-").concat(event.recipient, "-").concat(event.exclusiveRelayer, "-").concat(event.inputToken, "-").concat(event.outputToken, "-").concat(event.inputAmount, "-").concat(event.outputAmount, "-").concat(event.originChainId, "-").concat(event.depositId.toString(), "-").concat(event.fillDeadline, "-").concat(event.exclusivityDeadline, "-").concat(event.message, "-").concat(event.destinationChainId);
1022
- };
1023
- BundleDataClient.prototype.findMatchingFillEvent = function (deposit, spokePoolClient) {
1024
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1025
- return tslib_1.__generator(this, function (_a) {
1026
- switch (_a.label) {
1027
- case 0: return [4, (0, utils_1.findFillEvent)(spokePoolClient.spokePool, deposit, spokePoolClient.deploymentBlock, spokePoolClient.latestBlockSearched)];
1028
- case 1: return [2, _a.sent()];
1029
- }
1030
- });
1031
- });
938
+ return "".concat(event.depositor, "-").concat(event.recipient, "-").concat(event.exclusiveRelayer, "-").concat(event.inputToken, "-").concat(event.outputToken, "-").concat(event.inputAmount, "-").concat(event.outputAmount, "-").concat(event.originChainId, "-").concat(event.depositId, "-").concat(event.fillDeadline, "-").concat(event.exclusivityDeadline, "-").concat(event.message, "-").concat(event.destinationChainId);
1032
939
  };
1033
940
  BundleDataClient.prototype.getBundleBlockTimestamps = function (chainIds, blockRangesForChains, spokePoolClients) {
1034
941
  return tslib_1.__awaiter(this, void 0, void 0, function () {
@@ -1039,7 +946,7 @@ var BundleDataClient = (function () {
1039
946
  case 0:
1040
947
  _b = (_a = Object).fromEntries;
1041
948
  return [4, (0, utils_1.mapAsync)(chainIds, function (chainId, index) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1042
- var blockRangeForChain, _startBlockForChain, _endBlockForChain, spokePoolClient, startBlockForChain, endBlockForChain, _a, startTime, _endTime, _b, endBlockDelta, endTime;
949
+ var blockRangeForChain, _startBlockForChain, _endBlockForChain, spokePoolClient, startBlockForChain, endBlockForChain, _a, startTime, endTime, _b;
1043
950
  return tslib_1.__generator(this, function (_c) {
1044
951
  switch (_c.label) {
1045
952
  case 0:
@@ -1053,7 +960,7 @@ var BundleDataClient = (function () {
1053
960
  return [2];
1054
961
  }
1055
962
  startBlockForChain = Math.min(_startBlockForChain, spokePoolClient.latestBlockSearched);
1056
- endBlockForChain = Math.min(_endBlockForChain + 1, spokePoolClient.latestBlockSearched);
963
+ endBlockForChain = Math.min(_endBlockForChain, spokePoolClient.latestBlockSearched);
1057
964
  return [4, spokePoolClient.getTimestampForBlock(startBlockForChain)];
1058
965
  case 1:
1059
966
  _b = [
@@ -1063,10 +970,8 @@ var BundleDataClient = (function () {
1063
970
  case 2:
1064
971
  _a = _b.concat([
1065
972
  _c.sent()
1066
- ]), startTime = _a[0], _endTime = _a[1];
1067
- endBlockDelta = endBlockForChain > startBlockForChain ? 1 : 0;
1068
- endTime = Math.max(0, _endTime - endBlockDelta);
1069
- (0, utils_1.assert)(endTime >= startTime, "End time for block ".concat(endBlockForChain, " should be greater than start time for block ").concat(startBlockForChain, ": ").concat(endTime, " >= ").concat(startTime, "."));
973
+ ]), startTime = _a[0], endTime = _a[1];
974
+ (0, utils_1.assert)(endTime >= startTime, "End time should be greater than start time.");
1070
975
  (0, utils_1.assert)(startBlockForChain === 0 || startTime > 0, "Start timestamp must be greater than 0 if the start block is greater than 0.");
1071
976
  return [2, [chainId, [startTime, endTime]]];
1072
977
  }