@across-protocol/sdk 4.2.13 → 4.2.14-alpha.1

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 (194) hide show
  1. package/dist/cjs/arch/evm/SpokeUtils.d.ts +5 -2
  2. package/dist/cjs/arch/evm/SpokeUtils.js +22 -5
  3. package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
  4. package/dist/cjs/arch/svm/SpokeUtils.js +14 -11
  5. package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
  6. package/dist/cjs/arch/svm/utils.d.ts +1 -1
  7. package/dist/cjs/arch/svm/utils.js +15 -13
  8. package/dist/cjs/arch/svm/utils.js.map +1 -1
  9. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  10. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +4 -2
  11. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  12. package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  13. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +60 -56
  14. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  15. package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +13 -13
  16. package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  17. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  18. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +3 -2
  19. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  20. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
  21. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  22. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +3 -3
  23. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  24. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  25. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +11 -8
  26. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  27. package/dist/cjs/clients/HubPoolClient.d.ts +21 -21
  28. package/dist/cjs/clients/HubPoolClient.js +84 -60
  29. package/dist/cjs/clients/HubPoolClient.js.map +1 -1
  30. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
  31. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  32. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  33. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +52 -37
  34. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  35. package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +9 -9
  36. package/dist/cjs/clients/mocks/MockHubPoolClient.js +15 -9
  37. package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
  38. package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  39. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +39 -36
  40. package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
  41. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  42. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +2 -2
  43. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  44. package/dist/cjs/interfaces/HubPool.d.ts +19 -14
  45. package/dist/cjs/interfaces/SpokePool.d.ts +13 -13
  46. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  47. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +7 -7
  48. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  49. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
  50. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +14 -15
  51. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  52. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  53. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +7 -7
  54. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  55. package/dist/cjs/utils/AddressUtils.d.ts +6 -3
  56. package/dist/cjs/utils/AddressUtils.js +42 -14
  57. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  58. package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
  59. package/dist/cjs/utils/SpokeUtils.js +4 -22
  60. package/dist/cjs/utils/SpokeUtils.js.map +1 -1
  61. package/dist/cjs/utils/TokenUtils.d.ts +4 -4
  62. package/dist/cjs/utils/TokenUtils.js +3 -3
  63. package/dist/cjs/utils/TokenUtils.js.map +1 -1
  64. package/dist/esm/arch/evm/SpokeUtils.d.ts +5 -2
  65. package/dist/esm/arch/evm/SpokeUtils.js +23 -6
  66. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  67. package/dist/esm/arch/svm/SpokeUtils.js +15 -12
  68. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
  69. package/dist/esm/arch/svm/utils.d.ts +1 -1
  70. package/dist/esm/arch/svm/utils.js +15 -13
  71. package/dist/esm/arch/svm/utils.js.map +1 -1
  72. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  73. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +4 -2
  74. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  75. package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  76. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +61 -57
  77. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  78. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +14 -14
  79. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  80. package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  81. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +4 -3
  82. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  83. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
  84. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  85. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
  86. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  87. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  88. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +12 -9
  89. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  90. package/dist/esm/clients/HubPoolClient.d.ts +23 -22
  91. package/dist/esm/clients/HubPoolClient.js +97 -64
  92. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  93. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
  94. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  95. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  96. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +54 -38
  97. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  98. package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
  99. package/dist/esm/clients/mocks/MockHubPoolClient.js +16 -10
  100. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  101. package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  102. package/dist/esm/clients/mocks/MockSpokePoolClient.js +41 -38
  103. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  104. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  105. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
  106. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  107. package/dist/esm/interfaces/HubPool.d.ts +19 -14
  108. package/dist/esm/interfaces/SpokePool.d.ts +13 -13
  109. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  110. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +8 -8
  111. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  112. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
  113. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +15 -16
  114. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  115. package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  116. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +8 -8
  117. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  118. package/dist/esm/utils/AddressUtils.d.ts +7 -3
  119. package/dist/esm/utils/AddressUtils.js +52 -19
  120. package/dist/esm/utils/AddressUtils.js.map +1 -1
  121. package/dist/esm/utils/SpokeUtils.d.ts +3 -8
  122. package/dist/esm/utils/SpokeUtils.js +4 -26
  123. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  124. package/dist/esm/utils/TokenUtils.d.ts +18 -16
  125. package/dist/esm/utils/TokenUtils.js +3 -3
  126. package/dist/esm/utils/TokenUtils.js.map +1 -1
  127. package/dist/types/arch/evm/SpokeUtils.d.ts +5 -2
  128. package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
  129. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
  130. package/dist/types/arch/svm/utils.d.ts +1 -1
  131. package/dist/types/arch/svm/utils.d.ts.map +1 -1
  132. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  133. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  134. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  135. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  136. package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
  137. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  138. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
  139. package/dist/types/clients/BundleDataClient/utils/MerkleTreeUtils.d.ts.map +1 -1
  140. package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
  141. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  142. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
  143. package/dist/types/clients/HubPoolClient.d.ts +23 -22
  144. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  145. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  146. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  147. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
  148. package/dist/types/clients/mocks/MockHubPoolClient.d.ts +9 -9
  149. package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
  150. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  151. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
  152. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  153. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
  154. package/dist/types/interfaces/HubPool.d.ts +19 -14
  155. package/dist/types/interfaces/HubPool.d.ts.map +1 -1
  156. package/dist/types/interfaces/SpokePool.d.ts +13 -13
  157. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  158. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  159. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
  160. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
  161. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
  162. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  163. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
  164. package/dist/types/utils/AddressUtils.d.ts +7 -3
  165. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  166. package/dist/types/utils/SpokeUtils.d.ts +3 -8
  167. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  168. package/dist/types/utils/TokenUtils.d.ts +18 -16
  169. package/dist/types/utils/TokenUtils.d.ts.map +1 -1
  170. package/package.json +2 -3
  171. package/src/arch/evm/SpokeUtils.ts +53 -11
  172. package/src/arch/svm/SpokeUtils.ts +44 -11
  173. package/src/arch/svm/utils.ts +3 -3
  174. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -4
  175. package/src/clients/BundleDataClient/BundleDataClient.ts +54 -52
  176. package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +28 -13
  177. package/src/clients/BundleDataClient/utils/FillUtils.ts +6 -4
  178. package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +7 -1
  179. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
  180. package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +13 -9
  181. package/src/clients/HubPoolClient.ts +126 -83
  182. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +6 -0
  183. package/src/clients/SpokePoolClient/SpokePoolClient.ts +109 -28
  184. package/src/clients/mocks/MockHubPoolClient.ts +24 -19
  185. package/src/clients/mocks/MockSpokePoolClient.ts +37 -26
  186. package/src/clients/mocks/MockSvmSpokePoolClient.ts +12 -3
  187. package/src/interfaces/HubPool.ts +23 -14
  188. package/src/interfaces/SpokePool.ts +13 -13
  189. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +10 -8
  190. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +16 -21
  191. package/src/relayFeeCalculator/relayFeeCalculator.ts +20 -12
  192. package/src/utils/AddressUtils.ts +56 -21
  193. package/src/utils/SpokeUtils.ts +11 -33
  194. package/src/utils/TokenUtils.ts +7 -7
