@across-protocol/sdk 4.2.2-alpha.0 → 4.2.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 (111) hide show
  1. package/dist/cjs/arch/svm/BlockUtils.d.ts +15 -0
  2. package/dist/cjs/arch/svm/BlockUtils.js +181 -0
  3. package/dist/cjs/arch/svm/BlockUtils.js.map +1 -0
  4. package/dist/cjs/arch/svm/index.d.ts +1 -0
  5. package/dist/cjs/arch/svm/index.js +1 -0
  6. package/dist/cjs/arch/svm/index.js.map +1 -1
  7. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +1 -1
  8. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -1
  9. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  10. package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +3 -3
  11. package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js +19 -18
  12. package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -1
  13. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -4
  14. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +13 -5
  15. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  16. package/dist/cjs/clients/SpokePoolClient/index.d.ts +3 -3
  17. package/dist/cjs/clients/SpokePoolClient/index.js +5 -5
  18. package/dist/cjs/clients/index.d.ts +1 -1
  19. package/dist/cjs/clients/index.js +2 -2
  20. package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +11 -5
  21. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +35 -18
  22. package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
  23. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  24. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +1 -1
  25. package/dist/cjs/constants.d.ts +1 -1
  26. package/dist/cjs/constants.js +3 -1
  27. package/dist/cjs/constants.js.map +1 -1
  28. package/dist/cjs/interfaces/SpokePool.d.ts +3 -1
  29. package/dist/cjs/interfaces/SpokePool.js.map +1 -1
  30. package/dist/cjs/providers/infura.js +1 -0
  31. package/dist/cjs/providers/infura.js.map +1 -1
  32. package/dist/cjs/utils/BlockFinder.d.ts +0 -1
  33. package/dist/cjs/utils/BlockFinder.js.map +1 -1
  34. package/dist/cjs/utils/NetworkUtils.d.ts +0 -2
  35. package/dist/cjs/utils/NetworkUtils.js +18 -26
  36. package/dist/cjs/utils/NetworkUtils.js.map +1 -1
  37. package/dist/esm/arch/svm/BlockUtils.d.ts +25 -0
  38. package/dist/esm/arch/svm/BlockUtils.js +208 -0
  39. package/dist/esm/arch/svm/BlockUtils.js.map +1 -0
  40. package/dist/esm/arch/svm/index.d.ts +1 -0
  41. package/dist/esm/arch/svm/index.js +1 -0
  42. package/dist/esm/arch/svm/index.js.map +1 -1
  43. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +2 -2
  44. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +3 -2
  45. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  46. package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +3 -3
  47. package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js +19 -18
  48. package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -1
  49. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -4
  50. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +13 -5
  51. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  52. package/dist/esm/clients/SpokePoolClient/index.d.ts +3 -3
  53. package/dist/esm/clients/SpokePoolClient/index.js +4 -4
  54. package/dist/esm/clients/index.d.ts +1 -1
  55. package/dist/esm/clients/index.js +1 -1
  56. package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +11 -5
  57. package/dist/esm/clients/mocks/MockSpokePoolClient.js +38 -21
  58. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  59. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  60. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +2 -2
  61. package/dist/esm/constants.d.ts +1 -1
  62. package/dist/esm/constants.js +1 -1
  63. package/dist/esm/constants.js.map +1 -1
  64. package/dist/esm/interfaces/SpokePool.d.ts +3 -1
  65. package/dist/esm/interfaces/SpokePool.js.map +1 -1
  66. package/dist/esm/providers/infura.js +1 -0
  67. package/dist/esm/providers/infura.js.map +1 -1
  68. package/dist/esm/utils/BlockFinder.d.ts +0 -1
  69. package/dist/esm/utils/BlockFinder.js.map +1 -1
  70. package/dist/esm/utils/NetworkUtils.d.ts +0 -12
  71. package/dist/esm/utils/NetworkUtils.js +5 -19
  72. package/dist/esm/utils/NetworkUtils.js.map +1 -1
  73. package/dist/types/arch/svm/BlockUtils.d.ts +26 -0
  74. package/dist/types/arch/svm/BlockUtils.d.ts.map +1 -0
  75. package/dist/types/arch/svm/index.d.ts +1 -0
  76. package/dist/types/arch/svm/index.d.ts.map +1 -1
  77. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  78. package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +3 -3
  79. package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts.map +1 -1
  80. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -4
  81. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
  82. package/dist/types/clients/SpokePoolClient/index.d.ts +3 -3
  83. package/dist/types/clients/index.d.ts +1 -1
  84. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +11 -5
  85. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
  86. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  87. package/dist/types/constants.d.ts +1 -1
  88. package/dist/types/constants.d.ts.map +1 -1
  89. package/dist/types/interfaces/SpokePool.d.ts +3 -1
  90. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  91. package/dist/types/providers/infura.d.ts.map +1 -1
  92. package/dist/types/utils/BlockFinder.d.ts +0 -1
  93. package/dist/types/utils/BlockFinder.d.ts.map +1 -1
  94. package/dist/types/utils/NetworkUtils.d.ts +0 -12
  95. package/dist/types/utils/NetworkUtils.d.ts.map +1 -1
  96. package/package.json +1 -1
  97. package/src/arch/svm/BlockUtils.ts +171 -0
  98. package/src/arch/svm/index.ts +1 -0
  99. package/src/clients/BundleDataClient/BundleDataClient.ts +2 -2
  100. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +3 -1
  101. package/src/clients/SpokePoolClient/SVMSpokePoolClient.ts +6 -4
  102. package/src/clients/SpokePoolClient/SpokePoolClient.ts +18 -8
  103. package/src/clients/SpokePoolClient/index.ts +4 -4
  104. package/src/clients/index.ts +1 -1
  105. package/src/clients/mocks/MockSpokePoolClient.ts +66 -36
  106. package/src/clients/mocks/MockSvmSpokePoolClient.ts +2 -2
  107. package/src/constants.ts +2 -0
  108. package/src/interfaces/SpokePool.ts +4 -1
  109. package/src/providers/infura.ts +1 -0
  110. package/src/utils/BlockFinder.ts +0 -1
  111. package/src/utils/NetworkUtils.ts +13 -21
