@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,9 +1,9 @@
1
1
  import { BlockTag } from "@ethersproject/abstract-provider";
2
2
  import { providers, Signer } from "ethers";
3
- import { L1Token } from "../interfaces";
3
+ import { TokenInfo } from "../interfaces";
4
4
  import { BigNumber } from "./BigNumberUtils";
5
5
  type SignerOrProvider = providers.Provider | Signer;
6
- export declare function fetchTokenInfo(address: string, signerOrProvider: SignerOrProvider): Promise<L1Token>;
6
+ export declare function fetchTokenInfo(address: string, signerOrProvider: SignerOrProvider): Promise<TokenInfo>;
7
7
  export declare const getL2TokenAddresses: (l1TokenAddress: string, l1ChainId?: number) => {
8
8
  [chainId: number]: string;
9
9
  } | undefined;
@@ -14,7 +14,7 @@ export declare const getL2TokenAddresses: (l1TokenAddress: string, l1ChainId?: n
14
14
  * @param chainId Chain ID to query on.
15
15
  * @returns Symbol, decimals and contract address on the requested chain.
16
16
  */
17
- export declare function resolveSymbolOnChain(chainId: number, symbol: string): L1Token;
17
+ export declare function resolveSymbolOnChain(chainId: number, symbol: string): TokenInfo;
18
18
  /**
19
19
  * Returns the contract address for a given token symbol and chainId.
20
20
  * @param symbol A case-insensitive token symbol.
@@ -124,13 +124,7 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
124
124
  };
125
125
  GHO: {
126
126
  name: string;
127
- symbol: string; /**
128
- * Returns the contract address for a given token symbol and chainId.
129
- * @param symbol A case-insensitive token symbol.
130
- * @param chainId The chainId to resolve the contract address for.
131
- * @param tokenMapping A parameter to determine where to source token information. Defaults to the constants variant.
132
- * @returns The contract address for the given token symbol and chainId, or undefined if the token symbol is not supported.
133
- */
127
+ symbol: string;
134
128
  decimals: number;
135
129
  addresses: {
136
130
  [x: number]: string;
@@ -191,6 +185,14 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
191
185
  };
192
186
  coingeckoId: string;
193
187
  };
