@across-protocol/sdk 4.1.63-alpha.1 → 4.1.63-beta.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 (358) hide show
  1. package/dist/cjs/arch/evm/SpokeUtils.d.ts +1 -1
  2. package/dist/cjs/arch/evm/SpokeUtils.js +6 -5
  3. package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
  4. package/dist/cjs/arch/svm/SpokeUtils.d.ts +20 -0
  5. package/dist/cjs/arch/svm/SpokeUtils.js +428 -0
  6. package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -0
  7. package/dist/cjs/arch/svm/constants.d.ts +1 -0
  8. package/dist/cjs/arch/svm/constants.js +5 -0
  9. package/dist/cjs/arch/svm/constants.js.map +1 -0
  10. package/dist/cjs/arch/svm/eventsClient.d.ts +21 -0
  11. package/dist/cjs/{svm → arch/svm}/eventsClient.js +60 -28
  12. package/dist/cjs/arch/svm/eventsClient.js.map +1 -0
  13. package/dist/cjs/arch/svm/index.d.ts +5 -1
  14. package/dist/cjs/arch/svm/index.js +6 -2
  15. package/dist/cjs/arch/svm/index.js.map +1 -1
  16. package/dist/cjs/{svm → arch/svm}/types.d.ts +9 -4
  17. package/dist/cjs/arch/svm/types.js.map +1 -0
  18. package/dist/cjs/arch/svm/utils.d.ts +17 -0
  19. package/dist/cjs/arch/svm/utils.js +204 -0
  20. package/dist/cjs/arch/svm/utils.js.map +1 -0
  21. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
  22. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +7 -7
  23. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  24. package/dist/cjs/clients/BaseAbstractClient.d.ts +6 -5
  25. package/dist/cjs/clients/BaseAbstractClient.js +30 -19
  26. package/dist/cjs/clients/BaseAbstractClient.js.map +1 -1
  27. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +15 -11
  28. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  29. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +1 -1
  30. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  31. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +90 -90
  32. package/dist/cjs/clients/HubPoolClient.d.ts +1 -1
  33. package/dist/cjs/clients/HubPoolClient.js +16 -16
  34. package/dist/cjs/clients/HubPoolClient.js.map +1 -1
  35. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
  36. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +23 -20
  37. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  38. package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +23 -0
  39. package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js +145 -0
  40. package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -0
  41. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +5 -5
  42. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +50 -54
  43. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  44. package/dist/cjs/clients/SpokePoolClient/index.d.ts +3 -0
  45. package/dist/cjs/clients/SpokePoolClient/index.js +8 -1
  46. package/dist/cjs/clients/SpokePoolClient/index.js.map +1 -1
  47. package/dist/cjs/clients/index.d.ts +1 -1
  48. package/dist/cjs/clients/index.js +2 -1
  49. package/dist/cjs/clients/index.js.map +1 -1
  50. package/dist/cjs/clients/mocks/MockConfigStoreClient.d.ts +1 -1
  51. package/dist/cjs/clients/mocks/MockConfigStoreClient.js +2 -2
  52. package/dist/cjs/clients/mocks/MockConfigStoreClient.js.map +1 -1
  53. package/dist/cjs/clients/mocks/MockHubPoolClient.js +2 -2
  54. package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
  55. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +7 -4
  56. package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
  57. package/dist/cjs/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
  58. package/dist/cjs/gasPriceOracle/adapters/arbitrum.js.map +1 -1
  59. package/dist/cjs/gasPriceOracle/adapters/ethereum.d.ts +4 -4
  60. package/dist/cjs/gasPriceOracle/adapters/ethereum.js.map +1 -1
  61. package/dist/cjs/gasPriceOracle/adapters/linea-viem.js +3 -2
  62. package/dist/cjs/gasPriceOracle/adapters/linea-viem.js.map +1 -1
  63. package/dist/cjs/gasPriceOracle/adapters/polygon.d.ts +3 -3
  64. package/dist/cjs/gasPriceOracle/adapters/solana.d.ts +4 -0
  65. package/dist/cjs/gasPriceOracle/adapters/solana.js +43 -0
  66. package/dist/cjs/gasPriceOracle/adapters/solana.js.map +1 -0
  67. package/dist/cjs/gasPriceOracle/index.d.ts +1 -1
  68. package/dist/cjs/gasPriceOracle/oracle.d.ts +4 -3
  69. package/dist/cjs/gasPriceOracle/oracle.js +16 -9
  70. package/dist/cjs/gasPriceOracle/oracle.js.map +1 -1
  71. package/dist/cjs/gasPriceOracle/types.d.ts +6 -1
  72. package/dist/cjs/index.d.ts +0 -1
  73. package/dist/cjs/index.js +1 -2
  74. package/dist/cjs/index.js.map +1 -1
  75. package/dist/cjs/interfaces/SpokePool.d.ts +7 -0
  76. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
  77. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +5 -4
  78. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  79. package/dist/cjs/relayFeeCalculator/chain-queries/factory.d.ts +4 -2
  80. package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +7 -1
  81. package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -1
  82. package/dist/cjs/relayFeeCalculator/chain-queries/index.d.ts +1 -0
  83. package/dist/cjs/relayFeeCalculator/chain-queries/index.js +1 -0
  84. package/dist/cjs/relayFeeCalculator/chain-queries/index.js.map +1 -1
  85. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +31 -0
  86. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +136 -0
  87. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -0
  88. package/dist/cjs/utils/AddressUtils.d.ts +9 -3
  89. package/dist/cjs/utils/AddressUtils.js +36 -6
  90. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  91. package/dist/cjs/utils/ArrayUtils.d.ts +1 -0
  92. package/dist/cjs/utils/ArrayUtils.js +6 -1
  93. package/dist/cjs/utils/ArrayUtils.js.map +1 -1
  94. package/dist/cjs/utils/EventUtils.d.ts +4 -4
  95. package/dist/cjs/utils/EventUtils.js +7 -4
  96. package/dist/cjs/utils/EventUtils.js.map +1 -1
  97. package/dist/cjs/utils/JSONUtils.js +3 -0
  98. package/dist/cjs/utils/JSONUtils.js.map +1 -1
  99. package/dist/cjs/utils/SpokeUtils.js +5 -0
  100. package/dist/cjs/utils/SpokeUtils.js.map +1 -1
  101. package/dist/esm/arch/evm/SpokeUtils.d.ts +1 -1
  102. package/dist/esm/arch/evm/SpokeUtils.js +6 -5
  103. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  104. package/dist/esm/arch/svm/SpokeUtils.d.ts +94 -0
  105. package/dist/esm/arch/svm/SpokeUtils.js +513 -0
  106. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -0
  107. package/dist/esm/arch/svm/constants.d.ts +1 -0
  108. package/dist/esm/arch/svm/constants.js +2 -0
  109. package/dist/esm/arch/svm/constants.js.map +1 -0
  110. package/dist/esm/arch/svm/eventsClient.d.ts +67 -0
  111. package/dist/esm/{svm → arch/svm}/eventsClient.js +69 -27
  112. package/dist/esm/arch/svm/eventsClient.js.map +1 -0
  113. package/dist/esm/arch/svm/index.d.ts +5 -1
  114. package/dist/esm/arch/svm/index.js +5 -1
  115. package/dist/esm/arch/svm/index.js.map +1 -1
  116. package/dist/{types → esm/arch}/svm/types.d.ts +9 -5
  117. package/dist/esm/arch/svm/types.js.map +1 -0
  118. package/dist/esm/arch/svm/utils.d.ts +59 -0
  119. package/dist/esm/arch/svm/utils.js +248 -0
  120. package/dist/esm/arch/svm/utils.js.map +1 -0
  121. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
  122. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +7 -7
  123. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  124. package/dist/esm/clients/BaseAbstractClient.d.ts +6 -5
  125. package/dist/esm/clients/BaseAbstractClient.js +30 -19
  126. package/dist/esm/clients/BaseAbstractClient.js.map +1 -1
  127. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +17 -14
  128. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  129. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +1 -1
  130. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  131. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +90 -90
  132. package/dist/esm/clients/HubPoolClient.d.ts +1 -1
  133. package/dist/esm/clients/HubPoolClient.js +16 -16
  134. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  135. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
  136. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +23 -20
  137. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  138. package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +67 -0
  139. package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js +196 -0
  140. package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -0
  141. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +7 -7
  142. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +51 -55
  143. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  144. package/dist/esm/clients/SpokePoolClient/index.d.ts +8 -0
  145. package/dist/esm/clients/SpokePoolClient/index.js +10 -0
  146. package/dist/esm/clients/SpokePoolClient/index.js.map +1 -1
  147. package/dist/esm/clients/index.d.ts +1 -1
  148. package/dist/esm/clients/index.js +1 -1
  149. package/dist/esm/clients/index.js.map +1 -1
  150. package/dist/esm/clients/mocks/MockConfigStoreClient.d.ts +1 -1
  151. package/dist/esm/clients/mocks/MockConfigStoreClient.js +2 -2
  152. package/dist/esm/clients/mocks/MockConfigStoreClient.js.map +1 -1
  153. package/dist/esm/clients/mocks/MockHubPoolClient.js +2 -2
  154. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  155. package/dist/esm/clients/mocks/MockSpokePoolClient.js +8 -5
  156. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  157. package/dist/esm/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
  158. package/dist/esm/gasPriceOracle/adapters/arbitrum.js.map +1 -1
  159. package/dist/esm/gasPriceOracle/adapters/ethereum.d.ts +4 -4
  160. package/dist/esm/gasPriceOracle/adapters/ethereum.js.map +1 -1
  161. package/dist/esm/gasPriceOracle/adapters/linea-viem.js +3 -2
  162. package/dist/esm/gasPriceOracle/adapters/linea-viem.js.map +1 -1
  163. package/dist/esm/gasPriceOracle/adapters/polygon.d.ts +4 -4
  164. package/dist/esm/gasPriceOracle/adapters/polygon.js +1 -1
  165. package/dist/esm/gasPriceOracle/adapters/solana.d.ts +8 -0
  166. package/dist/esm/gasPriceOracle/adapters/solana.js +43 -0
  167. package/dist/esm/gasPriceOracle/adapters/solana.js.map +1 -0
  168. package/dist/esm/gasPriceOracle/index.d.ts +1 -1
  169. package/dist/esm/gasPriceOracle/oracle.d.ts +4 -3
  170. package/dist/esm/gasPriceOracle/oracle.js +18 -9
  171. package/dist/esm/gasPriceOracle/oracle.js.map +1 -1
  172. package/dist/esm/gasPriceOracle/types.d.ts +6 -1
  173. package/dist/esm/index.d.ts +0 -1
  174. package/dist/esm/index.js +0 -2
  175. package/dist/esm/index.js.map +1 -1
  176. package/dist/esm/interfaces/SpokePool.d.ts +7 -0
  177. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
  178. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +4 -3
  179. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  180. package/dist/esm/relayFeeCalculator/chain-queries/factory.d.ts +4 -2
  181. package/dist/esm/relayFeeCalculator/chain-queries/factory.js +8 -2
  182. package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -1
  183. package/dist/esm/relayFeeCalculator/chain-queries/index.d.ts +1 -0
  184. package/dist/esm/relayFeeCalculator/chain-queries/index.js +1 -0
  185. package/dist/esm/relayFeeCalculator/chain-queries/index.js.map +1 -1
  186. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +66 -0
  187. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +169 -0
  188. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -0
  189. package/dist/esm/utils/AddressUtils.d.ts +9 -3
  190. package/dist/esm/utils/AddressUtils.js +41 -6
  191. package/dist/esm/utils/AddressUtils.js.map +1 -1
  192. package/dist/esm/utils/ArrayUtils.d.ts +6 -0
  193. package/dist/esm/utils/ArrayUtils.js +9 -0
  194. package/dist/esm/utils/ArrayUtils.js.map +1 -1
  195. package/dist/esm/utils/EventUtils.d.ts +4 -4
  196. package/dist/esm/utils/EventUtils.js +7 -4
  197. package/dist/esm/utils/EventUtils.js.map +1 -1
  198. package/dist/esm/utils/JSONUtils.js +3 -0
  199. package/dist/esm/utils/JSONUtils.js.map +1 -1
  200. package/dist/esm/utils/SpokeUtils.js +5 -0
  201. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  202. package/dist/types/arch/evm/SpokeUtils.d.ts +1 -1
  203. package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
  204. package/dist/types/arch/svm/SpokeUtils.d.ts +95 -0
  205. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -0
  206. package/dist/types/arch/svm/constants.d.ts +2 -0
  207. package/dist/types/arch/svm/constants.d.ts.map +1 -0
  208. package/dist/types/arch/svm/eventsClient.d.ts +68 -0
  209. package/dist/types/arch/svm/eventsClient.d.ts.map +1 -0
  210. package/dist/types/arch/svm/index.d.ts +5 -1
  211. package/dist/types/arch/svm/index.d.ts.map +1 -1
  212. package/dist/{esm → types/arch}/svm/types.d.ts +10 -4
  213. package/dist/types/arch/svm/types.d.ts.map +1 -0
  214. package/dist/types/arch/svm/utils.d.ts +60 -0
  215. package/dist/types/arch/svm/utils.d.ts.map +1 -0
  216. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
  217. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  218. package/dist/types/clients/BaseAbstractClient.d.ts +6 -5
  219. package/dist/types/clients/BaseAbstractClient.d.ts.map +1 -1
  220. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  221. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +90 -90
  222. package/dist/types/clients/HubPoolClient.d.ts +1 -1
  223. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  224. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
  225. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  226. package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +68 -0
  227. package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts.map +1 -0
  228. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +7 -7
  229. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
  230. package/dist/types/clients/SpokePoolClient/index.d.ts +8 -0
  231. package/dist/types/clients/SpokePoolClient/index.d.ts.map +1 -1
  232. package/dist/types/clients/index.d.ts +1 -1
  233. package/dist/types/clients/index.d.ts.map +1 -1
  234. package/dist/types/clients/mocks/MockConfigStoreClient.d.ts +1 -1
  235. package/dist/types/clients/mocks/MockConfigStoreClient.d.ts.map +1 -1
  236. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
  237. package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
  238. package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts.map +1 -1
  239. package/dist/types/gasPriceOracle/adapters/ethereum.d.ts +4 -4
  240. package/dist/types/gasPriceOracle/adapters/ethereum.d.ts.map +1 -1
  241. package/dist/types/gasPriceOracle/adapters/linea-viem.d.ts.map +1 -1
  242. package/dist/types/gasPriceOracle/adapters/polygon.d.ts +4 -4
  243. package/dist/types/gasPriceOracle/adapters/polygon.d.ts.map +1 -1
  244. package/dist/types/gasPriceOracle/adapters/solana.d.ts +9 -0
  245. package/dist/types/gasPriceOracle/adapters/solana.d.ts.map +1 -0
  246. package/dist/types/gasPriceOracle/index.d.ts +1 -1
  247. package/dist/types/gasPriceOracle/index.d.ts.map +1 -1
  248. package/dist/types/gasPriceOracle/oracle.d.ts +4 -3
  249. package/dist/types/gasPriceOracle/oracle.d.ts.map +1 -1
  250. package/dist/types/gasPriceOracle/types.d.ts +6 -1
  251. package/dist/types/gasPriceOracle/types.d.ts.map +1 -1
  252. package/dist/types/index.d.ts +0 -1
  253. package/dist/types/index.d.ts.map +1 -1
  254. package/dist/types/interfaces/SpokePool.d.ts +7 -0
  255. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  256. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
  257. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
  258. package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts +4 -2
  259. package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
  260. package/dist/types/relayFeeCalculator/chain-queries/index.d.ts +1 -0
  261. package/dist/types/relayFeeCalculator/chain-queries/index.d.ts.map +1 -1
  262. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +67 -0
  263. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -0
  264. package/dist/types/utils/AddressUtils.d.ts +9 -3
  265. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  266. package/dist/types/utils/ArrayUtils.d.ts +6 -0
  267. package/dist/types/utils/ArrayUtils.d.ts.map +1 -1
  268. package/dist/types/utils/EventUtils.d.ts +4 -4
  269. package/dist/types/utils/EventUtils.d.ts.map +1 -1
  270. package/dist/types/utils/JSONUtils.d.ts.map +1 -1
  271. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  272. package/package.json +5 -2
  273. package/src/arch/evm/SpokeUtils.ts +5 -5
  274. package/src/arch/svm/SpokeUtils.ts +526 -0
  275. package/src/arch/svm/constants.ts +1 -0
  276. package/src/{svm → arch/svm}/eventsClient.ts +67 -45
  277. package/src/arch/svm/index.ts +5 -1
  278. package/src/{svm → arch/svm}/types.ts +21 -4
  279. package/src/arch/svm/utils.ts +222 -0
  280. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -7
  281. package/src/clients/BaseAbstractClient.ts +20 -13
  282. package/src/clients/BundleDataClient/BundleDataClient.ts +28 -19
  283. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +1 -1
  284. package/src/clients/HubPoolClient.ts +16 -16
  285. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +23 -21
  286. package/src/clients/SpokePoolClient/SVMSpokePoolClient.ts +244 -0
  287. package/src/clients/SpokePoolClient/SpokePoolClient.ts +44 -56
  288. package/src/clients/SpokePoolClient/index.ts +11 -0
  289. package/src/clients/index.ts +1 -1
  290. package/src/clients/mocks/MockConfigStoreClient.ts +2 -2
  291. package/src/clients/mocks/MockHubPoolClient.ts +2 -2
  292. package/src/clients/mocks/MockSpokePoolClient.ts +9 -4
  293. package/src/gasPriceOracle/adapters/arbitrum.ts +5 -2
  294. package/src/gasPriceOracle/adapters/ethereum.ts +7 -4
  295. package/src/gasPriceOracle/adapters/linea-viem.ts +3 -1
  296. package/src/gasPriceOracle/adapters/polygon.ts +6 -6
  297. package/src/gasPriceOracle/adapters/solana.ts +45 -0
  298. package/src/gasPriceOracle/index.ts +1 -1
  299. package/src/gasPriceOracle/oracle.ts +20 -4
  300. package/src/gasPriceOracle/types.ts +7 -1
  301. package/src/index.ts +0 -1
  302. package/src/interfaces/SpokePool.ts +7 -0
  303. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +5 -3
  304. package/src/relayFeeCalculator/chain-queries/factory.ts +21 -5
  305. package/src/relayFeeCalculator/chain-queries/index.ts +1 -0
  306. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +193 -0
  307. package/src/utils/AddressUtils.ts +49 -6
  308. package/src/utils/ArrayUtils.ts +12 -0
  309. package/src/utils/EventUtils.ts +11 -11
  310. package/src/utils/JSONUtils.ts +2 -0
  311. package/src/utils/SpokeUtils.ts +5 -1
  312. package/dist/cjs/svm/eventsClient.d.ts +0 -15
  313. package/dist/cjs/svm/eventsClient.js.map +0 -1
  314. package/dist/cjs/svm/index.d.ts +0 -3
  315. package/dist/cjs/svm/index.js +0 -8
  316. package/dist/cjs/svm/index.js.map +0 -1
  317. package/dist/cjs/svm/types.js.map +0 -1
  318. package/dist/cjs/svm/utils/events.d.ts +0 -8
  319. package/dist/cjs/svm/utils/events.js +0 -47
  320. package/dist/cjs/svm/utils/events.js.map +0 -1
  321. package/dist/cjs/svm/utils/helpers.d.ts +0 -2
  322. package/dist/cjs/svm/utils/helpers.js +0 -19
  323. package/dist/cjs/svm/utils/helpers.js.map +0 -1
  324. package/dist/cjs/svm/utils/index.d.ts +0 -1
  325. package/dist/cjs/svm/utils/index.js +0 -5
  326. package/dist/cjs/svm/utils/index.js.map +0 -1
  327. package/dist/esm/svm/eventsClient.d.ts +0 -51
  328. package/dist/esm/svm/eventsClient.js.map +0 -1
  329. package/dist/esm/svm/index.d.ts +0 -3
  330. package/dist/esm/svm/index.js +0 -5
  331. package/dist/esm/svm/index.js.map +0 -1
  332. package/dist/esm/svm/types.js.map +0 -1
  333. package/dist/esm/svm/utils/events.d.ts +0 -17
  334. package/dist/esm/svm/utils/events.js +0 -55
  335. package/dist/esm/svm/utils/events.js.map +0 -1
  336. package/dist/esm/svm/utils/helpers.d.ts +0 -5
  337. package/dist/esm/svm/utils/helpers.js +0 -18
  338. package/dist/esm/svm/utils/helpers.js.map +0 -1
  339. package/dist/esm/svm/utils/index.d.ts +0 -1
  340. package/dist/esm/svm/utils/index.js +0 -2
  341. package/dist/esm/svm/utils/index.js.map +0 -1
  342. package/dist/types/svm/eventsClient.d.ts +0 -52
  343. package/dist/types/svm/eventsClient.d.ts.map +0 -1
  344. package/dist/types/svm/index.d.ts +0 -4
  345. package/dist/types/svm/index.d.ts.map +0 -1
  346. package/dist/types/svm/types.d.ts.map +0 -1
  347. package/dist/types/svm/utils/events.d.ts +0 -18
  348. package/dist/types/svm/utils/events.d.ts.map +0 -1
  349. package/dist/types/svm/utils/helpers.d.ts +0 -6
  350. package/dist/types/svm/utils/helpers.d.ts.map +0 -1
  351. package/dist/types/svm/utils/index.d.ts +0 -2
  352. package/dist/types/svm/utils/index.d.ts.map +0 -1
  353. package/src/svm/index.ts +0 -3
  354. package/src/svm/utils/events.ts +0 -58
  355. package/src/svm/utils/helpers.ts +0 -9
  356. package/src/svm/utils/index.ts +0 -1
  357. /package/dist/cjs/{svm → arch/svm}/types.js +0 -0
  358. /package/dist/esm/{svm → arch/svm}/types.js +0 -0
