four-flap-meme-sdk 2.2.8 → 2.2.10

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 (474) hide show
  1. package/README.en.md +6 -41
  2. package/README.md +0 -31
  3. package/README.zh-CN.md +6 -41
  4. package/dist/chains/bsc/four/approve-tokenmanager.d.ts +26 -1
  5. package/dist/chains/bsc/four/approve-tokenmanager.js +113 -1
  6. package/dist/chains/bsc/four/config.d.ts +67 -5
  7. package/dist/chains/bsc/four/config.js +114 -2
  8. package/dist/chains/bsc/four/core.d.ts +4 -1
  9. package/dist/chains/bsc/four/core.js +592 -1
  10. package/dist/chains/bsc/four/index.d.ts +6 -6
  11. package/dist/chains/bsc/four/index.js +6 -6
  12. package/dist/chains/bsc/four/internal.d.ts +46 -2
  13. package/dist/chains/bsc/four/internal.js +239 -2
  14. package/dist/chains/bsc/four/pancake-proxy.d.ts +28 -1
  15. package/dist/chains/bsc/four/pancake-proxy.js +687 -1
  16. package/dist/chains/bsc/four/private.d.ts +27 -1
  17. package/dist/chains/bsc/four/private.js +477 -1
  18. package/dist/chains/bsc/four/submit.d.ts +315 -2
  19. package/dist/chains/bsc/four/submit.js +752 -2
  20. package/dist/chains/bsc/four/swap-buy-first.d.ts +55 -2
  21. package/dist/chains/bsc/four/swap-buy-first.js +507 -2
  22. package/dist/chains/bsc/four/swap-internal.d.ts +3 -1
  23. package/dist/chains/bsc/four/swap-internal.js +18 -1
  24. package/dist/chains/bsc/four/swap.d.ts +144 -2
  25. package/dist/chains/bsc/four/swap.js +766 -2
  26. package/dist/chains/bsc/four/types.d.ts +476 -1
  27. package/dist/chains/bsc/four/utils.d.ts +18 -5
  28. package/dist/chains/bsc/four/utils.js +1552 -5
  29. package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +91 -1
  30. package/dist/chains/bsc/pancake/bundle-buy-first.js +212 -97
  31. package/dist/chains/bsc/pancake/bundle-swap.d.ts +79 -1
  32. package/dist/chains/bsc/pancake/bundle-swap.js +726 -114
  33. package/dist/chains/bsc/pancake/index.d.ts +2 -4
  34. package/dist/chains/bsc/pancake/index.js +3 -1
  35. package/dist/chains/bsc/platforms/iro/factory.d.ts +2 -2
  36. package/dist/chains/bsc/platforms/iro/factory.js +1 -3
  37. package/dist/chains/bsc/platforms/iro/index.d.ts +5 -5
  38. package/dist/chains/bsc/platforms/iro/index.js +3 -3
  39. package/dist/chains/bsc/platforms/iro/pool.js +10 -31
  40. package/dist/chains/bsc/platforms/iro/token.js +1 -4
  41. package/dist/chains/eni/batch-router/bundle-approve.js +3 -4
  42. package/dist/chains/eni/batch-router/transfer.js +25 -55
  43. package/dist/chains/eni/batch-router/utils.js +6 -32
  44. package/dist/chains/eni/bundler/sign.js +6 -5
  45. package/dist/chains/eni/bundler/submit.js +4 -1
  46. package/dist/chains/eni/constants.js +1 -1
  47. package/dist/chains/eni/index.d.ts +1 -2
  48. package/dist/chains/eni/index.js +0 -1
  49. package/dist/chains/eni/platforms/daoaas/create.js +2 -2
  50. package/dist/chains/eni/platforms/daoaas/index.d.ts +3 -3
  51. package/dist/chains/eni/platforms/daoaas/index.js +3 -3
  52. package/dist/chains/eni/platforms/daoaas/meta.js +6 -9
  53. package/dist/chains/eni/platforms/daoaas/portal-direct.js +44 -28
  54. package/dist/chains/eni/platforms/daoaas/portal.js +6 -10
  55. package/dist/chains/eni/platforms/dswap/liquidity.js +26 -58
  56. package/dist/chains/eni/platforms/fair-launch/index.d.ts +2 -2
  57. package/dist/chains/eni/platforms/fair-launch/index.js +1 -1
  58. package/dist/chains/eni/platforms/fair-launch/launcher.js +46 -87
  59. package/dist/chains/eni/platforms/fair-launch/pool.js +1 -4
  60. package/dist/chains/eni/platforms/fair-launch/presets.js +2 -2
  61. package/dist/chains/eni/platforms/iro/factory.d.ts +2 -2
  62. package/dist/chains/eni/platforms/iro/factory.js +1 -3
  63. package/dist/chains/eni/platforms/iro/index.d.ts +6 -6
  64. package/dist/chains/eni/platforms/iro/index.js +4 -4
  65. package/dist/chains/eni/platforms/iro/pool.js +26 -90
  66. package/dist/chains/eni/platforms/iro/token.js +31 -107
  67. package/dist/chains/eni/platforms/iro/whitelist.js +18 -6
  68. package/dist/chains/index.d.ts +0 -13
  69. package/dist/chains/index.js +0 -13
  70. package/dist/chains/xlayer/eip7702/bundle-approve.d.ts +26 -2
  71. package/dist/chains/xlayer/eip7702/bundle-approve.js +21 -11
  72. package/dist/chains/xlayer/eip7702/bundle-buy.d.ts +6 -2
  73. package/dist/chains/xlayer/eip7702/bundle-buy.js +51 -13
  74. package/dist/chains/xlayer/eip7702/bundle-create.js +59 -93
  75. package/dist/chains/xlayer/eip7702/bundle-sell.d.ts +6 -2
  76. package/dist/chains/xlayer/eip7702/bundle-sell.js +111 -29
  77. package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +65 -3
  78. package/dist/chains/xlayer/eip7702/bundle-swap.js +245 -51
  79. package/dist/chains/xlayer/eip7702/constants.d.ts +16 -1
  80. package/dist/chains/xlayer/eip7702/constants.js +21 -3
  81. package/dist/chains/xlayer/eip7702/index.d.ts +46 -28
  82. package/dist/chains/xlayer/eip7702/index.js +81 -28
  83. package/dist/chains/xlayer/eip7702/multi-hop-transfer.d.ts +203 -2
  84. package/dist/chains/xlayer/eip7702/multi-hop-transfer.js +307 -63
  85. package/dist/chains/xlayer/eip7702/types.d.ts +0 -88
  86. package/dist/chains/xlayer/eip7702/utils.d.ts +3 -0
  87. package/dist/chains/xlayer/eip7702/utils.js +28 -23
  88. package/dist/chains/xlayer/eip7702/volume.d.ts +184 -6
  89. package/dist/chains/xlayer/eip7702/volume.js +164 -89
  90. package/dist/chains/xlayer/eoa/constants.js +1 -1
  91. package/dist/chains/xlayer/eoa/dex-helpers.js +5 -5
  92. package/dist/chains/xlayer/eoa/eoa-bundle-swap.d.ts +95 -1
  93. package/dist/chains/xlayer/eoa/eoa-bundle-swap.js +299 -66
  94. package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +1 -1
  95. package/dist/chains/xlayer/eoa/eoa-wash-volume.js +23 -18
  96. package/dist/chains/xlayer/eoa/index.d.ts +6 -10
  97. package/dist/chains/xlayer/eoa/index.js +23 -8
  98. package/dist/chains/xlayer/eoa/portal-ops.js +2 -7
  99. package/dist/chains/xlayer/eoa/router-manager.js +3 -3
  100. package/dist/chains/xlayer/eoa/types.d.ts +2 -2
  101. package/dist/chains/xlayer/eoa/types.js +3 -1
  102. package/dist/chains/xlayer/index.d.ts +2 -3
  103. package/dist/chains/xlayer/index.js +7 -4
  104. package/dist/contracts/helper3.d.ts +5 -20
  105. package/dist/contracts/helper3.js +20 -56
  106. package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.d.ts +26 -1
  107. package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.js +113 -1
  108. package/dist/contracts/tm-bundle-merkle/config.d.ts +67 -5
  109. package/dist/contracts/tm-bundle-merkle/config.js +114 -2
  110. package/dist/contracts/tm-bundle-merkle/core.d.ts +4 -1
  111. package/dist/contracts/tm-bundle-merkle/core.js +591 -1
  112. package/dist/contracts/tm-bundle-merkle/index.d.ts +5 -5
  113. package/dist/contracts/tm-bundle-merkle/index.js +5 -5
  114. package/dist/contracts/tm-bundle-merkle/internal.d.ts +46 -2
  115. package/dist/contracts/tm-bundle-merkle/internal.js +238 -2
  116. package/dist/contracts/tm-bundle-merkle/pancake-proxy.d.ts +28 -1
  117. package/dist/contracts/tm-bundle-merkle/pancake-proxy.js +686 -1
  118. package/dist/contracts/tm-bundle-merkle/private.d.ts +27 -1
  119. package/dist/contracts/tm-bundle-merkle/private.js +476 -1
  120. package/dist/contracts/tm-bundle-merkle/submit.d.ts +314 -3
  121. package/dist/contracts/tm-bundle-merkle/submit.js +928 -3
  122. package/dist/contracts/tm-bundle-merkle/swap-buy-first.d.ts +55 -2
  123. package/dist/contracts/tm-bundle-merkle/swap-buy-first.js +506 -2
  124. package/dist/contracts/tm-bundle-merkle/swap-internal.d.ts +3 -1
  125. package/dist/contracts/tm-bundle-merkle/swap-internal.js +18 -1
  126. package/dist/contracts/tm-bundle-merkle/swap.d.ts +144 -2
  127. package/dist/contracts/tm-bundle-merkle/swap.js +764 -2
  128. package/dist/contracts/tm-bundle-merkle/types.d.ts +476 -1
  129. package/dist/contracts/tm-bundle-merkle/utils.d.ts +18 -6
  130. package/dist/contracts/tm-bundle-merkle/utils.js +1501 -6
  131. package/dist/contracts/tm-bundle.d.ts +51 -3
  132. package/dist/contracts/tm-bundle.js +177 -108
  133. package/dist/contracts/tm.d.ts +2 -3
  134. package/dist/contracts/tm.js +32 -37
  135. package/dist/contracts/tm1.js +4 -9
  136. package/dist/contracts/tm2.js +4 -9
  137. package/dist/dex/direct-router.d.ts +125 -3
  138. package/dist/dex/direct-router.js +666 -237
  139. package/dist/flows/create.d.ts +1 -2
  140. package/dist/flows/create.js +6 -6
  141. package/dist/index.d.ts +86 -20
  142. package/dist/index.js +216 -20
  143. package/dist/shared/abis/TaxToken.json +105 -0
  144. package/dist/shared/abis/TokenManager2.json +60 -0
  145. package/dist/shared/abis/common.d.ts +83 -2
  146. package/dist/shared/abis/common.js +253 -2
  147. package/dist/shared/abis/index.d.ts +6 -5
  148. package/dist/shared/abis/index.js +7 -5
  149. package/dist/shared/clients/blockrazor.js +25 -39
  150. package/dist/shared/clients/club48.d.ts +2 -2
  151. package/dist/shared/clients/club48.js +29 -34
  152. package/dist/shared/clients/emitservice.js +0 -2
  153. package/dist/shared/clients/four.d.ts +6 -21
  154. package/dist/shared/clients/four.js +24 -29
  155. package/dist/shared/clients/merkle.js +34 -27
  156. package/dist/shared/constants/addresses.d.ts +1 -1
  157. package/dist/shared/constants/addresses.js +2 -11
  158. package/dist/shared/constants/chains.d.ts +1 -1
  159. package/dist/shared/constants/chains.js +1 -1
  160. package/dist/shared/constants/gas.d.ts +1 -1
  161. package/dist/shared/constants/gas.js +6 -2
  162. package/dist/shared/constants/index.d.ts +0 -3
  163. package/dist/shared/constants/index.js +0 -1
  164. package/dist/shared/flap/abi.js +1 -1
  165. package/dist/shared/flap/constants.d.ts +2 -3
  166. package/dist/shared/flap/constants.js +4 -5
  167. package/dist/shared/flap/curve.js +0 -3
  168. package/dist/shared/flap/errors.d.ts +4 -1
  169. package/dist/shared/flap/errors.js +1 -20
  170. package/dist/shared/flap/index.d.ts +5 -5
  171. package/dist/shared/flap/index.js +5 -5
  172. package/dist/shared/flap/launch-v6.d.ts +117 -0
  173. package/dist/shared/flap/launch-v6.js +111 -0
  174. package/dist/shared/flap/meta.d.ts +18 -22
  175. package/dist/shared/flap/meta.js +17 -12
  176. package/dist/shared/flap/permit.js +2 -5
  177. package/dist/shared/flap/pinata.d.ts +6 -22
  178. package/dist/shared/flap/pinata.js +26 -21
  179. package/dist/shared/flap/portal-bundle-merkle/config.d.ts +72 -3
  180. package/dist/shared/flap/portal-bundle-merkle/config.js +124 -4
  181. package/dist/shared/flap/portal-bundle-merkle/core.d.ts +4 -0
  182. package/dist/shared/flap/portal-bundle-merkle/core.js +267 -161
  183. package/dist/shared/flap/portal-bundle-merkle/create-to-dex.d.ts +4 -17
  184. package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +195 -104
  185. package/dist/shared/flap/portal-bundle-merkle/curve-to-dex.js +92 -100
  186. package/dist/shared/flap/portal-bundle-merkle/index.d.ts +7 -11
  187. package/dist/shared/flap/portal-bundle-merkle/index.js +7 -4
  188. package/dist/shared/flap/portal-bundle-merkle/pancake-proxy.js +68 -71
  189. package/dist/shared/flap/portal-bundle-merkle/private.js +114 -61
  190. package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.d.ts +64 -1
  191. package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.js +247 -66
  192. package/dist/shared/flap/portal-bundle-merkle/swap.d.ts +71 -2
  193. package/dist/shared/flap/portal-bundle-merkle/swap.js +410 -103
  194. package/dist/shared/flap/portal-bundle-merkle/types.d.ts +12 -88
  195. package/dist/shared/flap/portal-bundle-merkle/utils.d.ts +80 -1
  196. package/dist/shared/flap/portal-bundle-merkle/utils.js +265 -145
  197. package/dist/shared/flap/portal-bundle.js +56 -55
  198. package/dist/shared/flap/portal.d.ts +3 -14
  199. package/dist/shared/flap/portal.js +26 -49
  200. package/dist/shared/flap/vanity.d.ts +5 -8
  201. package/dist/shared/flap/vanity.js +20 -21
  202. package/dist/shared/flap/vault.d.ts +93 -25
  203. package/dist/shared/flap/vault.js +126 -75
  204. package/dist/shared/four/tax-token.d.ts +1 -1
  205. package/dist/shared/four/tax-token.js +7 -27
  206. package/dist/shared/index.d.ts +0 -6
  207. package/dist/shared/index.js +0 -4
  208. package/dist/utils/airdrop-sweep.d.ts +76 -4
  209. package/dist/utils/airdrop-sweep.js +55 -42
  210. package/dist/utils/bundle-helpers.d.ts +243 -9
  211. package/dist/utils/bundle-helpers.js +584 -10
  212. package/dist/utils/constants.d.ts +61 -5
  213. package/dist/utils/constants.js +80 -5
  214. package/dist/utils/contract-factory.d.ts +4 -2
  215. package/dist/utils/contract-factory.js +18 -25
  216. package/dist/utils/erc20.d.ts +89 -7
  217. package/dist/utils/erc20.js +125 -94
  218. package/dist/utils/errors.d.ts +1 -12
  219. package/dist/utils/errors.js +1 -60
  220. package/dist/utils/holders-maker.d.ts +138 -2
  221. package/dist/utils/holders-maker.js +661 -26
  222. package/dist/utils/lp-inspect.d.ts +112 -2
  223. package/dist/utils/lp-inspect.js +223 -73
  224. package/dist/utils/mpcExclusive.d.ts +5 -2
  225. package/dist/utils/mpcExclusive.js +3 -4
  226. package/dist/utils/private-sale.d.ts +58 -2
  227. package/dist/utils/private-sale.js +15 -4
  228. package/dist/utils/provider-factory.d.ts +0 -4
  229. package/dist/utils/provider-factory.js +0 -10
  230. package/dist/utils/quote-helpers.d.ts +45 -4
  231. package/dist/utils/quote-helpers.js +74 -17
  232. package/dist/utils/stealth-transfer.d.ts +28 -2
  233. package/dist/utils/stealth-transfer.js +15 -31
  234. package/dist/utils/swap-helpers.d.ts +15 -2
  235. package/dist/utils/swap-helpers.js +11 -6
  236. package/dist/utils/wallet.d.ts +25 -2
  237. package/dist/utils/wallet.js +10 -13
  238. package/package.json +4 -160
  239. package/dist/__tests__/subpath-exports.test.d.ts +0 -1
  240. package/dist/__tests__/subpath-exports.test.js +0 -64
  241. package/dist/abis/common.d.ts +0 -85
  242. package/dist/abis/common.js +0 -264
  243. package/dist/abis/contracts/TaxToken.json +0 -969
  244. package/dist/abis/contracts/TokenManager2.json +0 -136
  245. package/dist/abis/contracts/index.d.ts +0 -5
  246. package/dist/abis/contracts/index.js +0 -5
  247. package/dist/abis/flap/index.d.ts +0 -3
  248. package/dist/abis/flap/index.js +0 -3
  249. package/dist/abis/flap/portal-events.d.ts +0 -6
  250. package/dist/abis/flap/portal-events.js +0 -17
  251. package/dist/abis/flap/portal.d.ts +0 -6
  252. package/dist/abis/flap/portal.js +0 -37
  253. package/dist/abis/flap/vault.d.ts +0 -171
  254. package/dist/abis/flap/vault.js +0 -91
  255. package/dist/abis/index.d.ts +0 -8
  256. package/dist/abis/index.js +0 -11
  257. package/dist/bundle-core/__tests__/config-helpers.test.d.ts +0 -1
  258. package/dist/bundle-core/__tests__/config-helpers.test.js +0 -28
  259. package/dist/bundle-core/__tests__/facade-parity.test.d.ts +0 -1
  260. package/dist/bundle-core/__tests__/facade-parity.test.js +0 -33
  261. package/dist/bundle-core/__tests__/sign-context-helpers.test.d.ts +0 -1
  262. package/dist/bundle-core/__tests__/sign-context-helpers.test.js +0 -60
  263. package/dist/bundle-core/__tests__/sign-fixture.test.d.ts +0 -1
  264. package/dist/bundle-core/__tests__/sign-fixture.test.js +0 -220
  265. package/dist/bundle-core/__tests__/sign-fixtures.d.ts +0 -10
  266. package/dist/bundle-core/__tests__/sign-fixtures.js +0 -16
  267. package/dist/bundle-core/config-helpers.d.ts +0 -36
  268. package/dist/bundle-core/config-helpers.js +0 -57
  269. package/dist/bundle-core/errors.d.ts +0 -50
  270. package/dist/bundle-core/errors.js +0 -35
  271. package/dist/bundle-core/four-meme/approve-tokenmanager.d.ts +0 -7
  272. package/dist/bundle-core/four-meme/approve-tokenmanager.js +0 -99
  273. package/dist/bundle-core/four-meme/core-helpers.d.ts +0 -8
  274. package/dist/bundle-core/four-meme/core-helpers.js +0 -40
  275. package/dist/bundle-core/four-meme/core.d.ts +0 -4
  276. package/dist/bundle-core/four-meme/core.js +0 -515
  277. package/dist/bundle-core/four-meme/pancake-proxy.d.ts +0 -28
  278. package/dist/bundle-core/four-meme/pancake-proxy.js +0 -679
  279. package/dist/bundle-core/four-meme/private.d.ts +0 -27
  280. package/dist/bundle-core/four-meme/private.js +0 -465
  281. package/dist/bundle-core/four-meme/sign-context-helpers.d.ts +0 -2
  282. package/dist/bundle-core/four-meme/sign-context-helpers.js +0 -2
  283. package/dist/bundle-core/four-meme/swap-buy-first.d.ts +0 -8
  284. package/dist/bundle-core/four-meme/swap-buy-first.js +0 -493
  285. package/dist/bundle-core/four-meme/swap-hop-helpers.d.ts +0 -6
  286. package/dist/bundle-core/four-meme/swap-hop-helpers.js +0 -63
  287. package/dist/bundle-core/four-meme/swap-internal.d.ts +0 -3
  288. package/dist/bundle-core/four-meme/swap-internal.js +0 -18
  289. package/dist/bundle-core/four-meme/swap-sign-helpers.d.ts +0 -27
  290. package/dist/bundle-core/four-meme/swap-sign-helpers.js +0 -105
  291. package/dist/bundle-core/four-meme/swap.d.ts +0 -17
  292. package/dist/bundle-core/four-meme/swap.js +0 -505
  293. package/dist/bundle-core/four-meme/types/buy-first.d.ts +0 -50
  294. package/dist/bundle-core/four-meme/types/buy-first.js +0 -1
  295. package/dist/bundle-core/four-meme/types/core-flow.d.ts +0 -63
  296. package/dist/bundle-core/four-meme/types/core-flow.js +0 -1
  297. package/dist/bundle-core/four-meme/types/index.d.ts +0 -600
  298. package/dist/bundle-core/four-meme/types/index.js +0 -1
  299. package/dist/bundle-core/four-meme/types/swap-internal.d.ts +0 -19
  300. package/dist/bundle-core/four-meme/types/swap-internal.js +0 -1
  301. package/dist/bundle-core/four-meme/types.d.ts +0 -1
  302. package/dist/bundle-core/four-meme/types.js +0 -1
  303. package/dist/bundle-core/four-meme/utils-disperse.d.ts +0 -7
  304. package/dist/bundle-core/four-meme/utils-disperse.js +0 -396
  305. package/dist/bundle-core/four-meme/utils-pairwise.d.ts +0 -8
  306. package/dist/bundle-core/four-meme/utils-pairwise.js +0 -328
  307. package/dist/bundle-core/four-meme/utils-sweep.d.ts +0 -8
  308. package/dist/bundle-core/four-meme/utils-sweep.js +0 -744
  309. package/dist/bundle-core/index.d.ts +0 -8
  310. package/dist/bundle-core/index.js +0 -8
  311. package/dist/bundle-core/internal.d.ts +0 -21
  312. package/dist/bundle-core/internal.js +0 -182
  313. package/dist/bundle-core/sign-context-helpers.d.ts +0 -25
  314. package/dist/bundle-core/sign-context-helpers.js +0 -67
  315. package/dist/bundle-core/submit.d.ts +0 -293
  316. package/dist/bundle-core/submit.js +0 -727
  317. package/dist/bundle-core/types/index.d.ts +0 -8
  318. package/dist/bundle-core/types/index.js +0 -1
  319. package/dist/bundle-core/types.d.ts +0 -1
  320. package/dist/bundle-core/types.js +0 -1
  321. package/dist/chains/bsc/four/utils-disperse.d.ts +0 -1
  322. package/dist/chains/bsc/four/utils-disperse.js +0 -1
  323. package/dist/chains/bsc/four/utils-pairwise.d.ts +0 -1
  324. package/dist/chains/bsc/four/utils-pairwise.js +0 -1
  325. package/dist/chains/bsc/four/utils-sweep.d.ts +0 -1
  326. package/dist/chains/bsc/four/utils-sweep.js +0 -1
  327. package/dist/chains/bsc/iro.d.ts +0 -5
  328. package/dist/chains/bsc/iro.js +0 -4
  329. package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +0 -159
  330. package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +0 -117
  331. package/dist/chains/bsc/pancake/bundle-swap-helpers.d.ts +0 -241
  332. package/dist/chains/bsc/pancake/bundle-swap-helpers.js +0 -565
  333. package/dist/chains/eni/flat-aliases.d.ts +0 -10
  334. package/dist/chains/eni/flat-aliases.js +0 -8
  335. package/dist/chains/eni/submit.d.ts +0 -43
  336. package/dist/chains/eni/submit.js +0 -286
  337. package/dist/chains/xlayer/eip7702/flat-aliases.d.ts +0 -13
  338. package/dist/chains/xlayer/eip7702/flat-aliases.js +0 -10
  339. package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.d.ts +0 -79
  340. package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.js +0 -1
  341. package/dist/chains/xlayer/eip7702/transfer-context-helpers.d.ts +0 -26
  342. package/dist/chains/xlayer/eip7702/transfer-context-helpers.js +0 -57
  343. package/dist/chains/xlayer/eip7702/volume-helpers.d.ts +0 -148
  344. package/dist/chains/xlayer/eip7702/volume-helpers.js +0 -48
  345. package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts +0 -126
  346. package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +0 -228
  347. package/dist/contracts/tm-bundle-helpers.d.ts +0 -88
  348. package/dist/contracts/tm-bundle-helpers.js +0 -72
  349. package/dist/contracts/tm-bundle-merkle/utils-disperse.d.ts +0 -1
  350. package/dist/contracts/tm-bundle-merkle/utils-disperse.js +0 -1
  351. package/dist/contracts/tm-bundle-merkle/utils-pairwise.d.ts +0 -1
  352. package/dist/contracts/tm-bundle-merkle/utils-pairwise.js +0 -1
  353. package/dist/contracts/tm-bundle-merkle/utils-sweep.d.ts +0 -1
  354. package/dist/contracts/tm-bundle-merkle/utils-sweep.js +0 -1
  355. package/dist/dex/direct-router-helpers.d.ts +0 -264
  356. package/dist/dex/direct-router-helpers.js +0 -539
  357. package/dist/dex/types.d.ts +0 -81
  358. package/dist/dex/types.js +0 -1
  359. package/dist/exports/root-bundle-and-tooling.d.ts +0 -27
  360. package/dist/exports/root-bundle-and-tooling.js +0 -30
  361. package/dist/exports/root-eni-and-bsc-iro.d.ts +0 -26
  362. package/dist/exports/root-eni-and-bsc-iro.js +0 -66
  363. package/dist/exports/root-foundations.d.ts +0 -35
  364. package/dist/exports/root-foundations.js +0 -70
  365. package/dist/exports/root-swap-dex-and-xlayer.d.ts +0 -30
  366. package/dist/exports/root-swap-dex-and-xlayer.js +0 -78
  367. package/dist/flap/index.d.ts +0 -10
  368. package/dist/flap/index.js +0 -8
  369. package/dist/flows/index.d.ts +0 -1
  370. package/dist/flows/index.js +0 -1
  371. package/dist/merkle/index.d.ts +0 -12
  372. package/dist/merkle/index.js +0 -11
  373. package/dist/shared/clients/index.d.ts +0 -8
  374. package/dist/shared/clients/index.js +0 -8
  375. package/dist/shared/constants/quote.d.ts +0 -30
  376. package/dist/shared/constants/quote.js +0 -37
  377. package/dist/shared/flap/portal-bundle-merkle/core-helpers.d.ts +0 -32
  378. package/dist/shared/flap/portal-bundle-merkle/core-helpers.js +0 -83
  379. package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +0 -125
  380. package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.js +0 -113
  381. package/dist/shared/flap/portal-bundle-merkle/swap-helpers.d.ts +0 -149
  382. package/dist/shared/flap/portal-bundle-merkle/swap-helpers.js +0 -259
  383. package/dist/shared/flap/portal-create-token.d.ts +0 -81
  384. package/dist/shared/flap/portal-create-token.js +0 -255
  385. package/dist/shared/foundation/dex/v3-path.d.ts +0 -6
  386. package/dist/shared/foundation/dex/v3-path.js +0 -35
  387. package/dist/shared/foundation/gas/bundle-gas.d.ts +0 -49
  388. package/dist/shared/foundation/gas/bundle-gas.js +0 -93
  389. package/dist/shared/foundation/gas/profit-hop.d.ts +0 -20
  390. package/dist/shared/foundation/gas/profit-hop.js +0 -72
  391. package/dist/shared/foundation/index.d.ts +0 -13
  392. package/dist/shared/foundation/index.js +0 -12
  393. package/dist/shared/foundation/nonce/nonce-manager.d.ts +0 -17
  394. package/dist/shared/foundation/nonce/nonce-manager.js +0 -183
  395. package/dist/shared/foundation/normalize-unknown.d.ts +0 -9
  396. package/dist/shared/foundation/normalize-unknown.js +0 -29
  397. package/dist/shared/foundation/sdk-logger.d.ts +0 -13
  398. package/dist/shared/foundation/sdk-logger.js +0 -12
  399. package/dist/shared/foundation/tx/build-request.d.ts +0 -17
  400. package/dist/shared/foundation/tx/build-request.js +0 -25
  401. package/dist/shared/foundation/tx/sign-batch.d.ts +0 -5
  402. package/dist/shared/foundation/tx/sign-batch.js +0 -26
  403. package/dist/shared/foundation/tx/wallet-sign-patch.d.ts +0 -1
  404. package/dist/shared/foundation/tx/wallet-sign-patch.js +0 -18
  405. package/dist/shared/foundation/types/airdrop-sweep.d.ts +0 -79
  406. package/dist/shared/foundation/types/airdrop-sweep.js +0 -1
  407. package/dist/shared/foundation/types/erc20.d.ts +0 -65
  408. package/dist/shared/foundation/types/erc20.js +0 -1
  409. package/dist/shared/foundation/types/holders-maker.d.ts +0 -64
  410. package/dist/shared/foundation/types/holders-maker.js +0 -1
  411. package/dist/shared/foundation/types/index.d.ts +0 -7
  412. package/dist/shared/foundation/types/index.js +0 -1
  413. package/dist/shared/foundation/types/lp-inspect.d.ts +0 -102
  414. package/dist/shared/foundation/types/lp-inspect.js +0 -1
  415. package/dist/shared/foundation/types/multicall.d.ts +0 -5
  416. package/dist/shared/foundation/types/multicall.js +0 -1
  417. package/dist/shared/foundation/types/private-sale.d.ts +0 -35
  418. package/dist/shared/foundation/types/private-sale.js +0 -1
  419. package/dist/shared/foundation/types/quote-helpers.d.ts +0 -17
  420. package/dist/shared/foundation/types/quote-helpers.js +0 -1
  421. package/dist/types/errors.d.ts +0 -27
  422. package/dist/types/errors.js +0 -34
  423. package/dist/utils/holders-maker/addresses.d.ts +0 -12
  424. package/dist/utils/holders-maker/addresses.js +0 -15
  425. package/dist/utils/holders-maker/buy-tx.d.ts +0 -44
  426. package/dist/utils/holders-maker/buy-tx.js +0 -278
  427. package/dist/utils/holders-maker/constants.d.ts +0 -6
  428. package/dist/utils/holders-maker/constants.js +0 -7
  429. package/dist/utils/holders-maker/disperse.d.ts +0 -18
  430. package/dist/utils/holders-maker/disperse.js +0 -90
  431. package/dist/utils/holders-maker/routing.d.ts +0 -4
  432. package/dist/utils/holders-maker/routing.js +0 -45
  433. package/dist/utils/holders-maker/transfer-tx.d.ts +0 -4
  434. package/dist/utils/holders-maker/transfer-tx.js +0 -67
  435. package/dist/utils/holders-maker-helpers.d.ts +0 -9
  436. package/dist/utils/holders-maker-helpers.js +0 -9
  437. package/dist/utils/hop-chains.d.ts +0 -35
  438. package/dist/utils/hop-chains.js +0 -215
  439. package/dist/utils/lp-inspect-helpers.d.ts +0 -9
  440. package/dist/utils/lp-inspect-helpers.js +0 -109
  441. package/dist/utils/types/airdrop-sweep.d.ts +0 -1
  442. package/dist/utils/types/airdrop-sweep.js +0 -1
  443. package/dist/utils/types/contract-factory.d.ts +0 -1
  444. package/dist/utils/types/contract-factory.js +0 -1
  445. package/dist/utils/types/erc20.d.ts +0 -1
  446. package/dist/utils/types/erc20.js +0 -1
  447. package/dist/utils/types/errors.d.ts +0 -1
  448. package/dist/utils/types/errors.js +0 -1
  449. package/dist/utils/types/holders-maker.d.ts +0 -1
  450. package/dist/utils/types/holders-maker.js +0 -1
  451. package/dist/utils/types/hop-chains.d.ts +0 -8
  452. package/dist/utils/types/hop-chains.js +0 -1
  453. package/dist/utils/types/index.d.ts +0 -13
  454. package/dist/utils/types/index.js +0 -1
  455. package/dist/utils/types/lp-inspect.d.ts +0 -1
  456. package/dist/utils/types/lp-inspect.js +0 -1
  457. package/dist/utils/types/mpc-exclusive.d.ts +0 -5
  458. package/dist/utils/types/mpc-exclusive.js +0 -1
  459. package/dist/utils/types/private-sale.d.ts +0 -1
  460. package/dist/utils/types/private-sale.js +0 -1
  461. package/dist/utils/types/quote-helpers.d.ts +0 -1
  462. package/dist/utils/types/quote-helpers.js +0 -1
  463. package/dist/utils/types/stealth-transfer.d.ts +0 -44
  464. package/dist/utils/types/stealth-transfer.js +0 -1
  465. package/dist/utils/types/wallet.d.ts +0 -25
  466. package/dist/utils/types/wallet.js +0 -1
  467. package/dist/vanity/index.d.ts +0 -5
  468. package/dist/vanity/index.js +0 -5
  469. package/src/abis/contracts/TaxToken.json +0 -969
  470. package/src/abis/contracts/TokenManager.json +0 -836
  471. package/src/abis/contracts/TokenManager2.json +0 -136
  472. package/src/abis/contracts/TokenManagerHelper3.json +0 -993
  473. /package/dist/{abis/contracts → shared/abis}/TokenManager.json +0 -0
  474. /package/dist/{abis/contracts → shared/abis}/TokenManagerHelper3.json +0 -0
