@across-protocol/sdk 4.2.16 → 4.3.0

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 (220) hide show
  1. package/dist/cjs/arch/evm/SpokeUtils.d.ts +8 -3
  2. package/dist/cjs/arch/evm/SpokeUtils.js +26 -11
  3. package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
  4. package/dist/cjs/arch/svm/SpokeUtils.d.ts +8 -2
  5. package/dist/cjs/arch/svm/SpokeUtils.js +41 -50
  6. package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
  7. package/dist/cjs/arch/svm/eventsClient.js +4 -2
  8. package/dist/cjs/arch/svm/eventsClient.js.map +1 -1
  9. package/dist/cjs/arch/svm/utils.d.ts +3 -3
  10. package/dist/cjs/arch/svm/utils.js +16 -14
  11. package/dist/cjs/arch/svm/utils.js.map +1 -1
  12. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  13. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +4 -2
  14. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  15. package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  16. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +60 -56
  17. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  18. package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +13 -13
  19. package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  20. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  21. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +3 -2
  22. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  23. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
  24. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  25. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +3 -3
  26. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  27. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
  28. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +13 -8
  29. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  30. package/dist/cjs/clients/HubPoolClient.d.ts +21 -21
  31. package/dist/cjs/clients/HubPoolClient.js +85 -58
  32. package/dist/cjs/clients/HubPoolClient.js.map +1 -1
  33. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
  34. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  35. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  36. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +65 -45
  37. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  38. package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +9 -9
  39. package/dist/cjs/clients/mocks/MockHubPoolClient.js +15 -9
  40. package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
  41. package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  42. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +40 -36
  43. package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
  44. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  45. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +6 -4
  46. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
  47. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  48. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +2 -2
  49. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  50. package/dist/cjs/interfaces/HubPool.d.ts +19 -14
  51. package/dist/cjs/interfaces/SpokePool.d.ts +18 -19
  52. package/dist/cjs/interfaces/SpokePool.js.map +1 -1
  53. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +15 -7
  54. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +24 -15
  55. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  56. package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +1 -1
  57. package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -1
  58. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +12 -4
  59. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +46 -44
  60. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  61. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
  62. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +10 -10
  63. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  64. package/dist/cjs/utils/AddressUtils.d.ts +12 -8
  65. package/dist/cjs/utils/AddressUtils.js +33 -36
  66. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  67. package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
  68. package/dist/cjs/utils/SpokeUtils.js +4 -22
  69. package/dist/cjs/utils/SpokeUtils.js.map +1 -1
  70. package/dist/cjs/utils/TokenUtils.d.ts +4 -4
  71. package/dist/cjs/utils/TokenUtils.js +5 -3
  72. package/dist/cjs/utils/TokenUtils.js.map +1 -1
  73. package/dist/esm/arch/evm/SpokeUtils.d.ts +9 -4
  74. package/dist/esm/arch/evm/SpokeUtils.js +29 -14
  75. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  76. package/dist/esm/arch/svm/SpokeUtils.d.ts +9 -3
  77. package/dist/esm/arch/svm/SpokeUtils.js +42 -55
  78. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
  79. package/dist/esm/arch/svm/eventsClient.js +5 -3
  80. package/dist/esm/arch/svm/eventsClient.js.map +1 -1
  81. package/dist/esm/arch/svm/utils.d.ts +3 -3
  82. package/dist/esm/arch/svm/utils.js +17 -15
  83. package/dist/esm/arch/svm/utils.js.map +1 -1
  84. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  85. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +4 -2
  86. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  87. package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  88. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +61 -57
  89. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  90. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +14 -14
  91. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  92. package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  93. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +7 -7
  94. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  95. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
  96. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  97. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
  98. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  99. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
  100. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +20 -10
  101. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  102. package/dist/esm/clients/HubPoolClient.d.ts +22 -22
  103. package/dist/esm/clients/HubPoolClient.js +91 -62
  104. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  105. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
  106. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  107. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  108. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +68 -47
  109. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  110. package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
  111. package/dist/esm/clients/mocks/MockHubPoolClient.js +16 -10
  112. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  113. package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  114. package/dist/esm/clients/mocks/MockSpokePoolClient.js +42 -38
  115. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  116. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  117. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +7 -5
  118. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
  119. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  120. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
  121. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  122. package/dist/esm/interfaces/HubPool.d.ts +19 -14
  123. package/dist/esm/interfaces/SpokePool.d.ts +18 -19
  124. package/dist/esm/interfaces/SpokePool.js.map +1 -1
  125. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +18 -10
  126. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +29 -20
  127. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  128. package/dist/esm/relayFeeCalculator/chain-queries/factory.js +2 -2
  129. package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -1
  130. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +14 -6
  131. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +51 -48
  132. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  133. package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
  134. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +9 -9
  135. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  136. package/dist/esm/utils/AddressUtils.d.ts +12 -8
  137. package/dist/esm/utils/AddressUtils.js +36 -38
  138. package/dist/esm/utils/AddressUtils.js.map +1 -1
  139. package/dist/esm/utils/SpokeUtils.d.ts +3 -8
  140. package/dist/esm/utils/SpokeUtils.js +4 -26
  141. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  142. package/dist/esm/utils/TokenUtils.d.ts +22 -18
  143. package/dist/esm/utils/TokenUtils.js +6 -4
  144. package/dist/esm/utils/TokenUtils.js.map +1 -1
  145. package/dist/types/arch/evm/SpokeUtils.d.ts +9 -4
  146. package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
  147. package/dist/types/arch/svm/SpokeUtils.d.ts +9 -3
  148. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
  149. package/dist/types/arch/svm/eventsClient.d.ts.map +1 -1
  150. package/dist/types/arch/svm/utils.d.ts +3 -3
  151. package/dist/types/arch/svm/utils.d.ts.map +1 -1
  152. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  153. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  154. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  155. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  156. package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
  157. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  158. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
  159. package/dist/types/clients/BundleDataClient/utils/MerkleTreeUtils.d.ts.map +1 -1
  160. package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
  161. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
  162. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
  163. package/dist/types/clients/HubPoolClient.d.ts +22 -22
  164. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  165. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  166. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  167. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
  168. package/dist/types/clients/mocks/MockHubPoolClient.d.ts +9 -9
  169. package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
  170. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  171. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
  172. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  173. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts.map +1 -1
  174. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  175. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
  176. package/dist/types/interfaces/HubPool.d.ts +19 -14
  177. package/dist/types/interfaces/HubPool.d.ts.map +1 -1
  178. package/dist/types/interfaces/SpokePool.d.ts +18 -19
  179. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  180. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +18 -10
  181. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
  182. package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
  183. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +14 -6
  184. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
  185. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
  186. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
  187. package/dist/types/utils/AddressUtils.d.ts +12 -8
  188. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  189. package/dist/types/utils/SpokeUtils.d.ts +3 -8
  190. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  191. package/dist/types/utils/TokenUtils.d.ts +22 -18
  192. package/dist/types/utils/TokenUtils.d.ts.map +1 -1
  193. package/package.json +1 -2
  194. package/src/arch/evm/SpokeUtils.ts +72 -22
  195. package/src/arch/svm/SpokeUtils.ts +67 -53
  196. package/src/arch/svm/eventsClient.ts +40 -8
  197. package/src/arch/svm/utils.ts +6 -6
  198. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -4
  199. package/src/clients/BundleDataClient/BundleDataClient.ts +57 -53
  200. package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +28 -13
  201. package/src/clients/BundleDataClient/utils/FillUtils.ts +12 -8
  202. package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +7 -1
  203. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
  204. package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +22 -10
  205. package/src/clients/HubPoolClient.ts +123 -82
  206. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +6 -0
  207. package/src/clients/SpokePoolClient/SpokePoolClient.ts +121 -35
  208. package/src/clients/mocks/MockHubPoolClient.ts +24 -19
  209. package/src/clients/mocks/MockSpokePoolClient.ts +39 -27
  210. package/src/clients/mocks/MockSvmCpiEventsClient.ts +8 -5
  211. package/src/clients/mocks/MockSvmSpokePoolClient.ts +12 -3
  212. package/src/interfaces/HubPool.ts +20 -14
  213. package/src/interfaces/SpokePool.ts +19 -19
  214. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +39 -20
  215. package/src/relayFeeCalculator/chain-queries/factory.ts +2 -2
  216. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +57 -56
  217. package/src/relayFeeCalculator/relayFeeCalculator.ts +15 -13
  218. package/src/utils/AddressUtils.ts +39 -51
  219. package/src/utils/SpokeUtils.ts +11 -33
  220. package/src/utils/TokenUtils.ts +10 -8
