four-flap-meme-sdk 2.2.1 → 2.2.2

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 (470) 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 +85 -20
  142. package/dist/index.js +215 -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 +252 -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 -1
  166. package/dist/shared/flap/constants.js +3 -2
  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 +3 -3
  171. package/dist/shared/flap/index.js +3 -3
  172. package/dist/shared/flap/meta.d.ts +18 -22
  173. package/dist/shared/flap/meta.js +17 -12
  174. package/dist/shared/flap/permit.js +2 -5
  175. package/dist/shared/flap/pinata.d.ts +6 -22
  176. package/dist/shared/flap/pinata.js +26 -21
  177. package/dist/shared/flap/portal-bundle-merkle/config.d.ts +72 -3
  178. package/dist/shared/flap/portal-bundle-merkle/config.js +124 -4
  179. package/dist/shared/flap/portal-bundle-merkle/core.d.ts +4 -0
  180. package/dist/shared/flap/portal-bundle-merkle/core.js +172 -92
  181. package/dist/shared/flap/portal-bundle-merkle/create-to-dex.d.ts +1 -2
  182. package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +99 -106
  183. package/dist/shared/flap/portal-bundle-merkle/curve-to-dex.js +92 -100
  184. package/dist/shared/flap/portal-bundle-merkle/index.d.ts +7 -11
  185. package/dist/shared/flap/portal-bundle-merkle/index.js +7 -4
  186. package/dist/shared/flap/portal-bundle-merkle/pancake-proxy.js +68 -71
  187. package/dist/shared/flap/portal-bundle-merkle/private.js +114 -61
  188. package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.d.ts +64 -1
  189. package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.js +247 -66
  190. package/dist/shared/flap/portal-bundle-merkle/swap.d.ts +71 -2
  191. package/dist/shared/flap/portal-bundle-merkle/swap.js +410 -103
  192. package/dist/shared/flap/portal-bundle-merkle/types.d.ts +7 -73
  193. package/dist/shared/flap/portal-bundle-merkle/utils.d.ts +80 -1
  194. package/dist/shared/flap/portal-bundle-merkle/utils.js +265 -145
  195. package/dist/shared/flap/portal-bundle.js +56 -55
  196. package/dist/shared/flap/portal.d.ts +3 -1
  197. package/dist/shared/flap/portal.js +25 -32
  198. package/dist/shared/flap/vanity.d.ts +5 -1
  199. package/dist/shared/flap/vanity.js +17 -6
  200. package/dist/shared/flap/vault.d.ts +124 -17
  201. package/dist/shared/flap/vault.js +148 -67
  202. package/dist/shared/four/tax-token.d.ts +1 -1
  203. package/dist/shared/four/tax-token.js +7 -27
  204. package/dist/shared/index.d.ts +0 -6
  205. package/dist/shared/index.js +0 -4
  206. package/dist/utils/airdrop-sweep.d.ts +76 -4
  207. package/dist/utils/airdrop-sweep.js +55 -42
  208. package/dist/utils/bundle-helpers.d.ts +243 -9
  209. package/dist/utils/bundle-helpers.js +584 -10
  210. package/dist/utils/constants.d.ts +61 -5
  211. package/dist/utils/constants.js +80 -5
  212. package/dist/utils/contract-factory.d.ts +4 -2
  213. package/dist/utils/contract-factory.js +18 -25
  214. package/dist/utils/erc20.d.ts +89 -7
  215. package/dist/utils/erc20.js +125 -94
  216. package/dist/utils/errors.d.ts +1 -12
  217. package/dist/utils/errors.js +1 -60
  218. package/dist/utils/holders-maker.d.ts +138 -2
  219. package/dist/utils/holders-maker.js +661 -26
  220. package/dist/utils/lp-inspect.d.ts +112 -2
  221. package/dist/utils/lp-inspect.js +223 -73
  222. package/dist/utils/mpcExclusive.d.ts +5 -2
  223. package/dist/utils/mpcExclusive.js +3 -4
  224. package/dist/utils/private-sale.d.ts +58 -2
  225. package/dist/utils/private-sale.js +15 -4
  226. package/dist/utils/provider-factory.d.ts +0 -4
  227. package/dist/utils/provider-factory.js +0 -10
  228. package/dist/utils/quote-helpers.d.ts +45 -4
  229. package/dist/utils/quote-helpers.js +74 -17
  230. package/dist/utils/stealth-transfer.d.ts +28 -2
  231. package/dist/utils/stealth-transfer.js +15 -31
  232. package/dist/utils/swap-helpers.d.ts +15 -2
  233. package/dist/utils/swap-helpers.js +11 -6
  234. package/dist/utils/wallet.d.ts +25 -2
  235. package/dist/utils/wallet.js +10 -13
  236. package/package.json +4 -160
  237. package/dist/__tests__/subpath-exports.test.d.ts +0 -1
  238. package/dist/__tests__/subpath-exports.test.js +0 -64
  239. package/dist/abis/common.d.ts +0 -85
  240. package/dist/abis/common.js +0 -260
  241. package/dist/abis/contracts/TaxToken.json +0 -969
  242. package/dist/abis/contracts/TokenManager2.json +0 -136
  243. package/dist/abis/contracts/index.d.ts +0 -5
  244. package/dist/abis/contracts/index.js +0 -5
  245. package/dist/abis/flap/index.d.ts +0 -3
  246. package/dist/abis/flap/index.js +0 -3
  247. package/dist/abis/flap/portal-events.d.ts +0 -6
  248. package/dist/abis/flap/portal-events.js +0 -17
  249. package/dist/abis/flap/portal.d.ts +0 -6
  250. package/dist/abis/flap/portal.js +0 -37
  251. package/dist/abis/flap/vault.d.ts +0 -171
  252. package/dist/abis/flap/vault.js +0 -91
  253. package/dist/abis/index.d.ts +0 -8
  254. package/dist/abis/index.js +0 -11
  255. package/dist/bundle-core/__tests__/config-helpers.test.d.ts +0 -1
  256. package/dist/bundle-core/__tests__/config-helpers.test.js +0 -28
  257. package/dist/bundle-core/__tests__/facade-parity.test.d.ts +0 -1
  258. package/dist/bundle-core/__tests__/facade-parity.test.js +0 -33
  259. package/dist/bundle-core/__tests__/sign-context-helpers.test.d.ts +0 -1
  260. package/dist/bundle-core/__tests__/sign-context-helpers.test.js +0 -60
  261. package/dist/bundle-core/__tests__/sign-fixture.test.d.ts +0 -1
  262. package/dist/bundle-core/__tests__/sign-fixture.test.js +0 -220
  263. package/dist/bundle-core/__tests__/sign-fixtures.d.ts +0 -10
  264. package/dist/bundle-core/__tests__/sign-fixtures.js +0 -16
  265. package/dist/bundle-core/config-helpers.d.ts +0 -36
  266. package/dist/bundle-core/config-helpers.js +0 -57
  267. package/dist/bundle-core/errors.d.ts +0 -50
  268. package/dist/bundle-core/errors.js +0 -35
  269. package/dist/bundle-core/four-meme/approve-tokenmanager.d.ts +0 -7
  270. package/dist/bundle-core/four-meme/approve-tokenmanager.js +0 -99
  271. package/dist/bundle-core/four-meme/core-helpers.d.ts +0 -8
  272. package/dist/bundle-core/four-meme/core-helpers.js +0 -40
  273. package/dist/bundle-core/four-meme/core.d.ts +0 -4
  274. package/dist/bundle-core/four-meme/core.js +0 -515
  275. package/dist/bundle-core/four-meme/pancake-proxy.d.ts +0 -28
  276. package/dist/bundle-core/four-meme/pancake-proxy.js +0 -679
  277. package/dist/bundle-core/four-meme/private.d.ts +0 -27
  278. package/dist/bundle-core/four-meme/private.js +0 -465
  279. package/dist/bundle-core/four-meme/sign-context-helpers.d.ts +0 -2
  280. package/dist/bundle-core/four-meme/sign-context-helpers.js +0 -2
  281. package/dist/bundle-core/four-meme/swap-buy-first.d.ts +0 -8
  282. package/dist/bundle-core/four-meme/swap-buy-first.js +0 -493
  283. package/dist/bundle-core/four-meme/swap-hop-helpers.d.ts +0 -6
  284. package/dist/bundle-core/four-meme/swap-hop-helpers.js +0 -63
  285. package/dist/bundle-core/four-meme/swap-internal.d.ts +0 -3
  286. package/dist/bundle-core/four-meme/swap-internal.js +0 -18
  287. package/dist/bundle-core/four-meme/swap-sign-helpers.d.ts +0 -27
  288. package/dist/bundle-core/four-meme/swap-sign-helpers.js +0 -105
  289. package/dist/bundle-core/four-meme/swap.d.ts +0 -17
  290. package/dist/bundle-core/four-meme/swap.js +0 -505
  291. package/dist/bundle-core/four-meme/types/buy-first.d.ts +0 -50
  292. package/dist/bundle-core/four-meme/types/buy-first.js +0 -1
  293. package/dist/bundle-core/four-meme/types/core-flow.d.ts +0 -63
  294. package/dist/bundle-core/four-meme/types/core-flow.js +0 -1
  295. package/dist/bundle-core/four-meme/types/index.d.ts +0 -600
  296. package/dist/bundle-core/four-meme/types/index.js +0 -1
  297. package/dist/bundle-core/four-meme/types/swap-internal.d.ts +0 -19
  298. package/dist/bundle-core/four-meme/types/swap-internal.js +0 -1
  299. package/dist/bundle-core/four-meme/types.d.ts +0 -1
  300. package/dist/bundle-core/four-meme/types.js +0 -1
  301. package/dist/bundle-core/four-meme/utils-disperse.d.ts +0 -7
  302. package/dist/bundle-core/four-meme/utils-disperse.js +0 -396
  303. package/dist/bundle-core/four-meme/utils-pairwise.d.ts +0 -8
  304. package/dist/bundle-core/four-meme/utils-pairwise.js +0 -328
  305. package/dist/bundle-core/four-meme/utils-sweep.d.ts +0 -8
  306. package/dist/bundle-core/four-meme/utils-sweep.js +0 -744
  307. package/dist/bundle-core/index.d.ts +0 -8
  308. package/dist/bundle-core/index.js +0 -8
  309. package/dist/bundle-core/internal.d.ts +0 -21
  310. package/dist/bundle-core/internal.js +0 -182
  311. package/dist/bundle-core/sign-context-helpers.d.ts +0 -25
  312. package/dist/bundle-core/sign-context-helpers.js +0 -67
  313. package/dist/bundle-core/submit.d.ts +0 -293
  314. package/dist/bundle-core/submit.js +0 -727
  315. package/dist/bundle-core/types/index.d.ts +0 -8
  316. package/dist/bundle-core/types/index.js +0 -1
  317. package/dist/bundle-core/types.d.ts +0 -1
  318. package/dist/bundle-core/types.js +0 -1
  319. package/dist/chains/bsc/four/utils-disperse.d.ts +0 -1
  320. package/dist/chains/bsc/four/utils-disperse.js +0 -1
  321. package/dist/chains/bsc/four/utils-pairwise.d.ts +0 -1
  322. package/dist/chains/bsc/four/utils-pairwise.js +0 -1
  323. package/dist/chains/bsc/four/utils-sweep.d.ts +0 -1
  324. package/dist/chains/bsc/four/utils-sweep.js +0 -1
  325. package/dist/chains/bsc/iro.d.ts +0 -5
  326. package/dist/chains/bsc/iro.js +0 -4
  327. package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +0 -159
  328. package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +0 -117
  329. package/dist/chains/bsc/pancake/bundle-swap-helpers.d.ts +0 -241
  330. package/dist/chains/bsc/pancake/bundle-swap-helpers.js +0 -565
  331. package/dist/chains/eni/flat-aliases.d.ts +0 -10
  332. package/dist/chains/eni/flat-aliases.js +0 -8
  333. package/dist/chains/eni/submit.d.ts +0 -43
  334. package/dist/chains/eni/submit.js +0 -286
  335. package/dist/chains/xlayer/eip7702/flat-aliases.d.ts +0 -13
  336. package/dist/chains/xlayer/eip7702/flat-aliases.js +0 -10
  337. package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.d.ts +0 -79
  338. package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.js +0 -1
  339. package/dist/chains/xlayer/eip7702/transfer-context-helpers.d.ts +0 -26
  340. package/dist/chains/xlayer/eip7702/transfer-context-helpers.js +0 -57
  341. package/dist/chains/xlayer/eip7702/volume-helpers.d.ts +0 -148
  342. package/dist/chains/xlayer/eip7702/volume-helpers.js +0 -48
  343. package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts +0 -126
  344. package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +0 -228
  345. package/dist/contracts/tm-bundle-helpers.d.ts +0 -88
  346. package/dist/contracts/tm-bundle-helpers.js +0 -72
  347. package/dist/contracts/tm-bundle-merkle/utils-disperse.d.ts +0 -1
  348. package/dist/contracts/tm-bundle-merkle/utils-disperse.js +0 -1
  349. package/dist/contracts/tm-bundle-merkle/utils-pairwise.d.ts +0 -1
  350. package/dist/contracts/tm-bundle-merkle/utils-pairwise.js +0 -1
  351. package/dist/contracts/tm-bundle-merkle/utils-sweep.d.ts +0 -1
  352. package/dist/contracts/tm-bundle-merkle/utils-sweep.js +0 -1
  353. package/dist/dex/direct-router-helpers.d.ts +0 -264
  354. package/dist/dex/direct-router-helpers.js +0 -539
  355. package/dist/dex/types.d.ts +0 -81
  356. package/dist/dex/types.js +0 -1
  357. package/dist/exports/root-bundle-and-tooling.d.ts +0 -27
  358. package/dist/exports/root-bundle-and-tooling.js +0 -30
  359. package/dist/exports/root-eni-and-bsc-iro.d.ts +0 -26
  360. package/dist/exports/root-eni-and-bsc-iro.js +0 -66
  361. package/dist/exports/root-foundations.d.ts +0 -35
  362. package/dist/exports/root-foundations.js +0 -70
  363. package/dist/exports/root-swap-dex-and-xlayer.d.ts +0 -30
  364. package/dist/exports/root-swap-dex-and-xlayer.js +0 -78
  365. package/dist/flap/index.d.ts +0 -10
  366. package/dist/flap/index.js +0 -8
  367. package/dist/flows/index.d.ts +0 -1
  368. package/dist/flows/index.js +0 -1
  369. package/dist/merkle/index.d.ts +0 -12
  370. package/dist/merkle/index.js +0 -11
  371. package/dist/shared/clients/index.d.ts +0 -8
  372. package/dist/shared/clients/index.js +0 -8
  373. package/dist/shared/constants/quote.d.ts +0 -30
  374. package/dist/shared/constants/quote.js +0 -37
  375. package/dist/shared/flap/portal-bundle-merkle/core-helpers.d.ts +0 -32
  376. package/dist/shared/flap/portal-bundle-merkle/core-helpers.js +0 -83
  377. package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +0 -125
  378. package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.js +0 -113
  379. package/dist/shared/flap/portal-bundle-merkle/swap-helpers.d.ts +0 -149
  380. package/dist/shared/flap/portal-bundle-merkle/swap-helpers.js +0 -259
  381. package/dist/shared/foundation/dex/v3-path.d.ts +0 -6
  382. package/dist/shared/foundation/dex/v3-path.js +0 -35
  383. package/dist/shared/foundation/gas/bundle-gas.d.ts +0 -49
  384. package/dist/shared/foundation/gas/bundle-gas.js +0 -93
  385. package/dist/shared/foundation/gas/profit-hop.d.ts +0 -20
  386. package/dist/shared/foundation/gas/profit-hop.js +0 -72
  387. package/dist/shared/foundation/index.d.ts +0 -13
  388. package/dist/shared/foundation/index.js +0 -12
  389. package/dist/shared/foundation/nonce/nonce-manager.d.ts +0 -17
  390. package/dist/shared/foundation/nonce/nonce-manager.js +0 -183
  391. package/dist/shared/foundation/normalize-unknown.d.ts +0 -9
  392. package/dist/shared/foundation/normalize-unknown.js +0 -29
  393. package/dist/shared/foundation/sdk-logger.d.ts +0 -13
  394. package/dist/shared/foundation/sdk-logger.js +0 -12
  395. package/dist/shared/foundation/tx/build-request.d.ts +0 -17
  396. package/dist/shared/foundation/tx/build-request.js +0 -25
  397. package/dist/shared/foundation/tx/sign-batch.d.ts +0 -5
  398. package/dist/shared/foundation/tx/sign-batch.js +0 -26
  399. package/dist/shared/foundation/tx/wallet-sign-patch.d.ts +0 -1
  400. package/dist/shared/foundation/tx/wallet-sign-patch.js +0 -18
  401. package/dist/shared/foundation/types/airdrop-sweep.d.ts +0 -79
  402. package/dist/shared/foundation/types/airdrop-sweep.js +0 -1
  403. package/dist/shared/foundation/types/erc20.d.ts +0 -65
  404. package/dist/shared/foundation/types/erc20.js +0 -1
  405. package/dist/shared/foundation/types/holders-maker.d.ts +0 -64
  406. package/dist/shared/foundation/types/holders-maker.js +0 -1
  407. package/dist/shared/foundation/types/index.d.ts +0 -7
  408. package/dist/shared/foundation/types/index.js +0 -1
  409. package/dist/shared/foundation/types/lp-inspect.d.ts +0 -102
  410. package/dist/shared/foundation/types/lp-inspect.js +0 -1
  411. package/dist/shared/foundation/types/multicall.d.ts +0 -5
  412. package/dist/shared/foundation/types/multicall.js +0 -1
  413. package/dist/shared/foundation/types/private-sale.d.ts +0 -35
  414. package/dist/shared/foundation/types/private-sale.js +0 -1
  415. package/dist/shared/foundation/types/quote-helpers.d.ts +0 -17
  416. package/dist/shared/foundation/types/quote-helpers.js +0 -1
  417. package/dist/types/errors.d.ts +0 -27
  418. package/dist/types/errors.js +0 -34
  419. package/dist/utils/holders-maker/addresses.d.ts +0 -12
  420. package/dist/utils/holders-maker/addresses.js +0 -15
  421. package/dist/utils/holders-maker/buy-tx.d.ts +0 -44
  422. package/dist/utils/holders-maker/buy-tx.js +0 -278
  423. package/dist/utils/holders-maker/constants.d.ts +0 -6
  424. package/dist/utils/holders-maker/constants.js +0 -7
  425. package/dist/utils/holders-maker/disperse.d.ts +0 -18
  426. package/dist/utils/holders-maker/disperse.js +0 -90
  427. package/dist/utils/holders-maker/routing.d.ts +0 -4
  428. package/dist/utils/holders-maker/routing.js +0 -45
  429. package/dist/utils/holders-maker/transfer-tx.d.ts +0 -4
  430. package/dist/utils/holders-maker/transfer-tx.js +0 -67
  431. package/dist/utils/holders-maker-helpers.d.ts +0 -9
  432. package/dist/utils/holders-maker-helpers.js +0 -9
  433. package/dist/utils/hop-chains.d.ts +0 -35
  434. package/dist/utils/hop-chains.js +0 -215
  435. package/dist/utils/lp-inspect-helpers.d.ts +0 -9
  436. package/dist/utils/lp-inspect-helpers.js +0 -109
  437. package/dist/utils/types/airdrop-sweep.d.ts +0 -1
  438. package/dist/utils/types/airdrop-sweep.js +0 -1
  439. package/dist/utils/types/contract-factory.d.ts +0 -1
  440. package/dist/utils/types/contract-factory.js +0 -1
  441. package/dist/utils/types/erc20.d.ts +0 -1
  442. package/dist/utils/types/erc20.js +0 -1
  443. package/dist/utils/types/errors.d.ts +0 -1
  444. package/dist/utils/types/errors.js +0 -1
  445. package/dist/utils/types/holders-maker.d.ts +0 -1
  446. package/dist/utils/types/holders-maker.js +0 -1
  447. package/dist/utils/types/hop-chains.d.ts +0 -8
  448. package/dist/utils/types/hop-chains.js +0 -1
  449. package/dist/utils/types/index.d.ts +0 -13
  450. package/dist/utils/types/index.js +0 -1
  451. package/dist/utils/types/lp-inspect.d.ts +0 -1
  452. package/dist/utils/types/lp-inspect.js +0 -1
  453. package/dist/utils/types/mpc-exclusive.d.ts +0 -5
  454. package/dist/utils/types/mpc-exclusive.js +0 -1
  455. package/dist/utils/types/private-sale.d.ts +0 -1
  456. package/dist/utils/types/private-sale.js +0 -1
  457. package/dist/utils/types/quote-helpers.d.ts +0 -1
  458. package/dist/utils/types/quote-helpers.js +0 -1
  459. package/dist/utils/types/stealth-transfer.d.ts +0 -44
  460. package/dist/utils/types/stealth-transfer.js +0 -1
  461. package/dist/utils/types/wallet.d.ts +0 -25
  462. package/dist/utils/types/wallet.js +0 -1
  463. package/dist/vanity/index.d.ts +0 -5
  464. package/dist/vanity/index.js +0 -5
  465. package/src/abis/contracts/TaxToken.json +0 -969
  466. package/src/abis/contracts/TokenManager.json +0 -836
  467. package/src/abis/contracts/TokenManager2.json +0 -136
  468. package/src/abis/contracts/TokenManagerHelper3.json +0 -993
  469. /package/dist/{abis/contracts → shared/abis}/TokenManager.json +0 -0
  470. /package/dist/{abis/contracts → shared/abis}/TokenManagerHelper3.json +0 -0
