@across-protocol/sdk 4.2.16-alpha.6 → 4.2.16

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 (234) hide show
  1. package/dist/cjs/arch/evm/SpokeUtils.d.ts +3 -8
  2. package/dist/cjs/arch/evm/SpokeUtils.js +11 -26
  3. package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
  4. package/dist/cjs/arch/svm/SpokeUtils.d.ts +2 -8
  5. package/dist/cjs/arch/svm/SpokeUtils.js +50 -41
  6. package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
  7. package/dist/cjs/arch/svm/eventsClient.js +2 -4
  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 +14 -16
  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 +2 -4
  14. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  15. package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +6 -7
  16. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +83 -78
  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 +1 -2
  21. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +2 -3
  22. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  23. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +1 -5
  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 +8 -13
  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 +58 -84
  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 +45 -65
  37. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  38. package/dist/cjs/clients/SpokePoolClient/SpokePoolClientManager.d.ts +13 -0
  39. package/dist/cjs/clients/SpokePoolClient/SpokePoolClientManager.js +18 -0
  40. package/dist/cjs/clients/SpokePoolClient/SpokePoolClientManager.js.map +1 -0
  41. package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +9 -9
  42. package/dist/cjs/clients/mocks/MockHubPoolClient.js +9 -15
  43. package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
  44. package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +3 -5
  45. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +36 -40
  46. package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
  47. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  48. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +4 -6
  49. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
  50. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  51. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +2 -2
  52. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  53. package/dist/cjs/interfaces/HubPool.d.ts +14 -19
  54. package/dist/cjs/interfaces/SpokePool.d.ts +19 -18
  55. package/dist/cjs/interfaces/SpokePool.js.map +1 -1
  56. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +7 -15
  57. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +15 -24
  58. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  59. package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +1 -1
  60. package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -1
  61. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -12
  62. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +44 -46
  63. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  64. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
  65. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +10 -10
  66. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  67. package/dist/cjs/utils/AddressUtils.d.ts +8 -12
  68. package/dist/cjs/utils/AddressUtils.js +36 -33
  69. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  70. package/dist/cjs/utils/NetworkUtils.js +1 -1
  71. package/dist/cjs/utils/NetworkUtils.js.map +1 -1
  72. package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
  73. package/dist/cjs/utils/SpokeUtils.js +22 -4
  74. package/dist/cjs/utils/SpokeUtils.js.map +1 -1
  75. package/dist/cjs/utils/TokenUtils.d.ts +4 -4
  76. package/dist/cjs/utils/TokenUtils.js +3 -5
  77. package/dist/cjs/utils/TokenUtils.js.map +1 -1
  78. package/dist/esm/arch/evm/SpokeUtils.d.ts +4 -9
  79. package/dist/esm/arch/evm/SpokeUtils.js +14 -29
  80. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  81. package/dist/esm/arch/svm/SpokeUtils.d.ts +3 -9
  82. package/dist/esm/arch/svm/SpokeUtils.js +55 -42
  83. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
  84. package/dist/esm/arch/svm/eventsClient.js +3 -5
  85. package/dist/esm/arch/svm/eventsClient.js.map +1 -1
  86. package/dist/esm/arch/svm/utils.d.ts +3 -3
  87. package/dist/esm/arch/svm/utils.js +15 -17
  88. package/dist/esm/arch/svm/utils.js.map +1 -1
  89. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  90. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +2 -4
  91. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  92. package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +6 -7
  93. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +84 -79
  94. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  95. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +14 -14
  96. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  97. package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
  98. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +3 -5
  99. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  100. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +1 -5
  101. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  102. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
  103. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  104. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
  105. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +10 -20
  106. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  107. package/dist/esm/clients/HubPoolClient.d.ts +22 -23
  108. package/dist/esm/clients/HubPoolClient.js +63 -98
  109. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  110. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
  111. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  112. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  113. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +47 -68
  114. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  115. package/dist/esm/clients/SpokePoolClient/SpokePoolClientManager.d.ts +28 -0
  116. package/dist/esm/clients/SpokePoolClient/SpokePoolClientManager.js +30 -0
  117. package/dist/esm/clients/SpokePoolClient/SpokePoolClientManager.js.map +1 -0
  118. package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
  119. package/dist/esm/clients/mocks/MockHubPoolClient.js +10 -16
  120. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  121. package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +3 -5
  122. package/dist/esm/clients/mocks/MockSpokePoolClient.js +38 -42
  123. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  124. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  125. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +5 -7
  126. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
  127. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  128. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
  129. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  130. package/dist/esm/interfaces/HubPool.d.ts +14 -19
  131. package/dist/esm/interfaces/SpokePool.d.ts +19 -18
  132. package/dist/esm/interfaces/SpokePool.js.map +1 -1
  133. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +10 -18
  134. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +20 -29
  135. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  136. package/dist/esm/relayFeeCalculator/chain-queries/factory.js +2 -2
  137. package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -1
  138. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -14
  139. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +48 -51
  140. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  141. package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
  142. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +9 -9
  143. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  144. package/dist/esm/utils/AddressUtils.d.ts +8 -12
  145. package/dist/esm/utils/AddressUtils.js +38 -36
  146. package/dist/esm/utils/AddressUtils.js.map +1 -1
  147. package/dist/esm/utils/NetworkUtils.js +1 -1
  148. package/dist/esm/utils/NetworkUtils.js.map +1 -1
  149. package/dist/esm/utils/SpokeUtils.d.ts +8 -3
  150. package/dist/esm/utils/SpokeUtils.js +26 -4
  151. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  152. package/dist/esm/utils/TokenUtils.d.ts +18 -22
  153. package/dist/esm/utils/TokenUtils.js +4 -6
  154. package/dist/esm/utils/TokenUtils.js.map +1 -1
  155. package/dist/types/arch/evm/SpokeUtils.d.ts +4 -9
  156. package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
  157. package/dist/types/arch/svm/SpokeUtils.d.ts +3 -9
  158. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
  159. package/dist/types/arch/svm/eventsClient.d.ts.map +1 -1
  160. package/dist/types/arch/svm/utils.d.ts +3 -3
  161. package/dist/types/arch/svm/utils.d.ts.map +1 -1
  162. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  163. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  164. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +6 -7
  165. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  166. package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
  167. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
  168. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
  169. package/dist/types/clients/BundleDataClient/utils/MerkleTreeUtils.d.ts.map +1 -1
  170. package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
  171. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
  172. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
  173. package/dist/types/clients/HubPoolClient.d.ts +22 -23
  174. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  175. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  176. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  177. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
  178. package/dist/types/clients/SpokePoolClient/SpokePoolClientManager.d.ts +29 -0
  179. package/dist/types/clients/SpokePoolClient/SpokePoolClientManager.d.ts.map +1 -0
  180. package/dist/types/clients/mocks/MockHubPoolClient.d.ts +9 -9
  181. package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
  182. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +3 -5
  183. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
  184. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  185. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts.map +1 -1
  186. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  187. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
  188. package/dist/types/interfaces/HubPool.d.ts +14 -19
  189. package/dist/types/interfaces/HubPool.d.ts.map +1 -1
  190. package/dist/types/interfaces/SpokePool.d.ts +19 -18
  191. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  192. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +10 -18
  193. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
  194. package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
  195. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -14
  196. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
  197. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
  198. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
  199. package/dist/types/utils/AddressUtils.d.ts +8 -12
  200. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  201. package/dist/types/utils/SpokeUtils.d.ts +8 -3
  202. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  203. package/dist/types/utils/TokenUtils.d.ts +18 -22
  204. package/dist/types/utils/TokenUtils.d.ts.map +1 -1
  205. package/package.json +2 -1
  206. package/src/arch/evm/SpokeUtils.ts +22 -72
  207. package/src/arch/svm/SpokeUtils.ts +53 -67
  208. package/src/arch/svm/eventsClient.ts +8 -40
  209. package/src/arch/svm/utils.ts +6 -6
  210. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +4 -7
  211. package/src/clients/BundleDataClient/BundleDataClient.ts +90 -77
  212. package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +13 -28
  213. package/src/clients/BundleDataClient/utils/FillUtils.ts +4 -10
  214. package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +1 -7
  215. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
  216. package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +10 -22
  217. package/src/clients/HubPoolClient.ts +82 -127
  218. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +0 -6
  219. package/src/clients/SpokePoolClient/SpokePoolClient.ts +35 -121
  220. package/src/clients/SpokePoolClient/SpokePoolClientManager.ts +36 -0
  221. package/src/clients/mocks/MockHubPoolClient.ts +19 -24
  222. package/src/clients/mocks/MockSpokePoolClient.ts +27 -39
  223. package/src/clients/mocks/MockSvmCpiEventsClient.ts +5 -8
  224. package/src/clients/mocks/MockSvmSpokePoolClient.ts +3 -12
  225. package/src/interfaces/HubPool.ts +14 -23
  226. package/src/interfaces/SpokePool.ts +19 -19
  227. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +20 -39
  228. package/src/relayFeeCalculator/chain-queries/factory.ts +2 -2
  229. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +56 -57
  230. package/src/relayFeeCalculator/relayFeeCalculator.ts +13 -15
  231. package/src/utils/AddressUtils.ts +51 -39
  232. package/src/utils/NetworkUtils.ts +1 -1
  233. package/src/utils/SpokeUtils.ts +33 -11
  234. package/src/utils/TokenUtils.ts +8 -10
