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

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 +2 -5
  2. package/dist/cjs/arch/evm/SpokeUtils.js +5 -22
  3. package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
  4. package/dist/cjs/arch/svm/SpokeUtils.js +11 -14
  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 +13 -15
  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 +2 -4
  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 +56 -60
  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 +1 -2
  18. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +2 -3
  19. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  20. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +1 -5
  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 +8 -11
  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 +60 -84
  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 +7 -3
  33. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +78 -69
  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 +9 -15
  37. package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
  38. package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +3 -5
  39. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +36 -39
  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 +14 -19
  45. package/dist/cjs/interfaces/SpokePool.d.ts +23 -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 +15 -14
  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 +3 -6
  56. package/dist/cjs/utils/AddressUtils.js +14 -42
  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 +22 -4
  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 +2 -5
  65. package/dist/esm/arch/evm/SpokeUtils.js +6 -23
  66. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  67. package/dist/esm/arch/svm/SpokeUtils.js +12 -15
  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 +13 -15
  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 +2 -4
  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 +57 -61
  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 +1 -2
  81. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +3 -4
  82. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  83. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +1 -5
  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 +9 -12
  89. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  90. package/dist/esm/clients/HubPoolClient.d.ts +22 -23
  91. package/dist/esm/clients/HubPoolClient.js +64 -97
  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 +15 -3
  96. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +87 -71
  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 +10 -16
  100. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  101. package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +3 -5
  102. package/dist/esm/clients/mocks/MockSpokePoolClient.js +38 -41
  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 +14 -19
  108. package/dist/esm/interfaces/SpokePool.d.ts +23 -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 +16 -15
  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 +3 -7
  119. package/dist/esm/utils/AddressUtils.js +19 -52
  120. package/dist/esm/utils/AddressUtils.js.map +1 -1
  121. package/dist/esm/utils/SpokeUtils.d.ts +8 -3
  122. package/dist/esm/utils/SpokeUtils.js +26 -4
  123. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  124. package/dist/esm/utils/TokenUtils.d.ts +16 -18
  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 +2 -5
  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 +1 -2
  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 +22 -23
  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 +15 -3
  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 +3 -5
  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 +14 -19
  155. package/dist/types/interfaces/HubPool.d.ts.map +1 -1
  156. package/dist/types/interfaces/SpokePool.d.ts +23 -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 +3 -7
  165. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  166. package/dist/types/utils/SpokeUtils.d.ts +8 -3
  167. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  168. package/dist/types/utils/TokenUtils.d.ts +16 -18
  169. package/dist/types/utils/TokenUtils.d.ts.map +1 -1
  170. package/package.json +3 -2
  171. package/src/arch/evm/SpokeUtils.ts +11 -53
  172. package/src/arch/svm/SpokeUtils.ts +11 -44
  173. package/src/arch/svm/utils.ts +3 -3
  174. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +4 -7
  175. package/src/clients/BundleDataClient/BundleDataClient.ts +52 -54
  176. package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +13 -28
  177. package/src/clients/BundleDataClient/utils/FillUtils.ts +4 -6
  178. package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +1 -7
  179. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
  180. package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +9 -13
  181. package/src/clients/HubPoolClient.ts +83 -126
  182. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +0 -6
  183. package/src/clients/SpokePoolClient/SpokePoolClient.ts +67 -107
  184. package/src/clients/mocks/MockHubPoolClient.ts +19 -24
  185. package/src/clients/mocks/MockSpokePoolClient.ts +26 -37
  186. package/src/clients/mocks/MockSvmSpokePoolClient.ts +3 -12
  187. package/src/interfaces/HubPool.ts +14 -23
  188. package/src/interfaces/SpokePool.ts +25 -13
  189. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +8 -10
  190. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +21 -16
  191. package/src/relayFeeCalculator/relayFeeCalculator.ts +12 -20
  192. package/src/utils/AddressUtils.ts +21 -56
  193. package/src/utils/SpokeUtils.ts +33 -11
  194. package/src/utils/TokenUtils.ts +7 -7
@@ -1,7 +1,7 @@
1
1
  import { MerkleTree } from "@across-protocol/contracts/dist/utils/MerkleTree";
2
2
  import { RunningBalances, PoolRebalanceLeaf, Clients, SpokePoolTargetBalance } from "../../../interfaces";
3
3
  import { SpokePoolClient } from "../../SpokePoolClient";
4
- import { BigNumber, bnZero, compareAddresses, EvmAddress } from "../../../utils";
4
+ import { BigNumber, bnZero, compareAddresses } from "../../../utils";
5
5
  import { HubPoolClient } from "../../HubPoolClient";
6
6
  import { V3DepositWithBlock } from "./shims";
7
7
  import { AcrossConfigStoreClient } from "../../AcrossConfigStoreClient";
@@ -151,7 +151,7 @@ export function addLastRunningBalance(
151
151
  const { runningBalance } = hubPoolClient.getRunningBalanceBeforeBlockForChain(
152
152
  latestMainnetBlock,
153
153
  Number(repaymentChainId),
154
- EvmAddress.from(l1TokenAddress)
154
+ l1TokenAddress
155
155
  );
156
156
  if (!runningBalance.eq(bnZero)) {
157
157
  updateRunningBalance(runningBalances, Number(repaymentChainId), l1TokenAddress, runningBalance);
@@ -172,7 +172,7 @@ export function updateRunningBalanceForDeposit(
172
172
  deposit.originChainId,
173
173
  mainnetBundleEndBlock
174
174
  );
175
- updateRunningBalance(runningBalances, deposit.originChainId, l1TokenCounterpart.toEvmAddress(), updateAmount);
175
+ updateRunningBalance(runningBalances, deposit.originChainId, l1TokenCounterpart, updateAmount);
176
176
  }
177
177
 
178
178
  export function constructPoolRebalanceLeaves(
@@ -253,7 +253,7 @@ export function constructPoolRebalanceLeaves(
253
253
  runningBalances: leafRunningBalances,
254
254
  groupIndex: groupIndexForChainId++,
255
255
  leafId: leaves.length,
256
- l1Tokens: l1TokensToIncludeInThisLeaf.map((l1TokenAddr: string) => EvmAddress.from(l1TokenAddr)),
256
+ l1Tokens: l1TokensToIncludeInThisLeaf,
257
257
  });
258
258
  }