@@ -1,42 +1,93 @@
1
- /**
2
- * core - 主函数
3
- */
4
1
  import { ethers, Wallet, Contract, Interface } from 'ethers';
5
- import { NonceManager, getOptimizedGasPrice, buildProfitHopTransactions, PROFIT_HOP_COUNT, } from '../../../utils/bundle-helpers.js';
6
- import { ZERO_ADDRESS } from '../../../shared/constants/index.js';
7
- import { GAS_LIMITS } from '../../constants/index.js';
8
- import { MULTICALL3_ABI } from '../../abis/common.js';
2
+ import { NonceManager, getOptimizedGasPrice, buildProfitHopTransactions, PROFIT_HOP_COUNT } from '../../../utils/bundle-helpers.js';
3
+ import { ADDRESSES, ZERO_ADDRESS } from '../../../utils/constants.js';
4
+ import { GAS_LIMITS, CHAINS } from '../../constants/index.js';
5
+ import { MULTICALL3_ABI, V2_ROUTER_QUOTE_ABI } from '../../abis/common.js';
9
6
  import { FLAP_PORTAL_ADDRESSES, FLAP_ORIGINAL_PORTAL_ADDRESSES } from '../constants.js';
10
- import { normalizeTaxLaunchConfig, populateCreateTokenTransaction, } from '../portal-create-token.js';
11
- import { CHAIN_ID_MAP, PORTAL_ABI, getErrorMessage, getTxType, getGasPriceConfig, shouldExtractProfit, calculateProfit, getProfitRecipient, getBribeAmount, BLOCKRAZOR_BUILDER_EOA, } from './config.js';
12
- import { MigratorType } from '../portal.js';
13
- import { MULTICALL3_ADDRESS, getGasLimit, getTokenToNativeQuote } from './core-helpers.js';
14
- function resolveCreateTokenLaunchFlags(params) {
15
- const normalizedTax = normalizeTaxLaunchConfig(params.taxV2Config, params.taxRate);
16
- const isTaxLaunch = !!normalizedTax || (params.taxRate ?? 0) > 0;
17
- const hasVault = !!normalizedTax?.vaultConfig && normalizedTax.vaultConfig.vaultType !== 'none';
18
- const useV7Portal = !isTaxLaunch &&
19
- !hasVault &&
20
- (params.lpFeeProfile !== undefined ||
21
- params.dexId !== undefined ||
22
- params.migratorType === MigratorType.PCS_INFINITY_CL_MIGRATOR);
23
- return { normalizedTax, isTaxLaunch, hasVault, useV7Portal };
24
- }
7
+ import { buildNewTokenV6WithVaultParams, VAULT_PORTAL_ADDRESSES, VAULT_PORTAL_ABI } from '../vault.js';
8
+ import { buildNewTokenV6Params } from '../launch-v6.js';
9
+ import { CHAIN_ID_MAP, PORTAL_ABI, getErrorMessage, getTxType, getGasPriceConfig, shouldExtractProfit, calculateProfit, getProfitRecipient, getBribeAmount, BLOCKRAZOR_BUILDER_EOA } from './config.js';
10
+ // 常量
11
+ const MULTICALL3_ADDRESS = ADDRESSES.BSC.Multicall3;
12
+ // ==================== ERC20 原生代币报价 ====================
13
+ // BSC 链常量
14
+ const BSC_PANCAKE_V2_ROUTER = ADDRESSES.BSC.PancakeV2Router;
15
+ const BSC_WBNB = ADDRESSES.BSC.WBNB;
16
+ // ✅ Monad 链常量
17
+ const MONAD_PANCAKE_V2_ROUTER = '0xb1bc24c34e88f7d43d5923034e3a14b24daacff9';
18
+ const MONAD_WMON = ADDRESSES.MONAD.WMON;
19
+ // XLAYER 链常量(PotatoSwap V2)
20
+ const XLAYER_POTATOSWAP_V2_ROUTER = ADDRESSES.XLAYER.PotatoSwapV2Router;
21
+ const XLAYER_WOKB = ADDRESSES.XLAYER.WOKB;
22
+ // ✅ Base 链常量(Uniswap V3 SwapRouter02)
23
+ const BASE_WETH = ADDRESSES.BASE.WETH;
24
+ const ROUTER_ABI = V2_ROUTER_QUOTE_ABI;
25
25
  /**
26
- * 无捆绑钱包、仅 Dev 自跟买、原生报价Flap 文档方式 A(create 内 quoteAmt + msg.value)
26
+ * 获取 ERC20 代币原生代币的报价
27
+ * @param provider - Provider 实例
28
+ * @param tokenAddress - ERC20 代币地址
29
+ * @param tokenAmount - 代币数量(wei)
30
+ * @param chainId - 链 ID(56=BSC, 143=Monad)
31
+ * @returns 等值的原生代币数量(wei),失败返回 0n
27
32
  */