@@ -1,8 +1,13 @@
1
- import { Fill, RelayData, SlowFillLeaf } from "../interfaces";
1
+ import { Deposit, Fill, RelayData, SlowFillLeaf } from "../interfaces";
2
2
  import { BigNumber } from "./BigNumberUtils";
3
- import { Address } from "./AddressUtils";
4
3
  export declare function isSlowFill(fill: Fill): boolean;
5
4
  export declare function getSlowFillLeafLpFeePct(leaf: SlowFillLeaf): BigNumber;
5
+ /**
6
+ * Produce the RelayData for a Deposit.
7
+ * @param deposit Deposit instance.
8
+ * @returns The corresponding RelayData object.
9
+ */
10
+ export declare function getDepositRelayData(deposit: Omit<Deposit, "messageHash">): RelayData;
6
11
  /**
7
12
  * Compute the RelayData hash for a fill. This can be used to determine the fill status.
8
13
  * @param relayData RelayData information that is used to complete a fill.
@@ -14,6 +19,6 @@ export declare function getRelayHashFromEvent(e: RelayData & {
14
19
  destinationChainId: number;
15
20
  }): string;
16
21
  export declare function isUnsafeDepositId(depositId: BigNumber): boolean;
17
- export declare function isZeroAddress(address: Address): boolean;
22
+ export declare function isZeroAddress(address: string): boolean;
18
23
  export declare function getMessageHash(message: string): string;
19
24
  //# sourceMappingURL=SpokeUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpokeUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/SpokeUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAY,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAKzC,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAE9C;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,CAGrE;AACD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAkCzF;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,SAAS,GAAG;IAAE,kBAAkB,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE3F;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAQ/D;AAGD,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEvD;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD"}
1
+ {"version":3,"file":"SpokeUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/SpokeUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAY,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAK7C,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAE9C;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,CAGrE;AACD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,GAAG,SAAS,CAepF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAkCzF;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,SAAS,GAAG;IAAE,kBAAkB,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE3F;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAQ/D;AAGD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD"}
@@ -1,9 +1,9 @@
1
1
  import { BlockTag } from "@ethersproject/abstract-provider";
2
2
  import { providers, Signer } from "ethers";
3
- import { TokenInfo } from "../interfaces";
3
+ import { L1Token } 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<TokenInfo>;
6
+ export declare function fetchTokenInfo(address: string, signerOrProvider: SignerOrProvider): Promise<L1Token>;
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): TokenInfo;
17
+ export declare function resolveSymbolOnChain(chainId: number, symbol: string): L1Token;
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,7 +124,13 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
124
124
  };
125
125
  GHO: {
126
126
  name: string;
127
- symbol: 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
+ */
128
134
  decimals: number;
