@across-protocol/sdk 4.1.63 → 4.2.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 (519) hide show
  1. package/dist/cjs/arch/evm/BlockUtils.d.ts +15 -0
  2. package/dist/cjs/arch/evm/BlockUtils.js +218 -0
  3. package/dist/cjs/arch/evm/BlockUtils.js.map +1 -0
  4. package/dist/cjs/arch/evm/SpokeUtils.d.ts +1 -1
  5. package/dist/cjs/arch/evm/SpokeUtils.js +6 -5
  6. package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
  7. package/dist/cjs/arch/evm/index.d.ts +1 -0
  8. package/dist/cjs/arch/evm/index.js +1 -0
  9. package/dist/cjs/arch/evm/index.js.map +1 -1
  10. package/dist/cjs/arch/svm/SpokeUtils.d.ts +20 -0
  11. package/dist/cjs/arch/svm/SpokeUtils.js +449 -0
  12. package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -0
  13. package/dist/cjs/arch/svm/constants.d.ts +2 -0
  14. package/dist/cjs/arch/svm/constants.js +7 -0
  15. package/dist/cjs/arch/svm/constants.js.map +1 -0
  16. package/dist/cjs/arch/svm/eventsClient.d.ts +26 -0
  17. package/dist/cjs/arch/svm/eventsClient.js +253 -0
  18. package/dist/cjs/arch/svm/eventsClient.js.map +1 -0
  19. package/dist/cjs/arch/svm/index.d.ts +5 -1
  20. package/dist/cjs/arch/svm/index.js +6 -2
  21. package/dist/cjs/arch/svm/index.js.map +1 -1
  22. package/dist/cjs/{svm → arch/svm}/types.d.ts +9 -4
  23. package/dist/cjs/arch/svm/types.js.map +1 -0
  24. package/dist/cjs/arch/svm/utils.d.ts +18 -0
  25. package/dist/cjs/arch/svm/utils.js +212 -0
  26. package/dist/cjs/arch/svm/utils.js.map +1 -0
  27. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
  28. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +7 -7
  29. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  30. package/dist/cjs/clients/BaseAbstractClient.d.ts +6 -5
  31. package/dist/cjs/clients/BaseAbstractClient.js +30 -19
  32. package/dist/cjs/clients/BaseAbstractClient.js.map +1 -1
  33. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +15 -11
  34. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  35. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +1 -1
  36. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  37. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +114 -114
  38. package/dist/cjs/clients/HubPoolClient.d.ts +4 -3
  39. package/dist/cjs/clients/HubPoolClient.js +18 -17
  40. package/dist/cjs/clients/HubPoolClient.js.map +1 -1
  41. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
  42. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +23 -20
  43. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  44. package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +23 -0
  45. package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js +172 -0
  46. package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -0
  47. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +5 -5
  48. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +54 -57
  49. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  50. package/dist/cjs/clients/SpokePoolClient/index.d.ts +3 -0
  51. package/dist/cjs/clients/SpokePoolClient/index.js +8 -1
  52. package/dist/cjs/clients/SpokePoolClient/index.js.map +1 -1
  53. package/dist/cjs/clients/index.d.ts +1 -1
  54. package/dist/cjs/clients/index.js +2 -1
  55. package/dist/cjs/clients/index.js.map +1 -1
  56. package/dist/cjs/clients/mocks/MockConfigStoreClient.d.ts +1 -1
  57. package/dist/cjs/clients/mocks/MockConfigStoreClient.js +2 -2
  58. package/dist/cjs/clients/mocks/MockConfigStoreClient.js.map +1 -1
  59. package/dist/cjs/clients/mocks/MockHubPoolClient.js +2 -2
  60. package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
  61. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +7 -4
  62. package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
  63. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +33 -0
  64. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +184 -0
  65. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -0
  66. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +30 -0
  67. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +90 -0
  68. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -0
  69. package/dist/cjs/clients/mocks/index.d.ts +2 -0
  70. package/dist/cjs/clients/mocks/index.js +2 -0
  71. package/dist/cjs/clients/mocks/index.js.map +1 -1
  72. package/dist/cjs/constants.d.ts +1 -0
  73. package/dist/cjs/constants.js +2 -1
  74. package/dist/cjs/constants.js.map +1 -1
  75. package/dist/cjs/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
  76. package/dist/cjs/gasPriceOracle/adapters/arbitrum.js.map +1 -1
  77. package/dist/cjs/gasPriceOracle/adapters/ethereum.d.ts +4 -4
  78. package/dist/cjs/gasPriceOracle/adapters/ethereum.js.map +1 -1
  79. package/dist/cjs/gasPriceOracle/adapters/linea-viem.js +3 -2
  80. package/dist/cjs/gasPriceOracle/adapters/linea-viem.js.map +1 -1
  81. package/dist/cjs/gasPriceOracle/adapters/polygon.d.ts +3 -3
  82. package/dist/cjs/gasPriceOracle/adapters/solana.d.ts +4 -0
  83. package/dist/cjs/gasPriceOracle/adapters/solana.js +43 -0
  84. package/dist/cjs/gasPriceOracle/adapters/solana.js.map +1 -0
  85. package/dist/cjs/gasPriceOracle/index.d.ts +1 -1
  86. package/dist/cjs/gasPriceOracle/oracle.d.ts +4 -3
  87. package/dist/cjs/gasPriceOracle/oracle.js +16 -9
  88. package/dist/cjs/gasPriceOracle/oracle.js.map +1 -1
  89. package/dist/cjs/gasPriceOracle/types.d.ts +6 -1
  90. package/dist/cjs/index.d.ts +0 -1
  91. package/dist/cjs/index.js +1 -2
  92. package/dist/cjs/index.js.map +1 -1
  93. package/dist/cjs/interfaces/SpokePool.d.ts +13 -0
  94. package/dist/cjs/interfaces/SpokePool.js.map +1 -1
  95. package/dist/cjs/providers/index.d.ts +1 -1
  96. package/dist/cjs/providers/index.js +1 -2
  97. package/dist/cjs/providers/index.js.map +1 -1
  98. package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.d.ts +5 -0
  99. package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.js +21 -0
  100. package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.js.map +1 -0
  101. package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +5 -0
  102. package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.js +20 -0
  103. package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.js.map +1 -0
  104. package/dist/cjs/providers/mocks/MockSolanaRpcFactory.d.ts +13 -0
  105. package/dist/cjs/providers/mocks/MockSolanaRpcFactory.js +76 -0
  106. package/dist/cjs/providers/mocks/MockSolanaRpcFactory.js.map +1 -0
  107. package/dist/cjs/providers/mocks/index.d.ts +4 -0
  108. package/dist/cjs/providers/mocks/index.js +8 -0
  109. package/dist/cjs/providers/mocks/index.js.map +1 -0
  110. package/dist/cjs/providers/{mockProvider.js → mocks/mockEthersProvider.js} +2 -2
  111. package/dist/cjs/providers/mocks/mockEthersProvider.js.map +1 -0
  112. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
  113. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +10 -8
  114. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  115. package/dist/cjs/relayFeeCalculator/chain-queries/factory.d.ts +4 -2
  116. package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +8 -2
  117. package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -1
  118. package/dist/cjs/relayFeeCalculator/chain-queries/index.d.ts +1 -0
  119. package/dist/cjs/relayFeeCalculator/chain-queries/index.js +1 -0
  120. package/dist/cjs/relayFeeCalculator/chain-queries/index.js.map +1 -1
  121. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +37 -0
  122. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +171 -0
  123. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -0
  124. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +2 -0
  125. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +9 -3
  126. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  127. package/dist/cjs/utils/AddressUtils.d.ts +9 -3
  128. package/dist/cjs/utils/AddressUtils.js +36 -6
  129. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  130. package/dist/cjs/utils/ArrayUtils.d.ts +1 -0
  131. package/dist/cjs/utils/ArrayUtils.js +6 -1
  132. package/dist/cjs/utils/ArrayUtils.js.map +1 -1
  133. package/dist/cjs/utils/BlockFinder.d.ts +22 -0
  134. package/dist/cjs/utils/BlockFinder.js +10 -0
  135. package/dist/cjs/utils/BlockFinder.js.map +1 -0
  136. package/dist/cjs/utils/BlockUtils.d.ts +2 -27
  137. package/dist/cjs/utils/BlockUtils.js +2 -208
  138. package/dist/cjs/utils/BlockUtils.js.map +1 -1
  139. package/dist/cjs/utils/EventUtils.d.ts +4 -4
  140. package/dist/cjs/utils/EventUtils.js +7 -4
  141. package/dist/cjs/utils/EventUtils.js.map +1 -1
  142. package/dist/cjs/utils/JSONUtils.js +3 -0
  143. package/dist/cjs/utils/JSONUtils.js.map +1 -1
  144. package/dist/cjs/utils/NumberUtils.d.ts +1 -0
  145. package/dist/cjs/utils/NumberUtils.js +7 -1
  146. package/dist/cjs/utils/NumberUtils.js.map +1 -1
  147. package/dist/cjs/utils/SpokeUtils.js +5 -0
  148. package/dist/cjs/utils/SpokeUtils.js.map +1 -1
  149. package/dist/cjs/utils/index.d.ts +1 -0
  150. package/dist/cjs/utils/index.js +1 -0
  151. package/dist/cjs/utils/index.js.map +1 -1
  152. package/dist/esm/arch/evm/BlockUtils.d.ts +24 -0
  153. package/dist/esm/arch/evm/BlockUtils.js +250 -0
  154. package/dist/esm/arch/evm/BlockUtils.js.map +1 -0
  155. package/dist/esm/arch/evm/SpokeUtils.d.ts +1 -1
  156. package/dist/esm/arch/evm/SpokeUtils.js +6 -5
  157. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  158. package/dist/esm/arch/evm/index.d.ts +1 -0
  159. package/dist/esm/arch/evm/index.js +1 -0
  160. package/dist/esm/arch/evm/index.js.map +1 -1
  161. package/dist/esm/arch/svm/SpokeUtils.d.ts +122 -0
  162. package/dist/esm/arch/svm/SpokeUtils.js +566 -0
  163. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -0
  164. package/dist/esm/arch/svm/constants.d.ts +2 -0
  165. package/dist/esm/arch/svm/constants.js +3 -0
  166. package/dist/esm/arch/svm/constants.js.map +1 -0
  167. package/dist/esm/arch/svm/eventsClient.d.ts +87 -0
  168. package/dist/esm/arch/svm/eventsClient.js +316 -0
  169. package/dist/esm/arch/svm/eventsClient.js.map +1 -0
  170. package/dist/esm/arch/svm/index.d.ts +5 -1
  171. package/dist/esm/arch/svm/index.js +5 -1
  172. package/dist/esm/arch/svm/index.js.map +1 -1
  173. package/dist/esm/{svm → arch/svm}/types.d.ts +9 -4
  174. package/dist/esm/arch/svm/types.js.map +1 -0
  175. package/dist/esm/arch/svm/utils.d.ts +63 -0
  176. package/dist/esm/arch/svm/utils.js +258 -0
  177. package/dist/esm/arch/svm/utils.js.map +1 -0
  178. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
  179. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +7 -7
  180. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  181. package/dist/esm/clients/BaseAbstractClient.d.ts +6 -5
  182. package/dist/esm/clients/BaseAbstractClient.js +30 -19
  183. package/dist/esm/clients/BaseAbstractClient.js.map +1 -1
  184. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +17 -14
  185. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  186. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +1 -1
  187. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  188. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +114 -114
  189. package/dist/esm/clients/HubPoolClient.d.ts +4 -3
  190. package/dist/esm/clients/HubPoolClient.js +19 -18
  191. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  192. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
  193. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +23 -20
  194. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  195. package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +66 -0
  196. package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js +225 -0
  197. package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -0
  198. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +7 -7
  199. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +57 -59
  200. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  201. package/dist/esm/clients/SpokePoolClient/index.d.ts +8 -0
  202. package/dist/esm/clients/SpokePoolClient/index.js +10 -0
  203. package/dist/esm/clients/SpokePoolClient/index.js.map +1 -1
  204. package/dist/esm/clients/index.d.ts +1 -1
  205. package/dist/esm/clients/index.js +1 -1
  206. package/dist/esm/clients/index.js.map +1 -1
  207. package/dist/esm/clients/mocks/MockConfigStoreClient.d.ts +1 -1
  208. package/dist/esm/clients/mocks/MockConfigStoreClient.js +2 -2
  209. package/dist/esm/clients/mocks/MockConfigStoreClient.js.map +1 -1
  210. package/dist/esm/clients/mocks/MockHubPoolClient.js +2 -2
  211. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  212. package/dist/esm/clients/mocks/MockSpokePoolClient.js +8 -5
  213. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  214. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +33 -0
  215. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +183 -0
  216. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -0
  217. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +30 -0
  218. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +89 -0
  219. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -0
  220. package/dist/esm/clients/mocks/index.d.ts +2 -0
  221. package/dist/esm/clients/mocks/index.js +2 -0
  222. package/dist/esm/clients/mocks/index.js.map +1 -1
  223. package/dist/esm/constants.d.ts +1 -0
  224. package/dist/esm/constants.js +1 -0
  225. package/dist/esm/constants.js.map +1 -1
  226. package/dist/esm/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
  227. package/dist/esm/gasPriceOracle/adapters/arbitrum.js.map +1 -1
  228. package/dist/esm/gasPriceOracle/adapters/ethereum.d.ts +4 -4
  229. package/dist/esm/gasPriceOracle/adapters/ethereum.js.map +1 -1
  230. package/dist/esm/gasPriceOracle/adapters/linea-viem.js +3 -2
  231. package/dist/esm/gasPriceOracle/adapters/linea-viem.js.map +1 -1
  232. package/dist/esm/gasPriceOracle/adapters/polygon.d.ts +4 -4
  233. package/dist/esm/gasPriceOracle/adapters/polygon.js +1 -1
  234. package/dist/esm/gasPriceOracle/adapters/solana.d.ts +8 -0
  235. package/dist/esm/gasPriceOracle/adapters/solana.js +43 -0
  236. package/dist/esm/gasPriceOracle/adapters/solana.js.map +1 -0
  237. package/dist/esm/gasPriceOracle/index.d.ts +1 -1
  238. package/dist/esm/gasPriceOracle/oracle.d.ts +4 -3
  239. package/dist/esm/gasPriceOracle/oracle.js +18 -9
  240. package/dist/esm/gasPriceOracle/oracle.js.map +1 -1
  241. package/dist/esm/gasPriceOracle/types.d.ts +6 -1
  242. package/dist/esm/index.d.ts +0 -1
  243. package/dist/esm/index.js +0 -2
  244. package/dist/esm/index.js.map +1 -1
  245. package/dist/esm/interfaces/SpokePool.d.ts +13 -0
  246. package/dist/esm/interfaces/SpokePool.js.map +1 -1
  247. package/dist/esm/providers/index.d.ts +1 -1
  248. package/dist/esm/providers/index.js +1 -2
  249. package/dist/esm/providers/index.js.map +1 -1
  250. package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.d.ts +5 -0
  251. package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.js +19 -0
  252. package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.js.map +1 -0
  253. package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +5 -0
  254. package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.js +18 -0
  255. package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.js.map +1 -0
  256. package/dist/esm/providers/mocks/MockSolanaRpcFactory.d.ts +13 -0
  257. package/dist/esm/providers/mocks/MockSolanaRpcFactory.js +74 -0
  258. package/dist/esm/providers/mocks/MockSolanaRpcFactory.js.map +1 -0
  259. package/dist/esm/providers/mocks/index.d.ts +4 -0
  260. package/dist/esm/providers/mocks/index.js +5 -0
  261. package/dist/esm/providers/mocks/index.js.map +1 -0
  262. package/dist/esm/providers/{mockProvider.js → mocks/mockEthersProvider.js} +2 -2
  263. package/dist/esm/providers/mocks/mockEthersProvider.js.map +1 -0
  264. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
  265. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +10 -8
  266. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  267. package/dist/esm/relayFeeCalculator/chain-queries/factory.d.ts +4 -2
  268. package/dist/esm/relayFeeCalculator/chain-queries/factory.js +11 -5
  269. package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -1
  270. package/dist/esm/relayFeeCalculator/chain-queries/index.d.ts +1 -0
  271. package/dist/esm/relayFeeCalculator/chain-queries/index.js +1 -0
  272. package/dist/esm/relayFeeCalculator/chain-queries/index.js.map +1 -1
  273. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +84 -0
  274. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +216 -0
  275. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -0
  276. package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +12 -1
  277. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +9 -4
  278. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  279. package/dist/esm/utils/AddressUtils.d.ts +9 -3
  280. package/dist/esm/utils/AddressUtils.js +41 -6
  281. package/dist/esm/utils/AddressUtils.js.map +1 -1
  282. package/dist/esm/utils/ArrayUtils.d.ts +6 -0
  283. package/dist/esm/utils/ArrayUtils.js +9 -0
  284. package/dist/esm/utils/ArrayUtils.js.map +1 -1
  285. package/dist/esm/utils/BlockFinder.d.ts +22 -0
  286. package/dist/esm/utils/BlockFinder.js +7 -0
  287. package/dist/esm/utils/BlockFinder.js.map +1 -0
  288. package/dist/esm/utils/BlockUtils.d.ts +2 -36
  289. package/dist/esm/utils/BlockUtils.js +2 -243
  290. package/dist/esm/utils/BlockUtils.js.map +1 -1
  291. package/dist/esm/utils/EventUtils.d.ts +4 -4
  292. package/dist/esm/utils/EventUtils.js +7 -4
  293. package/dist/esm/utils/EventUtils.js.map +1 -1
  294. package/dist/esm/utils/JSONUtils.js +3 -0
  295. package/dist/esm/utils/JSONUtils.js.map +1 -1
  296. package/dist/esm/utils/NumberUtils.d.ts +7 -0
  297. package/dist/esm/utils/NumberUtils.js +11 -0
  298. package/dist/esm/utils/NumberUtils.js.map +1 -1
  299. package/dist/esm/utils/SpokeUtils.js +5 -0
  300. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  301. package/dist/esm/utils/index.d.ts +1 -0
  302. package/dist/esm/utils/index.js +1 -0
  303. package/dist/esm/utils/index.js.map +1 -1
  304. package/dist/types/arch/evm/BlockUtils.d.ts +25 -0
  305. package/dist/types/arch/evm/BlockUtils.d.ts.map +1 -0
  306. package/dist/types/arch/evm/SpokeUtils.d.ts +1 -1
  307. package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
  308. package/dist/types/arch/evm/index.d.ts +1 -0
  309. package/dist/types/arch/evm/index.d.ts.map +1 -1
  310. package/dist/types/arch/svm/SpokeUtils.d.ts +123 -0
  311. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -0
  312. package/dist/types/arch/svm/constants.d.ts +3 -0
  313. package/dist/types/arch/svm/constants.d.ts.map +1 -0
  314. package/dist/types/arch/svm/eventsClient.d.ts +88 -0
  315. package/dist/types/arch/svm/eventsClient.d.ts.map +1 -0
  316. package/dist/types/arch/svm/index.d.ts +5 -1
  317. package/dist/types/arch/svm/index.d.ts.map +1 -1
  318. package/dist/types/{svm → arch/svm}/types.d.ts +9 -4
  319. package/dist/types/arch/svm/types.d.ts.map +1 -0
  320. package/dist/types/arch/svm/utils.d.ts +64 -0
  321. package/dist/types/arch/svm/utils.d.ts.map +1 -0
  322. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
  323. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  324. package/dist/types/clients/BaseAbstractClient.d.ts +6 -5
  325. package/dist/types/clients/BaseAbstractClient.d.ts.map +1 -1
  326. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  327. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +114 -114
  328. package/dist/types/clients/HubPoolClient.d.ts +4 -3
  329. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  330. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
  331. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  332. package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +67 -0
  333. package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts.map +1 -0
  334. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +7 -7
  335. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
  336. package/dist/types/clients/SpokePoolClient/index.d.ts +8 -0
  337. package/dist/types/clients/SpokePoolClient/index.d.ts.map +1 -1
  338. package/dist/types/clients/index.d.ts +1 -1
  339. package/dist/types/clients/index.d.ts.map +1 -1
  340. package/dist/types/clients/mocks/MockConfigStoreClient.d.ts +1 -1
  341. package/dist/types/clients/mocks/MockConfigStoreClient.d.ts.map +1 -1
  342. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
  343. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts +34 -0
  344. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts.map +1 -0
  345. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +31 -0
  346. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -0
  347. package/dist/types/clients/mocks/index.d.ts +2 -0
  348. package/dist/types/clients/mocks/index.d.ts.map +1 -1
  349. package/dist/types/constants.d.ts +1 -0
  350. package/dist/types/constants.d.ts.map +1 -1
  351. package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
  352. package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts.map +1 -1
  353. package/dist/types/gasPriceOracle/adapters/ethereum.d.ts +4 -4
  354. package/dist/types/gasPriceOracle/adapters/ethereum.d.ts.map +1 -1
  355. package/dist/types/gasPriceOracle/adapters/linea-viem.d.ts.map +1 -1
  356. package/dist/types/gasPriceOracle/adapters/polygon.d.ts +4 -4
  357. package/dist/types/gasPriceOracle/adapters/polygon.d.ts.map +1 -1
  358. package/dist/types/gasPriceOracle/adapters/solana.d.ts +9 -0
  359. package/dist/types/gasPriceOracle/adapters/solana.d.ts.map +1 -0
  360. package/dist/types/gasPriceOracle/index.d.ts +1 -1
  361. package/dist/types/gasPriceOracle/index.d.ts.map +1 -1
  362. package/dist/types/gasPriceOracle/oracle.d.ts +4 -3
  363. package/dist/types/gasPriceOracle/oracle.d.ts.map +1 -1
  364. package/dist/types/gasPriceOracle/types.d.ts +6 -1
  365. package/dist/types/gasPriceOracle/types.d.ts.map +1 -1
  366. package/dist/types/index.d.ts +0 -1
  367. package/dist/types/index.d.ts.map +1 -1
  368. package/dist/types/interfaces/SpokePool.d.ts +13 -0
  369. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  370. package/dist/types/providers/index.d.ts +1 -1
  371. package/dist/types/providers/index.d.ts.map +1 -1
  372. package/dist/types/providers/mocks/MockCachedSolanaRpcFactory.d.ts +6 -0
  373. package/dist/types/providers/mocks/MockCachedSolanaRpcFactory.d.ts.map +1 -0
  374. package/dist/types/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +6 -0
  375. package/dist/types/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts.map +1 -0
  376. package/dist/types/providers/mocks/MockSolanaRpcFactory.d.ts +14 -0
  377. package/dist/types/providers/mocks/MockSolanaRpcFactory.d.ts.map +1 -0
  378. package/dist/types/providers/mocks/index.d.ts +5 -0
  379. package/dist/types/providers/mocks/index.d.ts.map +1 -0
  380. package/dist/types/providers/{mockProvider.d.ts → mocks/mockEthersProvider.d.ts} +1 -1
  381. package/dist/types/providers/mocks/mockEthersProvider.d.ts.map +1 -0
  382. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
  383. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
  384. package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts +4 -2
  385. package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
  386. package/dist/types/relayFeeCalculator/chain-queries/index.d.ts +1 -0
  387. package/dist/types/relayFeeCalculator/chain-queries/index.d.ts.map +1 -1
  388. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +85 -0
  389. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -0
  390. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +12 -1
  391. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
  392. package/dist/types/utils/AddressUtils.d.ts +9 -3
  393. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  394. package/dist/types/utils/ArrayUtils.d.ts +6 -0
  395. package/dist/types/utils/ArrayUtils.d.ts.map +1 -1
  396. package/dist/types/utils/BlockFinder.d.ts +23 -0
  397. package/dist/types/utils/BlockFinder.d.ts.map +1 -0
  398. package/dist/types/utils/BlockUtils.d.ts +2 -36
  399. package/dist/types/utils/BlockUtils.d.ts.map +1 -1
  400. package/dist/types/utils/EventUtils.d.ts +4 -4
  401. package/dist/types/utils/EventUtils.d.ts.map +1 -1
  402. package/dist/types/utils/JSONUtils.d.ts.map +1 -1
  403. package/dist/types/utils/NumberUtils.d.ts +7 -0
  404. package/dist/types/utils/NumberUtils.d.ts.map +1 -1
  405. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  406. package/dist/types/utils/index.d.ts +1 -0
  407. package/dist/types/utils/index.d.ts.map +1 -1
  408. package/package.json +3 -1
  409. package/src/arch/evm/BlockUtils.ts +209 -0
  410. package/src/arch/evm/SpokeUtils.ts +5 -5
  411. package/src/arch/evm/index.ts +1 -0
  412. package/src/arch/svm/SpokeUtils.ts +581 -0
  413. package/src/arch/svm/constants.ts +2 -0
  414. package/src/arch/svm/eventsClient.ts +342 -0
  415. package/src/arch/svm/index.ts +5 -1
  416. package/src/{svm → arch/svm}/types.ts +21 -4
  417. package/src/arch/svm/utils.ts +233 -0
  418. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -7
  419. package/src/clients/BaseAbstractClient.ts +20 -13
  420. package/src/clients/BundleDataClient/BundleDataClient.ts +28 -19
  421. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +1 -1
  422. package/src/clients/HubPoolClient.ts +19 -19
  423. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +23 -21
  424. package/src/clients/SpokePoolClient/SVMSpokePoolClient.ts +268 -0
  425. package/src/clients/SpokePoolClient/SpokePoolClient.ts +50 -59
  426. package/src/clients/SpokePoolClient/index.ts +11 -0
  427. package/src/clients/index.ts +1 -1
  428. package/src/clients/mocks/MockConfigStoreClient.ts +2 -2
  429. package/src/clients/mocks/MockHubPoolClient.ts +2 -2
  430. package/src/clients/mocks/MockSpokePoolClient.ts +9 -4
  431. package/src/clients/mocks/MockSvmCpiEventsClient.ts +226 -0
  432. package/src/clients/mocks/MockSvmSpokePoolClient.ts +119 -0
  433. package/src/clients/mocks/index.ts +2 -0
  434. package/src/constants.ts +1 -0
  435. package/src/gasPriceOracle/adapters/arbitrum.ts +5 -2
  436. package/src/gasPriceOracle/adapters/ethereum.ts +7 -4
  437. package/src/gasPriceOracle/adapters/linea-viem.ts +3 -1
  438. package/src/gasPriceOracle/adapters/polygon.ts +6 -6
  439. package/src/gasPriceOracle/adapters/solana.ts +45 -0
  440. package/src/gasPriceOracle/index.ts +1 -1
  441. package/src/gasPriceOracle/oracle.ts +20 -4
  442. package/src/gasPriceOracle/types.ts +7 -1
  443. package/src/index.ts +0 -1
  444. package/src/interfaces/SpokePool.ts +14 -0
  445. package/src/providers/index.ts +1 -1
  446. package/src/providers/mocks/MockCachedSolanaRpcFactory.ts +15 -0
  447. package/src/providers/mocks/MockRateLimitedSolanaRpcFactory.ts +14 -0
  448. package/src/providers/mocks/MockSolanaRpcFactory.ts +55 -0
  449. package/src/providers/mocks/index.ts +4 -0
  450. package/src/providers/{mockProvider.ts → mocks/mockEthersProvider.ts} +1 -1
  451. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +11 -9
  452. package/src/relayFeeCalculator/chain-queries/factory.ts +24 -8
  453. package/src/relayFeeCalculator/chain-queries/index.ts +1 -0
  454. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +225 -0
  455. package/src/relayFeeCalculator/relayFeeCalculator.ts +15 -3
  456. package/src/utils/AddressUtils.ts +49 -6
  457. package/src/utils/ArrayUtils.ts +12 -0
  458. package/src/utils/BlockFinder.ts +26 -0
  459. package/src/utils/BlockUtils.ts +5 -215
  460. package/src/utils/EventUtils.ts +11 -11
  461. package/src/utils/JSONUtils.ts +2 -0
  462. package/src/utils/NumberUtils.ts +10 -0
  463. package/src/utils/SpokeUtils.ts +7 -3
  464. package/src/utils/index.ts +1 -0
  465. package/dist/cjs/providers/mockProvider.js.map +0 -1
  466. package/dist/cjs/svm/eventsClient.d.ts +0 -15
  467. package/dist/cjs/svm/eventsClient.js +0 -157
  468. package/dist/cjs/svm/eventsClient.js.map +0 -1
  469. package/dist/cjs/svm/index.d.ts +0 -3
  470. package/dist/cjs/svm/index.js +0 -8
  471. package/dist/cjs/svm/index.js.map +0 -1
  472. package/dist/cjs/svm/types.js.map +0 -1
  473. package/dist/cjs/svm/utils/events.d.ts +0 -8
  474. package/dist/cjs/svm/utils/events.js +0 -47
  475. package/dist/cjs/svm/utils/events.js.map +0 -1
  476. package/dist/cjs/svm/utils/helpers.d.ts +0 -2
  477. package/dist/cjs/svm/utils/helpers.js +0 -19
  478. package/dist/cjs/svm/utils/helpers.js.map +0 -1
  479. package/dist/cjs/svm/utils/index.d.ts +0 -1
  480. package/dist/cjs/svm/utils/index.js +0 -5
  481. package/dist/cjs/svm/utils/index.js.map +0 -1
  482. package/dist/esm/providers/mockProvider.js.map +0 -1
  483. package/dist/esm/svm/eventsClient.d.ts +0 -51
  484. package/dist/esm/svm/eventsClient.js +0 -195
  485. package/dist/esm/svm/eventsClient.js.map +0 -1
  486. package/dist/esm/svm/index.d.ts +0 -3
  487. package/dist/esm/svm/index.js +0 -5
  488. package/dist/esm/svm/index.js.map +0 -1
  489. package/dist/esm/svm/types.js.map +0 -1
  490. package/dist/esm/svm/utils/events.d.ts +0 -17
  491. package/dist/esm/svm/utils/events.js +0 -55
  492. package/dist/esm/svm/utils/events.js.map +0 -1
  493. package/dist/esm/svm/utils/helpers.d.ts +0 -5
  494. package/dist/esm/svm/utils/helpers.js +0 -18
  495. package/dist/esm/svm/utils/helpers.js.map +0 -1
  496. package/dist/esm/svm/utils/index.d.ts +0 -1
  497. package/dist/esm/svm/utils/index.js +0 -2
  498. package/dist/esm/svm/utils/index.js.map +0 -1
  499. package/dist/types/providers/mockProvider.d.ts.map +0 -1
  500. package/dist/types/svm/eventsClient.d.ts +0 -52
  501. package/dist/types/svm/eventsClient.d.ts.map +0 -1
  502. package/dist/types/svm/index.d.ts +0 -4
  503. package/dist/types/svm/index.d.ts.map +0 -1
  504. package/dist/types/svm/types.d.ts.map +0 -1
  505. package/dist/types/svm/utils/events.d.ts +0 -18
  506. package/dist/types/svm/utils/events.d.ts.map +0 -1
  507. package/dist/types/svm/utils/helpers.d.ts +0 -6
  508. package/dist/types/svm/utils/helpers.d.ts.map +0 -1
  509. package/dist/types/svm/utils/index.d.ts +0 -2
  510. package/dist/types/svm/utils/index.d.ts.map +0 -1
  511. package/src/svm/eventsClient.ts +0 -199
  512. package/src/svm/index.ts +0 -3
  513. package/src/svm/utils/events.ts +0 -58
  514. package/src/svm/utils/helpers.ts +0 -9
  515. package/src/svm/utils/index.ts +0 -1
  516. /package/dist/cjs/{svm → arch/svm}/types.js +0 -0
  517. /package/dist/cjs/providers/{mockProvider.d.ts → mocks/mockEthersProvider.d.ts} +0 -0
  518. /package/dist/esm/{svm → arch/svm}/types.js +0 -0
  519. /package/dist/esm/providers/{mockProvider.d.ts → mocks/mockEthersProvider.d.ts} +0 -0