188
+ /**
189
+ * Retrieves the ERC20 balance for a given address and token address.
190
+ * @param address The address to retrieve the balance for.
191
+ * @param tokenAddress The token address
192
+ * @param signerOrProvider A valid ethers.js Signer or Provider object.
193
+ * @param blockTag The block tag to retrieve the balance at.
194
+ * @returns The balance of the given address for the given token address.
195
+ */
194
196
  SOL: {
195
197
  name: string;
196
198
  symbol: string;
@@ -545,13 +547,7 @@ export declare function getTokenInfo(l2TokenAddress: string, chainId: number, to
545
547
  };
546
548
  GHO: {
547
549
  name: string;
548
- symbol: string; /**
549
- * Returns the contract address for a given token symbol and chainId.
550
- * @param symbol A case-insensitive token symbol.
551
- * @param chainId The chainId to resolve the contract address for.
552
- * @param tokenMapping A parameter to determine where to source token information. Defaults to the constants variant.
553
- * @returns The contract address for the given token symbol and chainId, or undefined if the token symbol is not supported.
554
- */
550
+ symbol: string;
555
551
  decimals: number;
556
552
  addresses: {
557
553
  [x: number]: string;
@@ -612,6 +608,14 @@ export declare function getTokenInfo(l2TokenAddress: string, chainId: number, to
612
608
  };
613
609
  coingeckoId: string;
614
610
  };
611
+ /**
612
+ * Retrieves the ERC20 balance for a given address and token address.
613
+ * @param address The address to retrieve the balance for.
614
+ * @param tokenAddress The token address
615
+ * @param signerOrProvider A valid ethers.js Signer or Provider object.
616
+ * @param blockTag The block tag to retrieve the balance at.
617
+ * @returns The balance of the given address for the given token address.
618
+ */
615
619
  SOL: {
616
620
  name: string;
617
621
  symbol: string;
@@ -842,7 +846,7 @@ export declare function getTokenInfo(l2TokenAddress: string, chainId: number, to
842
846
  };
843
847
  coingeckoId: string;
844
848
  };
845
- }): L1Token;
849
+ }): TokenInfo;
846
850
  /**
847
851
  * Get the USDC symbol for the given token address and chain ID.
848
852
  * @param l2Token A Web3 token address (not case sensitive)
@@ -1 +1 @@
1
- {"version":3,"file":"TokenUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/TokenUtils.ts"],"names":[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
4
+ "version": "4.3.0",
5
5
  "license": "AGPL-3.0",
6
6
  "homepage": "https://docs.across.to/reference/sdk",
7
7
  "files": [
@@ -111,7 +111,6 @@
111
111
  "@ethersproject/bignumber": "^5.7.0",
112
112
  "@pinata/sdk": "^2.1.0",
113
113
  "@solana-program/system": "^0.7.0",
114
- "@solana-program/token": "^0.5.1",
115
114
  "@solana-program/token-2022": "^0.4.0",
116
115
  "@solana/kit": "^2.1.0",
117
116
  "@solana/web3.js": "^1.31.0",
@@ -1,10 +1,18 @@
1
1
  import assert from "assert";
2
2
  import { BytesLike, Contract, PopulatedTransaction, providers } from "ethers";
3
3
  import { CHAIN_IDs } from "../../constants";
4
- import { Deposit, FillStatus, FillWithBlock, RelayData } from "../../interfaces";
4
+ import {
5
+ Deposit,
6
+ FillStatus,
7
+ FillWithBlock,
8
+ RelayData,
9
+ RelayExecutionEventInfo,
10
+ SpeedUpCommon,
11
+ } from "../../interfaces";
5
12
  import {
6
13
  bnUint32Max,
7
14
  BigNumber,
15
+ EvmAddress,
8
16
  toBN,
9
17
  bnZero,
10
18
  chunk,
@@ -12,47 +20,70 @@ import {
12
20
  getRelayDataHash,
13
21
  isDefined,
14
22
  isUnsafeDepositId,
15
- isZeroAddress,
16
- getDepositRelayData,
17
23
  getNetworkName,
18
24
  paginatedEventQuery,
19
25
  spreadEventWithBlockNumber,
20
- toBytes32,
26
+ Address,
27
+ toAddressType,
21
28
  } from "../../utils";
22
29
 
23
30
  type BlockTag = providers.BlockTag;
24
31
 
32
+ type ProtoFill = Omit<RelayData, "recipient" | "outputToken"> &
33
+ Pick<Deposit, "speedUpSignature"> &
34
+ Partial<SpeedUpCommon> & {
35
+ destinationChainId: number;
36
+ recipient: EvmAddress;
37
+ outputToken: EvmAddress;
38
+ };
39
+
25
40
  /**
26
41
  * @param spokePool SpokePool Contract instance.
27
- * @param deposit V3Deopsit instance.
42
+ * @param relayData RelayData instance, supplemented with destinationChainId
28
43
  * @param repaymentChainId Optional repaymentChainId (defaults to destinationChainId).
29
44
  * @returns An Ethers UnsignedTransaction instance.
30
45
  */