28
- function canUseLaunchMethodA(privateKeys, buyAmounts, devAddress, useNativeToken) {
29
- if (!useNativeToken || buyAmounts.length !== 1 || privateKeys.length !== 2) {
30
- return false;
31
- }
33
+ async function getTokenToNativeQuote(provider, tokenAddress, tokenAmount, chainId) {
34
+ if (tokenAmount <= 0n)
35
+ return 0n;
32
36
  try {
33
- const buyerAddr = new Wallet(privateKeys[1]).address;
34
- return buyerAddr.toLowerCase() === devAddress.toLowerCase();
37
+ if (chainId === CHAINS.BSC.chainId) {
38
+ // BSC: 使用 PancakeSwap V2 Router
39
+ const router = new Contract(BSC_PANCAKE_V2_ROUTER, ROUTER_ABI, provider);
40
+ const amounts = await router.getAmountsOut(tokenAmount, [tokenAddress, BSC_WBNB]);
41
+ return amounts[1];
42
+ }
43
+ if (chainId === CHAINS.MONAD.chainId) {
44
+ // ✅ Monad: 使用 PancakeSwap V2 Router
45
+ const router = new Contract(MONAD_PANCAKE_V2_ROUTER, ROUTER_ABI, provider);
46
+ const amounts = await router.getAmountsOut(tokenAmount, [tokenAddress, MONAD_WMON]);
47
+ return amounts[1];
48
+ }
49
+ if (chainId === CHAINS.XLAYER.chainId) {
50
+ // ✅ XLAYER: 使用 PotatoSwap V2 Router(USDT0 → WOKB)
51
+ const router = new Contract(XLAYER_POTATOSWAP_V2_ROUTER, ROUTER_ABI, provider);
52
+ const amounts = await router.getAmountsOut(tokenAmount, [tokenAddress, XLAYER_WOKB]);
53
+ return amounts[1];
54
+ }
55
+ if (chainId === CHAINS.BASE.chainId) {
56
+ // ✅ Base: 目前大部分 Flap 交易使用 ETH(原生代币),ERC20 报价暂不支持
57
+ // Base 主力 DEX 是 Uniswap V3,V2 Router 流动性有限,暂返回 0
58
+ // TODO: 后续可接入 Uniswap V3 QuoterV2 进行精确报价
59
+ return 0n;
60
+ }
61
+ // 其他链暂不支持报价,返回 0
62
+ return 0n;
35
63
  }
36
64
  catch {
37
- return false;
65
+ // 报价失败返回 0(可能是流动性不足或路径不存在)
66
+ return 0n;
38
67
  }
39
68
  }
69
+ /**
70
+ * 获取 Gas Limit
71
+ * 优先使用 config.gasLimit,否则使用默认值 * multiplier
72
+ *
73
+ * ✅ ethers v6 最佳实践:直接使用 bigint 类型
74
+ */
75
+ function getGasLimit(config, defaultGas = 800000) {
76
+ // 优先使用前端传入的 gasLimit
77
+ if (config.gasLimit !== undefined) {
78
+ // 如果已经是 bigint,直接返回;否则转换
79
+ return typeof config.gasLimit === 'bigint' ? config.gasLimit : BigInt(config.gasLimit);
80
+ }
81
+ // 使用默认值 * multiplier
82
+ const multiplier = config.gasLimitMultiplier ?? 1.0;
83
+ const calculatedGas = Math.ceil(defaultGas * multiplier);
84
+ // JavaScript 原生 BigInt 转换(ethers v6 兼容)
85
+ return BigInt(calculatedGas);
86
+ }
87
+ /**
88
+ * Flap Protocol: 创建代币 + 捆绑购买(仅签名版本 - 不依赖 Merkle)
89
+ * ✅ 精简版:只负责签名交易,不提交到 Merkle
90
+ */
40
91
  export async function createTokenWithBundleBuyMerkle(params) {
41
92
  const { chain, privateKeys, buyAmounts, tokenInfo, tokenAddress, config } = params;
42
93
  if (privateKeys.length === 0) {
@@ -52,40 +103,128 @@ export async function createTokenWithBundleBuyMerkle(params) {
52
103
  const portalAddr = FLAP_PORTAL_ADDRESSES[chain];
53
104
  const originalPortalAddr = FLAP_ORIGINAL_PORTAL_ADDRESSES[chain];
54
105
  const portal = new ethers.Contract(originalPortalAddr, PORTAL_ABI, devWallet);
55
- const { normalizedTax, useV7Portal } = resolveCreateTokenLaunchFlags(params);
56
- const inputToken = params.quoteToken && params.quoteToken !== ZERO_ADDRESS ? params.quoteToken : ZERO_ADDRESS;
57
- const useNativeToken = inputToken === ZERO_ADDRESS;
58
- const extractProfit = config.extractProfitOnLaunch === false ? false : shouldExtractProfit(config);
59
- const useMethodA = canUseLaunchMethodA(privateKeys, buyAmounts, devWallet.address, useNativeToken);
60
- let methodAQuoteAmt = 0n;
61
- let methodABuyMeta;
62
- if (useMethodA) {
63
- methodABuyMeta = analyzeBuyFunds(buyAmounts, config, extractProfit);
64
- methodAQuoteAmt = methodABuyMeta.fundsList[0] ?? 0n;
65
- }
66
- const createTxPromise = populateCreateTokenTransaction({
67
- chain,
68
- devWallet,
69
- originalPortal: portal,
70
- tokenInfo,
71
- quoteToken: params.quoteToken || ZERO_ADDRESS,
72
- beneficiary: devWallet.address,
73
- dexThresh: params.dexThresh,
74
- salt: params.salt,
75
- migratorType: params.migratorType,
76
- taxRate: params.taxRate,
77
- dexId: params.dexId,
78
- lpFeeProfile: params.lpFeeProfile,
79
- extensionID: params.extensionID,
80
- extensionData: params.extensionData,
81
- useV7Portal,
82
- taxConfig: normalizedTax,
83
- initialQuoteAmt: useMethodA ? methodAQuoteAmt : 0n,
84
- });
106
+ // 判断使用哪个版本的 newToken
107
+ // V5: 提供了 taxV2Config taxRate > 0(Tax Token V2 高级税收分配)
108
+ // V4: 提供了 dexId lpFeeProfile(支持 DEX 选择和 LP 费率配置)
109
+ // V3: 提供了 extensionID(支持扩展数据)
110
+ // V2: 默认
111
+ const useV5 = params.taxV2Config !== undefined && (params.taxRate ?? 0) > 0;
112
+ const useV4 = !useV5 && (params.dexId !== undefined || params.lpFeeProfile !== undefined);
113
+ const useV3 = !useV5 && !useV4 && !!params.extensionID;
114
+ // 优化:并行获取 gasPrice、devWallet nonce 和 createTx
115
+ let createTxPromise;
116
+ if (useV5) {
117
+ // V5: Tax Token V2 高级税收分配
118
+ const tv2 = params.taxV2Config;
119
+ const dist = tv2.distribution;
120
+ const total = dist.mktBps + dist.deflationBps + dist.dividendBps + dist.lpBps;
121
+ if (total !== 10000) {
122
+ throw new Error(`Tax distribution must sum to 10000 (100%), got ${total}`);
123
+ }
124
+ // ✅ 金库:VaultPortal.newTokenV6WithVault;无金库:Portal.newTokenV6 + TOKEN_TAXED_V3
125
+ const hasVault = tv2.vaultConfig && tv2.vaultConfig.vaultType !== 'none';
126
+ if (hasVault) {
127
+ const vaultPortalAddr = VAULT_PORTAL_ADDRESSES[chain];
128
+ if (!vaultPortalAddr) {
129
+ throw new Error(`链 "${chain}" 不支持 Tax Vault 金库功能`);
130
+ }
131
+ const vaultPortal = new ethers.Contract(vaultPortalAddr, VAULT_PORTAL_ABI, devWallet);
132
+ const v6VaultParams = buildNewTokenV6WithVaultParams({
133
+ tokenInfo,
134
+ taxV2: tv2,
135
+ chain,
136
+ salt: params.salt,
137
+ taxRate: params.taxRate,
138
+ buyTaxRate: params.buyTaxRate,
139
+ sellTaxRate: params.sellTaxRate,
140
+ dexThresh: params.dexThresh,
141
+ migratorType: params.migratorType,
142
+ quoteToken: params.quoteToken,
143
+ quoteAmt: 0n,
144
+ dexId: params.dexId,
145
+ lpFeeProfile: params.lpFeeProfile,
146
+ });
147
+ createTxPromise = vaultPortal.newTokenV6WithVault.populateTransaction(v6VaultParams);
148
+ }
149
+ else {
150
+ const v6Params = buildNewTokenV6Params({
151
+ tokenInfo,
152
+ taxV2: tv2,
153
+ beneficiary: devWallet.address,
154
+ salt: params.salt,
155
+ taxRate: params.taxRate,
156
+ buyTaxRate: params.buyTaxRate,
157
+ sellTaxRate: params.sellTaxRate,
158
+ dexThresh: params.dexThresh,
159
+ migratorType: params.migratorType,
160
+ quoteToken: params.quoteToken,
161
+ quoteAmt: 0n,
162
+ dexId: params.dexId,
163
+ lpFeeProfile: params.lpFeeProfile,
164
+ extensionID: params.extensionID,
165
+ extensionData: params.extensionData,
166
+ });
167
+ createTxPromise = portal.newTokenV6.populateTransaction(v6Params);
168
+ }
169
+ }
170
+ else if (useV4) {
171
+ // V4: 支持 DEX ID 和 LP 费率配置
172
+ createTxPromise = portal.newTokenV4.populateTransaction({
173
+ name: tokenInfo.name,
174
+ symbol: tokenInfo.symbol,
175
+ meta: tokenInfo.meta,
176
+ dexThresh: (params.dexThresh ?? 1) & 0xff,
177
+ salt: params.salt ?? '0x' + '00'.repeat(32),
178
+ taxRate: (params.taxRate ?? 0) & 0xffff,
179
+ migratorType: (params.migratorType ?? 0) & 0xff,
180
+ quoteToken: params.quoteToken || ZERO_ADDRESS,
181
+ quoteAmt: 0n,
182
+ beneficiary: devWallet.address,
183
+ permitData: '0x',
184
+ extensionID: params.extensionID ?? '0x' + '00'.repeat(32),
185
+ extensionData: params.extensionData ?? '0x',
186
+ dexId: (params.dexId ?? 0) & 0xff,
187
+ lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff
188
+ });
189
+ }
190
+ else if (useV3) {
191
+ // V3: 支持扩展数据
192
+ createTxPromise = portal.newTokenV3.populateTransaction({
193
+ name: tokenInfo.name,
194
+ symbol: tokenInfo.symbol,
195
+ meta: tokenInfo.meta,
196
+ dexThresh: (params.dexThresh ?? 1) & 0xff,
197
+ salt: params.salt ?? '0x' + '00'.repeat(32),
198
+ taxRate: (params.taxRate ?? 0) & 0xffff,
199
+ migratorType: (params.migratorType ?? 0) & 0xff,
200
+ quoteToken: params.quoteToken || ZERO_ADDRESS,
201
+ quoteAmt: 0n,
202
+ beneficiary: devWallet.address,
203
+ permitData: '0x',
204
+ extensionID: params.extensionID,
205
+ extensionData: params.extensionData ?? '0x'
206
+ });
207
+ }
208
+ else {
209
+ // V2: 基础版本
210
+ createTxPromise = portal.newTokenV2.populateTransaction({
211
+ name: tokenInfo.name,
212
+ symbol: tokenInfo.symbol,
213
+ meta: tokenInfo.meta,
214
+ dexThresh: (params.dexThresh ?? 1) & 0xff,
215
+ salt: params.salt ?? '0x' + '00'.repeat(32),
216
+ taxRate: (params.taxRate ?? 0) & 0xffff,
217
+ migratorType: (params.migratorType ?? 0) & 0xff,
218
+ quoteToken: params.quoteToken || ZERO_ADDRESS,
219
+ quoteAmt: 0n,
220
+ beneficiary: devWallet.address,
221
+ permitData: '0x'
222
+ });
223
+ }
85
224
  const [gasPrice, createTxUnsigned, devNonce] = await Promise.all([
86
225
  resolveGasPrice(provider, config),
87
226
  createTxPromise,
88
- nonceManager.getNextNonce(devWallet),
227
+ nonceManager.getNextNonce(devWallet)
89
228
  ]);
90
229
  const createTxRequest = {
91
230
  ...createTxUnsigned,
@@ -94,74 +233,31 @@ export async function createTokenWithBundleBuyMerkle(params) {
94
233
  gasLimit: getGasLimit(config),
95
234
  gasPrice,
96
235
  chainId,
97
- type: getTxType(config),
98
- value: useMethodA ? methodAQuoteAmt : 0n,
236
+ type: getTxType(config)
99
237
  };
100
238
  const signedCreateTx = await devWallet.signTransaction(createTxRequest);
101
239
  signedTxs.push(signedCreateTx);
102
- if (useMethodA && methodABuyMeta) {
103
- const { totalBuyAmount, totalProfit } = methodABuyMeta;
104
- const bribeAmount = getBribeAmount(config);
105
- const bribeTxs = [];
106
- let nextDevNonce = devNonce + 1;
107
- if (bribeAmount > 0n) {
108
- const bribeTx = await devWallet.signTransaction({
109
- to: BLOCKRAZOR_BUILDER_EOA,
110
- value: bribeAmount,
111
- nonce: nextDevNonce,
112
- gasPrice,
113
- gasLimit: GAS_LIMITS.BRIBE,
114
- chainId,
115
- type: getTxType(config),
116
- });
117
- bribeTxs.push(bribeTx);
118
- nextDevNonce += 1;
119
- }
120
- const profitTxs = [];
121
- let profitHopWallets;
122
- if (extractProfit && totalProfit > 0n) {
123
- const profitHopResult = await buildProfitHopTransactions({
124
- provider,
125
- payerWallet: devWallet,
126
- profitAmount: totalProfit,
127
- profitRecipient: getProfitRecipient(),
128
- hopCount: PROFIT_HOP_COUNT,
129
- gasPrice,
130
- chainId,
131
- txType: getTxType(config),
132
- startNonce: nextDevNonce,
133
- });
134
- profitTxs.push(...profitHopResult.signedTransactions);
135
- profitHopWallets = profitHopResult.hopWallets;
136
- }
137
- nonceManager.clearTemp();
138
- return {
139
- signedTransactions: [...bribeTxs, ...signedTxs, ...profitTxs],
140
- tokenAddress,
141
- profitHopWallets,
142
- metadata: {
143
- ...buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, 0),
144
- launchMethod: 'quoteAmt',
145
- },
146
- };
147
- }
148
240
  const buyers = createWallets(privateKeys.slice(1), provider);
241
+ const extractProfit = shouldExtractProfit(config);
149
242
  const { fundsList, originalAmounts, totalBuyAmount, totalProfit } = analyzeBuyFunds(buyAmounts, config, extractProfit);
150
243
  const maxFundsIndex = findMaxIndex(originalAmounts);
151
244
  const gasLimits = buildGasLimitList(buyers.length, config);
245
+ // ✅ 支持 quoteToken:如果传入了 quoteToken 且非零地址,则使用它
246
+ const inputToken = params.quoteToken && params.quoteToken !== ZERO_ADDRESS ? params.quoteToken : ZERO_ADDRESS;
247
+ const useNativeToken = inputToken === ZERO_ADDRESS;
152
248
  // ✅ 如果使用非原生代币(如 USDC),需要根据精度转换金额
153
249
  let adjustedFundsList = fundsList;
154
250
  let profitTokenAmount = totalProfit;
155
251
  if (!useNativeToken && params.quoteTokenDecimals !== undefined && params.quoteTokenDecimals !== 18) {
156
252
  const decimalsDiff = 18 - params.quoteTokenDecimals;
157
253
  const divisor = BigInt(10 ** decimalsDiff);
158
- adjustedFundsList = fundsList.map((amount) => amount / divisor);
254
+ adjustedFundsList = fundsList.map(amount => amount / divisor);
159
255
  profitTokenAmount = totalProfit / divisor;
160
256
  }
161
257
  // ✅ 优化:并行获取 unsignedBuys 和 buyerNonces
162
258
  const [unsignedBuys, buyerNonces] = await Promise.all([
163
259
  populateBuyTransactionsWithQuote(buyers, portalAddr, tokenAddress, adjustedFundsList, inputToken, useNativeToken),
164
- allocateBuyerNonces(buyers, extractProfit, maxFundsIndex, useNativeToken ? totalProfit : profitTokenAmount, nonceManager),
260
+ allocateBuyerNonces(buyers, extractProfit, maxFundsIndex, useNativeToken ? totalProfit : profitTokenAmount, nonceManager)
165
261
  ]);
166
262
  // ✅ 贿赂交易放在首位(提高 BlockRazor 打包优先级)
167
263
  const bribeAmount = getBribeAmount(config);
@@ -176,7 +272,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
176
272
  gasPrice,
177
273
  gasLimit: GAS_LIMITS.BRIBE,
178
274
  chainId,
179
- type: getTxType(config),
275
+ type: getTxType(config)
180
276
  });
181
277
  bribeTxs.push(bribeTx);
182
278
  // 调整 maxFundsIndex 钱包的 nonce(买入交易 +1)
@@ -191,7 +287,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
191
287
  chainId,
192
288
  config,
193
289
  fundsList: adjustedFundsList, // ✅ 使用调整后的金额
194
- useNativeToken, // ✅ 传递是否使用原生代币
290
+ useNativeToken // ✅ 传递是否使用原生代币
195
291
  });