@@ -0,0 +1,226 @@
1
+ import assert from "assert";
2
+ import { createHash } from "crypto";
3
+ import { hexlify, arrayify, hexZeroPad } from "ethers/lib/utils";
4
+ import { random } from "lodash";
5
+ import { Address, UnixTimestamp, signature } from "@solana/kit";
6
+ import { Idl } from "@coral-xyz/anchor";
7
+ import { SvmSpokeClient } from "@across-protocol/contracts";
8
+ import { CHAIN_IDs } from "@across-protocol/constants";
9
+
10
+ import { MockSolanaRpcFactory } from "../../providers/mocks";
11
+ import {
12
+ SVM_DEFAULT_ADDRESS,
13
+ EventName,
14
+ EventWithData,
15
+ SvmCpiEventsClient,
16
+ SVMEventNames,
17
+ SVMProvider,
18
+ getRandomSvmAddress,
19
+ } from "../../arch/svm";
20
+ import { bnZero, bnOne, bs58, getCurrentTime, randomAddress, EvmAddress } from "../../utils";
21
+ import { FillType } from "../../interfaces";
22
+
23
+ export class MockSvmCpiEventsClient extends SvmCpiEventsClient {
24
+ private events: Record<EventName, EventWithData[]> = {} as Record<EventName, EventWithData[]>;
25
+ private slotHeight: bigint = BigInt(0);
26
+ public chainId: number;
27
+ public minBlockRange = 10;
28
+ public numberOfDeposits = bnZero;
29
+
30
+ constructor(programId = SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS, chainId = CHAIN_IDs.SOLANA) {
31
+ super(null as unknown as SVMProvider, programId as Address, null as unknown as Address, null as unknown as Idl);
32
+ this.chainId = chainId;
33
+ }
34
+
35
+ public setSlotHeight(slotHeight: bigint) {
36
+ this.slotHeight = slotHeight;
37
+ }
38
+
39
+ public setEvents(events: EventWithData[]) {
40
+ for (const event of events) {
41
+ this.events[event.name as EventName] ??= [];
42
+ this.events[event.name as EventName].push(event);
43
+ }
44
+ const maxSlot = Math.max(...events.map((event) => Number(event.slot)));
45
+ this.setSlotHeight(BigInt(maxSlot) + BigInt(1));
46
+ }
47
+
48
+ public clearEvents(name?: EventName) {
49
+ if (name) {
50
+ this.events[name] = [];
51
+ } else {
52
+ this.events = {} as Record<EventName, EventWithData[]>;
53
+ }
54
+ }
55
+
56
+ public override queryEvents(eventName: EventName, fromSlot?: bigint, toSlot?: bigint): Promise<EventWithData[]> {
57
+ return Promise.resolve(
58
+ this.events[eventName]?.filter(
59
+ (event) => (!fromSlot || event.slot >= fromSlot) && (!toSlot || event.slot <= toSlot)
60
+ ) ?? []
61
+ );
62
+ }
63
+
64
+ public override getRpc(): SVMProvider {
65
+ const client = new MockSolanaRpcFactory("https://test.com", 1234567890);
66
+ client.setResult("getSlot", [], this.slotHeight);
67
+ return client.createRpcClient();
68
+ }
69
+
70
+ public deposit(deposit: SvmSpokeClient.FundsDeposited & Partial<EventWithData>): EventWithData {
71
+ const { slot } = deposit;
72
+ let { depositId, destinationChainId, inputAmount, outputAmount } = deposit;
73
+ depositId ??= arrayify(hexZeroPad(hexlify(random(1, 100_000, false)), 32));
74
+ this.numberOfDeposits = this.numberOfDeposits.add(bnOne);
75
+
76
+ destinationChainId ??= BigInt(random(1, 42161, false));
77
+ const depositor = deposit.depositor ?? getRandomSvmAddress();
78
+ const recipient = deposit.recipient ?? EvmAddress.from(randomAddress()).toBase58();
79
+ const inputToken = deposit.inputToken ?? getRandomSvmAddress();
80
+ const outputToken = deposit.outputToken ?? EvmAddress.from(randomAddress()).toBase58();
81
+ inputAmount ??= BigInt(random(1, 1000, false));
82
+ outputAmount ??= (inputAmount * BigInt(95)) / BigInt(100);
83
+ const message = deposit.message ?? new Uint8Array(32);
84
+ const quoteTimestamp = deposit.quoteTimestamp ?? getCurrentTime();
85
+
86
+ const args = {
87
+ depositId,
88
+ destinationChainId,
89
+ depositor,
90
+ recipient,
91
+ inputToken,
92
+ inputAmount,
93
+ outputToken,
94
+ outputAmount,
95
+ quoteTimestamp,
96
+ fillDeadline: deposit.fillDeadline ?? quoteTimestamp + 3600,
97
+ exclusiveRelayer: deposit.exclusiveRelayer ?? SVM_DEFAULT_ADDRESS,
98
+ exclusivityDeadline: deposit.exclusivityDeadline ?? quoteTimestamp + 600,
99
+ message,
100
+ };
101
+
102
+ return this.generateEvent({
103
+ event: SVMEventNames.FundsDeposited,
104
+ address: this.getProgramAddress(),
105
+ args,
106
+ slot,
107
+ });
108
+ }
109
+
110
+ public fillRelay(fill: SvmSpokeClient.FilledRelay & Partial<EventWithData>): EventWithData {
111
+ const { slot } = fill;
112
+ let { depositId, inputAmount, outputAmount, fillDeadline } = fill;
113
+ depositId ??= arrayify(hexZeroPad(hexlify(random(1, 100_000, false)), 32));
114
+ inputAmount ??= BigInt(random(1, 1000, false));
115
+ outputAmount ??= (inputAmount * BigInt(95)) / BigInt(100);
116
+ fillDeadline ??= getCurrentTime() + 60;
117
+
118
+ const depositor = fill.depositor ?? EvmAddress.from(randomAddress()).toBase58();
119
+ const recipient = fill.recipient ?? getRandomSvmAddress();
120
+ const inputToken = fill.inputToken ?? EvmAddress.from(randomAddress()).toBase58();
121
+ const outputToken = fill.outputToken ?? getRandomSvmAddress();
122
+ const messageHash = fill.messageHash ?? new Uint8Array(32);
123
+
124
+ const relayExecutionInfo = {
125
+ updatedRecipient: fill.relayExecutionInfo?.updatedRecipient ?? recipient,
126
+ updatedOutputAmount: fill.relayExecutionInfo?.updatedOutputAmount ?? outputAmount,
127
+ fillType: fill.relayExecutionInfo?.fillType ?? FillType.FastFill,
128
+ updatedMessageHash: fill.relayExecutionInfo?.updatedMessageHash ?? messageHash,
129
+ };
130
+
131
+ const args = {
132
+ depositId,
133
+ originChainId: fill.originChainId ?? BigInt(random(1, 42161, false)),
134
+ depositor,
135
+ recipient,
136
+ inputToken,
137
+ inputAmount,
138
+ outputToken,
139
+ outputAmount,
140
+ fillDeadline,
141
+ exclusiveRelayer: fill.exclusiveRelayer ?? SVM_DEFAULT_ADDRESS,
142
+ exclusivityDeadline: fill.exclusivityDeadline ?? fillDeadline,
143
+ relayer: fill.relayer ?? getRandomSvmAddress(),
144
+ messageHash,
145
+ relayExecutionInfo,
146
+ };
147
+
148
+ return this.generateEvent({
149
+ event: SVMEventNames.FilledRelay,
150
+ address: this.getProgramAddress(),
151
+ args,
152
+ slot,
153
+ });
154
+ }
155
+
156
+ public requestSlowFill(slowFillRequest: SvmSpokeClient.RequestedSlowFill & Partial<EventWithData>): EventWithData {
157
+ const { slot } = slowFillRequest;
158
+ let { depositId, originChainId } = slowFillRequest;
159
+ depositId ??= Uint8Array.from([random(1, 100_000, false)]);
160
+ originChainId ??= BigInt(random(1, 42161, false));
161
+ const depositor = slowFillRequest.depositor ?? EvmAddress.from(randomAddress()).toBase58();
162
+ const recipient = slowFillRequest.recipient ?? getRandomSvmAddress();
163
+ const inputToken = slowFillRequest.inputToken ?? EvmAddress.from(randomAddress()).toBase58();
164
+ const outputToken = slowFillRequest.outputToken ?? getRandomSvmAddress();
165
+
166
+ const args = {
167
+ ...slowFillRequest,
168
+ depositId,
169
+ originChainId,
170
+ depositor,
171
+ recipient,
172
+ inputToken,
173
+ outputToken,
174
+ inputAmount: slowFillRequest.inputAmount ?? BigInt(random(1, 1000, false)),
175
+ outputAmount: slowFillRequest.outputAmount ?? slowFillRequest.inputAmount ?? BigInt(random(1, 1000, false)),
176
+ exclusiveRelayer: slowFillRequest.exclusiveRelayer ?? SVM_DEFAULT_ADDRESS,
177
+ };
178
+
179
+ return this.generateEvent({
180
+ event: SVMEventNames.RequestedSlowFill,
181
+ address: this.getProgramAddress(),
182
+ args,
183
+ slot,
184
+ });
185
+ }
186
+
187
+ protected generateEvent(inputs: {
188
+ address: Address;
189
+ event: EventName;
190
+ args: Record<string, unknown>;
191
+ slot?: bigint;
192
+ }) {
193
+ const { address, event, args } = inputs;
194
+ let { slot } = inputs;
195
+
196
+ const randomSlotWithinRange = () =>
197
+ random(Number(this.slotHeight) + 1, Number(this.slotHeight) + this.minBlockRange, false);
198
+
199
+ // Increment the slot number by at least 1, by default. The caller may override
200
+ // to force the same slot number to be used, but never a previous slot number.
201
+ slot ??= BigInt(randomSlotWithinRange());
202
+ assert(slot >= this.slotHeight, `${slot} < ${this.slotHeight}`);
203
+ this.slotHeight = slot;
204
+
205
+ const generatedEvent = {
206
+ name: event,
207
+ slot,
208
+ signature: signature(
209
+ bs58.encode(
210
+ Uint8Array.from(
211
+ createHash("sha512")
212
+ .update(`Across-${event}-${slot}-${random(1, 100_000)}`)
213
+ .digest()
214
+ )
215
+ )
216
+ ),
217
+ program: address,
218
+ data: args,
219
+ confirmationStatus: "finalized",
220
+ blockTime: BigInt(new Date().getTime()) as UnixTimestamp,
221
+ };
222
+
223
+ this.setEvents([generatedEvent]);
224
+ return generatedEvent;
225
+ }
226
+ }
@@ -0,0 +1,119 @@
1
+ import winston from "winston";
2
+ import { SvmSpokeClient } from "@across-protocol/contracts";
3
+ import { Address } from "@solana/kit";
4
+ import { DepositWithBlock, RelayerRefundExecution, SortableEvent, SlowFillLeaf, Log } from "../../interfaces";
5
+ import { getCurrentTime, bnZero, MakeOptional, EventSearchConfig } from "../../utils";
6
+ import { SpokePoolUpdate, SvmSpokePoolClient } from "../SpokePoolClient";
7
+ import { HubPoolClient } from "../HubPoolClient";
8
+ import { EventOverrides } from "./MockEvents";
9
+ import { AcrossConfigStoreClient } from "../AcrossConfigStoreClient";
10
+ import { MockSvmCpiEventsClient } from "./MockSvmCpiEventsClient";
11
+ import { EventWithData, SvmCpiEventsClient, SVMEventNames, unwrapEventData } from "../../arch/svm";
12
+
13
+ // This class replaces internal SpokePoolClient functionality, enabling
14
+ // the user to bypass on-chain queries and inject events directly.
15
+ export class MockSvmSpokePoolClient extends SvmSpokePoolClient {
16
+ public mockEventsClient: MockSvmCpiEventsClient;
17
+ private destinationTokenForChainOverride: Record<number, string> = {};
18
+
19
+ constructor(
20
+ logger: winston.Logger,
21
+ chainId: number,
22
+ programId = SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS,
23
+ deploymentBlock: number = 1,
24
+ eventSearchConfig: MakeOptional<EventSearchConfig, "to"> = { from: 0, maxLookBack: 0 },
25
+ opts: { hubPoolClient: HubPoolClient | null } = { hubPoolClient: null }
26
+ ) {
27
+ super(
28
+ logger,
29
+ opts.hubPoolClient,
30
+ chainId,
31
+ BigInt(deploymentBlock),
32
+ eventSearchConfig,
33
+ null as unknown as SvmCpiEventsClient,
34
+ programId,
35
+ null as unknown as Address
36
+ );
37
+ this.mockEventsClient = new MockSvmCpiEventsClient();
38
+ this.latestHeightSearched = deploymentBlock;
39
+ }
40
+
41
+ setConfigStoreClient(configStore?: AcrossConfigStoreClient): void {
42
+ this.configStoreClient = configStore;
43
+ }
44
+
45
+ setDestinationTokenForChain(chainId: number, token: string): void {
46
+ this.destinationTokenForChainOverride[chainId] = token;
47
+ }
48
+
49
+ getDestinationTokenForDeposit(deposit: DepositWithBlock): string {
50
+ return this.destinationTokenForChainOverride[deposit.originChainId] ?? super.getDestinationTokenForDeposit(deposit);
51
+ }
52
+
53
+ setLatestBlockNumber(blockNumber: number): void {
54
+ this.latestHeightSearched = blockNumber;
55
+ }
56
+
57
+ async _update(eventsToQuery: string[]): Promise<SpokePoolUpdate> {
58
+ const from = this.eventSearchConfig.from ?? this.deploymentBlock;
59
+ const to = this.eventSearchConfig.to ? BigInt(this.eventSearchConfig.to) : undefined;
60
+
61
+ // Get events from the mock event client.
62
+ const events: EventWithData[][] = await Promise.all(
63
+ eventsToQuery.map((eventName) => this.mockEventsClient.queryEvents(eventName as SVMEventNames, BigInt(from), to))
64
+ );
65
+
66
+ const eventsWithBlockNumber = events.map((eventList) =>
67
+ eventList.map((event) => {
68
+ return {
69
+ txnRef: event.signature,
70
+ blockNumber: Number(event.slot),
71
+ txnIndex: 0,
72
+ logIndex: 0,
73
+ ...(unwrapEventData(event.data) as Record<string, unknown>),
74
+ };
75
+ })
76
+ );
77
+
78
+ return Promise.resolve({
79
+ success: true,
80
+ firstDepositId: bnZero,
81
+ currentTime: getCurrentTime(),
82
+ events: eventsWithBlockNumber,
83
+ searchEndBlock: this.eventSearchConfig.to || this.latestHeightSearched,
84
+ });
85
+ }
86
+
87
+ deposit(deposit: SvmSpokeClient.FundsDeposited & Partial<EventWithData>): EventWithData {
88
+ return this.mockEventsClient.deposit(deposit);
89
+ }
90
+
91
+ fillRelay(fill: SvmSpokeClient.FilledRelay & Partial<EventWithData>): EventWithData {
92
+ return this.mockEventsClient.fillRelay(fill);
93
+ }
94
+
95
+ requestSlowFill(request: SvmSpokeClient.RequestedSlowFill & Partial<EventWithData>): EventWithData {
96
+ return this.mockEventsClient.requestSlowFill(request);
97
+ }
98
+
99
+ setTokensBridged(_tokensBridged: SvmSpokeClient.TokensBridged & Partial<EventWithData>): EventWithData {
100
+ throw new Error("MockSvmSpokePoolClient#setTokensBridged not implemented");
101
+ }
102
+
103
+ executeSlowRelayLeaf(_leaf: Omit<SlowFillLeaf, "messageHash">): Log {
104
+ throw new Error("MockSvmSpokePoolClient#executeV3SlowRelayLeaf not implemented");
105
+ }
106
+
107
+ executeRelayerRefundLeaf(_refund: RelayerRefundExecution & Partial<SortableEvent>): Log {
108
+ throw new Error("MockSvmSpokePoolClient#executeRelayerRefundLeaf not implemented");
109
+ }
110
+
111
+ setEnableRoute(
112
+ _originToken: string,
113
+ _destinationChainId: number,
114
+ _enabled: boolean,
115
+ _overrides: EventOverrides = {}
116
+ ): Log {
117
+ throw new Error("MockSvmSpokePoolClient#setEnableRoute not implemented");
118
+ }
119
+ }
@@ -1,3 +1,5 @@
1
1
  export * from "./MockConfigStoreClient";
