four-flap-meme-sdk 3.0.1 → 4.0.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 (442) hide show
  1. package/dist/bundle/four-meme/approve-tokenmanager.d.ts +2 -2
  2. package/dist/bundle/four-meme/approve-tokenmanager.js +3 -3
  3. package/dist/bundle/four-meme/core/buy-flow.d.ts +5 -0
  4. package/dist/bundle/four-meme/core/buy-flow.js +147 -0
  5. package/dist/bundle/four-meme/core/constants.d.ts +6 -0
  6. package/dist/bundle/four-meme/core/constants.js +15 -0
  7. package/dist/bundle/four-meme/core/create-token.d.ts +5 -0
  8. package/dist/bundle/four-meme/core/create-token.js +137 -0
  9. package/dist/bundle/four-meme/core/index.d.ts +14 -0
  10. package/dist/bundle/four-meme/core/index.js +14 -0
  11. package/dist/bundle/four-meme/core/sell-flow.d.ts +5 -0
  12. package/dist/bundle/four-meme/core/sell-flow.js +240 -0
  13. package/dist/bundle/four-meme/core-helpers.js +1 -1
  14. package/dist/bundle/four-meme/core.d.ts +7 -4
  15. package/dist/bundle/four-meme/core.js +5 -513
  16. package/dist/bundle/four-meme/pancake-proxy/approve.d.ts +15 -0
  17. package/dist/bundle/four-meme/pancake-proxy/approve.js +113 -0
  18. package/dist/bundle/four-meme/pancake-proxy/buy.d.ts +8 -0
  19. package/dist/bundle/four-meme/pancake-proxy/buy.js +143 -0
  20. package/dist/bundle/four-meme/pancake-proxy/constants.d.ts +25 -0
  21. package/dist/bundle/four-meme/pancake-proxy/constants.js +14 -0
  22. package/dist/bundle/four-meme/pancake-proxy/helpers.d.ts +45 -0
  23. package/dist/bundle/four-meme/pancake-proxy/helpers.js +232 -0
  24. package/dist/bundle/four-meme/pancake-proxy/index.d.ts +15 -0
  25. package/dist/bundle/four-meme/pancake-proxy/index.js +15 -0
  26. package/dist/bundle/four-meme/pancake-proxy/sell.d.ts +8 -0
  27. package/dist/bundle/four-meme/pancake-proxy/sell.js +194 -0
  28. package/dist/bundle/four-meme/pancake-proxy.d.ts +4 -20
  29. package/dist/bundle/four-meme/pancake-proxy.js +3 -670
  30. package/dist/bundle/four-meme/private/buy.d.ts +16 -0
  31. package/dist/bundle/four-meme/private/buy.js +225 -0
  32. package/dist/bundle/four-meme/private/index.d.ts +11 -0
  33. package/dist/bundle/four-meme/private/index.js +11 -0
  34. package/dist/bundle/four-meme/private/sell.d.ts +18 -0
  35. package/dist/bundle/four-meme/private/sell.js +245 -0
  36. package/dist/bundle/four-meme/private.d.ts +5 -25
  37. package/dist/bundle/four-meme/private.js +5 -463
  38. package/dist/bundle/four-meme/swap/batch.d.ts +8 -0
  39. package/dist/bundle/four-meme/swap/batch.js +170 -0
  40. package/dist/bundle/four-meme/swap/bundle.d.ts +8 -0
  41. package/dist/bundle/four-meme/swap/bundle.js +147 -0
  42. package/dist/bundle/four-meme/swap/index.d.ts +14 -0
  43. package/dist/bundle/four-meme/swap/index.js +13 -0
  44. package/dist/bundle/four-meme/swap/quick-batch.d.ts +8 -0
  45. package/dist/bundle/four-meme/swap/quick-batch.js +206 -0
  46. package/dist/bundle/four-meme/swap-buy-first/helpers.d.ts +20 -0
  47. package/dist/bundle/four-meme/swap-buy-first/helpers.js +39 -0
  48. package/dist/bundle/four-meme/swap-buy-first/index.d.ts +12 -0
  49. package/dist/bundle/four-meme/swap-buy-first/index.js +11 -0
  50. package/dist/bundle/four-meme/swap-buy-first/multi-wallet.d.ts +20 -0
  51. package/dist/bundle/four-meme/swap-buy-first/multi-wallet.js +198 -0
  52. package/dist/bundle/four-meme/swap-buy-first/single.d.ts +7 -0
  53. package/dist/bundle/four-meme/swap-buy-first/single.js +232 -0
  54. package/dist/bundle/four-meme/swap-buy-first.d.ts +4 -3
  55. package/dist/bundle/four-meme/swap-buy-first.js +4 -451
  56. package/dist/bundle/four-meme/swap-hop-helpers.d.ts +2 -2
  57. package/dist/bundle/four-meme/swap-sign-helpers.d.ts +2 -2
  58. package/dist/bundle/four-meme/swap-sign-helpers.js +1 -1
  59. package/dist/bundle/four-meme/swap.d.ts +4 -14
  60. package/dist/bundle/four-meme/swap.js +4 -502
  61. package/dist/bundle/four-meme/types/index.d.ts +1 -1
  62. package/dist/bundle/four-meme/utils-disperse.d.ts +1 -1
  63. package/dist/bundle/four-meme/utils-disperse.js +1 -1
  64. package/dist/bundle/four-meme/utils-pairwise.d.ts +1 -1
  65. package/dist/bundle/four-meme/utils-pairwise.js +1 -1
  66. package/dist/bundle/four-meme/utils-sweep/context.d.ts +39 -0
  67. package/dist/bundle/four-meme/utils-sweep/context.js +7 -0
  68. package/dist/bundle/four-meme/utils-sweep/erc20-no-hop.d.ts +5 -0
  69. package/dist/bundle/four-meme/utils-sweep/erc20-no-hop.js +162 -0
  70. package/dist/bundle/four-meme/utils-sweep/index.d.ts +13 -0
  71. package/dist/bundle/four-meme/utils-sweep/index.js +13 -0
  72. package/dist/bundle/four-meme/utils-sweep/main.d.ts +8 -0
  73. package/dist/bundle/four-meme/utils-sweep/main.js +114 -0
  74. package/dist/bundle/four-meme/utils-sweep/native-no-hop.d.ts +5 -0
  75. package/dist/bundle/four-meme/utils-sweep/native-no-hop.js +156 -0
  76. package/dist/bundle/four-meme/utils-sweep/with-hops.d.ts +6 -0
  77. package/dist/bundle/four-meme/utils-sweep/with-hops.js +382 -0
  78. package/dist/bundle/four-meme/utils-sweep.d.ts +3 -4
  79. package/dist/bundle/four-meme/utils-sweep.js +3 -740
  80. package/dist/bundle/internal.d.ts +2 -2
  81. package/dist/bundle/sign-context-helpers.d.ts +1 -26
  82. package/dist/bundle/sign-context-helpers.js +1 -63
  83. package/dist/bundle/submit/blockrazor.d.ts +94 -0
  84. package/dist/bundle/submit/blockrazor.js +122 -0
  85. package/dist/bundle/submit/direct.d.ts +118 -0
  86. package/dist/bundle/submit/direct.js +484 -0
  87. package/dist/bundle/submit/helpers.d.ts +7 -0
  88. package/dist/bundle/submit/helpers.js +15 -0
  89. package/dist/bundle/submit/index.d.ts +14 -0
  90. package/dist/bundle/submit/index.js +14 -0
  91. package/dist/bundle/submit/merkle.d.ts +84 -0
  92. package/dist/bundle/submit/merkle.js +121 -0
  93. package/dist/bundle/submit.d.ts +3 -286
  94. package/dist/bundle/submit.js +3 -724
  95. package/dist/chains/bsc/four/types.d.ts +1 -1
  96. package/dist/chains/bsc/pancake/bundle-buy-first-build.d.ts +25 -0
  97. package/dist/chains/bsc/pancake/bundle-buy-first-build.js +177 -0
  98. package/dist/chains/bsc/pancake/bundle-buy-first-constants.d.ts +30 -0
  99. package/dist/chains/bsc/pancake/bundle-buy-first-constants.js +24 -0
  100. package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +11 -149
  101. package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +12 -74
  102. package/dist/chains/bsc/pancake/bundle-buy-first-multi-wallet.d.ts +9 -0
  103. package/dist/chains/bsc/pancake/bundle-buy-first-multi-wallet.js +225 -0
  104. package/dist/chains/bsc/pancake/bundle-buy-first-plan.d.ts +14 -0
  105. package/dist/chains/bsc/pancake/bundle-buy-first-plan.js +64 -0
  106. package/dist/chains/bsc/pancake/bundle-buy-first-profit.d.ts +12 -0
  107. package/dist/chains/bsc/pancake/bundle-buy-first-profit.js +22 -0
  108. package/dist/chains/bsc/pancake/bundle-buy-first-quote.d.ts +15 -0
  109. package/dist/chains/bsc/pancake/bundle-buy-first-quote.js +122 -0
  110. package/dist/chains/bsc/pancake/bundle-buy-first-types.d.ts +179 -0
  111. package/dist/chains/bsc/pancake/bundle-buy-first-types.js +1 -0
  112. package/dist/chains/bsc/pancake/bundle-buy-first-validate.d.ts +2 -0
  113. package/dist/chains/bsc/pancake/bundle-buy-first-validate.js +41 -0
  114. package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +1 -1
  115. package/dist/chains/bsc/pancake/bundle-buy-first.js +8 -578
  116. package/dist/chains/bsc/pancake/bundle-swap-helpers.d.ts +11 -239
  117. package/dist/chains/bsc/pancake/bundle-swap-helpers.js +12 -564
  118. package/dist/chains/bsc/pancake/bundle-swap-types.d.ts +183 -0
  119. package/dist/chains/bsc/pancake/bundle-swap-types.js +17 -0
  120. package/dist/chains/bsc/pancake/bundle-swap.d.ts +10 -132
  121. package/dist/chains/bsc/pancake/bundle-swap.js +12 -1003
  122. package/dist/chains/bsc/pancake/hop-chain.d.ts +18 -0
  123. package/dist/chains/bsc/pancake/hop-chain.js +227 -0
  124. package/dist/chains/bsc/pancake/quote.d.ts +14 -0
  125. package/dist/chains/bsc/pancake/quote.js +84 -0
  126. package/dist/chains/bsc/pancake/swap-batch.d.ts +42 -0
  127. package/dist/chains/bsc/pancake/swap-batch.js +283 -0
  128. package/dist/chains/bsc/pancake/swap-build.d.ts +19 -0
  129. package/dist/chains/bsc/pancake/swap-build.js +226 -0
  130. package/dist/chains/bsc/pancake/swap-cross.d.ts +42 -0
  131. package/dist/chains/bsc/pancake/swap-cross.js +140 -0
  132. package/dist/chains/bsc/pancake/swap-quick.d.ts +54 -0
  133. package/dist/chains/bsc/pancake/swap-quick.js +424 -0
  134. package/dist/chains/bsc/pancake/swap-single.d.ts +2 -0
  135. package/dist/chains/bsc/pancake/swap-single.js +182 -0
  136. package/dist/chains/bsc/platforms/four/index.d.ts +21 -3
  137. package/dist/chains/bsc/platforms/four/index.js +28 -3
  138. package/dist/chains/eni/batch-router/transfer-disperse.d.ts +37 -0
  139. package/dist/chains/eni/batch-router/transfer-disperse.js +302 -0
  140. package/dist/chains/eni/batch-router/transfer-shared.d.ts +9 -0
  141. package/dist/chains/eni/batch-router/transfer-shared.js +10 -0
  142. package/dist/chains/eni/batch-router/transfer-sweep.d.ts +51 -0
  143. package/dist/chains/eni/batch-router/transfer-sweep.js +364 -0
  144. package/dist/chains/eni/batch-router/transfer.d.ts +4 -74
  145. package/dist/chains/eni/batch-router/transfer.js +2 -647
  146. package/dist/chains/eni/platforms/daoaas/portal-direct-profit.d.ts +17 -0
  147. package/dist/chains/eni/platforms/daoaas/portal-direct-profit.js +30 -0
  148. package/dist/chains/eni/platforms/daoaas/portal-direct-submit.d.ts +12 -0
  149. package/dist/chains/eni/platforms/daoaas/portal-direct-submit.js +396 -0
  150. package/dist/chains/eni/platforms/daoaas/portal-direct-tx.d.ts +20 -0
  151. package/dist/chains/eni/platforms/daoaas/portal-direct-tx.js +165 -0
  152. package/dist/chains/eni/platforms/daoaas/portal-direct.d.ts +3 -32
  153. package/dist/chains/eni/platforms/daoaas/portal-direct.js +3 -571
  154. package/dist/chains/eni/submit.js +1 -1
  155. package/dist/chains/xlayer/constants.d.ts +0 -2
  156. package/dist/chains/xlayer/constants.js +0 -2
  157. package/dist/chains/xlayer/eip7702/auth.d.ts +16 -0
  158. package/dist/chains/xlayer/eip7702/auth.js +81 -0
  159. package/dist/chains/xlayer/eip7702/bundle-create-buy.d.ts +22 -0
  160. package/dist/chains/xlayer/eip7702/bundle-create-buy.js +201 -0
  161. package/dist/chains/xlayer/eip7702/bundle-create-helpers.d.ts +114 -0
  162. package/dist/chains/xlayer/eip7702/bundle-create-helpers.js +139 -0
  163. package/dist/chains/xlayer/eip7702/bundle-create-to-dex.d.ts +24 -0
  164. package/dist/chains/xlayer/eip7702/bundle-create-to-dex.js +233 -0
  165. package/dist/chains/xlayer/eip7702/bundle-create.d.ts +3 -35
  166. package/dist/chains/xlayer/eip7702/bundle-create.js +3 -746
  167. package/dist/chains/xlayer/eip7702/bundle-graduate-buy.d.ts +22 -0
  168. package/dist/chains/xlayer/eip7702/bundle-graduate-buy.js +214 -0
  169. package/dist/chains/xlayer/eip7702/bundle-sell.js +1 -1
  170. package/dist/chains/xlayer/eip7702/bundle-swap-batch.d.ts +31 -0
  171. package/dist/chains/xlayer/eip7702/bundle-swap-batch.js +216 -0
  172. package/dist/chains/xlayer/eip7702/bundle-swap-helpers.d.ts +21 -0
  173. package/dist/chains/xlayer/eip7702/bundle-swap-helpers.js +206 -0
  174. package/dist/chains/xlayer/eip7702/bundle-swap-multi.d.ts +33 -0
  175. package/dist/chains/xlayer/eip7702/bundle-swap-multi.js +146 -0
  176. package/dist/chains/xlayer/eip7702/bundle-swap-single.d.ts +31 -0
  177. package/dist/chains/xlayer/eip7702/bundle-swap-single.js +177 -0
  178. package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +6 -61
  179. package/dist/chains/xlayer/eip7702/bundle-swap.js +3 -712
  180. package/dist/chains/xlayer/eip7702/bytes.d.ts +4 -0
  181. package/dist/chains/xlayer/eip7702/bytes.js +31 -0
  182. package/dist/chains/xlayer/eip7702/gas.d.ts +19 -0
  183. package/dist/chains/xlayer/eip7702/gas.js +152 -0
  184. package/dist/chains/xlayer/eip7702/multi-hop-transfer-disperse.d.ts +5 -0
  185. package/dist/chains/xlayer/eip7702/multi-hop-transfer-disperse.js +196 -0
  186. package/dist/chains/xlayer/eip7702/multi-hop-transfer-pairwise.d.ts +5 -0
  187. package/dist/chains/xlayer/eip7702/multi-hop-transfer-pairwise.js +188 -0
  188. package/dist/chains/xlayer/eip7702/multi-hop-transfer-sweep.d.ts +5 -0
  189. package/dist/chains/xlayer/eip7702/multi-hop-transfer-sweep.js +220 -0
  190. package/dist/chains/xlayer/eip7702/multi-hop-transfer.d.ts +8 -4
  191. package/dist/chains/xlayer/eip7702/multi-hop-transfer.js +5 -591
  192. package/dist/chains/xlayer/eip7702/profit.d.ts +32 -0
  193. package/dist/chains/xlayer/eip7702/profit.js +59 -0
  194. package/dist/chains/xlayer/eip7702/provider.d.ts +3 -0
  195. package/dist/chains/xlayer/eip7702/provider.js +17 -0
  196. package/dist/chains/xlayer/eip7702/time.d.ts +2 -0
  197. package/dist/chains/xlayer/eip7702/time.js +10 -0
  198. package/dist/chains/xlayer/eip7702/tx-build.d.ts +10 -0
  199. package/dist/chains/xlayer/eip7702/tx-build.js +128 -0
  200. package/dist/chains/xlayer/eip7702/utils.d.ts +19 -85
  201. package/dist/chains/xlayer/eip7702/utils.js +19 -484
  202. package/dist/chains/xlayer/eip7702/volume-bundle.d.ts +13 -0
  203. package/dist/chains/xlayer/eip7702/volume-bundle.js +250 -0
  204. package/dist/chains/xlayer/eip7702/volume-internal.d.ts +13 -0
  205. package/dist/chains/xlayer/eip7702/volume-internal.js +169 -0
  206. package/dist/chains/xlayer/eip7702/volume-make.d.ts +8 -0
  207. package/dist/chains/xlayer/eip7702/volume-make.js +38 -0
  208. package/dist/chains/xlayer/eip7702/volume-single-round.d.ts +17 -0
  209. package/dist/chains/xlayer/eip7702/volume-single-round.js +44 -0
  210. package/dist/chains/xlayer/eip7702/volume-swap.d.ts +18 -0
  211. package/dist/chains/xlayer/eip7702/volume-swap.js +30 -0
  212. package/dist/chains/xlayer/eip7702/volume-wash.d.ts +8 -0
  213. package/dist/chains/xlayer/eip7702/volume-wash.js +191 -0
  214. package/dist/chains/xlayer/eip7702/volume.d.ts +7 -35
  215. package/dist/chains/xlayer/eip7702/volume.js +5 -697
  216. package/dist/chains/xlayer/eip7702/wallet.d.ts +6 -0
  217. package/dist/chains/xlayer/eip7702/wallet.js +17 -0
  218. package/dist/chains/xlayer/eoa/aa-types.d.ts +176 -0
  219. package/dist/chains/xlayer/eoa/aa-types.js +6 -0
  220. package/dist/chains/xlayer/eoa/constants.d.ts +0 -2
  221. package/dist/chains/xlayer/eoa/constants.js +0 -2
  222. package/dist/chains/xlayer/eoa/context.d.ts +8 -0
  223. package/dist/chains/xlayer/eoa/context.js +23 -0
  224. package/dist/chains/xlayer/eoa/encoders.d.ts +147 -0
  225. package/dist/chains/xlayer/eoa/encoders.js +147 -0
  226. package/dist/chains/xlayer/eoa/eoa-bundle-swap-cross.d.ts +5 -0
  227. package/dist/chains/xlayer/eoa/eoa-bundle-swap-cross.js +113 -0
  228. package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts +10 -123
  229. package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +10 -225
  230. package/dist/chains/xlayer/eoa/eoa-bundle-swap-pure.d.ts +50 -0
  231. package/dist/chains/xlayer/eoa/eoa-bundle-swap-pure.js +170 -0
  232. package/dist/chains/xlayer/eoa/eoa-bundle-swap-quick.d.ts +5 -0
  233. package/dist/chains/xlayer/eoa/eoa-bundle-swap-quick.js +257 -0
  234. package/dist/chains/xlayer/eoa/eoa-bundle-swap-types.d.ts +99 -0
  235. package/dist/chains/xlayer/eoa/eoa-bundle-swap-types.js +11 -0
  236. package/dist/chains/xlayer/eoa/eoa-bundle-swap.d.ts +5 -47
  237. package/dist/chains/xlayer/eoa/eoa-bundle-swap.js +3 -522
  238. package/dist/chains/xlayer/eoa/eoa-types.d.ts +776 -0
  239. package/dist/chains/xlayer/eoa/eoa-types.js +6 -0
  240. package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +8 -0
  241. package/dist/chains/xlayer/eoa/eoa-wash-volume.js +8 -0
  242. package/dist/chains/xlayer/eoa/format.d.ts +34 -0
  243. package/dist/chains/xlayer/eoa/format.js +56 -0
  244. package/dist/chains/xlayer/eoa/hop-chain.d.ts +4 -0
  245. package/dist/chains/xlayer/eoa/hop-chain.js +87 -0
  246. package/dist/chains/xlayer/eoa/nonce-map.d.ts +20 -0
  247. package/dist/chains/xlayer/eoa/nonce-map.js +51 -0
  248. package/dist/chains/xlayer/eoa/portal-ops.d.ts +9 -292
  249. package/dist/chains/xlayer/eoa/portal-ops.js +9 -486
  250. package/dist/chains/xlayer/eoa/query.d.ts +117 -0
  251. package/dist/chains/xlayer/eoa/query.js +285 -0
  252. package/dist/chains/xlayer/eoa/quote.d.ts +6 -0
  253. package/dist/chains/xlayer/eoa/quote.js +90 -0
  254. package/dist/chains/xlayer/eoa/types.d.ts +9 -959
  255. package/dist/chains/xlayer/eoa/types.js +9 -49
  256. package/dist/core/clients/blockrazor.js +1 -1
  257. package/dist/core/clients/merkle.js +1 -1
  258. package/dist/core/erc20/allowances.d.ts +104 -0
  259. package/dist/core/erc20/allowances.js +205 -0
  260. package/dist/core/erc20/approve.d.ts +141 -0
  261. package/dist/core/erc20/approve.js +325 -0
  262. package/dist/core/erc20/helpers.d.ts +20 -0
  263. package/dist/core/erc20/helpers.js +109 -0
  264. package/dist/core/erc20/index.d.ts +13 -0
  265. package/dist/core/erc20/index.js +12 -0
  266. package/dist/core/gas/bundle-gas.d.ts +6 -1
  267. package/dist/core/index.d.ts +1 -1
  268. package/dist/core/index.js +1 -1
  269. package/dist/core/quote/index.d.ts +1 -0
  270. package/dist/core/quote/index.js +1 -0
  271. package/dist/core/quote/quote-helpers.d.ts +78 -0
  272. package/dist/core/quote/quote-helpers.js +289 -0
  273. package/dist/core/quote/types.d.ts +1 -0
  274. package/dist/core/quote/types.js +1 -0
  275. package/dist/core/sign-context-helpers.d.ts +29 -0
  276. package/dist/core/sign-context-helpers.js +63 -0
  277. package/dist/domains/dex/direct-router-helpers.d.ts +16 -268
  278. package/dist/domains/dex/direct-router-helpers.js +16 -535
  279. package/dist/domains/dex/direct-router-types.d.ts +104 -0
  280. package/dist/domains/dex/direct-router-types.js +81 -0
  281. package/dist/domains/dex/direct-router-v2-buy.d.ts +2 -0
  282. package/dist/domains/dex/direct-router-v2-buy.js +249 -0
  283. package/dist/domains/dex/direct-router-v2-sell.d.ts +5 -0
  284. package/dist/domains/dex/direct-router-v2-sell.js +270 -0
  285. package/dist/domains/dex/direct-router-v2.d.ts +9 -0
  286. package/dist/domains/dex/direct-router-v2.js +9 -0
  287. package/dist/domains/dex/direct-router-v3.d.ts +17 -0
  288. package/dist/domains/dex/direct-router-v3.js +432 -0
  289. package/dist/domains/dex/direct-router.d.ts +11 -26
  290. package/dist/domains/dex/direct-router.js +10 -977
  291. package/dist/domains/dex/dyo-encode.d.ts +62 -0
  292. package/dist/domains/dex/dyo-encode.js +124 -0
  293. package/dist/domains/dex/profit.d.ts +24 -0
  294. package/dist/domains/dex/profit.js +86 -0
  295. package/dist/domains/dex/provider.d.ts +10 -0
  296. package/dist/domains/dex/provider.js +27 -0
  297. package/dist/domains/dex/quote.d.ts +7 -0
  298. package/dist/domains/dex/quote.js +52 -0
  299. package/dist/domains/dex/router.d.ts +56 -0
  300. package/dist/domains/dex/router.js +193 -0
  301. package/dist/domains/flap/portal-bundle/batch.d.ts +9 -0
  302. package/dist/domains/flap/portal-bundle/batch.js +193 -0
  303. package/dist/domains/flap/portal-bundle/create.d.ts +5 -0
  304. package/dist/domains/flap/portal-bundle/create.js +153 -0
  305. package/dist/domains/flap/portal-bundle/helpers.d.ts +32 -0
  306. package/dist/domains/flap/portal-bundle/helpers.js +50 -0
  307. package/dist/domains/flap/portal-bundle/index.d.ts +16 -0
  308. package/dist/domains/flap/portal-bundle/index.js +15 -0
  309. package/dist/domains/flap/portal-bundle/private.d.ts +5 -0
  310. package/dist/domains/flap/portal-bundle/private.js +198 -0
  311. package/dist/domains/flap/portal-bundle/types.d.ts +102 -0
  312. package/dist/domains/flap/portal-bundle/types.js +1 -0
  313. package/dist/domains/flap/portal-bundle-merkle/core-batch.d.ts +13 -0
  314. package/dist/domains/flap/portal-bundle-merkle/core-batch.js +376 -0
  315. package/dist/domains/flap/portal-bundle-merkle/core-helpers.d.ts +75 -7
  316. package/dist/domains/flap/portal-bundle-merkle/core-helpers.js +259 -20
  317. package/dist/domains/flap/portal-bundle-merkle/core.d.ts +2 -13
  318. package/dist/domains/flap/portal-bundle-merkle/core.js +12 -629
  319. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/constants.d.ts +70 -0
  320. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/constants.js +90 -0
  321. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/index.d.ts +12 -0
  322. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/index.js +11 -0
  323. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/main.d.ts +15 -0
  324. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/main.js +432 -0
  325. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/types.d.ts +113 -0
  326. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/types.js +4 -0
  327. package/dist/domains/flap/portal-bundle-merkle/create-to-dex.d.ts +4 -127
  328. package/dist/domains/flap/portal-bundle-merkle/create-to-dex.js +4 -527
  329. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/constants.d.ts +42 -0
  330. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/constants.js +81 -0
  331. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/index.d.ts +12 -0
  332. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/index.js +11 -0
  333. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/main.d.ts +15 -0
  334. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/main.js +339 -0
  335. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/types.d.ts +72 -0
  336. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/types.js +4 -0
  337. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex.d.ts +4 -85
  338. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex.js +4 -425
  339. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/approve.d.ts +12 -0
  340. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/approve.js +102 -0
  341. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/buy.d.ts +5 -0
  342. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/buy.js +135 -0
  343. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/helpers.d.ts +52 -0
  344. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/helpers.js +267 -0
  345. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/index.d.ts +14 -0
  346. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/index.js +14 -0
  347. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/sell.d.ts +5 -0
  348. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/sell.js +195 -0
  349. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy.d.ts +3 -24
  350. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy.js +3 -700
  351. package/dist/domains/flap/portal-bundle-merkle/private/buy.d.ts +9 -0
  352. package/dist/domains/flap/portal-bundle-merkle/private/buy.js +188 -0
  353. package/dist/domains/flap/portal-bundle-merkle/private/helpers.d.ts +36 -0
  354. package/dist/domains/flap/portal-bundle-merkle/private/helpers.js +127 -0
  355. package/dist/domains/flap/portal-bundle-merkle/private/index.d.ts +12 -0
  356. package/dist/domains/flap/portal-bundle-merkle/private/index.js +12 -0
  357. package/dist/domains/flap/portal-bundle-merkle/private/sell.d.ts +9 -0
  358. package/dist/domains/flap/portal-bundle-merkle/private/sell.js +191 -0
  359. package/dist/domains/flap/portal-bundle-merkle/private.d.ts +5 -15
  360. package/dist/domains/flap/portal-bundle-merkle/private.js +5 -494
  361. package/dist/domains/flap/portal-bundle-merkle/swap-batch.js +3 -2
  362. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-chain.d.ts +4 -0
  363. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-chain.js +43 -0
  364. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-constants.d.ts +13 -0
  365. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-constants.js +21 -0
  366. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +11 -121
  367. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-helpers.js +11 -109
  368. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-multi-wallet.d.ts +20 -0
  369. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-multi-wallet.js +223 -0
  370. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-plan.d.ts +32 -0
  371. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-plan.js +66 -0
  372. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-profit.d.ts +22 -0
  373. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-profit.js +22 -0
  374. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-quote.d.ts +51 -0
  375. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-quote.js +149 -0
  376. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-types.d.ts +87 -0
  377. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-types.js +1 -0
  378. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first.js +5 -404
  379. package/dist/domains/flap/portal-bundle-merkle/swap-helpers.d.ts +0 -1
  380. package/dist/domains/flap/portal-bundle-merkle/swap-helpers.js +0 -7
  381. package/dist/domains/flap/portal-bundle-merkle/swap-planning.js +1 -1
  382. package/dist/domains/flap/portal-bundle-merkle/swap-quick-batch.js +3 -2
  383. package/dist/domains/flap/portal-bundle-merkle/swap-single.js +3 -2
  384. package/dist/domains/flap/portal-bundle-merkle/utils/disperse.d.ts +2 -0
  385. package/dist/domains/flap/portal-bundle-merkle/utils/disperse.js +275 -0
  386. package/dist/domains/flap/portal-bundle-merkle/utils/index.d.ts +11 -0
  387. package/dist/domains/flap/portal-bundle-merkle/utils/index.js +11 -0
  388. package/dist/domains/flap/portal-bundle-merkle/utils/sweep.d.ts +9 -0
  389. package/dist/domains/flap/portal-bundle-merkle/utils/sweep.js +570 -0
  390. package/dist/domains/flap/portal-bundle-merkle/utils.d.ts +5 -8
  391. package/dist/domains/flap/portal-bundle-merkle/utils.js +5 -841
  392. package/dist/domains/flap/portal-bundle.d.ts +5 -117
  393. package/dist/domains/flap/portal-bundle.js +5 -587
  394. package/dist/domains/flap/portal.d.ts +13 -404
  395. package/dist/domains/flap/portal.js +12 -619
  396. package/dist/domains/flap/reader.d.ts +51 -0
  397. package/dist/domains/flap/reader.js +275 -0
  398. package/dist/domains/flap/types.d.ts +246 -0
  399. package/dist/domains/flap/types.js +104 -0
  400. package/dist/domains/flap/vault/constants.d.ts +220 -0
  401. package/dist/domains/flap/vault/constants.js +173 -0
  402. package/dist/domains/flap/vault/encode.d.ts +39 -0
  403. package/dist/domains/flap/vault/encode.js +135 -0
  404. package/dist/domains/flap/vault/index.d.ts +15 -0
  405. package/dist/domains/flap/vault/index.js +14 -0
  406. package/dist/domains/flap/vault/query.d.ts +40 -0
  407. package/dist/domains/flap/vault/query.js +104 -0
  408. package/dist/domains/flap/vault/types.d.ts +147 -0
  409. package/dist/domains/flap/vault/types.js +29 -0
  410. package/dist/domains/flap/vault.d.ts +3 -413
  411. package/dist/domains/flap/vault.js +3 -467
  412. package/dist/domains/flap/writer.d.ts +124 -0
  413. package/dist/domains/flap/writer.js +255 -0
  414. package/dist/domains/four/contracts/tm-bundle-batch.d.ts +35 -0
  415. package/dist/domains/four/contracts/tm-bundle-batch.js +286 -0
  416. package/dist/domains/four/contracts/tm-bundle-create.d.ts +2 -0
  417. package/dist/domains/four/contracts/tm-bundle-create.js +304 -0
  418. package/dist/domains/four/contracts/tm-bundle-helpers.d.ts +2 -1
  419. package/dist/domains/four/contracts/tm-bundle-helpers.js +3 -0
  420. package/dist/domains/four/contracts/tm-bundle-private.d.ts +36 -0
  421. package/dist/domains/four/contracts/tm-bundle-private.js +164 -0
  422. package/dist/domains/four/contracts/tm-bundle.d.ts +10 -71
  423. package/dist/domains/four/contracts/tm-bundle.js +9 -738
  424. package/dist/domains/lp-inspect/inspect-helpers.d.ts +25 -0
  425. package/dist/domains/lp-inspect/inspect-helpers.js +343 -0
  426. package/dist/domains/lp-inspect/inspect.d.ts +8 -0
  427. package/dist/domains/lp-inspect/inspect.js +332 -0
  428. package/dist/domains/lp-inspect/lp-inspect.d.ts +9 -37
  429. package/dist/domains/lp-inspect/lp-inspect.js +9 -775
  430. package/dist/domains/lp-inspect/registry.d.ts +43 -0
  431. package/dist/domains/lp-inspect/registry.js +127 -0
  432. package/dist/domains/merkle/index.d.ts +1 -1
  433. package/dist/exports/root-bundle-and-tooling.d.ts +9 -1
  434. package/dist/exports/root-bundle-and-tooling.js +8 -1
  435. package/dist/exports/root-foundations.d.ts +1 -1
  436. package/dist/exports/root-foundations.js +1 -1
  437. package/dist/exports/root-swap-dex-and-xlayer.d.ts +4 -4
  438. package/dist/exports/root-swap-dex-and-xlayer.js +4 -4
  439. package/dist/index.d.ts +1 -1
  440. package/dist/index.js +1 -1
  441. package/dist/utils/swap-helpers.js +1 -1
  442. package/package.json +1 -85