129
135
  addresses: {
130
136
  [x: number]: string;
@@ -185,14 +191,6 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
185
191
  };
186
192
  coingeckoId: string;
187
193
  };
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
- */
196
194
  SOL: {
197
195
  name: string;
198
196
  symbol: string;
@@ -547,7 +545,13 @@ export declare function getTokenInfo(l2TokenAddress: string, chainId: number, to
547
545
  };
548
546
  GHO: {
549
547
  name: string;
550
- symbol: 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
+ */
551
555
  decimals: number;
552
556
  addresses: {
553
557
  [x: number]: string;
@@ -608,14 +612,6 @@ export declare function getTokenInfo(l2TokenAddress: string, chainId: number, to
608
612
  };
609
613
  coingeckoId: string;
610
614
  };
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
- */
619
615
  SOL: {
620
616
  name: string;
621
617
  symbol: string;
@@ -846,7 +842,7 @@ export declare function getTokenInfo(l2TokenAddress: string, chainId: number, to
846
842
  };
847
843
  coingeckoId: string;
848
844
  };
849
- }): TokenInfo;
845
+ }): L1Token;
850
846
  /**
851
847
  * Get the USDC symbol for the given token address and chain ID.
852
848
  * @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":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAY,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAM7C,KAAK,gBAAgB,GAAG,SAAS,CAAC,QAAQ,GAAG,MAAM,CAAC;AAEpD,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAI5G;AAED,eAAO,MAAM,mBAAmB,mBACd,MAAM;;aAMvB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAa/E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,WAC5B,MAAM,WACL,MAAM;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DmG,GAAG,OAAO,CAoB/G;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOlF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAUjF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@across-protocol/sdk",
3
3
  "author": "UMA Team",
4
- "version": "4.2.16-alpha.6",
4
+ "version": "4.2.16",
5
5
  "license": "AGPL-3.0",
6
6
  "homepage": "https://docs.across.to/reference/sdk",
7
7
  "files": [
@@ -111,6 +111,7 @@
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",
114
115
  "@solana-program/token-2022": "^0.4.0",
115
116
  "@solana/kit": "^2.1.0",
116
117
  "@solana/web3.js": "^1.31.0",
@@ -1,18 +1,10 @@
1
1
  import assert from "assert";
2
2
  import { BytesLike, Contract, PopulatedTransaction, providers } from "ethers";
3
3
  import { CHAIN_IDs } from "../../constants";
4
- import {
5
- Deposit,
6
- FillStatus,
7
- FillWithBlock,
8
- RelayData,
9
- RelayExecutionEventInfo,
10
- SpeedUpCommon,
11
- } from "../../interfaces";
4
+ import { Deposit, FillStatus, FillWithBlock, RelayData } from "../../interfaces";
12
5
  import {
13
6
  bnUint32Max,
14
7
  BigNumber,
15
- EvmAddress,
16
8
  toBN,
17
9
  bnZero,
18
10
  chunk,
@@ -20,70 +12,47 @@ import {
20
12
  getRelayDataHash,
21
13
  isDefined,
22
14
  isUnsafeDepositId,
15
+ isZeroAddress,
16
+ getDepositRelayData,
23
17
  getNetworkName,
24
18
  paginatedEventQuery,
25
19
  spreadEventWithBlockNumber,
26
- Address,
27
- toAddressType,
20
+ toBytes32,
28
21
  } from "../../utils";
29
22
 
30
23
  type BlockTag = providers.BlockTag;
31
24
 
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
-
40
25
  /**
41
26
  * @param spokePool SpokePool Contract instance.
42
- * @param relayData RelayData instance, supplemented with destinationChainId
27
+ * @param deposit V3Deopsit instance.
43
28
  * @param repaymentChainId Optional repaymentChainId (defaults to destinationChainId).
44
29
  * @returns An Ethers UnsignedTransaction instance.
45
30
  */