2
2
  export * from "./MockHubPoolClient";
3
3
  export * from "./MockSpokePoolClient";
4
+ export * from "./MockSvmCpiEventsClient";
5
+ export * from "./MockSvmSpokePoolClient";
package/src/constants.ts CHANGED
@@ -54,6 +54,7 @@ export const DEFAULT_CACHING_TTL = 60 * 60 * 24 * 7 * 2; // 2 Weeks
54
54
  export const DEFAULT_CACHING_SAFE_LAG = 60 * 60; // 1 hour
55
55
 
56
56
  export const DEFAULT_SIMULATED_RELAYER_ADDRESS = "0x07aE8551Be970cB1cCa11Dd7a11F47Ae82e70E67";
57
+ export const DEFAULT_SIMULATED_RELAYER_ADDRESS_SVM = "FmMK62wrtWVb5SVoTZftSCGw3nEDA79hDbZNTRnC1R6t";
57
58
  export const DEFAULT_SIMULATED_RELAYER_ADDRESS_TEST = "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D"; // Görli, ...
58
59
 
59
60
  export const DEFAULT_ARWEAVE_STORAGE_ADDRESS = "Z6hjBM8FHu90lYWB8o5jR1dfX92FlV2WBaND9xgp8Lg";
@@ -1,6 +1,6 @@
1
1
  import { providers } from "ethers";