@@ -19,6 +19,7 @@ import {
19
19
  validateFillForDeposit,
20
20
  chainIsEvm,
21
21
  chainIsProd,
22
+ Address,
22
23
  } from "../../utils";
23
24
  import { duplicateEvent, sortEventsAscendingInPlace } from "../../utils/EventUtils";
24
25
  import { ZERO_ADDRESS } from "../../constants";
@@ -86,6 +87,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
86
87
  protected relayerRefundExecutions: RelayerRefundExecutionWithBlock[] = [];
87
88
  protected configStoreClient: AcrossConfigStoreClient | undefined;
88
89
  protected invalidFills: Set<string> = new Set();
90
+ public spokePoolAddress: Address | undefined;
89
91
  public fills: { [OriginChainId: number]: FillWithBlock[] } = {};
90
92
 
91
93
  /**
@@ -300,10 +302,9 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
300
302
  * @param relayData RelayData field for the SlowFill request.
301
303
  * @returns The corresponding SlowFillRequest event if found, otherwise undefined.
302
304
  */
303
- public getSlowFillRequest(
304
- relayData: Omit<RelayData, "message"> & { messageHash: string }
305
- ): SlowFillRequestWithBlock | undefined {
306
- const hash = getRelayEventKey({ ...relayData, destinationChainId: this.chainId });
305
+ public getSlowFillRequest(relayData: RelayData): SlowFillRequestWithBlock | undefined {
306
+ const messageHash = getMessageHash(relayData.message);
307
+ const hash = getRelayEventKey({ ...relayData, messageHash, destinationChainId: this.chainId });
307
308
  return this.slowFillRequests[hash];
308
309
  }
309
310
 
@@ -554,7 +555,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
554
555
  }
555
556
  };
556
557
 