46
31
  export function populateV3Relay(
47
32
  spokePool: Contract,
48
- relayData: ProtoFill,
49
- repaymentAddress: Address,
50
- repaymentChainId = relayData.destinationChainId
33
+ deposit: Omit<Deposit, "messageHash">,
34
+ relayer: string,
35
+ repaymentChainId = deposit.destinationChainId
51
36
  ): Promise<PopulatedTransaction> {
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));
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));
75
43
  return spokePool.populateTransaction.fillRelayWithUpdatedDeposit(
76
44
  relayData,
77
45
  repaymentChainId,
78
- repaymentAddress.toBytes32(),
79
- relayData.updatedOutputAmount,
80
- relayData.updatedRecipient.toBytes32(),
81
- relayData.updatedMessage,
82
- relayData.speedUpSignature
46
+ toBytes32(relayer),
47
+ deposit.updatedOutputAmount,
48
+ toBytes32(deposit.updatedRecipient),
49
+ deposit.updatedMessage,
50
+ deposit.speedUpSignature,
51
+ { from: relayer }
83
52
  );
84
53
  }
85
54
 
86
- return spokePool.populateTransaction.fillRelay(evmRelayData, repaymentChainId, repaymentAddress.toBytes32());
55
+ return spokePool.populateTransaction.fillRelay(relayData, repaymentChainId, toBytes32(relayer), { from: relayer });
87
56
  }