@@ -13,13 +13,12 @@ import {
13
13
  isDefined,
14
14
  getMessageHash,
15
15
  isSlowFill,
16
- isValidEvmAddress,
17
16
  isZeroAddress,
18
- toAddress,
19
17
  validateFillForDeposit,
20
18
  chainIsEvm,
21
19
  chainIsProd,
22
20
  Address,
21
+ toAddressType,
23
22
  } from "../../utils";
24
23
  import { duplicateEvent, sortEventsAscendingInPlace } from "../../utils/EventUtils";
25
24
  import { ZERO_ADDRESS } from "../../constants";
@@ -37,6 +36,7 @@ import {
37
36
  SortableEvent,
38
37
  SpeedUpWithBlock,
39
38
  TokensBridged,
39
+ RelayExecutionEventInfo,
40
40
  } from "../../interfaces";
41
41
  import { BaseAbstractClient, UpdateFailureReason } from "../BaseAbstractClient";
42
42
  import { AcrossConfigStoreClient } from "../AcrossConfigStoreClient";
@@ -202,8 +202,8 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
202
202
  * @param relayer The relayer address.
203
203
  * @returns A list of fills.
204
204
  */
205
- public getFillsForRelayer(relayer: string): FillWithBlock[] {
206
- return this.getFills().filter((fill) => fill.relayer === relayer);
205
+ public getFillsForRelayer(relayer: Address): FillWithBlock[] {
206
+ return this.getFills().filter((fill) => fill.relayer.eq(relayer));
207
207
  }
208
208
 
209
209
  /**
@@ -251,7 +251,8 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
251
251
  const { depositId, depositor } = deposit;
252
252
 
253
253
  // Note: we know depositor cannot be more than 20 bytes since this is guaranteed by contracts.
254
- const speedups = this.speedUps[toAddress(depositor)]?.[depositId.toString()];
254
+ // Additionally, speed ups can only be done on EVM networks.
255
+ const speedups = this.speedUps[depositor.toEvmAddress()]?.[depositId.toString()];
255
256
 
256
257
  if (!isDefined(speedups) || speedups.length === 0) {
257
258
  return deposit;
@@ -384,7 +385,8 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
384
385
  if (
385
386
  this.hubPoolClient &&
386
387
  !isSlowFill(fill) &&
387
- (!chainIsEvm(repaymentChainId) || !isValidEvmAddress(fill.relayer))
388
+ chainIsEvm(repaymentChainId) &&
389
+ !fill.relayer.isValidEvmAddress()
388
390
  ) {
389
391
  groupedFills.unrepayableFills.push(fill);
390
392
  }
@@ -407,7 +409,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
407
409
  chainId: this.chainId,
408
410
  message: "Unrepayable fills found where we need to switch repayment address and or chain",
409
411
  deposit,
410
- unrepayableFills: Object.fromEntries(unrepayableFillsForDeposit.map((x) => [x.relayer, x])),
412
+ unrepayableFills: Object.fromEntries(unrepayableFillsForDeposit.map((x) => [x.relayer.toAddress(), x])),
411
413
  notificationPath: "across-unrepayable-fills",
412
414
  });
413
415
  }
@@ -479,14 +481,36 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
479
481
  const { events: queryResults, currentTime, searchEndBlock } = update;
480
482
 
481
483
  if (eventsToQuery.includes("TokensBridged")) {
482
- for (const event of queryResults[eventsToQuery.indexOf("TokensBridged")] as TokensBridged[]) {
483
- this.tokensBridged.push(event);
484
+ for (const _event of queryResults[eventsToQuery.indexOf("TokensBridged")]) {
485
+ const event = _event as TokensBridged & {
486
+ l2TokenAddress: string;
487
+ };
488
+ this.tokensBridged.push({
489
+ ...event,
490
+ l2TokenAddress: toAddressType(event.l2TokenAddress, this.chainId),
491
+ });
484
492
  }
485
493
  }
486
494
 
487
495
  // Performs the indexing of a deposit-like spoke pool event.
488
496
  const queryDepositEvents = async (eventName: string) => {
489
- const depositEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as DepositWithBlock[];
497
+ const depositEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []).map((_event) => {
498
+ const event = _event as DepositWithBlock & {
499
+ depositor: string;
500
+ recipient: string;
501
+ inputToken: string;
502
+ outputToken: string;
503
+ exclusiveRelayer: string;
504
+ };
505
+ return {
506
+ ...event,
507
+ depositor: toAddressType(event.depositor, this.chainId),
508
+ recipient: toAddressType(event.recipient, event.destinationChainId),
509
+ inputToken: toAddressType(event.inputToken, this.chainId),
510
+ outputToken: toAddressType(event.outputToken, event.destinationChainId),
511
+ exclusiveRelayer: toAddressType(event.exclusiveRelayer, event.destinationChainId),
512
+ } as DepositWithBlock;
513
+ });
490
514
  if (depositEvents.length > 0) {
491
515
  this.log(
492
516
  "debug",
@@ -543,11 +567,21 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
543
567
 
544
568
  // Performs indexing of a "speed up deposit"-like event.
545
569
  const querySpeedUpDepositEvents = (eventName: string) => {
546
- const speedUpEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as SpeedUpWithBlock[];
570
+ const speedUpEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []).map((_event) => {
571
+ const event = _event as SpeedUpWithBlock & { depositor: string; updatedRecipient: string };
572
+ return {
573
+ ...event,
574
+ depositor: toAddressType(event.depositor, this.chainId),
575
+ updatedRecipient: toAddressType(event.updatedRecipient),
576
+ } as SpeedUpWithBlock;
577
+ });
547
578
 
548
579
  for (const event of speedUpEvents) {
549
- const speedUp = { ...event, originChainId: this.chainId };
550
- assign(this.speedUps, [speedUp.depositor, speedUp.depositId.toString()], [speedUp]);
580
+ const speedUp = {
581
+ ...event,
582
+ originChainId: this.chainId,
583
+ };
584
+ assign(this.speedUps, [speedUp.depositor.toAddress(), speedUp.depositId.toString()], [speedUp]);
551
585
 
552
586
  // Find deposit hash matching this speed up event and update the deposit data associated with the hash,
553
587
  // if the hash+data exists.
@@ -571,7 +605,23 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
571
605
 
572
606
  // Performs indexing of "requested slow fill"-like events.
573
607
  const queryRequestedSlowFillEvents = (eventName: string) => {
574
- const slowFillRequests = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as SlowFillRequestWithBlock[];
608
+ const slowFillRequests = (queryResults[eventsToQuery.indexOf(eventName)] ?? []).map((_event) => {
609
+ const event = _event as SlowFillRequestWithBlock & {
610
+ depositor: string;
611
+ recipient: string;
612
+ inputToken: string;
613
+ outputToken: string;
614
+ exclusiveRelayer: string;
615
+ };
616
+ return {
617
+ ...event,
618
+ depositor: toAddressType(event.depositor, event.originChainId),
619
+ recipient: toAddressType(event.recipient, this.chainId),
620
+ inputToken: toAddressType(event.inputToken, event.originChainId),
621
+ outputToken: toAddressType(event.outputToken, this.chainId),
622
+ exclusiveRelayer: toAddressType(event.exclusiveRelayer, this.chainId),
623
+ } as SlowFillRequestWithBlock;
624
+ });
575
625
  for (const event of slowFillRequests) {
576
626
  const slowFillRequest = {
577
627
  ...event,
@@ -598,7 +648,30 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
598
648
 
599
649
  // Performs indexing of filled relay-like events.
600
650
  const queryFilledRelayEvents = (eventName: string) => {
601
- const fillEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as FillWithBlock[];
651
+ const fillEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []).map((_event) => {
652
+ const event = _event as FillWithBlock & {
653
+ depositor: string;
654
+ recipient: string;
655
+ inputToken: string;
656
+ outputToken: string;
657
+ exclusiveRelayer: string;
658
+ relayer: string;
659
+ relayExecutionInfo: RelayExecutionEventInfo & { updatedRecipient: string };
660
+ };
661
+ return {
662
+ ...event,
663
+ depositor: toAddressType(event.depositor, event.originChainId),
664
+ recipient: toAddressType(event.recipient, this.chainId),
665
+ inputToken: toAddressType(event.inputToken, event.originChainId),
666
+ outputToken: toAddressType(event.outputToken, this.chainId),
667
+ exclusiveRelayer: toAddressType(event.exclusiveRelayer, this.chainId),
668
+ relayer: toAddressType(event.relayer, this.chainId),
669
+ relayExecutionInfo: {
670
+ ...event.relayExecutionInfo,
671
+ updatedRecipient: toAddressType(event.relayExecutionInfo.updatedRecipient, this.chainId),
672
+ },
673
+ } as FillWithBlock;
674
+ });
602
675
 
603
676
  if (fillEvents.length > 0) {
604
677
  this.log("debug", `Using ${fillEvents.length} newly queried ${eventName} events for chain ${this.chainId}`, {
@@ -634,8 +707,9 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
634
707
  });
635
708
 
636
709
  if (eventsToQuery.includes("EnabledDepositRoute")) {
637
- const enableDepositsEvents = (queryResults[eventsToQuery.indexOf("EnabledDepositRoute")] ??
638
- []) as EnabledDepositRouteWithBlock[];
710
+ const enableDepositsEvents = queryResults[
711
+ eventsToQuery.indexOf("EnabledDepositRoute")
712
+ ] as EnabledDepositRouteWithBlock[];
639
713
 
640
714
  for (const event of enableDepositsEvents) {
641
715
  assign(this.depositRoutes, [event.originToken, event.destinationChainId], event.enabled);
@@ -643,18 +717,23 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
643
717
  }
644
718
 
645
719
  if (eventsToQuery.includes("RelayedRootBundle")) {
646
- const relayedRootBundleEvents = (queryResults[eventsToQuery.indexOf("RelayedRootBundle")] ??
647
- []) as RootBundleRelayWithBlock[];
720
+ const relayedRootBundleEvents = queryResults[
721
+ eventsToQuery.indexOf("RelayedRootBundle")
722
+ ] as RootBundleRelayWithBlock[];
648
723
  for (const event of relayedRootBundleEvents) {
649
724
  this.rootBundleRelays.push(event);
650
725
  }
651
726
  }
652
727
 
653
728
  if (eventsToQuery.includes("ExecutedRelayerRefundRoot")) {
654
- const refundEvents = (queryResults[eventsToQuery.indexOf("ExecutedRelayerRefundRoot")] ??
655
- []) as RelayerRefundExecutionWithBlock[];
656
- for (const event of refundEvents) {
657
- this.relayerRefundExecutions.push(event);
729
+ const refundEvents = queryResults[eventsToQuery.indexOf("ExecutedRelayerRefundRoot")];
730
+ for (const _event of refundEvents) {
731
+ const event = _event as { l2TokenAddress: string; refundAddresses: string[] } & RelayerRefundExecutionWithBlock;
732
+ this.relayerRefundExecutions.push({
733
+ ...event,
734
+ l2TokenAddress: toAddressType(event.l2TokenAddress, this.chainId),
735
+ refundAddresses: event.refundAddresses.map((addr) => toAddressType(addr, this.chainId)),
736
+ });
658
737
  }
659
738
  }
660
739
 
@@ -702,9 +781,9 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
702
781
  * @param deposit The deposit to retrieve the destination token for.
703
782
  * @returns The destination token.
704
783
  */
705
- protected getDestinationTokenForDeposit(deposit: DepositWithBlock): string {
784
+ protected getDestinationTokenForDeposit(deposit: DepositWithBlock): Address {
706
785
  if (!this.canResolveZeroAddressOutputToken(deposit)) {
707
- return ZERO_ADDRESS;
786
+ return toAddressType(ZERO_ADDRESS);
708
787
  }
709
788
  // L1 token should be resolved if we get here:
710
789
  const l1Token = this.hubPoolClient!.getL1TokenForL2TokenAtBlock(
@@ -712,10 +791,12 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
712
791
  deposit.originChainId,
713
792
  deposit.quoteBlockNumber
714
793
  )!;
715
- return (
716
- this.hubPoolClient!.getL2TokenForL1TokenAtBlock(l1Token, deposit.destinationChainId, deposit.quoteBlockNumber) ??
717
- ZERO_ADDRESS
794
+ const counterpartToken = this.hubPoolClient!.getL2TokenForL1TokenAtBlock(
795
+ l1Token,
796
+ deposit.destinationChainId,
797
+ deposit.quoteBlockNumber
718
798
  );
799
+ return counterpartToken ?? toAddressType(ZERO_ADDRESS);
719
800
  }
720
801
 
721
802
  /**
@@ -1,16 +1,17 @@
1
1
  import winston from "winston";
2
2
  import { Contract } from "ethers";
3
- import { BigNumber, randomAddress, assign, bnZero } from "../../utils";
4
- import { L1Token, Log, PendingRootBundle, RealizedLpFee } from "../../interfaces";
3
+ import { BigNumber, randomAddress, assign, bnZero, toAddressType, EvmAddress, Address, isDefined } from "../../utils";
4
+ import { TokenInfo, Log, PendingRootBundle, RealizedLpFee, L1TokenInfo } from "../../interfaces";
5
5
  import { AcrossConfigStoreClient as ConfigStoreClient } from "../AcrossConfigStoreClient";
6
6
  import { HubPoolClient, HubPoolUpdate, LpFeeRequest } from "../HubPoolClient";
7
7
  import { EventManager, EventOverrides, getEventManager } from "./MockEvents";
8
+ import { ZERO_ADDRESS } from "../../constants";
8
9
 
9
10
  const emptyRootBundle: PendingRootBundle = {
10
11
  poolRebalanceRoot: "",
11
12
  relayerRefundRoot: "",
12
13
  slowRelayRoot: "",
13
- proposer: "",
14
+ proposer: EvmAddress.from(ZERO_ADDRESS),
14
15
  unclaimedPoolRebalanceLeafCount: 0,
15
16
  challengePeriodEndTimestamp: 0,
16
17
  bundleEvaluationBlockNumbers: [],
@@ -22,9 +23,9 @@ export class MockHubPoolClient extends HubPoolClient {
22
23
  private realizedLpFeePct: BigNumber = bnZero;
23
24
  private realizedLpFeePctOverride = false;
24
25
 
25
- private l1TokensMock: L1Token[] = []; // L1Tokens and their associated info.
26
+ private l1TokensMock: L1TokenInfo[] = []; // L1Tokens and their associated info.
26
27
 
27
- private spokePoolTokens: { [l1Token: string]: { [chainId: number]: string } } = {};
28
+ private spokePoolTokens: { [l1Token: string]: { [chainId: number]: Address } } = {};
28
29
 
29
30
  private eventManager: EventManager;
30
31
 
@@ -69,7 +70,7 @@ export class MockHubPoolClient extends HubPoolClient {
69
70
  [chainId],
70
71
  [
71
72
  {
72
- spokePool: contract,
73
+ spokePool: toAddressType(contract),
73
74
  blockNumber: blockNumber,
74
75
  transactionIndex: 0,
75
76
  logIndex: 0,
@@ -82,7 +83,7 @@ export class MockHubPoolClient extends HubPoolClient {
82
83
  this.latestHeightSearched = blockNumber;
83
84
  }
84
85
 
85
- addL1Token(l1Token: L1Token) {
86
+ addL1Token(l1Token: TokenInfo) {
86
87
  this.l1TokensMock.push(l1Token);
87
88
  }
88
89
 
@@ -92,19 +93,19 @@ export class MockHubPoolClient extends HubPoolClient {
92
93
 
93
94
  setTokenMapping(l1Token: string, chainId: number, l2Token: string) {
94
95
  this.spokePoolTokens[l1Token] ??= {};
95
- this.spokePoolTokens[l1Token][chainId] = l2Token;
96
+ this.spokePoolTokens[l1Token][chainId] = toAddressType(l2Token);
96
97
  }
97
98
 
98
- l2TokenEnabledForL1TokenAtBlock(l1Token: string, destinationChainId: number, hubBlockNumber: number): boolean {
99
- if (this.spokePoolTokens[l1Token]?.[destinationChainId]) {
99
+ l2TokenEnabledForL1TokenAtBlock(l1Token: EvmAddress, destinationChainId: number, hubBlockNumber: number): boolean {
100
+ if (this.spokePoolTokens[l1Token.toEvmAddress()]?.[destinationChainId]) {
100
101
  return true;
101
102
  } else {
102
103
  return super.l2TokenEnabledForL1TokenAtBlock(l1Token, destinationChainId, hubBlockNumber);
103
104
  }
104
105
  }
105
- l2TokenHasPoolRebalanceRoute(l2Token: string, chainId: number, hubPoolBlock: number): boolean {
106
+ l2TokenHasPoolRebalanceRoute(l2Token: Address, chainId: number, hubPoolBlock: number): boolean {
106
107
  const l1Token = Object.keys(this.spokePoolTokens).find(
107
- (l1Token) => this.spokePoolTokens[l1Token]?.[chainId] === l2Token
108
+ (l1Token) => this.spokePoolTokens[l1Token]?.[chainId]?.eq(l2Token)
108
109
  );
109
110
  if (!l1Token) {
110
111
  return super.l2TokenHasPoolRebalanceRoute(l2Token, chainId, hubPoolBlock);
@@ -115,20 +116,24 @@ export class MockHubPoolClient extends HubPoolClient {
115
116
  delete this.spokePoolTokens[l1Token]?.[chainId];
116
117
  }
117
118
 
118
- getL1TokenForL2TokenAtBlock(l2Token: string, chainId: number, blockNumber: number): string {
119
+ getL1TokenForL2TokenAtBlock(l2Token: Address, chainId: number, blockNumber: number): EvmAddress {
119
120
  const l1Token = Object.keys(this.spokePoolTokens).find(
120
- (l1Token) => this.spokePoolTokens[l1Token]?.[chainId] === l2Token
121
+ (l1Token) => this.spokePoolTokens[l1Token]?.[chainId].eq(l2Token)
121
122
  );
122
- return l1Token ?? super.getL1TokenForL2TokenAtBlock(l2Token, chainId, blockNumber);
123
+ if (isDefined(l1Token)) {
124
+ return EvmAddress.from(l1Token);
125
+ } else {
126
+ return super.getL1TokenForL2TokenAtBlock(l2Token, chainId, blockNumber);
127
+ }
123
128
  }
124
129
 
125
- getL2TokenForL1TokenAtBlock(l1Token: string, chainId: number, blockNumber: number): string {
126
- const l2Token = this.spokePoolTokens[l1Token]?.[chainId];
130
+ getL2TokenForL1TokenAtBlock(l1Token: EvmAddress, chainId: number, blockNumber: number): Address {
131
+ const l2Token = this.spokePoolTokens[l1Token.toEvmAddress()]?.[chainId];
127
132
  return l2Token ?? super.getL2TokenForL1TokenAtBlock(l1Token, chainId, blockNumber);
128
133
  }
129
134
 
130
- getTokenInfoForL1Token(l1Token: string): L1Token | undefined {
131
- return this.l1TokensMock.find((token) => token.address === l1Token);
135
+ getTokenInfoForL1Token(l1Token: EvmAddress): TokenInfo | undefined {
136
+ return this.l1TokensMock.find((token) => token.address.eq(l1Token));
132
137
  }
133
138
 
134
139
  _update(eventNames: string[]): Promise<HubPoolUpdate> {
@@ -2,7 +2,7 @@ import assert from "assert";
2
2
  import { Contract } from "ethers";
3
3
  import { random } from "lodash";
4
4
  import winston from "winston";
5
- import { EMPTY_MESSAGE, ZERO_ADDRESS } from "../../constants";
5
+ import { EMPTY_MESSAGE, ZERO_ADDRESS, ZERO_BYTES } from "../../constants";
6
6
  import {
7
7
  Log,
8
8
  Deposit,
@@ -27,6 +27,9 @@ import {
27
27
  bnOne,
28
28
  toBytes32,
29
29
  spreadEventWithBlockNumber,
30
+ Address,
31
+ toAddressType,
32
+ isDefined,
30
33
  } from "../../utils";
31
34
  import { EVMSpokePoolClient, SpokePoolUpdate } from "../SpokePoolClient";
32
35
  import { HubPoolClient } from "../HubPoolClient";
@@ -62,8 +65,11 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
62
65
  this.destinationTokenForChainOverride[chainId] = token;
63
66
  }
64
67
 
65
- getDestinationTokenForDeposit(deposit: DepositWithBlock): string {
66
- return this.destinationTokenForChainOverride[deposit.originChainId] ?? super.getDestinationTokenForDeposit(deposit);
68
+ getDestinationTokenForDeposit(deposit: DepositWithBlock): Address {
69
+ const override = this.destinationTokenForChainOverride[deposit.originChainId];
70
+ return isDefined(override)
71
+ ? toAddressType(override, deposit.destinationChainId)
72
+ : super.getDestinationTokenForDeposit(deposit);
67
73
  }
68
74
 
69
75
  setLatestBlockNumber(blockNumber: number): void {
@@ -129,23 +135,26 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
129
135
  return this._deposit("FundsDeposited", deposit);
130
136
  }
131
137
 
132
- protected _deposit(event: string, deposit: Omit<Deposit, "messageHash"> & Partial<SortableEvent>): Log {
138
+ protected _deposit(
139
+ event: string,
140
+ deposit: Omit<Deposit, "messageHash"> & { message?: string } & Partial<SortableEvent>
141
+ ): Log {
133
142
  const { blockNumber, txnIndex } = deposit;
134
143
  let { depositId, destinationChainId, inputAmount, outputAmount } = deposit;
135
144
  depositId ??= this.numberOfDeposits;
136
145
  this.numberOfDeposits = depositId.add(bnOne);
137
146
 
138
147
  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);
148
+ const depositor = deposit.depositor?.toBytes32() ?? toBytes32(randomAddress());
149
+ const recipient = deposit.recipient?.toBytes32() ?? toBytes32(depositor);
150
+ const inputToken = deposit.inputToken?.toBytes32() ?? toBytes32(randomAddress());
151
+ const outputToken = deposit.outputToken?.toBytes32() ?? inputToken;
152
+ const exclusiveRelayer = deposit.exclusiveRelayer?.toBytes32() ?? toBytes32(ZERO_ADDRESS);
144
153
 
145
154
  inputAmount ??= toBNWei(random(1, 1000, false));
146
155
  outputAmount ??= inputAmount.mul(toBN("0.95"));
147
156
 
148
- const message = deposit["message"] ?? "0x";
157
+ const message = deposit.message ?? "0x";
149
158
  const topics = [destinationChainId, depositId, depositor];
150
159
  const quoteTimestamp = deposit.quoteTimestamp ?? getCurrentTime();
151
160
  const args = {
@@ -191,19 +200,20 @@ 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 depositor = fill.depositor?.toBytes32() ?? toBytes32(randomAddress());
204
+ const recipient = fill.recipient?.toBytes32() ?? toBytes32(depositor);
205
+ const inputToken = fill.inputToken?.toBytes32() ?? toBytes32(randomAddress());
206
+ const outputToken = fill.outputToken?.toBytes32() ?? toBytes32(ZERO_ADDRESS);
207
+ const exclusiveRelayer = fill.exclusiveRelayer?.toBytes32() ?? toBytes32(ZERO_ADDRESS);
208
+ const relayer = fill.relayer?.toBytes32() ?? toBytes32(randomAddress());
200
209
 
201
210
  const topics = [originChainId, depositId, relayer];
202
211
  const message = fill.message ?? EMPTY_MESSAGE;
203
212
  const updatedMessage = fill.relayExecutionInfo?.updatedMessage ?? message;
213
+ const updatedRecipient = fill.relayExecutionInfo?.updatedRecipient.toBytes32() ?? recipient;
204
214
 
205
215
  const relayExecutionInfo = {
206
- updatedRecipient: fill.relayExecutionInfo?.updatedRecipient ?? recipient,
216
+ updatedRecipient,
207
217
  updatedOutputAmount: fill.relayExecutionInfo?.updatedOutputAmount ?? outputAmount,
208
218
  fillType: fill.relayExecutionInfo?.fillType ?? FillType.FastFill,
209
219
  };
@@ -223,7 +233,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
223
233
  depositor,
224
234
  recipient,
225
235
  relayExecutionInfo: {
226
- updatedRecipient: fill.relayExecutionInfo?.updatedRecipient ?? recipient,
236
+ updatedRecipient,
227
237
  updatedOutputAmount: fill.relayExecutionInfo?.updatedOutputAmount ?? outputAmount,
228
238
  fillType: fill.relayExecutionInfo?.fillType ?? FillType.FastFill,
229
239
  },
@@ -253,7 +263,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
253
263
  }
254
264
 
255
265
  protected _speedUpDeposit(event: string, speedUp: SpeedUp): Log {
256
- const depositor = toBytes32(speedUp.depositor);
266
+ const depositor = speedUp.depositor.toBytes32();
257
267
  const topics = [speedUp.depositId, depositor];
258
268
  const args = { ...speedUp };
259
269
 
@@ -264,7 +274,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
264
274
  args: {
265
275
  ...args,
266
276
  depositor,
267
- updatedRecipient: toBytes32(speedUp.updatedRecipient),
277
+ updatedRecipient: speedUp.updatedRecipient.toBytes32(),
268
278
  },
269
279
  });
270
280
  }
@@ -294,7 +304,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
294
304
  const topics = [originChainId, depositId];
295
305
  const args = { ...request };
296
306
 
297
- const depositor = toBytes32(args.depositor ?? randomAddress());
307
+ const depositor = args.depositor.toBytes32() ?? toBytes32(randomAddress());
298
308
 
299
309
  return this.eventManager.generateEvent({
300
310
  event,
@@ -304,10 +314,11 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
304
314
  ...args,
305
315
  destinationChainId: this.chainId,
306
316
  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),
317
+ recipient: args.recipient?.toBytes32() ?? depositor,
318
+ inputToken: args.inputToken?.toBytes32() ?? toBytes32(randomAddress()),
319
+ outputToken: args.outputToken?.toBytes32() ?? toBytes32(ZERO_ADDRESS),
320
+ exclusiveRelayer: args.exclusiveRelayer?.toBytes32() ?? toBytes32(ZERO_ADDRESS),
321
+ messageHash: args.messageHash ?? ZERO_BYTES,
311
322
  },
312
323
  blockNumber: request.blockNumber,
313
324
  transactionIndex: request.txnIndex,
@@ -320,7 +331,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
320
331
  const fill = {
321
332
  ...leaf.relayData,
322
333
  destinationChainId: this.chainId,
323
- relayer: ZERO_ADDRESS,
334
+ relayer: toAddressType(ZERO_ADDRESS),
324
335
  repaymentChainId: 0,
325
336
  relayExecutionInfo: {
326
337
  updatedRecipient: leaf.relayData.recipient,
@@ -2,7 +2,15 @@ import winston from "winston";
2
2
  import { SvmSpokeClient } from "@across-protocol/contracts";
3
3
  import { Address } from "@solana/kit";
4
4
  import { DepositWithBlock, RelayerRefundExecution, SortableEvent, SlowFillLeaf, Log } from "../../interfaces";
5
- import { getCurrentTime, bnZero, MakeOptional, EventSearchConfig } from "../../utils";
5
+ import {
6
+ getCurrentTime,
7
+ bnZero,
8
+ MakeOptional,
9
+ EventSearchConfig,
10
+ Address as SDKAddress,
11
+ toAddressType,
12
+ isDefined,
13
+ } from "../../utils";
6
14
  import { SpokePoolUpdate, SVMSpokePoolClient } from "../SpokePoolClient";
7
15
  import { HubPoolClient } from "../HubPoolClient";
8
16
  import { EventOverrides } from "./MockEvents";
@@ -46,8 +54,9 @@ export class MockSvmSpokePoolClient extends SVMSpokePoolClient {
46
54
  this.destinationTokenForChainOverride[chainId] = token;
47
55
  }
48
56
 
49
- getDestinationTokenForDeposit(deposit: DepositWithBlock): string {
50
- return this.destinationTokenForChainOverride[deposit.originChainId] ?? super.getDestinationTokenForDeposit(deposit);
57
+ getDestinationTokenForDeposit(deposit: DepositWithBlock): SDKAddress {
58
+ const override = this.destinationTokenForChainOverride[deposit.originChainId];
59
+ return isDefined(override) ? toAddressType(override) : super.getDestinationTokenForDeposit(deposit);
51
60
  }
52
61
 
53
62
  setLatestBlockNumber(blockNumber: number): void {
@@ -1,4 +1,4 @@
1
- import { BigNumber } from "../utils";
1
+ import { Address, BigNumber, EvmAddress } from "../utils";
2
2
  import { SortableEvent } from "./Common";
3
3
 
4
4
  export interface PoolRebalanceLeaf {
@@ -8,7 +8,7 @@ export interface PoolRebalanceLeaf {
8
8
  netSendAmounts: BigNumber[];
9
9
  runningBalances: BigNumber[];
10
10
  leafId: number;
11
- l1Tokens: string[];
11
+ l1Tokens: EvmAddress[];
12
12
  }
13
13
 
14
14
  export interface RelayerRefundLeaf {
@@ -16,8 +16,8 @@ export interface RelayerRefundLeaf {
16
16
  chainId: number;
17
17
  refundAmounts: BigNumber[];
18
18
  leafId: number;
19
- l2TokenAddress: string;
20
- refundAddresses: string[];
19
+ l2TokenAddress: Address;
20
+ refundAddresses: Address[];
21
21
  }
22
22
 
23
23
  export interface ProposedRootBundle extends SortableEvent {
@@ -27,7 +27,7 @@ export interface ProposedRootBundle extends SortableEvent {
27
27
  poolRebalanceRoot: string;
28
28
  relayerRefundRoot: string;
29
29
  slowRelayRoot: string;
30
- proposer: string;
30
+ proposer: EvmAddress;
31
31
  }
32
32
 
33
33
  export type RealizedLpFee = {
@@ -55,7 +55,7 @@ export interface ExecutedRootBundle extends SortableEvent {
55
55
  netSendAmounts: BigNumber[];
56
56
  runningBalances: BigNumber[];
57
57
  leafId: number;
58
- l1Tokens: string[];
58
+ l1Tokens: EvmAddress[];
59
59
  proof: string[];
60
60
  }
61
61
 
@@ -76,8 +76,14 @@ export interface RelayerRefundLeafWithGroup extends RelayerRefundLeaf {
76
76
  groupIndex: number;
77
77
  }
78
78
 
79
- export interface L1Token {
80
- address: string;
79
+ export interface L1TokenInfo {
80
+ address: EvmAddress;
81
+ symbol: string;
82
+ decimals: number;
83
+ }
84
+
85
+ export interface TokenInfo {
86
+ address: Address;
81
87
  symbol: string;
82
88
  decimals: number;
83
89
  }
@@ -87,27 +93,30 @@ export interface LpToken {
87
93
  liquidReserves: BigNumber;
88
94
  }
89
95
 
96
+ // TODO: I think I don't change string -> Address in the Events. I change right after the event is read
90
97
  export interface CrossChainContractsSet extends SortableEvent {
91
98
  l2ChainId: number;
92
- spokePool: string;
99
+ spokePool: Address;
93
100
  }
94
101
 
102
+ // TODO: I think I don't change string -> Address in the Events. I change right after the event is read
95
103
  export interface DestinationTokenWithBlock extends SortableEvent {
96
- l2Token: string;
97
- l1Token: string;
104
+ l2Token: Address;
105
+ l1Token: EvmAddress;
98
106
  }
99
107
 
108
+ // TODO: I think I don't change string -> Address in the Events. I change right after the event is read
100
109
  export interface SetPoolRebalanceRoot extends SortableEvent {
101
110
  destinationChainId: number;
102
- l1Token: string;
103
- destinationToken: string;
111
+ l1Token: EvmAddress;
112
+ destinationToken: Address;
104
113
  }
105
114
 
106
115
  export interface PendingRootBundle {
107
116
  poolRebalanceRoot: string;
108
117
  relayerRefundRoot: string;
109
118
  slowRelayRoot: string;
110
- proposer: string;
119
+ proposer: EvmAddress;
111
120
  unclaimedPoolRebalanceLeafCount: number;
112
121
  challengePeriodEndTimestamp: number;
113
122
  bundleEvaluationBlockNumbers: number[];