259
259
  });
@@ -15,7 +15,7 @@ import {
15
15
  type,
16
16
  } from "superstruct";
17
17
  import { UNDEFINED_MESSAGE_HASH } from "../../../constants";
18
- import { BigNumber, toAddressType, Address } from "../../../utils";
18
+ import { BigNumber } from "../../../utils";
19
19
 
20
20
  const PositiveIntegerStringSS = pattern(string(), /\d+/);
21
21
  const Web3AddressSS = pattern(string(), /^0x[a-fA-F0-9]{40}$/);
@@ -31,23 +31,19 @@ const BigNumberType = coerce(instance(BigNumber), union([string(), number()]), (
31
31
  }
32
32
  });
33
33
 
34
- const AddressType = coerce(instance(Address), string(), (value) => {
35
- return toAddressType(value);
36
- });
37
-
38
34
  const FillTypeSS = number();
39
35
 
40
36
  const V3RelayDataSS = {
41
- inputToken: AddressType,
37
+ inputToken: string(),
42
38
  inputAmount: BigNumberType,
43
- outputToken: AddressType,
39
+ outputToken: string(),
44
40
  outputAmount: BigNumberType,
45
41
  fillDeadline: number(),
46
- exclusiveRelayer: AddressType,
42
+ exclusiveRelayer: string(),
47
43
  exclusivityDeadline: number(),
48
44
  originChainId: number(),
49
- depositor: AddressType,
50
- recipient: AddressType,
45
+ depositor: string(),
46
+ recipient: string(),
51
47
  depositId: BigNumberType,
52
48
  message: string(),
53
49
  };
@@ -71,7 +67,7 @@ const V3DepositSS = {
71
67
  quoteTimestamp: number(),
72
68
  relayerFeePct: optional(BigNumberType),
73
69
  speedUpSignature: optional(string()),
74
- updatedRecipient: optional(AddressType),
70
+ updatedRecipient: optional(string()),
75
71
  updatedOutputAmount: optional(BigNumberType),
76
72
  updatedMessage: optional(string()),
77
73
  };