@@ -1,8 +1,8 @@
1
1
  import { Contract, EventFilter } from "ethers";
2
2
  import winston from "winston";
3
- import { CachingMechanismInterface, CancelledRootBundle, CrossChainContractsSet, Deposit, DepositWithBlock, DestinationTokenWithBlock, DisputedRootBundle, ExecutedRootBundle, L1Token, Log, LpToken, PendingRootBundle, ProposedRootBundle, RealizedLpFee, TokenRunningBalance } from "../interfaces";
3
+ import { CachingMechanismInterface, CancelledRootBundle, CrossChainContractsSet, Deposit, DepositWithBlock, DestinationTokenWithBlock, DisputedRootBundle, ExecutedRootBundle, TokenInfo, Log, LpToken, PendingRootBundle, ProposedRootBundle, RealizedLpFee, TokenRunningBalance, L1TokenInfo } from "../interfaces";
4
4
  import { EVMBlockFinder } from "../arch/evm";
5
- import { BigNumber, EventSearchConfig, MakeOptional } from "../utils";
5
+ import { BigNumber, EventSearchConfig, MakeOptional, EvmAddress, Address } from "../utils";
6
6
  import { AcrossConfigStoreClient as ConfigStoreClient } from "./AcrossConfigStoreClient/AcrossConfigStoreClient";
7
7
  import { BaseAbstractClient, UpdateFailureReason } from "./BaseAbstractClient";