196
292
  // ✅ 利润多跳转账(强制 2 跳中转)
197
293
  const profitTxs = [];
@@ -212,7 +308,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
212
308
  gasPrice,
213
309
  chainId,
214
310
  txType: getTxType(config),
215
- startNonce: profitNonce,
311
+ startNonce: profitNonce
216
312
  });
217
313
  profitTxs.push(...profitHopResult.signedTransactions);
218
314
  profitHopWallets = profitHopResult.hopWallets; // ✅ 收集利润多跳钱包
@@ -224,10 +320,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
224
320
  signedTransactions: [...bribeTxs, ...signedTxs, ...signedBuys, ...profitTxs],
225
321
  tokenAddress,
226
322
  profitHopWallets, // ✅ 返回利润多跳钱包
227
- metadata: {
228
- ...buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, buyers.length),
229
- launchMethod: 'swapExactInput',
230
- },
323
+ metadata: buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, buyers.length)
231
324
  };
232
325
  }
233
326
  /**
@@ -242,8 +335,9 @@ export async function batchBuyWithBundleMerkle(params) {
242
335
  }
243
336
  const { provider, chainId } = createChainContext(chain, config.rpcUrl);
244
337
  const nonceManager = new NonceManager(provider);
338
+ const signedTxs = [];
245
339
  const buyers = createWallets(privateKeys, provider);
246
- const extractProfit = shouldExtractProfit();
340
+ const extractProfit = shouldExtractProfit(config);
247
341
  const { fundsList, originalAmounts, totalBuyAmount, totalProfit } = analyzeBuyFunds(buyAmounts, config, extractProfit);
248
342
  const maxFundsIndex = findMaxIndex(originalAmounts);
249
343
  const gasLimits = buildGasLimitList(buyers.length, config);
@@ -261,7 +355,7 @@ export async function batchBuyWithBundleMerkle(params) {
261
355
  // 转为 USDC (6位) = 100000 (0.1 USDC)
262
356
  const decimalsDiff = 18 - quoteTokenDecimals;
263
357
  const divisor = BigInt(10 ** decimalsDiff);
264
- adjustedFundsList = fundsList.map((amount) => amount / divisor);
358
+ adjustedFundsList = fundsList.map(amount => amount / divisor);
265
359
  profitTokenAmount = totalProfit / divisor;
266
360
  }
267
361
  // ✅ ERC20 购买:获取代币利润等值的原生代币(BNB)报价
@@ -278,8 +372,10 @@ export async function batchBuyWithBundleMerkle(params) {
278
372
  populateBuyTransactionsWithQuote(buyers, FLAP_PORTAL_ADDRESSES[chain], tokenAddress, adjustedFundsList, inputToken, useNativeToken),
279
373
  presetNonces && presetNonces.length === buyers.length
280
374
  ? adjustNoncesForProfit(presetNonces) // ✅ 调整 nonces 避免冲突
281
- : allocateBuyerNonces(buyers, extractProfit, maxFundsIndex, nativeProfitAmount, nonceManager),
375
+ : allocateBuyerNonces(buyers, extractProfit, maxFundsIndex, nativeProfitAmount, nonceManager)
282
376
  ]);
377
+ if (presetNonces) {
378
+ }
283
379
  // ✅ 贿赂交易放在首位(提高 BlockRazor 打包优先级)
284
380
  const bribeAmount = getBribeAmount(config);
285
381
  const bribeTxs = [];
@@ -292,7 +388,7 @@ export async function batchBuyWithBundleMerkle(params) {
292
388
  gasPrice,
293
389
  gasLimit: GAS_LIMITS.BRIBE,
294
390
  chainId,
295
- type: getTxType(config),
391
+ type: getTxType(config)
296
392
  });
297
393
  bribeTxs.push(bribeTx);
298
394
  // 调整 maxFundsIndex 钱包的 nonce(买入交易 +1)
@@ -307,18 +403,20 @@ export async function batchBuyWithBundleMerkle(params) {
307
403
  chainId,
308
404
  config,
309
405
  fundsList: adjustedFundsList, // ✅ 使用调整后的金额
310
- useNativeToken, // ✅ USDT 购买时 value=0,BNB 购买时 value=金额
406
+ useNativeToken // ✅ USDT 购买时 value=0,BNB 购买时 value=金额
311
407
  });
312
408
  // ✅ 利润多跳转账
313
409
  const profitTxs = [];
314
410
  let profitHopWallets;
315
411
  // ✅ 检查是否使用分布式利润模式
316
- const profitMode = config.profitMode ?? 'single';
412
+ const profitMode = config.profitMode || 'single';
413
+ console.log('🔧 [SDK batchBuyWithBundleMerkle] config.profitMode:', config.profitMode, '-> resolved:', profitMode, 'wallets:', buyers.length);
317
414
  if (extractProfit && nativeProfitAmount > 0n) {
318
415
  if (profitMode === 'distributed') {
319
416
  // ✅ 分布式模式:每个钱包独立扣除自己的利润,每个都有独立的多跳
320
417
  // 最多支持 12 个钱包(12 交易 + 36 多跳 + 1 贿赂 = 49 笔)
321
418
  const MAX_DISTRIBUTED_WALLETS = 12;
419
+ console.log('🔧 [SDK] 使用分布式利润模式,钱包数:', buyers.length);
322
420
  if (buyers.length > MAX_DISTRIBUTED_WALLETS) {
323
421
  throw new Error(`分布式利润模式最多支持 ${MAX_DISTRIBUTED_WALLETS} 个钱包,当前 ${buyers.length} 个`);
324
422
  }
@@ -328,7 +426,9 @@ export async function batchBuyWithBundleMerkle(params) {
328
426
  for (let i = 0; i < buyers.length; i++) {
329
427
  const walletOriginalAmount = originalAmounts[i];
330
428
  // 按比例计算该钱包应承担的利润
331
- const walletProfit = totalBuyAmount > 0n ? (nativeProfitAmount * walletOriginalAmount) / totalBuyAmount : 0n;
429
+ const walletProfit = totalBuyAmount > 0n
430
+ ? (nativeProfitAmount * walletOriginalAmount) / totalBuyAmount
431
+ : 0n;
332
432
  perWalletProfits.push(walletProfit);
333
433
  }
334
434
  // 为每个钱包生成独立的利润多跳交易
@@ -345,7 +445,7 @@ export async function batchBuyWithBundleMerkle(params) {
345
445
  gasPrice,
346
446
  chainId,
347
447
  txType: getTxType(config),
348
- startNonce: profitNonce,
448
+ startNonce: profitNonce
349
449
  });
350
450
  profitTxs.push(...profitHopResult.signedTransactions);
351
451
  if (profitHopResult.hopWallets) {
@@ -367,7 +467,7 @@ export async function batchBuyWithBundleMerkle(params) {
367
467
  gasPrice,
368
468
  chainId,
369
469
  txType: getTxType(config),
370
- startNonce: profitNonce,
470
+ startNonce: profitNonce
371
471
  });
372
472
  profitTxs.push(...profitHopResult.signedTransactions);
373
473
  profitHopWallets = profitHopResult.hopWallets;
@@ -382,7 +482,7 @@ export async function batchBuyWithBundleMerkle(params) {
382
482
  metadata: {
383
483
  ...buildProfitMetadata(extractProfit, totalBuyAmount, nativeProfitAmount, buyers.length),
384
484
  profitMode, // ✅ 返回使用的利润模式
385
- },
485
+ }
386
486
  };
387
487
  }
388
488
  /**
@@ -397,22 +497,23 @@ export async function batchSellWithBundleMerkle(params) {
397
497
  }
398
498
  const { provider, chainId } = createChainContext(chain, config.rpcUrl);
399
499
  const nonceManager = new NonceManager(provider);
500
+ const signedTxs = [];
400
501
  const wallets = createWallets(privateKeys, provider);
401
- const amountsWei = sellAmounts.map((a) => ethers.parseUnits(a, 18));
502
+ const amountsWei = sellAmounts.map(a => ethers.parseUnits(a, 18));
402
503
  const portalAddr = FLAP_PORTAL_ADDRESSES[chain];
403
504
  const readOnlyPortal = new ethers.Contract(portalAddr, PORTAL_ABI, provider);
404
505
  const gasLimits = buildGasLimitList(wallets.length, config);
405
- const portals = wallets.map((w) => new ethers.Contract(portalAddr, PORTAL_ABI, w));
506
+ const portals = wallets.map(w => new ethers.Contract(portalAddr, PORTAL_ABI, w));
406
507
  // ✅ 确定 outputToken:如果传入了 quoteToken 且非零地址,则使用它;否则使用零地址(原生代币)
407
508
  const outputToken = quoteToken && quoteToken !== ZERO_ADDRESS ? quoteToken : ZERO_ADDRESS;
408
509
  const useNativeOutput = outputToken === ZERO_ADDRESS;
409
510
  // ✅ 优化:如果前端传入了 nonces,直接使用(跳过 RPC 调用)
410
511
  const presetNonces = config.nonces;
411
- const extractProfit = shouldExtractProfit();
512
+ const extractProfit = shouldExtractProfit(config);
412
513
  // ✅ 并行执行 gasPrice 和 quoteSellOutputs(Multicall3)
413
514
  const [gasPrice, quotedOutputs] = await Promise.all([
414
515
  resolveGasPrice(provider, config),
415
- quoteSellOutputsWithQuote(readOnlyPortal, tokenAddress, amountsWei, outputToken),
516
+ quoteSellOutputsWithQuote(readOnlyPortal, tokenAddress, amountsWei, outputToken)
416
517
  ]);
417
518
  // ✅ 计算利润和 maxRevenueIndex(用于 nonce 分配)
418
519
  let totalTokenProfit = 0n;
@@ -422,7 +523,7 @@ export async function batchSellWithBundleMerkle(params) {
422
523
  for (let i = 0; i < wallets.length; i++) {
423
524
  const quoted = quotedOutputs[i];
424
525
  if (quoted > 0n) {
425
- const { profit } = calculateProfit(quoted);
526
+ const { profit } = calculateProfit(quoted, config);
426
527
  totalTokenProfit += profit;
427
528
  if (quoted > maxRevenue) {
428
529
  maxRevenue = quoted;
@@ -454,7 +555,9 @@ export async function batchSellWithBundleMerkle(params) {
454
555
  const maxRevenueNonces = await nonceManager.getNextNonceBatch(wallets[maxRevenueIndex], maxRevenueNonceCount);
455
556
  // 其他钱包各需要 1 个 nonce
456
557
  const otherWallets = wallets.filter((_, i) => i !== maxRevenueIndex);
457
- const otherNonces = otherWallets.length > 0 ? await nonceManager.getNextNoncesForWallets(otherWallets) : [];
558
+ const otherNonces = otherWallets.length > 0
559
+ ? await nonceManager.getNextNoncesForWallets(otherWallets)
560
+ : [];
458
561
  // 组装最终的 nonces 数组(保持原顺序)
459
562
  nonces = [];
460
563
  let otherIdx = 0;
@@ -485,7 +588,7 @@ export async function batchSellWithBundleMerkle(params) {
485
588
  outputToken, // ✅ 使用动态 outputToken
486
589
  inputAmount: amountsWei[i],
487
590
  minOutputAmount: minOuts[i],
488
- permitData: '0x',
591
+ permitData: '0x'
489
592
  })));
490
593
  // ✅ 贿赂交易放在首位
491
594
  const bribeTxs = [];
@@ -497,7 +600,7 @@ export async function batchSellWithBundleMerkle(params) {
497
600
  gasPrice,
498
601
  gasLimit: GAS_LIMITS.BRIBE,
499
602
  chainId,
500
- type: getTxType(config),
603
+ type: getTxType(config)
501
604
  });
502
605
  bribeTxs.push(bribeTx);
503
606
  }
@@ -511,13 +614,14 @@ export async function batchSellWithBundleMerkle(params) {
511
614
  gasPrice,
512
615
  chainId,
513
616
  type: getTxType(config),
514
- value: 0n, // ✅ 卖出交易不发送原生代币
617
+ value: 0n // ✅ 卖出交易不发送原生代币
515
618
  })));
516
619
  // ✅ 利润多跳转账
517
620
  const profitTxs = [];
518
621
  let profitHopWallets;
519
622
  // ✅ 检查是否使用分布式利润模式
520
- const profitMode = config.profitMode ?? 'single';
623
+ const profitMode = config.profitMode || 'single';
624
+ console.log('🔧 [SDK batchSellWithBundleMerkle] config.profitMode:', config.profitMode, '-> resolved:', profitMode, 'wallets:', wallets.length);
521
625
  if (needProfitTx) {
522
626
  // ERC20 输出时:获取代币利润等值的原生代币(BNB)报价
523
627
  let totalNativeProfitAmount = totalTokenProfit;
@@ -551,7 +655,7 @@ export async function batchSellWithBundleMerkle(params) {
551
655
  gasPrice,
552
656
  chainId,
553
657
  txType: getTxType(config),
554
- startNonce: walletProfitNonce,
658
+ startNonce: walletProfitNonce
555
659
  });
556
660
  profitTxs.push(...profitHopResult.signedTransactions);
557
661
  if (profitHopResult.hopWallets) {
@@ -573,7 +677,7 @@ export async function batchSellWithBundleMerkle(params) {
573
677
  gasPrice,
574
678
  chainId,
575
679
  txType: getTxType(config),
576
- startNonce: profitNonce,
680
+ startNonce: profitNonce
577
681
  });
578
682
  profitTxs.push(...profitHopResult.signedTransactions);
579
683
  profitHopWallets = profitHopResult.hopWallets;
@@ -589,7 +693,7 @@ export async function batchSellWithBundleMerkle(params) {
589
693
  metadata: {
590
694
  profitMode, // ✅ 返回使用的利润模式
591
695
  totalProfit: totalTokenProfit.toString(),
592
- },
696
+ }
593
697
  };
594
698
  }
595
699
  // ✅ Provider 缓存(复用连接,减少初始化开销)
@@ -610,27 +714,29 @@ function createChainContext(chain, rpcUrl) {
610
714
  return { chainId, provider };
611
715
  }
612
716
  async function resolveGasPrice(provider, config) {
613
- if ('gasPrice' in config && config.gasPrice !== undefined) {
614
- return config.gasPrice;
717
+ // 优化:如果前端传入了 gasPrice,直接使用(跳过 RPC 调用)
718
+ if (config.gasPrice !== undefined) {
719
+ const gasPrice = config.gasPrice;
720
+ return gasPrice;
615
721
  }
616
722
  return await getOptimizedGasPrice(provider, getGasPriceConfig(config));
617
723
  }
618
724
  function createWallets(privateKeys, provider) {
619
- return privateKeys.map((key) => new Wallet(key, provider));
725
+ return privateKeys.map(key => new Wallet(key, provider));
620
726
  }
621
727
  function analyzeBuyFunds(buyAmounts, config, extractProfit) {
622
728
  const result = {
623
729
  fundsList: [],
624
730
  originalAmounts: [],
625
731
  totalBuyAmount: 0n,
626
- totalProfit: 0n,
732
+ totalProfit: 0n
627
733
  };
628
- buyAmounts.forEach((amount) => {
734
+ buyAmounts.forEach(amount => {
629
735
  const originalAmount = ethers.parseEther(amount);
630
736
  result.originalAmounts.push(originalAmount);
631
737
  result.totalBuyAmount += originalAmount;
632
738
  if (extractProfit) {
633
- const { remaining, profit } = calculateProfit(originalAmount);
739
+ const { remaining, profit } = calculateProfit(originalAmount, config);
634
740
  result.totalProfit += profit;
635
741
  result.fundsList.push(remaining);
636
742
  }
@@ -659,13 +765,13 @@ function findMaxIndex(values) {
659
765
  * 当 inputToken 为非零地址(如 USDC)时,value 为 0
660
766
  */