557
- for (const event of ["FundsDeposited"]) {
558
+ for (const event of ["V3FundsDeposited", "FundsDeposited"]) {
558
559
  if (eventsToQuery.includes(event)) {
559
560
  await queryDepositEvents(event);
560
561
  }
@@ -582,7 +583,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
582
583
  };
583
584
 
584
585
  // Update deposits with speed up requests from depositor.
585
- ["RequestedSpeedUpDeposit"].forEach((event) => {
586
+ ["RequestedSpeedUpV3Deposit", "RequestedSpeedUpDeposit"].forEach((event) => {
586
587
  if (eventsToQuery.includes(event)) {
587
588
  querySpeedUpDepositEvents(event);
588
589
  }
@@ -597,6 +598,10 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
597
598
  destinationChainId: this.chainId,
598
599
  };
599
600
 
601
+ if (eventName === "RequestedV3SlowFill") {
602
+ slowFillRequest.messageHash = getMessageHash(slowFillRequest.message);
603
+ }
604
+
600
605
  const depositHash = getRelayEventKey({ ...slowFillRequest, destinationChainId: this.chainId });
601
606
 
602
607
  // Sanity check that this event is not a duplicate.
@@ -609,7 +614,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
609
614
  }
610
615
  };
611
616
 
612
- ["RequestedSlowFill"].forEach((event) => {
617
+ ["RequestedV3SlowFill", "RequestedSlowFill"].forEach((event) => {
613
618
  if (eventsToQuery.includes(event)) {
614
619
  queryRequestedSlowFillEvents(event);
615
620
  }
@@ -633,6 +638,11 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
633
638
  destinationChainId: this.chainId,
634
639
  };
635
640
 
641
+ if (eventName === "FilledV3Relay") {
642
+ fill.messageHash = getMessageHash((event as unknown as { message: string }).message);
643
+ fill.relayExecutionInfo.updatedMessageHash = getMessageHash(event.relayExecutionInfo.updatedMessage!);
644
+ }
645
+
636
646
  // Sanity check that this event is not a duplicate.
637
647
  const duplicateFill = this.fills[fill.originChainId]?.find((f) => duplicateEvent(fill, f));
638
648
  if (duplicateFill) {
@@ -646,7 +656,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
646
656
  };
647
657
 
648
658
  // Update observed fills with ingested event data.
649
- ["FilledRelay"].forEach((event) => {
659
+ ["FilledV3Relay", "FilledRelay"].forEach((event) => {
650
660
  if (eventsToQuery.includes(event)) {
651
661
  queryFilledRelayEvents(event);
652
662
  }
@@ -1,10 +1,10 @@
1
1
  import { EVMSpokePoolClient } from "./EVMSpokePoolClient";
2
- import { SvmSpokePoolClient } from "./SVMSpokePoolClient";
2
+ import { SVMSpokePoolClient } from "./SVMSpokePoolClient";
3
3
  import { SpokePoolClient } from "./SpokePoolClient";
4
4
 
5
5
  export { EVMSpokePoolClient } from "./EVMSpokePoolClient";
6
6
  export { SpokePoolClient, SpokePoolUpdate } from "./SpokePoolClient";
7
- export { SvmSpokePoolClient } from "./SVMSpokePoolClient";
7
+ export { SVMSpokePoolClient } from "./SVMSpokePoolClient";
8
8
 
9
9
  /**
10
10
  * Checks if a SpokePoolClient is an EVMSpokePoolClient.
@@ -20,6 +20,6 @@ export function isEVMSpokePoolClient(spokePoolClient: SpokePoolClient): spokePoo
20
20
  * @param spokePoolClient The SpokePoolClient to check.
21
21
  * @returns True if the SpokePoolClient is an SVMSpokePoolClient, false otherwise.
22
22
  */
23
- export function isSvmSpokePoolClient(spokePoolClient: SpokePoolClient): spokePoolClient is SvmSpokePoolClient {
24
- return spokePoolClient instanceof SvmSpokePoolClient;
23
+ export function isSVMSpokePoolClient(spokePoolClient: SpokePoolClient): spokePoolClient is SVMSpokePoolClient {
24
+ return spokePoolClient instanceof SVMSpokePoolClient;
25
25
  }
@@ -6,6 +6,6 @@ export {
6
6
  } from "./AcrossConfigStoreClient";
7
7
  export { UpdateFailureReason } from "./BaseAbstractClient";
8
8
  export { HubPoolClient, LpFeeRequest } from "./HubPoolClient";
9
- export { SpokePoolClient, SpokePoolUpdate, EVMSpokePoolClient, SvmSpokePoolClient } from "./SpokePoolClient";
9
+ export { SpokePoolClient, SpokePoolUpdate, EVMSpokePoolClient, SVMSpokePoolClient } from "./SpokePoolClient";
10
10
  export * as BundleDataClient from "./BundleDataClient";
11
11
  export * as mocks from "./mocks";
@@ -25,6 +25,7 @@ import {
25
25
  BigNumber,
26
26
  bnZero,
27
27
  bnOne,
28
+ toAddress,
28
29
  toBytes32,
29
30
  spreadEventWithBlockNumber,
30
31
  } from "../../utils";
@@ -84,7 +85,6 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
84
85
  lastDepositId = _depositIds[i];
85
86
  }
86
87
  }
87
-
88
88
  _getDepositIdAtBlock(blockTag: number): Promise<BigNumber> {
89
89
  return Promise.resolve(this.depositIdAtBlock[blockTag]);
90
90
  }
@@ -129,6 +129,10 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
129
129
  return this._deposit("FundsDeposited", deposit);
130
130
  }
131
131
 
132
+ depositV3(deposit: Omit<Deposit, "messageHash"> & Partial<SortableEvent>): Log {
133
+ return this._deposit("V3FundsDeposited", deposit);
134
+ }
135
+
132
136
  protected _deposit(event: string, deposit: Omit<Deposit, "messageHash"> & Partial<SortableEvent>): Log {
133
137
  const { blockNumber, txnIndex } = deposit;
134
138
  let { depositId, destinationChainId, inputAmount, outputAmount } = deposit;
@@ -136,11 +140,12 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
136
140
  this.numberOfDeposits = depositId.add(bnOne);
137
141
 
138
142
  destinationChainId ??= random(1, 42161, false);
139
- const depositor = toBytes32(deposit.depositor ?? randomAddress());
140
- const recipient = toBytes32(deposit.recipient ?? depositor);
141
- const inputToken = toBytes32(deposit.inputToken ?? randomAddress());
142
- const outputToken = toBytes32(deposit.outputToken ?? inputToken);
143
- const exclusiveRelayer = toBytes32(deposit.exclusiveRelayer ?? ZERO_ADDRESS);
143
+ const addressModifier = event === "FundsDeposited" ? toBytes32 : toAddress;
144
+ const depositor = addressModifier(deposit.depositor ?? randomAddress());
145
+ const recipient = addressModifier(deposit.recipient ?? depositor);
146
+ const inputToken = addressModifier(deposit.inputToken ?? randomAddress());
147
+ const outputToken = addressModifier(deposit.outputToken ?? inputToken);
148
+ const exclusiveRelayer = addressModifier(deposit.exclusiveRelayer ?? ZERO_ADDRESS);
144
149
 
145
150
  inputAmount ??= toBNWei(random(1, 1000, false));
146
151
  outputAmount ??= inputAmount.mul(toBN("0.95"));
@@ -175,13 +180,17 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
175
180
  });
176
181
  }
177
182
 
178
- fillRelay(fill: Omit<Fill, "messageHash"> & { message?: string } & Partial<SortableEvent>): Log {
183
+ fillV3Relay(fill: Omit<Fill, "messageHash"> & { message: string } & Partial<SortableEvent>): Log {
184
+ return this._fillRelay("FilledV3Relay", fill);
185
+ }
186
+
187
+ fillRelay(fill: Omit<Fill, "messageHash"> & { message: string } & Partial<SortableEvent>): Log {
179
188
  return this._fillRelay("FilledRelay", fill);
180
189
  }
181
190
 
182
191
  protected _fillRelay(
183
192
  event: string,
184
- fill: Omit<Fill, "messageHash"> & { message?: string } & Partial<SortableEvent>
193
+ fill: Omit<Fill, "messageHash"> & { message: string } & Partial<SortableEvent>
185
194
  ): Log {
186
195
  const { blockNumber, txnIndex } = fill;
187
196
  let { originChainId, depositId, inputAmount, outputAmount, fillDeadline } = fill;
@@ -191,14 +200,15 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
191
200
  outputAmount ??= inputAmount;
192
201
  fillDeadline ??= getCurrentTime() + 60;
193
202
 
194
- const depositor = toBytes32(fill.depositor ?? randomAddress());
195
- const recipient = toBytes32(fill.recipient ?? depositor);
196
- const inputToken = toBytes32(fill.inputToken ?? randomAddress());
197
- const outputToken = toBytes32(fill.outputToken ?? ZERO_ADDRESS);
198
- const exclusiveRelayer = toBytes32(fill.exclusiveRelayer ?? ZERO_ADDRESS);
199
- const relayer = toBytes32(fill.relayer ?? randomAddress());
203
+ const addressModifier = event === "FilledRelay" ? toBytes32 : toAddress;
204
+ const depositor = addressModifier(fill.depositor ?? randomAddress());
205
+ const recipient = addressModifier(fill.recipient ?? depositor);
206
+ const inputToken = addressModifier(fill.inputToken ?? randomAddress());
207
+ const outputToken = addressModifier(fill.outputToken ?? ZERO_ADDRESS);
208
+ const exclusiveRelayer = addressModifier(fill.exclusiveRelayer ?? ZERO_ADDRESS);
209
+ const relayer = addressModifier(fill.relayer ?? randomAddress());
200
210
 
201
- const topics = [originChainId, depositId, relayer];
211
+ const topics = [originChainId, depositId, relayer]; // @todo verify
202
212
  const message = fill.message ?? EMPTY_MESSAGE;
203
213
  const updatedMessage = fill.relayExecutionInfo?.updatedMessage ?? message;
204
214
 
@@ -229,14 +239,25 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
229
239
  },
230
240
  };
231
241
 
232
- const args = {
233
- ..._args,
234
- messageHash: getMessageHash(message),
235
- relayExecutionInfo: {
236
- ...relayExecutionInfo,
237
- updatedMessageHash: getMessageHash(updatedMessage),
238
- },
239
- };
242
+ const args =
243
+ event === "FilledRelay"
244
+ ? {
245
+ ..._args,
246
+ messageHash: getMessageHash(message),
247
+ relayExecutionInfo: {
248
+ ...relayExecutionInfo,
249
+ updatedMessageHash: getMessageHash(updatedMessage),
250
+ },
251
+ }
252
+ : {
253
+ // FilledV3Relay
254
+ ..._args,
255
+ message,
256
+ relayExecutionInfo: {
257
+ ...relayExecutionInfo,
258
+ updatedMessage,
259
+ },
260
+ };
240
261
 
241
262
  return this.eventManager.generateEvent({
242
263
  event,
@@ -248,12 +269,17 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
248
269
  });
249
270
  }
250
271
 
272
+ speedUpV3Deposit(speedUp: SpeedUp): Log {
273
+ return this._speedUpDeposit("RequestedSpeedUpV3Deposit", speedUp);
274
+ }
275
+
251
276
  speedUpDeposit(speedUp: SpeedUp): Log {
252
277
  return this._speedUpDeposit("RequestedSpeedUpDeposit", speedUp);
253
278
  }
254
279
 
255
280
  protected _speedUpDeposit(event: string, speedUp: SpeedUp): Log {
256
- const depositor = toBytes32(speedUp.depositor);
281
+ const addressModifier = event === "RequestedSpeedUpDeposit" ? toBytes32 : toAddress;
282
+ const depositor = addressModifier(speedUp.depositor);
257
283
  const topics = [speedUp.depositId, depositor];
258
284
  const args = { ...speedUp };
259
285
 
@@ -264,7 +290,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
264
290
  args: {
265
291
  ...args,
266
292
  depositor,
267
- updatedRecipient: toBytes32(speedUp.updatedRecipient),
293
+ updatedRecipient: addressModifier(speedUp.updatedRecipient),
268
294
  },
269
295
  });
270
296
  }
@@ -282,19 +308,24 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
282
308
  });
