@paraswap/dex-lib 5.1.10 → 5.1.11-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 (310) hide show
  1. package/build/abi/BProtocol.json +1155 -0
  2. package/build/abi/Jarvis.json +1172 -0
  3. package/build/abi/MStableAsset.json +1545 -0
  4. package/build/abi/OneInchLp.json +1304 -0
  5. package/build/abi/Onebit.json +736 -0
  6. package/build/abi/Shell.json +1294 -0
  7. package/build/abi/TraderJoeV2Router.json +50 -0
  8. package/build/abi/idle-dao/idle-cdo-factory.json +38 -0
  9. package/build/abi/idle-dao/idle-cdo.json +1245 -0
  10. package/build/abi/infusion/InfusionFactory.json +147 -0
  11. package/build/abi/infusion/InfusionPair.json +658 -0
  12. package/build/abi/infusion/InfusionRouter.json +442 -0
  13. package/build/abi/maker-psm/pot.json +322 -0
  14. package/build/abi/maker-psm/psm.json +243 -0
  15. package/build/abi/maker-psm/vat.json +363 -0
  16. package/build/abi/nomiswap-v2/nomiswap-v2-pool.json +773 -0
  17. package/build/abi/quick-perps/fast-price-events.json +70 -0
  18. package/build/abi/quick-perps/fast-price-feed.json +741 -0
  19. package/build/abi/quick-perps/reader.json +313 -0
  20. package/build/abi/quick-perps/vault-price-feed.json +323 -0
  21. package/build/abi/quick-perps/vault.json +1953 -0
  22. package/build/abi/uniswap-v2/excalibur-pool.json +881 -0
  23. package/build/abi/uniswap-v2/mdex-factory.json +759 -0
  24. package/build/abi/wUSDM.json +757 -0
  25. package/build/abi/zrx.v2.json +1967 -0
  26. package/build/abi/zrx.v3.json +3454 -0
  27. package/build/abi/zrx.v4.json +2193 -0
  28. package/build/dex/OneInchLp.d.ts +24 -0
  29. package/build/dex/OneInchLp.js +43 -0
  30. package/build/dex/OneInchLp.js.map +1 -0
  31. package/build/dex/algebra/algebra.d.ts +2 -2
  32. package/build/dex/algebra/algebra.js +5 -4
  33. package/build/dex/algebra/algebra.js.map +1 -1
  34. package/build/dex/algebra-integral/algebra-integral.d.ts +2 -2
  35. package/build/dex/algebra-integral/algebra-integral.js +5 -4
  36. package/build/dex/algebra-integral/algebra-integral.js.map +1 -1
  37. package/build/dex/bProtocol/bProtocol.d.ts +15 -0
  38. package/build/dex/bProtocol/bProtocol.js +56 -0
  39. package/build/dex/bProtocol/bProtocol.js.map +1 -0
  40. package/build/dex/bProtocol/types.d.ts +11 -0
  41. package/build/dex/bProtocol/types.js +8 -0
  42. package/build/dex/bProtocol/types.js.map +1 -0
  43. package/build/dex/balancer-v2/balancer-v2.d.ts +5 -4
  44. package/build/dex/balancer-v2/balancer-v2.js +8 -7
  45. package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
  46. package/build/dex/cap/cap.d.ts +2 -2
  47. package/build/dex/cap/cap.js +2 -2
  48. package/build/dex/cap/cap.js.map +1 -1
  49. package/build/dex/ekubo/pools/base-pool.d.ts +47 -0
  50. package/build/dex/ekubo/pools/base-pool.js +184 -0
  51. package/build/dex/ekubo/pools/base-pool.js.map +1 -0
  52. package/build/dex/ekubo/pools/iface.d.ts +46 -0
  53. package/build/dex/ekubo/pools/iface.js +75 -0
  54. package/build/dex/ekubo/pools/iface.js.map +1 -0
  55. package/build/dex/ekubo/pools/math/price.d.ts +7 -0
  56. package/build/dex/ekubo/pools/math/price.js +112 -0
  57. package/build/dex/ekubo/pools/math/price.js.map +1 -0
  58. package/build/dex/ekubo/pools/oracle-pool.d.ts +10 -0
  59. package/build/dex/ekubo/pools/oracle-pool.js +19 -0
  60. package/build/dex/ekubo/pools/oracle-pool.js.map +1 -0
  61. package/build/dex/ekubo/pools/pool-utils.d.ts +44 -0
  62. package/build/dex/ekubo/pools/pool-utils.js +240 -0
  63. package/build/dex/ekubo/pools/pool-utils.js.map +1 -0
  64. package/build/dex/idle-dao/config.d.ts +5 -0
  65. package/build/dex/idle-dao/config.js +24 -0
  66. package/build/dex/idle-dao/config.js.map +1 -0
  67. package/build/dex/idle-dao/idle-dao.d.ts +42 -0
  68. package/build/dex/idle-dao/idle-dao.js +279 -0
  69. package/build/dex/idle-dao/idle-dao.js.map +1 -0
  70. package/build/dex/idle-dao/token_list.d.ts +4 -0
  71. package/build/dex/idle-dao/token_list.js +289 -0
  72. package/build/dex/idle-dao/token_list.js.map +1 -0
  73. package/build/dex/idle-dao/tokens.d.ts +9 -0
  74. package/build/dex/idle-dao/tokens.js +68 -0
  75. package/build/dex/idle-dao/tokens.js.map +1 -0
  76. package/build/dex/idle-dao/types.d.ts +35 -0
  77. package/build/dex/idle-dao/types.js +11 -0
  78. package/build/dex/idle-dao/types.js.map +1 -0
  79. package/build/dex/idle-dao/utils.d.ts +8 -0
  80. package/build/dex/idle-dao/utils.js +149 -0
  81. package/build/dex/idle-dao/utils.js.map +1 -0
  82. package/build/dex/infusion/config.d.ts +3 -0
  83. package/build/dex/infusion/config.js +20 -0
  84. package/build/dex/infusion/config.js.map +1 -0
  85. package/build/dex/infusion/infusion-stable-pool.d.ts +4 -0
  86. package/build/dex/infusion/infusion-stable-pool.js +74 -0
  87. package/build/dex/infusion/infusion-stable-pool.js.map +1 -0
  88. package/build/dex/infusion/infusion.d.ts +51 -0
  89. package/build/dex/infusion/infusion.js +500 -0
  90. package/build/dex/infusion/infusion.js.map +1 -0
  91. package/build/dex/infusion/types.d.ts +45 -0
  92. package/build/dex/infusion/types.js.map +1 -0
  93. package/build/dex/infusion/utils/isStablePair.d.ts +2 -0
  94. package/build/dex/infusion/utils/isStablePair.js +18 -0
  95. package/build/dex/infusion/utils/isStablePair.js.map +1 -0
  96. package/build/dex/jarvis.d.ts +56 -0
  97. package/build/dex/jarvis.js +163 -0
  98. package/build/dex/jarvis.js.map +1 -0
  99. package/build/dex/mStable.d.ts +44 -0
  100. package/build/dex/mStable.js +75 -0
  101. package/build/dex/mStable.js.map +1 -0
  102. package/build/dex/maker-psm/config.d.ts +11 -0
  103. package/build/dex/maker-psm/config.js +53 -0
  104. package/build/dex/maker-psm/config.js.map +1 -0
  105. package/build/dex/maker-psm/maker-psm.d.ts +103 -0
  106. package/build/dex/maker-psm/maker-psm.js +493 -0
  107. package/build/dex/maker-psm/maker-psm.js.map +1 -0
  108. package/build/dex/maker-psm/types.d.ts +39 -0
  109. package/build/{generic-swap-transaction-builder/dex-encoder/ports.js → dex/maker-psm/types.js} +1 -1
  110. package/build/dex/maker-psm/types.js.map +1 -0
  111. package/build/dex/maverick-v1/maverick-v1.d.ts +2 -2
  112. package/build/dex/maverick-v1/maverick-v1.js +4 -3
  113. package/build/dex/maverick-v1/maverick-v1.js.map +1 -1
  114. package/build/dex/onebit/onebit.d.ts +16 -0
  115. package/build/dex/onebit/onebit.js +61 -0
  116. package/build/dex/onebit/onebit.js.map +1 -0
  117. package/build/dex/onebit/types.d.ts +14 -0
  118. package/build/dex/onebit/types.js +8 -0
  119. package/build/dex/onebit/types.js.map +1 -0
  120. package/build/dex/oswap/oswap.d.ts +2 -2
  121. package/build/dex/oswap/oswap.js +2 -2
  122. package/build/dex/oswap/oswap.js.map +1 -1
  123. package/build/dex/quick-perps/config.d.ts +11 -0
  124. package/build/dex/quick-perps/config.js +27 -0
  125. package/build/dex/quick-perps/config.js.map +1 -0
  126. package/build/dex/quick-perps/fast-price-feed.d.ts +26 -0
  127. package/build/dex/quick-perps/fast-price-feed.js +184 -0
  128. package/build/dex/quick-perps/fast-price-feed.js.map +1 -0
  129. package/build/dex/quick-perps/pool.d.ts +21 -0
  130. package/build/dex/quick-perps/pool.js +229 -0
  131. package/build/dex/quick-perps/pool.js.map +1 -0
  132. package/build/dex/quick-perps/quick-perps.d.ts +53 -0
  133. package/build/dex/quick-perps/quick-perps.js +247 -0
  134. package/build/dex/quick-perps/quick-perps.js.map +1 -0
  135. package/build/dex/quick-perps/types.d.ts +98 -0
  136. package/build/{executor/encoding-types.js → dex/quick-perps/types.js} +1 -1
  137. package/build/dex/quick-perps/types.js.map +1 -0
  138. package/build/dex/quick-perps/usdq.d.ts +15 -0
  139. package/build/dex/quick-perps/usdq.js +62 -0
  140. package/build/dex/quick-perps/usdq.js.map +1 -0
  141. package/build/dex/quick-perps/vault-price-feed.d.ts +43 -0
  142. package/build/dex/quick-perps/vault-price-feed.js +203 -0
  143. package/build/dex/quick-perps/vault-price-feed.js.map +1 -0
  144. package/build/dex/quick-perps/vault-utils.d.ts +8 -0
  145. package/build/dex/quick-perps/vault-utils.js +42 -0
  146. package/build/dex/quick-perps/vault-utils.js.map +1 -0
  147. package/build/dex/quick-perps/vault.d.ts +46 -0
  148. package/build/dex/quick-perps/vault.js +182 -0
  149. package/build/dex/quick-perps/vault.js.map +1 -0
  150. package/build/dex/se-vlr/config.d.ts +3 -0
  151. package/build/dex/se-vlr/config.js +24 -0
  152. package/build/dex/se-vlr/config.js.map +1 -0
  153. package/build/dex/se-vlr/se-vlr-pool.d.ts +39 -0
  154. package/build/dex/se-vlr/se-vlr-pool.js +70 -0
  155. package/build/dex/se-vlr/se-vlr-pool.js.map +1 -0
  156. package/build/dex/se-vlr/se-vlr.d.ts +35 -0
  157. package/build/dex/se-vlr/se-vlr.js +131 -0
  158. package/build/dex/se-vlr/se-vlr.js.map +1 -0
  159. package/build/dex/se-vlr/types.d.ts +6 -0
  160. package/build/dex/se-vlr/types.js +3 -0
  161. package/build/dex/se-vlr/types.js.map +1 -0
  162. package/build/dex/shell.d.ts +25 -0
  163. package/build/dex/shell.js +41 -0
  164. package/build/dex/shell.js.map +1 -0
  165. package/build/dex/solidly/forks-override/aerodrome.d.ts +14 -0
  166. package/build/dex/solidly/forks-override/aerodrome.js +46 -0
  167. package/build/dex/solidly/forks-override/aerodrome.js.map +1 -0
  168. package/build/dex/solidly/forks-override/chronos.d.ts +23 -0
  169. package/build/dex/solidly/forks-override/chronos.js +141 -0
  170. package/build/dex/solidly/forks-override/chronos.js.map +1 -0
  171. package/build/dex/solidly/forks-override/usdfi.d.ts +8 -0
  172. package/build/dex/solidly/forks-override/usdfi.js +15 -0
  173. package/build/dex/solidly/forks-override/usdfi.js.map +1 -0
  174. package/build/dex/solidly/forks-override/velocimeter.d.ts +23 -0
  175. package/build/dex/solidly/forks-override/velocimeter.js +77 -0
  176. package/build/dex/solidly/forks-override/velocimeter.js.map +1 -0
  177. package/build/dex/tessera/types.d.ts +3 -0
  178. package/build/dex/tessera/types.js +3 -0
  179. package/build/dex/tessera/types.js.map +1 -0
  180. package/build/dex/trader-joe-v2.1/base.d.ts +2 -2
  181. package/build/dex/trader-joe-v2.1/base.js +2 -2
  182. package/build/dex/trader-joe-v2.1/base.js.map +1 -1
  183. package/build/dex/trader-joe-v2.d.ts +40 -0
  184. package/build/dex/trader-joe-v2.js +74 -0
  185. package/build/dex/trader-joe-v2.js.map +1 -0
  186. package/build/dex/uniswap-v2/dfyn.d.ts +19 -0
  187. package/build/dex/uniswap-v2/dfyn.js +61 -0
  188. package/build/dex/uniswap-v2/dfyn.js.map +1 -0
  189. package/build/dex/uniswap-v2/excalibur.d.ts +24 -0
  190. package/build/dex/uniswap-v2/excalibur.js +47 -0
  191. package/build/dex/uniswap-v2/excalibur.js.map +1 -0
  192. package/build/dex/uniswap-v2/mdex.d.ts +24 -0
  193. package/build/dex/uniswap-v2/mdex.js +50 -0
  194. package/build/dex/uniswap-v2/mdex.js.map +1 -0
  195. package/build/dex/uniswap-v2/nomiswap-v2.d.ts +24 -0
  196. package/build/dex/uniswap-v2/nomiswap-v2.js +57 -0
  197. package/build/dex/uniswap-v2/nomiswap-v2.js.map +1 -0
  198. package/build/dex/uniswap-v3/scripts/bench-all-dexes.js +160 -0
  199. package/build/dex/uniswap-v3/scripts/bench-all-dexes.js.map +1 -0
  200. package/build/dex/uniswap-v3/uniswap-v3-new.d.ts +94 -0
  201. package/build/dex/uniswap-v3/uniswap-v3-new.js +923 -0
  202. package/build/dex/uniswap-v3/uniswap-v3-new.js.map +1 -0
  203. package/build/dex/uniswap-v3.d.ts +2 -2
  204. package/build/dex/uniswap-v3.js +4 -3
  205. package/build/dex/uniswap-v3.js.map +1 -1
  206. package/build/dex/uniswap-v4/contract-math/Position.d.ts +3 -0
  207. package/build/dex/uniswap-v4/contract-math/Position.js +10 -0
  208. package/build/dex/uniswap-v4/contract-math/Position.js.map +1 -0
  209. package/build/dex/usual-bond/config.d.ts +3 -0
  210. package/build/dex/usual-bond/config.js +13 -0
  211. package/build/dex/usual-bond/config.js.map +1 -0
  212. package/build/dex/usual-bond/types.d.ts +7 -0
  213. package/build/dex/usual-bond/types.js +3 -0
  214. package/build/dex/usual-bond/types.js.map +1 -0
  215. package/build/dex/usual-bond/usual-bond.d.ts +35 -0
  216. package/build/dex/usual-bond/usual-bond.js +176 -0
  217. package/build/dex/usual-bond/usual-bond.js.map +1 -0
  218. package/build/dex/wusdm/config.d.ts +3 -0
  219. package/build/dex/wusdm/config.js +43 -0
  220. package/build/dex/wusdm/config.js.map +1 -0
  221. package/build/dex/wusdm/constants.d.ts +2 -0
  222. package/build/dex/wusdm/constants.js +6 -0
  223. package/build/dex/wusdm/constants.js.map +1 -0
  224. package/build/dex/wusdm/types.d.ts +18 -0
  225. package/build/dex/wusdm/types.js +11 -0
  226. package/build/dex/wusdm/types.js.map +1 -0
  227. package/build/dex/wusdm/wusdm-pool.d.ts +21 -0
  228. package/build/dex/wusdm/wusdm-pool.js +74 -0
  229. package/build/dex/wusdm/wusdm-pool.js.map +1 -0
  230. package/build/dex/wusdm/wusdm.d.ts +46 -0
  231. package/build/dex/wusdm/wusdm.js +243 -0
  232. package/build/dex/wusdm/wusdm.js.map +1 -0
  233. package/build/dex/zerox/config.d.ts +2 -0
  234. package/build/dex/zerox/config.js +33 -0
  235. package/build/dex/zerox/config.js.map +1 -0
  236. package/build/dex/zerox/index.d.ts +22 -0
  237. package/build/dex/zerox/index.js +225 -0
  238. package/build/dex/zerox/index.js.map +1 -0
  239. package/build/dex/zerox/order.d.ts +88 -0
  240. package/build/dex/zerox/order.js +53 -0
  241. package/build/dex/zerox/order.js.map +1 -0
  242. package/build/dex/zerox/types.d.ts +73 -0
  243. package/build/dex/zerox/types.js +21 -0
  244. package/build/dex/zerox/types.js.map +1 -0
  245. package/package.json +15 -13
  246. package/build/abi/pancakeswap-infinity/cl-pool-manager.json +0 -80
  247. package/build/dex/fluid-dex/scripts/measure-calc-time.js +0 -178
  248. package/build/dex/fluid-dex/scripts/measure-calc-time.js.map +0 -1
  249. package/build/dex/uniswap-v4/api-go/compare-pricing.d.ts +0 -1
  250. package/build/dex/uniswap-v4/api-go/compare-pricing.js +0 -187
  251. package/build/dex/uniswap-v4/api-go/compare-pricing.js.map +0 -1
  252. package/build/dex/uniswap-v4/api-go/compare-states.d.ts +0 -1
  253. package/build/dex/uniswap-v4/api-go/compare-states.js +0 -149
  254. package/build/dex/uniswap-v4/api-go/compare-states.js.map +0 -1
  255. package/build/dex/uniswap-v4/api-go/fetch-pool-key.d.ts +0 -0
  256. package/build/dex/uniswap-v4/api-go/fetch-pool-key.js +0 -140
  257. package/build/dex/uniswap-v4/api-go/fetch-pool-key.js.map +0 -1
  258. package/build/executor/__test-utils__/snapshot-test-helpers.d.ts +0 -10
  259. package/build/executor/__test-utils__/snapshot-test-helpers.js +0 -72
  260. package/build/executor/__test-utils__/snapshot-test-helpers.js.map +0 -1
  261. package/build/executor/address-utils.d.ts +0 -2
  262. package/build/executor/address-utils.js +0 -7
  263. package/build/executor/address-utils.js.map +0 -1
  264. package/build/executor/approval.d.ts +0 -9
  265. package/build/executor/approval.js +0 -29
  266. package/build/executor/approval.js.map +0 -1
  267. package/build/executor/encoding-context.d.ts +0 -4
  268. package/build/executor/encoding-context.js +0 -54
  269. package/build/executor/encoding-context.js.map +0 -1
  270. package/build/executor/encoding-types.d.ts +0 -75
  271. package/build/executor/encoding-types.js.map +0 -1
  272. package/build/executor/factory.d.ts +0 -4
  273. package/build/executor/factory.js +0 -23
  274. package/build/executor/factory.js.map +0 -1
  275. package/build/executor/route-plan.d.ts +0 -8
  276. package/build/executor/route-plan.js +0 -109
  277. package/build/executor/route-plan.js.map +0 -1
  278. package/build/generic-swap-transaction-builder/dex-encoder/direct-methods.d.ts +0 -6
  279. package/build/generic-swap-transaction-builder/dex-encoder/direct-methods.js +0 -39
  280. package/build/generic-swap-transaction-builder/dex-encoder/direct-methods.js.map +0 -1
  281. package/build/generic-swap-transaction-builder/dex-encoder/index.d.ts +0 -4
  282. package/build/generic-swap-transaction-builder/dex-encoder/index.js +0 -21
  283. package/build/generic-swap-transaction-builder/dex-encoder/index.js.map +0 -1
  284. package/build/generic-swap-transaction-builder/dex-encoder/ports.d.ts +0 -26
  285. package/build/generic-swap-transaction-builder/dex-encoder/ports.js.map +0 -1
  286. package/build/generic-swap-transaction-builder/dex-encoder/ts-adapter.d.ts +0 -22
  287. package/build/generic-swap-transaction-builder/dex-encoder/ts-adapter.js +0 -299
  288. package/build/generic-swap-transaction-builder/dex-encoder/ts-adapter.js.map +0 -1
  289. package/build/generic-swap-transaction-builder/dex-encoder/types.d.ts +0 -207
  290. package/build/generic-swap-transaction-builder/dex-encoder/types.js +0 -194
  291. package/build/generic-swap-transaction-builder/dex-encoder/types.js.map +0 -1
  292. package/build/generic-swap-transaction-builder/orchestration.d.ts +0 -65
  293. package/build/generic-swap-transaction-builder/orchestration.js +0 -198
  294. package/build/generic-swap-transaction-builder/orchestration.js.map +0 -1
  295. package/build/generic-swap-transaction-builder/resolved/build-transaction.d.ts +0 -13
  296. package/build/generic-swap-transaction-builder/resolved/build-transaction.js +0 -343
  297. package/build/generic-swap-transaction-builder/resolved/build-transaction.js.map +0 -1
  298. package/build/generic-swap-transaction-builder/resolved/index.d.ts +0 -4
  299. package/build/generic-swap-transaction-builder/resolved/index.js +0 -21
  300. package/build/generic-swap-transaction-builder/resolved/index.js.map +0 -1
  301. package/build/generic-swap-transaction-builder/resolved/route-plan.d.ts +0 -2
  302. package/build/generic-swap-transaction-builder/resolved/route-plan.js +0 -11
  303. package/build/generic-swap-transaction-builder/resolved/route-plan.js.map +0 -1
  304. package/build/generic-swap-transaction-builder/resolved/types.d.ts +0 -67
  305. package/build/generic-swap-transaction-builder/resolved/types.js.map +0 -1
  306. package/build/generic-swap-transaction-builder/resolved/validation.d.ts +0 -10
  307. package/build/generic-swap-transaction-builder/resolved/validation.js +0 -69
  308. package/build/generic-swap-transaction-builder/resolved/validation.js.map +0 -1
  309. /package/build/{generic-swap-transaction-builder/resolved → dex/infusion}/types.js +0 -0
  310. /package/build/dex/{fluid-dex/scripts/measure-calc-time.d.ts → uniswap-v3/scripts/bench-all-dexes.d.ts} +0 -0
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getApprovalTokenAndTarget = getApprovalTokenAndTarget;
4
- const utils_1 = require("../utils");
5
- const address_utils_1 = require("./address-utils");
6
- function getApprovalTokenAndTarget(swap, exchangeParam, context) {
7
- if (exchangeParam.skipApproval)
8
- return null;
9
- const target = exchangeParam.spender || exchangeParam.targetExchange;
10
- if (exchangeParam.needUnwrapNative &&
11
- (0, address_utils_1.isWrappedNativeTokenAddress)(swap.srcToken, context.wrappedNativeTokenAddress)) {
12
- return null;
13
- }
14
- if (!(0, utils_1.isETHAddress)(swap.srcToken) &&
15
- !exchangeParam.transferSrcTokenBeforeSwap) {
16
- return {
17
- token: swap.srcToken,
18
- target,
19
- };
20
- }
21
- if (exchangeParam.needWrapNative && (0, utils_1.isETHAddress)(swap.srcToken)) {
22
- return {
23
- token: exchangeParam.wethAddress || context.wrappedNativeTokenAddress,
24
- target,
25
- };
26
- }
27
- return null;
28
- }
29
- //# sourceMappingURL=approval.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"approval.js","sourceRoot":"","sources":["../../src/executor/approval.ts"],"names":[],"mappings":";;AAUA,8DAqCC;AA7CD,oCAAwC;AACxC,mDAA8D;AAO9D,SAAgB,yBAAyB,CACvC,IAA2B,EAC3B,aAAoC,EACpC,OAAmE;IAEnE,IAAI,aAAa,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAE5C,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,IAAI,aAAa,CAAC,cAAc,CAAC;IAErE,IACE,aAAa,CAAC,gBAAgB;QAC9B,IAAA,2CAA2B,EACzB,IAAI,CAAC,QAAQ,EACb,OAAO,CAAC,yBAAyB,CAClC,EACD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IACE,CAAC,IAAA,oBAAY,EAAC,IAAI,CAAC,QAAQ,CAAC;QAC5B,CAAC,aAAa,CAAC,0BAA0B,EACzC,CAAC;QACD,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,QAAQ;YACpB,MAAM;SACP,CAAC;IACJ,CAAC;IAED,IAAI,aAAa,CAAC,cAAc,IAAI,IAAA,oBAAY,EAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChE,OAAO;YACL,KAAK,EAAE,aAAa,CAAC,WAAW,IAAI,OAAO,CAAC,yBAAyB;YACrE,MAAM;SACP,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { IDexHelper } from '../dex-helper';
2
- import type { ExecutorEncodingContext, ExecutorEncodingLogger } from './encoding-types';
3
- export declare function createNoopExecutorEncodingLogger(): ExecutorEncodingLogger;
4
- export declare function createExecutorEncodingContextFromDexHelper(dexHelper: IDexHelper): ExecutorEncodingContext;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createNoopExecutorEncodingLogger = createNoopExecutorEncodingLogger;
4
- exports.createExecutorEncodingContextFromDexHelper = createExecutorEncodingContextFromDexHelper;
5
- const types_1 = require("./types");
6
- function createNoopExecutorEncodingLogger() {
7
- return {
8
- debug: () => undefined,
9
- info: () => undefined,
10
- warn: () => undefined,
11
- error: () => undefined,
12
- };
13
- }
14
- function createExecutorEncodingContextFromDexHelper(dexHelper) {
15
- const logger = dexHelper.getLogger('ExecutorBytecodeBuilder');
16
- const wrappedNativeTokenAddress = normalizeRequiredAddress(dexHelper.config.data.wrappedNativeTokenAddress, 'wrappedNativeTokenAddress');
17
- assertConfiguredWethExecutorAddress(dexHelper.config.data.executorsAddresses?.[types_1.Executors.WETH], wrappedNativeTokenAddress);
18
- const augustusV6Address = normalizeRequiredAddress(dexHelper.config.data.augustusV6Address, 'augustusV6Address');
19
- return {
20
- network: dexHelper.config.data.network,
21
- augustusV6Address,
22
- wrappedNativeTokenAddress,
23
- executorsAddresses: {
24
- [types_1.Executors.ONE]: normalizeRequiredAddress(dexHelper.config.data.executorsAddresses?.[types_1.Executors.ONE], `executorsAddresses.${types_1.Executors.ONE}`),
25
- [types_1.Executors.TWO]: normalizeRequiredAddress(dexHelper.config.data.executorsAddresses?.[types_1.Executors.TWO], `executorsAddresses.${types_1.Executors.TWO}`),
26
- [types_1.Executors.THREE]: normalizeRequiredAddress(dexHelper.config.data.executorsAddresses?.[types_1.Executors.THREE], `executorsAddresses.${types_1.Executors.THREE}`),
27
- [types_1.Executors.WETH]: wrappedNativeTokenAddress,
28
- },
29
- // Keep method bindings: some logger implementations depend on `this`.
30
- logger: {
31
- debug: logger.debug.bind(logger),
32
- info: logger.info.bind(logger),
33
- warn: logger.warn.bind(logger),
34
- error: logger.error.bind(logger),
35
- },
36
- };
37
- }
38
- function normalizeRequiredAddress(address, fieldName) {
39
- if (!address) {
40
- throw new Error(`${fieldName} is required`);
41
- }
42
- return normalizeAddress(address);
43
- }
44
- function assertConfiguredWethExecutorAddress(configuredWethExecutorAddress, wrappedNativeTokenAddress) {
45
- if (configuredWethExecutorAddress &&
46
- normalizeAddress(configuredWethExecutorAddress) !==
47
- normalizeAddress(wrappedNativeTokenAddress)) {
48
- throw new Error(`executorsAddresses.${types_1.Executors.WETH} must match wrappedNativeTokenAddress`);
49
- }
50
- }
51
- function normalizeAddress(address) {
52
- return address.toLowerCase();
53
- }
54
- //# sourceMappingURL=encoding-context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encoding-context.js","sourceRoot":"","sources":["../../src/executor/encoding-context.ts"],"names":[],"mappings":";;AAQA,4EAOC;AAED,gGA4CC;AAvDD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wB,CACzC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,iBAAS,CAAC,KAAK,CAAC,EAC3D,sBAAsB,iBAAS,CAAC,KAAK,EAAE,CACxC;YACD,CAAC,iBAAS,CAAC,IAAI,CAAC,EAAE,yBAAyB;SAC5C;QACD,sEAAsE;QACtE,MAAM,EAAE;YACN,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;YAChC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9B,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;SACjC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,wBAAwB,CAC/B,OAA4B,EAC5B,SAAiB;IAEjB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,cAAc,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,mCAAmC,CAC1C,6BAAkD,EAClD,yBAAkC;IAElC,IACE,6BAA6B;QAC7B,gBAAgB,CAAC,6BAA6B,CAAC;YAC7C,gBAAgB,CAAC,yBAAyB,CAAC,EAC7C,CAAC;QACD,MAAM,IAAI,KAAK,CACb,sBAAsB,iBAAS,CAAC,IAAI,uCAAuC,CAC5E,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAgB;IACxC,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;AAC/B,CAAC"}
@@ -1,75 +0,0 @@
1
- import type { DepositWithdrawReturn } from '../dex/weth/types';
2
- import type { Address, DexExchangeBuildParam } from '../types';
3
- import type { Executors } from './types';
4
- export type ExecutorEncodingLogger = {
5
- debug: (message: unknown, ...args: unknown[]) => void;
6
- info: (message: unknown, ...args: unknown[]) => void;
7
- warn: (message: unknown, ...args: unknown[]) => void;
8
- error: (message: unknown, ...args: unknown[]) => void;
9
- };
10
- export type ExecutorEncodingContext = {
11
- network: number;
12
- augustusV6Address: Address;
13
- wrappedNativeTokenAddress: Address;
14
- executorsAddresses: Record<Executors, Address>;
15
- logger: ExecutorEncodingLogger;
16
- };
17
- export type RoutePlan = {
18
- routes: RoutePlanRoute[];
19
- };
20
- export type RoutePlanRoute = {
21
- percent: number;
22
- swaps: RoutePlanSwap[];
23
- };
24
- export type RoutePlanSwap = {
25
- srcToken: Address;
26
- destToken: Address;
27
- srcAmount: string;
28
- destAmount: string;
29
- swapExchanges: RoutePlanSwapExchange[];
30
- };
31
- export type RoutePlanSwapExchange = {
32
- exchange: string;
33
- percent: number;
34
- srcAmount: string;
35
- destAmount: string;
36
- };
37
- export type ExecutorRoute = {
38
- srcToken: Address;
39
- destToken: Address;
40
- destAmount: string;
41
- bestRoute: RoutePlanRoute[];
42
- };
43
- export type ExecutorRouteRoute = RoutePlanRoute;
44
- export type ExecutorRouteSwap = RoutePlanSwap;
45
- export type ExecutorRouteSwapExchange = RoutePlanSwapExchange;
46
- export type RoutePosition = {
47
- routeIndex: number;
48
- swapIndex: number;
49
- swapExchangeIndex: number;
50
- };
51
- export type ResolvedLeg = RoutePosition & {
52
- exchangeParam: DexExchangeBuildParam;
53
- normalizedSrcToken: Address;
54
- normalizedDestToken: Address;
55
- normalizedSrcAmount: string;
56
- normalizedDestAmount: string;
57
- recipient: Address;
58
- };
59
- export type RoutePlanExchange = RoutePosition & {
60
- route: RoutePlanRoute;
61
- swap: RoutePlanSwap;
62
- swapExchange: RoutePlanSwapExchange;
63
- };
64
- export type OrderedExecutorLeg = RoutePlanExchange & {
65
- resolvedLeg: ResolvedLeg;
66
- };
67
- export type ExecutorBytecodeBuildInput = {
68
- routePlan: RoutePlan;
69
- resolvedLegs: ResolvedLeg[];
70
- sender: Address;
71
- srcToken: Address;
72
- destToken: Address;
73
- destAmount: string;
74
- wethPlan?: DepositWithdrawReturn;
75
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"encoding-types.js","sourceRoot":"","sources":["../../src/executor/encoding-types.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- import { ExecutorBytecodeBuilder } from './ExecutorBytecodeBuilder';
2
- import type { ExecutorEncodingContext } from './encoding-types';
3
- import { Executors } from './types';
4
- export declare function createExecutorBytecodeBuilder(executorType: Executors, context: ExecutorEncodingContext): ExecutorBytecodeBuilder;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createExecutorBytecodeBuilder = createExecutorBytecodeBuilder;
4
- const Executor01BytecodeBuilder_1 = require("./Executor01BytecodeBuilder");
5
- const Executor02BytecodeBuilder_1 = require("./Executor02BytecodeBuilder");
6
- const Executor03BytecodeBuilder_1 = require("./Executor03BytecodeBuilder");
7
- const WETHBytecodeBuilder_1 = require("./WETHBytecodeBuilder");
8
- const types_1 = require("./types");
9
- function createExecutorBytecodeBuilder(executorType, context) {
10
- switch (executorType) {
11
- case types_1.Executors.ONE:
12
- return new Executor01BytecodeBuilder_1.Executor01BytecodeBuilder(context);
13
- case types_1.Executors.TWO:
14
- return new Executor02BytecodeBuilder_1.Executor02BytecodeBuilder(context);
15
- case types_1.Executors.THREE:
16
- return new Executor03BytecodeBuilder_1.Executor03BytecodeBuilder(context);
17
- case types_1.Executors.WETH:
18
- return new WETHBytecodeBuilder_1.WETHBytecodeBuilder(context);
19
- default:
20
- throw new Error(`${executorType} is not supported`);
21
- }
22
- }
23
- //# sourceMappingURL=factory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/executor/factory.ts"],"names":[],"mappings":";;AAQA,sEAgBC;AAxBD,2EAAwE;AACxE,2EAAwE;AACxE,2EAAwE;AACxE,+DAA4D;AAG5D,mCAAoC;AAEpC,SAAgB,6BAA6B,CAC3C,YAAuB,EACvB,OAAgC;IAEhC,QAAQ,YAAY,EAAE,CAAC;QACrB,KAAK,iBAAS,CAAC,GAAG;YAChB,OAAO,IAAI,qDAAyB,CAAC,OAAO,CAAC,CAAC;QAChD,KAAK,iBAAS,CAAC,GAAG;YAChB,OAAO,IAAI,qDAAyB,CAAC,OAAO,CAAC,CAAC;QAChD,KAAK,iBAAS,CAAC,KAAK;YAClB,OAAO,IAAI,qDAAyB,CAAC,OAAO,CAAC,CAAC;QAChD,KAAK,iBAAS,CAAC,IAAI;YACjB,OAAO,IAAI,yCAAmB,CAAC,OAAO,CAAC,CAAC;QAC1C;YACE,MAAM,IAAI,KAAK,CAAC,GAAG,YAAY,mBAAmB,CAAC,CAAC;IACxD,CAAC;AACH,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { OptimalRate } from '@paraswap/core';
2
- import type { OrderedExecutorLeg, ResolvedLeg, RoutePlan, RoutePlanExchange, RoutePosition } from './encoding-types';
3
- export declare function buildRoutePlan(priceRoute: OptimalRate): RoutePlan;
4
- export declare function flattenRoutePlan(routePlan: RoutePlan): RoutePosition[];
5
- export declare function walkRoutePlan(routePlan: RoutePlan): RoutePlanExchange[];
6
- export declare function routePositionKey(position: RoutePosition): string;
7
- export declare function getRoutePlanLegCount(routePlan: RoutePlan): number;
8
- export declare function getOrderedExecutorLegs(routePlan: RoutePlan, resolvedLegs: ResolvedLeg[]): OrderedExecutorLeg[];
@@ -1,109 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildRoutePlan = buildRoutePlan;
4
- exports.flattenRoutePlan = flattenRoutePlan;
5
- exports.walkRoutePlan = walkRoutePlan;
6
- exports.routePositionKey = routePositionKey;
7
- exports.getRoutePlanLegCount = getRoutePlanLegCount;
8
- exports.getOrderedExecutorLegs = getOrderedExecutorLegs;
9
- function buildRoutePlan(priceRoute) {
10
- return {
11
- routes: priceRoute.bestRoute.map(route => ({
12
- percent: route.percent,
13
- swaps: route.swaps.map(swap => buildRoutePlanSwap(swap)),
14
- })),
15
- };
16
- }
17
- function flattenRoutePlan(routePlan) {
18
- return walkRoutePlan(routePlan).map(({ routeIndex, swapIndex, swapExchangeIndex }) => ({
19
- routeIndex,
20
- swapIndex,
21
- swapExchangeIndex,
22
- }));
23
- }
24
- function walkRoutePlan(routePlan) {
25
- return routePlan.routes.flatMap((route, routeIndex) => route.swaps.flatMap((swap, swapIndex) => swap.swapExchanges.map((swapExchange, swapExchangeIndex) => ({
26
- routeIndex,
27
- swapIndex,
28
- swapExchangeIndex,
29
- route,
30
- swap,
31
- swapExchange,
32
- }))));
33
- }
34
- function routePositionKey(position) {
35
- return [
36
- position.routeIndex,
37
- position.swapIndex,
38
- position.swapExchangeIndex,
39
- ].join(':');
40
- }
41
- function getRoutePlanLegCount(routePlan) {
42
- return routePlan.routes.reduce((routeCount, route) => routeCount +
43
- route.swaps.reduce((swapCount, swap) => swapCount + swap.swapExchanges.length, 0), 0);
44
- }
45
- function getOrderedExecutorLegs(routePlan, resolvedLegs) {
46
- // Executor validation is deliberately local to bytecode traversal, even when
47
- // callers already validated serialized boundary input.
48
- const routePositions = walkRoutePlan(routePlan);
49
- const routePositionKeys = new Set(routePositions.map(routePositionKey));
50
- const resolvedLegByKey = new Map();
51
- const duplicateKeys = new Set();
52
- const extraKeys = new Set();
53
- resolvedLegs.forEach(resolvedLeg => {
54
- const key = routePositionKey(resolvedLeg);
55
- if (resolvedLegByKey.has(key)) {
56
- duplicateKeys.add(key);
57
- }
58
- if (!routePositionKeys.has(key)) {
59
- extraKeys.add(key);
60
- }
61
- resolvedLegByKey.set(key, resolvedLeg);
62
- });
63
- if (duplicateKeys.size > 0) {
64
- throw new Error(`duplicate resolved leg route position(s): ${[...duplicateKeys].join(', ')}`);
65
- }
66
- if (extraKeys.size > 0) {
67
- throw new Error(`resolved leg route position(s) not present in route plan: ${[
68
- ...extraKeys,
69
- ].join(', ')}`);
70
- }
71
- return routePositions.map(routePosition => {
72
- const key = routePositionKey(routePosition);
73
- const resolvedLeg = resolvedLegByKey.get(key);
74
- if (!resolvedLeg) {
75
- throw new Error(`missing resolved leg for route position ${key}`);
76
- }
77
- return {
78
- ...routePosition,
79
- resolvedLeg,
80
- };
81
- });
82
- }
83
- function buildRoutePlanSwap(swap) {
84
- return {
85
- srcToken: normalizeAddress(swap.srcToken),
86
- destToken: normalizeAddress(swap.destToken),
87
- srcAmount: getSwapAmount(swap, 'srcAmount'),
88
- destAmount: getSwapAmount(swap, 'destAmount'),
89
- swapExchanges: swap.swapExchanges.map(swapExchange => ({
90
- exchange: swapExchange.exchange,
91
- percent: swapExchange.percent,
92
- srcAmount: swapExchange.srcAmount,
93
- destAmount: swapExchange.destAmount,
94
- })),
95
- };
96
- }
97
- function getSwapAmount(swap, amountField) {
98
- const amount = swap[amountField];
99
- if (amount !== undefined)
100
- return amount;
101
- return sumDecimalStrings(swap.swapExchanges.map(swapExchange => swapExchange[amountField]));
102
- }
103
- function sumDecimalStrings(amounts) {
104
- return amounts.reduce((sum, amount) => sum + BigInt(amount), 0n).toString();
105
- }
106
- function normalizeAddress(address) {
107
- return address.toLowerCase();
108
- }
109
- //# sourceMappingURL=route-plan.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"route-plan.js","sourceRoot":"","sources":["../../src/executor/route-plan.ts"],"names":[],"mappings":";;AAkBA,wCAOC;AAED,4CAQC;AAED,sCAaC;AAED,4CAMC;AAED,oDAUC;AAED,wDAuDC;AA7GD,SAAgB,cAAc,CAAC,UAAuB;IACpD,OAAO;QACL,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACzC,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;SACzD,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC;AAED,S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AC9E,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAgB;IACxC,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;AAC/B,CAAC"}
@@ -1,6 +0,0 @@
1
- import { ContractMethodV6, SwapSide } from '@paraswap/core';
2
- export declare const DIRECT_CONTRACT_METHODS_V6: readonly [ContractMethodV6.swapExactAmountInOnUniswapV2, ContractMethodV6.swapExactAmountOutOnUniswapV2, ContractMethodV6.swapExactAmountInOnUniswapV3, ContractMethodV6.swapExactAmountOutOnUniswapV3, ContractMethodV6.swapExactAmountInOnBalancerV2, ContractMethodV6.swapExactAmountOutOnBalancerV2, ContractMethodV6.swapExactAmountInOnCurveV1, ContractMethodV6.swapExactAmountInOnCurveV2, ContractMethodV6.swapOnAugustusRFQTryBatchFill, ContractMethodV6.swapExactAmountInOutOnMakerPSM];
3
- export type DirectContractMethodV6 = (typeof DIRECT_CONTRACT_METHODS_V6)[number];
4
- export declare const DIRECT_CONTRACT_METHOD_SIDES_V6: Partial<Record<DirectContractMethodV6, SwapSide>>;
5
- export declare function isDirectContractMethodV6(contractMethod: string): contractMethod is DirectContractMethodV6;
6
- export declare function getDirectContractMethodSideV6(contractMethod: DirectContractMethodV6): SwapSide | undefined;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DIRECT_CONTRACT_METHOD_SIDES_V6 = exports.DIRECT_CONTRACT_METHODS_V6 = void 0;
4
- exports.isDirectContractMethodV6 = isDirectContractMethodV6;
5
- exports.getDirectContractMethodSideV6 = getDirectContractMethodSideV6;
6
- const core_1 = require("@paraswap/core");
7
- exports.DIRECT_CONTRACT_METHODS_V6 = [
8
- core_1.ContractMethodV6.swapExactAmountInOnUniswapV2,
9
- core_1.ContractMethodV6.swapExactAmountOutOnUniswapV2,
10
- core_1.ContractMethodV6.swapExactAmountInOnUniswapV3,
11
- core_1.ContractMethodV6.swapExactAmountOutOnUniswapV3,
12
- core_1.ContractMethodV6.swapExactAmountInOnBalancerV2,
13
- core_1.ContractMethodV6.swapExactAmountOutOnBalancerV2,
14
- core_1.ContractMethodV6.swapExactAmountInOnCurveV1,
15
- core_1.ContractMethodV6.swapExactAmountInOnCurveV2,
16
- core_1.ContractMethodV6.swapOnAugustusRFQTryBatchFill,
17
- core_1.ContractMethodV6.swapExactAmountInOutOnMakerPSM,
18
- ];
19
- const DIRECT_CONTRACT_METHOD_SET_V6 = new Set(exports.DIRECT_CONTRACT_METHODS_V6);
20
- // Omits swapOnAugustusRFQTryBatchFill and swapExactAmountInOutOnMakerPSM:
21
- // those methods do not encode side in the method name. An undefined lookup
22
- // means side must come from the per-call route input.
23
- exports.DIRECT_CONTRACT_METHOD_SIDES_V6 = {
24
- [core_1.ContractMethodV6.swapExactAmountInOnUniswapV2]: core_1.SwapSide.SELL,
25
- [core_1.ContractMethodV6.swapExactAmountOutOnUniswapV2]: core_1.SwapSide.BUY,
26
- [core_1.ContractMethodV6.swapExactAmountInOnUniswapV3]: core_1.SwapSide.SELL,
27
- [core_1.ContractMethodV6.swapExactAmountOutOnUniswapV3]: core_1.SwapSide.BUY,
28
- [core_1.ContractMethodV6.swapExactAmountInOnBalancerV2]: core_1.SwapSide.SELL,
29
- [core_1.ContractMethodV6.swapExactAmountOutOnBalancerV2]: core_1.SwapSide.BUY,
30
- [core_1.ContractMethodV6.swapExactAmountInOnCurveV1]: core_1.SwapSide.SELL,
31
- [core_1.ContractMethodV6.swapExactAmountInOnCurveV2]: core_1.SwapSide.SELL,
32
- };
33
- function isDirectContractMethodV6(contractMethod) {
34
- return DIRECT_CONTRACT_METHOD_SET_V6.has(contractMethod);
35
- }
36
- function getDirectContractMethodSideV6(contractMethod) {
37
- return exports.DIRECT_CONTRACT_METHOD_SIDES_V6[contractMethod];
38
- }
39
- //# sourceMappingURL=direct-methods.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"direct-methods.js","sourceRoot":"","sources":["../../../src/generic-swap-transaction-builder/dex-encoder/direct-methods.ts"],"names":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AAO,uCAA+B,CAAC,cAAc,CAAC,CAAC;AACzD,CAAC"}
@@ -1,4 +0,0 @@
1
- export * from './direct-methods';
2
- export * from './ports';
3
- export * from './ts-adapter';
4
- export * from './types';
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./direct-methods"), exports);
18
- __exportStar(require("./ports"), exports);
19
- __exportStar(require("./ts-adapter"), exports);
20
- __exportStar(require("./types"), exports);
21
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/generic-swap-transaction-builder/dex-encoder/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,0CAAwB;AACxB,+CAA6B;AAC7B,0CAAwB"}
@@ -1,26 +0,0 @@
1
- import type { ExecutorEncodingContext } from '../../executor/encoding-types';
2
- import type { DexExchangeParam, DexParamInput, DirectParamInput, DirectParamResult, NeedWrapNativeInput, WethDepositWithdrawInput, WethDepositWithdrawResult } from './types';
3
- export type MaybePromise<T> = T | Promise<T>;
4
- export type DexEncoderPort = {
5
- needWrapNative(input: NeedWrapNativeInput): MaybePromise<boolean>;
6
- getDexParam(input: DexParamInput): MaybePromise<DexExchangeParam>;
7
- };
8
- export type DirectDexEncoderPort = {
9
- getDirectParam(input: DirectParamInput): MaybePromise<DirectParamResult>;
10
- };
11
- export type DexEncoderLookup = {
12
- network: number;
13
- dexKey: string;
14
- };
15
- export type DirectDexEncoderLookup = DexEncoderLookup & {
16
- contractMethod: DirectParamInput['contractMethod'];
17
- };
18
- export type DexEncoderRegistryPort = {
19
- getDexEncoder(lookup: DexEncoderLookup): MaybePromise<DexEncoderPort>;
20
- getDirectDexEncoder(lookup: DirectDexEncoderLookup): MaybePromise<DirectDexEncoderPort>;
21
- };
22
- export type WethCallDataProviderPort = {
23
- getDepositWithdrawCallData(input: WethDepositWithdrawInput): MaybePromise<WethDepositWithdrawResult | undefined>;
24
- };
25
- export type CreateWethCallDataProviderPort = (context: ExecutorEncodingContext) => WethCallDataProviderPort;
26
- export type CreateWethCallDataProvider = CreateWethCallDataProviderPort;
@@ -1 +0,0 @@
1
- {"version":3,"file":"ports.js","sourceRoot":"","sources":["../../../src/generic-swap-transaction-builder/dex-encoder/ports.ts"],"names":[],"mappings":""}
@@ -1,22 +0,0 @@
1
- import type { DexAdapterService } from '../../dex';
2
- import type { ExecutorEncodingContext } from '../../executor/encoding-types';
3
- import { type DirectParamInput } from './types';
4
- import type { DexEncoderPort, DexEncoderRegistryPort, DirectDexEncoderPort, WethCallDataProviderPort } from './ports';
5
- type TsDexAdapterService = Pick<DexAdapterService, 'network' | 'getTxBuilderDexByKey'>;
6
- export declare function createTsDexEncoderRegistry(dexAdapterService: TsDexAdapterService): DexEncoderRegistryPort;
7
- export declare class TsDexEncoderRegistryAdapter implements DexEncoderRegistryPort {
8
- private readonly dexAdapterService;
9
- constructor(dexAdapterService: TsDexAdapterService);
10
- getDexEncoder({ network, dexKey, }: {
11
- network: number;
12
- dexKey: string;
13
- }): Promise<DexEncoderPort>;
14
- getDirectDexEncoder({ network, dexKey, contractMethod, }: {
15
- network: number;
16
- dexKey: string;
17
- contractMethod: DirectParamInput['contractMethod'];
18
- }): Promise<DirectDexEncoderPort>;
19
- private assertNetwork;
20
- }
21
- export declare function createWethCallDataProvider(context: ExecutorEncodingContext): WethCallDataProviderPort;
22
- export {};