@kumbaya_xyz/smart-order-router 4.22.38

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 (522) hide show
  1. package/CHANGELOG.md +255 -0
  2. package/LICENSE +674 -0
  3. package/README.md +315 -0
  4. package/build/main/index.d.ts +3 -0
  5. package/build/main/index.js +20 -0
  6. package/build/main/providers/cache-node.d.ts +10 -0
  7. package/build/main/providers/cache-node.js +33 -0
  8. package/build/main/providers/cache.d.ts +14 -0
  9. package/build/main/providers/cache.js +3 -0
  10. package/build/main/providers/caching/route/index.d.ts +2 -0
  11. package/build/main/providers/caching/route/index.js +19 -0
  12. package/build/main/providers/caching/route/model/cache-mode.d.ts +16 -0
  13. package/build/main/providers/caching/route/model/cache-mode.js +21 -0
  14. package/build/main/providers/caching/route/model/cached-route.d.ts +29 -0
  15. package/build/main/providers/caching/route/model/cached-route.js +77 -0
  16. package/build/main/providers/caching/route/model/cached-routes.d.ts +67 -0
  17. package/build/main/providers/caching/route/model/cached-routes.js +81 -0
  18. package/build/main/providers/caching/route/model/index.d.ts +3 -0
  19. package/build/main/providers/caching/route/model/index.js +20 -0
  20. package/build/main/providers/caching/route/route-caching-provider.d.ts +111 -0
  21. package/build/main/providers/caching/route/route-caching-provider.js +86 -0
  22. package/build/main/providers/caching-gas-provider.d.ts +23 -0
  23. package/build/main/providers/caching-gas-provider.js +41 -0
  24. package/build/main/providers/caching-subgraph-provider.d.ts +33 -0
  25. package/build/main/providers/caching-subgraph-provider.js +170 -0
  26. package/build/main/providers/caching-token-list-provider.d.ts +52 -0
  27. package/build/main/providers/caching-token-list-provider.js +147 -0
  28. package/build/main/providers/caching-token-provider.d.ts +24 -0
  29. package/build/main/providers/caching-token-provider.js +242 -0
  30. package/build/main/providers/eip-1559-gas-price-provider.d.ts +31 -0
  31. package/build/main/providers/eip-1559-gas-price-provider.js +71 -0
  32. package/build/main/providers/eth-estimate-gas-provider.d.ts +21 -0
  33. package/build/main/providers/eth-estimate-gas-provider.js +91 -0
  34. package/build/main/providers/eth-gas-station-info-gas-price-provider.d.ts +19 -0
  35. package/build/main/providers/eth-gas-station-info-gas-price-provider.js +36 -0
  36. package/build/main/providers/gas-price-provider.d.ts +10 -0
  37. package/build/main/providers/gas-price-provider.js +10 -0
  38. package/build/main/providers/index.d.ts +47 -0
  39. package/build/main/providers/index.js +64 -0
  40. package/build/main/providers/legacy-gas-price-provider.d.ts +7 -0
  41. package/build/main/providers/legacy-gas-price-provider.js +18 -0
  42. package/build/main/providers/multicall-provider.d.ts +83 -0
  43. package/build/main/providers/multicall-provider.js +15 -0
  44. package/build/main/providers/multicall-uniswap-provider.d.ts +37 -0
  45. package/build/main/providers/multicall-uniswap-provider.js +164 -0
  46. package/build/main/providers/on-chain-gas-price-provider.d.ts +19 -0
  47. package/build/main/providers/on-chain-gas-price-provider.js +37 -0
  48. package/build/main/providers/on-chain-quote-provider.d.ts +258 -0
  49. package/build/main/providers/on-chain-quote-provider.js +713 -0
  50. package/build/main/providers/pool-provider.d.ts +45 -0
  51. package/build/main/providers/pool-provider.js +73 -0
  52. package/build/main/providers/portion-provider.d.ts +86 -0
  53. package/build/main/providers/portion-provider.js +118 -0
  54. package/build/main/providers/provider.d.ts +38 -0
  55. package/build/main/providers/provider.js +3 -0
  56. package/build/main/providers/simulation-provider.d.ts +46 -0
  57. package/build/main/providers/simulation-provider.js +138 -0
  58. package/build/main/providers/static-gas-price-provider.d.ts +7 -0
  59. package/build/main/providers/static-gas-price-provider.js +13 -0
  60. package/build/main/providers/subgraph-provider-with-fallback.d.ts +11 -0
  61. package/build/main/providers/subgraph-provider-with-fallback.js +25 -0
  62. package/build/main/providers/subgraph-provider.d.ts +56 -0
  63. package/build/main/providers/subgraph-provider.js +287 -0
  64. package/build/main/providers/swap-router-provider.d.ts +30 -0
  65. package/build/main/providers/swap-router-provider.js +42 -0
  66. package/build/main/providers/tenderly-simulation-provider.d.ts +69 -0
  67. package/build/main/providers/tenderly-simulation-provider.js +458 -0
  68. package/build/main/providers/token-fee-fetcher.d.ts +31 -0
  69. package/build/main/providers/token-fee-fetcher.js +165 -0
  70. package/build/main/providers/token-properties-provider.d.ts +31 -0
  71. package/build/main/providers/token-properties-provider.js +118 -0
  72. package/build/main/providers/token-provider.d.ts +141 -0
  73. package/build/main/providers/token-provider.js +394 -0
  74. package/build/main/providers/token-validator-provider.d.ts +42 -0
  75. package/build/main/providers/token-validator-provider.js +99 -0
  76. package/build/main/providers/uri-subgraph-provider.d.ts +20 -0
  77. package/build/main/providers/uri-subgraph-provider.js +65 -0
  78. package/build/main/providers/v2/caching-pool-provider.d.ts +33 -0
  79. package/build/main/providers/v2/caching-pool-provider.js +89 -0
  80. package/build/main/providers/v2/caching-subgraph-provider.d.ts +19 -0
  81. package/build/main/providers/v2/caching-subgraph-provider.js +24 -0
  82. package/build/main/providers/v2/pool-provider.d.ts +63 -0
  83. package/build/main/providers/v2/pool-provider.js +148 -0
  84. package/build/main/providers/v2/quote-provider.d.ts +34 -0
  85. package/build/main/providers/v2/quote-provider.js +90 -0
  86. package/build/main/providers/v2/static-subgraph-provider.d.ts +19 -0
  87. package/build/main/providers/v2/static-subgraph-provider.js +171 -0
  88. package/build/main/providers/v2/subgraph-provider-with-fallback.d.ts +16 -0
  89. package/build/main/providers/v2/subgraph-provider-with-fallback.js +23 -0
  90. package/build/main/providers/v2/subgraph-provider.d.ts +53 -0
  91. package/build/main/providers/v2/subgraph-provider.js +344 -0
  92. package/build/main/providers/v2/uri-subgraph-provider.d.ts +4 -0
  93. package/build/main/providers/v2/uri-subgraph-provider.js +8 -0
  94. package/build/main/providers/v3/caching-pool-provider.d.ts +32 -0
  95. package/build/main/providers/v3/caching-pool-provider.js +84 -0
  96. package/build/main/providers/v3/caching-subgraph-provider.d.ts +19 -0
  97. package/build/main/providers/v3/caching-subgraph-provider.js +24 -0
  98. package/build/main/providers/v3/gas-data-provider.d.ts +39 -0
  99. package/build/main/providers/v3/gas-data-provider.js +26 -0
  100. package/build/main/providers/v3/pool-provider.d.ts +77 -0
  101. package/build/main/providers/v3/pool-provider.js +108 -0
  102. package/build/main/providers/v3/static-subgraph-provider.d.ts +21 -0
  103. package/build/main/providers/v3/static-subgraph-provider.js +217 -0
  104. package/build/main/providers/v3/subgraph-provider-with-fallback.d.ts +12 -0
  105. package/build/main/providers/v3/subgraph-provider-with-fallback.js +19 -0
  106. package/build/main/providers/v3/subgraph-provider.d.ts +45 -0
  107. package/build/main/providers/v3/subgraph-provider.js +46 -0
  108. package/build/main/providers/v3/uri-subgraph-provider.d.ts +4 -0
  109. package/build/main/providers/v3/uri-subgraph-provider.js +8 -0
  110. package/build/main/providers/v4/caching-pool-provider.d.ts +24 -0
  111. package/build/main/providers/v4/caching-pool-provider.js +81 -0
  112. package/build/main/providers/v4/caching-subgraph-provider.d.ts +19 -0
  113. package/build/main/providers/v4/caching-subgraph-provider.js +24 -0
  114. package/build/main/providers/v4/euler-swap-hooks-subgraph-provider.d.ts +25 -0
  115. package/build/main/providers/v4/euler-swap-hooks-subgraph-provider.js +160 -0
  116. package/build/main/providers/v4/pool-provider.d.ts +58 -0
  117. package/build/main/providers/v4/pool-provider.js +115 -0
  118. package/build/main/providers/v4/static-subgraph-provider.d.ts +15 -0
  119. package/build/main/providers/v4/static-subgraph-provider.js +78 -0
  120. package/build/main/providers/v4/subgraph-provider-with-fallback.d.ts +5 -0
  121. package/build/main/providers/v4/subgraph-provider-with-fallback.js +12 -0
  122. package/build/main/providers/v4/subgraph-provider.d.ts +63 -0
  123. package/build/main/providers/v4/subgraph-provider.js +63 -0
  124. package/build/main/providers/v4/uri-subgraph-provider.d.ts +4 -0
  125. package/build/main/providers/v4/uri-subgraph-provider.js +8 -0
  126. package/build/main/routers/alpha-router/alpha-router.d.ts +483 -0
  127. package/build/main/routers/alpha-router/alpha-router.js +1678 -0
  128. package/build/main/routers/alpha-router/config.d.ts +4 -0
  129. package/build/main/routers/alpha-router/config.js +131 -0
  130. package/build/main/routers/alpha-router/entities/index.d.ts +1 -0
  131. package/build/main/routers/alpha-router/entities/index.js +18 -0
  132. package/build/main/routers/alpha-router/entities/route-with-valid-quote.d.ts +208 -0
  133. package/build/main/routers/alpha-router/entities/route-with-valid-quote.js +194 -0
  134. package/build/main/routers/alpha-router/functions/best-swap-route.d.ts +24 -0
  135. package/build/main/routers/alpha-router/functions/best-swap-route.js +538 -0
  136. package/build/main/routers/alpha-router/functions/calculate-ratio-amount-in.d.ts +3 -0
  137. package/build/main/routers/alpha-router/functions/calculate-ratio-amount-in.js +18 -0
  138. package/build/main/routers/alpha-router/functions/compute-all-routes.d.ts +12 -0
  139. package/build/main/routers/alpha-router/functions/compute-all-routes.js +133 -0
  140. package/build/main/routers/alpha-router/functions/get-candidate-pools.d.ts +126 -0
  141. package/build/main/routers/alpha-router/functions/get-candidate-pools.js +1527 -0
  142. package/build/main/routers/alpha-router/gas-models/gas-costs.d.ts +12 -0
  143. package/build/main/routers/alpha-router/gas-models/gas-costs.js +200 -0
  144. package/build/main/routers/alpha-router/gas-models/gas-model.d.ts +107 -0
  145. package/build/main/routers/alpha-router/gas-models/gas-model.js +117 -0
  146. package/build/main/routers/alpha-router/gas-models/index.d.ts +2 -0
  147. package/build/main/routers/alpha-router/gas-models/index.js +19 -0
  148. package/build/main/routers/alpha-router/gas-models/mixedRoute/mixed-route-heuristic-gas-model.d.ts +24 -0
  149. package/build/main/routers/alpha-router/gas-models/mixedRoute/mixed-route-heuristic-gas-model.js +161 -0
  150. package/build/main/routers/alpha-router/gas-models/tick-based-heuristic-gas-model.d.ts +15 -0
  151. package/build/main/routers/alpha-router/gas-models/tick-based-heuristic-gas-model.js +191 -0
  152. package/build/main/routers/alpha-router/gas-models/v2/v2-heuristic-gas-model.d.ts +31 -0
  153. package/build/main/routers/alpha-router/gas-models/v2/v2-heuristic-gas-model.js +169 -0
  154. package/build/main/routers/alpha-router/gas-models/v3/v3-heuristic-gas-model.d.ts +26 -0
  155. package/build/main/routers/alpha-router/gas-models/v3/v3-heuristic-gas-model.js +41 -0
  156. package/build/main/routers/alpha-router/gas-models/v4/v4-heuristic-gas-model.d.ts +15 -0
  157. package/build/main/routers/alpha-router/gas-models/v4/v4-heuristic-gas-model.js +40 -0
  158. package/build/main/routers/alpha-router/index.d.ts +4 -0
  159. package/build/main/routers/alpha-router/index.js +21 -0
  160. package/build/main/routers/alpha-router/quoters/base-quoter.d.ts +77 -0
  161. package/build/main/routers/alpha-router/quoters/base-quoter.js +76 -0
  162. package/build/main/routers/alpha-router/quoters/index.d.ts +5 -0
  163. package/build/main/routers/alpha-router/quoters/index.js +22 -0
  164. package/build/main/routers/alpha-router/quoters/mixed-quoter.d.ts +32 -0
  165. package/build/main/routers/alpha-router/quoters/mixed-quoter.js +154 -0
  166. package/build/main/routers/alpha-router/quoters/model/index.d.ts +1 -0
  167. package/build/main/routers/alpha-router/quoters/model/index.js +18 -0
  168. package/build/main/routers/alpha-router/quoters/model/results/get-quotes-result.d.ts +6 -0
  169. package/build/main/routers/alpha-router/quoters/model/results/get-quotes-result.js +3 -0
  170. package/build/main/routers/alpha-router/quoters/model/results/get-routes-result.d.ts +6 -0
  171. package/build/main/routers/alpha-router/quoters/model/results/get-routes-result.js +3 -0
  172. package/build/main/routers/alpha-router/quoters/model/results/index.d.ts +2 -0
  173. package/build/main/routers/alpha-router/quoters/model/results/index.js +19 -0
  174. package/build/main/routers/alpha-router/quoters/v2-quoter.d.ts +24 -0
  175. package/build/main/routers/alpha-router/quoters/v2-quoter.js +141 -0
  176. package/build/main/routers/alpha-router/quoters/v3-quoter.d.ts +19 -0
  177. package/build/main/routers/alpha-router/quoters/v3-quoter.js +125 -0
  178. package/build/main/routers/alpha-router/quoters/v4-quoter.d.ts +18 -0
  179. package/build/main/routers/alpha-router/quoters/v4-quoter.js +122 -0
  180. package/build/main/routers/index.d.ts +4 -0
  181. package/build/main/routers/index.js +21 -0
  182. package/build/main/routers/legacy-router/bases.d.ts +213 -0
  183. package/build/main/routers/legacy-router/bases.js +124 -0
  184. package/build/main/routers/legacy-router/index.d.ts +1 -0
  185. package/build/main/routers/legacy-router/index.js +18 -0
  186. package/build/main/routers/legacy-router/legacy-router.d.ts +41 -0
  187. package/build/main/routers/legacy-router/legacy-router.js +291 -0
  188. package/build/main/routers/router.d.ts +195 -0
  189. package/build/main/routers/router.js +92 -0
  190. package/build/main/tsconfig.tsbuildinfo +1 -0
  191. package/build/main/types/other/factories/Erc20__factory.d.ts +45 -0
  192. package/build/main/types/other/factories/Erc20__factory.js +240 -0
  193. package/build/main/types/other/factories/GasDataArbitrum__factory.d.ts +18 -0
  194. package/build/main/types/other/factories/GasDataArbitrum__factory.js +58 -0
  195. package/build/main/types/other/factories/IMixedRouteQuoterV1__factory.d.ts +41 -0
  196. package/build/main/types/other/factories/IMixedRouteQuoterV1__factory.js +156 -0
  197. package/build/main/types/other/factories/ITokenValidator__factory.d.ts +22 -0
  198. package/build/main/types/other/factories/ITokenValidator__factory.js +78 -0
  199. package/build/main/types/other/factories/MixedRouteQuoterV2__factory.d.ts +86 -0
  200. package/build/main/types/other/factories/MixedRouteQuoterV2__factory.js +477 -0
  201. package/build/main/types/other/factories/Permit2__factory.d.ts +87 -0
  202. package/build/main/types/other/factories/Permit2__factory.js +941 -0
  203. package/build/main/types/other/factories/StateView__factory.d.ts +32 -0
  204. package/build/main/types/other/factories/StateView__factory.js +383 -0
  205. package/build/main/types/other/factories/SwapRouter02__factory.d.ts +67 -0
  206. package/build/main/types/other/factories/SwapRouter02__factory.js +1103 -0
  207. package/build/main/types/other/factories/TokenFeeDetector__factory.d.ts +47 -0
  208. package/build/main/types/other/factories/TokenFeeDetector__factory.js +243 -0
  209. package/build/main/types/other/factories/V4Quoter__factory.d.ts +37 -0
  210. package/build/main/types/other/factories/V4Quoter__factory.js +312 -0
  211. package/build/main/types/v2/factories/IUniswapV2Pair__factory.d.ts +35 -0
  212. package/build/main/types/v2/factories/IUniswapV2Pair__factory.js +671 -0
  213. package/build/main/types/v3/factories/IERC20Metadata__factory.d.ts +35 -0
  214. package/build/main/types/v3/factories/IERC20Metadata__factory.js +242 -0
  215. package/build/main/types/v3/factories/IQuoterV2__factory.d.ts +41 -0
  216. package/build/main/types/v3/factories/IQuoterV2__factory.js +220 -0
  217. package/build/main/types/v3/factories/IUniswapV3PoolState__factory.d.ts +22 -0
  218. package/build/main/types/v3/factories/IUniswapV3PoolState__factory.js +266 -0
  219. package/build/main/types/v3/factories/UniswapInterfaceMulticall__factory.d.ts +61 -0
  220. package/build/main/types/v3/factories/UniswapInterfaceMulticall__factory.js +132 -0
  221. package/build/main/util/addresses.d.ts +32 -0
  222. package/build/main/util/addresses.js +113 -0
  223. package/build/main/util/amounts.d.ts +10 -0
  224. package/build/main/util/amounts.js +94 -0
  225. package/build/main/util/callData.d.ts +1 -0
  226. package/build/main/util/callData.js +6 -0
  227. package/build/main/util/chains.d.ts +69 -0
  228. package/build/main/util/chains.js +740 -0
  229. package/build/main/util/defaultBlocksToLive.d.ts +4 -0
  230. package/build/main/util/defaultBlocksToLive.js +58 -0
  231. package/build/main/util/gas-factory-helpers.d.ts +34 -0
  232. package/build/main/util/gas-factory-helpers.js +439 -0
  233. package/build/main/util/hooksOptions.d.ts +5 -0
  234. package/build/main/util/hooksOptions.js +10 -0
  235. package/build/main/util/index.d.ts +10 -0
  236. package/build/main/util/index.js +27 -0
  237. package/build/main/util/intent.d.ts +6 -0
  238. package/build/main/util/intent.js +13 -0
  239. package/build/main/util/l2FeeChains.d.ts +2 -0
  240. package/build/main/util/l2FeeChains.js +18 -0
  241. package/build/main/util/log.d.ts +3 -0
  242. package/build/main/util/log.js +97 -0
  243. package/build/main/util/methodParameters.d.ts +5 -0
  244. package/build/main/util/methodParameters.js +147 -0
  245. package/build/main/util/metric.d.ts +48 -0
  246. package/build/main/util/metric.js +59 -0
  247. package/build/main/util/mixedRouteFilterOutV4Pools.d.ts +3 -0
  248. package/build/main/util/mixedRouteFilterOutV4Pools.js +17 -0
  249. package/build/main/util/onchainQuoteProviderConfigs.d.ts +42 -0
  250. package/build/main/util/onchainQuoteProviderConfigs.js +72 -0
  251. package/build/main/util/pool.d.ts +5 -0
  252. package/build/main/util/pool.js +44 -0
  253. package/build/main/util/protocols.d.ts +2 -0
  254. package/build/main/util/protocols.js +20 -0
  255. package/build/main/util/routes.d.ts +11 -0
  256. package/build/main/util/routes.js +148 -0
  257. package/build/main/util/serializeRouteIds.d.ts +2 -0
  258. package/build/main/util/serializeRouteIds.js +12 -0
  259. package/build/main/util/tenderlySimulationErrorBreakDown.d.ts +3 -0
  260. package/build/main/util/tenderlySimulationErrorBreakDown.js +33 -0
  261. package/build/main/util/unsupported-tokens.d.ts +37 -0
  262. package/build/main/util/unsupported-tokens.js +1119 -0
  263. package/build/module/index.d.ts +3 -0
  264. package/build/module/index.js +4 -0
  265. package/build/module/providers/cache-node.d.ts +10 -0
  266. package/build/module/providers/cache-node.js +29 -0
  267. package/build/module/providers/cache.d.ts +14 -0
  268. package/build/module/providers/cache.js +2 -0
  269. package/build/module/providers/caching/route/index.d.ts +2 -0
  270. package/build/module/providers/caching/route/index.js +3 -0
  271. package/build/module/providers/caching/route/model/cache-mode.d.ts +16 -0
  272. package/build/module/providers/caching/route/model/cache-mode.js +18 -0
  273. package/build/module/providers/caching/route/model/cached-route.d.ts +29 -0
  274. package/build/module/providers/caching/route/model/cached-route.js +73 -0
  275. package/build/module/providers/caching/route/model/cached-routes.d.ts +67 -0
  276. package/build/module/providers/caching/route/model/cached-routes.js +74 -0
  277. package/build/module/providers/caching/route/model/index.d.ts +3 -0
  278. package/build/module/providers/caching/route/model/index.js +4 -0
  279. package/build/module/providers/caching/route/route-caching-provider.d.ts +111 -0
  280. package/build/module/providers/caching/route/route-caching-provider.js +82 -0
  281. package/build/module/providers/caching-gas-provider.d.ts +23 -0
  282. package/build/module/providers/caching-gas-provider.js +37 -0
  283. package/build/module/providers/caching-subgraph-provider.d.ts +33 -0
  284. package/build/module/providers/caching-subgraph-provider.js +166 -0
  285. package/build/module/providers/caching-token-list-provider.d.ts +52 -0
  286. package/build/module/providers/caching-token-list-provider.js +140 -0
  287. package/build/module/providers/caching-token-provider.d.ts +24 -0
  288. package/build/module/providers/caching-token-provider.js +235 -0
  289. package/build/module/providers/eip-1559-gas-price-provider.d.ts +31 -0
  290. package/build/module/providers/eip-1559-gas-price-provider.js +64 -0
  291. package/build/module/providers/eth-estimate-gas-provider.d.ts +21 -0
  292. package/build/module/providers/eth-estimate-gas-provider.js +99 -0
  293. package/build/module/providers/eth-gas-station-info-gas-price-provider.d.ts +19 -0
  294. package/build/module/providers/eth-gas-station-info-gas-price-provider.js +29 -0
  295. package/build/module/providers/gas-price-provider.d.ts +10 -0
  296. package/build/module/providers/gas-price-provider.js +6 -0
  297. package/build/module/providers/index.d.ts +47 -0
  298. package/build/module/providers/index.js +48 -0
  299. package/build/module/providers/legacy-gas-price-provider.d.ts +7 -0
  300. package/build/module/providers/legacy-gas-price-provider.js +14 -0
  301. package/build/module/providers/multicall-provider.d.ts +83 -0
  302. package/build/module/providers/multicall-provider.js +11 -0
  303. package/build/module/providers/multicall-uniswap-provider.d.ts +37 -0
  304. package/build/module/providers/multicall-uniswap-provider.js +157 -0
  305. package/build/module/providers/on-chain-gas-price-provider.d.ts +19 -0
  306. package/build/module/providers/on-chain-gas-price-provider.js +33 -0
  307. package/build/module/providers/on-chain-quote-provider.d.ts +258 -0
  308. package/build/module/providers/on-chain-quote-provider.js +707 -0
  309. package/build/module/providers/pool-provider.d.ts +45 -0
  310. package/build/module/providers/pool-provider.js +66 -0
  311. package/build/module/providers/portion-provider.d.ts +86 -0
  312. package/build/module/providers/portion-provider.js +114 -0
  313. package/build/module/providers/provider.d.ts +38 -0
  314. package/build/module/providers/provider.js +2 -0
  315. package/build/module/providers/simulation-provider.d.ts +46 -0
  316. package/build/module/providers/simulation-provider.js +140 -0
  317. package/build/module/providers/static-gas-price-provider.d.ts +7 -0
  318. package/build/module/providers/static-gas-price-provider.js +9 -0
  319. package/build/module/providers/subgraph-provider-with-fallback.d.ts +11 -0
  320. package/build/module/providers/subgraph-provider-with-fallback.js +21 -0
  321. package/build/module/providers/subgraph-provider.d.ts +56 -0
  322. package/build/module/providers/subgraph-provider.js +284 -0
  323. package/build/module/providers/swap-router-provider.d.ts +30 -0
  324. package/build/module/providers/swap-router-provider.js +38 -0
  325. package/build/module/providers/tenderly-simulation-provider.d.ts +69 -0
  326. package/build/module/providers/tenderly-simulation-provider.js +456 -0
  327. package/build/module/providers/token-fee-fetcher.d.ts +31 -0
  328. package/build/module/providers/token-fee-fetcher.js +161 -0
  329. package/build/module/providers/token-properties-provider.d.ts +31 -0
  330. package/build/module/providers/token-properties-provider.js +114 -0
  331. package/build/module/providers/token-provider.d.ts +141 -0
  332. package/build/module/providers/token-provider.js +381 -0
  333. package/build/module/providers/token-validator-provider.d.ts +42 -0
  334. package/build/module/providers/token-validator-provider.js +92 -0
  335. package/build/module/providers/uri-subgraph-provider.d.ts +20 -0
  336. package/build/module/providers/uri-subgraph-provider.js +58 -0
  337. package/build/module/providers/v2/caching-pool-provider.d.ts +33 -0
  338. package/build/module/providers/v2/caching-pool-provider.js +85 -0
  339. package/build/module/providers/v2/caching-subgraph-provider.d.ts +19 -0
  340. package/build/module/providers/v2/caching-subgraph-provider.js +20 -0
  341. package/build/module/providers/v2/pool-provider.d.ts +63 -0
  342. package/build/module/providers/v2/pool-provider.js +141 -0
  343. package/build/module/providers/v2/quote-provider.d.ts +34 -0
  344. package/build/module/providers/v2/quote-provider.js +86 -0
  345. package/build/module/providers/v2/static-subgraph-provider.d.ts +19 -0
  346. package/build/module/providers/v2/static-subgraph-provider.js +164 -0
  347. package/build/module/providers/v2/subgraph-provider-with-fallback.d.ts +16 -0
  348. package/build/module/providers/v2/subgraph-provider-with-fallback.js +19 -0
  349. package/build/module/providers/v2/subgraph-provider.d.ts +53 -0
  350. package/build/module/providers/v2/subgraph-provider.js +341 -0
  351. package/build/module/providers/v2/uri-subgraph-provider.d.ts +4 -0
  352. package/build/module/providers/v2/uri-subgraph-provider.js +4 -0
  353. package/build/module/providers/v3/caching-pool-provider.d.ts +32 -0
  354. package/build/module/providers/v3/caching-pool-provider.js +77 -0
  355. package/build/module/providers/v3/caching-subgraph-provider.d.ts +19 -0
  356. package/build/module/providers/v3/caching-subgraph-provider.js +20 -0
  357. package/build/module/providers/v3/gas-data-provider.d.ts +39 -0
  358. package/build/module/providers/v3/gas-data-provider.js +22 -0
  359. package/build/module/providers/v3/pool-provider.d.ts +77 -0
  360. package/build/module/providers/v3/pool-provider.js +101 -0
  361. package/build/module/providers/v3/static-subgraph-provider.d.ts +21 -0
  362. package/build/module/providers/v3/static-subgraph-provider.js +210 -0
  363. package/build/module/providers/v3/subgraph-provider-with-fallback.d.ts +12 -0
  364. package/build/module/providers/v3/subgraph-provider-with-fallback.js +15 -0
  365. package/build/module/providers/v3/subgraph-provider.d.ts +45 -0
  366. package/build/module/providers/v3/subgraph-provider.js +42 -0
  367. package/build/module/providers/v3/uri-subgraph-provider.d.ts +4 -0
  368. package/build/module/providers/v3/uri-subgraph-provider.js +4 -0
  369. package/build/module/providers/v4/caching-pool-provider.d.ts +24 -0
  370. package/build/module/providers/v4/caching-pool-provider.js +74 -0
  371. package/build/module/providers/v4/caching-subgraph-provider.d.ts +19 -0
  372. package/build/module/providers/v4/caching-subgraph-provider.js +20 -0
  373. package/build/module/providers/v4/euler-swap-hooks-subgraph-provider.d.ts +25 -0
  374. package/build/module/providers/v4/euler-swap-hooks-subgraph-provider.js +153 -0
  375. package/build/module/providers/v4/pool-provider.d.ts +58 -0
  376. package/build/module/providers/v4/pool-provider.js +106 -0
  377. package/build/module/providers/v4/static-subgraph-provider.d.ts +15 -0
  378. package/build/module/providers/v4/static-subgraph-provider.js +71 -0
  379. package/build/module/providers/v4/subgraph-provider-with-fallback.d.ts +5 -0
  380. package/build/module/providers/v4/subgraph-provider-with-fallback.js +8 -0
  381. package/build/module/providers/v4/subgraph-provider.d.ts +63 -0
  382. package/build/module/providers/v4/subgraph-provider.js +59 -0
  383. package/build/module/providers/v4/uri-subgraph-provider.d.ts +4 -0
  384. package/build/module/providers/v4/uri-subgraph-provider.js +4 -0
  385. package/build/module/routers/alpha-router/alpha-router.d.ts +483 -0
  386. package/build/module/routers/alpha-router/alpha-router.js +1680 -0
  387. package/build/module/routers/alpha-router/config.d.ts +4 -0
  388. package/build/module/routers/alpha-router/config.js +127 -0
  389. package/build/module/routers/alpha-router/entities/index.d.ts +1 -0
  390. package/build/module/routers/alpha-router/entities/index.js +2 -0
  391. package/build/module/routers/alpha-router/entities/route-with-valid-quote.d.ts +208 -0
  392. package/build/module/routers/alpha-router/entities/route-with-valid-quote.js +184 -0
  393. package/build/module/routers/alpha-router/functions/best-swap-route.d.ts +24 -0
  394. package/build/module/routers/alpha-router/functions/best-swap-route.js +528 -0
  395. package/build/module/routers/alpha-router/functions/calculate-ratio-amount-in.d.ts +3 -0
  396. package/build/module/routers/alpha-router/functions/calculate-ratio-amount-in.js +14 -0
  397. package/build/module/routers/alpha-router/functions/compute-all-routes.d.ts +12 -0
  398. package/build/module/routers/alpha-router/functions/compute-all-routes.js +125 -0
  399. package/build/module/routers/alpha-router/functions/get-candidate-pools.d.ts +126 -0
  400. package/build/module/routers/alpha-router/functions/get-candidate-pools.js +1516 -0
  401. package/build/module/routers/alpha-router/gas-models/gas-costs.d.ts +12 -0
  402. package/build/module/routers/alpha-router/gas-models/gas-costs.js +189 -0
  403. package/build/module/routers/alpha-router/gas-models/gas-model.d.ts +107 -0
  404. package/build/module/routers/alpha-router/gas-models/gas-model.js +111 -0
  405. package/build/module/routers/alpha-router/gas-models/index.d.ts +2 -0
  406. package/build/module/routers/alpha-router/gas-models/index.js +3 -0
  407. package/build/module/routers/alpha-router/gas-models/mixedRoute/mixed-route-heuristic-gas-model.d.ts +24 -0
  408. package/build/module/routers/alpha-router/gas-models/mixedRoute/mixed-route-heuristic-gas-model.js +154 -0
  409. package/build/module/routers/alpha-router/gas-models/tick-based-heuristic-gas-model.d.ts +15 -0
  410. package/build/module/routers/alpha-router/gas-models/tick-based-heuristic-gas-model.js +187 -0
  411. package/build/module/routers/alpha-router/gas-models/v2/v2-heuristic-gas-model.d.ts +31 -0
  412. package/build/module/routers/alpha-router/gas-models/v2/v2-heuristic-gas-model.js +162 -0
  413. package/build/module/routers/alpha-router/gas-models/v3/v3-heuristic-gas-model.d.ts +26 -0
  414. package/build/module/routers/alpha-router/gas-models/v3/v3-heuristic-gas-model.js +37 -0
  415. package/build/module/routers/alpha-router/gas-models/v4/v4-heuristic-gas-model.d.ts +15 -0
  416. package/build/module/routers/alpha-router/gas-models/v4/v4-heuristic-gas-model.js +36 -0
  417. package/build/module/routers/alpha-router/index.d.ts +4 -0
  418. package/build/module/routers/alpha-router/index.js +5 -0
  419. package/build/module/routers/alpha-router/quoters/base-quoter.d.ts +77 -0
  420. package/build/module/routers/alpha-router/quoters/base-quoter.js +69 -0
  421. package/build/module/routers/alpha-router/quoters/index.d.ts +5 -0
  422. package/build/module/routers/alpha-router/quoters/index.js +6 -0
  423. package/build/module/routers/alpha-router/quoters/mixed-quoter.d.ts +32 -0
  424. package/build/module/routers/alpha-router/quoters/mixed-quoter.js +147 -0
  425. package/build/module/routers/alpha-router/quoters/model/index.d.ts +1 -0
  426. package/build/module/routers/alpha-router/quoters/model/index.js +2 -0
  427. package/build/module/routers/alpha-router/quoters/model/results/get-quotes-result.d.ts +6 -0
  428. package/build/module/routers/alpha-router/quoters/model/results/get-quotes-result.js +2 -0
  429. package/build/module/routers/alpha-router/quoters/model/results/get-routes-result.d.ts +6 -0
  430. package/build/module/routers/alpha-router/quoters/model/results/get-routes-result.js +2 -0
  431. package/build/module/routers/alpha-router/quoters/model/results/index.d.ts +2 -0
  432. package/build/module/routers/alpha-router/quoters/model/results/index.js +3 -0
  433. package/build/module/routers/alpha-router/quoters/v2-quoter.d.ts +24 -0
  434. package/build/module/routers/alpha-router/quoters/v2-quoter.js +138 -0
  435. package/build/module/routers/alpha-router/quoters/v3-quoter.d.ts +19 -0
  436. package/build/module/routers/alpha-router/quoters/v3-quoter.js +118 -0
  437. package/build/module/routers/alpha-router/quoters/v4-quoter.d.ts +18 -0
  438. package/build/module/routers/alpha-router/quoters/v4-quoter.js +115 -0
  439. package/build/module/routers/index.d.ts +4 -0
  440. package/build/module/routers/index.js +5 -0
  441. package/build/module/routers/legacy-router/bases.d.ts +213 -0
  442. package/build/module/routers/legacy-router/bases.js +130 -0
  443. package/build/module/routers/legacy-router/index.d.ts +1 -0
  444. package/build/module/routers/legacy-router/index.js +2 -0
  445. package/build/module/routers/legacy-router/legacy-router.d.ts +41 -0
  446. package/build/module/routers/legacy-router/legacy-router.js +292 -0
  447. package/build/module/routers/router.d.ts +195 -0
  448. package/build/module/routers/router.js +79 -0
  449. package/build/module/tsconfig.module.tsbuildinfo +1 -0
  450. package/build/module/types/other/factories/Erc20__factory.d.ts +45 -0
  451. package/build/module/types/other/factories/Erc20__factory.js +236 -0
  452. package/build/module/types/other/factories/GasDataArbitrum__factory.d.ts +18 -0
  453. package/build/module/types/other/factories/GasDataArbitrum__factory.js +54 -0
  454. package/build/module/types/other/factories/IMixedRouteQuoterV1__factory.d.ts +41 -0
  455. package/build/module/types/other/factories/IMixedRouteQuoterV1__factory.js +152 -0
  456. package/build/module/types/other/factories/ITokenValidator__factory.d.ts +22 -0
  457. package/build/module/types/other/factories/ITokenValidator__factory.js +74 -0
  458. package/build/module/types/other/factories/MixedRouteQuoterV2__factory.d.ts +86 -0
  459. package/build/module/types/other/factories/MixedRouteQuoterV2__factory.js +473 -0
  460. package/build/module/types/other/factories/Permit2__factory.d.ts +87 -0
  461. package/build/module/types/other/factories/Permit2__factory.js +937 -0
  462. package/build/module/types/other/factories/StateView__factory.d.ts +32 -0
  463. package/build/module/types/other/factories/StateView__factory.js +379 -0
  464. package/build/module/types/other/factories/SwapRouter02__factory.d.ts +67 -0
  465. package/build/module/types/other/factories/SwapRouter02__factory.js +1099 -0
  466. package/build/module/types/other/factories/TokenFeeDetector__factory.d.ts +47 -0
  467. package/build/module/types/other/factories/TokenFeeDetector__factory.js +239 -0
  468. package/build/module/types/other/factories/V4Quoter__factory.d.ts +37 -0
  469. package/build/module/types/other/factories/V4Quoter__factory.js +308 -0
  470. package/build/module/types/v2/factories/IUniswapV2Pair__factory.d.ts +35 -0
  471. package/build/module/types/v2/factories/IUniswapV2Pair__factory.js +667 -0
  472. package/build/module/types/v3/factories/IERC20Metadata__factory.d.ts +35 -0
  473. package/build/module/types/v3/factories/IERC20Metadata__factory.js +238 -0
  474. package/build/module/types/v3/factories/IQuoterV2__factory.d.ts +41 -0
  475. package/build/module/types/v3/factories/IQuoterV2__factory.js +216 -0
  476. package/build/module/types/v3/factories/IUniswapV3PoolState__factory.d.ts +22 -0
  477. package/build/module/types/v3/factories/IUniswapV3PoolState__factory.js +262 -0
  478. package/build/module/types/v3/factories/UniswapInterfaceMulticall__factory.d.ts +61 -0
  479. package/build/module/types/v3/factories/UniswapInterfaceMulticall__factory.js +128 -0
  480. package/build/module/util/addresses.d.ts +32 -0
  481. package/build/module/util/addresses.js +233 -0
  482. package/build/module/util/amounts.d.ts +10 -0
  483. package/build/module/util/amounts.js +82 -0
  484. package/build/module/util/callData.d.ts +1 -0
  485. package/build/module/util/callData.js +3 -0
  486. package/build/module/util/chains.d.ts +69 -0
  487. package/build/module/util/chains.js +732 -0
  488. package/build/module/util/defaultBlocksToLive.d.ts +4 -0
  489. package/build/module/util/defaultBlocksToLive.js +55 -0
  490. package/build/module/util/gas-factory-helpers.d.ts +34 -0
  491. package/build/module/util/gas-factory-helpers.js +421 -0
  492. package/build/module/util/hooksOptions.d.ts +5 -0
  493. package/build/module/util/hooksOptions.js +7 -0
  494. package/build/module/util/index.d.ts +10 -0
  495. package/build/module/util/index.js +11 -0
  496. package/build/module/util/intent.d.ts +6 -0
  497. package/build/module/util/intent.js +10 -0
  498. package/build/module/util/l2FeeChains.d.ts +2 -0
  499. package/build/module/util/l2FeeChains.js +15 -0
  500. package/build/module/util/log.d.ts +3 -0
  501. package/build/module/util/log.js +93 -0
  502. package/build/module/util/methodParameters.d.ts +5 -0
  503. package/build/module/util/methodParameters.js +145 -0
  504. package/build/module/util/metric.d.ts +48 -0
  505. package/build/module/util/metric.js +53 -0
  506. package/build/module/util/mixedRouteFilterOutV4Pools.d.ts +3 -0
  507. package/build/module/util/mixedRouteFilterOutV4Pools.js +12 -0
  508. package/build/module/util/onchainQuoteProviderConfigs.d.ts +42 -0
  509. package/build/module/util/onchainQuoteProviderConfigs.js +74 -0
  510. package/build/module/util/pool.d.ts +5 -0
  511. package/build/module/util/pool.js +41 -0
  512. package/build/module/util/protocols.d.ts +2 -0
  513. package/build/module/util/protocols.js +16 -0
  514. package/build/module/util/routes.d.ts +11 -0
  515. package/build/module/util/routes.js +136 -0
  516. package/build/module/util/serializeRouteIds.d.ts +2 -0
  517. package/build/module/util/serializeRouteIds.js +7 -0
  518. package/build/module/util/tenderlySimulationErrorBreakDown.d.ts +3 -0
  519. package/build/module/util/tenderlySimulationErrorBreakDown.js +29 -0
  520. package/build/module/util/unsupported-tokens.d.ts +37 -0
  521. package/build/module/util/unsupported-tokens.js +1116 -0
  522. package/package.json +129 -0