8
8
  type HubPoolUpdateSuccess = {
@@ -38,7 +38,7 @@ export declare class HubPoolClient extends BaseAbstractClient {
38
38
  timeToCache?: number;
39
39
  };
40
40
  protected l1TokensToDestinationTokens: L1TokensToDestinationTokens;
41
- protected l1Tokens: L1Token[];
41
+ protected l1Tokens: L1TokenInfo[];
42
42
  protected lpTokens: {
43
43
  [token: string]: LpToken;
44
44
  };
@@ -69,21 +69,21 @@ export declare class HubPoolClient extends BaseAbstractClient {
69
69
  getCancelledRootBundles(): CancelledRootBundle[];
70
70
  getDisputedRootBundles(): DisputedRootBundle[];
71
71
  getExecutedRootBundles(): ExecutedRootBundle[];
72
- getSpokePoolForBlock(chain: number, block?: number): string;
73
- getSpokePoolActivationBlock(chain: number, spokePool: string): number | undefined;
74
- getL2TokenForL1TokenAtBlock(l1Token: string, destinationChainId: number, latestHubBlock?: number): string;
75
- getL1TokenForL2TokenAtBlock(l2Token: string, destinationChainId: number, latestHubBlock?: number): string;
76
- protected getL1TokenForDeposit(deposit: Pick<DepositWithBlock, "originChainId" | "inputToken" | "quoteBlockNumber">): string;
77
- l2TokenEnabledForL1Token(l1Token: string, destinationChainId: number): boolean;
78
- l2TokenEnabledForL1TokenAtBlock(l1Token: string, destinationChainId: number, hubBlockNumber: number): boolean;
79
- l2TokenHasPoolRebalanceRoute(l2Token: string, l2ChainId: number, hubPoolBlock?: number): boolean;
72
+ getSpokePoolForBlock(chain: number, block?: number): Address;
73
+ getSpokePoolActivationBlock(chain: number, spokePool: Address): number | undefined;
74
+ getL2TokenForL1TokenAtBlock(l1Token: EvmAddress, destinationChainId: number, latestHubBlock?: number): Address;
75
+ getL1TokenForL2TokenAtBlock(l2Token: Address, destinationChainId: number, latestHubBlock?: number): EvmAddress;
76
+ protected getL1TokenForDeposit(deposit: Pick<DepositWithBlock, "originChainId" | "inputToken" | "quoteBlockNumber">): EvmAddress;
77
+ l2TokenEnabledForL1Token(l1Token: EvmAddress, destinationChainId: number): boolean;
78
+ l2TokenEnabledForL1TokenAtBlock(l1Token: EvmAddress, destinationChainId: number, hubBlockNumber: number): boolean;
79
+ l2TokenHasPoolRebalanceRoute(l2Token: Address, l2ChainId: number, hubPoolBlock?: number): boolean;
80
80
  /**
81
81
  * @dev If tokenAddress + chain do not exist in TOKEN_SYMBOLS_MAP then this will throw.
82
82
  * @param tokenAddress Token address on `chain`
83
- * @param chain Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
83
+ * @param chainId Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
84
84
  * @returns Token info for the given token address on the L2 chain including symbol and decimal.
85
85
  */
86
- getTokenInfoForAddress(tokenAddress: string, chain: number): L1Token;
86
+ getTokenInfoForAddress(tokenAddress: string, chainId: number): TokenInfo;
87
87
  /**
88
88
  * Resolve a given timestamp to a block number on the HubPool chain.
89
89
  * @param timestamp A single timestamp to be resolved to a block number on the HubPool chain.
@@ -100,7 +100,7 @@ export declare class HubPoolClient extends BaseAbstractClient {
100
100
  getBlockNumbers(timestamps: number[]): Promise<{
101
101
  [quoteTimestamp: number]: number;
102
102
  }>;
103
- getCurrentPoolUtilization(l1Token: string): Promise<BigNumber>;
103
+ getCurrentPoolUtilization(l1Token: EvmAddress): Promise<BigNumber>;
104
104
  /**
105
105
  * For a HubPool token at a specific block number, compute the relevant utilization.
106
106
  * @param hubPoolToken HubPool token to query utilization for.
@@ -110,13 +110,13 @@ export declare class HubPoolClient extends BaseAbstractClient {
110
110
  * @param timeToCache Age at which the response is able to be cached.
111
111
  * @returns HubPool utilization at `blockNumber` after optional `amount` increase in utilization.
112
112
  */
113
- protected getUtilization(hubPoolToken: string, blockNumber: number, depositAmount: BigNumber, timestamp: number, timeToCache: number): Promise<BigNumber>;
113
+ protected getUtilization(hubPoolToken: EvmAddress, blockNumber: number, depositAmount: BigNumber, timestamp: number, timeToCache: number): Promise<BigNumber>;
114
114
  computeRealizedLpFeePct(deposit: LpFeeRequest): Promise<RealizedLpFee>;
115
115
  batchComputeRealizedLpFeePct(deposits: LpFeeRequest[]): Promise<RealizedLpFee[]>;
116
- getL1Tokens(): L1Token[];
117
- getTokenInfoForL1Token(l1Token: string): L1Token | undefined;
118
- getLpTokenInfoForL1Token(l1Token: string): LpToken | undefined;
119
- areTokensEquivalent(tokenA: string, chainIdA: number, tokenB: string, chainIdB: number, hubPoolBlock?: number): boolean;
116
+ getL1Tokens(): L1TokenInfo[];
117
+ getTokenInfoForL1Token(l1Token: EvmAddress): L1TokenInfo | undefined;
118
+ getLpTokenInfoForL1Token(l1Token: EvmAddress): LpToken | undefined;
119
+ areTokensEquivalent(tokenA: Address, chainIdA: number, tokenB: Address, chainIdB: number, hubPoolBlock?: number): boolean;
120
120
  getSpokeActivationBlockForChain(chainId: number): number;
121
121
  isRootBundleValid(rootBundle: ProposedRootBundle, latestMainnetBlock: number): boolean;
122
122
  getRootBundleEvalBlockNumberContainingBlock(latestMainnetBlock: number, block: number, chain: number, chainIdListOverride?: number[]): number | undefined;
@@ -142,9 +142,9 @@ export declare class HubPoolClient extends BaseAbstractClient {
142
142
  getNthFullyExecutedRootBundle(n: number, startBlock?: number): ProposedRootBundle | undefined;
143
143
  getLatestBundleEndBlockForChain(chainIdList: number[], latestMainnetBlock: number, chainId: number): number;
144
144
  getNextBundleStartBlockNumber(chainIdList: number[], latestMainnetBlock: number, chainId: number): number;
145
- getLatestExecutedRootBundleContainingL1Token(block: number, chain: number, l1Token: string): ExecutedRootBundle | undefined;
146
- getRunningBalanceBeforeBlockForChain(block: number, chain: number, l1Token: string): TokenRunningBalance;
147
- getRunningBalanceForToken(l1Token: string, executedRootBundle: ExecutedRootBundle | undefined): TokenRunningBalance;
145
+ getLatestExecutedRootBundleContainingL1Token(block: number, chain: number, l1Token: EvmAddress): ExecutedRootBundle | undefined;
146
+ getRunningBalanceBeforeBlockForChain(block: number, chain: number, l1Token: EvmAddress): TokenRunningBalance;
147
+ getRunningBalanceForToken(l1Token: EvmAddress, executedRootBundle: ExecutedRootBundle | undefined): TokenRunningBalance;
148
148
  _update(eventNames: HubPoolEvent[]): Promise<HubPoolUpdate>;
149
149
  update(eventsToQuery?: HubPoolEvent[]): Promise<void>;
150
150
  protected getBundleEndBlockForChain(proposeRootBundleEvent: ProposedRootBundle, chainId: number, chainIdList: number[]): number;
@@ -1,10 +1,10 @@
1
1
  import { __assign, __awaiter, __extends, __generator, __spreadArray } from "tslib";
2
2
  import assert from "assert";
3
3
  import _ from "lodash";
4
- import { DEFAULT_CACHING_SAFE_LAG, DEFAULT_CACHING_TTL, TOKEN_SYMBOLS_MAP, ZERO_ADDRESS } from "../constants";
4
+ import { DEFAULT_CACHING_SAFE_LAG, DEFAULT_CACHING_TTL, TOKEN_SYMBOLS_MAP } from "../constants";
5
5
  import * as lpFeeCalculator from "../lpFeeCalculator";
6
6
  import { EVMBlockFinder } from "../arch/evm";
7
- import { BigNumber, bnZero, dedupArray, assign, fetchTokenInfo, getCachedBlockForTimestamp, getCurrentTime, getNetworkName, isDefined, mapAsync, paginatedEventQuery, shouldCache, sortEventsDescending, spreadEventWithBlockNumber, toBN, getTokenInfo, getUsdcSymbol, compareAddressesSimple, chainIsSvm, getDeployedAddress, SvmAddress, } from "../utils";
7
+ import { BigNumber, bnZero, dedupArray, assign, fetchTokenInfo, getCachedBlockForTimestamp, getCurrentTime, getNetworkName, isDefined, mapAsync, paginatedEventQuery, shouldCache, sortEventsDescending, spreadEventWithBlockNumber, toBN, getTokenInfo, getUsdcSymbol, chainIsSvm, getDeployedAddress, SvmAddress, EvmAddress, toAddressType, } from "../utils";
8
8
  import { BaseAbstractClient, isUpdateFailureReason, UpdateFailureReason } from "./BaseAbstractClient";
9
9
  var HubPoolClient = /** @class */ (function (_super) {
10
10
  __extends(HubPoolClient, _super);
@@ -26,6 +26,7 @@ var HubPoolClient = /** @class */ (function (_super) {
26
26
  // L1Token -> destinationChainId -> destinationToken
27
27
  _this.l1TokensToDestinationTokens = {};
28
28
  _this.l1Tokens = []; // L1Tokens and their associated info.
29
+ // @dev `token` here is a 20-byte hex sting
29
30
  _this.lpTokens = {};
30
31
  _this.proposedRootBundles = [];
31
32
  _this.canceledRootBundles = [];
@@ -84,29 +85,31 @@ var HubPoolClient = /** @class */ (function (_super) {
84
85
  HubPoolClient.prototype.getSpokePoolActivationBlock = function (chain, spokePool) {
85
86
  // Return first time that this spoke pool was registered in the HubPool as a cross chain contract. We can use
86
87
  // this block as the oldest block that we should query for SpokePoolClient purposes.
87
- var mostRecentSpokePoolUpdateBeforeBlock = this.crossChainContracts[chain].find(function (crossChainContract) { return crossChainContract.spokePool === spokePool; });
88
+ var mostRecentSpokePoolUpdateBeforeBlock = this.crossChainContracts[chain].find(function (crossChainContract) {
89
+ return crossChainContract.spokePool.eq(spokePool);
90
+ });
88
91
  return mostRecentSpokePoolUpdateBeforeBlock === null || mostRecentSpokePoolUpdateBeforeBlock === void 0 ? void 0 : mostRecentSpokePoolUpdateBeforeBlock.blockNumber;
89
92
  };
90
93
  // Returns the latest L2 token to use for an L1 token as of the input hub block.
91
94
  HubPoolClient.prototype.getL2TokenForL1TokenAtBlock = function (l1Token, destinationChainId, latestHubBlock) {
92
95
  var _a, _b, _c, _d;
93
96
  if (latestHubBlock === void 0) { latestHubBlock = Number.MAX_SAFE_INTEGER; }
94
- if (!((_b = (_a = this.l1TokensToDestinationTokensWithBlock) === null || _a === void 0 ? void 0 : _a[l1Token]) === null || _b === void 0 ? void 0 : _b[destinationChainId])) {
97
+ if (!((_b = (_a = this.l1TokensToDestinationTokensWithBlock) === null || _a === void 0 ? void 0 : _a[l1Token.toEvmAddress()]) === null || _b === void 0 ? void 0 : _b[destinationChainId])) {
95
98
  var chain = getNetworkName(destinationChainId);
96
99
  var symbol = ((_c = this.l1Tokens.find(function (_a) {
97
100
  var address = _a.address;
98
- return address === l1Token;
99
- })) !== null && _c !== void 0 ? _c : { symbol: l1Token }).symbol;
101
+ return address.eq(l1Token);
102
+ })) !== null && _c !== void 0 ? _c : { symbol: l1Token.toString() }).symbol;
100
103
  throw new Error("Could not find SpokePool mapping for ".concat(symbol, " on ").concat(chain, " and L1 token ").concat(l1Token));
101
104
  }
102
105
  // Find the last mapping published before the target block.
103
- var l2Token = sortEventsDescending(this.l1TokensToDestinationTokensWithBlock[l1Token][destinationChainId]).find(function (mapping) { return mapping.blockNumber <= latestHubBlock; });
106
+ var l2Token = sortEventsDescending(this.l1TokensToDestinationTokensWithBlock[l1Token.toEvmAddress()][destinationChainId]).find(function (mapping) { return mapping.blockNumber <= latestHubBlock; });
104
107
  if (!l2Token) {
105
108
  var chain = getNetworkName(destinationChainId);
106
109
  var symbol = ((_d = this.l1Tokens.find(function (_a) {
107
110
  var address = _a.address;
108
- return address === l1Token;
109
- })) !== null && _d !== void 0 ? _d : { symbol: l1Token }).symbol;
111
+ return address.eq(l1Token);
112
+ })) !== null && _d !== void 0 ? _d : { symbol: l1Token.toString() }).symbol;
110
113
  throw new Error("Could not find SpokePool mapping for ".concat(symbol, " on ").concat(chain, " at or before HubPool block ").concat(latestHubBlock, "!"));
111
114
  }
112
115
  return l2Token.l2Token;
@@ -116,10 +119,14 @@ var HubPoolClient = /** @class */ (function (_super) {
116
119
  var _this = this;
117
120
  if (latestHubBlock === void 0) { latestHubBlock = Number.MAX_SAFE_INTEGER; }
118
121
  var l2Tokens = Object.keys(this.l1TokensToDestinationTokensWithBlock)
119
- .filter(function (l1Token) { return _this.l2TokenEnabledForL1Token(l1Token, destinationChainId); })
122
+ .filter(function (l1Token) { return _this.l2TokenEnabledForL1Token(EvmAddress.from(l1Token), destinationChainId); })
120
123
  .map(function (l1Token) {
121
124
  // Return all matching L2 token mappings that are equal to or earlier than the target block.
122
- return _this.l1TokensToDestinationTokensWithBlock[l1Token][destinationChainId].filter(function (mapping) { return mapping.l2Token === l2Token && mapping.blockNumber <= latestHubBlock; });
125
+ // @dev Since tokens on L2s (like Solana) can have 32 byte addresses, filter on the lower 20 bytes of the token only.
126
+ return _this.l1TokensToDestinationTokensWithBlock[l1Token][destinationChainId].filter(function (dstTokenWithBlock) {
127
+ return dstTokenWithBlock.l2Token.truncateToBytes20() === l2Token.truncateToBytes20() &&
128
+ dstTokenWithBlock.blockNumber <= latestHubBlock;
129
+ });
123
130
  })
124
131
  .flat();
125
132
  if (l2Tokens.length === 0) {
@@ -137,12 +144,12 @@ var HubPoolClient = /** @class */ (function (_super) {
137
144
  };
138
145
  HubPoolClient.prototype.l2TokenEnabledForL1Token = function (l1Token, destinationChainId) {
139
146
  var _a, _b;
140
- return ((_b = (_a = this.l1TokensToDestinationTokens) === null || _a === void 0 ? void 0 : _a[l1Token]) === null || _b === void 0 ? void 0 : _b[destinationChainId]) != undefined;
147
+ return ((_b = (_a = this.l1TokensToDestinationTokens) === null || _a === void 0 ? void 0 : _a[l1Token.toEvmAddress()]) === null || _b === void 0 ? void 0 : _b[destinationChainId]) != undefined;
141
148
  };
142
149
  HubPoolClient.prototype.l2TokenEnabledForL1TokenAtBlock = function (l1Token, destinationChainId, hubBlockNumber) {
143
150
  var _a, _b, _c;
144
151
  // Find the last mapping published before the target block.
145
- var l2Token = sortEventsDescending((_c = (_b = (_a = this.l1TokensToDestinationTokensWithBlock) === null || _a === void 0 ? void 0 : _a[l1Token]) === null || _b === void 0 ? void 0 : _b[destinationChainId]) !== null && _c !== void 0 ? _c : []).find(function (mapping) { return mapping.blockNumber <= hubBlockNumber; });
152
+ var l2Token = sortEventsDescending((_c = (_b = (_a = this.l1TokensToDestinationTokensWithBlock) === null || _a === void 0 ? void 0 : _a[l1Token.toEvmAddress()]) === null || _b === void 0 ? void 0 : _b[destinationChainId]) !== null && _c !== void 0 ? _c : []).find(function (mapping) { return mapping.blockNumber <= hubBlockNumber; });
146
153
  return l2Token !== undefined;
147
154
  };
148
155
  HubPoolClient.prototype.l2TokenHasPoolRebalanceRoute = function (l2Token, l2ChainId, hubPoolBlock) {
@@ -152,7 +159,7 @@ var HubPoolClient = /** @class */ (function (_super) {
152
159
  var _l2ChainId = _a[0], setPoolRebalanceRouteEvents = _a[1];
153
160
  return setPoolRebalanceRouteEvents.some(function (e) {
154
161
  return (e.blockNumber <= hubPoolBlock &&
155
- compareAddressesSimple(e.l2Token, l2Token) &&
162
+ e.l2Token.truncateToBytes20() === l2Token.truncateToBytes20() &&
156
163
  Number(_l2ChainId) === l2ChainId);
157
164
  });
158
165
  });
@@ -161,16 +168,17 @@ var HubPoolClient = /** @class */ (function (_super) {
161
168
  /**
162
169
  * @dev If tokenAddress + chain do not exist in TOKEN_SYMBOLS_MAP then this will throw.
163
170
  * @param tokenAddress Token address on `chain`
164
- * @param chain Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
171
+ * @param chainId Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
165
172
  * @returns Token info for the given token address on the L2 chain including symbol and decimal.
166
173
  */
167
- HubPoolClient.prototype.getTokenInfoForAddress = function (tokenAddress, chain) {
174
+ // TODO: didn't change `tokenAddress` here to Address because of downstream getTokenInfo impl
175
+ HubPoolClient.prototype.getTokenInfoForAddress = function (tokenAddress, chainId) {
168
176
  var _a;
169
- var tokenInfo = getTokenInfo(tokenAddress, chain);
177
+ var tokenInfo = getTokenInfo(tokenAddress, chainId);
170
178
  // @dev Temporarily handle case where an L2 token for chain ID can map to more than one TOKEN_SYMBOLS_MAP
171
179
  // entry. For example, L2 Bridged USDC maps to both the USDC and USDC.e/USDbC entries in TOKEN_SYMBOLS_MAP.
172
- if (tokenInfo.symbol.toLowerCase() === "usdc" && chain !== this.chainId) {
173
- tokenInfo.symbol = (_a = getUsdcSymbol(tokenAddress, chain)) !== null && _a !== void 0 ? _a : "UNKNOWN";
180
+ if (tokenInfo.symbol.toLowerCase() === "usdc" && chainId !== this.chainId) {
181
+ tokenInfo.symbol = (_a = getUsdcSymbol(tokenAddress, chainId)) !== null && _a !== void 0 ? _a : "UNKNOWN";
174
182
  }
175
183
  return tokenInfo;
176
184
  };
@@ -262,11 +270,11 @@ var HubPoolClient = /** @class */ (function (_super) {
262
270
  case 0:
263
271
  overrides = { blockTag: blockNumber };
264
272
  if (!depositAmount.eq(0)) return [3 /*break*/, 2];
265
- return [4 /*yield*/, this.hubPool.callStatic.liquidityUtilizationCurrent(hubPoolToken, overrides)];
273
+ return [4 /*yield*/, this.hubPool.callStatic.liquidityUtilizationCurrent(hubPoolToken.toEvmAddress(), overrides)];
266
274
  case 1:
267
275
  // For zero amount, just get the utilisation at `blockNumber`.
268
276
  return [2 /*return*/, _a.sent()];
269
- case 2: return [4 /*yield*/, this.hubPool.callStatic.liquidityUtilizationPostRelay(hubPoolToken, depositAmount, overrides)];
277
+ case 2: return [4 /*yield*/, this.hubPool.callStatic.liquidityUtilizationPostRelay(hubPoolToken.toEvmAddress(), depositAmount, overrides)];
270
278
  case 3: return [2 /*return*/, _a.sent()];
271
279
  }
272
280
  });
@@ -277,8 +285,8 @@ var HubPoolClient = /** @class */ (function (_super) {
277
285
  return [2 /*return*/, resolver()];
278
286
  }
279
287
  key = depositAmount.eq(0)
280
- ? "utilization_".concat(hubPoolToken, "_").concat(blockNumber)
281
- : "utilization_".concat(hubPoolToken, "_").concat(blockNumber, "_").concat(depositAmount.toString(), "_");
288
+ ? "utilization_".concat(hubPoolToken.toEvmAddress(), "_").concat(blockNumber)
289
+ : "utilization_".concat(hubPoolToken.toEvmAddress(), "_").concat(blockNumber, "_").concat(depositAmount.toString(), "_");
282
290
  return [4 /*yield*/, cache.get(key)];
283
291
  case 1:
284
292
  result = _a.sent();
@@ -341,6 +349,7 @@ var HubPoolClient = /** @class */ (function (_super) {
341
349
  getHubPoolTokens = function () { return dedupArray(Object.values(hubPoolTokens).filter(isDefined)); };
342
350
  resolveUniqueQuoteTimestamps = function (deposit) {
343
351
  var _a;
352
+ var _b;
344
353
  var quoteTimestamp = deposit.quoteTimestamp;
345
354
  // Resolve the HubPool token address for this origin chainId/token pair, if it isn't already known.
346
355
  var quoteBlockNumber = quoteBlocks[quoteTimestamp];
@@ -349,9 +358,9 @@ var HubPoolClient = /** @class */ (function (_super) {
349
358
  return;
350
359
  }
351
360
  // Append the quoteTimestamp for this HubPool token, if it isn't already enqueued.
352
- (_a = utilizationTimestamps[hubPoolToken]) !== null && _a !== void 0 ? _a : (utilizationTimestamps[hubPoolToken] = []);
353
- if (!utilizationTimestamps[hubPoolToken].includes(quoteTimestamp)) {
354
- utilizationTimestamps[hubPoolToken].push(quoteTimestamp);
361
+ (_a = utilizationTimestamps[_b = hubPoolToken.toEvmAddress()]) !== null && _a !== void 0 ? _a : (utilizationTimestamps[_b] = []);
362
+ if (!utilizationTimestamps[hubPoolToken.toEvmAddress()].includes(quoteTimestamp)) {
363
+ utilizationTimestamps[hubPoolToken.toEvmAddress()].push(quoteTimestamp);
355
364
  }
356
365
  };
357
366
  resolveUtilization = function (hubPoolToken) { return __awaiter(_this, void 0, void 0, function () {
@@ -361,7 +370,7 @@ var HubPoolClient = /** @class */ (function (_super) {
361
370
  switch (_c.label) {
362
371
  case 0:
363
372
  _b = (_a = Object).fromEntries;
364
- return [4 /*yield*/, mapAsync(utilizationTimestamps[hubPoolToken], function (quoteTimestamp) { return __awaiter(_this, void 0, void 0, function () {
373
+ return [4 /*yield*/, mapAsync(utilizationTimestamps[hubPoolToken.toEvmAddress()], function (quoteTimestamp) { return __awaiter(_this, void 0, void 0, function () {
365
374
  var blockNumber, utilization;
366
375
  return __generator(this, function (_a) {
367
376
  switch (_a.label) {
@@ -394,7 +403,7 @@ var HubPoolClient = /** @class */ (function (_super) {
394
403
  throw new Error("Cannot computeRealizedLpFeePct for deposit with no pool rebalance route for input token ".concat(deposit.inputToken, " on ").concat(originChainId));
395
404
  }
396
405
  rateModel = this.configStoreClient.getRateModelForBlockNumber(hubPoolToken, originChainId, paymentChainId, quoteBlock);
397
- preUtilization = utilization[hubPoolToken][quoteBlock];
406
+ preUtilization = utilization[hubPoolToken.toEvmAddress()][quoteBlock];
398
407
  return [4 /*yield*/, this.getUtilization(hubPoolToken, quoteBlock, inputAmount, quoteTimestamp, timeToCache)];
399
408
  case 1:
400
409
  postUtilization = _a.sent();
@@ -414,14 +423,19 @@ var HubPoolClient = /** @class */ (function (_super) {
414
423
  // Identify the unique hubPoolToken & quoteTimestamp mappings. This is used to optimise subsequent HubPool queries.
415
424
  deposits.forEach(function (deposit) { return resolveUniqueQuoteTimestamps(deposit); });
416
425
  _c = (_b = Object).fromEntries;
417
- return [4 /*yield*/, mapAsync(getHubPoolTokens(), function (hubPoolToken) { return __awaiter(_this, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
418
- switch (_b.label) {
419
- case 0:
420
- _a = [hubPoolToken];
421
- return [4 /*yield*/, resolveUtilization(hubPoolToken)];
422
- case 1: return [2 /*return*/, _a.concat([_b.sent()])];
423
- }
424
- }); }); })];
426
+ return [4 /*yield*/, mapAsync(getHubPoolTokens(), function (hubPoolToken) { return __awaiter(_this, void 0, void 0, function () {
427
+ var _a;
428
+ return __generator(this, function (_b) {
429
+ switch (_b.label) {
430
+ case 0:
431
+ _a = [hubPoolToken.toEvmAddress()];
432
+ return [4 /*yield*/, resolveUtilization(hubPoolToken)];
433
+ case 1: return [2 /*return*/, _a.concat([
434
+ _b.sent()
435
+ ])];
436
+ }
437
+ });
438
+ }); })];
425
439
  case 2:
426
440
  // For each token / quoteBlock pair, resolve the utilisation for each quoted block.
427
441
  // This can be reused for each deposit with the same HubPool token and quoteTimestamp pair.
@@ -454,10 +468,10 @@ var HubPoolClient = /** @class */ (function (_super) {
454
468
  return this.l1Tokens;
455
469
  };
456
470
  HubPoolClient.prototype.getTokenInfoForL1Token = function (l1Token) {
457
- return this.l1Tokens.find(function (token) { return token.address === l1Token; });
471
+ return this.l1Tokens.find(function (token) { return token.address.eq(l1Token); });
458
472
  };
459
473
  HubPoolClient.prototype.getLpTokenInfoForL1Token = function (l1Token) {
460
- return this.lpTokens[l1Token];
474
+ return this.lpTokens[l1Token.toEvmAddress()];
461
475
  };
462
476
  HubPoolClient.prototype.areTokensEquivalent = function (tokenA, chainIdA, tokenB, chainIdB, hubPoolBlock) {
463
477
  if (hubPoolBlock === void 0) { hubPoolBlock = this.latestHeightSearched; }
@@ -468,13 +482,13 @@ var HubPoolClient = /** @class */ (function (_super) {
468
482
  // Resolve both SpokePool tokens back to their respective HubPool tokens and verify that they match.
469
483
  var l1TokenA = this.getL1TokenForL2TokenAtBlock(tokenA, chainIdA, hubPoolBlock);
470
484
  var l1TokenB = this.getL1TokenForL2TokenAtBlock(tokenB, chainIdB, hubPoolBlock);
471
- if (l1TokenA !== l1TokenB) {
485
+ if (!l1TokenA.eq(l1TokenB)) {
472
486
  return false;
473
487
  }
474
488
  // Resolve both HubPool tokens back to a current SpokePool token and verify that they match.
475
489
  var _tokenA = this.getL2TokenForL1TokenAtBlock(l1TokenA, chainIdA, hubPoolBlock);
476
490
  var _tokenB = this.getL2TokenForL1TokenAtBlock(l1TokenB, chainIdB, hubPoolBlock);
477
- return tokenA === _tokenA && tokenB === _tokenB;
491
+ return tokenA.eq(_tokenA) && tokenB.eq(_tokenB);
478
492
  };
479
493
  HubPoolClient.prototype.getSpokeActivationBlockForChain = function (chainId) {
480
494
  var _a;
@@ -661,7 +675,7 @@ var HubPoolClient = /** @class */ (function (_super) {
661
675
  return sortEventsDescending(this.executedRootBundles).find(function (executedLeaf) {
662
676
  return (executedLeaf.blockNumber <= block &&
663
677
  executedLeaf.chainId === chain &&
664
- executedLeaf.l1Tokens.some(function (token) { return token.toLowerCase() === l1Token.toLowerCase(); }));
678
+ executedLeaf.l1Tokens.some(function (token) { return token.eq(l1Token); }));
665
679
  });
666
680
  };
667
681
  HubPoolClient.prototype.getRunningBalanceBeforeBlockForChain = function (block, chain, l1Token) {
@@ -671,10 +685,10 @@ var HubPoolClient = /** @class */ (function (_super) {
671
685
  HubPoolClient.prototype.getRunningBalanceForToken = function (l1Token, executedRootBundle) {
672
686
  var runningBalance = toBN(0);
673
687
  if (executedRootBundle) {
674
- var indexOfL1Token = executedRootBundle.l1Tokens
675
- .map(function (l1Token) { return l1Token.toLowerCase(); })
676
- .indexOf(l1Token.toLowerCase());
677
- runningBalance = executedRootBundle.runningBalances[indexOfL1Token];
688
+ var indexOfL1Token = executedRootBundle.l1Tokens.findIndex(function (tokenInBundle) { return tokenInBundle.eq(l1Token); });
689
+ if (indexOfL1Token !== -1) {
690
+ runningBalance = executedRootBundle.runningBalances[indexOfL1Token];
691
+ }
678
692
  }
679
693
  return { runningBalance: runningBalance };
680
694
  };
@@ -738,7 +752,7 @@ var HubPoolClient = /** @class */ (function (_super) {
738
752
  return [2 /*return*/, {
739
753
  success: true,
740
754
  currentTime: currentTime,
741
- pendingRootBundleProposal: pendingRootBundleProposal,
755
+ pendingRootBundleProposal: __assign(__assign({}, pendingRootBundleProposal), { proposer: toAddressType(pendingRootBundleProposal.proposer, this.chainId) }),
742
756
  searchEndBlock: searchConfig.to,
743
757
  events: _events,
744
758
  }];
@@ -749,7 +763,7 @@ var HubPoolClient = /** @class */ (function (_super) {
749
763
  HubPoolClient.prototype.update = function (eventsToQuery) {
750
764
  if (eventsToQuery === void 0) { eventsToQuery = Object.keys(this.hubPoolEventFilters()); }
751
765
  return __awaiter(this, void 0, void 0, function () {
752
- var update, events, currentTime, pendingRootBundleProposal, searchEndBlock, _i, _a, event_1, args, dataToAdd, solanaSpokePool, truncatedAddress, _b, _c, event_2, args, destinationToken, usdcTokenSol, truncatedAddress, uniqueL1Tokens, _d, tokenInfo, lpTokenInfo_1, _loop_1, this_1, _e, tokenInfo_1, info, _f, _g, event_3, executedRootBundle, l1Tokens, runningBalances, nTokens, mostRecentProposedRootBundle;
766
+ var update, events, currentTime, pendingRootBundleProposal, searchEndBlock, _i, _a, event_1, args, dataToAdd, solanaSpokePool, svmSpoke, truncatedAddress, _b, _c, event_2, args, destinationToken, usdcTokenSol, svmUsdc, uniqueL1Tokens, _d, tokenInfo, lpTokenInfo_1, _loop_1, this_1, _e, tokenInfo_1, info, _f, _g, event_3, executedRootBundle, l1Tokens, runningBalances, nTokens, mostRecentProposedRootBundle;
753
767
  var _h, _j, _k;
754
768
  var _this = this;
755
769
  return __generator(this, function (_l) {
@@ -774,7 +788,7 @@ var HubPoolClient = /** @class */ (function (_super) {
774
788
  event_1 = _a[_i];
775
789
  args = spreadEventWithBlockNumber(event_1);
776
790
  dataToAdd = {
777
- spokePool: args.spokePool,
791
+ spokePool: toAddressType(args.spokePool, this.chainId),
778
792
  blockNumber: args.blockNumber,
779
793
  txnRef: args.txnRef,
780
794
  logIndex: args.logIndex,
@@ -790,14 +804,14 @@ var HubPoolClient = /** @class */ (function (_super) {
790
804
  if (!solanaSpokePool) {
791
805
  throw new Error("SVM spoke pool not found for chain ".concat(args.l2ChainId));
792
806
  }
793
- truncatedAddress = SvmAddress.from(solanaSpokePool).truncateToBytes20();
807
+ svmSpoke = SvmAddress.from(solanaSpokePool);
808
+ truncatedAddress = svmSpoke.truncateToBytes20();
794
809
  // Verify the event address matches our expected truncated address
795
810
  if (args.spokePool.toLowerCase() !== truncatedAddress.toLowerCase()) {
796
811
  throw new Error("SVM spoke pool address mismatch for chain ".concat(args.l2ChainId, ". ") +
797
812
  "Expected ".concat(truncatedAddress, ", got ").concat(args.spokePool));
798
813
  }
799
- // Store the full Solana address
800
- dataToAdd.spokePool = SvmAddress.from(solanaSpokePool).toBytes32();
814
+ dataToAdd.spokePool = svmSpoke;
801
815
  }
802
816
  assign(this.crossChainContracts, [args.l2ChainId], [dataToAdd]);
803
817
  }
@@ -806,23 +820,23 @@ var HubPoolClient = /** @class */ (function (_super) {
806
820
  for (_b = 0, _c = events["SetPoolRebalanceRoute"]; _b < _c.length; _b++) {
807
821
  event_2 = _c[_b];
808
822
  args = spreadEventWithBlockNumber(event_2);
809
- destinationToken = args.destinationToken;
823
+ destinationToken = toAddressType(args.destinationToken, this.chainId);
810
824
  if (chainIsSvm(args.destinationChainId)) {
811
825
  usdcTokenSol = TOKEN_SYMBOLS_MAP.USDC.addresses[args.destinationChainId];
812
- truncatedAddress = SvmAddress.from(usdcTokenSol).truncateToBytes20();
813
- if (destinationToken.toLowerCase() !== truncatedAddress.toLowerCase()) {
826
+ svmUsdc = SvmAddress.from(usdcTokenSol);
827
+ if (destinationToken.truncateToBytes20() !== svmUsdc.truncateToBytes20()) {
814
828
  throw new Error("SVM USDC address mismatch for chain ".concat(args.destinationChainId, ". ") +
815
- "Expected ".concat(truncatedAddress, ", got ").concat(destinationToken));
829
+ "Expected ".concat(svmUsdc.truncateToBytes20(), ", got ").concat(destinationToken));
816
830
  }
817
- destinationToken = SvmAddress.from(usdcTokenSol).toBytes32();
831
+ destinationToken = svmUsdc;
818
832
  }
819
833
  // If the destination token is set to the zero address in an event, then this means Across should no longer
820
834
  // rebalance to this chain.
821
- if (destinationToken !== ZERO_ADDRESS) {
835
+ if (!destinationToken.isZeroAddress()) {
822
836
  assign(this.l1TokensToDestinationTokens, [args.l1Token, args.destinationChainId], destinationToken);
823
837
  assign(this.l1TokensToDestinationTokensWithBlock, [args.l1Token, args.destinationChainId], [
824
838
  {
825
- l1Token: args.l1Token,
839
+ l1Token: toAddressType(args.l1Token, this.chainId),
826
840
  l2Token: destinationToken,
827
841
  blockNumber: args.blockNumber,
828
842
  txnIndex: args.txnIndex,
@@ -836,7 +850,17 @@ var HubPoolClient = /** @class */ (function (_super) {
836
850
  if (!eventsToQuery.includes("L1TokenEnabledForLiquidityProvision")) return [3 /*break*/, 3];
837
851
  uniqueL1Tokens = dedupArray(events["L1TokenEnabledForLiquidityProvision"].map(function (event) { return String(event.args["l1Token"]); }));
838
852
  return [4 /*yield*/, Promise.all([
839
- Promise.all(uniqueL1Tokens.map(function (l1Token) { return fetchTokenInfo(l1Token, _this.hubPool.provider); })),
853
+ Promise.all(uniqueL1Tokens.map(function (l1Token) { return __awaiter(_this, void 0, void 0, function () {
854
+ var tokenInfo;
855
+ return __generator(this, function (_a) {
856
+ switch (_a.label) {
857
+ case 0: return [4 /*yield*/, fetchTokenInfo(l1Token, this.hubPool.provider)];
858
+ case 1:
859
+ tokenInfo = _a.sent();
860
+ return [2 /*return*/, __assign(__assign({}, tokenInfo), { address: EvmAddress.from(l1Token) })];
861
+ }
862
+ });
863
+ }); })),
840
864
  Promise.all(uniqueL1Tokens.map(function (l1Token) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
841
865
  switch (_a.label) {
842
866
  case 0: return [4 /*yield*/, this.hubPool.pooledTokens(l1Token, { blockTag: update.searchEndBlock })];
@@ -847,7 +871,7 @@ var HubPoolClient = /** @class */ (function (_super) {
847
871
  case 2:
848
872
  _d = _l.sent(), tokenInfo = _d[0], lpTokenInfo_1 = _d[1];
849
873
  _loop_1 = function (info) {
850
- if (!this_1.l1Tokens.find(function (token) { return compareAddressesSimple(token.address, info.address); })) {
874
+ if (!this_1.l1Tokens.find(function (token) { return token.address.eq(info.address); })) {
851
875
  if (info.decimals > 0 && info.decimals <= 18) {
852
876
  this_1.l1Tokens.push(info);
853
877
  }
@@ -872,7 +896,10 @@ var HubPoolClient = /** @class */ (function (_super) {
872
896
  if (eventsToQuery.includes("ProposeRootBundle")) {
873
897
  (_h = this.proposedRootBundles).push.apply(_h, events["ProposeRootBundle"]
874
898
  .filter(function (event) { return !_this.configOverride.ignoredHubProposedBundles.includes(event.blockNumber); })
875
- .map(function (event) { return spreadEventWithBlockNumber(event); }));
899
+ .map(function (_event) {
900
+ var args = spreadEventWithBlockNumber(_event);
901
+ return __assign(__assign({}, args), { proposer: EvmAddress.from(args.proposer) });
902
+ }));
876
903
  }
877
904
  if (eventsToQuery.includes("RootBundleCanceled")) {
878
905
  (_j = this.canceledRootBundles).push.apply(_j, events["RootBundleCanceled"].map(function (event) { return spreadEventWithBlockNumber(event); }));
@@ -895,7 +922,9 @@ var HubPoolClient = /** @class */ (function (_super) {
895
922
  " Expected ".concat(nTokens, " or ").concat(nTokens * 2, " for chain ").concat(this.chainId, " transaction ").concat(event_3.transactionHash));
896
923
  }
897
924
  executedRootBundle.runningBalances = runningBalances.slice(0, nTokens);
898
- this.executedRootBundles.push(executedRootBundle);
925
+ this.executedRootBundles.push(__assign(__assign({}, executedRootBundle), { l1Tokens: l1Tokens.map(function (token) {
926
+ return EvmAddress.from(token, "base16");
927
+ }) }));
899
928
  }
900
929
  }
901
930
  // If the contract's current rootBundleProposal() value has an unclaimedPoolRebalanceLeafCount > 0, then