@@ -92,7 +88,7 @@ const V3DepositWithBlockLpFeeSS = object({
92
88
  const V3RelayExecutionEventInfoSS = object({
93
89
  updatedOutputAmount: BigNumberType,
94
90
  fillType: FillTypeSS,
95
- updatedRecipient: AddressType,
91
+ updatedRecipient: string(),
96
92
  updatedMessage: optional(string()),
97
93
  updatedMessageHash: defaulted(string(), UNDEFINED_MESSAGE_HASH),
98
94
  });
@@ -102,7 +98,7 @@ const V3FillSS = {
102
98
  message: optional(string()),
103
99
  messageHash: defaulted(string(), UNDEFINED_MESSAGE_HASH),
104
100
  destinationChainId: number(),
105
- relayer: AddressType,
101
+ relayer: string(),
106
102
  repaymentChainId: number(),
107
103
  relayExecutionInfo: V3RelayExecutionEventInfoSS,
108
104
  quoteTimestamp: number(),
@@ -12,7 +12,7 @@ import {
12
12
  DestinationTokenWithBlock,
13
13
  DisputedRootBundle,
14
14
  ExecutedRootBundle,
15
- TokenInfo,
15
+ L1Token,
16
16
  Log,
17
17
  LpToken,
18
18
  PendingRootBundle,
@@ -20,7 +20,6 @@ import {
20
20
  RealizedLpFee,
21
21
  SetPoolRebalanceRoot,
22
22
  TokenRunningBalance,
23
- L1TokenInfo,
24
23
  } from "../interfaces";
25
24
  import * as lpFeeCalculator from "../lpFeeCalculator";
26
25
  import { EVMBlockFinder } from "../arch/evm";
@@ -44,12 +43,10 @@ import {
44
43
  toBN,
45
44
  getTokenInfo,
46
45
  getUsdcSymbol,
46
+ compareAddressesSimple,
47
47
  chainIsSvm,
48
48
  getDeployedAddress,
49
49
  SvmAddress,
50
- EvmAddress,
51
- Address,
52
- toAddressType,
53
50
  } from "../utils";
54
51
  import { AcrossConfigStoreClient as ConfigStoreClient } from "./AcrossConfigStoreClient/AcrossConfigStoreClient";
55
52
  import { BaseAbstractClient, isUpdateFailureReason, UpdateFailureReason } from "./BaseAbstractClient";
@@ -87,8 +84,7 @@ export type LpFeeRequest = Pick<Deposit, "originChainId" | "inputToken" | "input
87
84
  export class HubPoolClient extends BaseAbstractClient {
88
85
  // L1Token -> destinationChainId -> destinationToken
89
86
  protected l1TokensToDestinationTokens: L1TokensToDestinationTokens = {};
90
- protected l1Tokens: L1TokenInfo[] = []; // L1Tokens and their associated info.
91
- // @dev `token` here is a 20-byte hex sting
87
+ protected l1Tokens: L1Token[] = []; // L1Tokens and their associated info.
92
88
  protected lpTokens: { [token: string]: LpToken } = {};
93
89
  protected proposedRootBundles: ProposedRootBundle[] = [];
94
90
  protected canceledRootBundles: CancelledRootBundle[] = [];
@@ -96,7 +92,6 @@ export class HubPoolClient extends BaseAbstractClient {
96
92
  protected executedRootBundles: ExecutedRootBundle[] = [];
97
93
  protected crossChainContracts: { [l2ChainId: number]: CrossChainContractsSet[] } = {};
98
94
  protected l1TokensToDestinationTokensWithBlock: {
99
- // @dev `l1Token` here is a 20-byte hex sting
100
95
  [l1Token: string]: { [destinationChainId: number]: DestinationTokenWithBlock[] };
101
96
  } = {};
102
97
  protected pendingRootBundle: PendingRootBundle | undefined;
@@ -165,7 +160,7 @@ export class HubPoolClient extends BaseAbstractClient {
165
160
  return this.executedRootBundles;
166
161
  }
167
162
 
168
- getSpokePoolForBlock(chain: number, block: number = Number.MAX_SAFE_INTEGER): Address {
163
+ getSpokePoolForBlock(chain: number, block: number = Number.MAX_SAFE_INTEGER): string {
169
164
  if (!this.crossChainContracts[chain]) {
170
165
  throw new Error(`No cross chain contracts set for ${chain}`);
171
166
  }
@@ -179,33 +174,33 @@ export class HubPoolClient extends BaseAbstractClient {
179
174
  }
180
175
  }
181
176
 
182
- getSpokePoolActivationBlock(chain: number, spokePool: Address): number | undefined {
177
+ getSpokePoolActivationBlock(chain: number, spokePool: string): number | undefined {
183
178
  // Return first time that this spoke pool was registered in the HubPool as a cross chain contract. We can use
184
179
  // this block as the oldest block that we should query for SpokePoolClient purposes.
185
- const mostRecentSpokePoolUpdateBeforeBlock = this.crossChainContracts[chain].find((crossChainContract) =>
186
- crossChainContract.spokePool.eq(spokePool)
180
+ const mostRecentSpokePoolUpdateBeforeBlock = this.crossChainContracts[chain].find(
181
+ (crossChainContract) => crossChainContract.spokePool === spokePool
187
182
  );
188
183
  return mostRecentSpokePoolUpdateBeforeBlock?.blockNumber;
189
184
  }
190
185
 
191
186
  // Returns the latest L2 token to use for an L1 token as of the input hub block.
192
187
  getL2TokenForL1TokenAtBlock(
193
- l1Token: EvmAddress,
188
+ l1Token: string,
194
189
  destinationChainId: number,
195
190
  latestHubBlock = Number.MAX_SAFE_INTEGER
196
- ): Address {
197
- if (!this.l1TokensToDestinationTokensWithBlock?.[l1Token.toEvmAddress()]?.[destinationChainId]) {
191
+ ): string {
192
+ if (!this.l1TokensToDestinationTokensWithBlock?.[l1Token]?.[destinationChainId]) {
198
193
  const chain = getNetworkName(destinationChainId);
199
- const { symbol } = this.l1Tokens.find(({ address }) => address.eq(l1Token)) ?? { symbol: l1Token.toString() };
194
+ const { symbol } = this.l1Tokens.find(({ address }) => address === l1Token) ?? { symbol: l1Token };
200
195
  throw new Error(`Could not find SpokePool mapping for ${symbol} on ${chain} and L1 token ${l1Token}`);
201
196
  }
202
197
  // Find the last mapping published before the target block.
203
198
  const l2Token: DestinationTokenWithBlock | undefined = sortEventsDescending(
204
- this.l1TokensToDestinationTokensWithBlock[l1Token.toEvmAddress()][destinationChainId]
199
+ this.l1TokensToDestinationTokensWithBlock[l1Token][destinationChainId]
205
200
  ).find((mapping: DestinationTokenWithBlock) => mapping.blockNumber <= latestHubBlock);
206
201
  if (!l2Token) {
207
202
  const chain = getNetworkName(destinationChainId);
208
- const { symbol } = this.l1Tokens.find(({ address }) => address.eq(l1Token)) ?? { symbol: l1Token.toString() };
203
+ const { symbol } = this.l1Tokens.find(({ address }) => address === l1Token) ?? { symbol: l1Token };
209
204
  throw new Error(
210
205
  `Could not find SpokePool mapping for ${symbol} on ${chain} at or before HubPool block ${latestHubBlock}!`
211
206
  );
@@ -213,23 +208,18 @@ export class HubPoolClient extends BaseAbstractClient {
213
208
  return l2Token.l2Token;
214
209
  }
215
210
 
216
- // TODO: this might have to deal with truncated Solana addresses? Depends on what input is given actually
217
- // TODO: might craete `getL1TokenForL2EVMTokenAtBlock` and some other fn
218
211
  // Returns the latest L1 token to use for an L2 token as of the input hub block.
219
212
  getL1TokenForL2TokenAtBlock(
220
- l2Token: Address, // ! TODO: assuming that for Svm token, we'll have a proper full SvmAddress in this var
213
+ l2Token: string,
221
214
  destinationChainId: number,
222
215
  latestHubBlock = Number.MAX_SAFE_INTEGER
223
- ): EvmAddress {
216
+ ): string {
224
217
  const l2Tokens = Object.keys(this.l1TokensToDestinationTokensWithBlock)
225
- .filter((l1Token) => this.l2TokenEnabledForL1Token(EvmAddress.from(l1Token), destinationChainId))
218
+ .filter((l1Token) => this.l2TokenEnabledForL1Token(l1Token, destinationChainId))
226
219
  .map((l1Token) => {
227
220
  // Return all matching L2 token mappings that are equal to or earlier than the target block.
228
221
  return this.l1TokensToDestinationTokensWithBlock[l1Token][destinationChainId].filter(
229
- // ! TODO: Okay. Here, in `l1TokensToDestinationTokensWithBlock`, we might be saving truncated solana addresses (as `l1TokensToDestinationTokensWithBlock` is probably generated from events)
230
- // ! TODO: Considering this, this filtering should be a bit different. If .isSvmAddress => check not for equality, but for *truncated equality*. If .isEvmAddress, check for equality
231
- (dstTokenWithBlock) =>
232
- dstTokenWithBlock.l2Token.eq(l2Token) && dstTokenWithBlock.blockNumber <= latestHubBlock
222
+ (mapping) => mapping.l2Token === l2Token && mapping.blockNumber <= latestHubBlock
233
223
  );
234
224
  })
235
225
  .flat();
@@ -245,33 +235,32 @@ export class HubPoolClient extends BaseAbstractClient {
245
235
 
246
236
  protected getL1TokenForDeposit(
247
237
  deposit: Pick<DepositWithBlock, "originChainId" | "inputToken" | "quoteBlockNumber">
248
- ): EvmAddress {
238
+ ): string {
249
239
  // L1-->L2 token mappings are set via PoolRebalanceRoutes which occur on mainnet,
250
240
  // so we use the latest token mapping. This way if a very old deposit is filled, the relayer can use the
251
241
  // latest L2 token mapping to find the L1 token counterpart.
252
242
  return this.getL1TokenForL2TokenAtBlock(deposit.inputToken, deposit.originChainId, deposit.quoteBlockNumber);
253
243
  }
254
244
 
255
- l2TokenEnabledForL1Token(l1Token: EvmAddress, destinationChainId: number): boolean {
256
- return this.l1TokensToDestinationTokens?.[l1Token.toEvmAddress()]?.[destinationChainId] != undefined;
245
+ l2TokenEnabledForL1Token(l1Token: string, destinationChainId: number): boolean {
246
+ return this.l1TokensToDestinationTokens?.[l1Token]?.[destinationChainId] != undefined;
257
247
  }
258
248
 
259
- l2TokenEnabledForL1TokenAtBlock(l1Token: EvmAddress, destinationChainId: number, hubBlockNumber: number): boolean {
249
+ l2TokenEnabledForL1TokenAtBlock(l1Token: string, destinationChainId: number, hubBlockNumber: number): boolean {
260
250
  // Find the last mapping published before the target block.
261
251
  const l2Token: DestinationTokenWithBlock | undefined = sortEventsDescending(
262
- this.l1TokensToDestinationTokensWithBlock?.[l1Token.toEvmAddress()]?.[destinationChainId] ?? []
252
+ this.l1TokensToDestinationTokensWithBlock?.[l1Token]?.[destinationChainId] ?? []
263
253
  ).find((mapping: DestinationTokenWithBlock) => mapping.blockNumber <= hubBlockNumber);
264
254
  return l2Token !== undefined;
265
255
  }
266
256
 
267
- l2TokenHasPoolRebalanceRoute(l2Token: Address, l2ChainId: number, hubPoolBlock = this.latestHeightSearched): boolean {
257
+ l2TokenHasPoolRebalanceRoute(l2Token: string, l2ChainId: number, hubPoolBlock = this.latestHeightSearched): boolean {
268
258
  return Object.values(this.l1TokensToDestinationTokensWithBlock).some((destinationTokenMapping) => {
269
259
  return Object.entries(destinationTokenMapping).some(([_l2ChainId, setPoolRebalanceRouteEvents]) => {
270
260
  return setPoolRebalanceRouteEvents.some((e) => {
271
261
  return (
272
262
  e.blockNumber <= hubPoolBlock &&
273
- // TODO: compare the last 20 bytes of l2Token only. Solana workaround, is this correct?
274
- e.l2Token.eq(l2Token) &&
263
+ compareAddressesSimple(e.l2Token, l2Token) &&
275
264
  Number(_l2ChainId) === l2ChainId
276
265
  );
277
266
  });
@@ -282,16 +271,15 @@ export class HubPoolClient extends BaseAbstractClient {
282
271
  /**
283
272
  * @dev If tokenAddress + chain do not exist in TOKEN_SYMBOLS_MAP then this will throw.
284
273
  * @param tokenAddress Token address on `chain`
285
- * @param chainId Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
274
+ * @param chain Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
286
275
  * @returns Token info for the given token address on the L2 chain including symbol and decimal.
287
276
  */
288
- // TODO: didn't change `tokenAddress` here to Address because of downstream getTokenInfo impl
289
- getTokenInfoForAddress(tokenAddress: string, chainId: number): TokenInfo {
290
- const tokenInfo = getTokenInfo(tokenAddress, chainId);
277
+ getTokenInfoForAddress(tokenAddress: string, chain: number): L1Token {
278
+ const tokenInfo = getTokenInfo(tokenAddress, chain);
291
279
  // @dev Temporarily handle case where an L2 token for chain ID can map to more than one TOKEN_SYMBOLS_MAP
292
280
  // entry. For example, L2 Bridged USDC maps to both the USDC and USDC.e/USDbC entries in TOKEN_SYMBOLS_MAP.
293
- if (tokenInfo.symbol.toLowerCase() === "usdc" && chainId !== this.chainId) {
294
- tokenInfo.symbol = getUsdcSymbol(tokenAddress, chainId) ?? "UNKNOWN";
281
+ if (tokenInfo.symbol.toLowerCase() === "usdc" && chain !== this.chainId) {
282
+ tokenInfo.symbol = getUsdcSymbol(tokenAddress, chain) ?? "UNKNOWN";
295
283
  }
296
284
  return tokenInfo;
297
285
  }
@@ -323,7 +311,7 @@ export class HubPoolClient extends BaseAbstractClient {
323
311
  return blockNumbers;
324
312
  }
325
313
 
326
- async getCurrentPoolUtilization(l1Token: EvmAddress): Promise<BigNumber> {
314
+ async getCurrentPoolUtilization(l1Token: string): Promise<BigNumber> {
327
315
  const blockNumber = this.latestHeightSearched ?? (await this.hubPool.provider.getBlockNumber());
328
316
  return await this.getUtilization(l1Token, blockNumber, bnZero, getCurrentTime(), 0);
329
317
  }
@@ -338,7 +326,7 @@ export class HubPoolClient extends BaseAbstractClient {
338
326
  * @returns HubPool utilization at `blockNumber` after optional `amount` increase in utilization.
339
327
  */
340
328
  protected async getUtilization(
341
- hubPoolToken: EvmAddress,
329
+ hubPoolToken: string,
342
330
  blockNumber: number,
343
331
  depositAmount: BigNumber,
344
332
  timestamp: number,
@@ -349,14 +337,10 @@ export class HubPoolClient extends BaseAbstractClient {
349
337
  const overrides = { blockTag: blockNumber };
350
338
  if (depositAmount.eq(0)) {
351
339
  // For zero amount, just get the utilisation at `blockNumber`.
352
- return await this.hubPool.callStatic.liquidityUtilizationCurrent(hubPoolToken.toEvmAddress(), overrides);
340
+ return await this.hubPool.callStatic.liquidityUtilizationCurrent(hubPoolToken, overrides);
353
341
  }
354
342
 
355
- return await this.hubPool.callStatic.liquidityUtilizationPostRelay(
356
- hubPoolToken.toEvmAddress(),
357
- depositAmount,
358
- overrides
359
- );
343
+ return await this.hubPool.callStatic.liquidityUtilizationPostRelay(hubPoolToken, depositAmount, overrides);
360
344
  };
361
345
 
362
346
  // Resolve the cache locally so that we can appease typescript
@@ -371,8 +355,8 @@ export class HubPoolClient extends BaseAbstractClient {
371
355
  // @note Avoid collisions with pre-existing cache keys by appending an underscore (_) for post-relay utilization.
372
356
  // @fixme This can be removed once the existing keys have been ejected from the cache (i.e. 7 days).
373
357
  const key = depositAmount.eq(0)
374
- ? `utilization_${hubPoolToken.toEvmAddress()}_${blockNumber}`
375
- : `utilization_${hubPoolToken.toEvmAddress()}_${blockNumber}_${depositAmount.toString()}_`;
358
+ ? `utilization_${hubPoolToken}_${blockNumber}`
359
+ : `utilization_${hubPoolToken}_${blockNumber}_${depositAmount.toString()}_`;
376
360
  const result = await cache.get<string>(key);
377
361
  if (isDefined(result)) {
378
362
  return BigNumber.from(result);
@@ -409,14 +393,14 @@ export class HubPoolClient extends BaseAbstractClient {
409
393
 
410
394
  // Map SpokePool token addresses to HubPool token addresses.
411
395
  // Note: Should only be accessed via `getHubPoolToken()` or `getHubPoolTokens()`.
412
- const hubPoolTokens: { [k: string]: EvmAddress } = {};
413
- const getHubPoolToken = (deposit: LpFeeRequest, quoteBlockNumber: number): EvmAddress | undefined => {
396
+ const hubPoolTokens: { [k: string]: string } = {};
397
+ const getHubPoolToken = (deposit: LpFeeRequest, quoteBlockNumber: number): string | undefined => {
414
398
  const tokenKey = `${deposit.originChainId}-${deposit.inputToken}`;
415
399
  if (this.l2TokenHasPoolRebalanceRoute(deposit.inputToken, deposit.originChainId, quoteBlockNumber)) {
416
400
  return (hubPoolTokens[tokenKey] ??= this.getL1TokenForDeposit({ ...deposit, quoteBlockNumber }));
417
401
  } else return undefined;
418
402
  };
419
- const getHubPoolTokens = (): EvmAddress[] => dedupArray(Object.values(hubPoolTokens).filter(isDefined));
403
+ const getHubPoolTokens = (): string[] => dedupArray(Object.values(hubPoolTokens).filter(isDefined));
420
404
 
421
405
  // Helper to resolve the unqiue hubPoolToken & quoteTimestamp mappings.
422
406
  const resolveUniqueQuoteTimestamps = (deposit: LpFeeRequest): void => {
@@ -430,17 +414,17 @@ export class HubPoolClient extends BaseAbstractClient {
430
414
  }
431
415
 
432
416
  // Append the quoteTimestamp for this HubPool token, if it isn't already enqueued.
433
- utilizationTimestamps[hubPoolToken.toEvmAddress()] ??= [];
434
- if (!utilizationTimestamps[hubPoolToken.toEvmAddress()].includes(quoteTimestamp)) {
435
- utilizationTimestamps[hubPoolToken.toEvmAddress()].push(quoteTimestamp);
417
+ utilizationTimestamps[hubPoolToken] ??= [];
418
+ if (!utilizationTimestamps[hubPoolToken].includes(quoteTimestamp)) {
419
+ utilizationTimestamps[hubPoolToken].push(quoteTimestamp);
436
420
  }
437
421
  };
438
422
 
439
423
  // Helper to resolve existing HubPool token utilisation for an array of unique block numbers.
440
424
  // Produces a mapping of blockNumber -> utilization for a specific token.
441
- const resolveUtilization = async (hubPoolToken: EvmAddress): Promise<Record<number, BigNumber>> => {
425
+ const resolveUtilization = async (hubPoolToken: string): Promise<Record<number, BigNumber>> => {
442
426
  return Object.fromEntries(
443
- await mapAsync(utilizationTimestamps[hubPoolToken.toEvmAddress()], async (quoteTimestamp) => {
427
+ await mapAsync(utilizationTimestamps[hubPoolToken], async (quoteTimestamp) => {
444
428
  const blockNumber = quoteBlocks[quoteTimestamp];
445
429
  const utilization = await this.getUtilization(
446
430
  hubPoolToken,
@@ -476,7 +460,7 @@ export class HubPoolClient extends BaseAbstractClient {
476
460
  quoteBlock
477
461
  );
478
462
 
479
- const preUtilization = utilization[hubPoolToken.toEvmAddress()][quoteBlock];
463
+ const preUtilization = utilization[hubPoolToken][quoteBlock];
480
464
  const postUtilization = await this.getUtilization(
481
465
  hubPoolToken,
482
466
  quoteBlock,
@@ -504,10 +488,7 @@ export class HubPoolClient extends BaseAbstractClient {
504
488
  // For each token / quoteBlock pair, resolve the utilisation for each quoted block.
505
489
  // This can be reused for each deposit with the same HubPool token and quoteTimestamp pair.
506
490
  utilization = Object.fromEntries(
507
- await mapAsync(getHubPoolTokens(), async (hubPoolToken) => [
508
- hubPoolToken.toEvmAddress(),
509
- await resolveUtilization(hubPoolToken),
510
- ])
491
+ await mapAsync(getHubPoolTokens(), async (hubPoolToken) => [hubPoolToken, await resolveUtilization(hubPoolToken)])
511
492
  );
512
493
 
513
494
  // For each deposit, compute the post-relay HubPool utilisation independently.
@@ -525,22 +506,22 @@ export class HubPoolClient extends BaseAbstractClient {
525
506
  });
526
507
  }
527
508
 
528
- getL1Tokens(): L1TokenInfo[] {
509
+ getL1Tokens(): L1Token[] {
529
510
  return this.l1Tokens;
530
511
  }
531
512
 
532
- getTokenInfoForL1Token(l1Token: EvmAddress): L1TokenInfo | undefined {
533
- return this.l1Tokens.find((token) => token.address.eq(l1Token));
513
+ getTokenInfoForL1Token(l1Token: string): L1Token | undefined {
514
+ return this.l1Tokens.find((token) => token.address === l1Token);
534
515
  }
535
516
 
536
- getLpTokenInfoForL1Token(l1Token: EvmAddress): LpToken | undefined {
537
- return this.lpTokens[l1Token.toEvmAddress()];
517
+ getLpTokenInfoForL1Token(l1Token: string): LpToken | undefined {
518
+ return this.lpTokens[l1Token];
538
519
  }
539
520
 
540
521
  areTokensEquivalent(
541
- tokenA: Address,
522
+ tokenA: string,
542
523
  chainIdA: number,
543
- tokenB: Address,
524
+ tokenB: string,
544
525
  chainIdB: number,
545
526
  hubPoolBlock = this.latestHeightSearched
546
527
  ): boolean {
@@ -553,14 +534,14 @@ export class HubPoolClient extends BaseAbstractClient {
553
534
  // Resolve both SpokePool tokens back to their respective HubPool tokens and verify that they match.
554
535
  const l1TokenA = this.getL1TokenForL2TokenAtBlock(tokenA, chainIdA, hubPoolBlock);
555
536
  const l1TokenB = this.getL1TokenForL2TokenAtBlock(tokenB, chainIdB, hubPoolBlock);
556
- if (!l1TokenA.eq(l1TokenB)) {
537
+ if (l1TokenA !== l1TokenB) {
557
538
  return false;
558
539
  }
559
540
 
560
541
  // Resolve both HubPool tokens back to a current SpokePool token and verify that they match.
561
542
  const _tokenA = this.getL2TokenForL1TokenAtBlock(l1TokenA, chainIdA, hubPoolBlock);
562
543
  const _tokenB = this.getL2TokenForL1TokenAtBlock(l1TokenB, chainIdB, hubPoolBlock);
563
- return tokenA.eq(_tokenA) && tokenB.eq(_tokenB);
544
+ return tokenA === _tokenA && tokenB === _tokenB;
564
545
  }
565
546
 
566
547
  getSpokeActivationBlockForChain(chainId: number): number {
@@ -797,35 +778,34 @@ export class HubPoolClient extends BaseAbstractClient {
797
778
  getLatestExecutedRootBundleContainingL1Token(
798
779
  block: number,
799
780
  chain: number,
800
- l1Token: EvmAddress
781
+ l1Token: string
801
782
  ): ExecutedRootBundle | undefined {
802
783
  // Search ExecutedRootBundles in descending block order to find the most recent event before the target block.
803
784
  return sortEventsDescending(this.executedRootBundles).find((executedLeaf: ExecutedRootBundle) => {
804
785
  return (
805
786
  executedLeaf.blockNumber <= block &&
806
787
  executedLeaf.chainId === chain &&
807
- executedLeaf.l1Tokens.some((token) => token.eq(l1Token))
788
+ executedLeaf.l1Tokens.some((token) => token.toLowerCase() === l1Token.toLowerCase())
808
789
  );
809
790
  });
810
791
  }
811
792
 
812
- getRunningBalanceBeforeBlockForChain(block: number, chain: number, l1Token: EvmAddress): TokenRunningBalance {
793
+ getRunningBalanceBeforeBlockForChain(block: number, chain: number, l1Token: string): TokenRunningBalance {
813
794
  const executedRootBundle = this.getLatestExecutedRootBundleContainingL1Token(block, chain, l1Token);
814
795
 
815
796
  return this.getRunningBalanceForToken(l1Token, executedRootBundle);
816
797
  }
817
798
 
818
799
  public getRunningBalanceForToken(
819
- l1Token: EvmAddress,
800
+ l1Token: string,
820
801
  executedRootBundle: ExecutedRootBundle | undefined
821
802
  ): TokenRunningBalance {
822
803
  let runningBalance = toBN(0);
823
804
  if (executedRootBundle) {
824
- const indexOfL1Token = executedRootBundle.l1Tokens.findIndex((tokenInBundle) => tokenInBundle.eq(l1Token));
825
- // TODO: not sure this if is required. Wasn't here before. Probably `getRunningBalanceForToken` is used on checked tokens only
826
- if (indexOfL1Token !== -1) {
827
- runningBalance = executedRootBundle.runningBalances[indexOfL1Token];
828
- }
805
+ const indexOfL1Token = executedRootBundle.l1Tokens
806
+ .map((l1Token) => l1Token.toLowerCase())
807
+ .indexOf(l1Token.toLowerCase());
808
+ runningBalance = executedRootBundle.runningBalances[indexOfL1Token];
829
809
  }
830
810
 
831
811
  return { runningBalance };
@@ -893,10 +873,7 @@ export class HubPoolClient extends BaseAbstractClient {
893
873
  return {
894
874
  success: true,
895
875
  currentTime,
896
- pendingRootBundleProposal: {
897
- ...pendingRootBundleProposal,
898
- proposer: toAddressType(pendingRootBundleProposal.proposer, this.chainId),
899
- },
876
+ pendingRootBundleProposal,
900
877
  searchEndBlock: searchConfig.to,
901
878
  events: _events,
902
879
  };
@@ -921,9 +898,9 @@ export class HubPoolClient extends BaseAbstractClient {
921
898
 
922
899
  if (eventsToQuery.includes("CrossChainContractsSet")) {
923
900
  for (const event of events["CrossChainContractsSet"]) {
924
- const args = spreadEventWithBlockNumber(event) as CrossChainContractsSet & { spokePool: string };
901
+ const args = spreadEventWithBlockNumber(event) as CrossChainContractsSet;
925
902
  const dataToAdd: CrossChainContractsSet = {
926
- spokePool: toAddressType(args.spokePool, this.chainId),
903
+ spokePool: args.spokePool,
927
904
  blockNumber: args.blockNumber,
928
905
  txnRef: args.txnRef,
929
906
  logIndex: args.logIndex,
@@ -939,15 +916,16 @@ export class HubPoolClient extends BaseAbstractClient {
939
916
  if (!solanaSpokePool) {
940
917
  throw new Error(`SVM spoke pool not found for chain ${args.l2ChainId}`);
941
918
  }
942
- const svmSpoke = SvmAddress.from(solanaSpokePool);
919
+ const truncatedAddress = SvmAddress.from(solanaSpokePool).toEvmAddress();
943
920
  // Verify the event address matches our expected truncated address
944
- if (args.spokePool.toLowerCase() !== svmSpoke.truncateToBytes20().toLowerCase()) {
921
+ if (args.spokePool.toLowerCase() !== truncatedAddress.toLowerCase()) {
945
922
  throw new Error(
946
923
  `SVM spoke pool address mismatch for chain ${args.l2ChainId}. ` +
947
- `Expected ${svmSpoke.truncateToBytes20()}, got ${args.spokePool}`
924
+ `Expected ${truncatedAddress}, got ${args.spokePool}`
948
925
  );
949
926
  }
950
- dataToAdd.spokePool = svmSpoke;
927
+ // Store the full Solana address
928
+ dataToAdd.spokePool = SvmAddress.from(solanaSpokePool).toBytes32();
951
929
  }
952
930
  assign(this.crossChainContracts, [args.l2ChainId], [dataToAdd]);
953
931
  }
@@ -955,37 +933,34 @@ export class HubPoolClient extends BaseAbstractClient {
955
933
 
956
934
  if (eventsToQuery.includes("SetPoolRebalanceRoute")) {
957
935
  for (const event of events["SetPoolRebalanceRoute"]) {
958
- const args = spreadEventWithBlockNumber(event) as SetPoolRebalanceRoot & {
959
- l1Token: string;
960
- destinationToken: string;
961
- };
936
+ const args = spreadEventWithBlockNumber(event) as SetPoolRebalanceRoot;
962
937
 
963
938
  // If the destination chain is SVM, then we need to convert the destination token to the Solana address.
964
939
  // This is because the HubPool contract only holds a truncated address for the USDC token and currently
965
940
  // only supports USDC as a destination token for Solana.
966
- let destinationToken = toAddressType(args.destinationToken, this.chainId);
941
+ let destinationToken = args.destinationToken;
967
942
  if (chainIsSvm(args.destinationChainId)) {
968
943
  const usdcTokenSol = TOKEN_SYMBOLS_MAP.USDC.addresses[args.destinationChainId];
969
- const svmUsdc = SvmAddress.from(usdcTokenSol);
970
- if (destinationToken.truncateToBytes20() !== svmUsdc.truncateToBytes20()) {
944
+ const truncatedAddress = SvmAddress.from(usdcTokenSol).toEvmAddress();
945
+ if (destinationToken.toLowerCase() !== truncatedAddress.toLowerCase()) {
971
946
  throw new Error(
972
947
  `SVM USDC address mismatch for chain ${args.destinationChainId}. ` +
973
- `Expected ${svmUsdc.truncateToBytes20()}, got ${destinationToken}`
948
+ `Expected ${truncatedAddress}, got ${destinationToken}`
974
949
  );
975
950
  }
976
- destinationToken = svmUsdc;
951
+ destinationToken = SvmAddress.from(usdcTokenSol).toBytes32();
977
952
  }
978
953
 
979
954
  // If the destination token is set to the zero address in an event, then this means Across should no longer
980
955
  // rebalance to this chain.
981
- if (destinationToken.toAddress() !== ZERO_ADDRESS) {
956
+ if (destinationToken !== ZERO_ADDRESS) {
982
957
  assign(this.l1TokensToDestinationTokens, [args.l1Token, args.destinationChainId], destinationToken);
983
958
  assign(
984
959
  this.l1TokensToDestinationTokensWithBlock,
985
960
  [args.l1Token, args.destinationChainId],
986
961
  [
987
962
  {
988
- l1Token: toAddressType(args.l1Token, this.chainId),
963
+ l1Token: args.l1Token,
989
964
  l2Token: destinationToken,
990
965
  blockNumber: args.blockNumber,
991
966
  txnIndex: args.txnIndex,
@@ -1007,15 +982,7 @@ export class HubPoolClient extends BaseAbstractClient {
1007
982
  );
1008
983
 
1009
984
  const [tokenInfo, lpTokenInfo] = await Promise.all([
1010
- Promise.all(
1011
- uniqueL1Tokens.map(async (l1Token: string) => {
1012
- const tokenInfo: L1TokenInfo = await fetchTokenInfo(l1Token, this.hubPool.provider);
1013
- return {
1014
- ...tokenInfo,
1015
- address: EvmAddress.from(l1Token),
1016
- };
1017
- })
1018
- ),
985
+ Promise.all(uniqueL1Tokens.map((l1Token: string) => fetchTokenInfo(l1Token, this.hubPool.provider))),
1019
986
  Promise.all(
1020
987
  uniqueL1Tokens.map(
1021
988
  async (l1Token: string) => await this.hubPool.pooledTokens(l1Token, { blockTag: update.searchEndBlock })
@@ -1023,7 +990,7 @@ export class HubPoolClient extends BaseAbstractClient {
1023
990
  ),
1024
991
  ]);
1025
992
  for (const info of tokenInfo) {
1026
- if (!this.l1Tokens.find((token) => token.address.eq(info.address))) {
993
+ if (!this.l1Tokens.find((token) => compareAddressesSimple(token.address, info.address))) {
1027
994
  if (info.decimals > 0 && info.decimals <= 18) {
1028
995
  this.l1Tokens.push(info);
1029
996
  } else {
@@ -1044,13 +1011,7 @@ export class HubPoolClient extends BaseAbstractClient {
1044
1011
  this.proposedRootBundles.push(
1045
1012
  ...events["ProposeRootBundle"]
1046
1013
  .filter((event) => !this.configOverride.ignoredHubProposedBundles.includes(event.blockNumber))
1047
- .map((_event) => {
1048
- const args = spreadEventWithBlockNumber(_event) as ProposedRootBundle & { proposer: string };
1049
- return {
1050
- ...args,
1051
- proposer: toAddressType(args.proposer, this.chainId),
1052
- };
1053
- })
1014
+ .map((event) => spreadEventWithBlockNumber(event) as ProposedRootBundle)
1054
1015
  );
1055
1016
  }
1056
1017
 
@@ -1073,7 +1034,7 @@ export class HubPoolClient extends BaseAbstractClient {
1073
1034
  }
1074
1035
 
1075
1036
  // Set running balances and incentive balances for this bundle.
1076
- const executedRootBundle = spreadEventWithBlockNumber(event) as ExecutedRootBundle & { l1Tokens: string[] };
1037
+ const executedRootBundle = spreadEventWithBlockNumber(event) as ExecutedRootBundle;
1077
1038
  const { l1Tokens, runningBalances } = executedRootBundle;
1078
1039
  const nTokens = l1Tokens.length;
1079
1040
 
@@ -1085,11 +1046,7 @@ export class HubPoolClient extends BaseAbstractClient {
1085
1046
  );
1086
1047
  }
1087
1048
  executedRootBundle.runningBalances = runningBalances.slice(0, nTokens);
1088
- const executedRootBundleWithL1Tokens = {
1089
- ...executedRootBundle,
1090
- l1Tokens: executedRootBundle.l1Tokens.map(toAddressType, this.chainId),
1091
- };
1092
- this.executedRootBundles.push(executedRootBundleWithL1Tokens);
1049
+ this.executedRootBundles.push(executedRootBundle);
1093
1050
  }
1094
1051
  }
1095
1052
 
@@ -17,7 +17,6 @@ import {
17
17
  MakeOptional,
18
18
  toBN,
19
19
  EvmAddress,
20
- toAddressType,
21
20
  } from "../../utils";
22
21
  import {
23
22
  EventSearchConfig,
@@ -195,11 +194,6 @@ export class EVMSpokePoolClient extends SpokePoolClient {
195
194
 
196
195
  deposit = {
197
196
  ...spreadEventWithBlockNumber(event),
198
- inputToken: toAddressType(event.args.inputToken, this.chainId),
199
- outputToken: toAddressType(event.args.outputToken, event.args.destinationChainId),
200
- depositor: toAddressType(event.args.depositor, this.chainId),
201
- recipient: toAddressType(event.args.recipient, event.args.destinationChainId),
202
- exclusiveRelayer: toAddressType(event.args.exclusiveRelayer, event.args.destinationChainId),
203
197
  originChainId: this.chainId,
204
198
  quoteBlockNumber: await this.getBlockNumber(Number(event.args["quoteTimestamp"])),
205
199
  fromLiteChain: true, // To be updated immediately afterwards.