@@ -5,9 +5,8 @@
5
5
  * 提供代币 Logo、社交链接、描述等元信息查询
6
6
  */
7
7
  import { Contract, JsonRpcProvider } from 'ethers';
8
- import { ENI_CHAIN_ID, ENI_RPC_URL, LP_FAIR_LAUNCHER_ABI } from '../../constants.js';
9
- import { LP_FAIR_LAUNCHER_ADDRESS } from '../fair-launch/constants.js';
10
- import { ERC20_ABI } from '../../../../abis/common.js';
8
+ import { ENI_CHAIN_ID, ENI_RPC_URL, } from '../../constants.js';
9
+ import { ERC20_ABI } from '../../../../shared/abis/common.js';
11
10
  /**
12
11
  * 从 ERC20 合约获取 DAOaaS Portal 代币基本元数据
13
12
  * Portal 的 getTokenState 仅返回状态码,name/symbol 从 ERC20 接口获取
@@ -22,9 +21,7 @@ export async function getTokenMeta(token, rpcUrl = ENI_RPC_URL) {
22
21
  tokenContract.symbol(),
23
22
  ]);
24
23
  }
25
- catch {
26
- /* ignore */
27
- }
24
+ catch { /* ignore */ }
28
25
  return {
29
26
  token,
30
27
  name,
@@ -42,6 +39,8 @@ export async function getTokenMeta(token, rpcUrl = ENI_RPC_URL) {
42
39
  * FairLaunch 代币的 logo 和 metadata 存储在 LaunchParams 中
43
40
  */
44
41
  export async function getFairLaunchTokenMeta(token, rpcUrl = ENI_RPC_URL) {
42
+ const { LP_FAIR_LAUNCHER_ABI } = await import('../../constants.js');
43
+ const { LP_FAIR_LAUNCHER_ADDRESS } = await import('../fair-launch/constants.js');
45
44
  const provider = new JsonRpcProvider(rpcUrl, ENI_CHAIN_ID, { staticNetwork: true });
46
45
  const launcher = new Contract(LP_FAIR_LAUNCHER_ADDRESS, LP_FAIR_LAUNCHER_ABI, provider);
47
46
  const info = await launcher.getTokenInfoByToken(token);
@@ -51,9 +50,7 @@ export async function getFairLaunchTokenMeta(token, rpcUrl = ENI_RPC_URL) {
51
50
  meta = JSON.parse(info.metadata);
52
51
  }
53
52
  }
54
- catch {
55
- /* metadata may not be valid JSON */
56
- }
53
+ catch { /* metadata may not be valid JSON */ }
57
54
  return {
58
55
  token: info.token ?? token,
59
56
  name: info.name ?? '',
@@ -5,7 +5,7 @@
5
5
  * 等同于 BSC EOA 普通模式 / Monad direct 模式
6
6
  */
7
7
  import { Wallet, JsonRpcProvider } from 'ethers';
8
- import { ENI_CHAIN_ID, ENI_RPC_URL, DAOAAS_PORTAL, NATIVE_TRANSFER_GAS_LIMIT } from '../../constants.js';
8
+ import { ENI_CHAIN_ID, ENI_RPC_URL, DAOAAS_PORTAL, NATIVE_TRANSFER_GAS_LIMIT, } from '../../constants.js';
9
9
  import { encodeBuyCall, encodeSellCall, applySlippage, DaoaasPortalQuery } from './portal.js';
10
10
  import { getProfitRecipient, getProfitRateBps, calculateProfitAmount } from '../../../../shared/constants/profit.js';
11
11
  const NORMAL_PROFIT_BPS = getProfitRateBps('normal');
@@ -45,7 +45,7 @@ export async function directBuy(params) {
45
45
  const provider = new JsonRpcProvider(params.rpcUrl ?? ENI_RPC_URL, ENI_CHAIN_ID, { staticNetwork: true });
46
46
  const wallet = new Wallet(params.privateKey, provider);
47
47
  const calldata = encodeBuyCall(params.token, params.amountOutMin ?? 0n);
48
- const nonce = params.nonce ?? (await wallet.getNonce('pending'));
48
+ const nonce = params.nonce ?? await wallet.getNonce('pending');
49
49
  const feeData = await provider.getFeeData();
50
50
  const tx = await wallet.signTransaction({
51
51
  to: DAOAAS_PORTAL,
@@ -70,7 +70,7 @@ export async function directSell(params) {
70
70
  const provider = new JsonRpcProvider(params.rpcUrl ?? ENI_RPC_URL, ENI_CHAIN_ID, { staticNetwork: true });
71
71
  const wallet = new Wallet(params.privateKey, provider);
72
72
  const calldata = encodeSellCall(params.token, params.tokenAmount, params.amountOutMin ?? 0n);
73
- const nonce = params.nonce ?? (await wallet.getNonce('pending'));
73
+ const nonce = params.nonce ?? await wallet.getNonce('pending');
74
74
  const feeData = await provider.getFeeData();
75
75
  const tx = await wallet.signTransaction({
76
76
  to: DAOAAS_PORTAL,
@@ -260,7 +260,7 @@ export async function directSellForSubmit(params) {
260
260
  };
261
261
  }
262
262
  export async function directBatchBuyForSubmit(params) {
263
- const { rpcUrl = ENI_RPC_URL, token, privateKeys: rawKeys, amounts: rawAmounts, slippageBps = 100, gasPrice, } = params;
263
+ const { rpcUrl = ENI_RPC_URL, token, privateKeys: rawKeys, amounts: rawAmounts, slippageBps = 100, gasPrice } = params;
264
264
  if (rawKeys.length !== rawAmounts.length) {
265
265
  throw new Error(`privateKeys.length (${rawKeys.length}) !== amounts.length (${rawAmounts.length})`);
266
266
  }
@@ -277,8 +277,8 @@ export async function directBatchBuyForSubmit(params) {
277
277
  const totalFlowRaw = rawAmounts.reduce((sum, amount) => sum + amount, 0n);
278
278
  const profitAmountFull = calculateProfitAmount(totalFlowRaw, NORMAL_PROFIT_BPS) + profitTxGasCost;
279
279
  const maxPayerIdx = pickMaxAmountIndex(rawAmounts);
280
- const wallets = rawKeys.map((pk) => new Wallet(pk, provider));
281
- const balances = await Promise.all(wallets.map((w) => provider.getBalance(w.address)));
280
+ const wallets = rawKeys.map(pk => new Wallet(pk, provider));
281
+ const balances = await Promise.all(wallets.map(w => provider.getBalance(w.address)));
282
282
  let privateKeys = rawKeys;
283
283
  let amounts = rawAmounts;
284
284
  const validIndices = [];
@@ -287,6 +287,7 @@ export async function directBatchBuyForSubmit(params) {
287
287
  if (i === maxPayerIdx)
288
288
  required += profitAmountFull + NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
289
289
  if (balances[i] < required) {
290
+ console.warn(`[DAOAAS BatchBuy] 钱包 ${wallets[i].address.slice(0, 10)} 余额不足: 余额=${balances[i]}, 需要=${required},跳过`);
290
291
  continue;
291
292
  }
292
293
  validIndices.push(i);
@@ -295,8 +296,9 @@ export async function directBatchBuyForSubmit(params) {
295
296
  throw new Error('所有钱包余额不足(含 swap + gas),无法执行 DAOAAS 买入');
296
297
  }
297
298
  if (validIndices.length < rawKeys.length) {
298
- privateKeys = validIndices.map((i) => rawKeys[i]);
299
- amounts = validIndices.map((i) => rawAmounts[i]);
299
+ privateKeys = validIndices.map(i => rawKeys[i]);
300
+ amounts = validIndices.map(i => rawAmounts[i]);
301
+ console.log(`[DAOAAS BatchBuy] 余额预检: ${rawKeys.length - validIndices.length} 个钱包被跳过, 剩余 ${validIndices.length} 个`);
300
302
  }
301
303
  const transactions = [];
302
304
  const totalFlow = amounts.reduce((sum, amount) => sum + amount, 0n);
@@ -304,7 +306,9 @@ export async function directBatchBuyForSubmit(params) {
304
306
  for (let i = 0; i < privateKeys.length; i++) {
305
307
  const wallet = new Wallet(privateKeys[i], provider);
306
308
  const preview = await query.previewBuy(token, amounts[i]);
307
- const effectiveSlippage = isBatch ? Math.min(9500, slippageBps + i * 2000) : slippageBps;
309
+ const effectiveSlippage = isBatch
310
+ ? Math.min(9500, slippageBps + i * 2000)
311
+ : slippageBps;
308
312
  const minOut = applySlippage(preview, effectiveSlippage);
309
313
  const calldata = encodeBuyCall(token, minOut);
310
314
  const nonce = await wallet.getNonce('pending');
@@ -333,7 +337,7 @@ export async function directBatchBuyForSubmit(params) {
333
337
  });
334
338
  return {
335
339
  transactions,
336
- signedTransactions: [...transactions.map((tx) => tx.signedTx), profitTx.signedTx],
340
+ signedTransactions: [...transactions.map(tx => tx.signedTx), profitTx.signedTx],
337
341
  totalGasCost: swapGasLimit * maxFeePerGas * BigInt(transactions.length) + NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas,
338
342
  metadata: formatSubmitMetadata(totalFlow, profitAmount),
339
343
  };
@@ -352,7 +356,19 @@ export async function directBatchSellForSubmit(params) {
352
356
  const maxFeePerGas = gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
353
357
  const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
354
358
  const swapGasLimit = 300000n;
355
- const wallets = privateKeys.map((pk) => new Wallet(pk, provider));
359
+ const swapGasCost = swapGasLimit * maxFeePerGas;
360
+ const profitGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
361
+ const wallets = privateKeys.map(pk => new Wallet(pk, provider));
362
+ const balances = await Promise.all(wallets.map(w => provider.getBalance(w.address)));
363
+ const maxPayerIdx = pickMaxAmountIndex(tokenAmounts);
364
+ for (let i = 0; i < wallets.length; i++) {
365
+ let required = swapGasCost;
366
+ if (i === maxPayerIdx)
367
+ required += profitGasCost;
368
+ if (balances[i] < required) {
369
+ console.warn(`[DAOAAS BatchSell] 钱包 ${wallets[i].address.slice(0, 10)} 原生余额不足 gas: 余额=${balances[i]}, 需要=${required},可能导致交易失败`);
370
+ }
371
+ }
356
372
  const transactions = [];
357
373
  const estimatedOuts = [];
358
374
  const isBatch = privateKeys.length > 1;
@@ -360,7 +376,9 @@ export async function directBatchSellForSubmit(params) {
360
376
  const wallet = wallets[i];
361
377
  const preview = await query.previewSell(token, tokenAmounts[i]);
362
378
  estimatedOuts.push(preview);
363
- const effectiveSlippage = isBatch ? Math.min(9500, slippageBps + i * 2000) : slippageBps;
379
+ const effectiveSlippage = isBatch
380
+ ? Math.min(9500, slippageBps + i * 2000)
381
+ : slippageBps;
364
382
  const minOut = applySlippage(preview, effectiveSlippage);
365
383
  const calldata = encodeSellCall(token, tokenAmounts[i], minOut);
366
384
  const nonce = await wallet.getNonce('pending');
@@ -390,7 +408,7 @@ export async function directBatchSellForSubmit(params) {
390
408
  });
391
409
  return {
392
410
  transactions,
393
- signedTransactions: [...transactions.map((tx) => tx.signedTx), profitTx.signedTx],
411
+ signedTransactions: [...transactions.map(tx => tx.signedTx), profitTx.signedTx],
394
412
  totalGasCost: 300000n * maxFeePerGas * BigInt(transactions.length) + NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas,
395
413
  metadata: formatSubmitMetadata(totalFlow, profitAmount),
396
414
  };
@@ -421,9 +439,9 @@ export async function directQuickSwapForSubmit(params) {
421
439
  if (params.sellerKeys.length > 1) {
422
440
  for (let i = 1; i < params.sellerKeys.length; i++) {
423
441
  const otherWallet = new Wallet(params.sellerKeys[i], provider);
424
- const otherSellTxs = sellResult.transactions.filter((tx) => tx.from.toLowerCase() === otherWallet.address.toLowerCase());
442
+ const otherSellTxs = sellResult.transactions.filter(tx => tx.from.toLowerCase() === otherWallet.address.toLowerCase());
425
443
  const otherNextNonce = otherSellTxs.length > 0
426
- ? Math.max(...otherSellTxs.map((tx) => tx.nonce)) + 1
444
+ ? Math.max(...otherSellTxs.map(tx => tx.nonce)) + 1
427
445
  : await otherWallet.getNonce('pending');
428
446
  const otherBalance = await provider.getBalance(otherWallet.address);
429
447
  const reserveGas = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
@@ -447,23 +465,23 @@ export async function directQuickSwapForSubmit(params) {
447
465
  const hopCount = params.hopCount ?? 0;
448
466
  const distributeHopWallets = [];
449
467
  if (params.buyerKeys.length > 0) {
450
- const primarySellTxs = sellResult.transactions.filter((tx) => tx.from.toLowerCase() === primarySellerAddress);
468
+ const primarySellTxs = sellResult.transactions.filter(tx => tx.from.toLowerCase() === primarySellerAddress);
451
469
  let primaryNextNonce = primarySellTxs.length > 0
452
- ? Math.max(...primarySellTxs.map((tx) => tx.nonce)) + 1
470
+ ? Math.max(...primarySellTxs.map(tx => tx.nonce)) + 1
453
471
  : await primarySellerWallet.getNonce('pending');
454
472
  const gasForBuy = 300000n * maxFeePerGas;
455
473
  const hopGasFee = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
456
474
  const totalFlow = params.buyAmounts.reduce((sum, a) => sum + a, 0n);
457
475
  const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
458
476
  const profitAmount = calculateProfitAmount(totalFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
459
- const profitGasPerBuyer = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
477
+ const profitGasPerBuyer = (NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas);
460
478
  for (let i = 0; i < params.buyerKeys.length; i++) {
461
479
  const buyerAddress = new Wallet(params.buyerKeys[i]).address;
462
480
  const transferAmount = params.buyAmounts[i];
463
481
  if (transferAmount <= 0n)
464
482
  continue;
465
483
  const isMaxBuyer = i === pickMaxAmountIndex(params.buyAmounts);
466
- const extraForProfit = isMaxBuyer ? profitAmount + profitGasPerBuyer : 0n;
484
+ const extraForProfit = isMaxBuyer ? (profitAmount + profitGasPerBuyer) : 0n;
467
485
  const baseTransfer = transferAmount + gasForBuy + extraForProfit;
468
486
  if (hopCount <= 0) {
469
487
  const signedTx = await primarySellerWallet.signTransaction({
@@ -486,8 +504,8 @@ export async function directQuickSwapForSubmit(params) {
486
504
  hops.push({ address: w.address, privateKey: w.privateKey });
487
505
  }
488
506
  distributeHopWallets.push(hops);
489
- const fullChain = [primarySellerWallet, ...hops.map((h) => new Wallet(h.privateKey))];
490
- const addresses = [...fullChain.map((w) => w.address), buyerAddress];
507
+ const fullChain = [primarySellerWallet, ...hops.map(h => new Wallet(h.privateKey))];
508
+ const addresses = [...fullChain.map(w => w.address), buyerAddress];
491
509
  for (let j = 0; j < addresses.length - 1; j++) {
492
510
  const fromWallet = fullChain[j];
493
511
  const toAddress = addresses[j + 1];
@@ -527,10 +545,8 @@ export async function directQuickSwapForSubmit(params) {
527
545
  const payerIndex = pickMaxAmountIndex(params.buyAmounts);
528
546
  const payerKey = params.buyerKeys[payerIndex] || primarySellerKey;
529
547
  const payerAddress = new Wallet(payerKey).address.toLowerCase();
530
- const payerTxs = allTxs.filter((tx) => tx.from.toLowerCase() === payerAddress);
531
- const payerNonce = payerTxs.length > 0
532
- ? Math.max(...payerTxs.map((tx) => tx.nonce)) + 1
533
- : await new Wallet(payerKey, provider).getNonce('pending');
548
+ const payerTxs = allTxs.filter(tx => tx.from.toLowerCase() === payerAddress);
549
+ const payerNonce = payerTxs.length > 0 ? Math.max(...payerTxs.map(tx => tx.nonce)) + 1 : await new Wallet(payerKey, provider).getNonce('pending');
534
550
  const profitTx = await buildRevenueTail({
535
551
  rpcUrl,
536
552
  payerKey,
@@ -542,7 +558,7 @@ export async function directQuickSwapForSubmit(params) {
542
558
  const distributeGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas * BigInt(distributeTxs.length);
543
559
  return {
544
560
  transactions: allTxs,
545
- signedTransactions: [...allTxs.map((tx) => tx.signedTx), profitTx.signedTx],
561
+ signedTransactions: [...allTxs.map(tx => tx.signedTx), profitTx.signedTx],
546
562
  totalGasCost: sellResult.totalGasCost + distributeGasCost + buyResult.totalGasCost + NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas,
547
563
  metadata: formatSubmitMetadata(totalFlow, profitAmount),
548
564
  ...(distributeHopWallets.length > 0 ? { hopWallets: distributeHopWallets } : {}),
@@ -556,11 +572,11 @@ export async function directQuickSwapForSubmit(params) {
556
572
  * ENI 不需要多跳,直接转到收益地址
557
573
  */
558
574
  export async function buildProfitTransfer(params) {
559
- const { rpcUrl = ENI_RPC_URL, payerKey, profitAmount, gasPrice, nonce: explicitNonce, maxFeePerGas, maxPriorityFeePerGas, } = params;
575
+ const { rpcUrl = ENI_RPC_URL, payerKey, profitAmount, gasPrice, nonce: explicitNonce, maxFeePerGas, maxPriorityFeePerGas } = params;
560
576
  const provider = new JsonRpcProvider(rpcUrl, ENI_CHAIN_ID, { staticNetwork: true });
561
577
  const wallet = new Wallet(payerKey, provider);
562
578
  const feeData = await provider.getFeeData();
563
- const nonce = explicitNonce ?? (await wallet.getNonce('pending'));
579
+ const nonce = explicitNonce ?? await wallet.getNonce('pending');
564
580
  const resolvedMaxFeePerGas = maxFeePerGas ?? gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
565
581
  const resolvedMaxPriorityFeePerGas = maxPriorityFeePerGas ?? feeData.maxPriorityFeePerGas ?? 0n;
566
582
  const signedTx = await wallet.signTransaction({
@@ -5,8 +5,8 @@
5
5
  * 接口与 Flap Portal 不兼容,独立实现
6
6
  */
7
7
  import { Contract, Interface, JsonRpcProvider, formatEther, parseEther } from 'ethers';
8
- import { DAOAAS_PORTAL, DAOAAS_PORTAL_ABI, ENI_CHAIN_ID, ENI_MULTICALL3, ENI_RPC_URL } from '../../constants.js';
9
- import { ERC20_ABI, MULTICALL3_ABI } from '../../../../abis/common.js';
8
+ import { DAOAAS_PORTAL, DAOAAS_PORTAL_ABI, ENI_CHAIN_ID, ENI_MULTICALL3, ENI_RPC_URL, } from '../../constants.js';
9
+ import { ERC20_ABI, MULTICALL3_ABI } from '../../../../shared/abis/common.js';
10
10
  const portalIface = new Interface(DAOAAS_PORTAL_ABI);
11
11
  const erc20Iface = new Interface(ERC20_ABI);
12
12
  const multicallIface = new Interface(MULTICALL3_ABI);
@@ -34,10 +34,6 @@ export function encodeTransferCall(to, amount) {
34
34
  return erc20Iface.encodeFunctionData('transfer', [to, amount]);
35
35
  }
36
36
  export class DaoaasPortalQuery {
37
- provider;
38
- portal;
39
- portalAddress;
40
- multicall3Address;
41
37
  constructor(config = {}) {
42
38
  const rpcUrl = config.rpcUrl ?? ENI_RPC_URL;
43
39
  this.provider = new JsonRpcProvider(rpcUrl, ENI_CHAIN_ID, { staticNetwork: true });
@@ -60,7 +56,7 @@ export class DaoaasPortalQuery {
60
56
  /** 获取代币完整状态(链上 getTokenState 仅返回 uint256 状态码,其余数据分别查询) */
61
57
  async getTokenState(token) {
62
58
  const status = Number(await this.portal.getTokenState(token));
63
- const price = (await this.portal.getPrice(token));
59
+ const price = await this.portal.getPrice(token);
64
60
  const tokenContract = new Contract(token, ERC20_ABI, this.provider);
65
61
  const [totalSupply, portalBalance, name, symbol] = await Promise.all([
66
62
  tokenContract.totalSupply(),
@@ -73,7 +69,7 @@ export class DaoaasPortalQuery {
73
69
  }
74
70
  /** 批量获取钱包 EGAS 余额 */
75
71
  async getMultipleEgasBalances(addresses) {
76
- const calls = addresses.map((addr) => ({
72
+ const calls = addresses.map(addr => ({
77
73
  target: this.multicall3Address,
78
74
  allowFailure: true,
79
75
  callData: multicallIface.encodeFunctionData('getEthBalance', [addr]),
@@ -89,7 +85,7 @@ export class DaoaasPortalQuery {
89
85
  }
90
86
  /** 批量获取 ERC20 余额 */
91
87
  async getMultipleTokenBalances(token, addresses) {
92
- const calls = addresses.map((addr) => ({
88
+ const calls = addresses.map(addr => ({
93
89
  target: token,
94
90
  allowFailure: true,
95
91
  callData: erc20Iface.encodeFunctionData('balanceOf', [addr]),
@@ -105,7 +101,7 @@ export class DaoaasPortalQuery {
105
101
  }
106
102
  /** 批量获取 ERC20 allowance */
107
103
  async getMultipleAllowances(token, owners, spender) {
108
- const calls = owners.map((owner) => ({
104
+ const calls = owners.map(owner => ({
109
105
  target: token,
110
106
  allowFailure: true,
111
107
  callData: erc20Iface.encodeFunctionData('allowance', [owner, spender]),
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import { Wallet, JsonRpcProvider, Contract, ethers, Interface } from 'ethers';
11
11
  import { ENI_CHAIN_ID, ENI_RPC_URL, WEGAS, NATIVE_TRANSFER_GAS_LIMIT, DSWAP_V2_ROUTER, DSWAP_V2_FACTORY, DSWAP_V2_ROUTER_ABI, DSWAP_V2_FACTORY_ABI, DSWAP_V2_PAIR_ABI, } from '../../constants.js';
12
- import { ERC20_ABI } from '../../../../abis/common.js';
12
+ import { ERC20_ABI } from '../../../../shared/abis/common.js';
13
13
  import { getProfitRecipient, getProfitRateBps, calculateProfitAmount } from '../../../../shared/constants/profit.js';
14
14
  const DEFAULT_DEADLINE_MINUTES = 20;
15
15
  const DEFAULT_SLIPPAGE_PCT = 5;
@@ -25,7 +25,7 @@ function getDeadline(minutes) {
25
25
  }
26
26
  function applySlippage(amount, slippagePct) {
27
27
  const pct = Math.max(0, Math.min(100, slippagePct));
28
- return (amount * BigInt(100 - Math.floor(pct))) / 100n;
28
+ return amount * BigInt(100 - Math.floor(pct)) / 100n;
29
29
  }
30
30
  async function signProfitTx(params) {
31
31
  return params.wallet.signTransaction({
@@ -64,11 +64,17 @@ export async function getLPPairInfo(params) {
64
64
  ]);
65
65
  let userLPBalance = 0n;
66
66
  if (params.userAddress) {
67
- userLPBalance = (await pair.balanceOf(params.userAddress));
67
+ userLPBalance = await pair.balanceOf(params.userAddress);
68
68
  }
69
- const userShare = totalSupply > 0n ? Number((userLPBalance * 10000n) / totalSupply) / 10000 : 0;
70
- const userToken0Amount = totalSupply > 0n ? (reserves[0] * userLPBalance) / totalSupply : 0n;
71
- const userToken1Amount = totalSupply > 0n ? (reserves[1] * userLPBalance) / totalSupply : 0n;
69
+ const userShare = totalSupply > 0n
70
+ ? Number(userLPBalance * 10000n / totalSupply) / 10000
71
+ : 0;
72
+ const userToken0Amount = totalSupply > 0n
73
+ ? reserves[0] * userLPBalance / totalSupply
74
+ : 0n;
75
+ const userToken1Amount = totalSupply > 0n
76
+ ? reserves[1] * userLPBalance / totalSupply
77
+ : 0n;
72
78
  return {
73
79
  pairAddress: pairAddr,
74
80
  token0,
@@ -83,7 +89,7 @@ export async function getLPPairInfo(params) {
83
89
  };
84
90
  }
85
91
  export async function batchGetLPPairInfo(params) {
86
- return Promise.all(params.tokens.map((token) => getLPPairInfo({ rpcUrl: params.rpcUrl, token, userAddress: params.userAddress })));
92
+ return Promise.all(params.tokens.map(token => getLPPairInfo({ rpcUrl: params.rpcUrl, token, userAddress: params.userAddress })));
87
93
  }
88
94
  // ============================================================================
89
95
  // 创建/添加 流动性 — EGAS + Token
@@ -117,12 +123,7 @@ export async function addLiquidityETHForSubmit(params) {
117
123
  const amountTokenMin = applySlippage(amountTokenDesired, slippage);
118
124
  const amountETHMin = applySlippage(amountETHDesired, slippage);
119
125
  const addLiqData = routerIface.encodeFunctionData('addLiquidityETH', [
120
- token,
121
- amountTokenDesired,
122
- amountTokenMin,
123
- amountETHMin,
124
- wallet.address,
125
- deadline,
126
+ token, amountTokenDesired, amountTokenMin, amountETHMin, wallet.address, deadline,
126
127
  ]);
127
128
  const addLiqTx = await wallet.signTransaction({
128
129
  to: DSWAP_V2_ROUTER,
@@ -139,13 +140,7 @@ export async function addLiquidityETHForSubmit(params) {
139
140
  const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
140
141
  const profitAmount = calculateProfitAmount(amountETHDesired, PROFIT_BPS) + profitTxGasCost;
141
142
  if (profitAmount > 0n) {
142
- const profitTx = await signProfitTx({
143
- wallet,
144
- nonce: currentNonce,
145
- profitAmount,
146
- maxFeePerGas,
147
- maxPriorityFeePerGas,
148
- });
143
+ const profitTx = await signProfitTx({ wallet, nonce: currentNonce, profitAmount, maxFeePerGas, maxPriorityFeePerGas });
149
144
  signedTxs.push(profitTx);
150
145
  }
151
146
  return { signedTransactions: signedTxs };
@@ -170,7 +165,7 @@ export async function removeLiquidityETHForSubmit(params) {
170
165
  const pair = new Contract(pairAddr, DSWAP_V2_PAIR_ABI, provider);
171
166
  let liquidity = params.liquidity;
172
167
  if (liquidity === 0n) {
173
- liquidity = (await pair.balanceOf(wallet.address));
168
+ liquidity = await pair.balanceOf(wallet.address);
174
169
  if (liquidity === 0n)
175
170
  throw new Error('No LP tokens to remove');
176
171
  }
@@ -182,8 +177,8 @@ export async function removeLiquidityETHForSubmit(params) {
182
177
  const isToken0 = token.toLowerCase() === token0.toLowerCase();
183
178
  const reserveToken = isToken0 ? reserves[0] : reserves[1];
184
179
  const reserveETH = isToken0 ? reserves[1] : reserves[0];
185
- const amountTokenExpected = (reserveToken * liquidity) / totalSupply;
186
- const amountETHExpected = (reserveETH * liquidity) / totalSupply;
180
+ const amountTokenExpected = reserveToken * liquidity / totalSupply;
181
+ const amountETHExpected = reserveETH * liquidity / totalSupply;
187
182
  const amountTokenMin = applySlippage(amountTokenExpected, slippage);
188
183
  const amountETHMin = applySlippage(amountETHExpected, slippage);
189
184
  let currentNonce = await wallet.getNonce();
@@ -203,12 +198,7 @@ export async function removeLiquidityETHForSubmit(params) {
203
198
  signedTxs.push(approveTx);
204
199
  }
205
200
  const removeLiqData = routerIface.encodeFunctionData('removeLiquidityETHSupportingFeeOnTransferTokens', [
206
- token,
207
- liquidity,
208
- amountTokenMin,
209
- amountETHMin,
210
- wallet.address,
211
- deadline,
201
+ token, liquidity, amountTokenMin, amountETHMin, wallet.address, deadline,
212
202
  ]);
213
203
  const removeLiqTx = await wallet.signTransaction({
214
204
  to: DSWAP_V2_ROUTER,
@@ -225,13 +215,7 @@ export async function removeLiquidityETHForSubmit(params) {
225
215
  const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
226
216
  const profitAmount = calculateProfitAmount(amountETHExpected, PROFIT_BPS) + profitTxGasCost;
227
217
  if (profitAmount > 0n) {
228
- const profitTx = await signProfitTx({
229
- wallet,
230
- nonce: currentNonce,
231
- profitAmount,
232
- maxFeePerGas,
233
- maxPriorityFeePerGas,
234
- });
218
+ const profitTx = await signProfitTx({ wallet, nonce: currentNonce, profitAmount, maxFeePerGas, maxPriorityFeePerGas });
235
219
  signedTxs.push(profitTx);
236
220
  }
237
221
  return { signedTransactions: signedTxs };
@@ -250,10 +234,7 @@ export async function addLiquidityForSubmit(params) {
250
234
  const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
251
235
  let currentNonce = await wallet.getNonce();
252
236
  const signedTxs = [];
253
- for (const [token, amount] of [
254
- [tokenA, amountADesired],
255
- [tokenB, amountBDesired],
256
- ]) {
237
+ for (const [token, amount] of [[tokenA, amountADesired], [tokenB, amountBDesired]]) {
257
238
  const erc20 = new Contract(token, ERC20_ABI, provider);
258
239
  const allowance = await erc20.allowance(wallet.address, DSWAP_V2_ROUTER);
259
240
  if (allowance < amount) {
@@ -273,14 +254,7 @@ export async function addLiquidityForSubmit(params) {
273
254
  const amountAMin = applySlippage(amountADesired, slippage);
274
255
  const amountBMin = applySlippage(amountBDesired, slippage);
275
256
  const addLiqData = routerIface.encodeFunctionData('addLiquidity', [
276
- tokenA,
277
- tokenB,
278
- amountADesired,
279
- amountBDesired,
280
- amountAMin,
281
- amountBMin,
282
- wallet.address,
283
- deadline,
257
+ tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin, wallet.address, deadline,
284
258
  ]);
285
259
  const addLiqTx = await wallet.signTransaction({
286
260
  to: DSWAP_V2_ROUTER,
@@ -316,7 +290,7 @@ export async function removeLiquidityForSubmit(params) {
316
290
  const pair = new Contract(pairAddr, DSWAP_V2_PAIR_ABI, provider);
317
291
  let liquidity = params.liquidity;
318
292
  if (liquidity === 0n) {
319
- liquidity = (await pair.balanceOf(wallet.address));
293
+ liquidity = await pair.balanceOf(wallet.address);
320
294
  if (liquidity === 0n)
321
295
  throw new Error('No LP tokens to remove');
322
296
  }
@@ -328,8 +302,8 @@ export async function removeLiquidityForSubmit(params) {
328
302
  const isAToken0 = tokenA.toLowerCase() === token0.toLowerCase();
329
303
  const reserveA = isAToken0 ? reserves[0] : reserves[1];
330
304
  const reserveB = isAToken0 ? reserves[1] : reserves[0];
331
- const amountAMin = applySlippage((reserveA * liquidity) / totalSupply, slippage);
332
- const amountBMin = applySlippage((reserveB * liquidity) / totalSupply, slippage);
305
+ const amountAMin = applySlippage(reserveA * liquidity / totalSupply, slippage);
306
+ const amountBMin = applySlippage(reserveB * liquidity / totalSupply, slippage);
333
307
  let currentNonce = await wallet.getNonce();
334
308
  const signedTxs = [];
335
309
  const lpAllowance = await pair.allowance(wallet.address, DSWAP_V2_ROUTER);
@@ -347,13 +321,7 @@ export async function removeLiquidityForSubmit(params) {
347
321
  signedTxs.push(approveTx);
348
322
  }
349
323
  const removeLiqData = routerIface.encodeFunctionData('removeLiquidity', [
350
- tokenA,
351
- tokenB,
352
- liquidity,
353
- amountAMin,
354
- amountBMin,
355
- wallet.address,
356
- deadline,
324
+ tokenA, tokenB, liquidity, amountAMin, amountBMin, wallet.address, deadline,
357
325
  ]);
358
326
  const removeLiqTx = await wallet.signTransaction({
359
327
  to: DSWAP_V2_ROUTER,
@@ -9,5 +9,5 @@ export type { LaunchParams, FairLaunchTokenInfo, FairLaunchQueryConfig, FairLaun
9
9
  export { LP_FAIR_LAUNCHER_ADDRESS, TOKEN_FACTORY_ADDRESS, POOL_FACTORY_ADDRESS, RATE_BASE, DEAD_ADDRESS, QUOTE_TOKENS, DEFAULT_LOCK_TIME, DEFAULT_RELEASE_PERIOD, DEFAULT_INITIAL_LP, } from './constants.js';
10
10
  export { standardPreset, liquidityProvidingPreset, dividendPreset, dividendBuybackPreset, deflationaryPreset, validateLaunchParams, detectLaunchType, } from './presets.js';
11
11
  export { FairLauncherQuery, encodeLaunchTokenCall, launchToken, launchTokenForSubmit, setTokenTradeStartTime, setTokenTradeStartTimeForSubmit, } from './launcher.js';
12
- export { FairPoolQuery, claimFromPool, claimFromPoolForSubmit, batchClaimForSubmit } from './pool.js';
13
- export type { PoolOverview, PoolClaimParams, PoolClaimResult } from './pool.js';
12
+ export { FairPoolQuery, claimFromPool, claimFromPoolForSubmit, batchClaimForSubmit, } from './pool.js';
13
+ export type { PoolOverview, PoolClaimParams, PoolClaimResult, } from './pool.js';
@@ -23,4 +23,4 @@ export { FairLauncherQuery, encodeLaunchTokenCall, launchToken, launchTokenForSu
23
23
  // ============================================================================
24
24
  // 池 (Pool)
25
25
  // ============================================================================
26
- export { FairPoolQuery, claimFromPool, claimFromPoolForSubmit, batchClaimForSubmit } from './pool.js';
26
+ export { FairPoolQuery, claimFromPool, claimFromPoolForSubmit, batchClaimForSubmit, } from './pool.js';