31
46
  export function populateV3Relay(
32
47
  spokePool: Contract,
33
- deposit: Omit<Deposit, "messageHash">,
34
- relayer: string,
35
- repaymentChainId = deposit.destinationChainId
48
+ relayData: ProtoFill,
49
+ repaymentAddress: Address,
50
+ repaymentChainId = relayData.destinationChainId
36
51
  ): Promise<PopulatedTransaction> {
37
- const relayData = getDepositRelayData(deposit);
38
-
39
- if (isDefined(deposit.speedUpSignature)) {
40
- assert(isDefined(deposit.updatedRecipient) && !isZeroAddress(deposit.updatedRecipient));
41
- assert(isDefined(deposit.updatedOutputAmount));
42
- assert(isDefined(deposit.updatedMessage));
52
+ assert(
53
+ repaymentAddress.isValidOn(repaymentChainId),
54
+ `Invalid repayment address for chain ${repaymentChainId}: ${repaymentAddress.toNative()}.`
55
+ );
56
+ const evmRelayData = {
57
+ depositor: relayData.depositor.toBytes32(),
58
+ recipient: relayData.recipient.toBytes32(),
59
+ inputToken: relayData.inputToken.toBytes32(),
60
+ outputToken: relayData.outputToken.toBytes32(),
61
+ inputAmount: relayData.inputAmount,
62
+ outputAmount: relayData.outputAmount,
63
+ originChainId: relayData.originChainId,
64
+ depositId: relayData.depositId,
65
+ fillDeadline: relayData.fillDeadline,
66
+ exclusivityDeadline: relayData.exclusivityDeadline,
67
+ message: relayData.message,
68
+ exclusiveRelayer: relayData.exclusiveRelayer.toBytes32(),
69
+ };
70
+
71
+ if (isDefined(relayData.speedUpSignature)) {
72
+ assert(isDefined(relayData.updatedRecipient) && !relayData.updatedRecipient.isZeroAddress());
73
+ assert(isDefined(relayData.updatedOutputAmount));
74
+ assert(isDefined(relayData.updatedMessage));
43
75
  return spokePool.populateTransaction.fillRelayWithUpdatedDeposit(
44
76
  relayData,
45
77
  repaymentChainId,
46
- toBytes32(relayer),
47
- deposit.updatedOutputAmount,
48
- toBytes32(deposit.updatedRecipient),
49
- deposit.updatedMessage,
50
- deposit.speedUpSignature,
51
- { from: relayer }
78
+ repaymentAddress.toBytes32(),
79
+ relayData.updatedOutputAmount,
80
+ relayData.updatedRecipient.toBytes32(),
81
+ relayData.updatedMessage,
82
+ relayData.speedUpSignature
52
83
  );
53
84
  }
54
85
 
55
- return spokePool.populateTransaction.fillRelay(relayData, repaymentChainId, toBytes32(relayer), { from: relayer });
86
+ return spokePool.populateTransaction.fillRelay(evmRelayData, repaymentChainId, repaymentAddress.toBytes32());
56
87
  }
57
88
 
58
89
  /**
@@ -315,8 +346,27 @@ export async function findFillEvent(
315
346
  const destinationChainId = Object.values(CHAIN_IDs).includes(relayData.originChainId)
316
347
  ? (await spokePool.provider.getNetwork()).chainId
317
348
  : Number(await spokePool.chainId());
349
+ const fillEvent = spreadEventWithBlockNumber(event) as FillWithBlock & {
350
+ depositor: string;
351
+ recipient: string;
352
+ inputToken: string;
353
+ outputToken: string;
354
+ exclusiveRelayer: string;
355
+ relayer: string;
356
+ relayExecutionInfo: RelayExecutionEventInfo & { updatedRecipient: string };
357
+ };
318
358
  const fill = {
319
- ...spreadEventWithBlockNumber(event),
359
+ ...fillEvent,
360
+ inputToken: toAddressType(fillEvent.inputToken, relayData.originChainId),
361
+ outputToken: toAddressType(fillEvent.outputToken, destinationChainId),
362
+ depositor: toAddressType(fillEvent.depositor, relayData.originChainId),
363
+ recipient: toAddressType(fillEvent.recipient, destinationChainId),
364
+ exclusiveRelayer: toAddressType(fillEvent.exclusiveRelayer, destinationChainId),
365
+ relayer: toAddressType(fillEvent.relayer, destinationChainId),
366
+ relayExecutionInfo: {
367
+ ...fillEvent.relayExecutionInfo,
368
+ updatedRecipient: toAddressType(fillEvent.relayExecutionInfo.updatedRecipient, destinationChainId),
369
+ },
320
370
  destinationChainId,
321
371
  messageHash: getMessageHash(event.args.message),
322
372
  } as FillWithBlock;
@@ -24,13 +24,13 @@ import {
24
24
  import assert from "assert";
25
25
  import { arrayify, hexZeroPad, hexlify } from "ethers/lib/utils";
26
26
  import { Logger } from "winston";
27
-
28
27
  import { SYSTEM_PROGRAM_ADDRESS } from "@solana-program/system";
29
- import { Deposit, DepositWithBlock, FillStatus, FillWithBlock, RelayData } from "../../interfaces";
28
+ import { DepositWithBlock, FillStatus, FillWithBlock, RelayData, RelayExecutionEventInfo } from "../../interfaces";
30
29
  import {
31
30
  BigNumber,
32
31
  EvmAddress,
33
32
  SvmAddress,
33
+ Address as SdkAddress,
34
34
  chainIsSvm,
35
35
  chunk,
36
36
  isUnsafeDepositId,
@@ -46,6 +46,7 @@ import {
46
46
  toAddress,
47
47
  unwrapEventData,
48
48
  } from "./";
49
+ import { CHAIN_IDs } from "../../constants";
49
50
  import { SVMEventNames, SVMProvider } from "./types";
50
51
 
51
52
  /**
@@ -54,6 +55,12 @@ import { SVMEventNames, SVMProvider } from "./types";
54
55
  */
55
56
  export const SLOT_DURATION_MS = 400;
56
57
 
58
+ type ProtoFill = Omit<RelayData, "recipient" | "outputToken"> & {
59
+ destinationChainId: number;
60
+ recipient: SvmAddress;
61
+ outputToken: SvmAddress;
62
+ };
63
+
57
64
  /**
58
65
  * Retrieves the chain time at a particular slot.
59
66
  */
@@ -145,13 +152,20 @@ export async function findDeposit(
145
152
  return undefined;
146
153
  }
147
154
 
155
+ const unwrappedDepositEvent = unwrapEventData(depositEvent.data) as Record<string, unknown>;
156
+ const destinationChainId = unwrappedDepositEvent.destinationChainId as number;
148
157
  // Return the deposit event with block info
149
158
  return {
150
159
  txnRef: depositEvent.signature.toString(),
151
160
  blockNumber: Number(depositEvent.slot),
152
161
  txnIndex: 0,
153
162
  logIndex: 0,
154
- ...(unwrapEventData(depositEvent.data) as Record<string, unknown>),
163
+ ...unwrappedDepositEvent,
164
+ depositor: toAddressType(unwrappedDepositEvent.depositor as string, CHAIN_IDs.SOLANA),
165
+ recipient: toAddressType(unwrappedDepositEvent.recipient as string, destinationChainId),
166
+ inputToken: toAddressType(unwrappedDepositEvent.inputToken as string, CHAIN_IDs.SOLANA),
167
+ outputToken: toAddressType(unwrappedDepositEvent.outputToken as string, destinationChainId),
168
+ exclusiveRelayer: toAddressType(unwrappedDepositEvent.exclusiveRelayer as string, destinationChainId),
155
169
  } as DepositWithBlock;
156
170
  }