@@ -1,17 +1,10 @@
1
+ import { Idl } from "@coral-xyz/anchor";
1
2
  import { getDeployedAddress, SvmSpokeIdl } from "@across-protocol/contracts";
2
3
  import { getSolanaChainId } from "@across-protocol/contracts/dist/src/svm/web3-v1";
3
- import web3, {
4
- Address,
5
- Commitment,
6
- GetSignaturesForAddressApi,
7
- GetTransactionApi,
8
- RpcTransport,
9
- Signature,
10
- } from "@solana/kit";
11
- import { bs58 } from "../utils";
12
- import { EventData, EventName, EventWithData } from "./types";
13
- import { decodeEvent } from "./utils/events";
14
- import { isDevnet } from "./utils/helpers";
4
+ import web3, { Address, Commitment, GetSignaturesForAddressApi, GetTransactionApi, Signature } from "@solana/kit";
5
+ import { bs58 } from "../../utils";
6
+ import { EventName, EventWithData, SVMProvider } from "./types";
7
+ import { decodeEvent, isDevnet } from "./utils";
15
8
 
16
9
  // Utility type to extract the return type for the JSON encoding overload. We only care about the overload where the
17
10
  // configuration parameter (C) has the optional property 'encoding' set to 'json'.
@@ -26,39 +19,39 @@ type GetSignaturesForAddressConfig = Parameters<GetSignaturesForAddressApi["getS
26
19
  type GetSignaturesForAddressTransaction = ReturnType<GetSignaturesForAddressApi["getSignaturesForAddress"]>[number];
27
20
  type GetSignaturesForAddressApiResponse = readonly GetSignaturesForAddressTransaction[];
28
21
 
29
- export class SvmSpokeEventsClient {
30
- private rpc: web3.Rpc<web3.SolanaRpcApiFromTransport<RpcTransport>>;
31
- private svmSpokeAddress: Address;
32
- private svmSpokeEventAuthority: Address;
22
+ export class SvmCpiEventsClient {
23
+ private rpc: SVMProvider;
24
+ private programAddress: Address;
25
+ private programEventAuthority: Address;
26
+ private idl: Idl;
33
27
 
34
28
  /**
35
- * Private constructor. Use the async create() method to instantiate.
29
+ * Protected constructor. Use the async create() method to instantiate.
36
30
  */
37
- private constructor(
38
- rpc: web3.Rpc<web3.SolanaRpcApiFromTransport<RpcTransport>>,
39
- svmSpokeAddress: Address,
40
- eventAuthority: Address
41
- ) {
31
+ protected constructor(rpc: SVMProvider, address: Address, eventAuthority: Address, idl: Idl) {
42
32
  this.rpc = rpc;
43
- this.svmSpokeAddress = svmSpokeAddress;
44
- this.svmSpokeEventAuthority = eventAuthority;
33
+ this.programAddress = address;
34
+ this.programEventAuthority = eventAuthority;
35
+ this.idl = idl;
45
36
  }
46
37
 
47
38
  /**
48
39
  * Factory method to asynchronously create an instance of SvmSpokeEventsClient.
49
40
  */
50
- public static async create(
51
- rpc: web3.Rpc<web3.SolanaRpcApiFromTransport<RpcTransport>>
52
- ): Promise<SvmSpokeEventsClient> {
41
+ public static async create(rpc: SVMProvider): Promise<SvmCpiEventsClient> {
53
42
  const isTestnet = await isDevnet(rpc);
54
43
  const programId = getDeployedAddress("SvmSpoke", getSolanaChainId(isTestnet ? "devnet" : "mainnet").toString());
55
44
  if (!programId) throw new Error("Program not found");
56
- const svmSpokeAddress = web3.address(programId);
57
- const [svmSpokeEventAuthority] = await web3.getProgramDerivedAddress({
58
- programAddress: svmSpokeAddress,
45
+ return this.createFor(rpc, programId, SvmSpokeIdl);
46
+ }
47
+
48
+ public static async createFor(rpc: SVMProvider, programId: string, idl: Idl): Promise<SvmCpiEventsClient> {
49
+ const address = web3.address(programId);
50
+ const [eventAuthority] = await web3.getProgramDerivedAddress({
51
+ programAddress: address,
59
52
  seeds: ["__event_authority"],
60
53
  });
61
- return new SvmSpokeEventsClient(rpc, svmSpokeAddress, svmSpokeEventAuthority);
54
+ return new SvmCpiEventsClient(rpc, address, eventAuthority, idl);
62
55
  }
63
56
 
64
57
  /**
@@ -70,14 +63,34 @@ export class SvmSpokeEventsClient {
70
63
  * @param options - Options for fetching signatures.
71
64
  * @returns A promise that resolves to an array of events matching the eventName.
72
65
  */
73
- public async queryEvents<T extends EventData>(
66
+ public async queryEvents(
74
67
  eventName: EventName,
75
68
  fromSlot?: bigint,
76
69
  toSlot?: bigint,
77
70
  options: GetSignaturesForAddressConfig = { limit: 1000, commitment: "confirmed" }
78
- ): Promise<EventWithData<T>[]> {
71
+ ): Promise<EventWithData[]> {
79
72
  const events = await this.queryAllEvents(fromSlot, toSlot, options);
80
- return events.filter((event) => event.name === eventName) as EventWithData<T>[];
73
+ return events.filter((event) => event.name === eventName) as EventWithData[];
74
+ }
75
+
76
+ /**
77
+ * Queries events for the provided derived address at instantiation filtered by event name.
78
+ *
79
+ * @param eventName - The name of the event to filter by.
80
+ * @param fromSlot - Optional starting slot.
81
+ * @param toSlot - Optional ending slot.
82
+ * @param options - Options for fetching signatures.
83
+ * @returns A promise that resolves to an array of events matching the eventName.
84
+ */
85
+ public async queryDerivedAddressEvents(
86
+ eventName: string,
87
+ derivedAddress: Address,
88
+ fromSlot?: bigint,
89
+ toSlot?: bigint,
90
+ options: GetSignaturesForAddressConfig = { limit: 1000, commitment: "confirmed" }
91
+ ): Promise<EventWithData[]> {
92
+ const events = await this.queryAllEvents(fromSlot, toSlot, options, derivedAddress);
93
+ return events.filter((event) => event.name === eventName) as EventWithData[];
81
94
  }
82
95
 
83
96
  /**
@@ -86,20 +99,23 @@ export class SvmSpokeEventsClient {
86
99
  * @param fromSlot - Optional starting slot.
87
100
  * @param toSlot - Optional ending slot.
88
101
  * @param options - Options for fetching signatures.
102
+ * @param forDerivedAddress - Whether to query events for the program or the derived address.
89
103
  * @returns A promise that resolves to an array of all events with additional metadata.
90
104
  */
91
105
  private async queryAllEvents(
92
106
  fromSlot?: bigint,
93
107
  toSlot?: bigint,
94
- options: GetSignaturesForAddressConfig = { limit: 1000, commitment: "confirmed" }
95
- ): Promise<EventWithData<EventData>[]> {
108
+ options: GetSignaturesForAddressConfig = { limit: 1000, commitment: "confirmed" },
109
+ derivedAddress?: Address
110
+ ): Promise<EventWithData[]> {
111
+ const addressToQuery = derivedAddress || this.programAddress;
96
112
  const allSignatures: GetSignaturesForAddressTransaction[] = [];
97
113
  let hasMoreSignatures = true;
98
114
  let currentOptions = options;
99
115
 
100
116
  while (hasMoreSignatures) {
101
117
  const signatures: GetSignaturesForAddressApiResponse = await this.rpc
102
- .getSignaturesForAddress(this.svmSpokeAddress, currentOptions)
118
+ .getSignaturesForAddress(addressToQuery!, currentOptions)
103
119
  .send();
104
120
  // Signatures are sorted by slot in descending order.
105
121
  allSignatures.push(...signatures);
@@ -162,11 +178,9 @@ export class SvmSpokeEventsClient {
162
178
  * @param txResult - The transaction result.
163
179
  * @returns A promise that resolves to an array of events with their data and name.
164
180
  */
165
- private processEventFromTx(
166
- txResult: GetTransactionReturnType
167
- ): { program: Address; data: EventData; name: EventName }[] {
181
+ private processEventFromTx(txResult: GetTransactionReturnType): { program: Address; data: unknown; name: string }[] {
168
182
  if (!txResult) return [];
169
- const events: { program: Address; data: EventData; name: EventName }[] = [];
183
+ const events: { program: Address; data: unknown; name: string }[] = [];
170
184
 
171
185
  const accountKeys = txResult.transaction.message.accountKeys;
172
186
  const messageAccountKeys = [...accountKeys];
@@ -182,18 +196,26 @@ export class SvmSpokeEventsClient {
182
196
  if (
183
197
  ixProgramId !== undefined &&
184
198
  singleIxAccount !== undefined &&
185
- this.svmSpokeAddress === ixProgramId &&
186
- this.svmSpokeEventAuthority === singleIxAccount
199
+ this.programAddress === ixProgramId &&
200
+ this.programEventAuthority === singleIxAccount
187
201
  ) {
188
202
  const ixData = bs58.decode(ix.data);
189
203
  // Skip the first 8 bytes (assumed header) and encode the rest.
190
204
  const eventData = Buffer.from(ixData.slice(8)).toString("base64");
191
- const { name, data } = decodeEvent(SvmSpokeIdl, eventData);
192
- events.push({ program: this.svmSpokeAddress, name, data });
205
+ const { name, data } = decodeEvent(this.idl, eventData);
206
+ events.push({ program: this.programAddress, name, data });
193
207
  }
194
208
  }
195
209
  }
196
210
 
197
211
  return events;
198
212
  }
213
+
214
+ public getProgramAddress(): Address {
215
+ return this.programAddress;
216
+ }
217
+
218
+ public getRpc(): SVMProvider {
219
+ return this.rpc;
220
+ }
199
221
  }
@@ -1 +1,5 @@
1
- export const platform = "svm"; // Placeholder for actual exports.
1
+ export * from "./eventsClient";
2
+ export * from "./SpokeUtils";
3
+ export * from "./types";
4
+ export * from "./utils";
5
+ export * from "./constants";
@@ -1,5 +1,15 @@
1
- import { Signature, Address, UnixTimestamp } from "@solana/kit";
2
1
  import { SvmSpokeClient } from "@across-protocol/contracts";
2
+ import {
3
+ Address,
4
+ Rpc,
5
+ RpcSubscriptions,
6
+ RpcTransport,
7
+ Signature,
8
+ SignatureNotificationsApi,
9
+ SlotNotificationsApi,
10
+ SolanaRpcApiFromTransport,
11
+ UnixTimestamp,
12
+ } from "@solana/kit";
3
13
 
4
14
  export type EventData =
5
15
  | SvmSpokeClient.BridgedToHubPool
@@ -36,12 +46,19 @@ export enum SVMEventNames {
36
46
 
37
47
  export type EventName = keyof typeof SVMEventNames;
38
48
 
39
- export type EventWithData<T extends EventData> = {
49
+ export type EventWithData = {
40
50
  confirmationStatus: string | null;
41
51
  blockTime: UnixTimestamp | null;
42
52
  signature: Signature;
43
53
  slot: bigint;
44
- name: EventName;
45
- data: T;
54
+ name: string;
55
+ data: unknown;
46
56
  program: Address;
47
57
  };
58
+
59
+ // Typed aggregate of JSON‑RPC and subscription clients.
60
+ export type RpcClient = {
61
+ rpc: Rpc<SolanaRpcApiFromTransport<RpcTransport>>;
62
+ rpcSubscriptions: RpcSubscriptions<SignatureNotificationsApi & SlotNotificationsApi>;
63
+ };
64
+ export type SVMProvider = Rpc<SolanaRpcApiFromTransport<RpcTransport>>;
@@ -0,0 +1,222 @@
1
+ import { BN, BorshEventCoder, Idl } from "@coral-xyz/anchor";
2
+ import {
3
+ address,
4
+ getProgramDerivedAddress,
5
+ getU64Encoder,
6
+ getAddressEncoder,
7
+ Address,
8
+ isAddress,
9
+ type TransactionSigner,
10
+ } from "@solana/kit";
11
+ import { BigNumber, getRelayDataHash, isUint8Array, SvmAddress } from "../../utils";
12
+ import { SvmSpokeClient } from "@across-protocol/contracts";
13
+ import { FillType, RelayData } from "../../interfaces";
14
+ import { EventName, SVMEventNames, SVMProvider } from "./types";
15
+
16
+ /**
17
+ * Basic void TransactionSigner type
18
+ */
19
+ export const SolanaVoidSigner: (simulationAddress: string) => TransactionSigner<string> = (
20
+ simulationAddress: string
21
+ ) => {
22
+ return {
23
+ address: address(simulationAddress),
24
+ signAndSendTransactions: async () => {
25
+ return await Promise.resolve([]);
26
+ },
27
+ };
28
+ };
29
+
30
+ /**
31
+ * Helper to determine if the current RPC network is devnet.
32
+ */
33
+ export async function isDevnet(rpc: SVMProvider): Promise<boolean> {
34
+ const genesisHash = await rpc.getGenesisHash().send();
35
+ return genesisHash === "EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG";
36
+ }
37
+
38
+ /**
39
+ * Parses event data from a transaction.
40
+ */
41
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
+ export function parseEventData(eventData: any): any {
43
+ if (!eventData) return eventData;
44
+
45
+ if (Array.isArray(eventData)) {
46
+ return eventData.map(parseEventData);
47
+ }
48
+
49
+ if (typeof eventData === "object") {
50
+ if (eventData.constructor.name === "PublicKey") {
51
+ return address(eventData.toString());
52
+ }
53
+ if (BN.isBN(eventData)) {
54
+ return BigInt(eventData.toString());
55
+ }
56
+
57
+ // Convert each key from snake_case to camelCase and process the value recursively.
58
+ return Object.fromEntries(
59
+ Object.entries(eventData).map(([key, value]) => [snakeToCamel(key), parseEventData(value)])
60
+ );
61
+ }
62
+
63
+ return eventData;
64
+ }
65
+
66
+ /**
67
+ * Decodes a raw event according to a supplied IDL.
68
+ */
69
+ export function decodeEvent(idl: Idl, rawEvent: string): { data: unknown; name: string } {
70
+ const event = new BorshEventCoder(idl).decode(rawEvent);
71
+ if (!event) throw new Error(`Malformed rawEvent for IDL ${idl.address}: ${rawEvent}`);
72
+ return {
73
+ name: event.name,
74
+ data: parseEventData(event.data),
75
+ };
76
+ }
77
+
78
+ /**
79
+ * Converts a snake_case string to camelCase.
80
+ */
81
+ function snakeToCamel(s: string): string {
82
+ return s.replace(/(_\w)/g, (match) => match[1].toUpperCase());
83
+ }
84
+
85
+ /**
86
+ * Gets the event name from a raw name.
87
+ */
88
+ export function getEventName(rawName: string): EventName {
89
+ if (Object.values(SVMEventNames).some((name) => rawName.includes(name))) return rawName as EventName;
90
+ throw new Error(`Unknown event name: ${rawName}`);
91
+ }
92
+
93
+ /**
94
+ * Unwraps any data structure and converts Address types to strings and Uint8Array to hex or BigInt.
95
+ * Recursively processes nested objects and arrays.
96
+ */
97
+ export function unwrapEventData(
98
+ data: unknown,
99
+ uint8ArrayKeysAsBigInt: string[] = ["depositId"],
100
+ currentKey?: string
101
+ ): unknown {
102
+ // Handle null/undefined
103
+ if (data == null) {
104
+ return data;
105
+ }
106
+ // Handle BigInt
107
+ if (typeof data === "bigint") {
108
+ return BigNumber.from(data);
109
+ }
110
+ // Handle Uint8Array and byte arrays
111
+ if (data instanceof Uint8Array || isUint8Array(data)) {
112
+ const bytes = data instanceof Uint8Array ? data : new Uint8Array(data as number[]);
113
+ const hex = "0x" + Buffer.from(bytes).toString("hex");
114
+ if (currentKey && uint8ArrayKeysAsBigInt.includes(currentKey)) {
115
+ return BigNumber.from(hex);
116
+ }
117
+ return hex;
118
+ }
119
+ // Handle regular arrays (non-byte arrays)
120
+ if (Array.isArray(data)) {
121
+ return data.map((item) => unwrapEventData(item, uint8ArrayKeysAsBigInt));
122
+ }
123
+ // Handle strings (potential addresses)
124
+ if (typeof data === "string" && isAddress(data)) {
125
+ return SvmAddress.from(data).toBytes32();
126
+ }
127
+ // Handle objects
128
+ if (typeof data === "object") {
129
+ // Special case: if an object is in the context of the fillType key, then
130
+ // parse out the fillType from the object
131
+ if (currentKey === "fillType") {
132
+ const fillType = Object.keys(data)[0];
133
+ switch (fillType) {
134
+ case "FastFill":
135
+ return FillType.FastFill;
136
+ case "ReplacedSlowFill":
137
+ return FillType.ReplacedSlowFill;
138
+ case "SlowFill":
139
+ return FillType.SlowFill;
140
+ default:
141
+ throw new Error(`Unknown fill type: ${fillType}`);
142
+ }
143
+ }
144
+ // Special case: if an object is empty, return 0x
145
+ if (Object.keys(data).length === 0) {
146
+ return "0x";
147
+ }
148
+ return Object.fromEntries(
149
+ Object.entries(data as Record<string, unknown>).map(([key, value]) => [
150
+ key,
151
+ unwrapEventData(value, uint8ArrayKeysAsBigInt, key),
152
+ ])
153
+ );
154
+ }
155
+ // Return primitives as is
156
+ return data;
157
+ }
158
+
159
+ /**
160
+ * Returns the PDA for the State account.
161
+ * @param programId The SpokePool program ID.
162
+ * @returns The PDA for the State account.
163
+ */
164
+ export async function getStatePda(programId: Address): Promise<Address> {
165
+ const intEncoder = getU64Encoder();
166
+ const seed = intEncoder.encode(0);
167
+ const [statePda] = await getProgramDerivedAddress({
168
+ programAddress: programId,
169
+ seeds: ["state", seed],
170
+ });
171
+ return statePda;
172
+ }
173
+
174
+ /**
175
+ * Returns the fill status PDA for the given relay data.
176
+ * @param programId The SpokePool program ID.
177
+ * @param relayData The relay data to get the fill status PDA for.
178
+ * @param destinationChainId The destination chain ID.
179
+ * @returns The PDA for the fill status.
180
+ */
181
+ export async function getFillStatusPda(
182
+ programId: Address,
183
+ relayData: RelayData,
184
+ destinationChainId: number
185
+ ): Promise<Address> {
186
+ const relayDataHash = getRelayDataHash(relayData, destinationChainId);
187
+ const uint8RelayDataHash = new Uint8Array(Buffer.from(relayDataHash.slice(2), "hex"));
188
+ const [fillStatusPda] = await getProgramDerivedAddress({
189
+ programAddress: programId,
190
+ seeds: ["fills", uint8RelayDataHash],
191
+ });
192
+ return fillStatusPda;
193
+ }
194
+
195
+ /**
196
+ * Returns the PDA for a route account on SVM Spoke.
197
+ * @param originToken The origin token address.
198
+ * @param seed The seed for the route account.
199
+ * @param routeChainId The route chain ID.
200
+ * @returns The PDA for the route account.
201
+ */
202
+ export async function getRoutePda(originToken: Address, seed: bigint, routeChainId: bigint): Promise<Address> {
203
+ const intEncoder = getU64Encoder();
204
+ const addressEncoder = getAddressEncoder();
205
+ const [pda] = await getProgramDerivedAddress({
206
+ programAddress: address(SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS),
207
+ seeds: ["route", addressEncoder.encode(originToken), intEncoder.encode(seed), intEncoder.encode(routeChainId)],
208
+ });
209
+ return pda;
210
+ }
211
+
212
+ /**
213
+ * Returns the PDA for the Event Authority.
214
+ * @returns The PDA for the Event Authority.
215
+ */
216
+ export const getEventAuthority = async () => {
217
+ const [eventAuthority] = await getProgramDerivedAddress({
218
+ programAddress: address(SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS),
219
+ seeds: ["__event_authority"],
220
+ });
221
+ return eventAuthority;
222
+ };
@@ -98,12 +98,12 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
98
98
  constructor(
99
99
  readonly logger: winston.Logger,
100
100
  readonly configStore: Contract,
101
- eventSearchConfig: MakeOptional<EventSearchConfig, "toBlock"> = { fromBlock: 0, maxBlockLookBack: 0 },
101
+ eventSearchConfig: MakeOptional<EventSearchConfig, "to"> = { from: 0, maxLookBack: 0 },
102
102
  readonly configStoreVersion: number
103
103
  ) {
104
104
  super(eventSearchConfig);
105
- this.firstBlockToSearch = eventSearchConfig.fromBlock;
106
- this.latestBlockSearched = 0;
105
+ this.firstHeightToSearch = eventSearchConfig.from;
106
+ this.latestHeightSearched = 0;
107
107
  }
108
108
 
109
109
  getRateModelForBlockNumber(
@@ -355,7 +355,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
355
355
  return {
356
356
  success: true,
357
357
  chainId,
358
- searchEndBlock: searchConfig.toBlock,
358
+ searchEndBlock: searchConfig.to,
359
359
  events: {
360
360
  updatedTokenConfigEvents: updatedTokenConfigSortableEvents,
361
361
  updatedGlobalConfigEvents: updatedGlobalConfigSortableEvents,
@@ -550,9 +550,9 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
550
550
  }
551
551
 
552
552
  this.hasLatestConfigStoreVersion = this.hasValidConfigStoreVersionForTimestamp();
553
- this.latestBlockSearched = result.searchEndBlock;
554
- this.firstBlockToSearch = result.searchEndBlock + 1; // Next iteration should start off from where this one ended.
555
- this.eventSearchConfig.toBlock = undefined; // Caller can re-set on subsequent updates if necessary
553
+ this.latestHeightSearched = result.searchEndBlock;
554
+ this.firstHeightToSearch = result.searchEndBlock + 1; // Next iteration should start off from where this one ended.
555
+ this.eventSearchConfig.to = undefined; // Caller can re-set on subsequent updates if necessary
556
556
  this.chainId = this.chainId ?? chainId; // Update on the first run only.
557
557
  this.isUpdated = true;
558
558
 
@@ -1,6 +1,7 @@
1
1
  import { providers } from "ethers";
2
2
  import { CachingMechanismInterface } from "../interfaces";
3
3
  import { EventSearchConfig, isDefined, MakeOptional } from "../utils";
4
+ import { SVMProvider } from "../arch/svm";
4
5
 
5
6
  export enum UpdateFailureReason {
6
7
  NotReady,
@@ -18,15 +19,15 @@ export function isUpdateFailureReason(x: EventSearchConfig | UpdateFailureReason
18
19
  */
19
20
  export abstract class BaseAbstractClient {
20
21
  protected _isUpdated: boolean;
21
- public firstBlockToSearch = 0;
22
- public latestBlockSearched = 0;
22
+ public firstHeightToSearch = 0;
23
+ public latestHeightSearched = 0;
23
24
 
24
25
  /**
25
26
  * Creates a new client.
26
27
  * @param cachingMechanism The caching mechanism to use for this client. If not provided, the client will not rely on an external cache.
27
28
  */
28
29
  constructor(
29
- readonly eventSearchConfig: MakeOptional<EventSearchConfig, "toBlock"> = { fromBlock: 0, maxBlockLookBack: 0 },
30
+ readonly eventSearchConfig: MakeOptional<EventSearchConfig, "to"> = { from: 0, maxLookBack: 0 },
30
31
  protected cachingMechanism?: CachingMechanismInterface
31
32
  ) {
32
33
  this._isUpdated = false;
@@ -58,22 +59,28 @@ export abstract class BaseAbstractClient {
58
59
  * @provider Ethers RPC provider instance.
59
60
  * @returns An EventSearchConfig instance if valid, otherwise an UpdateFailureReason.
60
61
  */
61
- public async updateSearchConfig(provider: providers.Provider): Promise<EventSearchConfig | UpdateFailureReason> {
62
- const fromBlock = this.firstBlockToSearch;
63
- let { toBlock } = this.eventSearchConfig;
64
- if (isDefined(toBlock)) {
65
- if (fromBlock > toBlock) {
66
- throw new Error(`Invalid event search config fromBlock (${fromBlock}) > toBlock (${toBlock})`);
62
+ public async updateSearchConfig(
63
+ provider: providers.Provider | SVMProvider
64
+ ): Promise<EventSearchConfig | UpdateFailureReason> {
65
+ const from = this.firstHeightToSearch;
66
+ let { to } = this.eventSearchConfig;
67
+ if (isDefined(to)) {
68
+ if (from > to) {
69
+ throw new Error(`Invalid event search config from (${from}) > to (${to})`);
67
70
  }
68
71
  } else {
69
- toBlock = await provider.getBlockNumber();
70
- if (toBlock < fromBlock) {
72
+ if (provider instanceof providers.Provider) {
73
+ to = await provider.getBlockNumber();
74
+ } else {
75
+ to = Number(await provider.getSlot({ commitment: "confirmed" }).send());
76
+ }
77
+ if (to < from) {
71
78
  return UpdateFailureReason.AlreadyUpdated;
72
79
  }
73
80
  }
74
81
 
75
- const { maxBlockLookBack } = this.eventSearchConfig;
76
- return { fromBlock, toBlock, maxBlockLookBack };
82
+ const { maxLookBack } = this.eventSearchConfig;
83
+ return { from, to, maxLookBack };
77
84
  }
78
85
 
79
86
  /**
@@ -20,7 +20,8 @@ import {
20
20
  DepositWithBlock,
21
21
  } from "../../interfaces";
22
22
  import { SpokePoolClient } from "..";
23
- import { findFillEvent } from "../../arch/evm";
23
+ import { findFillEvent as findEvmFillEvent } from "../../arch/evm";
24
+ import { findFillEvent as findSvmFillEvent } from "../../arch/svm";
24
25
  import {
25
26
  BigNumber,
26
27
  bnZero,
@@ -56,7 +57,7 @@ import {
56
57
  V3FillWithBlock,
57
58
  verifyFillRepayment,
58
59
  } from "./utils";
59
- import { isEVMSpokePoolClient } from "../SpokePoolClient";
60
+ import { isEVMSpokePoolClient, isSvmSpokePoolClient } from "../SpokePoolClient";
60
61
 
61
62
  // max(uint256) - 1
62
63
  export const INFINITE_FILL_DEADLINE = bnUint32Max;
@@ -370,7 +371,7 @@ export class BundleDataClient {
370
371
  }
371
372
 
372
373
  const bundle = this.clients.hubPoolClient.getLatestFullyExecutedRootBundle(
373
- this.clients.hubPoolClient.latestBlockSearched
374
+ this.clients.hubPoolClient.latestHeightSearched
374
375
  );
375
376
  if (bundle !== undefined) {
376
377
  refunds.push(await this.getPendingRefundsFromBundle(bundle));
@@ -383,7 +384,7 @@ export class BundleDataClient {
383
384
  async getPendingRefundsFromBundle(bundle: ProposedRootBundle): Promise<CombinedRefunds> {
384
385
  const nextBundleMainnetStartBlock = this.clients.hubPoolClient.getNextBundleStartBlockNumber(
385
386
  this.chainIdListForBundleEvaluationBlockNumbers,
386
- this.clients.hubPoolClient.latestBlockSearched,
387
+ this.clients.hubPoolClient.latestHeightSearched,
387
388
  this.clients.hubPoolClient.chainId
388
389
  );
389
390
  const chainIds = this.clients.configStoreClient.getChainIdIndicesForBlock(nextBundleMainnetStartBlock);
@@ -517,7 +518,7 @@ export class BundleDataClient {
517
518
  const hubPoolClient = this.clients.hubPoolClient;
518
519
  const nextBundleMainnetStartBlock = hubPoolClient.getNextBundleStartBlockNumber(
519
520
  this.chainIdListForBundleEvaluationBlockNumbers,
520
- hubPoolClient.latestBlockSearched,
521
+ hubPoolClient.latestHeightSearched,
521
522
  hubPoolClient.chainId
522
523
  );
523
524
  const chainIds = this.clients.configStoreClient.getChainIdIndicesForBlock(nextBundleMainnetStartBlock);
@@ -530,8 +531,8 @@ export class BundleDataClient {
530
531
  this.spokePoolClients,
531
532
  getEndBlockBuffers(chainIds, this.blockRangeEndBlockBuffer),
532
533
  this.clients,
533
- this.clients.hubPoolClient.latestBlockSearched,
534
- this.clients.configStoreClient.getEnabledChains(this.clients.hubPoolClient.latestBlockSearched)
534
+ this.clients.hubPoolClient.latestHeightSearched,
535
+ this.clients.configStoreClient.getEnabledChains(this.clients.hubPoolClient.latestHeightSearched)
535
536
  );
536
537
  // Return block ranges for blocks after _pendingBlockRanges and up to widestBlockRanges.
537
538
  // If a chain is disabled or doesn't have a spoke pool client, return a range of 0
@@ -799,7 +800,7 @@ export class BundleDataClient {
799
800
  // hasn't queried. This is because this function will usually be called
800
801
  // in production with block ranges that were validated by
801
802
  // DataworkerUtils.blockRangesAreInvalidForSpokeClients.
802
- Math.min(queryBlock, spokePoolClients[deposit.destinationChainId].latestBlockSearched)
803
+ Math.min(queryBlock, spokePoolClients[deposit.destinationChainId].latestHeightSearched)
803
804
  );
804
805
  };
805
806
 
@@ -1616,16 +1617,24 @@ export class BundleDataClient {
1616
1617
  deposit: DepositWithBlock,
1617
1618
  spokePoolClient: SpokePoolClient
1618
1619
  ): Promise<FillWithBlock | undefined> {
1619
- if (!isEVMSpokePoolClient(spokePoolClient)) {
1620
- // FIXME: Handle non-EVM chains.
1621
- throw new Error("Destination chain is not an EVM chain.");
1620
+ if (isSvmSpokePoolClient(spokePoolClient)) {
1621
+ return await findSvmFillEvent(
1622
+ deposit,
1623
+ spokePoolClient.chainId,
1624
+ spokePoolClient.svmEventsClient,
1625
+ spokePoolClient.deploymentBlock,
1626
+ spokePoolClient.latestHeightSearched
1627
+ );
1628
+ } else if (isEVMSpokePoolClient(spokePoolClient)) {
1629
+ return await findEvmFillEvent(
1630
+ spokePoolClient.spokePool,
1631
+ deposit,
1632
+ spokePoolClient.deploymentBlock,
1633
+ spokePoolClient.latestHeightSearched
1634
+ );
1635
+ } else {
1636
+ throw new Error("Unsupported spoke pool client type");
1622
1637
  }
1623
- return await findFillEvent(
1624
- spokePoolClient.spokePool,
1625
- deposit,
1626
- spokePoolClient.deploymentBlock,
1627
- spokePoolClient.latestBlockSearched
1628
- );
1629
1638
  }
1630
1639
 
1631
1640
  async getBundleBlockTimestamps(
@@ -1652,13 +1661,13 @@ export class BundleDataClient {
1652
1661
  // contain blocks where the spoke pool client hasn't queried. This is because this function
1653
1662
  // will usually be called in production with block ranges that were validated by
1654
1663
  // DataworkerUtils.blockRangesAreInvalidForSpokeClients.
1655
- const startBlockForChain = Math.min(_startBlockForChain, spokePoolClient.latestBlockSearched);
1664
+ const startBlockForChain = Math.min(_startBlockForChain, spokePoolClient.latestHeightSearched);
1656
1665
  // @dev Add 1 to the bundle end block. The thinking here is that there can be a gap between
1657
1666
  // block timestamps in subsequent blocks. The bundle data client assumes that fill deadlines expire
1658
1667
  // in exactly one bundle, therefore we must make sure that the bundle block timestamp for one bundle's
1659
1668
  // end block is exactly equal to the bundle block timestamp for the next bundle's start block. This way
1660
1669
  // there are no gaps in block timestamps between bundles.
1661
- const endBlockForChain = Math.min(_endBlockForChain + 1, spokePoolClient.latestBlockSearched);
1670
+ const endBlockForChain = Math.min(_endBlockForChain + 1, spokePoolClient.latestHeightSearched);
1662
1671
  const [startTime, _endTime] = [
1663
1672
  await spokePoolClient.getTimestampForBlock(startBlockForChain),
1664
1673
  await spokePoolClient.getTimestampForBlock(endBlockForChain),