@across-protocol/sdk 4.1.46-beta.2 → 4.1.46-beta.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.
Files changed (73) hide show
  1. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  2. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +11 -15
  3. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  4. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +6 -52
  5. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  6. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +1 -1
  7. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  8. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +20 -48
  9. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +6 -8
  10. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  11. package/dist/cjs/clients/HubPoolClient.js +6 -6
  12. package/dist/cjs/clients/HubPoolClient.js.map +1 -1
  13. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
  14. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  15. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +1 -1
  16. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  17. package/dist/cjs/clients/mocks/MockConfigStoreClient.js +2 -2
  18. package/dist/cjs/clients/mocks/MockConfigStoreClient.js.map +1 -1
  19. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +5 -5
  20. package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
  21. package/dist/cjs/interfaces/Common.d.ts +2 -2
  22. package/dist/cjs/utils/EventUtils.d.ts +1 -2
  23. package/dist/cjs/utils/EventUtils.js +12 -21
  24. package/dist/cjs/utils/EventUtils.js.map +1 -1
  25. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  26. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +11 -15
  27. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  28. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +7 -58
  29. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  30. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +1 -1
  31. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  32. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +20 -48
  33. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +3 -5
  34. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  35. package/dist/esm/clients/HubPoolClient.js +6 -6
  36. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  37. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
  38. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  39. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +1 -1
  40. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  41. package/dist/esm/clients/mocks/MockConfigStoreClient.js +3 -3
  42. package/dist/esm/clients/mocks/MockConfigStoreClient.js.map +1 -1
  43. package/dist/esm/clients/mocks/MockSpokePoolClient.js +5 -5
  44. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  45. package/dist/esm/interfaces/Common.d.ts +2 -2
  46. package/dist/esm/utils/EventUtils.d.ts +1 -2
  47. package/dist/esm/utils/EventUtils.js +10 -18
  48. package/dist/esm/utils/EventUtils.js.map +1 -1
  49. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  50. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  51. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  52. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
  53. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +20 -48
  54. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
  55. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  56. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  57. package/dist/types/clients/mocks/MockConfigStoreClient.d.ts.map +1 -1
  58. package/dist/types/interfaces/Common.d.ts +2 -2
  59. package/dist/types/interfaces/Common.d.ts.map +1 -1
  60. package/dist/types/utils/EventUtils.d.ts +1 -2
  61. package/dist/types/utils/EventUtils.d.ts.map +1 -1
  62. package/package.json +1 -1
  63. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +15 -17
  64. package/src/clients/BundleDataClient/BundleDataClient.ts +5 -107
  65. package/src/clients/BundleDataClient/utils/FillUtils.ts +3 -1
  66. package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +3 -7
  67. package/src/clients/HubPoolClient.ts +10 -7
  68. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +1 -2
  69. package/src/clients/SpokePoolClient/SpokePoolClient.ts +1 -1
  70. package/src/clients/mocks/MockConfigStoreClient.ts +3 -10
  71. package/src/clients/mocks/MockSpokePoolClient.ts +5 -5
  72. package/src/interfaces/Common.ts +2 -2
  73. package/src/utils/EventUtils.ts +13 -19