157
171
 
@@ -327,14 +341,34 @@ export async function findFillEvent(
327
341
 
328
342
  if (fillEvents.length > 0) {
329
343
  const rawFillEvent = fillEvents[0];
344
+ const eventData = unwrapEventData(rawFillEvent.data) as FillWithBlock & {
345
+ depositor: string;
346
+ recipient: string;
347
+ inputToken: string;
348
+ outputToken: string;
349
+ exclusiveRelayer: string;
350
+ relayer: string;
351
+ relayExecutionInfo: RelayExecutionEventInfo & { updatedRecipient: string };
352
+ };
353
+ const originChainId = eventData.originChainId;
330
354
  const parsedFillEvent = {
355
+ ...eventData,
331
356
  transactionHash: rawFillEvent.signature,
332
357
  blockNumber: Number(rawFillEvent.slot),
333
358
  transactionIndex: 0,
334
359
  logIndex: 0,
335
360
  destinationChainId,
336
- ...(unwrapEventData(rawFillEvent.data) as Record<string, unknown>),
337
- } as unknown as FillWithBlock;
361
+ inputToken: toAddressType(eventData.inputToken, originChainId),
362
+ outputToken: toAddressType(eventData.outputToken, destinationChainId),
363
+ relayer: toAddressType(eventData.relayer, destinationChainId),
364
+ exclusiveRelayer: toAddressType(eventData.exclusiveRelayer, destinationChainId),
365
+ depositor: toAddressType(eventData.depositor, originChainId),
366
+ recipient: toAddressType(eventData.recipient, destinationChainId),
367
+ relayExecutionInfo: {
368
+ ...eventData.relayExecutionInfo,
369
+ updatedRecipient: eventData.relayExecutionInfo.updatedRecipient,
370
+ },
371
+ } as FillWithBlock;
338
372
  return parsedFillEvent;
339
373
  }