88
57
 
89
58
  /**
@@ -346,27 +315,8 @@ export async function findFillEvent(
346
315
  const destinationChainId = Object.values(CHAIN_IDs).includes(relayData.originChainId)
347
316
  ? (await spokePool.provider.getNetwork()).chainId
348
317
  : 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
- };
358
318
  const fill = {
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
- },
319
+ ...spreadEventWithBlockNumber(event),
370
320
  destinationChainId,
371
321
  messageHash: getMessageHash(event.args.message),
372
322
  } 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
+
27
28
  import { SYSTEM_PROGRAM_ADDRESS } from "@solana-program/system";
28
- import { DepositWithBlock, FillStatus, FillWithBlock, RelayData, RelayExecutionEventInfo } from "../../interfaces";
29
+ import { Deposit, DepositWithBlock, FillStatus, FillWithBlock, RelayData } from "../../interfaces";
29
30
  import {
30
31
  BigNumber,
31
32
  EvmAddress,
32
33
  SvmAddress,
33
- Address as SdkAddress,
34
34
  chainIsSvm,
35
35
  chunk,
36
36
  isUnsafeDepositId,
@@ -46,7 +46,6 @@ import {
46
46
  toAddress,
47
47
  unwrapEventData,
48
48
  } from "./";
49
- import { CHAIN_IDs } from "../../constants";
50
49
  import { SVMEventNames, SVMProvider } from "./types";
51
50
 
52
51
  /**
@@ -55,12 +54,6 @@ import { SVMEventNames, SVMProvider } from "./types";
55
54
  */
56
55
  export const SLOT_DURATION_MS = 400;
57
56
 
58
- type ProtoFill = Omit<RelayData, "recipient" | "outputToken"> & {
59
- destinationChainId: number;
60
- recipient: SvmAddress;
61
- outputToken: SvmAddress;
62
- };
63
-
64
57
  /**
65
58
  * Retrieves the chain time at a particular slot.
66
59
  */
@@ -152,20 +145,13 @@ export async function findDeposit(
152
145
  return undefined;
153
146
  }
154
147
 
155
- const unwrappedDepositEvent = unwrapEventData(depositEvent.data) as Record<string, unknown>;
156
- const destinationChainId = unwrappedDepositEvent.destinationChainId as number;
157
148
  // Return the deposit event with block info
158
149
  return {
159
150
  txnRef: depositEvent.signature.toString(),
160
151
  blockNumber: Number(depositEvent.slot),
161
152
  txnIndex: 0,
162
153
  logIndex: 0,
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),
154
+ ...(unwrapEventData(depositEvent.data) as Record<string, unknown>),
169
155
  } as DepositWithBlock;
170
156
  }
171
157
 