@@ -884,13 +884,11 @@ export class HubPoolClient extends BaseAbstractClient {
884
884
  if (eventsToQuery.includes("CrossChainContractsSet")) {
885
885
  for (const event of events["CrossChainContractsSet"]) {
886
886
  const args = spreadEventWithBlockNumber(event) as CrossChainContractsSet;
887
- const dataToAdd: CrossChainContractsSet = {
887
+ const dataToAdd = {
888
888
  spokePool: args.spokePool,
889
889
  blockNumber: args.blockNumber,
890
- txnRef: args.txnRef,
890
+ transactionIndex: args.transactionIndex,
891
891
  logIndex: args.logIndex,
892
- txnIndex: args.txnIndex,
893
- l2ChainId: args.l2ChainId,
894
892
  };
895
893
  // If the chain is SVM then our `args.spokePool` will be set to the `solanaSpokePool.toAddressUnchecked()` in the
896
894
  // hubpool event because our hub deals with `address` types and not byte32. Therefore, we should confirm that the
@@ -948,9 +946,9 @@ export class HubPoolClient extends BaseAbstractClient {
948
946
  l1Token: args.l1Token,
949
947
  l2Token: destinationToken,
950
948
  blockNumber: args.blockNumber,
951
- txnIndex: args.txnIndex,
949
+ transactionIndex: args.transactionIndex,
952
950
  logIndex: args.logIndex,
953
- txnRef: args.txnRef,
951
+ transactionHash: args.transactionHash,
954
952
  },
955
953
  ]
956
954
  );
@@ -996,7 +994,12 @@ export class HubPoolClient extends BaseAbstractClient {
996
994
  this.proposedRootBundles.push(
997
995
  ...events["ProposeRootBundle"]
998
996
  .filter((event) => !this.configOverride.ignoredHubProposedBundles.includes(event.blockNumber))
999
- .map((event) => spreadEventWithBlockNumber(event) as ProposedRootBundle)
997
+ .map((event) => {
998
+ return {
999
+ ...spreadEventWithBlockNumber(event),
1000
+ transactionHash: event.transactionHash,
1001
+ } as ProposedRootBundle;
1002
+ })
1000
1003
  );
1001
1004
  }
1002
1005
 
@@ -19,7 +19,6 @@ import {
19
19
  } from "../../utils";
20
20
  import {
21
21
  EventSearchConfig,
22
- logToSortableEvent,
23
22
  paginatedEventQuery,
24
23
  sortEventsAscendingInPlace,
25
24
  spreadEventWithBlockNumber,
@@ -128,7 +127,7 @@ export class EVMSpokePoolClient extends SpokePoolClient {
128
127
  }
129
128
 
130
129
  // Sort all events to ensure they are stored in a consistent order.
131
- events.forEach((events) => sortEventsAscendingInPlace(events.map(logToSortableEvent)));
130
+ events.forEach((events) => sortEventsAscendingInPlace(events));
132
131
 
133
132
  return {
134
133
  success: true,
@@ -401,7 +401,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
401
401
 
402
402
  // Log any invalid deposits with same deposit id but different params.
403
403
  const invalidFillsForDeposit = invalidFills.filter((x) => {
404
- const txnUid = `${x.txnRef}:${x.logIndex}`;
404
+ const txnUid = `${x.transactionHash}:${x.logIndex}`;
405
405
  // if txnUid doesn't exist in the invalidFills set, add it now, but log the corresponding fill.
406
406
  const newInvalidFill = x.depositId.eq(deposit.depositId) && !this.invalidFills.has(txnUid);
407
407
  if (newInvalidFill) {
@@ -2,14 +2,7 @@ import assert from "assert";
2
2
  import winston from "winston";
3
3
  import { Contract, ethers } from "ethers";
4
4
  import { Log } from "../../interfaces";
5
- import {
6
- getCurrentTime,
7
- EventSearchConfig,
8
- MakeOptional,
9
- isDefined,
10
- utf8ToHex,
11
- spreadEventWithBlockNumber,
12
- } from "../../utils";
5
+ import { getCurrentTime, EventSearchConfig, MakeOptional, isDefined, utf8ToHex } from "../../utils";
13
6
  import {
14
7
  AcrossConfigStoreClient,
15
8
  ConfigStoreUpdate,
@@ -99,9 +92,9 @@ export class MockConfigStoreClient extends AcrossConfigStoreClient {
99
92
  chainId: this.chainId as number,
100
93
  searchEndBlock: this.eventSearchConfig.toBlock || latestBlockSearched,
101
94
  events: {
102
- updatedGlobalConfigEvents: events["UpdatedGlobalConfig"].map(spreadEventWithBlockNumber),
95
+ updatedGlobalConfigEvents: events["UpdatedGlobalConfig"],
103
96
  globalConfigUpdateTimes,
104
- updatedTokenConfigEvents: events["UpdatedTokenConfig"].map(spreadEventWithBlockNumber),
97
+ updatedTokenConfigEvents: events["UpdatedTokenConfig"],
105
98
  },
106
99
  });
107
100
  }
@@ -129,7 +129,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
129
129
  }
130
130
 
131
131
  protected _deposit(event: string, deposit: Omit<Deposit, "messageHash"> & Partial<SortableEvent>): Log {
132
- const { blockNumber, txnIndex } = deposit;
132
+ const { blockNumber, transactionIndex } = deposit;
133
133
  let { depositId, destinationChainId, inputAmount, outputAmount } = deposit;
134
134
  depositId ??= this.numberOfDeposits;
135
135
  this.numberOfDeposits = depositId.add(bnOne);
@@ -171,7 +171,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
171
171
  topics: topics.map((topic) => topic.toString()),
172
172
  args,
173
173
  blockNumber,
174
- transactionIndex: txnIndex,
174
+ transactionIndex,
175
175
  });
176
176
  }
177
177
 
@@ -187,7 +187,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
187
187
  event: string,
188
188
  fill: Omit<Fill, "messageHash"> & { message: string } & Partial<SortableEvent>
189
189
  ): Log {
190
- const { blockNumber, txnIndex } = fill;
190
+ const { blockNumber, transactionIndex } = fill;
191
191
  let { originChainId, depositId, inputAmount, outputAmount, fillDeadline } = fill;
192
192
  originChainId ??= random(1, 42161, false);
193
193
  depositId ??= BigNumber.from(random(1, 100_000, false));
@@ -260,7 +260,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
260
260
  topics: topics.map((topic) => topic.toString()),
261
261
  args,
262
262
  blockNumber,
263
- transactionIndex: txnIndex,
263
+ transactionIndex,
264
264
  });
265
265
  }