@@ -0,0 +1,41 @@
1
+ /**
2
+ * PancakeSwap Buy-First 余额校验 helper(从 bundle-buy-first-helpers.ts 抽取)
3
+ */
4
+ import { ethers } from 'ethers';
5
+ import { FLAT_FEE } from './bundle-buy-first-constants.js';
6
+ export async function validateFinalBalances({ sameAddress, buyerFundsWei, buyerBalance, reserveGas, gasLimit, gasPrice, useNativeToken = true, quoteTokenDecimals = 18, provider, buyerAddress, }) {
7
+ const gasCost = gasLimit * gasPrice;
8
+ if (sameAddress) {
9
+ // 同一地址:需要足够的余额支付两笔交易
10
+ if (useNativeToken) {
11
+ const requiredCombined = buyerFundsWei + FLAT_FEE * 2n + gasCost * 2n;
12
+ if (buyerBalance < requiredCombined) {
13
+ throw new Error(`账户余额不足:\n - 需要: ${ethers.formatEther(requiredCombined)} BNB(含两笔Gas与两笔手续费)\n - 实际: ${ethers.formatEther(buyerBalance)} BNB`);
14
+ }
15
+ }
16
+ else {
17
+ // ERC20:检查代币余额 + BNB Gas 余额
18
+ const requiredToken = buyerFundsWei + FLAT_FEE * 2n;
19
+ if (buyerBalance < requiredToken) {
20
+ throw new Error(`账户代币余额不足:\n - 需要: ${ethers.formatUnits(requiredToken, quoteTokenDecimals)}\n - 实际: ${ethers.formatUnits(buyerBalance, quoteTokenDecimals)}`);
21
+ }
22
+ // 检查 BNB Gas
23
+ if (provider && buyerAddress) {
24
+ const bnbBalance = await provider.getBalance(buyerAddress);
25
+ const requiredGas = gasCost * 2n;
26
+ if (bnbBalance < requiredGas) {
27
+ throw new Error(`账户 BNB 余额不足 (用于支付 Gas):\n - 需要: ${ethers.formatEther(requiredGas)} BNB\n - 实际: ${ethers.formatEther(bnbBalance)} BNB`);
28
+ }
29
+ }
30
+ }
31
+ return;
32
+ }
33
+ // 不同地址
34
+ if (useNativeToken) {
35
+ const requiredBuyer = buyerFundsWei + FLAT_FEE + reserveGas;
36
+ if (buyerBalance < requiredBuyer) {
37
+ throw new Error(`买方余额不足:\n - 需要: ${ethers.formatEther(requiredBuyer)} BNB\n - 实际: ${ethers.formatEther(buyerBalance)} BNB`);
38
+ }
39
+ }
40
+ // ERC20 余额已在 calculateBuyerFunds 中检查过
41
+ }
@@ -1,2 +1,2 @@
1
- import { PancakeBundleBuyFirstSignParams, PancakeBuyFirstResult } from './bundle-buy-first-helpers.js';
1
+ import { type PancakeBundleBuyFirstSignParams, type PancakeBuyFirstResult } from './bundle-buy-first-helpers.js';
2
2
  export declare function pancakeBundleBuyFirstMerkle(params: PancakeBundleBuyFirstSignParams): Promise<PancakeBuyFirstResult>;