@@ -0,0 +1,483 @@
1
+ import { BaseProvider } from '@ethersproject/providers';
2
+ import { Protocol } from '@uniswap/router-sdk';
3
+ import { ChainId, Currency, TradeType } from '@uniswap/sdk-core';
4
+ import { UniversalRouterVersion } from '@uniswap/universal-router-sdk';
5
+ import { Position } from '@uniswap/v3-sdk';
6
+ import { CacheMode, IOnChainQuoteProvider, IRouteCachingProvider, ISwapRouterProvider, ITokenPropertiesProvider, IV2QuoteProvider, IV2SubgraphProvider, IV4SubgraphProvider, Simulator, UniswapMulticallProvider } from '../../providers';
7
+ import { ITokenListProvider } from '../../providers/caching-token-list-provider';
8
+ import { IGasPriceProvider } from '../../providers/gas-price-provider';
9
+ import { IPortionProvider } from '../../providers/portion-provider';
10
+ import { ITokenProvider } from '../../providers/token-provider';
11
+ import { ITokenValidatorProvider } from '../../providers/token-validator-provider';
12
+ import { IV2PoolProvider } from '../../providers/v2/pool-provider';
13
+ import { ArbitrumGasData, IL2GasDataProvider } from '../../providers/v3/gas-data-provider';
14
+ import { IV3PoolProvider } from '../../providers/v3/pool-provider';
15
+ import { IV3SubgraphProvider } from '../../providers/v3/subgraph-provider';
16
+ import { IV4PoolProvider } from '../../providers/v4/pool-provider';
17
+ import { HooksOptions } from '../../util';
18
+ import { CurrencyAmount } from '../../util/amounts';
19
+ import { INTENT } from '../../util/intent';
20
+ import { IRouter, ISwapToRatio, MixedRoute, SwapAndAddConfig, SwapAndAddOptions, SwapOptions, SwapRoute, SwapToRatioResponse, V2Route, V3Route, V4Route } from '../router';
21
+ import { MixedRouteWithValidQuote, RouteWithValidQuote, V3RouteWithValidQuote, V4RouteWithValidQuote } from './entities/route-with-valid-quote';
22
+ import { IOnChainGasModelFactory, IV2GasModelFactory } from './gas-models/gas-model';
23
+ import { MixedQuoter, V2Quoter, V3Quoter } from './quoters';
24
+ import { V4Quoter } from './quoters/v4-quoter';
25
+ export type AlphaRouterParams = {
26
+ /**
27
+ * The chain id for this instance of the Alpha Router.
28
+ */
29
+ chainId: ChainId;
30
+ /**
31
+ * The Web3 provider for getting on-chain data.
32
+ */
33
+ provider: BaseProvider;
34
+ /**
35
+ * The provider to use for making multicalls. Used for getting on-chain data
36
+ * like pools, tokens, quotes in batch.
37
+ */
38
+ multicall2Provider?: UniswapMulticallProvider;
39
+ /**
40
+ * The provider for getting all pools that exist on V4 from the Subgraph. The pools
41
+ * from this provider are filtered during the algorithm to a set of candidate pools.
42
+ */
43
+ v4SubgraphProvider?: IV4SubgraphProvider;
44
+ /**
45
+ * The provider for getting data about V4 pools.
46
+ */
47
+ v4PoolProvider?: IV4PoolProvider;
48
+ /**
49
+ * The provider for getting all pools that exist on V3 from the Subgraph. The pools
50
+ * from this provider are filtered during the algorithm to a set of candidate pools.
51
+ */
52
+ v3SubgraphProvider?: IV3SubgraphProvider;
53
+ /**
54
+ * The provider for getting data about V3 pools.
55
+ */
56
+ v3PoolProvider?: IV3PoolProvider;
57
+ /**
58
+ * The provider for getting V3 quotes.
59
+ */
60
+ onChainQuoteProvider?: IOnChainQuoteProvider;
61
+ /**
62
+ * The provider for getting all pools that exist on V2 from the Subgraph. The pools
63
+ * from this provider are filtered during the algorithm to a set of candidate pools.
64
+ */
65
+ v2SubgraphProvider?: IV2SubgraphProvider;
66
+ /**
67
+ * The provider for getting data about V2 pools.
68
+ */
69
+ v2PoolProvider?: IV2PoolProvider;
70
+ /**
71
+ * The provider for getting V3 quotes.
72
+ */
73
+ v2QuoteProvider?: IV2QuoteProvider;
74
+ /**
75
+ * The provider for getting data about Tokens.
76
+ */
77
+ tokenProvider?: ITokenProvider;
78
+ /**
79
+ * The provider for getting the current gas price to use when account for gas in the
80
+ * algorithm.
81
+ */
82
+ gasPriceProvider?: IGasPriceProvider;
83
+ /**
84
+ * A factory for generating a gas model that is used when estimating the gas used by
85
+ * V4 routes.
86
+ */
87
+ v4GasModelFactory?: IOnChainGasModelFactory<V4RouteWithValidQuote>;
88
+ /**
89
+ * A factory for generating a gas model that is used when estimating the gas used by
90
+ * V3 routes.
91
+ */
92
+ v3GasModelFactory?: IOnChainGasModelFactory<V3RouteWithValidQuote>;
93
+ /**
94
+ * A factory for generating a gas model that is used when estimating the gas used by
95
+ * V2 routes.
96
+ */
97
+ v2GasModelFactory?: IV2GasModelFactory;
98
+ /**
99
+ * A factory for generating a gas model that is used when estimating the gas used by
100
+ * V3 routes.
101
+ */
102
+ mixedRouteGasModelFactory?: IOnChainGasModelFactory<MixedRouteWithValidQuote>;
103
+ /**
104
+ * A token list that specifies Token that should be blocked from routing through.
105
+ * Defaults to Uniswap's unsupported token list.
106
+ */
107
+ blockedTokenListProvider?: ITokenListProvider;
108
+ /**
109
+ * Calls lens function on SwapRouter02 to determine ERC20 approval types for
110
+ * LP position tokens.
111
+ */
112
+ swapRouterProvider?: ISwapRouterProvider;
113
+ /**
114
+ * A token validator for detecting fee-on-transfer tokens or tokens that can't be transferred.
115
+ */
116
+ tokenValidatorProvider?: ITokenValidatorProvider;
117
+ /**
118
+ * Calls the arbitrum gas data contract to fetch constants for calculating the l1 fee.
119
+ */
120
+ arbitrumGasDataProvider?: IL2GasDataProvider<ArbitrumGasData>;
121
+ /**
122
+ * Simulates swaps and returns new SwapRoute with updated gas estimates.
123
+ */
124
+ simulator?: Simulator;
125
+ /**
126
+ * A provider for caching the best route given an amount, quoteToken, tradeType
127
+ */
128
+ routeCachingProvider?: IRouteCachingProvider;
129
+ /**
130
+ * A provider for getting token properties for special tokens like fee-on-transfer tokens.
131
+ */
132
+ tokenPropertiesProvider?: ITokenPropertiesProvider;
133
+ /**
134
+ * A provider for computing the portion-related data for routes and quotes.
135
+ */
136
+ portionProvider?: IPortionProvider;
137
+ /**
138
+ * All the supported v2 chains configuration
139
+ */
140
+ v2Supported?: ChainId[];
141
+ /**
142
+ * All the supported v4 chains configuration
143
+ */
144
+ v4Supported?: ChainId[];
145
+ /**
146
+ * All the supported mixed chains configuration
147
+ */
148
+ mixedSupported?: ChainId[];
149
+ /**
150
+ * All the supported mixed cross-liquidity high v3 tvl pools against low-to-mid v4 pools chains configuration
151
+ */
152
+ mixedCrossLiquidityV3AgainstV4Supported?: ChainId[];
153
+ /**
154
+ * The v4 pool params to be used for the v4 pool provider.
155
+ * fee tiers, tickspacings, and hook addresses
156
+ */
157
+ v4PoolParams?: Array<[number, number, string]>;
158
+ /**
159
+ * We want to rollout the cached routes cache invalidation carefully.
160
+ * Because a wrong fix might impact prod success rate and/or latency.
161
+ */
162
+ cachedRoutesCacheInvalidationFixRolloutPercentage?: number;
163
+ /**
164
+ * All the chains that have the cache invalidation enabled
165
+ * https://linear.app/uniswap/issue/ROUTE-467/tenderly-simulation-during-caching-lambda
166
+ */
167
+ deleteCacheEnabledChains?: ChainId[];
168
+ };
169
+ export declare class MapWithLowerCaseKey<V> extends Map<string, V> {
170
+ set(key: string, value: V): this;
171
+ }
172
+ export declare class LowerCaseStringArray extends Array<string> {
173
+ constructor(...items: string[]);
174
+ }
175
+ /**
176
+ * Determines the pools that the algorithm will consider when finding the optimal swap.
177
+ *
178
+ * All pools on each protocol are filtered based on the heuristics specified here to generate
179
+ * the set of candidate pools. The Top N pools are taken by Total Value Locked (TVL).
180
+ *
181
+ * Higher values here result in more pools to explore which results in higher latency.
182
+ */
183
+ export type ProtocolPoolSelection = {
184
+ /**
185
+ * The top N pools by TVL out of all pools on the protocol.
186
+ */
187
+ topN: number;
188
+ /**
189
+ * The top N pools by TVL of pools that consist of tokenIn and tokenOut.
190
+ */
191
+ topNDirectSwaps: number;
192
+ /**
193
+ * The top N pools by TVL of pools where one token is tokenIn and the
194
+ * top N pools by TVL of pools where one token is tokenOut tokenOut.
195
+ */
196
+ topNTokenInOut: number;
197
+ /**
198
+ * Given the topNTokenInOut pools, gets the top N pools that involve the other token.
199
+ * E.g. for a WETH -> USDC swap, if topNTokenInOut found WETH -> DAI and WETH -> USDT,
200
+ * a value of 2 would find the top 2 pools that involve DAI and top 2 pools that involve USDT.
201
+ */
202
+ topNSecondHop: number;
203
+ /**
204
+ * Given the topNTokenInOut pools and a token address,
205
+ * gets the top N pools that involve the other token.
206
+ * If token address is not on the list, we default to topNSecondHop.
207
+ * E.g. for a WETH -> USDC swap, if topNTokenInOut found WETH -> DAI and WETH -> USDT,
208
+ * and there's a mapping USDT => 4, but no mapping for DAI
209
+ * it would find the top 4 pools that involve USDT, and find the topNSecondHop pools that involve DAI
210
+ */
211
+ topNSecondHopForTokenAddress?: MapWithLowerCaseKey<number>;
212
+ /**
213
+ * List of token addresses to avoid using as a second hop.
214
+ * There might be multiple reasons why we would like to avoid a specific token,
215
+ * but the specific reason that we are trying to solve is when the pool is not synced properly
216
+ * e.g. when the pool has a rebasing token that isn't syncing the pool on every rebase.
217
+ */
218
+ tokensToAvoidOnSecondHops?: LowerCaseStringArray;
219
+ /**
220
+ * The top N pools for token in and token out that involve a token from a list of
221
+ * hardcoded 'base tokens'. These are standard tokens such as WETH, USDC, DAI, etc.
222
+ * This is similar to how the legacy routing algorithm used by Uniswap would select
223
+ * pools and is intended to make the new pool selection algorithm close to a superset
224
+ * of the old algorithm.
225
+ */
226
+ topNWithEachBaseToken: number;
227
+ /**
228
+ * Given the topNWithEachBaseToken pools, takes the top N pools from the full list.
229
+ * E.g. for a WETH -> USDC swap, if topNWithEachBaseToken found WETH -0.05-> DAI,
230
+ * WETH -0.01-> DAI, WETH -0.05-> USDC, WETH -0.3-> USDC, a value of 2 would reduce
231
+ * this set to the top 2 pools from that full list.
232
+ */
233
+ topNWithBaseToken: number;
234
+ };
235
+ export type AlphaRouterConfig = {
236
+ /**
237
+ * The block number to use for all on-chain data. If not provided, the router will
238
+ * use the latest block returned by the provider.
239
+ */
240
+ blockNumber?: number | Promise<number>;
241
+ /**
242
+ * The protocols to consider when finding the optimal swap. If not provided all protocols
243
+ * will be used.
244
+ */
245
+ protocols?: Protocol[];
246
+ /**
247
+ * The protocols-version pools to be excluded from the mixed routes.
248
+ */
249
+ excludedProtocolsFromMixed?: Protocol[];
250
+ /**
251
+ * Config for selecting which pools to consider routing via on V2.
252
+ */
253
+ v2PoolSelection: ProtocolPoolSelection;
254
+ /**
255
+ * Config for selecting which pools to consider routing via on V3.
256
+ */
257
+ v3PoolSelection: ProtocolPoolSelection;
258
+ /**
259
+ * Config for selecting which pools to consider routing via on V4.
260
+ */
261
+ v4PoolSelection: ProtocolPoolSelection;
262
+ /**
263
+ * For each route, the maximum number of hops to consider. More hops will increase latency of the algorithm.
264
+ */
265
+ maxSwapsPerPath: number;
266
+ /**
267
+ * The maximum number of splits in the returned route. A higher maximum will increase latency of the algorithm.
268
+ */
269
+ maxSplits: number;
270
+ /**
271
+ * The minimum number of splits in the returned route.
272
+ * This parameters should always be set to 1. It is only included for testing purposes.
273
+ */
274
+ minSplits: number;
275
+ /**
276
+ * Forces the returned swap to route across all protocols.
277
+ * This parameter should always be false. It is only included for testing purposes.
278
+ */
279
+ forceCrossProtocol: boolean;
280
+ /**
281
+ * Force the alpha router to choose a mixed route swap.
282
+ * Default will be falsy. It is only included for testing purposes.
283
+ */
284
+ forceMixedRoutes?: boolean;
285
+ /**
286
+ * The minimum percentage of the input token to use for each route in a split route.
287
+ * All routes will have a multiple of this value. For example is distribution percentage is 5,
288
+ * a potential return swap would be:
289
+ *
290
+ * 5% of input => Route 1
291
+ * 55% of input => Route 2
292
+ * 40% of input => Route 3
293
+ */
294
+ distributionPercent: number;
295
+ /**
296
+ * Flag to indicate whether to use the cached routes or not.
297
+ * By default, the cached routes will be used.
298
+ */
299
+ useCachedRoutes?: boolean;
300
+ /**
301
+ * Flag to indicate whether to write to the cached routes or not.
302
+ * By default, the cached routes will be written to.
303
+ */
304
+ writeToCachedRoutes?: boolean;
305
+ /**
306
+ * Flag to indicate whether to use the CachedRoutes in optimistic mode.
307
+ * Optimistic mode means that we will allow blocksToLive greater than 1.
308
+ */
309
+ optimisticCachedRoutes?: boolean;
310
+ /**
311
+ * Debug param that helps to see the short-term latencies improvements without impacting the main path.
312
+ */
313
+ debugRouting?: boolean;
314
+ /**
315
+ * Flag that allow us to override the cache mode.
316
+ */
317
+ overwriteCacheMode?: CacheMode;
318
+ /**
319
+ * Flag for token properties provider to enable fetching fee-on-transfer tokens.
320
+ */
321
+ enableFeeOnTransferFeeFetching?: boolean;
322
+ /**
323
+ * Tenderly natively support save simulation failures if failed,
324
+ * we need this as a pass-through flag to enable/disable this feature.
325
+ */
326
+ saveTenderlySimulationIfFailed?: boolean;
327
+ /**
328
+ * Include an additional response field specifying the swap gas estimation in terms of a specific gas token.
329
+ * This requires a suitable Native/GasToken pool to exist on V3. If one does not exist this field will return null.
330
+ */
331
+ gasToken?: string;
332
+ /**
333
+ * The version of the universal router to use.
334
+ */
335
+ universalRouterVersion?: UniversalRouterVersion;
336
+ /**
337
+ * pass in routing-api intent to align the intent between routing-api and SOR
338
+ */
339
+ intent?: INTENT;
340
+ /**
341
+ * boolean flag to control whether we should enable mixed route that connects ETH <-> WETH
342
+ */
343
+ shouldEnableMixedRouteEthWeth?: boolean;
344
+ /**
345
+ * hashed router ids of the cached route, if the online routing lambda uses the cached route to serve the quote
346
+ */
347
+ cachedRoutesRouteIds?: string;
348
+ /**
349
+ * enable mixed route with UR1_2 version backward compatibility issue
350
+ */
351
+ enableMixedRouteWithUR1_2?: boolean;
352
+ /**
353
+ * enable debug mode for async routing lambda
354
+ */
355
+ enableDebug?: boolean;
356
+ /**
357
+ * pass in hooks options for hooks routing toggles from the frontend
358
+ */
359
+ hooksOptions?: HooksOptions;
360
+ /**
361
+ * sync call request id passed from the upstream (TAPI)
362
+ */
363
+ requestId?: string;
364
+ /**
365
+ * async call request id passed from sync routing lambda
366
+ */
367
+ asyncRequestId?: string;
368
+ /**
369
+ * pools to manually route through
370
+ * couple use cases for this, the top one is to route through hooked pool(s)
371
+ * Note this can only work when cached routes are not hit
372
+ */
373
+ poolsToManuallyRouteThrough?: string[];
374
+ };
375
+ export declare class AlphaRouter implements IRouter<AlphaRouterConfig>, ISwapToRatio<AlphaRouterConfig, SwapAndAddConfig> {
376
+ protected chainId: ChainId;
377
+ protected provider: BaseProvider;
378
+ protected multicall2Provider: UniswapMulticallProvider;
379
+ protected v4SubgraphProvider: IV4SubgraphProvider;
380
+ protected v4PoolProvider: IV4PoolProvider;
381
+ protected v3SubgraphProvider: IV3SubgraphProvider;
382
+ protected v3PoolProvider: IV3PoolProvider;
383
+ protected onChainQuoteProvider: IOnChainQuoteProvider;
384
+ protected v2SubgraphProvider: IV2SubgraphProvider;
385
+ protected v2QuoteProvider: IV2QuoteProvider;
386
+ protected v2PoolProvider: IV2PoolProvider;
387
+ protected tokenProvider: ITokenProvider;
388
+ protected gasPriceProvider: IGasPriceProvider;
389
+ protected swapRouterProvider: ISwapRouterProvider;
390
+ protected v4GasModelFactory: IOnChainGasModelFactory<V4RouteWithValidQuote>;
391
+ protected v3GasModelFactory: IOnChainGasModelFactory<V3RouteWithValidQuote>;
392
+ protected v2GasModelFactory: IV2GasModelFactory;
393
+ protected mixedRouteGasModelFactory: IOnChainGasModelFactory<MixedRouteWithValidQuote>;
394
+ protected tokenValidatorProvider?: ITokenValidatorProvider;
395
+ protected blockedTokenListProvider?: ITokenListProvider;
396
+ protected l2GasDataProvider?: IL2GasDataProvider<ArbitrumGasData>;
397
+ protected simulator?: Simulator;
398
+ protected v2Quoter: V2Quoter;
399
+ protected v3Quoter: V3Quoter;
400
+ protected v4Quoter: V4Quoter;
401
+ protected mixedQuoter: MixedQuoter;
402
+ protected routeCachingProvider?: IRouteCachingProvider;
403
+ protected tokenPropertiesProvider: ITokenPropertiesProvider;
404
+ protected portionProvider: IPortionProvider;
405
+ protected v2Supported?: ChainId[];
406
+ protected v4Supported?: ChainId[];
407
+ protected mixedSupported?: ChainId[];
408
+ protected mixedCrossLiquidityV3AgainstV4Supported?: ChainId[];
409
+ protected v4PoolParams?: Array<[number, number, string]>;
410
+ protected cachedRoutesCacheInvalidationFixRolloutPercentage?: number;
411
+ protected shouldEnableMixedRouteEthWeth?: boolean;
412
+ protected deleteCacheEnabledChains?: ChainId[];
413
+ constructor({ chainId, provider, multicall2Provider, v4SubgraphProvider, v4PoolProvider, v3PoolProvider, onChainQuoteProvider, v2PoolProvider, v2QuoteProvider, v2SubgraphProvider, tokenProvider, blockedTokenListProvider, v3SubgraphProvider, gasPriceProvider, v4GasModelFactory, v3GasModelFactory, v2GasModelFactory, mixedRouteGasModelFactory, swapRouterProvider, tokenValidatorProvider, arbitrumGasDataProvider, simulator, routeCachingProvider, tokenPropertiesProvider, portionProvider, v2Supported, v4Supported, mixedSupported, mixedCrossLiquidityV3AgainstV4Supported, v4PoolParams, cachedRoutesCacheInvalidationFixRolloutPercentage, deleteCacheEnabledChains, }: AlphaRouterParams);
414
+ routeToRatio(token0Balance: CurrencyAmount, token1Balance: CurrencyAmount, position: Position, swapAndAddConfig: SwapAndAddConfig, swapAndAddOptions?: SwapAndAddOptions, routingConfig?: Partial<AlphaRouterConfig>): Promise<SwapToRatioResponse>;
415
+ /**
416
+ * @inheritdoc IRouter
417
+ */
418
+ route(amount: CurrencyAmount, quoteCurrency: Currency, tradeType: TradeType, swapConfig?: SwapOptions, partialRoutingConfig?: Partial<AlphaRouterConfig>): Promise<SwapRoute | null>;
419
+ /**
420
+ * Refreshes the pools for the given routes.
421
+ *
422
+ * @param routes the routes to refresh the pools for
423
+ * @param routingConfig the routing config
424
+ */
425
+ protected refreshPools(routes: RouteWithValidQuote[], routingConfig: AlphaRouterConfig, v2PoolProvider: IV2PoolProvider, v3PoolProvider: IV3PoolProvider, v4PoolProvider: IV4PoolProvider): Promise<void>;
426
+ /**
427
+ * Refreshes the V2 pools for the given route.
428
+ *
429
+ * @param route the route to refresh the V2 pools for
430
+ * @param config the routing config
431
+ * @param v2PoolProvider the V2 pool provider
432
+ * @returns the refreshed route
433
+ */
434
+ protected static refreshV2Pools(route: V2Route, config: AlphaRouterConfig, v2PoolProvider: IV2PoolProvider): Promise<V2Route>;
435
+ /**
436
+ * Refreshes the V3 pools for the given route.
437
+ *
438
+ * @param route the route to refresh the V3 pools for
439
+ * @param config the routing config
440
+ * @param v3PoolProvider the V3 pool provider
441
+ * @returns the refreshed route
442
+ */
443
+ protected static refreshV3Pools(route: V3Route, config: AlphaRouterConfig, v3PoolProvider: IV3PoolProvider): Promise<V3Route>;
444
+ /**
445
+ * Refreshes the V4 pools for the given route.
446
+ *
447
+ * @param route the route to refresh the V4 pools for
448
+ * @param config the routing config
449
+ * @param v4PoolProvider the V4 pool provider
450
+ * @returns the refreshed route
451
+ */
452
+ protected static refreshV4Pools(route: V4Route, config: AlphaRouterConfig, v4PoolProvider: IV4PoolProvider): Promise<V4Route>;
453
+ /**
454
+ * Refreshes the mixed pools for the given route.
455
+ *
456
+ * @param route the route to refresh the mixed pools for
457
+ * @param config the routing config
458
+ * @param v2PoolProvider the V2 pool provider
459
+ * @param v3PoolProvider the V3 pool provider
460
+ * @param v4PoolProvider the V4 pool provider
461
+ * @returns the refreshed route
462
+ */
463
+ protected static refreshMixedPools(route: MixedRoute, config: AlphaRouterConfig, v2PoolProvider: IV2PoolProvider, v3PoolProvider: IV3PoolProvider, v4PoolProvider: IV4PoolProvider): Promise<MixedRoute>;
464
+ private static logV2PoolRefreshError;
465
+ private static logV3PoolRefreshError;
466
+ private static logV4PoolRefreshError;
467
+ private setCachedRoutesAndLog;
468
+ private getSwapRouteFromCache;
469
+ private getSwapRouteFromChain;
470
+ private tradeTypeStr;
471
+ private tokenPairSymbolTradeTypeChainId;
472
+ private determineCurrencyInOutFromTradeType;
473
+ private getGasPriceWei;
474
+ private getGasModels;
475
+ private getAmountDistribution;
476
+ private buildSwapAndAddMethodParameters;
477
+ private emitPoolSelectionMetrics;
478
+ private calculateOptimalRatio;
479
+ userHasSufficientBalance(fromAddress: string, tradeType: TradeType, amount: CurrencyAmount, quote: CurrencyAmount): Promise<boolean>;
480
+ private absoluteValue;
481
+ private getBlockNumberPromise;
482
+ static isAllowedToEnterCachedRoutes(intent?: INTENT, hooksOptions?: HooksOptions, swapRouter?: boolean): boolean;
483
+ }