2
2
  import { bnOne } from "../../utils";
3
- import { GasPriceEstimate } from "../types";
3
+ import { EvmGasPriceEstimate } from "../types";
4
4
  import * as ethereum from "./ethereum";
5
5
  import { GasPriceEstimateOptions } from "../oracle";
6
6
 
@@ -16,7 +16,10 @@ import { GasPriceEstimateOptions } from "../oracle";
16
16
  * function.
17
17
  * @returns GasPriceEstimate
18
18
  */
19
- export async function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate> {
19
+ export async function eip1559(
20
+ provider: providers.Provider,
21
+ opts: GasPriceEstimateOptions
22
+ ): Promise<EvmGasPriceEstimate> {
20
23
  const { maxFeePerGas: _maxFeePerGas, maxPriorityFeePerGas } = await ethereum.eip1559(provider, opts);
21
24
 
22
25
  // eip1559() sets maxFeePerGas = lastBaseFeePerGas + maxPriorityFeePerGas, so back out priority fee.
@@ -1,7 +1,7 @@
1
1
  import assert from "assert";
2
2
  import { providers } from "ethers";
3
3
  import { BigNumber, bnZero, fixedPointAdjustment, getNetworkName, parseUnits } from "../../utils";
4
- import { GasPriceEstimate } from "../types";
4
+ import { EvmGasPriceEstimate } from "../types";
5
5
  import { gasPriceError } from "../util";
6
6
  import { GasPriceEstimateOptions } from "../oracle";
7
7
 
@@ -13,7 +13,7 @@ import { GasPriceEstimateOptions } from "../oracle";
13
13
  * @param priorityFeeMultiplier Amount to multiply priority fee or unused for legacy gas pricing.
14
14
  * @returns Promise of gas price estimate object.
15
15
  */
16
- export function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate> {
16
+ export function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<EvmGasPriceEstimate> {
17
17
  return eip1559Raw(provider, opts.chainId, opts.baseFeeMultiplier, opts.priorityFeeMultiplier);
18
18
  }
19
19
 
@@ -29,7 +29,7 @@ export async function eip1559Raw(
29
29
  chainId: number,
30
30
  baseFeeMultiplier: BigNumber,
31
31
  priorityFeeMultiplier: BigNumber
32
- ): Promise<GasPriceEstimate> {
32
+ ): Promise<EvmGasPriceEstimate> {
33
33
  const [{ baseFeePerGas }, _maxPriorityFeePerGas] = await Promise.all([
34
34
  provider.getBlock("pending"),
35
35
  (provider as providers.JsonRpcProvider).send("eth_maxPriorityFeePerGas", []),
@@ -54,7 +54,10 @@ export async function eip1559Raw(
54
54
  * @dev Its recommended to use the eip1559Raw method over this one where possible as it will be more accurate.
55
55
  * @returns GasPriceEstimate
56
56
  */
57
- export async function legacy(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate> {
57
+ export async function legacy(
58
+ provider: providers.Provider,
59
+ opts: GasPriceEstimateOptions
60
+ ): Promise<EvmGasPriceEstimate> {
58
61
  const { chainId, baseFeeMultiplier } = opts;
59
62
  const gasPrice = await provider.getGasPrice();
60
63
 
@@ -1,3 +1,4 @@
1
+ import { PopulatedTransaction } from "ethers";
1
2
  import { Address, Hex, PublicClient } from "viem";
2
3
  import { estimateGas } from "viem/linea";
3
4
  import { DEFAULT_SIMULATED_RELAYER_ADDRESS as account } from "../../constants";
@@ -26,7 +27,8 @@ export async function eip1559(
26
27
  provider: PublicClient,
27
28
  opts: GasPriceEstimateOptions
28
29
  ): Promise<InternalGasPriceEstimate> {
29
- const { unsignedTx, priorityFeeMultiplier } = opts;
30
+ const { unsignedTx: _unsignedTx, priorityFeeMultiplier } = opts;
31
+ const unsignedTx = _unsignedTx as PopulatedTransaction; // Cast the opaque unsignedTx type to an ethers PopulatedTransaction.
30
32
  const { baseFeePerGas, priorityFeePerGas: _priorityFeePerGas } = await estimateGas(provider, {
31
33
  account: (unsignedTx?.from as Address) ?? account,
32
34
  to: (unsignedTx?.to as Address) ?? account,
@@ -2,7 +2,7 @@ import { providers } from "ethers";
2
2
  import { BaseHTTPAdapter, BaseHTTPAdapterArgs } from "../../priceClient/adapters/baseAdapter";
3
3
  import { BigNumber, bnZero, fixedPointAdjustment, isDefined, parseUnits } from "../../utils";
4
4
  import { CHAIN_IDs } from "../../constants";
5
- import { GasPriceEstimate } from "../types";
5
+ import { EvmGasPriceEstimate } from "../types";
6
6
  import { gasPriceError } from "../util";
7
7
  import { eip1559 } from "./ethereum";
8
8
  import { GasPriceEstimateOptions } from "../oracle";
@@ -38,7 +38,7 @@ export class PolygonGasStation extends BaseHTTPAdapter {
38
38
  this.chainId = chainId;
39
39
  }
40
40
 
41
- async getFeeData(strategy: "safeLow" | "standard" | "fast" = "fast"): Promise<GasPriceEstimate> {
41
+ async getFeeData(strategy: "safeLow" | "standard" | "fast" = "fast"): Promise<EvmGasPriceEstimate> {
42
42
  const gas = await this.query("v2", {});
43
43
 
44
44
  const gasPrice = (gas as GasStationV2Response)?.[strategy];
@@ -69,7 +69,7 @@ export class PolygonGasStation extends BaseHTTPAdapter {
69
69
  }
70
70
 
71
71
  class MockRevertingPolygonGasStation extends PolygonGasStation {
72
- getFeeData(): Promise<GasPriceEstimate> {
72
+ getFeeData(): Promise<EvmGasPriceEstimate> {
73
73
  throw new Error();
74
74
  }
75
75
  }
@@ -78,7 +78,7 @@ export const MockPolygonGasStationBaseFee = () => parseUnits("12", 9);
78
78
  export const MockPolygonGasStationPriorityFee = () => parseUnits("1", 9);
79
79
 
80
80
  class MockPolygonGasStation extends PolygonGasStation {
81
- getFeeData(): Promise<GasPriceEstimate> {
81
+ getFeeData(): Promise<EvmGasPriceEstimate> {
82
82
  return Promise.resolve({
83
83
  maxPriorityFeePerGas: MockPolygonGasStationPriorityFee(),
84
84
  maxFeePerGas: MockPolygonGasStationBaseFee().add(MockPolygonGasStationPriorityFee()),
@@ -90,12 +90,12 @@ class MockPolygonGasStation extends PolygonGasStation {
90
90
  * @notice Returns the gas price suggested by the Polygon GasStation API or reconstructs it using
91
91
  * the eip1559() method as a fallback.
92
92
  * @param provider Ethers Provider.
93
- * @returns GasPriceEstimate
93
+ * @returns EvmGasPriceEstimate
94
94
  */
95
95
  export async function gasStation(
96
96
  provider: providers.Provider,
97
97
  opts: GasPriceEstimateOptions
98
- ): Promise<GasPriceEstimate> {
98
+ ): Promise<EvmGasPriceEstimate> {
99
99
  const { chainId, baseFeeMultiplier, priorityFeeMultiplier } = opts;
100
100
  let gasStation: PolygonGasStation;
101
101
  if (process.env.TEST_POLYGON_GAS_STATION === "true") {
@@ -0,0 +1,45 @@
1
+ import { SVMProvider } from "../../arch/svm";
2
+ import { toBN, dedupArray, parseUnits } from "../../utils";
3
+ import { GasPriceEstimate } from "../types";
4
+ import { GasPriceEstimateOptions } from "../oracle";
5
+ import { CompilableTransactionMessage, TransactionMessageBytesBase64, compileTransaction } from "@solana/kit";
6
+
7
+ /**
8
+ * @notice Returns result of getFeeForMessage and getRecentPrioritizationFees RPC calls.
9
+ * @returns GasPriceEstimate
10
+ */
11
+ export async function messageFee(provider: SVMProvider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate> {
12
+ const { unsignedTx: _unsignedTx } = opts;
13
+
14
+ // Cast the opaque unsignedTx type to a solana-kit CompilableTransactionMessage.
15
+ const unsignedTx = _unsignedTx as CompilableTransactionMessage;
16
+ const compiledTransaction = compileTransaction(unsignedTx);
17
+
18
+ // Get this base fee. This should result in LAMPORTS_PER_SIGNATURE * nSignatures.
19
+ const encodedTransactionMessage = Buffer.from(compiledTransaction.messageBytes).toString(
20
+ "base64"
21
+ ) as TransactionMessageBytesBase64;
22
+ const baseFeeResponse = await provider.getFeeForMessage(encodedTransactionMessage).send();
23
+
24
+ // Get the priority fee by calling `getRecentPrioritzationFees` on all the addresses in the transaction's instruction array.
25
+ const instructionAddresses = dedupArray(unsignedTx.instructions.map((instruction) => instruction.programAddress));
26
+ const recentPriorityFees = await provider.getRecentPrioritizationFees(instructionAddresses).send();
27
+
28
+ // Take the most recent 25 slots and find the average of the nonzero priority fees.
29
+ const nonzeroPrioritizationFees = recentPriorityFees
30
+ .slice(125)
31
+ .map((value) => value.prioritizationFee)
32
+ .filter((fee) => fee > 0);
33
+ const totalPrioritizationFees = nonzeroPrioritizationFees.reduce((acc, fee) => acc + fee, BigInt(0));
34
+
35
+ // Optionally impose a minimum priority fee, denoted in microLamports/computeUnit.
36
+ const flooredPriorityFeePerGas = parseUnits(process.env[`MIN_PRIORITY_FEE_PER_GAS_${opts.chainId}`] || "0", 6);
37
+ let microLamportsPerComputeUnit = toBN(totalPrioritizationFees / BigInt(nonzeroPrioritizationFees.length));
38
+ if (microLamportsPerComputeUnit.lt(flooredPriorityFeePerGas)) {
39
+ microLamportsPerComputeUnit = flooredPriorityFeePerGas;
40
+ }
41
+ return {
42
+ baseFee: toBN(baseFeeResponse!.value!),
43
+ microLamportsPerComputeUnit,
44
+ };
45
+ }
@@ -1,2 +1,2 @@
1
1
  export { getGasPriceEstimate } from "./oracle";
2
- export { GasPriceEstimate } from "./types";
2
+ export { GasPriceEstimate, EvmGasPriceEstimate, SvmGasPriceEstimate } from "./types";
@@ -1,14 +1,16 @@
1
1
  import assert from "assert";
2
2
  import { Transport } from "viem";
3
- import { PopulatedTransaction, providers } from "ethers";
3
+ import { providers } from "ethers";
4
4
  import { CHAIN_IDs } from "../constants";
5
5
  import { BigNumber, chainIsOPStack, fixedPointAdjustment, toBNWei } from "../utils";
6
+ import { SVMProvider as SolanaProvider } from "../arch/svm";
6
7
  import { GasPriceEstimate } from "./types";
7
8
  import { getPublicClient } from "./util";
8
9
  import * as arbitrum from "./adapters/arbitrum";
9
10
  import * as ethereum from "./adapters/ethereum";
10
11
  import * as polygon from "./adapters/polygon";
11
12
  import * as lineaViem from "./adapters/linea-viem";
13
+ import * as solana from "./adapters/solana";
12
14
 
13
15
  export interface GasPriceEstimateOptions {
14
16
  // baseFeeMultiplier Multiplier applied to base fee for EIP1559 gas prices (or total fee for legacy).
@@ -19,8 +21,8 @@ export interface GasPriceEstimateOptions {
19
21
  legacyFallback: boolean;
20
22
  // chainId The chain ID to query for gas prices. If omitted can be inferred by provider.
21
23
  chainId: number;
22
- // unsignedTx The unsigned transaction used for simulation by Linea's Viem provider to produce the priority gas fee.
23
- unsignedTx?: PopulatedTransaction;
24
+ // unsignedTx The unsigned transaction used for simulation by Linea's Viem provider to produce the priority gas fee, or alternatively, by Solana's provider to determine the base/priority fee.
25
+ unsignedTx?: unknown;
24
26
  // transport Viem Transport object to use for querying gas fees used for testing.
25
27
  transport?: Transport;
26
28
  }
@@ -39,7 +41,7 @@ const VIEM_CHAINS = [CHAIN_IDs.LINEA];
39
41
  * @returns An object of type GasPriceEstimate.
40
42
  */
41
43
  export async function getGasPriceEstimate(
42
- provider: providers.Provider,
44
+ provider: providers.Provider | SolanaProvider,
43
45
  opts: Partial<GasPriceEstimateOptions> = {}
44
46
  ): Promise<GasPriceEstimate> {
45
47
  const baseFeeMultiplier = opts.baseFeeMultiplier ?? toBNWei("1");
@@ -53,6 +55,20 @@ export async function getGasPriceEstimate(
53
55
  `Require 1.0 < priority fee multiplier (${priorityFeeMultiplier}) <= 5.0 for a total gas multiplier within [+1.0, +5.0]`
54
56
  );
55
57
 
58
+ // Exit here if we need to estimate on Solana.
59
+ if (!(provider instanceof providers.Provider)) {
60
+ const optsWithDefaults: GasPriceEstimateOptions = {
61
+ ...GAS_PRICE_ESTIMATE_DEFAULTS,
62
+ baseFeeMultiplier,
63
+ priorityFeeMultiplier,
64
+ ...opts,
65
+ chainId: opts.chainId ?? CHAIN_IDs.SOLANA,
66
+ };
67
+ return solana.messageFee(provider, optsWithDefaults);
68
+ }
69
+
70
+ // Cast the provider to an ethers provider, which should be given to the oracle when querying an EVM network.
71
+ provider = provider as providers.Provider;
56
72
  const chainId = opts.chainId ?? (await provider.getNetwork()).chainId;
57
73
  const optsWithDefaults: GasPriceEstimateOptions = {
58
74
  ...GAS_PRICE_ESTIMATE_DEFAULTS,
@@ -2,12 +2,18 @@ import { type Chain, type Transport, PublicClient, FeeValuesEIP1559 } from "viem
2
2
  import { BigNumber } from "../utils";
3
3
 
4
4
  export type InternalGasPriceEstimate = FeeValuesEIP1559;
5
+ export type GasPriceEstimate = EvmGasPriceEstimate | SvmGasPriceEstimate;
5
6
 
6
- export type GasPriceEstimate = {
7
+ export type EvmGasPriceEstimate = {
7
8
  maxFeePerGas: BigNumber;
8
9
  maxPriorityFeePerGas: BigNumber;
9
10
  };
10
11
 
12
+ export type SvmGasPriceEstimate = {
13
+ baseFee: BigNumber;
14
+ microLamportsPerComputeUnit: BigNumber;
15
+ };
16
+
11
17
  export interface GasPriceFeed {
12
18
  (provider: PublicClient<Transport, Chain>, chainId: number): Promise<InternalGasPriceEstimate>;
13
19
  }
package/src/index.ts CHANGED
@@ -16,4 +16,3 @@ export * as clients from "./clients";
16
16
  export * as typechain from "./typechain";
17
17
  export * as caching from "./caching";
18
18
  export * as providers from "./providers";
19
- export * as svm from "./svm";
@@ -37,6 +37,10 @@ export interface DepositWithBlock extends Deposit, SortableEvent {
37
37
  quoteBlockNumber: number;
38
38
  }
39
39
 
40
+ export interface DepositWithTime extends Deposit, SortableEvent {
41
+ depositTimestamp: number;
42
+ }
43
+
40
44
  export enum FillStatus {
41
45
  Unfilled = 0,
42
46
  RequestedSlowFill,
@@ -66,7 +70,17 @@ export interface Fill extends Omit<RelayData, "message"> {
66
70
  }
67
71
 
68
72
  export interface FillWithBlock extends Fill, SortableEvent {}
73
+ export interface FillWithTime extends Fill, SortableEvent {
74
+ fillTimestamp: number;
75
+ }
76
+
77
+ export interface EnabledDepositRoute {
78
+ originToken: string;
79
+ destinationChainId: number;
80
+ enabled: boolean;
81
+ }
69
82
 
83
+ export interface EnabledDepositRouteWithBlock extends EnabledDepositRoute, SortableEvent {}
70
84
  export interface SpeedUp {
71
85
  depositor: string;
72
86
  depositorSignature: string;
@@ -5,5 +5,5 @@ export * from "./speedProvider";
5
5
  export * from "./constants";
6
6
  export * from "./types";
7
7
  export * from "./utils";
8
- export * as mocks from "./mockProvider";
8
+ export * from "./mocks";
9
9
  export * from "./solana";