@@ -1,13 +1,12 @@
1
1
  /**
2
- * bundle-buy-first - 主函数
2
+ * bundle-buy-first - 主函数(内部 helper 已抽取到 bundle-buy-first-helpers.ts)
3
3
  */
4
- import { ethers, Contract, Wallet } from 'ethers';
5
- import { createSignProvider } from '../../../bundle/sign-context-helpers.js';
6
- import { NonceManager, getDeadline, buildProfitHopTransactions, PROFIT_HOP_COUNT, } from '../../../utils/bundle-helpers.js';
7
- import { BLOCKRAZOR_BUILDER_EOA, ZERO_ADDRESS, CHAINS } from '../../../core/constants/index.js';
8
- import { GAS_LIMITS, getProfitRecipient } from '../../../core/constants/index.js';
9
- import { quoteV2, quoteV3, getTokenToNativeQuote } from '../../../domains/quote/quote-helpers.js';
10
- import { ERC20_BALANCE_OF_ABI, FLAT_FEE, PANCAKE_V2_ROUTER_ABI, PANCAKE_V2_ROUTER_ADDRESS, PANCAKE_V3_ROUTER_ABI, PANCAKE_V3_ROUTER_ADDRESS, getGasLimit, getGasPrice, getProfitRatePerTxBps, splitAmount, validateSwapCounts, } from './bundle-buy-first-helpers.js';
4
+ import { ethers, Wallet } from 'ethers';
5
+ import { getGasLimit } from '../../../core/gas/bundle-gas.js';
6
+ import { NonceManager } from '../../../utils/bundle-helpers.js';
7
+ import { BLOCKRAZOR_BUILDER_EOA, ZERO_ADDRESS, GAS_LIMITS } from '../../../core/constants/index.js';
8
+ import { getTokenToNativeQuote } from '../../../core/quote/quote-helpers.js';
9
+ import { buildMultiRouteTransactions, buildProfitTransaction, calculateBuyerFunds, createPancakeContext, getGasPrice, getProfitRatePerTxBps, pancakeBundleBuyFirstMultiWallet, planMultiNonces, quoteTokenOutput, splitAmount, validateFinalBalances, validateSwapCounts, } from './bundle-buy-first-helpers.js';
11
10
  export async function pancakeBundleBuyFirstMerkle(params) {
12
11
  const { buyerPrivateKey, buyerPrivateKeys, sellerPrivateKey, sellerPrivateKeys, routeParams, buyerFunds, buyerFundsPercentage, config, quoteToken, quoteTokenDecimals = 18, buyCount: _buyCount, sellCount: _sellCount, taxRateBps = 0, // ✅ 税率(基点),用于计算实际可卖出代币数量
13
12
  } = params;
@@ -80,7 +79,7 @@ export async function pancakeBundleBuyFirstMerkle(params) {
80
79
  useNativeToken,
81
80
  v2RouterAddress: config.v2RouterAddress,
82
81
  });
