@across-protocol/sdk 4.1.63-beta.3 → 4.1.64-alpha.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 (510) hide show
  1. package/dist/cjs/arch/evm/SpokeUtils.d.ts +1 -1
  2. package/dist/cjs/arch/evm/SpokeUtils.js +5 -6
  3. package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
  4. package/dist/cjs/arch/evm/index.d.ts +0 -1
  5. package/dist/cjs/arch/evm/index.js +0 -1
  6. package/dist/cjs/arch/evm/index.js.map +1 -1
  7. package/dist/cjs/arch/svm/index.d.ts +1 -5
  8. package/dist/cjs/arch/svm/index.js +2 -6
  9. package/dist/cjs/arch/svm/index.js.map +1 -1
  10. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
  11. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +7 -7
  12. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  13. package/dist/cjs/clients/BaseAbstractClient.d.ts +5 -6
  14. package/dist/cjs/clients/BaseAbstractClient.js +19 -30
  15. package/dist/cjs/clients/BaseAbstractClient.js.map +1 -1
  16. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +11 -15
  17. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  18. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +1 -1
  19. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  20. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +114 -114
  21. package/dist/cjs/clients/HubPoolClient.d.ts +3 -4
  22. package/dist/cjs/clients/HubPoolClient.js +17 -18
  23. package/dist/cjs/clients/HubPoolClient.js.map +1 -1
  24. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
  25. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +20 -23
  26. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  27. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +5 -5
  28. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +57 -54
  29. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  30. package/dist/cjs/clients/SpokePoolClient/index.d.ts +0 -3
  31. package/dist/cjs/clients/SpokePoolClient/index.js +1 -8
  32. package/dist/cjs/clients/SpokePoolClient/index.js.map +1 -1
  33. package/dist/cjs/clients/index.d.ts +1 -1
  34. package/dist/cjs/clients/index.js +1 -2
  35. package/dist/cjs/clients/index.js.map +1 -1
  36. package/dist/cjs/clients/mocks/MockConfigStoreClient.d.ts +1 -1
  37. package/dist/cjs/clients/mocks/MockConfigStoreClient.js +2 -2
  38. package/dist/cjs/clients/mocks/MockConfigStoreClient.js.map +1 -1
  39. package/dist/cjs/clients/mocks/MockHubPoolClient.js +2 -2
  40. package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
  41. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +4 -7
  42. package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
  43. package/dist/cjs/clients/mocks/index.d.ts +0 -2
  44. package/dist/cjs/clients/mocks/index.js +0 -2
  45. package/dist/cjs/clients/mocks/index.js.map +1 -1
  46. package/dist/cjs/constants.d.ts +0 -1
  47. package/dist/cjs/constants.js +1 -2
  48. package/dist/cjs/constants.js.map +1 -1
  49. package/dist/cjs/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
  50. package/dist/cjs/gasPriceOracle/adapters/arbitrum.js.map +1 -1
  51. package/dist/cjs/gasPriceOracle/adapters/ethereum.d.ts +4 -4
  52. package/dist/cjs/gasPriceOracle/adapters/ethereum.js.map +1 -1
  53. package/dist/cjs/gasPriceOracle/adapters/linea-viem.js +2 -3
  54. package/dist/cjs/gasPriceOracle/adapters/linea-viem.js.map +1 -1
  55. package/dist/cjs/gasPriceOracle/adapters/polygon.d.ts +3 -3
  56. package/dist/cjs/gasPriceOracle/index.d.ts +1 -1
  57. package/dist/cjs/gasPriceOracle/oracle.d.ts +3 -4
  58. package/dist/cjs/gasPriceOracle/oracle.js +9 -16
  59. package/dist/cjs/gasPriceOracle/oracle.js.map +1 -1
  60. package/dist/cjs/gasPriceOracle/types.d.ts +1 -6
  61. package/dist/cjs/index.d.ts +1 -0
  62. package/dist/cjs/index.js +2 -1
  63. package/dist/cjs/index.js.map +1 -1
  64. package/dist/cjs/interfaces/SpokePool.d.ts +0 -13
  65. package/dist/cjs/interfaces/SpokePool.js.map +1 -1
  66. package/dist/cjs/providers/index.d.ts +1 -1
  67. package/dist/cjs/providers/index.js +2 -1
  68. package/dist/cjs/providers/index.js.map +1 -1
  69. package/dist/cjs/providers/{mocks/mockEthersProvider.js → mockProvider.js} +2 -2
  70. package/dist/cjs/providers/mockProvider.js.map +1 -0
  71. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
  72. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +8 -10
  73. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  74. package/dist/cjs/relayFeeCalculator/chain-queries/factory.d.ts +2 -4
  75. package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +2 -8
  76. package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -1
  77. package/dist/cjs/relayFeeCalculator/chain-queries/index.d.ts +0 -1
  78. package/dist/cjs/relayFeeCalculator/chain-queries/index.js +0 -1
  79. package/dist/cjs/relayFeeCalculator/chain-queries/index.js.map +1 -1
  80. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +0 -2
  81. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +4 -10
  82. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  83. package/dist/cjs/svm/eventsClient.d.ts +15 -0
  84. package/dist/cjs/svm/eventsClient.js +157 -0
  85. package/dist/cjs/svm/eventsClient.js.map +1 -0
  86. package/dist/cjs/svm/index.d.ts +3 -0
  87. package/dist/cjs/svm/index.js +8 -0
  88. package/dist/cjs/svm/index.js.map +1 -0
  89. package/dist/cjs/{arch/svm → svm}/types.d.ts +4 -9
  90. package/dist/cjs/svm/types.js.map +1 -0
  91. package/dist/cjs/svm/utils/events.d.ts +8 -0
  92. package/dist/cjs/svm/utils/events.js +47 -0
  93. package/dist/cjs/svm/utils/events.js.map +1 -0
  94. package/dist/cjs/svm/utils/helpers.d.ts +2 -0
  95. package/dist/cjs/svm/utils/helpers.js +19 -0
  96. package/dist/cjs/svm/utils/helpers.js.map +1 -0
  97. package/dist/cjs/svm/utils/index.d.ts +1 -0
  98. package/dist/cjs/svm/utils/index.js +5 -0
  99. package/dist/cjs/svm/utils/index.js.map +1 -0
  100. package/dist/cjs/utils/AddressUtils.d.ts +3 -9
  101. package/dist/cjs/utils/AddressUtils.js +6 -36
  102. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  103. package/dist/cjs/utils/ArrayUtils.d.ts +0 -1
  104. package/dist/cjs/utils/ArrayUtils.js +1 -6
  105. package/dist/cjs/utils/ArrayUtils.js.map +1 -1
  106. package/dist/cjs/utils/BlockUtils.d.ts +27 -2
  107. package/dist/cjs/utils/BlockUtils.js +208 -2
  108. package/dist/cjs/utils/BlockUtils.js.map +1 -1
  109. package/dist/cjs/utils/EventUtils.d.ts +4 -4
  110. package/dist/cjs/utils/EventUtils.js +4 -7
  111. package/dist/cjs/utils/EventUtils.js.map +1 -1
  112. package/dist/cjs/utils/JSONUtils.js +0 -3
  113. package/dist/cjs/utils/JSONUtils.js.map +1 -1
  114. package/dist/cjs/utils/SpokeUtils.js +0 -5
  115. package/dist/cjs/utils/SpokeUtils.js.map +1 -1
  116. package/dist/cjs/utils/index.d.ts +0 -1
  117. package/dist/cjs/utils/index.js +0 -1
  118. package/dist/cjs/utils/index.js.map +1 -1
  119. package/dist/esm/arch/evm/SpokeUtils.d.ts +1 -1
  120. package/dist/esm/arch/evm/SpokeUtils.js +5 -6
  121. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  122. package/dist/esm/arch/evm/index.d.ts +0 -1
  123. package/dist/esm/arch/evm/index.js +0 -1
  124. package/dist/esm/arch/evm/index.js.map +1 -1
  125. package/dist/esm/arch/svm/index.d.ts +1 -5
  126. package/dist/esm/arch/svm/index.js +1 -5
  127. package/dist/esm/arch/svm/index.js.map +1 -1
  128. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
  129. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +7 -7
  130. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  131. package/dist/esm/clients/BaseAbstractClient.d.ts +5 -6
  132. package/dist/esm/clients/BaseAbstractClient.js +19 -30
  133. package/dist/esm/clients/BaseAbstractClient.js.map +1 -1
  134. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +14 -17
  135. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  136. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +1 -1
  137. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  138. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +114 -114
  139. package/dist/esm/clients/HubPoolClient.d.ts +3 -4
  140. package/dist/esm/clients/HubPoolClient.js +18 -19
  141. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  142. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
  143. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +20 -23
  144. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  145. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +7 -7
  146. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +59 -57
  147. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  148. package/dist/esm/clients/SpokePoolClient/index.d.ts +0 -8
  149. package/dist/esm/clients/SpokePoolClient/index.js +0 -10
  150. package/dist/esm/clients/SpokePoolClient/index.js.map +1 -1
  151. package/dist/esm/clients/index.d.ts +1 -1
  152. package/dist/esm/clients/index.js +1 -1
  153. package/dist/esm/clients/index.js.map +1 -1
  154. package/dist/esm/clients/mocks/MockConfigStoreClient.d.ts +1 -1
  155. package/dist/esm/clients/mocks/MockConfigStoreClient.js +2 -2
  156. package/dist/esm/clients/mocks/MockConfigStoreClient.js.map +1 -1
  157. package/dist/esm/clients/mocks/MockHubPoolClient.js +2 -2
  158. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  159. package/dist/esm/clients/mocks/MockSpokePoolClient.js +5 -8
  160. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  161. package/dist/esm/clients/mocks/index.d.ts +0 -2
  162. package/dist/esm/clients/mocks/index.js +0 -2
  163. package/dist/esm/clients/mocks/index.js.map +1 -1
  164. package/dist/esm/constants.d.ts +0 -1
  165. package/dist/esm/constants.js +0 -1
  166. package/dist/esm/constants.js.map +1 -1
  167. package/dist/esm/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
  168. package/dist/esm/gasPriceOracle/adapters/arbitrum.js.map +1 -1
  169. package/dist/esm/gasPriceOracle/adapters/ethereum.d.ts +4 -4
  170. package/dist/esm/gasPriceOracle/adapters/ethereum.js.map +1 -1
  171. package/dist/esm/gasPriceOracle/adapters/linea-viem.js +2 -3
  172. package/dist/esm/gasPriceOracle/adapters/linea-viem.js.map +1 -1
  173. package/dist/esm/gasPriceOracle/adapters/polygon.d.ts +4 -4
  174. package/dist/esm/gasPriceOracle/adapters/polygon.js +1 -1
  175. package/dist/esm/gasPriceOracle/index.d.ts +1 -1
  176. package/dist/esm/gasPriceOracle/oracle.d.ts +3 -4
  177. package/dist/esm/gasPriceOracle/oracle.js +9 -18
  178. package/dist/esm/gasPriceOracle/oracle.js.map +1 -1
  179. package/dist/esm/gasPriceOracle/types.d.ts +1 -6
  180. package/dist/esm/index.d.ts +1 -0
  181. package/dist/esm/index.js +2 -0
  182. package/dist/esm/index.js.map +1 -1
  183. package/dist/esm/interfaces/SpokePool.d.ts +0 -13
  184. package/dist/esm/interfaces/SpokePool.js.map +1 -1
  185. package/dist/esm/providers/index.d.ts +1 -1
  186. package/dist/esm/providers/index.js +2 -1
  187. package/dist/esm/providers/index.js.map +1 -1
  188. package/dist/esm/providers/{mocks/mockEthersProvider.js → mockProvider.js} +2 -2
  189. package/dist/esm/providers/mockProvider.js.map +1 -0
  190. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
  191. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +8 -10
  192. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  193. package/dist/esm/relayFeeCalculator/chain-queries/factory.d.ts +2 -4
  194. package/dist/esm/relayFeeCalculator/chain-queries/factory.js +5 -11
  195. package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -1
  196. package/dist/esm/relayFeeCalculator/chain-queries/index.d.ts +0 -1
  197. package/dist/esm/relayFeeCalculator/chain-queries/index.js +0 -1
  198. package/dist/esm/relayFeeCalculator/chain-queries/index.js.map +1 -1
  199. package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +1 -12
  200. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +5 -10
  201. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  202. package/dist/esm/svm/eventsClient.d.ts +51 -0
  203. package/dist/esm/svm/eventsClient.js +195 -0
  204. package/dist/esm/svm/eventsClient.js.map +1 -0
  205. package/dist/esm/svm/index.d.ts +3 -0
  206. package/dist/esm/svm/index.js +5 -0
  207. package/dist/esm/svm/index.js.map +1 -0
  208. package/dist/esm/{arch/svm → svm}/types.d.ts +4 -9
  209. package/dist/esm/svm/types.js.map +1 -0
  210. package/dist/esm/svm/utils/events.d.ts +17 -0
  211. package/dist/esm/svm/utils/events.js +55 -0
  212. package/dist/esm/svm/utils/events.js.map +1 -0
  213. package/dist/esm/svm/utils/helpers.d.ts +5 -0
  214. package/dist/esm/svm/utils/helpers.js +18 -0
  215. package/dist/esm/svm/utils/helpers.js.map +1 -0
  216. package/dist/esm/svm/utils/index.d.ts +1 -0
  217. package/dist/esm/svm/utils/index.js +2 -0
  218. package/dist/esm/svm/utils/index.js.map +1 -0
  219. package/dist/esm/utils/AddressUtils.d.ts +3 -9
  220. package/dist/esm/utils/AddressUtils.js +6 -41
  221. package/dist/esm/utils/AddressUtils.js.map +1 -1
  222. package/dist/esm/utils/ArrayUtils.d.ts +0 -6
  223. package/dist/esm/utils/ArrayUtils.js +0 -9
  224. package/dist/esm/utils/ArrayUtils.js.map +1 -1
  225. package/dist/esm/utils/BlockUtils.d.ts +36 -2
  226. package/dist/esm/utils/BlockUtils.js +243 -2
  227. package/dist/esm/utils/BlockUtils.js.map +1 -1
  228. package/dist/esm/utils/EventUtils.d.ts +4 -4
  229. package/dist/esm/utils/EventUtils.js +4 -7
  230. package/dist/esm/utils/EventUtils.js.map +1 -1
  231. package/dist/esm/utils/JSONUtils.js +0 -3
  232. package/dist/esm/utils/JSONUtils.js.map +1 -1
  233. package/dist/esm/utils/SpokeUtils.js +0 -5
  234. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  235. package/dist/esm/utils/index.d.ts +0 -1
  236. package/dist/esm/utils/index.js +0 -1
  237. package/dist/esm/utils/index.js.map +1 -1
  238. package/dist/types/arch/evm/SpokeUtils.d.ts +1 -1
  239. package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
  240. package/dist/types/arch/evm/index.d.ts +0 -1
  241. package/dist/types/arch/evm/index.d.ts.map +1 -1
  242. package/dist/types/arch/svm/index.d.ts +1 -5
  243. package/dist/types/arch/svm/index.d.ts.map +1 -1
  244. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
  245. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  246. package/dist/types/clients/BaseAbstractClient.d.ts +5 -6
  247. package/dist/types/clients/BaseAbstractClient.d.ts.map +1 -1
  248. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  249. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +114 -114
  250. package/dist/types/clients/HubPoolClient.d.ts +3 -4
  251. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  252. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
  253. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  254. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +7 -7
  255. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
  256. package/dist/types/clients/SpokePoolClient/index.d.ts +0 -8
  257. package/dist/types/clients/SpokePoolClient/index.d.ts.map +1 -1
  258. package/dist/types/clients/index.d.ts +1 -1
  259. package/dist/types/clients/index.d.ts.map +1 -1
  260. package/dist/types/clients/mocks/MockConfigStoreClient.d.ts +1 -1
  261. package/dist/types/clients/mocks/MockConfigStoreClient.d.ts.map +1 -1
  262. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
  263. package/dist/types/clients/mocks/index.d.ts +0 -2
  264. package/dist/types/clients/mocks/index.d.ts.map +1 -1
  265. package/dist/types/constants.d.ts +0 -1
  266. package/dist/types/constants.d.ts.map +1 -1
  267. package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
  268. package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts.map +1 -1
  269. package/dist/types/gasPriceOracle/adapters/ethereum.d.ts +4 -4
  270. package/dist/types/gasPriceOracle/adapters/ethereum.d.ts.map +1 -1
  271. package/dist/types/gasPriceOracle/adapters/linea-viem.d.ts.map +1 -1
  272. package/dist/types/gasPriceOracle/adapters/polygon.d.ts +4 -4
  273. package/dist/types/gasPriceOracle/adapters/polygon.d.ts.map +1 -1
  274. package/dist/types/gasPriceOracle/index.d.ts +1 -1
  275. package/dist/types/gasPriceOracle/index.d.ts.map +1 -1
  276. package/dist/types/gasPriceOracle/oracle.d.ts +3 -4
  277. package/dist/types/gasPriceOracle/oracle.d.ts.map +1 -1
  278. package/dist/types/gasPriceOracle/types.d.ts +1 -6
  279. package/dist/types/gasPriceOracle/types.d.ts.map +1 -1
  280. package/dist/types/index.d.ts +1 -0
  281. package/dist/types/index.d.ts.map +1 -1
  282. package/dist/types/interfaces/SpokePool.d.ts +0 -13
  283. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  284. package/dist/types/providers/index.d.ts +1 -1
  285. package/dist/types/providers/index.d.ts.map +1 -1
  286. package/dist/types/providers/{mocks/mockEthersProvider.d.ts → mockProvider.d.ts} +1 -1
  287. package/dist/types/providers/mockProvider.d.ts.map +1 -0
  288. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
  289. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
  290. package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts +2 -4
  291. package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
  292. package/dist/types/relayFeeCalculator/chain-queries/index.d.ts +0 -1
  293. package/dist/types/relayFeeCalculator/chain-queries/index.d.ts.map +1 -1
  294. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +1 -12
  295. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
  296. package/dist/types/svm/eventsClient.d.ts +52 -0
  297. package/dist/types/svm/eventsClient.d.ts.map +1 -0
  298. package/dist/types/svm/index.d.ts +4 -0
  299. package/dist/types/svm/index.d.ts.map +1 -0
  300. package/dist/types/{arch/svm → svm}/types.d.ts +4 -9
  301. package/dist/types/svm/types.d.ts.map +1 -0
  302. package/dist/types/svm/utils/events.d.ts +18 -0
  303. package/dist/types/svm/utils/events.d.ts.map +1 -0
  304. package/dist/types/svm/utils/helpers.d.ts +6 -0
  305. package/dist/types/svm/utils/helpers.d.ts.map +1 -0
  306. package/dist/types/svm/utils/index.d.ts +2 -0
  307. package/dist/types/svm/utils/index.d.ts.map +1 -0
  308. package/dist/types/utils/AddressUtils.d.ts +3 -9
  309. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  310. package/dist/types/utils/ArrayUtils.d.ts +0 -6
  311. package/dist/types/utils/ArrayUtils.d.ts.map +1 -1
  312. package/dist/types/utils/BlockUtils.d.ts +36 -2
  313. package/dist/types/utils/BlockUtils.d.ts.map +1 -1
  314. package/dist/types/utils/EventUtils.d.ts +4 -4
  315. package/dist/types/utils/EventUtils.d.ts.map +1 -1
  316. package/dist/types/utils/JSONUtils.d.ts.map +1 -1
  317. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  318. package/dist/types/utils/index.d.ts +0 -1
  319. package/dist/types/utils/index.d.ts.map +1 -1
  320. package/package.json +1 -3
  321. package/src/arch/evm/SpokeUtils.ts +5 -5
  322. package/src/arch/evm/index.ts +0 -1
  323. package/src/arch/svm/index.ts +1 -5
  324. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -7
  325. package/src/clients/BaseAbstractClient.ts +13 -20
  326. package/src/clients/BundleDataClient/BundleDataClient.ts +19 -28
  327. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +1 -1
  328. package/src/clients/HubPoolClient.ts +19 -19
  329. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +21 -23
  330. package/src/clients/SpokePoolClient/SpokePoolClient.ts +59 -50
  331. package/src/clients/SpokePoolClient/index.ts +0 -11
  332. package/src/clients/index.ts +1 -1
  333. package/src/clients/mocks/MockConfigStoreClient.ts +2 -2
  334. package/src/clients/mocks/MockHubPoolClient.ts +2 -2
  335. package/src/clients/mocks/MockSpokePoolClient.ts +4 -9
  336. package/src/clients/mocks/index.ts +0 -2
  337. package/src/constants.ts +0 -1
  338. package/src/gasPriceOracle/adapters/arbitrum.ts +2 -5
  339. package/src/gasPriceOracle/adapters/ethereum.ts +4 -7
  340. package/src/gasPriceOracle/adapters/linea-viem.ts +1 -3
  341. package/src/gasPriceOracle/adapters/polygon.ts +6 -6
  342. package/src/gasPriceOracle/index.ts +1 -1
  343. package/src/gasPriceOracle/oracle.ts +4 -20
  344. package/src/gasPriceOracle/types.ts +1 -7
  345. package/src/index.ts +1 -0
  346. package/src/interfaces/SpokePool.ts +0 -14
  347. package/src/providers/index.ts +1 -1
  348. package/src/providers/{mocks/mockEthersProvider.ts → mockProvider.ts} +1 -1
  349. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +9 -11
  350. package/src/relayFeeCalculator/chain-queries/factory.ts +8 -24
  351. package/src/relayFeeCalculator/chain-queries/index.ts +0 -1
  352. package/src/relayFeeCalculator/relayFeeCalculator.ts +4 -16
  353. package/src/svm/eventsClient.ts +199 -0
  354. package/src/svm/index.ts +3 -0
  355. package/src/{arch/svm → svm}/types.ts +4 -21
  356. package/src/svm/utils/events.ts +58 -0
  357. package/src/svm/utils/helpers.ts +9 -0
  358. package/src/svm/utils/index.ts +1 -0
  359. package/src/utils/AddressUtils.ts +6 -49
  360. package/src/utils/ArrayUtils.ts +0 -12
  361. package/src/utils/BlockUtils.ts +215 -5
  362. package/src/utils/EventUtils.ts +11 -11
  363. package/src/utils/JSONUtils.ts +0 -2
  364. package/src/utils/SpokeUtils.ts +3 -7
  365. package/src/utils/index.ts +0 -1
  366. package/dist/cjs/arch/evm/BlockUtils.d.ts +0 -15
  367. package/dist/cjs/arch/evm/BlockUtils.js +0 -218
  368. package/dist/cjs/arch/evm/BlockUtils.js.map +0 -1
  369. package/dist/cjs/arch/svm/SpokeUtils.d.ts +0 -21
  370. package/dist/cjs/arch/svm/SpokeUtils.js +0 -454
  371. package/dist/cjs/arch/svm/SpokeUtils.js.map +0 -1
  372. package/dist/cjs/arch/svm/constants.d.ts +0 -2
  373. package/dist/cjs/arch/svm/constants.js +0 -7
  374. package/dist/cjs/arch/svm/constants.js.map +0 -1
  375. package/dist/cjs/arch/svm/eventsClient.d.ts +0 -26
  376. package/dist/cjs/arch/svm/eventsClient.js +0 -253
  377. package/dist/cjs/arch/svm/eventsClient.js.map +0 -1
  378. package/dist/cjs/arch/svm/types.js.map +0 -1
  379. package/dist/cjs/arch/svm/utils.d.ts +0 -18
  380. package/dist/cjs/arch/svm/utils.js +0 -212
  381. package/dist/cjs/arch/svm/utils.js.map +0 -1
  382. package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +0 -23
  383. package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js +0 -172
  384. package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js.map +0 -1
  385. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +0 -33
  386. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +0 -184
  387. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +0 -1
  388. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +0 -30
  389. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +0 -90
  390. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +0 -1
  391. package/dist/cjs/gasPriceOracle/adapters/solana.d.ts +0 -4
  392. package/dist/cjs/gasPriceOracle/adapters/solana.js +0 -43
  393. package/dist/cjs/gasPriceOracle/adapters/solana.js.map +0 -1
  394. package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.d.ts +0 -5
  395. package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.js +0 -21
  396. package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.js.map +0 -1
  397. package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +0 -5
  398. package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.js +0 -20
  399. package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.js.map +0 -1
  400. package/dist/cjs/providers/mocks/MockSolanaRpcFactory.d.ts +0 -13
  401. package/dist/cjs/providers/mocks/MockSolanaRpcFactory.js +0 -76
  402. package/dist/cjs/providers/mocks/MockSolanaRpcFactory.js.map +0 -1
  403. package/dist/cjs/providers/mocks/index.d.ts +0 -4
  404. package/dist/cjs/providers/mocks/index.js +0 -8
  405. package/dist/cjs/providers/mocks/index.js.map +0 -1
  406. package/dist/cjs/providers/mocks/mockEthersProvider.js.map +0 -1
  407. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +0 -37
  408. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +0 -171
  409. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +0 -1
  410. package/dist/cjs/utils/BlockFinder.d.ts +0 -22
  411. package/dist/cjs/utils/BlockFinder.js +0 -10
  412. package/dist/cjs/utils/BlockFinder.js.map +0 -1
  413. package/dist/esm/arch/evm/BlockUtils.d.ts +0 -24
  414. package/dist/esm/arch/evm/BlockUtils.js +0 -250
  415. package/dist/esm/arch/evm/BlockUtils.js.map +0 -1
  416. package/dist/esm/arch/svm/SpokeUtils.d.ts +0 -129
  417. package/dist/esm/arch/svm/SpokeUtils.js +0 -576
  418. package/dist/esm/arch/svm/SpokeUtils.js.map +0 -1
  419. package/dist/esm/arch/svm/constants.d.ts +0 -2
  420. package/dist/esm/arch/svm/constants.js +0 -3
  421. package/dist/esm/arch/svm/constants.js.map +0 -1
  422. package/dist/esm/arch/svm/eventsClient.d.ts +0 -87
  423. package/dist/esm/arch/svm/eventsClient.js +0 -316
  424. package/dist/esm/arch/svm/eventsClient.js.map +0 -1
  425. package/dist/esm/arch/svm/types.js.map +0 -1
  426. package/dist/esm/arch/svm/utils.d.ts +0 -63
  427. package/dist/esm/arch/svm/utils.js +0 -258
  428. package/dist/esm/arch/svm/utils.js.map +0 -1
  429. package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +0 -66
  430. package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js +0 -225
  431. package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js.map +0 -1
  432. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +0 -33
  433. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +0 -183
  434. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +0 -1
  435. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +0 -30
  436. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +0 -89
  437. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +0 -1
  438. package/dist/esm/gasPriceOracle/adapters/solana.d.ts +0 -8
  439. package/dist/esm/gasPriceOracle/adapters/solana.js +0 -43
  440. package/dist/esm/gasPriceOracle/adapters/solana.js.map +0 -1
  441. package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.d.ts +0 -5
  442. package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.js +0 -19
  443. package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.js.map +0 -1
  444. package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +0 -5
  445. package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.js +0 -18
  446. package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.js.map +0 -1
  447. package/dist/esm/providers/mocks/MockSolanaRpcFactory.d.ts +0 -13
  448. package/dist/esm/providers/mocks/MockSolanaRpcFactory.js +0 -74
  449. package/dist/esm/providers/mocks/MockSolanaRpcFactory.js.map +0 -1
  450. package/dist/esm/providers/mocks/index.d.ts +0 -4
  451. package/dist/esm/providers/mocks/index.js +0 -5
  452. package/dist/esm/providers/mocks/index.js.map +0 -1
  453. package/dist/esm/providers/mocks/mockEthersProvider.js.map +0 -1
  454. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +0 -84
  455. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +0 -216
  456. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +0 -1
  457. package/dist/esm/utils/BlockFinder.d.ts +0 -22
  458. package/dist/esm/utils/BlockFinder.js +0 -7
  459. package/dist/esm/utils/BlockFinder.js.map +0 -1
  460. package/dist/types/arch/evm/BlockUtils.d.ts +0 -25
  461. package/dist/types/arch/evm/BlockUtils.d.ts.map +0 -1
  462. package/dist/types/arch/svm/SpokeUtils.d.ts +0 -130
  463. package/dist/types/arch/svm/SpokeUtils.d.ts.map +0 -1
  464. package/dist/types/arch/svm/constants.d.ts +0 -3
  465. package/dist/types/arch/svm/constants.d.ts.map +0 -1
  466. package/dist/types/arch/svm/eventsClient.d.ts +0 -88
  467. package/dist/types/arch/svm/eventsClient.d.ts.map +0 -1
  468. package/dist/types/arch/svm/types.d.ts.map +0 -1
  469. package/dist/types/arch/svm/utils.d.ts +0 -64
  470. package/dist/types/arch/svm/utils.d.ts.map +0 -1
  471. package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +0 -67
  472. package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts.map +0 -1
  473. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts +0 -34
  474. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts.map +0 -1
  475. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +0 -31
  476. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +0 -1
  477. package/dist/types/gasPriceOracle/adapters/solana.d.ts +0 -9
  478. package/dist/types/gasPriceOracle/adapters/solana.d.ts.map +0 -1
  479. package/dist/types/providers/mocks/MockCachedSolanaRpcFactory.d.ts +0 -6
  480. package/dist/types/providers/mocks/MockCachedSolanaRpcFactory.d.ts.map +0 -1
  481. package/dist/types/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +0 -6
  482. package/dist/types/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts.map +0 -1
  483. package/dist/types/providers/mocks/MockSolanaRpcFactory.d.ts +0 -14
  484. package/dist/types/providers/mocks/MockSolanaRpcFactory.d.ts.map +0 -1
  485. package/dist/types/providers/mocks/index.d.ts +0 -5
  486. package/dist/types/providers/mocks/index.d.ts.map +0 -1
  487. package/dist/types/providers/mocks/mockEthersProvider.d.ts.map +0 -1
  488. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +0 -85
  489. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +0 -1
  490. package/dist/types/utils/BlockFinder.d.ts +0 -23
  491. package/dist/types/utils/BlockFinder.d.ts.map +0 -1
  492. package/src/arch/evm/BlockUtils.ts +0 -209
  493. package/src/arch/svm/SpokeUtils.ts +0 -596
  494. package/src/arch/svm/constants.ts +0 -2
  495. package/src/arch/svm/eventsClient.ts +0 -342
  496. package/src/arch/svm/utils.ts +0 -233
  497. package/src/clients/SpokePoolClient/SVMSpokePoolClient.ts +0 -268
  498. package/src/clients/mocks/MockSvmCpiEventsClient.ts +0 -226
  499. package/src/clients/mocks/MockSvmSpokePoolClient.ts +0 -119
  500. package/src/gasPriceOracle/adapters/solana.ts +0 -45
  501. package/src/providers/mocks/MockCachedSolanaRpcFactory.ts +0 -15
  502. package/src/providers/mocks/MockRateLimitedSolanaRpcFactory.ts +0 -14
  503. package/src/providers/mocks/MockSolanaRpcFactory.ts +0 -55
  504. package/src/providers/mocks/index.ts +0 -4
  505. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +0 -225
  506. package/src/utils/BlockFinder.ts +0 -26
  507. /package/dist/cjs/providers/{mocks/mockEthersProvider.d.ts → mockProvider.d.ts} +0 -0
  508. /package/dist/cjs/{arch/svm → svm}/types.js +0 -0
  509. /package/dist/esm/providers/{mocks/mockEthersProvider.d.ts → mockProvider.d.ts} +0 -0
  510. /package/dist/esm/{arch/svm → svm}/types.js +0 -0