@@ -341,34 +327,14 @@ export async function findFillEvent(
341
327
 
342
328
  if (fillEvents.length > 0) {
343
329
  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;
354
330
  const parsedFillEvent = {
355
- ...eventData,
356
331
  transactionHash: rawFillEvent.signature,
357
332
  blockNumber: Number(rawFillEvent.slot),
358
333
  transactionIndex: 0,
359
334
  logIndex: 0,
360
335
  destinationChainId,
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;
336
+ ...(unwrapEventData(rawFillEvent.data) as Record<string, unknown>),
337
+ } as unknown as FillWithBlock;
372
338
  return parsedFillEvent;
373
339
  }
374
340
 
@@ -377,18 +343,18 @@ export async function findFillEvent(
377
343
 
378
344
  /**
379
345
  * @param spokePool Address (program ID) of the SvmSpoke.
380
- * @param relayData RelayData instance, supplemented with destinationChainId
346
+ * @param deposit V3Deopsit instance.
381
347
  * @param relayer Address of the relayer filling the deposit.
382
348
  * @param repaymentChainId Optional repaymentChainId (defaults to destinationChainId).
383
349
  * @returns An Ethers UnsignedTransaction instance.
384
350
  */
385
351
  export async function fillRelayInstruction(
386
352
  spokePool: SvmAddress,
387
- relayData: ProtoFill,
353
+ deposit: Omit<Deposit, "messageHash" | "fromLiteChain" | "toLiteChain">,
388
354
  signer: TransactionSigner<string>,
389
355
  recipientTokenAccount: Address<string>,
390
356
  repaymentAddress: EvmAddress | SvmAddress = SvmAddress.from(signer.address),
391
- repaymentChainId = relayData.destinationChainId
357
+ repaymentChainId = deposit.destinationChainId
392
358
  ) {
393
359
  const program = toAddress(spokePool);
394
360
 
@@ -397,22 +363,25 @@ export async function fillRelayInstruction(
397
363
  `Invalid repayment address for chain ${repaymentChainId}: ${repaymentAddress.toNative()}.`
398
364
  );
399
365
 
400
- const _relayDataHash = getRelayDataHash(relayData, relayData.destinationChainId);
366
+ const _relayDataHash = getRelayDataHash(deposit, deposit.destinationChainId);
401
367
  const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
402
368
 
403
369
  const relayer = SvmAddress.from(signer.address);
370
+ const outputTokenAddress = toAddressType(deposit.outputToken, deposit.destinationChainId);
371
+ if (!(outputTokenAddress instanceof SvmAddress)) {
372
+ return undefined;
373
+ }
404
374
 
405
375
  // Create ATA for the relayer and recipient token accounts
406
- const relayerTokenAccount = await getAssociatedTokenAddress(relayer, relayData.outputToken);
376
+ const relayerTokenAccount = await getAssociatedTokenAddress(relayer, outputTokenAddress);
407
377
 
408
378
  const [statePda, fillStatusPda, eventAuthority] = await Promise.all([
409
379
  getStatePda(program),
410
- getFillStatusPda(program, relayData, relayData.destinationChainId),
411
- getEventAuthority(program),
380
+ getFillStatusPda(program, deposit, deposit.destinationChainId),
381
+ getEventAuthority(),
412
382
  ]);
413
-
414
383
  const depositIdBuffer = new Uint8Array(32);
415
- const shortenedBuffer = new Uint8Array(Buffer.from(relayData.depositId.toHexString().slice(2), "hex"));
384
+ const shortenedBuffer = new Uint8Array(Buffer.from(deposit.depositId.toHexString().slice(2), "hex"));
416
385
  depositIdBuffer.set(shortenedBuffer, 32 - shortenedBuffer.length);
417
386
 
418
387
  const delegatePda = await getFillRelayDelegatePda(
@@ -422,14 +391,26 @@ export async function fillRelayInstruction(
422
391
  program
423
392
  );
424
393
 
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);
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;
432
412
 
413
+ const outputToken = toAddress(outputTokenAddress);
433
414
  return SvmSpokeClient.getFillRelayInstruction({
434
415
  signer,
435
416
  state: statePda,
@@ -447,13 +428,13 @@ export async function fillRelayInstruction(
447
428
  exclusiveRelayer,
448
429
  inputToken,
449
430
  outputToken,
450
- inputAmount: relayData.inputAmount.toBigInt(),
451
- outputAmount: relayData.outputAmount.toBigInt(),
452
- originChainId: BigInt(relayData.originChainId),
453
- fillDeadline: relayData.fillDeadline,
454
- exclusivityDeadline: relayData.exclusivityDeadline,
431
+ inputAmount: deposit.inputAmount.toBigInt(),
432
+ outputAmount: deposit.outputAmount.toBigInt(),
433
+ originChainId: BigInt(deposit.originChainId),
434
+ fillDeadline: deposit.fillDeadline,
435
+ exclusivityDeadline: deposit.exclusivityDeadline,
455
436
  depositId: depositIdBuffer,
456
- message: new Uint8Array(Buffer.from(relayData.message.slice(2), "hex")),
437
+ message: new Uint8Array(Buffer.from(deposit.message.slice(2), "hex")),
457
438
  }),
458
439
  repaymentChainId: some(BigInt(repaymentChainId)),
459
440
  repaymentAddress: toAddress(repaymentAddress),
@@ -635,14 +616,19 @@ export function getRelayDataHash(relayData: RelayData, destinationChainId: numbe
635
616
  const uint32Encoder = getU32Encoder();
636
617
 
637
618
  assert(relayData.message.startsWith("0x"), "Message must be a hex string");
638
- const encodeAddress = (data: SdkAddress) => Uint8Array.from(addressEncoder.encode(toAddress(data)));
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
+ };
639
625
 
640
626
  const contentToHash = Buffer.concat([
641
- encodeAddress(relayData.depositor),
642
- encodeAddress(relayData.recipient),
643
- encodeAddress(relayData.exclusiveRelayer),
644
- encodeAddress(relayData.inputToken),
645
- encodeAddress(relayData.outputToken),
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),
646
632
  Uint8Array.from(uint64Encoder.encode(BigInt(relayData.inputAmount.toString()))),
647
633
  Uint8Array.from(uint64Encoder.encode(BigInt(relayData.outputAmount.toString()))),
648
634
  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, toAddressType } from "../../utils";
13
+ import { bs58, chainIsSvm, getMessageHash } 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,6 +252,7 @@ export class SvmCpiEventsClient {
252
252
 
253
253
  // Filter for FundsDeposited events only
254
254
  const depositEvents = events?.filter((event) => event?.name === "FundsDeposited");
255
+
255
256
  if (!txDetails || !depositEvents?.length) {
256
257
  return;
257
258
  }
@@ -260,29 +261,13 @@ export class SvmCpiEventsClient {
260
261
  const unwrappedEventArgs = unwrapEventData(event as Record<string, unknown>, ["depositId"]) as Record<
261
262
  "data",
262
263
  Deposit
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;
264
+ >;
265
+
276
266
  return {
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),
267
+ ...unwrappedEventArgs.data,
283
268
  depositTimestamp: Number(txDetails.blockTime),
284
269
  originChainId,
285
- messageHash: getMessageHash(data.message),
270
+ messageHash: getMessageHash(unwrappedEventArgs.data.message),
286
271
  blockNumber: Number(txDetails.slot),
287
272
  txnIndex: 0,
288
273
  txnRef: txSignature,
@@ -324,26 +309,9 @@ export class SvmCpiEventsClient {
324
309
  }
325
310
 
326
311
  return fillEvents.map((event) => {
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;
312
+ const unwrappedEventData = unwrapEventData(event as Record<string, unknown>) as Record<"data", Fill>;
340
313
  return {
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),
314
+ ...unwrappedEventData.data,
347
315
  fillTimestamp: Number(txDetails.blockTime),
348
316
  blockNumber: Number(txDetails.slot),
349
317
  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, getRelayDataHash, isUint8Array, Address as SdkAddress } from "../../utils";
20
+ import { BigNumber, EvmAddress, SvmAddress, getRelayDataHash, isUint8Array } 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: SdkAddress): Address<string> {
48
+ export function toAddress(address: EvmAddress | SvmAddress): 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 ethers.utils.hexlify(bs58.decode(data));
147
+ return SvmAddress.from(data).toBytes32();
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 async function getEventAuthority(programId: Address): Promise<Address> {
283
+ export const getEventAuthority = async () => {
284
284
  const [eventAuthority] = await getProgramDerivedAddress({
285
- programAddress: programId,
285
+ programAddress: address(SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS),
286
286
  seeds: ["__event_authority"],
287
287
  });
288
288
  return eventAuthority;
289
- }
289
+ };
290
290
 
291
291
  /**
292
292
  * Returns a random SVM address.