266
266
 
@@ -335,7 +335,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
335
335
  exclusiveRelayer: addressModifier(args.exclusiveRelayer ?? ZERO_ADDRESS),
336
336
  },
337
337
  blockNumber: request.blockNumber,
338
- transactionIndex: request.txnIndex,
338
+ transactionIndex: request.transactionIndex,
339
339
  });
340
340
  }
341
341
 
@@ -9,9 +9,9 @@ export type Log = _Log & {
9
9
 
10
10
  export interface SortableEvent {
11
11
  blockNumber: number;
12
- txnIndex: number;
12
+ transactionIndex: number;
13
13
  logIndex: number;
14
- txnRef: string;
14
+ transactionHash: string;
15
15
  }
16
16
 
17
17
  export interface BigNumberForToken {
@@ -204,19 +204,13 @@ export function getPaginatedBlockRanges({
204
204
  return ranges;
205
205
  }
206
206
 
207
- export function logToSortableEvent(log: Log): SortableEvent {
208
- return {
209
- txnIndex: log.transactionIndex,
210
- txnRef: log.transactionHash,
211
- logIndex: log.logIndex,
212
- blockNumber: log.blockNumber,
213
- };
214
- }
215
-
216
207
  export function spreadEventWithBlockNumber(event: Log): SortableEvent {
217
208
  return {
218
209
  ...spreadEvent(event.args),
219
- ...logToSortableEvent(event),
210
+ blockNumber: event.blockNumber,
211
+ transactionIndex: event.transactionIndex,
212
+ logIndex: event.logIndex,
213
+ transactionHash: event.transactionHash,
220
214
  };
221
215
  }
222
216
 
@@ -232,8 +226,8 @@ export function sortEventsAscendingInPlace<T extends SortableEvent>(events: T[])
232
226
  if (ex.blockNumber !== ey.blockNumber) {
233
227
  return ex.blockNumber - ey.blockNumber;
234
228
  }
235
- if (ex.txnIndex !== ey.txnIndex) {
236
- return ex.txnIndex - ey.txnIndex;
229
+ if (ex.transactionIndex !== ey.transactionIndex) {
230
+ return ex.transactionIndex - ey.transactionIndex;
237
231
  }
238
232
  return ex.logIndex - ey.logIndex;
239
233
  });
@@ -251,8 +245,8 @@ export function sortEventsDescendingInPlace<T extends SortableEvent>(events: T[]
251
245
  if (ex.blockNumber !== ey.blockNumber) {
252
246
  return ey.blockNumber - ex.blockNumber;
253
247
  }
254
- if (ex.txnIndex !== ey.txnIndex) {
255
- return ey.txnIndex - ex.txnIndex;
248
+ if (ex.transactionIndex !== ey.transactionIndex) {
249
+ return ey.transactionIndex - ex.transactionIndex;
256
250
  }
257
251
  return ey.logIndex - ex.logIndex;
258
252
  });
@@ -263,16 +257,16 @@ export function isEventOlder<T extends SortableEvent>(ex: T, ey: T): boolean {
263
257
  if (ex.blockNumber !== ey.blockNumber) {
264
258
  return ex.blockNumber < ey.blockNumber;
265
259
  }
266
- if (ex.txnIndex !== ey.txnIndex) {
267
- return ex.txnIndex < ey.txnIndex;
260
+ if (ex.transactionIndex !== ey.transactionIndex) {
261
+ return ex.transactionIndex < ey.transactionIndex;
268
262
  }
269
263
  return ex.logIndex < ey.logIndex;
270
264
  }
271
265
 
272
- export function getTransactionRefs(events: SortableEvent[]): string[] {
273
- return [...Array.from(new Set(events.map((e) => e.txnRef)))];
266
+ export function getTransactionHashes(events: SortableEvent[]): string[] {
267
+ return [...Array.from(new Set(events.map((e) => e.transactionHash)))];
274
268
  }
275
269
 
276
270
  export function duplicateEvent(a: SortableEvent, b: SortableEvent): boolean {
277
- return a.txnRef === b.txnRef && a.logIndex === b.logIndex;
271
+ return a.transactionHash === b.transactionHash && a.logIndex === b.logIndex;
278
272
  }