@@ -1,268 +0,0 @@
1
- import { Address, Rpc, RpcTransport, SolanaRpcApiFromTransport } from "@solana/kit";
2
- import winston from "winston";
3
- import {
4
- SVMEventNames,
5
- unwrapEventData,
6
- getFillDeadline,
7
- getTimestampForSlot,
8
- getStatePda,
9
- SvmCpiEventsClient,
10
- findDeposit,
11
- relayFillStatus,
12
- fillStatusArray,
13
- } from "../../arch/svm";
14
- import { FillStatus, RelayData, SortableEvent } from "../../interfaces";
15
- import {
16
- BigNumber,
17
- DepositSearchResult,
18
- EventSearchConfig,
19
- InvalidFill,
20
- isZeroAddress,
21
- MakeOptional,
22
- sortEventsAscendingInPlace,
23
- } from "../../utils";
24
- import { isUpdateFailureReason } from "../BaseAbstractClient";
25
- import { HubPoolClient } from "../HubPoolClient";
26
- import { knownEventNames, SpokePoolClient, SpokePoolUpdate } from "./SpokePoolClient";
27
-
28
- /**
29
- * SvmSpokePoolClient is a client for the SVM SpokePool program. It extends the base SpokePoolClient
30
- * and implements the abstract methods required for interacting with an SVM Spoke Pool.
31
- */
32
- export class SvmSpokePoolClient extends SpokePoolClient {
33
- /**
34
- * Protected constructor. Use the async create() method to instantiate.
35
- */
36
- protected constructor(
37
- logger: winston.Logger,
38
- hubPoolClient: HubPoolClient | null,
39
- chainId: number,
40
- deploymentSlot: bigint, // Using slot instead of block number for SVM
41
- eventSearchConfig: MakeOptional<EventSearchConfig, "to">,
42
- public svmEventsClient: SvmCpiEventsClient,
43
- protected programId: Address,
44
- protected statePda: Address
45
- ) {
46
- // Convert deploymentSlot to number for base class, might need refinement
47
- super(logger, hubPoolClient, chainId, Number(deploymentSlot), eventSearchConfig);
48
- }
49
-
50
- /**
51
- * Factory method to asynchronously create an instance of SvmSpokePoolClient.
52
- */
53
- public static async create(
54
- logger: winston.Logger,
55
- hubPoolClient: HubPoolClient | null,
56
- chainId: number,
57
- deploymentSlot: bigint,
58
- eventSearchConfig: MakeOptional<EventSearchConfig, "to"> = { from: 0, maxLookBack: 0 }, // Provide default
59
- rpc: Rpc<SolanaRpcApiFromTransport<RpcTransport>>
60
- ): Promise<SvmSpokePoolClient> {
61
- const svmEventsClient = await SvmCpiEventsClient.create(rpc);
62
- const programId = svmEventsClient.getProgramAddress();
63
- const statePda = await getStatePda(programId);
64
- return new SvmSpokePoolClient(
65
- logger,
66
- hubPoolClient,
67
- chainId,
68
- deploymentSlot,
69
- eventSearchConfig,
70
- svmEventsClient,
71
- programId,
72
- statePda
73
- );
74
- }
75
-
76
- /**
77
- * Factory method to asynchronously create an instance of SvmSpokePoolClient with an existing event client.
78
- */
79
- public static async createWithExistingEventClient(
80
- logger: winston.Logger,
81
- hubPoolClient: HubPoolClient | null,
82
- chainId: number,
83
- deploymentSlot: bigint,
84
- eventSearchConfig: MakeOptional<EventSearchConfig, "to"> = { from: 0, maxLookBack: 0 }, // Provide default
85
- eventClient: SvmCpiEventsClient
86
- ) {
87
- const programId = eventClient.getProgramAddress();
88
- const statePda = await getStatePda(programId);
89
- return new SvmSpokePoolClient(
90
- logger,
91
- hubPoolClient,
92
- chainId,
93
- deploymentSlot,
94
- eventSearchConfig,
95
- eventClient,
96
- programId,
97
- statePda
98
- );
99
- }
100
-
101
- public _queryableEventNames(): string[] {
102
- // We want to take the internal event names relevant to
103
- // the SVM SpokePoolClient and filter them against the
104
- // knownEventNames list that we reference in practice
105
- const internalEventNames = Object.values(SVMEventNames);
106
- return internalEventNames.filter((e) => knownEventNames.includes(e));
107
- }
108
-
109
- /**
110
- * Performs an update to refresh the state of this client by querying SVM events.
111
- */
112
- protected async _update(eventsToQuery: string[]): Promise<SpokePoolUpdate> {
113
- const searchConfig = await this.updateSearchConfig(this.svmEventsClient.getRpc());
114
- if (isUpdateFailureReason(searchConfig)) {
115
- const reason = searchConfig;
116
- return { success: false, reason };
117
- }
118
-
119
- const deploymentSlot = BigInt(this.deploymentBlock);
120
-
121
- const eventSearchConfigs = eventsToQuery.map((eventName) => {
122
- if (!this._queryableEventNames().includes(eventName)) {
123
- throw new Error(`SpokePoolClient: Cannot query unrecognised SpokePool event name: ${eventName}`);
124
- }
125
-
126
- const _searchConfig = { ...searchConfig }; // shallow copy
127
-
128
- // By default, an event's query range is controlled by the `eventSearchConfig` passed in during instantiation.
129
- // However, certain events have special overriding requirements to their search ranges:
130
- // - EnabledDepositRoute: The full history is always required, so override the requested fromBlock.
131
- if (eventName === "EnabledDepositRoute" && !this.isUpdated) {
132
- _searchConfig.from = Number(deploymentSlot);
133
- }
134
-
135
- return _searchConfig as EventSearchConfig;
136
- });
137
-
138
- const spokePoolAddress = this.svmEventsClient.getProgramAddress();
139
-
140
- this.log("debug", `Updating SpokePool client for chain ${this.chainId}`, {
141
- eventsToQuery,
142
- searchConfig,
143
- spokePool: spokePoolAddress,
144
- });
145
-
146
- const timerStart = Date.now();
147
-
148
- const [currentTime, ...eventsQueried] = await Promise.all([
149
- this.svmEventsClient.getRpc().getBlockTime(BigInt(searchConfig.to)).send(),
150
- ...eventsToQuery.map(async (eventName, idx) => {
151
- const config = eventSearchConfigs[idx];
152
- const events = await this.svmEventsClient.queryEvents(
153
- eventName as SVMEventNames,
154
- BigInt(config.from),
155
- BigInt(config.to),
156
- {
157
- limit: config.maxLookBack,
158
- }
159
- );
160
- return events.map(
161
- (event): SortableEvent => ({
162
- txnRef: event.signature,
163
- blockNumber: Number(event.slot),
164
- txnIndex: 0,
165
- logIndex: 0,
166
- ...(unwrapEventData(event.data) as Record<string, unknown>),
167
- })
168
- );
169
- }),
170
- ]);
171
- this.log("debug", `Time to query new events from RPC for ${this.chainId}: ${Date.now() - timerStart} ms`);
172
- if (currentTime < this.currentTime) {
173
- const errMsg = `currentTime: ${currentTime} < ${this.currentTime}`;
174
- throw new Error(`SvmSpokePoolClient::update: ${errMsg}`);
175
- }
176
-
177
- // Sort all events to ensure they are stored in a consistent order.
178
- eventsQueried.forEach((events) => sortEventsAscendingInPlace(events));
179
-
180
- return {
181
- success: true,
182
- currentTime: Number(currentTime), // uint32
183
- searchEndBlock: searchConfig.to,
184
- events: eventsQueried,
185
- };
186
- }
187
-
188
- /**
189
- * Retrieves the fill deadline buffer fetched from the State PDA.
190
- * @note This function assumes that fill deadline buffer is a constant value in svm environments.
191
- */
192
- public override getMaxFillDeadlineInRange(_startSlot: number, _endSlot: number): Promise<number> {
193
- return getFillDeadline(this.svmEventsClient.getRpc(), this.statePda);
194
- }
195
-
196
- /**
197
- * Retrieves the timestamp for a given SVM slot number.
198
- */
199
- public override getTimestampForBlock(slot: number): Promise<number> {
200
- return getTimestampForSlot(this.svmEventsClient.getRpc(), slot);
201
- }
202
-
203
- /**
204
- * Retrieves the timestamp for a given SVM slot number.
205
- * @note This function uses the same underlying function as getTimestampForBlock.
206
- * It is kept for consistency with the EVM SpokePoolClient.
207
- */
208
- public getTimeAt(slot: number): Promise<number> {
209
- return getTimestampForSlot(this.svmEventsClient.getRpc(), slot);
210
- }
211
-
212
- /**
213
- * Finds a deposit based on its deposit ID on the SVM chain.
214
- */
215
- public async findDeposit(depositId: BigNumber): Promise<DepositSearchResult> {
216
- const deposit = await findDeposit(this.svmEventsClient, depositId);
217
- if (!deposit) {
218
- return {
219
- found: false,
220
- code: InvalidFill.DepositIdNotFound,
221
- reason: `Deposit with ID ${depositId} not found`,
222
- };
223
- }
224
- // Because we have additional context about this deposit, we can enrich it
225
- // with additional information.
226
- return {
227
- found: true,
228
- deposit: {
229
- ...deposit,
230
- quoteBlockNumber: await this.getBlockNumber(Number(deposit.quoteTimestamp)),
231
- originChainId: this.chainId,
232
- fromLiteChain: this.isOriginLiteChain(deposit),
233
- toLiteChain: this.isDestinationLiteChain(deposit),
234
- outputToken: isZeroAddress(deposit.outputToken)
235
- ? this.getDestinationTokenForDeposit(deposit)
236
- : deposit.outputToken,
237
- },
238
- };
239
- }
240
-
241
- /**
242
- * Retrieves the fill status for a given relay data from the SVM chain.
243
- */
244
- public override relayFillStatus(
245
- relayData: RelayData,
246
- atHeight?: number,
247
- destinationChainId?: number
248
- ): Promise<FillStatus> {
249
- destinationChainId ??= this.chainId;
250
- return relayFillStatus(this.programId, relayData, destinationChainId, this.svmEventsClient, atHeight);
251
- }
252
-
253
- /**
254
- * Retrieves the fill status for an array of given relay data.
255
- * @param relayData The array relay data to retrieve the fill status for.
256
- * @param atHeight The slot at which to query the fill status.
257
- * @returns The fill status for each of the given relay data.
258
- */
259
- public fillStatusArray(
260
- relayData: RelayData[],
261
- atHeight?: number,
262
- destinationChainId?: number
263
- ): Promise<(FillStatus | undefined)[]> {
264
- // @note: deploymentBlock actually refers to the deployment slot. Also, blockTag should be a slot number.
265
- destinationChainId ??= this.chainId;
266
- return fillStatusArray(this.programId, relayData, destinationChainId, this.svmEventsClient, atHeight, this.logger);
267
- }
268
- }
@@ -1,226 +0,0 @@
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
- }
@@ -1,119 +0,0 @@
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,45 +0,0 @@
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,15 +0,0 @@
1
- import { CachedSolanaRpcFactory } from "..";
2
- import { MockRateLimitedSolanaRpcFactory } from "./MockRateLimitedSolanaRpcFactory";
3
-
4
- // Creates mocked cached Solana RPC factory by using the mocked Solana RPC factory.
5
- export class MockCachedSolanaRpcFactory extends CachedSolanaRpcFactory {
6
- constructor(
7
- mockRateLimitedSolanaRpcFactory: MockRateLimitedSolanaRpcFactory,
8
- ...cachedConstructorParams: ConstructorParameters<typeof CachedSolanaRpcFactory>
9
- ) {
10
- super(...cachedConstructorParams);
11
-
12
- this.rateLimitedTransport = mockRateLimitedSolanaRpcFactory.createTransport();
13
- this.rateLimitedRpcClient = mockRateLimitedSolanaRpcFactory.createRpcClient();
14
- }
15
- }
@@ -1,14 +0,0 @@
1
- import { RateLimitedSolanaRpcFactory } from "..";
2
- import { MockSolanaRpcFactory } from "./MockSolanaRpcFactory";
3
-
4
- // Creates mocked rate limited Solana RPC factory by using the mocked Solana RPC factory.
5
- export class MockRateLimitedSolanaRpcFactory extends RateLimitedSolanaRpcFactory {
6
- constructor(
7
- mockSolanaRpcFactory: MockSolanaRpcFactory,
8
- ...rateLimitedConstructorParams: ConstructorParameters<typeof RateLimitedSolanaRpcFactory>
9
- ) {
10
- super(...rateLimitedConstructorParams);
11
-
12
- this.defaultTransport = mockSolanaRpcFactory.createTransport();
13
- }
14
- }