83
- const finalGasLimit = getGasLimit(config);
82
+ const finalGasLimit = getGasLimit(config, 800000);
84
83
  const gasPrice = await getGasPrice(context.provider, config);
85
84
  const txType = config.txType ?? 0;
86
85
  const nonceManager = new NonceManager(context.provider);
@@ -196,572 +195,3 @@ export async function pancakeBundleBuyFirstMerkle(params) {
196
195
  },
197
196
  };
198
197
  }
199
- function createPancakeContext(config) {
200
- const chainId = config.chainId ?? CHAINS.BSC.chainId;
201
- const provider = createSignProvider(config.rpcUrl, chainId, 'BSC');
202
- return { chainId, provider };
203
- }
204
- async function calculateBuyerFunds({ buyer, buyerFunds, buyerFundsPercentage, reserveGas, useNativeToken = true, quoteToken, quoteTokenDecimals = 18, provider, }) {
205
- const reserveGasWei = ethers.parseEther((reserveGas ?? 0.0005).toString());
206
- // ✅ 根据是否使用原生代币获取不同的余额
207
- let buyerBalance;
208
- if (useNativeToken) {
209
- buyerBalance = await buyer.provider.getBalance(buyer.address);
210
- }
211
- else {
212
- // ERC20 代币余额
213
- const erc20 = new Contract(quoteToken, ERC20_BALANCE_OF_ABI, provider || buyer.provider);
214
- buyerBalance = await erc20.balanceOf(buyer.address);
215
- }
216
- let buyerFundsWei;
217
- if (buyerFunds !== undefined) {
218
- // ✅ 根据代币精度解析金额
219
- buyerFundsWei = useNativeToken
220
- ? ethers.parseEther(String(buyerFunds))
221
- : ethers.parseUnits(String(buyerFunds), quoteTokenDecimals);
222
- }
223
- else if (buyerFundsPercentage !== undefined) {
224
- const pct = Math.max(0, Math.min(100, buyerFundsPercentage));
225
- // ✅ 原生代币需要预留 Gas,ERC20 不需要
226
- const spendable = useNativeToken
227
- ? buyerBalance > reserveGasWei
228
- ? buyerBalance - reserveGasWei
229
- : 0n
230
- : buyerBalance;
231
- buyerFundsWei = (spendable * BigInt(Math.floor(pct * 100))) / 10000n;
232
- }
233
- else {
234
- throw new Error('必须提供 buyerFunds 或 buyerFundsPercentage');
235
- }
236
- if (buyerFundsWei <= 0n) {
237
- throw new Error('buyerFunds 需要大于 0');
238
- }
239
- // ✅ 余额检查
240
- if (useNativeToken) {
241
- if (buyerBalance < buyerFundsWei + reserveGasWei) {
242
- throw new Error(`买方余额不足: 需要 ${ethers.formatEther(buyerFundsWei + reserveGasWei)} BNB,实际 ${ethers.formatEther(buyerBalance)} BNB`);
243
- }
244
- }
245
- else {
246
- // ERC20 购买:检查代币余额
247
- if (buyerBalance < buyerFundsWei) {
248
- throw new Error(`买方代币余额不足: 需要 ${ethers.formatUnits(buyerFundsWei, quoteTokenDecimals)},实际 ${ethers.formatUnits(buyerBalance, quoteTokenDecimals)}`);
249
- }
250
- // ✅ ERC20 购买时,还需要检查买方是否有足够 BNB 支付 Gas
251
- const buyerBnbBalance = await buyer.provider.getBalance(buyer.address);
252
- if (buyerBnbBalance < reserveGasWei) {
253
- throw new Error(`买方 BNB 余额不足 (用于支付 Gas): 需要 ${ethers.formatEther(reserveGasWei)} BNB,实际 ${ethers.formatEther(buyerBnbBalance)} BNB`);
254
- }
255
- }
256
- return { buyerFundsWei, buyerBalance, reserveGas: reserveGasWei };
257
- }
258
- /**
259
- * ✅ 使用 quote-helpers 统一报价
260
- */
261
- async function quoteTokenOutput({ routeParams, buyerFundsWei, provider, v2RouterOverride, }) {
262
- // V2 路由
263
- if (routeParams.routeType === 'v2') {
264
- const { v2Path } = routeParams;
265
- const tokenIn = v2Path[0];
266
- const tokenOut = v2Path[v2Path.length - 1];
267
- const result = await quoteV2(provider, tokenIn, tokenOut, buyerFundsWei, 'BSC', v2RouterOverride);
268
- if (result.amountOut <= 0n) {
269
- throw new Error('V2 报价失败');
270
- }
271
- return { quotedTokenOut: result.amountOut };
272
- }
273
- // V3 Single 路由
274
- if (routeParams.routeType === 'v3-single') {
275
- const paramsV3 = routeParams;
276
- const result = await quoteV3(provider, paramsV3.v3TokenIn, paramsV3.v3TokenOut, buyerFundsWei, 'BSC', paramsV3.v3Fee);
277
- if (result.amountOut <= 0n) {
278
- throw new Error('V3 报价失败');
279
- }
280
- return { quotedTokenOut: result.amountOut };
281
- }
282
- // V3 Multi 路由
283
- const paramsV3m = routeParams;
284
- if (!paramsV3m.v2Path || paramsV3m.v2Path.length < 2) {
285
- throw new Error('V3 多跳需要提供 v2Path 用于路径推断');
286
- }
287
- const tokenIn = paramsV3m.v2Path[0];
288
- const tokenOut = paramsV3m.v2Path[paramsV3m.v2Path.length - 1];
289
- const result = await quoteV3(provider, tokenIn, tokenOut, buyerFundsWei, 'BSC');
290
- if (result.amountOut <= 0n) {
291
- throw new Error('V3 多跳报价失败');
292
- }
293
- return { quotedTokenOut: result.amountOut };
294
- }
295
- /**
296
- * ✅ 构建多笔买入和卖出交易
297
- */
298
- async function buildMultiRouteTransactions({ routeParams, buyAmountsWei, sellAmountsWei, buyer, seller, useNativeToken = true, v2RouterAddress, }) {
299
- const deadline = getDeadline();
300
- if (routeParams.routeType === 'v2') {
301
- const { v2Path } = routeParams;
302
- const reversePath = [...v2Path].reverse();
303
- const v2Addr = v2RouterAddress || PANCAKE_V2_ROUTER_ADDRESS;
304
- const v2RouterBuyer = new Contract(v2Addr, PANCAKE_V2_ROUTER_ABI, buyer);
305
- const v2RouterSeller = new Contract(v2Addr, PANCAKE_V2_ROUTER_ABI, seller);
306
- // ✅ 根据是否使用原生代币选择不同的函数
307
- if (useNativeToken) {
308
- // BNB 池子:使用 swapExactETHForTokens / swapExactTokensForETH
309
- const buyUnsignedArray = await Promise.all(buyAmountsWei.map((amount) => {
310
- const buyValue = amount + FLAT_FEE;
311
- return v2RouterBuyer.swapExactETHForTokensSupportingFeeOnTransferTokens.populateTransaction(0n, v2Path, buyer.address, deadline, { value: buyValue });
312
- }));
313
- const sellUnsignedArray = await Promise.all(sellAmountsWei.map((amount) => v2RouterSeller.swapExactTokensForETHSupportingFeeOnTransferTokens.populateTransaction(amount, 0n, reversePath, seller.address, deadline)));
314
- return { buyUnsignedArray, sellUnsignedArray };
315
- }
316
- else {
317
- // ✅ ERC20 池子(如 USDT):使用 swapExactTokensForTokens
318
- const buyUnsignedArray = await Promise.all(buyAmountsWei.map((amount) => v2RouterBuyer.swapExactTokensForTokensSupportingFeeOnTransferTokens.populateTransaction(amount, 0n, v2Path, buyer.address, deadline)));
319
- const sellUnsignedArray = await Promise.all(sellAmountsWei.map((amount) => v2RouterSeller.swapExactTokensForTokensSupportingFeeOnTransferTokens.populateTransaction(amount, 0n, reversePath, seller.address, deadline)));
320
- return { buyUnsignedArray, sellUnsignedArray };
321
- }
322
- }
323
- if (routeParams.routeType === 'v3-single') {
324
- const { v3TokenIn, v3TokenOut, v3Fee } = routeParams;
325
- const v3RouterIface = new ethers.Interface(PANCAKE_V3_ROUTER_ABI);
326
- const v3RouterBuyer = new Contract(PANCAKE_V3_ROUTER_ADDRESS, PANCAKE_V3_ROUTER_ABI, buyer);
327
- const v3RouterSeller = new Contract(PANCAKE_V3_ROUTER_ADDRESS, PANCAKE_V3_ROUTER_ABI, seller);
328
- // 构建多笔买入交易(ERC20 模式 value = 0,因为通过代币授权支付)
329
- const buyUnsignedArray = await Promise.all(buyAmountsWei.map((amount) => {
330
- const buyValue = useNativeToken ? amount + FLAT_FEE : 0n;
331
- const buySwapData = v3RouterIface.encodeFunctionData('exactInputSingle', [
332
- {
333
- tokenIn: v3TokenIn,
334
- tokenOut: v3TokenOut,
335
- fee: v3Fee,
336
- recipient: buyer.address,
337
- amountIn: amount,
338
- amountOutMinimum: 0n,
339
- sqrtPriceLimitX96: 0n,
340
- },
341
- ]);
342
- return v3RouterBuyer.multicall.populateTransaction(deadline, [buySwapData], { value: buyValue });
343
- }));
344
- // ✅ 根据是否使用原生代币构建不同的卖出交易
345
- if (useNativeToken) {
346
- // BNB 池子:卖出后 unwrap WBNB 为 BNB
347
- const sellUnsignedArray = await Promise.all(sellAmountsWei.map((amount) => {
348
- const sellSwapData = v3RouterIface.encodeFunctionData('exactInputSingle', [
349
- {
350
- tokenIn: v3TokenOut,
351
- tokenOut: v3TokenIn,
352
- fee: v3Fee,
353
- recipient: PANCAKE_V3_ROUTER_ADDRESS,
354
- amountIn: amount,
355
- amountOutMinimum: 0n,
356
- sqrtPriceLimitX96: 0n,
357
- },
358
- ]);
359
- const sellUnwrapData = v3RouterIface.encodeFunctionData('unwrapWETH9', [0n, seller.address]);
360
- return v3RouterSeller.multicall.populateTransaction(deadline, [sellSwapData, sellUnwrapData]);
361
- }));
362
- return { buyUnsignedArray, sellUnsignedArray };
363
- }
364
- else {
365
- // ✅ ERC20 池子:卖出后直接获得 ERC20
366
- const sellUnsignedArray = await Promise.all(sellAmountsWei.map((amount) => {
367
- const sellSwapData = v3RouterIface.encodeFunctionData('exactInputSingle', [
368
- {
369
- tokenIn: v3TokenOut,
370
- tokenOut: v3TokenIn,
371
- fee: v3Fee,
372
- recipient: seller.address, // 直接发送到卖方地址
373
- amountIn: amount,
374
- amountOutMinimum: 0n,
375
- sqrtPriceLimitX96: 0n,
376
- },
377
- ]);
378
- return v3RouterSeller.multicall.populateTransaction(deadline, [sellSwapData]);
379
- }));
380
- return { buyUnsignedArray, sellUnsignedArray };
381
- }
382
- }
383
- throw new Error('V3 多跳路由暂不支持官方合约,请使用 V2 路由或 V3 单跳');
384
- }
385
- /**
386
- * ✅ 规划多笔交易 nonce(与 Flap 一致)
387
- * 交易顺序:贿赂 → 买入(多笔) → 卖出(多笔) → 利润
388
- */
389
- async function planMultiNonces({ buyer, seller, buyCount, sellCount, sameAddress, extractProfit, needBribeTx, nonceManager, }) {
390
- const profitNonceCount = extractProfit ? 1 : 0;
391
- if (sameAddress) {
392
- // 同一地址:贿赂(可选) + 买入(多笔) + 卖出(多笔) + 利润(可选)
393
- const bribeTxCount = needBribeTx ? 1 : 0;
394
- const totalTxCount = bribeTxCount + buyCount + sellCount + profitNonceCount;
395
- const nonces = await nonceManager.getNextNonceBatch(buyer, totalTxCount);
396
- let idx = 0;
397
- const bribeNonce = needBribeTx ? nonces[idx++] : undefined;
398
- const buyerNonces = nonces.slice(idx, idx + buyCount);
399
- idx += buyCount;
400
- const sellerNonces = nonces.slice(idx, idx + sellCount);
401
- const profitNonce = extractProfit ? nonces[idx + sellCount] : undefined;
402
- return { buyerNonces, sellerNonces, bribeNonce, profitNonce };
403
- }
404
- // 不同地址
405
- // 买方:buyCount 个 nonce
406
- // 卖方:贿赂(可选) + sellCount + 利润(可选) 个 nonce
407
- const bribeTxCount = needBribeTx ? 1 : 0;
408
- const sellerTxCount = bribeTxCount + sellCount + profitNonceCount;
409
- const [buyerNonces, sellerNoncesAll] = await Promise.all([
410
- nonceManager.getNextNonceBatch(buyer, buyCount),
411
- nonceManager.getNextNonceBatch(seller, sellerTxCount),
412
- ]);
413
- let idx = 0;
414
- const bribeNonce = needBribeTx ? sellerNoncesAll[idx++] : undefined;
415
- const sellerNonces = sellerNoncesAll.slice(idx, idx + sellCount);
416
- const profitNonce = extractProfit ? sellerNoncesAll[idx + sellCount] : undefined;
417
- return { buyerNonces, sellerNonces, bribeNonce, profitNonce };
418
- }
419
- /**
420
- * 构建利润多跳转账交易(强制 2 跳中转)
421
- */
422
- async function buildProfitTransaction({ provider, seller, profitAmount, profitNonce, gasPrice, chainId, txType, }) {
423
- if (profitNonce === undefined || profitAmount === 0n) {
424
- return null;
425
- }
426
- const profitHopResult = await buildProfitHopTransactions({
427
- provider,
428
- payerWallet: seller,
429
- profitAmount,
430
- profitRecipient: getProfitRecipient(),
431
- hopCount: PROFIT_HOP_COUNT,
432
- gasPrice,
433
- chainId,
434
- txType,
435
- startNonce: profitNonce,
436
- });
437
- return { signedTransactions: profitHopResult.signedTransactions, hopWallets: profitHopResult.hopWallets };
438
- }
439
- async function validateFinalBalances({ sameAddress, buyerFundsWei, buyerBalance, reserveGas, gasLimit, gasPrice, useNativeToken = true, quoteTokenDecimals = 18, provider, buyerAddress, }) {
440
- const gasCost = gasLimit * gasPrice;
441
- if (sameAddress) {
442
- // 同一地址:需要足够的余额支付两笔交易
443
- if (useNativeToken) {
444
- const requiredCombined = buyerFundsWei + FLAT_FEE * 2n + gasCost * 2n;
445
- if (buyerBalance < requiredCombined) {
446
- throw new Error(`账户余额不足:\n - 需要: ${ethers.formatEther(requiredCombined)} BNB(含两笔Gas与两笔手续费)\n - 实际: ${ethers.formatEther(buyerBalance)} BNB`);
447
- }
448
- }
449
- else {
450
- // ERC20:检查代币余额 + BNB Gas 余额
451
- const requiredToken = buyerFundsWei + FLAT_FEE * 2n;
452
- if (buyerBalance < requiredToken) {
453
- throw new Error(`账户代币余额不足:\n - 需要: ${ethers.formatUnits(requiredToken, quoteTokenDecimals)}\n - 实际: ${ethers.formatUnits(buyerBalance, quoteTokenDecimals)}`);
454
- }
455
- // 检查 BNB Gas
456
- if (provider && buyerAddress) {
457
- const bnbBalance = await provider.getBalance(buyerAddress);
458
- const requiredGas = gasCost * 2n;
459
- if (bnbBalance < requiredGas) {
460
- throw new Error(`账户 BNB 余额不足 (用于支付 Gas):\n - 需要: ${ethers.formatEther(requiredGas)} BNB\n - 实际: ${ethers.formatEther(bnbBalance)} BNB`);
461
- }
462
- }
463
- }
464
- return;
465
- }
466
- // 不同地址
467
- if (useNativeToken) {
468
- const requiredBuyer = buyerFundsWei + FLAT_FEE + reserveGas;
469
- if (buyerBalance < requiredBuyer) {
470
- throw new Error(`买方余额不足:\n - 需要: ${ethers.formatEther(requiredBuyer)} BNB\n - 实际: ${ethers.formatEther(buyerBalance)} BNB`);
471
- }
472
- }
473
- // ERC20 余额已在 calculateBuyerFunds 中检查过
474
- }
475
- /**
476
- * ✅ 多钱包捆绑换手
477
- * - 多个买方钱包执行买入(每个钱包1笔)
478
- * - 多个卖方钱包执行卖出(每个钱包1笔)
479
- * - 买入总价值 = 卖出总价值
480
- * - ✅ 优化:最大化并行操作
481
- */
482
- async function pancakeBundleBuyFirstMultiWallet(params) {
483
- const { buyerPrivateKeys, sellerPrivateKeys, routeParams, buyerFunds, config, quoteToken, quoteTokenDecimals = 18, taxRateBps = 0, // ✅ 税率(基点)
484
- } = params;
485
- const buyCount = buyerPrivateKeys.length;
486
- const sellCount = sellerPrivateKeys.length;
487
- if (buyCount === 0)
488
- throw new Error('买方钱包数量不能为0');
489
- if (sellCount === 0)
490
- throw new Error('卖方钱包数量不能为0');
491
- // 验证总交易数不超过限制
492
- validateSwapCounts(buyCount, sellCount);
493
- // ✅ 计算利润比例(根据 userType 动态调整)
494
- const totalTxCount = buyCount + sellCount;
495
- const profitRateBps = getProfitRatePerTxBps(config.userType) * totalTxCount;
496
- // ✅ 判断是否使用原生代币
497
- const useNativeToken = !quoteToken || quoteToken === ZERO_ADDRESS;
498
- const context = createPancakeContext(config);
499
- const nonceManager = new NonceManager(context.provider);
500
- // 创建所有钱包实例
501
- const buyers = buyerPrivateKeys.map((pk) => new Wallet(pk, context.provider));
502
- const sellers = sellerPrivateKeys.map((pk) => new Wallet(pk, context.provider));
503
- // 使用第一个卖方作为主卖方(支付贿赂和利润)
504
- const mainSeller = sellers[0];
505
- // ✅ 计算总交易金额
506
- let totalFundsWei;
507
- if (buyerFunds) {
508
- totalFundsWei = useNativeToken
509
- ? ethers.parseEther(String(buyerFunds))
510
- : ethers.parseUnits(String(buyerFunds), quoteTokenDecimals);
511
- }
512
- else {
513
- throw new Error('多钱包模式必须提供 buyerFunds(总交易金额)');
514
- }
515
- if (totalFundsWei <= 0n) {
516
- throw new Error('交易金额必须大于0');
517
- }
518
- const finalGasLimit = getGasLimit(config);
519
- const txType = config.txType ?? 0;
520
- const deadline = BigInt(getDeadline());
521
- const bribeAmount = config.bribeAmount && config.bribeAmount > 0 ? ethers.parseEther(String(config.bribeAmount)) : 0n;
522
- const needBribeTx = bribeAmount > 0n;
523
- // ✅ 第一批并行:报价 + Gas价格 + 所有钱包 nonces
524
- // 预先计算所有唯一钱包地址(去重)
525
- const allWallets = [...sellers, ...buyers];
526
- const uniqueWallets = allWallets.filter((w, i) => {
527
- const addr = w.address.toLowerCase();
528
- const firstIdx = allWallets.findIndex((x) => x.address.toLowerCase() === addr);
529
- return firstIdx === i;
530
- });
531
- const [quoteResult, gasPrice, noncesArray] = await Promise.all([
532
- quoteTokenOutput({
533
- routeParams,
534
- buyerFundsWei: totalFundsWei,
535
- provider: context.provider,
536
- v2RouterOverride: config.v2RouterAddress,
537
- }),
538
- getGasPrice(context.provider, config),
539
- nonceManager.getNextNoncesForWallets(uniqueWallets),
540
- ]);
541
- // 构建 nonces Map
542
- const noncesMap = new Map();
543
- uniqueWallets.forEach((wallet, i) => {
544
- noncesMap.set(wallet.address.toLowerCase(), noncesArray[i]);
545
- });
546
- // ✅ 将总金额平均分配给买方
547
- const buyAmountsWei = splitAmount(totalFundsWei, buyCount);
548
- // ✅ 税币支持:买入时会被扣税,实际获得的代币 = 报价 * (1 - 税率)
549
- let actualTokenOut = quoteResult.quotedTokenOut;
550
- if (taxRateBps > 0) {
551
- actualTokenOut = (quoteResult.quotedTokenOut * BigInt(10000 - taxRateBps)) / 10000n;
552
- }
553
- // ✅ 将代币平均分配给卖方
554
- const sellAmountsWei = splitAmount(actualTokenOut, sellCount);
555
- // ✅ 直接使用总交易金额作为利润基础(多钱包模式)
556
- // profitRateBps = 每笔交易利润率(bps) * 交易笔数
557
- const tokenProfitAmount = (totalFundsWei * BigInt(profitRateBps)) / 10000n;
558
- // ✅ ERC20 购买:将代币利润转换为等值 BNB(因为利润是用 BNB 转账的)
559
- let profitAmount = tokenProfitAmount;
560
- if (!useNativeToken && tokenProfitAmount > 0n && quoteToken) {
561
- const version = routeParams.routeType === 'v2' ? 'v2' : 'v3';
562
- const fee = routeParams.routeType === 'v3-single' ? routeParams.v3Fee : undefined;
563
- profitAmount = await getTokenToNativeQuote(context.provider, quoteToken, tokenProfitAmount, 'BSC', version, fee);
564
- // ERC20→BNB 转换完成
565
- }
566
- // ✅ 第三批并行:构建并签名所有交易
567
- const allTransactions = [];
568
- // 1. 贿赂交易(由主卖方支付)- 先处理以确定 nonce 偏移
569
- let bribeTxPromise = null;
570
- if (needBribeTx) {
571
- const mainSellerAddr = mainSeller.address.toLowerCase();
572
- const bribeNonce = noncesMap.get(mainSellerAddr);
573
- noncesMap.set(mainSellerAddr, bribeNonce + 1);
574
- bribeTxPromise = mainSeller.signTransaction({
575
- to: BLOCKRAZOR_BUILDER_EOA,
576
- value: bribeAmount,
577
- nonce: bribeNonce,
578
- gasPrice,
579
- gasLimit: GAS_LIMITS.BRIBE,
580
- chainId: context.chainId,
581
- type: txType,
582
- });
583
- }
584
- // 2. 预分配所有 nonces(同步操作,避免竞态)
585
- const buyerNonces = [];
586
- const sellerNonces = [];
587
- buyers.forEach((buyer) => {
588
- const addr = buyer.address.toLowerCase();
589
- const nonce = noncesMap.get(addr);
590
- buyerNonces.push(nonce);
591
- noncesMap.set(addr, nonce + 1);
592
- });
593
- sellers.forEach((seller) => {
594
- const addr = seller.address.toLowerCase();
595
- const nonce = noncesMap.get(addr);
596
- sellerNonces.push(nonce);
597
- noncesMap.set(addr, nonce + 1);
598
- });
599
- // 3. 并行构建所有买入交易
600
- const buyTxPromises = buyers.map(async (buyer, i) => {
601
- const unsigned = await buildSingleBuyTx({
602
- routeParams,
603
- buyAmount: buyAmountsWei[i],
604
- buyer,
605
- useNativeToken,
606
- deadline,
607
- v2RouterAddress: config.v2RouterAddress,
608
- });
609
- return buyer.signTransaction({
610
- ...unsigned,
611
- from: buyer.address,
612
- nonce: buyerNonces[i],
613
- gasLimit: finalGasLimit,
614
- gasPrice,
615
- chainId: context.chainId,
616
- type: txType,
617
- });
618
- });
619
- // 4. 并行构建所有卖出交易
620
- const sellTxPromises = sellers.map(async (seller, i) => {
621
- const unsigned = await buildSingleSellTx({
622
- routeParams,
623
- sellAmount: sellAmountsWei[i],
624
- seller,
625
- useNativeToken,
626
- deadline,
627
- v2RouterAddress: config.v2RouterAddress,
628
- });
629
- return seller.signTransaction({
630
- ...unsigned,
631
- from: seller.address,
632
- nonce: sellerNonces[i],
633
- gasLimit: finalGasLimit,
634
- gasPrice,
635
- chainId: context.chainId,
636
- type: txType,
637
- });
638
- });
639
- // ✅ 并行签名所有交易(贿赂 + 买入 + 卖出)
640
- const [bribeTx, signedBuys, signedSells] = await Promise.all([
641
- bribeTxPromise,
642
- Promise.all(buyTxPromises),
643
- Promise.all(sellTxPromises),
644
- ]);
645
- // 组装交易顺序:贿赂 → 买入 → 卖出
646
- if (bribeTx)
647
- allTransactions.push(bribeTx);
648
- allTransactions.push(...signedBuys, ...signedSells);
649
- // 5. 利润多跳转账(由主卖方支付)
650
- let profitHopWallets;
651
- if (profitAmount > 0n) {
652
- const mainSellerAddr = mainSeller.address.toLowerCase();
653
- const profitNonce = noncesMap.get(mainSellerAddr);
654
- const profitResult = await buildProfitTransaction({
655
- provider: context.provider,
656
- seller: mainSeller,
657
- profitAmount,
658
- profitNonce,
659
- gasPrice,
660
- chainId: context.chainId,
661
- txType,
662
- });
663
- if (profitResult) {
664
- allTransactions.push(...profitResult.signedTransactions);
665
- profitHopWallets = profitResult.hopWallets;
666
- }
667
- }
668
- nonceManager.clearTemp();
669
- return {
670
- signedTransactions: allTransactions,
671
- profitHopWallets,
672
- metadata: {
673
- buyerAddress: buyers.map((b) => b.address).join(','),
674
- sellerAddress: sellers.map((s) => s.address).join(','),
675
- buyAmount: useNativeToken
676
- ? ethers.formatEther(totalFundsWei)
677
- : ethers.formatUnits(totalFundsWei, quoteTokenDecimals),
678
- sellAmount: quoteResult.quotedTokenOut.toString(),
679
- profitAmount: profitAmount > 0n ? ethers.formatEther(profitAmount) : undefined,
680
- buyCount,
681
- sellCount,
682
- buyAmounts: buyAmountsWei.map((amt) => useNativeToken ? ethers.formatEther(amt) : ethers.formatUnits(amt, quoteTokenDecimals)),
683
- sellAmounts: sellAmountsWei.map((amt) => amt.toString()),
684
- },
685
- };
686
- }
687
- // ✅ 构建单笔买入交易
688
- async function buildSingleBuyTx({ routeParams, buyAmount, buyer, useNativeToken, deadline, v2RouterAddress, }) {
689
- if (routeParams.routeType === 'v2') {
690
- const { v2Path } = routeParams;
691
- const v2Router = new Contract(v2RouterAddress || PANCAKE_V2_ROUTER_ADDRESS, PANCAKE_V2_ROUTER_ABI, buyer);
692
- if (useNativeToken) {
693
- return await v2Router.swapExactETHForTokensSupportingFeeOnTransferTokens.populateTransaction(0n, v2Path, buyer.address, deadline, { value: buyAmount });
694
- }
695
- else {
696
- return await v2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens.populateTransaction(buyAmount, 0n, v2Path, buyer.address, deadline);
697
- }
698
- }
699
- if (routeParams.routeType === 'v3-single') {
700
- const { v3TokenIn, v3TokenOut, v3Fee } = routeParams;
701
- const v3RouterIface = new ethers.Interface(PANCAKE_V3_ROUTER_ABI);
702
- const v3Router = new Contract(PANCAKE_V3_ROUTER_ADDRESS, PANCAKE_V3_ROUTER_ABI, buyer);
703
- const buyValue = useNativeToken ? buyAmount : 0n;
704
- const buySwapData = v3RouterIface.encodeFunctionData('exactInputSingle', [
705
- {
706
- tokenIn: v3TokenIn,
707
- tokenOut: v3TokenOut,
708
- fee: v3Fee,
709
- recipient: buyer.address,
710
- amountIn: buyAmount,
711
- amountOutMinimum: 0n,
712
- sqrtPriceLimitX96: 0n,
713
- },
714
- ]);
715
- return await v3Router.multicall.populateTransaction(deadline, [buySwapData], { value: buyValue });
716
- }
717
- throw new Error('V3 多跳路由暂不支持');
718
- }
719
- // ✅ 构建单笔卖出交易
720
- async function buildSingleSellTx({ routeParams, sellAmount, seller, useNativeToken, deadline, v2RouterAddress, }) {
721
- if (routeParams.routeType === 'v2') {
722
- const { v2Path } = routeParams;
723
- const reversePath = [...v2Path].reverse();
724
- const v2Router = new Contract(v2RouterAddress || PANCAKE_V2_ROUTER_ADDRESS, PANCAKE_V2_ROUTER_ABI, seller);
725
- if (useNativeToken) {
726
- return await v2Router.swapExactTokensForETHSupportingFeeOnTransferTokens.populateTransaction(sellAmount, 0n, reversePath, seller.address, deadline);
727
- }
728
- else {
729
- return await v2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens.populateTransaction(sellAmount, 0n, reversePath, seller.address, deadline);
730
- }
731
- }
732
- if (routeParams.routeType === 'v3-single') {
733
- const { v3TokenIn, v3TokenOut, v3Fee } = routeParams;
734
- const v3RouterIface = new ethers.Interface(PANCAKE_V3_ROUTER_ABI);
735
- const v3Router = new Contract(PANCAKE_V3_ROUTER_ADDRESS, PANCAKE_V3_ROUTER_ABI, seller);
736
- if (useNativeToken) {
737
- const sellSwapData = v3RouterIface.encodeFunctionData('exactInputSingle', [
738
- {
739
- tokenIn: v3TokenOut,
740
- tokenOut: v3TokenIn,
741
- fee: v3Fee,
742
- recipient: PANCAKE_V3_ROUTER_ADDRESS,
743
- amountIn: sellAmount,
744
- amountOutMinimum: 0n,
745
- sqrtPriceLimitX96: 0n,
746
- },
747
- ]);
748
- const sellUnwrapData = v3RouterIface.encodeFunctionData('unwrapWETH9', [0n, seller.address]);
749
- return await v3Router.multicall.populateTransaction(deadline, [sellSwapData, sellUnwrapData]);
750
- }
751
- else {
752
- const sellSwapData = v3RouterIface.encodeFunctionData('exactInputSingle', [
753
- {
754
- tokenIn: v3TokenOut,
755
- tokenOut: v3TokenIn,
756
- fee: v3Fee,
757
- recipient: seller.address,
758
- amountIn: sellAmount,
759
- amountOutMinimum: 0n,
760
- sqrtPriceLimitX96: 0n,
761
- },
762
- ]);
763
- return await v3Router.multicall.populateTransaction(deadline, [sellSwapData]);
764
- }
765
- }
766
- throw new Error('V3 多跳路由暂不支持');
767
- }