283
309
  }
284
310
 
285
- requestSlowFill(request: Omit<SlowFillRequest, "destinationChainId"> & Partial<SortableEvent>): Log {
311
+ requestV3SlowFill(request: Omit<SlowFillRequest, "messageHash"> & Partial<SortableEvent>): Log {
312
+ return this._requestSlowFill("RequestedV3SlowFill", request);
313
+ }
314
+
315
+ requestSlowFill(request: Omit<SlowFillRequest, "messageHash"> & Partial<SortableEvent>): Log {
286
316
  return this._requestSlowFill("RequestedSlowFill", request);
287
317
  }
288
318
 
289
319
  protected _requestSlowFill(
290
320
  event: string,
291
- request: Omit<SlowFillRequest, "destinationChainId"> & Partial<SortableEvent>
321
+ request: Omit<SlowFillRequest, "messageHash"> & Partial<SortableEvent>
292
322
  ): Log {
293
323
  const { originChainId, depositId } = request;
294
324
  const topics = [originChainId, depositId];
295
325
  const args = { ...request };
296
326
 
297
- const depositor = toBytes32(args.depositor ?? randomAddress());
327
+ const addressModifier = event === "RequestedSlowFill" ? toBytes32 : toAddress;
328
+ const depositor = addressModifier(args.depositor ?? randomAddress());
298
329
 
299
330
  return this.eventManager.generateEvent({
300
331
  event,
@@ -302,21 +333,20 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
302
333
  topics: topics.map((topic) => topic.toString()),
303
334
  args: {
304
335
  ...args,
305
- destinationChainId: this.chainId,
306
336
  depositor,
307
- recipient: toBytes32(args.recipient ?? depositor),
308
- inputToken: toBytes32(args.inputToken ?? randomAddress()),
309
- outputToken: toBytes32(args.outputToken ?? ZERO_ADDRESS),
310
- exclusiveRelayer: toBytes32(args.exclusiveRelayer ?? ZERO_ADDRESS),
337
+ recipient: addressModifier(args.recipient ?? depositor),
338
+ inputToken: addressModifier(args.inputToken ?? randomAddress()),
339
+ outputToken: addressModifier(args.outputToken ?? ZERO_ADDRESS),
340
+ exclusiveRelayer: addressModifier(args.exclusiveRelayer ?? ZERO_ADDRESS),
311
341
  },
312
342
  blockNumber: request.blockNumber,
313
343
  transactionIndex: request.txnIndex,
314
344
  });
315
345
  }
316
346
 
317
- // This is a simple wrapper around fillRelay().
347
+ // This is a simple wrapper around fillV3Relay().
318
348
  // rootBundleId and proof are discarded here - we have no interest in verifying that.
319
- executeSlowRelayLeaf(leaf: Omit<SlowFillLeaf, "messageHash">): Log {
349
+ executeV3SlowRelayLeaf(leaf: Omit<SlowFillLeaf, "messageHash">): Log {
320
350
  const fill = {
321
351
  ...leaf.relayData,
322
352
  destinationChainId: this.chainId,
@@ -331,7 +361,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
331
361
  },
332
362
  };
333
363
 
334
- return this.fillRelay(fill);
364
+ return this.fillV3Relay(fill);
335
365
  }
336
366
 
337
367
  executeRelayerRefundLeaf(refund: RelayerRefundExecution & Partial<SortableEvent>): Log {
@@ -3,7 +3,7 @@ import { SvmSpokeClient } from "@across-protocol/contracts";
3
3
  import { Address } from "@solana/kit";
4
4
  import { DepositWithBlock, RelayerRefundExecution, SortableEvent, SlowFillLeaf, Log } from "../../interfaces";
5
5
  import { getCurrentTime, bnZero, MakeOptional, EventSearchConfig } from "../../utils";
6
- import { SpokePoolUpdate, SvmSpokePoolClient } from "../SpokePoolClient";
6
+ import { SpokePoolUpdate, SVMSpokePoolClient } from "../SpokePoolClient";
7
7
  import { HubPoolClient } from "../HubPoolClient";
8
8
  import { EventOverrides } from "./MockEvents";
9
9
  import { AcrossConfigStoreClient } from "../AcrossConfigStoreClient";
@@ -12,7 +12,7 @@ import { EventWithData, SvmCpiEventsClient, SVMEventNames, unwrapEventData } fro
12
12
 
13
13
  // This class replaces internal SpokePoolClient functionality, enabling
14
14
  // the user to bypass on-chain queries and inject events directly.
15
- export class MockSvmSpokePoolClient extends SvmSpokePoolClient {
15
+ export class MockSvmSpokePoolClient extends SVMSpokePoolClient {
16
16
  public mockEventsClient: MockSvmCpiEventsClient;
17
17
  private destinationTokenForChainOverride: Record<number, string> = {};
18
18
 
package/src/constants.ts CHANGED
@@ -2,10 +2,12 @@ import { constants as ethersConstants } from "ethers";
2
2
  import { CHAIN_IDs, TOKEN_SYMBOLS_MAP } from "@across-protocol/constants";
3
3
 
4
4
  export {
5
+ CCTP_NO_DOMAIN,
5
6
  ChainFamily,
6
7
  CHAIN_IDs,
7
8
  MAINNET_CHAIN_IDs,
8
9
  PUBLIC_NETWORKS,
10
+ PRODUCTION_NETWORKS,
9
11
  TESTNET_CHAIN_IDs,
10
12
  TOKEN_SYMBOLS_MAP,
11
13
  TOKEN_EQUIVALENCE_REMAPPING,
@@ -1,8 +1,11 @@
1
1
  import { SortableEvent } from "./Common";
2
+ import { FilledV3RelayEvent, V3FundsDepositedEvent } from "../typechain";
2
3
  import { SpokePoolClient } from "../clients";
3
4
  import { BigNumber } from "../utils";
4
5
  import { RelayerRefundLeaf } from "./HubPool";
5
6
 
7
+ export type { FilledV3RelayEvent, V3FundsDepositedEvent };
8
+
6
9
  export interface RelayData {
7
10
  originChainId: number;
8
11
  depositor: string;
@@ -90,7 +93,7 @@ export interface SpeedUp {
90
93
 
91
94
  export interface SpeedUpWithBlock extends SpeedUp, SortableEvent {}
92
95
 
93
- export interface SlowFillRequest extends Omit<RelayData, "message"> {
96
+ export interface SlowFillRequest extends RelayData {
94
97
  messageHash: string;
95
98
  destinationChainId: number;
96
99
  }
@@ -6,6 +6,7 @@ const MAINNET_CHAIN_IDs = Object.values(_MAINNET_CHAIN_IDs);
6
6
  // Chain-specific overrides for when the endpoint name does not match the canonical chain name.
7
7
  const endpoints: { [chainId: string]: string } = {
8
8
  [CHAIN_IDs.ARBITRUM]: "arbitrum",
9
+ [CHAIN_IDs.BSC]: "bsc",
9
10
  };
10
11
 
11
12
  export function getURL(chainId: number, apiKey: string, transport: RPCTransport): string {
@@ -11,7 +11,6 @@ export type BlockTimeAverage = {
11
11
  };
12
12
 
13
13
  export interface Block {
14
- hash: string;
15
14
  number: number;
16
15
  timestamp: number;
17
16
  }
@@ -1,5 +1,12 @@
1
- import { CCTP_NO_DOMAIN } from "@across-protocol/constants";
2
- import { ChainFamily, CHAIN_IDs, MAINNET_CHAIN_IDs, PUBLIC_NETWORKS, TESTNET_CHAIN_IDs } from "../constants";
1
+ import {
2
+ CCTP_NO_DOMAIN,
3
+ ChainFamily,
4
+ CHAIN_IDs,
5
+ MAINNET_CHAIN_IDs,
6
+ PRODUCTION_NETWORKS,
7
+ PUBLIC_NETWORKS,
8
+ TESTNET_CHAIN_IDs,
9
+ } from "../constants";
3
10
 
4
11
  export const hreNetworks: Record<number, string> = {
5
12
  666: "Hardhat1",
@@ -89,24 +96,6 @@ export function chainIsArbitrum(chainId: number): boolean {
89
96
  return [CHAIN_IDs.ARBITRUM, CHAIN_IDs.ARBITRUM_SEPOLIA].includes(chainId);
90
97
  }
91
98
 
92
- /**
93
- * Determines whether a chain ID is an Aleph0 implementation
94
- * @param chainId Chain ID to evaluate
95
- * @returns True if chainId is an Aleph0 chain, otherwise false.
96
- */
97
- export function chainIsAlephZero(chainId: number): boolean {
98
- return [CHAIN_IDs.ALEPH_ZERO].includes(chainId);
99
- }
100
-
101
- /**
102
- * Determines whether a chain ID is a Lens implementation
103
- * @param chainId Chain ID to evaluate
104
- * @returns True if chainId is a Lens chain, otherwise false.
105
- */
106
- export function chainIsLens(chainId: number): boolean {
107
- return [CHAIN_IDs.LENS_SEPOLIA].includes(chainId);
108
- }
109
-
110
99
  /**
111
100
  * Determines whether a chain ID is a Linea implementation.
112
101
  * @param chainId Chain ID to evaluate.
@@ -159,7 +148,10 @@ export function chainIsSvm(chainId: number): boolean {
159
148
  * @returns True if chainId is a CCTP-bridging enabled chain, otherwise false.
160
149
  */
161
150
  export function chainIsCCTPEnabled(chainId: number): boolean {
162
- return PUBLIC_NETWORKS?.[chainId]?.cctpDomain !== CCTP_NO_DOMAIN;
151
+ // Add chainIds to cctpExceptions to administratively disable CCTP on a chain.
152
+ // This is useful if constants has been updated to specify a CCTP domain in advance of it being activated.
153
+ const cctpExceptions: number[] = [];
154
+ return PRODUCTION_NETWORKS[chainId]?.cctpDomain !== CCTP_NO_DOMAIN && !cctpExceptions.includes(chainId);
163
155
  }
164
156
 
165
157
  /**