661
767
  async function populateBuyTransactionsWithQuote(buyers, portalAddr, tokenAddress, fundsList, inputToken, useNativeToken) {
662
- const portals = buyers.map((wallet) => new ethers.Contract(portalAddr, PORTAL_ABI, wallet));
768
+ const portals = buyers.map(wallet => new ethers.Contract(portalAddr, PORTAL_ABI, wallet));
663
769
  return await Promise.all(portals.map((portal, i) => portal.swapExactInput.populateTransaction({
664
770
  inputToken,
665
771
  outputToken: tokenAddress,
666
772
  inputAmount: fundsList[i],
667
773
  minOutputAmount: 0n,
668
- permitData: '0x',
774
+ permitData: '0x'
669
775
  },
670
776
  // ✅ 如果使用原生代币,value 为购买金额;否则为 0
671
777
  useNativeToken ? { value: fundsList[i] } : {})));
@@ -702,7 +808,9 @@ async function allocateBuyerNonces(buyers, extractProfit, maxIndex, totalProfit,
702
808
  const maxIndexNonces = await nonceManager.getNextNonceBatch(buyers[maxIndex], 2);
703
809
  // 其他钱包各需要 1 个 nonce
704
810
  const otherBuyers = buyers.filter((_, i) => i !== maxIndex);
705
- const otherNonces = otherBuyers.length > 0 ? await nonceManager.getNextNoncesForWallets(otherBuyers) : [];
811
+ const otherNonces = otherBuyers.length > 0
812
+ ? await nonceManager.getNextNoncesForWallets(otherBuyers)
813
+ : [];
706
814
  // 组装最终的 nonces 数组(保持原顺序)
707
815
  const nonces = [];
708
816
  let otherIdx = 0;
@@ -716,7 +824,7 @@ async function allocateBuyerNonces(buyers, extractProfit, maxIndex, totalProfit,
716
824
  }
717
825
  return nonces;
718
826
  }
719
- async function signBuyTransactions({ unsignedBuys, buyers, nonces, gasLimits, gasPrice, chainId, config, fundsList, useNativeToken = true, // ✅ 默认使用原生代币
827
+ async function signBuyTransactions({ unsignedBuys, buyers, nonces, gasLimits, gasPrice, chainId, config, fundsList, useNativeToken = true // ✅ 默认使用原生代币
720
828
  }) {
721
829
  return await Promise.all(unsignedBuys.map((unsigned, i) => buyers[i].signTransaction({
722
830
  ...unsigned,
@@ -726,7 +834,7 @@ async function signBuyTransactions({ unsignedBuys, buyers, nonces, gasLimits, ga
726
834
  gasPrice,
727
835
  chainId,
728
836
  type: getTxType(config),
729
- value: useNativeToken ? fundsList[i] : 0n, // ✅ 非原生代币时 value 为 0
837
+ value: useNativeToken ? fundsList[i] : 0n // ✅ 非原生代币时 value 为 0
730
838
  })));
731
839
  }
732
840
  function buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, buyerCount) {
@@ -737,7 +845,7 @@ function buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, buyerCo
737
845
  totalBuyAmount: ethers.formatEther(totalBuyAmount),
738
846
  profitAmount: ethers.formatEther(totalProfit),
739
847
  profitRecipient: getProfitRecipient(),
740
- buyerCount,
848
+ buyerCount
741
849
  };
742
850
  }
743
851
  /**
@@ -753,7 +861,7 @@ async function quoteSellOutputsWithQuote(portal, tokenAddress, amountsWei, outpu
753
861
  const result = await portal.quoteExactInput.staticCall({
754
862
  inputToken: tokenAddress,
755
863
  outputToken,
756
- inputAmount: amountsWei[0],
864
+ inputAmount: amountsWei[0]
757
865
  });
758
866
  return [result];
759
867
  }
@@ -766,16 +874,14 @@ async function quoteSellOutputsWithQuote(portal, tokenAddress, amountsWei, outpu
766
874
  const portalIface = new Interface(PORTAL_ABI);
767
875
  const multicall = new Contract(MULTICALL3_ADDRESS, MULTICALL3_ABI, provider);
768
876
  // 构建批量调用
769
- const calls = amountsWei.map((amount) => ({
877
+ const calls = amountsWei.map(amount => ({
770
878
  target: portalAddress,
771
879
  allowFailure: true, // 允许单个失败
772
- callData: portalIface.encodeFunctionData('quoteExactInput', [
773
- {
880
+ callData: portalIface.encodeFunctionData('quoteExactInput', [{
774
881
  inputToken: tokenAddress,
775
882
  outputToken,
776
- inputAmount: amount,
777
- },
778
- ]),
883
+ inputAmount: amount
884
+ }])
779
885
  }));
780
886
  try {
781
887
  const results = await multicall.aggregate3.staticCall(calls);
@@ -799,7 +905,7 @@ async function quoteSellOutputsWithQuote(portal, tokenAddress, amountsWei, outpu
799
905
  return await portal.quoteExactInput.staticCall({
800
906
  inputToken: tokenAddress,
801
907
  outputToken,
802
- inputAmount: amount,
908
+ inputAmount: amount
803
909
  });
804
910
  }
805
911
  catch {