340
374
 
@@ -343,18 +377,18 @@ export async function findFillEvent(
343
377
 
344
378
  /**
345
379
  * @param spokePool Address (program ID) of the SvmSpoke.
346
- * @param deposit V3Deopsit instance.
380
+ * @param relayData RelayData instance, supplemented with destinationChainId
347
381
  * @param relayer Address of the relayer filling the deposit.
348
382
  * @param repaymentChainId Optional repaymentChainId (defaults to destinationChainId).
349
383
  * @returns An Ethers UnsignedTransaction instance.
350
384
  */
351
385
  export async function fillRelayInstruction(
352
386
  spokePool: SvmAddress,
353
- deposit: Omit<Deposit, "messageHash" | "fromLiteChain" | "toLiteChain">,
387
+ relayData: ProtoFill,
354
388
  signer: TransactionSigner<string>,
355
389
  recipientTokenAccount: Address<string>,
356
390
  repaymentAddress: EvmAddress | SvmAddress = SvmAddress.from(signer.address),
357
- repaymentChainId = deposit.destinationChainId
391
+ repaymentChainId = relayData.destinationChainId
358
392
  ) {
359
393
  const program = toAddress(spokePool);
360
394
 
@@ -363,25 +397,22 @@ export async function fillRelayInstruction(
363
397
  `Invalid repayment address for chain ${repaymentChainId}: ${repaymentAddress.toNative()}.`
364
398
  );
365
399
 
366
- const _relayDataHash = getRelayDataHash(deposit, deposit.destinationChainId);
400
+ const _relayDataHash = getRelayDataHash(relayData, relayData.destinationChainId);
367
401
  const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
368
402
 
369
403
  const relayer = SvmAddress.from(signer.address);
370
- const outputTokenAddress = toAddressType(deposit.outputToken, deposit.destinationChainId);
371
- if (!(outputTokenAddress instanceof SvmAddress)) {
372
- return undefined;
373
- }
374
404
 
375
405
  // Create ATA for the relayer and recipient token accounts
376
- const relayerTokenAccount = await getAssociatedTokenAddress(relayer, outputTokenAddress);
406
+ const relayerTokenAccount = await getAssociatedTokenAddress(relayer, relayData.outputToken);
377
407
 
378
408
  const [statePda, fillStatusPda, eventAuthority] = await Promise.all([
379
409
  getStatePda(program),
380
- getFillStatusPda(program, deposit, deposit.destinationChainId),
381
- getEventAuthority(),
410
+ getFillStatusPda(program, relayData, relayData.destinationChainId),
411
+ getEventAuthority(program),
382
412
  ]);
413
+
383
414
  const depositIdBuffer = new Uint8Array(32);
384
- const shortenedBuffer = new Uint8Array(Buffer.from(deposit.depositId.toHexString().slice(2), "hex"));
415
+ const shortenedBuffer = new Uint8Array(Buffer.from(relayData.depositId.toHexString().slice(2), "hex"));
385
416
  depositIdBuffer.set(shortenedBuffer, 32 - shortenedBuffer.length);
386
417
 
387
418
  const delegatePda = await getFillRelayDelegatePda(
@@ -391,26 +422,14 @@ export async function fillRelayInstruction(
391
422
  program
392
423
  );
393
424
 
394
- // @todo we need to convert the deposit's relayData to svm-like since the interface assumes the data originates
395
- // from an EVM Spoke pool. Once we migrate to `Address` types, this can be modified/removed.
396
- const [depositor, inputToken] = [deposit.depositor, deposit.inputToken].map((addr: string) => {
397
- const addressObj = toAddressType(addr, deposit.originChainId);
398
- // @dev we don't really care for correctness of format of depositor / inputToken, so we're fine converting to Solana
399
- // SDK `Address<string>` type even if our `toAddressType` function returned a raw address.
400
- return addressObj.toBase58() as Address<string>;
401
- });
402
-
403
- const [recipient, exclusiveRelayer] = [deposit.recipient, deposit.exclusiveRelayer].map((addr) => {
404
- const addressObj = toAddressType(addr, deposit.originChainId);
405
- if (!(addressObj instanceof SvmAddress)) {
406
- return undefined;
407
- }
408
- return toAddress(addressObj);
409
- });
410
-
411
- if (!recipient || !exclusiveRelayer) return undefined;
425
+ const [recipient, outputToken, exclusiveRelayer, depositor, inputToken] = [
426
+ relayData.recipient,
427
+ relayData.outputToken,
428
+ relayData.exclusiveRelayer,
429
+ relayData.depositor,
430
+ relayData.inputToken,
431
+ ].map(toAddress);
412
432
 
413
- const outputToken = toAddress(outputTokenAddress);
414
433
  return SvmSpokeClient.getFillRelayInstruction({
415
434
  signer,
416
435
  state: statePda,
@@ -428,13 +447,13 @@ export async function fillRelayInstruction(
428
447
  exclusiveRelayer,
429
448
  inputToken,
430
449
  outputToken,
431
- inputAmount: deposit.inputAmount.toBigInt(),
432
- outputAmount: deposit.outputAmount.toBigInt(),
433
- originChainId: BigInt(deposit.originChainId),
434
- fillDeadline: deposit.fillDeadline,
435
- exclusivityDeadline: deposit.exclusivityDeadline,
450
+ inputAmount: relayData.inputAmount.toBigInt(),
451
+ outputAmount: relayData.outputAmount.toBigInt(),
452
+ originChainId: BigInt(relayData.originChainId),
453
+ fillDeadline: relayData.fillDeadline,
454
+ exclusivityDeadline: relayData.exclusivityDeadline,
436
455
  depositId: depositIdBuffer,
437
- message: new Uint8Array(Buffer.from(deposit.message.slice(2), "hex")),
456
+ message: new Uint8Array(Buffer.from(relayData.message.slice(2), "hex")),
438
457
  }),
439
458
  repaymentChainId: some(BigInt(repaymentChainId)),
440
459
  repaymentAddress: toAddress(repaymentAddress),
@@ -616,19 +635,14 @@ export function getRelayDataHash(relayData: RelayData, destinationChainId: numbe
616
635
  const uint32Encoder = getU32Encoder();
617
636
 
618
637
  assert(relayData.message.startsWith("0x"), "Message must be a hex string");
619
- const encodeAddress = (addr: string, chainId: number) => {
620
- const addrObj = toAddressType(addr, chainId);
621
- // @dev even if `addrObj` is of type `Address` here, we still want to calculate the relayHash
622
- // based on `base58` representation of the `Address`
623
- return Uint8Array.from(addressEncoder.encode(addrObj.toBase58() as Address<string>));
624
- };
638
+ const encodeAddress = (data: SdkAddress) => Uint8Array.from(addressEncoder.encode(toAddress(data)));
625
639
 
626
640
  const contentToHash = Buffer.concat([
627
- encodeAddress(relayData.depositor, relayData.originChainId),
628
- encodeAddress(relayData.recipient, destinationChainId),
629
- encodeAddress(relayData.exclusiveRelayer, destinationChainId),
630
- encodeAddress(relayData.inputToken, relayData.originChainId),
631
- encodeAddress(relayData.outputToken, destinationChainId),
641
+ encodeAddress(relayData.depositor),
642
+ encodeAddress(relayData.recipient),
643
+ encodeAddress(relayData.exclusiveRelayer),
644
+ encodeAddress(relayData.inputToken),
645
+ encodeAddress(relayData.outputToken),
632
646
  Uint8Array.from(uint64Encoder.encode(BigInt(relayData.inputAmount.toString()))),
633
647
  Uint8Array.from(uint64Encoder.encode(BigInt(relayData.outputAmount.toString()))),
634
648
  Uint8Array.from(uint64Encoder.encode(BigInt(relayData.originChainId.toString()))),
@@ -10,7 +10,7 @@ import {
10
10
  GetTransactionApi,
11
11
  Signature,
12
12
  } from "@solana/kit";
13
- import { bs58, chainIsSvm, getMessageHash } from "../../utils";
13
+ import { bs58, chainIsSvm, getMessageHash, toAddressType } from "../../utils";
14
14
  import { EventName, EventWithData, SVMProvider } from "./types";
15
15
  import { decodeEvent, isDevnet } from "./utils";
16
16
  import { Deposit, DepositWithTime, Fill, FillWithTime } from "../../interfaces";
@@ -252,7 +252,6 @@ export class SvmCpiEventsClient {
252
252
 
253
253
  // Filter for FundsDeposited events only
254
254
  const depositEvents = events?.filter((event) => event?.name === "FundsDeposited");
255
-
256
255
  if (!txDetails || !depositEvents?.length) {
257
256
  return;
258
257
  }
@@ -261,13 +260,29 @@ export class SvmCpiEventsClient {
261
260
  const unwrappedEventArgs = unwrapEventData(event as Record<string, unknown>, ["depositId"]) as Record<
262
261
  "data",
263
262
  Deposit
264
- >;
265
-
263
+ > &
264
+ Record<
265
+ "data",
266
+ {
267
+ depositor: string;
268
+ recipient: string;
269
+ exclusiveRelayer: string;
270
+ inputToken: string;
271
+ outputToken: string;
272
+ }
273
+ >;
274
+
275
+ const { data } = unwrappedEventArgs;
266
276
  return {
267
- ...unwrappedEventArgs.data,
277
+ ...data,
278
+ depositor: toAddressType(data.depositor, data.originChainId),
279
+ recipient: toAddressType(data.recipient, data.destinationChainId),
280
+ exclusiveRelayer: toAddressType(data.exclusiveRelayer, data.destinationChainId),
281
+ inputToken: toAddressType(data.inputToken, data.originChainId),
282
+ outputToken: toAddressType(data.outputToken, data.destinationChainId),
268
283
  depositTimestamp: Number(txDetails.blockTime),
269
284
  originChainId,
270
- messageHash: getMessageHash(unwrappedEventArgs.data.message),
285
+ messageHash: getMessageHash(data.message),
271
286
  blockNumber: Number(txDetails.slot),
272
287
  txnIndex: 0,
273
288
  txnRef: txSignature,
@@ -309,9 +324,26 @@ export class SvmCpiEventsClient {
309
324
  }
310
325
 
311
326
  return fillEvents.map((event) => {
312
- const unwrappedEventData = unwrapEventData(event as Record<string, unknown>) as Record<"data", Fill>;
327
+ const unwrappedEventData = unwrapEventData(event as Record<string, unknown>) as Record<"data", Fill> &
328
+ Record<
329
+ "data",
330
+ {
331
+ depositor: string;
332
+ recipient: string;
333
+ exclusiveRelayer: string;
334
+ inputToken: string;
335
+ outputToken: string;
336
+ }
337
+ >;
338
+
339
+ const { data } = unwrappedEventData;
313
340
  return {
314
- ...unwrappedEventData.data,
341
+ ...data,
342
+ depositor: toAddressType(data.depositor, data.originChainId),
343
+ recipient: toAddressType(data.recipient, data.destinationChainId),
344
+ exclusiveRelayer: toAddressType(data.exclusiveRelayer, data.destinationChainId),
345
+ inputToken: toAddressType(data.inputToken, data.originChainId),
346
+ outputToken: toAddressType(data.outputToken, data.destinationChainId),
315
347
  fillTimestamp: Number(txDetails.blockTime),
316
348
  blockNumber: Number(txDetails.slot),
317
349
  txnRef: txSignature,
@@ -17,7 +17,7 @@ import {
17
17
  } from "@solana/kit";
18
18
  import { SvmSpokeClient } from "@across-protocol/contracts";
19
19
  import { FillType, RelayData } from "../../interfaces";
20
- import { BigNumber, EvmAddress, SvmAddress, getRelayDataHash, isUint8Array } from "../../utils";
20
+ import { BigNumber, getRelayDataHash, isUint8Array, Address as SdkAddress } from "../../utils";
21
21
  import { EventName, SVMEventNames, SVMProvider } from "./types";
22
22
 
23
23
  /**
@@ -45,7 +45,7 @@ export async function isDevnet(rpc: SVMProvider): Promise<boolean> {
45
45
  /**
46
46
  * Small utility to convert an Address to a Solana Kit branded type.
47
47
  */
48
- export function toAddress(address: EvmAddress | SvmAddress): Address<string> {
48
+ export function toAddress(address: SdkAddress): Address<string> {
49
49
  return address.toBase58() as Address<string>;
50
50
  }
51
51
 
@@ -144,7 +144,7 @@ export function unwrapEventData(
144
144
  }
145
145
  // Handle strings (potential addresses)
146
146
  if (typeof data === "string" && isAddress(data)) {
147
- return SvmAddress.from(data).toBytes32();
147
+ return ethers.utils.hexlify(bs58.decode(data));
148
148
  }
149
149
  // Handle objects
150
150
  if (typeof data === "object") {
@@ -280,13 +280,13 @@ export async function getInstructionParamsPda(programId: Address, signer: Addres
280
280
  * Returns the PDA for the Event Authority.
281
281
  * @returns The PDA for the Event Authority.
282
282
  */
283
- export const getEventAuthority = async () => {
283
+ export async function getEventAuthority(programId: Address): Promise<Address> {
284
284
  const [eventAuthority] = await getProgramDerivedAddress({
285
- programAddress: address(SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS),
285
+ programAddress: programId,
286
286
  seeds: ["__event_authority"],
287
287
  });
288
288
  return eventAuthority;
289
- };
289
+ }
290
290
 
291
291
  /**
292
292
  * Returns a random SVM address.
@@ -5,6 +5,7 @@ import winston from "winston";
5
5
  import { isError } from "../../typeguards";
6
6
  import {
7
7
  EventSearchConfig,
8
+ EvmAddress,
8
9
  MakeOptional,
9
10
  isArrayOf,
10
11
  isDefined,
@@ -107,7 +108,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
107
108
  }
108
109
 
109
110
  getRateModelForBlockNumber(
110
- l1Token: string,
111
+ l1Token: EvmAddress,
111
112
  originChainId: number | string,
112
113
  destinationChainId: number | string,
113
114
  blockNumber: number | undefined = undefined
@@ -121,7 +122,9 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
121
122
 
122
123
  const defaultRateModelUpdate = sortEventsDescending(this.cumulativeRateModelUpdates).find(
123
124
  (config) =>
124
- config.blockNumber <= (blockNumber ?? 0) && config.l1Token === l1Token && config.rateModel !== undefined
125
+ config.blockNumber <= (blockNumber ?? 0) &&
126
+ config.l1Token === l1Token.toEvmAddress() &&
127
+ config.rateModel !== undefined
125
128
  );
126
129
  if (!defaultRateModelUpdate) {
127
130
  throw new Error(`Could not find TokenConfig update for ${l1Token} at block ${blockNumber}`);
@@ -130,12 +133,12 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
130
133
  }
131
134
 
132
135
  getRouteRateModelForBlockNumber(
133
- l1Token: string,
136
+ l1Token: EvmAddress,
134
137
  route: string,
135
138
  blockNumber: number | undefined = undefined
136
139
  ): RateModel | undefined {
137
140
  const config = (sortEventsDescending(this.cumulativeRouteRateModelUpdates) as RouteRateModelUpdate[]).find(
138
- (config) => config.blockNumber <= (blockNumber ?? 0) && config.l1Token === l1Token
141
+ (config) => config.blockNumber <= (blockNumber ?? 0) && config.l1Token === l1Token.toEvmAddress()
139
142
  );
140
143
  if (config?.routeRateModel[route] === undefined) {
141
144
  return undefined;