four-flap-meme-sdk 3.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (446) hide show
  1. package/dist/bundle/four-meme/approve-tokenmanager.d.ts +2 -2
  2. package/dist/bundle/four-meme/approve-tokenmanager.js +3 -3
  3. package/dist/bundle/four-meme/core/buy-flow.d.ts +5 -0
  4. package/dist/bundle/four-meme/core/buy-flow.js +147 -0
  5. package/dist/bundle/four-meme/core/constants.d.ts +6 -0
  6. package/dist/bundle/four-meme/core/constants.js +15 -0
  7. package/dist/bundle/four-meme/core/create-token.d.ts +5 -0
  8. package/dist/bundle/four-meme/core/create-token.js +137 -0
  9. package/dist/bundle/four-meme/core/index.d.ts +14 -0
  10. package/dist/bundle/four-meme/core/index.js +14 -0
  11. package/dist/bundle/four-meme/core/sell-flow.d.ts +5 -0
  12. package/dist/bundle/four-meme/core/sell-flow.js +240 -0
  13. package/dist/bundle/four-meme/core-helpers.js +1 -1
  14. package/dist/bundle/four-meme/core.d.ts +7 -4
  15. package/dist/bundle/four-meme/core.js +5 -513
  16. package/dist/bundle/four-meme/pancake-proxy/approve.d.ts +15 -0
  17. package/dist/bundle/four-meme/pancake-proxy/approve.js +113 -0
  18. package/dist/bundle/four-meme/pancake-proxy/buy.d.ts +8 -0
  19. package/dist/bundle/four-meme/pancake-proxy/buy.js +143 -0
  20. package/dist/bundle/four-meme/pancake-proxy/constants.d.ts +25 -0
  21. package/dist/bundle/four-meme/pancake-proxy/constants.js +14 -0
  22. package/dist/bundle/four-meme/pancake-proxy/helpers.d.ts +45 -0
  23. package/dist/bundle/four-meme/pancake-proxy/helpers.js +232 -0
  24. package/dist/bundle/four-meme/pancake-proxy/index.d.ts +15 -0
  25. package/dist/bundle/four-meme/pancake-proxy/index.js +15 -0
  26. package/dist/bundle/four-meme/pancake-proxy/sell.d.ts +8 -0
  27. package/dist/bundle/four-meme/pancake-proxy/sell.js +194 -0
  28. package/dist/bundle/four-meme/pancake-proxy.d.ts +4 -20
  29. package/dist/bundle/four-meme/pancake-proxy.js +3 -670
  30. package/dist/bundle/four-meme/private/buy.d.ts +16 -0
  31. package/dist/bundle/four-meme/private/buy.js +225 -0
  32. package/dist/bundle/four-meme/private/index.d.ts +11 -0
  33. package/dist/bundle/four-meme/private/index.js +11 -0
  34. package/dist/bundle/four-meme/private/sell.d.ts +18 -0
  35. package/dist/bundle/four-meme/private/sell.js +245 -0
  36. package/dist/bundle/four-meme/private.d.ts +5 -25
  37. package/dist/bundle/four-meme/private.js +5 -463
  38. package/dist/bundle/four-meme/swap/batch.d.ts +8 -0
  39. package/dist/bundle/four-meme/swap/batch.js +170 -0
  40. package/dist/bundle/four-meme/swap/bundle.d.ts +8 -0
  41. package/dist/bundle/four-meme/swap/bundle.js +147 -0
  42. package/dist/bundle/four-meme/swap/index.d.ts +14 -0
  43. package/dist/bundle/four-meme/swap/index.js +13 -0
  44. package/dist/bundle/four-meme/swap/quick-batch.d.ts +8 -0
  45. package/dist/bundle/four-meme/swap/quick-batch.js +206 -0
  46. package/dist/bundle/four-meme/swap-buy-first/helpers.d.ts +20 -0
  47. package/dist/bundle/four-meme/swap-buy-first/helpers.js +39 -0
  48. package/dist/bundle/four-meme/swap-buy-first/index.d.ts +12 -0
  49. package/dist/bundle/four-meme/swap-buy-first/index.js +11 -0
  50. package/dist/bundle/four-meme/swap-buy-first/multi-wallet.d.ts +20 -0
  51. package/dist/bundle/four-meme/swap-buy-first/multi-wallet.js +198 -0
  52. package/dist/bundle/four-meme/swap-buy-first/single.d.ts +7 -0
  53. package/dist/bundle/four-meme/swap-buy-first/single.js +232 -0
  54. package/dist/bundle/four-meme/swap-buy-first.d.ts +4 -3
  55. package/dist/bundle/four-meme/swap-buy-first.js +4 -451
  56. package/dist/bundle/four-meme/swap-hop-helpers.d.ts +2 -2
  57. package/dist/bundle/four-meme/swap-sign-helpers.d.ts +2 -2
  58. package/dist/bundle/four-meme/swap-sign-helpers.js +1 -1
  59. package/dist/bundle/four-meme/swap.d.ts +4 -14
  60. package/dist/bundle/four-meme/swap.js +4 -502
  61. package/dist/bundle/four-meme/types/index.d.ts +1 -1
  62. package/dist/bundle/four-meme/utils-disperse.d.ts +1 -1
  63. package/dist/bundle/four-meme/utils-disperse.js +1 -1
  64. package/dist/bundle/four-meme/utils-pairwise.d.ts +1 -1
  65. package/dist/bundle/four-meme/utils-pairwise.js +1 -1
  66. package/dist/bundle/four-meme/utils-sweep/context.d.ts +39 -0
  67. package/dist/bundle/four-meme/utils-sweep/context.js +7 -0
  68. package/dist/bundle/four-meme/utils-sweep/erc20-no-hop.d.ts +5 -0
  69. package/dist/bundle/four-meme/utils-sweep/erc20-no-hop.js +162 -0
  70. package/dist/bundle/four-meme/utils-sweep/index.d.ts +13 -0
  71. package/dist/bundle/four-meme/utils-sweep/index.js +13 -0
  72. package/dist/bundle/four-meme/utils-sweep/main.d.ts +8 -0
  73. package/dist/bundle/four-meme/utils-sweep/main.js +114 -0
  74. package/dist/bundle/four-meme/utils-sweep/native-no-hop.d.ts +5 -0
  75. package/dist/bundle/four-meme/utils-sweep/native-no-hop.js +156 -0
  76. package/dist/bundle/four-meme/utils-sweep/with-hops.d.ts +6 -0
  77. package/dist/bundle/four-meme/utils-sweep/with-hops.js +382 -0
  78. package/dist/bundle/four-meme/utils-sweep.d.ts +3 -4
  79. package/dist/bundle/four-meme/utils-sweep.js +3 -740
  80. package/dist/bundle/internal.d.ts +2 -2
  81. package/dist/bundle/sign-context-helpers.d.ts +1 -26
  82. package/dist/bundle/sign-context-helpers.js +1 -63
  83. package/dist/bundle/submit/blockrazor.d.ts +94 -0
  84. package/dist/bundle/submit/blockrazor.js +122 -0
  85. package/dist/bundle/submit/direct.d.ts +118 -0
  86. package/dist/bundle/submit/direct.js +484 -0
  87. package/dist/bundle/submit/helpers.d.ts +7 -0
  88. package/dist/bundle/submit/helpers.js +15 -0
  89. package/dist/bundle/submit/index.d.ts +14 -0
  90. package/dist/bundle/submit/index.js +14 -0
  91. package/dist/bundle/submit/merkle.d.ts +84 -0
  92. package/dist/bundle/submit/merkle.js +121 -0
  93. package/dist/bundle/submit.d.ts +3 -286
  94. package/dist/bundle/submit.js +3 -724
  95. package/dist/chains/bsc/four/types.d.ts +1 -1
  96. package/dist/chains/bsc/index.d.ts +1 -1
  97. package/dist/chains/bsc/index.js +2 -0
  98. package/dist/chains/bsc/pancake/bundle-buy-first-build.d.ts +25 -0
  99. package/dist/chains/bsc/pancake/bundle-buy-first-build.js +177 -0
  100. package/dist/chains/bsc/pancake/bundle-buy-first-constants.d.ts +30 -0
  101. package/dist/chains/bsc/pancake/bundle-buy-first-constants.js +24 -0
  102. package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +11 -149
  103. package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +12 -74
  104. package/dist/chains/bsc/pancake/bundle-buy-first-multi-wallet.d.ts +9 -0
  105. package/dist/chains/bsc/pancake/bundle-buy-first-multi-wallet.js +225 -0
  106. package/dist/chains/bsc/pancake/bundle-buy-first-plan.d.ts +14 -0
  107. package/dist/chains/bsc/pancake/bundle-buy-first-plan.js +64 -0
  108. package/dist/chains/bsc/pancake/bundle-buy-first-profit.d.ts +12 -0
  109. package/dist/chains/bsc/pancake/bundle-buy-first-profit.js +22 -0
  110. package/dist/chains/bsc/pancake/bundle-buy-first-quote.d.ts +15 -0
  111. package/dist/chains/bsc/pancake/bundle-buy-first-quote.js +122 -0
  112. package/dist/chains/bsc/pancake/bundle-buy-first-types.d.ts +179 -0
  113. package/dist/chains/bsc/pancake/bundle-buy-first-types.js +1 -0
  114. package/dist/chains/bsc/pancake/bundle-buy-first-validate.d.ts +2 -0
  115. package/dist/chains/bsc/pancake/bundle-buy-first-validate.js +41 -0
  116. package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +1 -1
  117. package/dist/chains/bsc/pancake/bundle-buy-first.js +8 -578
  118. package/dist/chains/bsc/pancake/bundle-swap-helpers.d.ts +11 -239
  119. package/dist/chains/bsc/pancake/bundle-swap-helpers.js +12 -564
  120. package/dist/chains/bsc/pancake/bundle-swap-types.d.ts +183 -0
  121. package/dist/chains/bsc/pancake/bundle-swap-types.js +17 -0
  122. package/dist/chains/bsc/pancake/bundle-swap.d.ts +10 -132
  123. package/dist/chains/bsc/pancake/bundle-swap.js +12 -1003
  124. package/dist/chains/bsc/pancake/hop-chain.d.ts +18 -0
  125. package/dist/chains/bsc/pancake/hop-chain.js +227 -0
  126. package/dist/chains/bsc/pancake/quote.d.ts +14 -0
  127. package/dist/chains/bsc/pancake/quote.js +84 -0
  128. package/dist/chains/bsc/pancake/swap-batch.d.ts +42 -0
  129. package/dist/chains/bsc/pancake/swap-batch.js +283 -0
  130. package/dist/chains/bsc/pancake/swap-build.d.ts +19 -0
  131. package/dist/chains/bsc/pancake/swap-build.js +226 -0
  132. package/dist/chains/bsc/pancake/swap-cross.d.ts +42 -0
  133. package/dist/chains/bsc/pancake/swap-cross.js +140 -0
  134. package/dist/chains/bsc/pancake/swap-quick.d.ts +54 -0
  135. package/dist/chains/bsc/pancake/swap-quick.js +424 -0
  136. package/dist/chains/bsc/pancake/swap-single.d.ts +2 -0
  137. package/dist/chains/bsc/pancake/swap-single.js +182 -0
  138. package/dist/chains/bsc/platforms/four/index.d.ts +21 -3
  139. package/dist/chains/bsc/platforms/four/index.js +28 -3
  140. package/dist/chains/eni/batch-router/transfer-disperse.d.ts +37 -0
  141. package/dist/chains/eni/batch-router/transfer-disperse.js +302 -0
  142. package/dist/chains/eni/batch-router/transfer-shared.d.ts +9 -0
  143. package/dist/chains/eni/batch-router/transfer-shared.js +10 -0
  144. package/dist/chains/eni/batch-router/transfer-sweep.d.ts +51 -0
  145. package/dist/chains/eni/batch-router/transfer-sweep.js +364 -0
  146. package/dist/chains/eni/batch-router/transfer.d.ts +4 -74
  147. package/dist/chains/eni/batch-router/transfer.js +2 -647
  148. package/dist/chains/eni/index.d.ts +2 -0
  149. package/dist/chains/eni/index.js +4 -0
  150. package/dist/chains/eni/platforms/daoaas/portal-direct-profit.d.ts +17 -0
  151. package/dist/chains/eni/platforms/daoaas/portal-direct-profit.js +30 -0
  152. package/dist/chains/eni/platforms/daoaas/portal-direct-submit.d.ts +12 -0
  153. package/dist/chains/eni/platforms/daoaas/portal-direct-submit.js +396 -0
  154. package/dist/chains/eni/platforms/daoaas/portal-direct-tx.d.ts +20 -0
  155. package/dist/chains/eni/platforms/daoaas/portal-direct-tx.js +165 -0
  156. package/dist/chains/eni/platforms/daoaas/portal-direct.d.ts +3 -32
  157. package/dist/chains/eni/platforms/daoaas/portal-direct.js +3 -571
  158. package/dist/chains/eni/submit.js +1 -1
  159. package/dist/chains/xlayer/constants.d.ts +0 -2
  160. package/dist/chains/xlayer/constants.js +0 -2
  161. package/dist/chains/xlayer/eip7702/auth.d.ts +16 -0
  162. package/dist/chains/xlayer/eip7702/auth.js +81 -0
  163. package/dist/chains/xlayer/eip7702/bundle-create-buy.d.ts +22 -0
  164. package/dist/chains/xlayer/eip7702/bundle-create-buy.js +201 -0
  165. package/dist/chains/xlayer/eip7702/bundle-create-helpers.d.ts +114 -0
  166. package/dist/chains/xlayer/eip7702/bundle-create-helpers.js +139 -0
  167. package/dist/chains/xlayer/eip7702/bundle-create-to-dex.d.ts +24 -0
  168. package/dist/chains/xlayer/eip7702/bundle-create-to-dex.js +233 -0
  169. package/dist/chains/xlayer/eip7702/bundle-create.d.ts +3 -35
  170. package/dist/chains/xlayer/eip7702/bundle-create.js +3 -746
  171. package/dist/chains/xlayer/eip7702/bundle-graduate-buy.d.ts +22 -0
  172. package/dist/chains/xlayer/eip7702/bundle-graduate-buy.js +214 -0
  173. package/dist/chains/xlayer/eip7702/bundle-sell.js +1 -1
  174. package/dist/chains/xlayer/eip7702/bundle-swap-batch.d.ts +31 -0
  175. package/dist/chains/xlayer/eip7702/bundle-swap-batch.js +216 -0
  176. package/dist/chains/xlayer/eip7702/bundle-swap-helpers.d.ts +21 -0
  177. package/dist/chains/xlayer/eip7702/bundle-swap-helpers.js +206 -0
  178. package/dist/chains/xlayer/eip7702/bundle-swap-multi.d.ts +33 -0
  179. package/dist/chains/xlayer/eip7702/bundle-swap-multi.js +146 -0
  180. package/dist/chains/xlayer/eip7702/bundle-swap-single.d.ts +31 -0
  181. package/dist/chains/xlayer/eip7702/bundle-swap-single.js +177 -0
  182. package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +6 -61
  183. package/dist/chains/xlayer/eip7702/bundle-swap.js +3 -712
  184. package/dist/chains/xlayer/eip7702/bytes.d.ts +4 -0
  185. package/dist/chains/xlayer/eip7702/bytes.js +31 -0
  186. package/dist/chains/xlayer/eip7702/gas.d.ts +19 -0
  187. package/dist/chains/xlayer/eip7702/gas.js +152 -0
  188. package/dist/chains/xlayer/eip7702/multi-hop-transfer-disperse.d.ts +5 -0
  189. package/dist/chains/xlayer/eip7702/multi-hop-transfer-disperse.js +196 -0
  190. package/dist/chains/xlayer/eip7702/multi-hop-transfer-pairwise.d.ts +5 -0
  191. package/dist/chains/xlayer/eip7702/multi-hop-transfer-pairwise.js +188 -0
  192. package/dist/chains/xlayer/eip7702/multi-hop-transfer-sweep.d.ts +5 -0
  193. package/dist/chains/xlayer/eip7702/multi-hop-transfer-sweep.js +220 -0
  194. package/dist/chains/xlayer/eip7702/multi-hop-transfer.d.ts +8 -4
  195. package/dist/chains/xlayer/eip7702/multi-hop-transfer.js +5 -591
  196. package/dist/chains/xlayer/eip7702/profit.d.ts +32 -0
  197. package/dist/chains/xlayer/eip7702/profit.js +59 -0
  198. package/dist/chains/xlayer/eip7702/provider.d.ts +3 -0
  199. package/dist/chains/xlayer/eip7702/provider.js +17 -0
  200. package/dist/chains/xlayer/eip7702/time.d.ts +2 -0
  201. package/dist/chains/xlayer/eip7702/time.js +10 -0
  202. package/dist/chains/xlayer/eip7702/tx-build.d.ts +10 -0
  203. package/dist/chains/xlayer/eip7702/tx-build.js +128 -0
  204. package/dist/chains/xlayer/eip7702/utils.d.ts +19 -85
  205. package/dist/chains/xlayer/eip7702/utils.js +19 -484
  206. package/dist/chains/xlayer/eip7702/volume-bundle.d.ts +13 -0
  207. package/dist/chains/xlayer/eip7702/volume-bundle.js +250 -0
  208. package/dist/chains/xlayer/eip7702/volume-internal.d.ts +13 -0
  209. package/dist/chains/xlayer/eip7702/volume-internal.js +169 -0
  210. package/dist/chains/xlayer/eip7702/volume-make.d.ts +8 -0
  211. package/dist/chains/xlayer/eip7702/volume-make.js +38 -0
  212. package/dist/chains/xlayer/eip7702/volume-single-round.d.ts +17 -0
  213. package/dist/chains/xlayer/eip7702/volume-single-round.js +44 -0
  214. package/dist/chains/xlayer/eip7702/volume-swap.d.ts +18 -0
  215. package/dist/chains/xlayer/eip7702/volume-swap.js +30 -0
  216. package/dist/chains/xlayer/eip7702/volume-wash.d.ts +8 -0
  217. package/dist/chains/xlayer/eip7702/volume-wash.js +191 -0
  218. package/dist/chains/xlayer/eip7702/volume.d.ts +7 -35
  219. package/dist/chains/xlayer/eip7702/volume.js +5 -697
  220. package/dist/chains/xlayer/eip7702/wallet.d.ts +6 -0
  221. package/dist/chains/xlayer/eip7702/wallet.js +17 -0
  222. package/dist/chains/xlayer/eoa/aa-types.d.ts +176 -0
  223. package/dist/chains/xlayer/eoa/aa-types.js +6 -0
  224. package/dist/chains/xlayer/eoa/constants.d.ts +0 -2
  225. package/dist/chains/xlayer/eoa/constants.js +0 -2
  226. package/dist/chains/xlayer/eoa/context.d.ts +8 -0
  227. package/dist/chains/xlayer/eoa/context.js +23 -0
  228. package/dist/chains/xlayer/eoa/encoders.d.ts +147 -0
  229. package/dist/chains/xlayer/eoa/encoders.js +147 -0
  230. package/dist/chains/xlayer/eoa/eoa-bundle-swap-cross.d.ts +5 -0
  231. package/dist/chains/xlayer/eoa/eoa-bundle-swap-cross.js +113 -0
  232. package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts +10 -123
  233. package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +10 -225
  234. package/dist/chains/xlayer/eoa/eoa-bundle-swap-pure.d.ts +50 -0
  235. package/dist/chains/xlayer/eoa/eoa-bundle-swap-pure.js +170 -0
  236. package/dist/chains/xlayer/eoa/eoa-bundle-swap-quick.d.ts +5 -0
  237. package/dist/chains/xlayer/eoa/eoa-bundle-swap-quick.js +257 -0
  238. package/dist/chains/xlayer/eoa/eoa-bundle-swap-types.d.ts +99 -0
  239. package/dist/chains/xlayer/eoa/eoa-bundle-swap-types.js +11 -0
  240. package/dist/chains/xlayer/eoa/eoa-bundle-swap.d.ts +5 -47
  241. package/dist/chains/xlayer/eoa/eoa-bundle-swap.js +3 -522
  242. package/dist/chains/xlayer/eoa/eoa-types.d.ts +776 -0
  243. package/dist/chains/xlayer/eoa/eoa-types.js +6 -0
  244. package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +8 -0
  245. package/dist/chains/xlayer/eoa/eoa-wash-volume.js +8 -0
  246. package/dist/chains/xlayer/eoa/format.d.ts +34 -0
  247. package/dist/chains/xlayer/eoa/format.js +56 -0
  248. package/dist/chains/xlayer/eoa/hop-chain.d.ts +4 -0
  249. package/dist/chains/xlayer/eoa/hop-chain.js +87 -0
  250. package/dist/chains/xlayer/eoa/nonce-map.d.ts +20 -0
  251. package/dist/chains/xlayer/eoa/nonce-map.js +51 -0
  252. package/dist/chains/xlayer/eoa/portal-ops.d.ts +9 -292
  253. package/dist/chains/xlayer/eoa/portal-ops.js +9 -486
  254. package/dist/chains/xlayer/eoa/query.d.ts +117 -0
  255. package/dist/chains/xlayer/eoa/query.js +285 -0
  256. package/dist/chains/xlayer/eoa/quote.d.ts +6 -0
  257. package/dist/chains/xlayer/eoa/quote.js +90 -0
  258. package/dist/chains/xlayer/eoa/types.d.ts +9 -959
  259. package/dist/chains/xlayer/eoa/types.js +9 -49
  260. package/dist/core/clients/blockrazor.js +1 -1
  261. package/dist/core/clients/merkle.js +1 -1
  262. package/dist/core/erc20/allowances.d.ts +104 -0
  263. package/dist/core/erc20/allowances.js +205 -0
  264. package/dist/core/erc20/approve.d.ts +141 -0
  265. package/dist/core/erc20/approve.js +325 -0
  266. package/dist/core/erc20/helpers.d.ts +20 -0
  267. package/dist/core/erc20/helpers.js +109 -0
  268. package/dist/core/erc20/index.d.ts +13 -0
  269. package/dist/core/erc20/index.js +12 -0
  270. package/dist/core/gas/bundle-gas.d.ts +6 -1
  271. package/dist/core/index.d.ts +1 -1
  272. package/dist/core/index.js +1 -1
  273. package/dist/core/quote/index.d.ts +1 -0
  274. package/dist/core/quote/index.js +1 -0
  275. package/dist/core/quote/quote-helpers.d.ts +78 -0
  276. package/dist/core/quote/quote-helpers.js +289 -0
  277. package/dist/core/quote/types.d.ts +1 -0
  278. package/dist/core/quote/types.js +1 -0
  279. package/dist/core/sign-context-helpers.d.ts +29 -0
  280. package/dist/core/sign-context-helpers.js +63 -0
  281. package/dist/domains/dex/direct-router-helpers.d.ts +16 -268
  282. package/dist/domains/dex/direct-router-helpers.js +16 -535
  283. package/dist/domains/dex/direct-router-types.d.ts +104 -0
  284. package/dist/domains/dex/direct-router-types.js +81 -0
  285. package/dist/domains/dex/direct-router-v2-buy.d.ts +2 -0
  286. package/dist/domains/dex/direct-router-v2-buy.js +249 -0
  287. package/dist/domains/dex/direct-router-v2-sell.d.ts +5 -0
  288. package/dist/domains/dex/direct-router-v2-sell.js +270 -0
  289. package/dist/domains/dex/direct-router-v2.d.ts +9 -0
  290. package/dist/domains/dex/direct-router-v2.js +9 -0
  291. package/dist/domains/dex/direct-router-v3.d.ts +17 -0
  292. package/dist/domains/dex/direct-router-v3.js +432 -0
  293. package/dist/domains/dex/direct-router.d.ts +11 -26
  294. package/dist/domains/dex/direct-router.js +10 -977
  295. package/dist/domains/dex/dyo-encode.d.ts +62 -0
  296. package/dist/domains/dex/dyo-encode.js +124 -0
  297. package/dist/domains/dex/profit.d.ts +24 -0
  298. package/dist/domains/dex/profit.js +86 -0
  299. package/dist/domains/dex/provider.d.ts +10 -0
  300. package/dist/domains/dex/provider.js +27 -0
  301. package/dist/domains/dex/quote.d.ts +7 -0
  302. package/dist/domains/dex/quote.js +52 -0
  303. package/dist/domains/dex/router.d.ts +56 -0
  304. package/dist/domains/dex/router.js +193 -0
  305. package/dist/domains/flap/portal-bundle/batch.d.ts +9 -0
  306. package/dist/domains/flap/portal-bundle/batch.js +193 -0
  307. package/dist/domains/flap/portal-bundle/create.d.ts +5 -0
  308. package/dist/domains/flap/portal-bundle/create.js +153 -0
  309. package/dist/domains/flap/portal-bundle/helpers.d.ts +32 -0
  310. package/dist/domains/flap/portal-bundle/helpers.js +50 -0
  311. package/dist/domains/flap/portal-bundle/index.d.ts +16 -0
  312. package/dist/domains/flap/portal-bundle/index.js +15 -0
  313. package/dist/domains/flap/portal-bundle/private.d.ts +5 -0
  314. package/dist/domains/flap/portal-bundle/private.js +198 -0
  315. package/dist/domains/flap/portal-bundle/types.d.ts +102 -0
  316. package/dist/domains/flap/portal-bundle/types.js +1 -0
  317. package/dist/domains/flap/portal-bundle-merkle/core-batch.d.ts +13 -0
  318. package/dist/domains/flap/portal-bundle-merkle/core-batch.js +376 -0
  319. package/dist/domains/flap/portal-bundle-merkle/core-helpers.d.ts +75 -7
  320. package/dist/domains/flap/portal-bundle-merkle/core-helpers.js +259 -20
  321. package/dist/domains/flap/portal-bundle-merkle/core.d.ts +2 -13
  322. package/dist/domains/flap/portal-bundle-merkle/core.js +12 -629
  323. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/constants.d.ts +70 -0
  324. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/constants.js +90 -0
  325. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/index.d.ts +12 -0
  326. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/index.js +11 -0
  327. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/main.d.ts +15 -0
  328. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/main.js +432 -0
  329. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/types.d.ts +113 -0
  330. package/dist/domains/flap/portal-bundle-merkle/create-to-dex/types.js +4 -0
  331. package/dist/domains/flap/portal-bundle-merkle/create-to-dex.d.ts +4 -127
  332. package/dist/domains/flap/portal-bundle-merkle/create-to-dex.js +4 -527
  333. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/constants.d.ts +42 -0
  334. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/constants.js +81 -0
  335. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/index.d.ts +12 -0
  336. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/index.js +11 -0
  337. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/main.d.ts +15 -0
  338. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/main.js +339 -0
  339. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/types.d.ts +72 -0
  340. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/types.js +4 -0
  341. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex.d.ts +4 -85
  342. package/dist/domains/flap/portal-bundle-merkle/curve-to-dex.js +4 -425
  343. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/approve.d.ts +12 -0
  344. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/approve.js +102 -0
  345. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/buy.d.ts +5 -0
  346. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/buy.js +135 -0
  347. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/helpers.d.ts +52 -0
  348. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/helpers.js +267 -0
  349. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/index.d.ts +14 -0
  350. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/index.js +14 -0
  351. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/sell.d.ts +5 -0
  352. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/sell.js +195 -0
  353. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy.d.ts +3 -24
  354. package/dist/domains/flap/portal-bundle-merkle/pancake-proxy.js +3 -700
  355. package/dist/domains/flap/portal-bundle-merkle/private/buy.d.ts +9 -0
  356. package/dist/domains/flap/portal-bundle-merkle/private/buy.js +188 -0
  357. package/dist/domains/flap/portal-bundle-merkle/private/helpers.d.ts +36 -0
  358. package/dist/domains/flap/portal-bundle-merkle/private/helpers.js +127 -0
  359. package/dist/domains/flap/portal-bundle-merkle/private/index.d.ts +12 -0
  360. package/dist/domains/flap/portal-bundle-merkle/private/index.js +12 -0
  361. package/dist/domains/flap/portal-bundle-merkle/private/sell.d.ts +9 -0
  362. package/dist/domains/flap/portal-bundle-merkle/private/sell.js +191 -0
  363. package/dist/domains/flap/portal-bundle-merkle/private.d.ts +5 -15
  364. package/dist/domains/flap/portal-bundle-merkle/private.js +5 -494
  365. package/dist/domains/flap/portal-bundle-merkle/swap-batch.js +3 -2
  366. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-chain.d.ts +4 -0
  367. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-chain.js +43 -0
  368. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-constants.d.ts +13 -0
  369. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-constants.js +21 -0
  370. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +11 -121
  371. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-helpers.js +11 -109
  372. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-multi-wallet.d.ts +20 -0
  373. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-multi-wallet.js +223 -0
  374. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-plan.d.ts +32 -0
  375. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-plan.js +66 -0
  376. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-profit.d.ts +22 -0
  377. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-profit.js +22 -0
  378. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-quote.d.ts +51 -0
  379. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-quote.js +149 -0
  380. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-types.d.ts +87 -0
  381. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-types.js +1 -0
  382. package/dist/domains/flap/portal-bundle-merkle/swap-buy-first.js +5 -404
  383. package/dist/domains/flap/portal-bundle-merkle/swap-helpers.d.ts +0 -1
  384. package/dist/domains/flap/portal-bundle-merkle/swap-helpers.js +0 -7
  385. package/dist/domains/flap/portal-bundle-merkle/swap-planning.js +1 -1
  386. package/dist/domains/flap/portal-bundle-merkle/swap-quick-batch.js +3 -2
  387. package/dist/domains/flap/portal-bundle-merkle/swap-single.js +3 -2
  388. package/dist/domains/flap/portal-bundle-merkle/utils/disperse.d.ts +2 -0
  389. package/dist/domains/flap/portal-bundle-merkle/utils/disperse.js +275 -0
  390. package/dist/domains/flap/portal-bundle-merkle/utils/index.d.ts +11 -0
  391. package/dist/domains/flap/portal-bundle-merkle/utils/index.js +11 -0
  392. package/dist/domains/flap/portal-bundle-merkle/utils/sweep.d.ts +9 -0
  393. package/dist/domains/flap/portal-bundle-merkle/utils/sweep.js +570 -0
  394. package/dist/domains/flap/portal-bundle-merkle/utils.d.ts +5 -8
  395. package/dist/domains/flap/portal-bundle-merkle/utils.js +5 -841
  396. package/dist/domains/flap/portal-bundle.d.ts +5 -117
  397. package/dist/domains/flap/portal-bundle.js +5 -587
  398. package/dist/domains/flap/portal.d.ts +13 -404
  399. package/dist/domains/flap/portal.js +12 -619
  400. package/dist/domains/flap/reader.d.ts +51 -0
  401. package/dist/domains/flap/reader.js +275 -0
  402. package/dist/domains/flap/types.d.ts +246 -0
  403. package/dist/domains/flap/types.js +104 -0
  404. package/dist/domains/flap/vault/constants.d.ts +220 -0
  405. package/dist/domains/flap/vault/constants.js +173 -0
  406. package/dist/domains/flap/vault/encode.d.ts +39 -0
  407. package/dist/domains/flap/vault/encode.js +135 -0
  408. package/dist/domains/flap/vault/index.d.ts +15 -0
  409. package/dist/domains/flap/vault/index.js +14 -0
  410. package/dist/domains/flap/vault/query.d.ts +40 -0
  411. package/dist/domains/flap/vault/query.js +104 -0
  412. package/dist/domains/flap/vault/types.d.ts +147 -0
  413. package/dist/domains/flap/vault/types.js +29 -0
  414. package/dist/domains/flap/vault.d.ts +3 -413
  415. package/dist/domains/flap/vault.js +3 -467
  416. package/dist/domains/flap/writer.d.ts +124 -0
  417. package/dist/domains/flap/writer.js +255 -0
  418. package/dist/domains/four/contracts/tm-bundle-batch.d.ts +35 -0
  419. package/dist/domains/four/contracts/tm-bundle-batch.js +286 -0
  420. package/dist/domains/four/contracts/tm-bundle-create.d.ts +2 -0
  421. package/dist/domains/four/contracts/tm-bundle-create.js +304 -0
  422. package/dist/domains/four/contracts/tm-bundle-helpers.d.ts +2 -1
  423. package/dist/domains/four/contracts/tm-bundle-helpers.js +3 -0
  424. package/dist/domains/four/contracts/tm-bundle-private.d.ts +36 -0
  425. package/dist/domains/four/contracts/tm-bundle-private.js +164 -0
  426. package/dist/domains/four/contracts/tm-bundle.d.ts +10 -71
  427. package/dist/domains/four/contracts/tm-bundle.js +9 -738
  428. package/dist/domains/lp-inspect/inspect-helpers.d.ts +25 -0
  429. package/dist/domains/lp-inspect/inspect-helpers.js +343 -0
  430. package/dist/domains/lp-inspect/inspect.d.ts +8 -0
  431. package/dist/domains/lp-inspect/inspect.js +332 -0
  432. package/dist/domains/lp-inspect/lp-inspect.d.ts +9 -37
  433. package/dist/domains/lp-inspect/lp-inspect.js +9 -775
  434. package/dist/domains/lp-inspect/registry.d.ts +43 -0
  435. package/dist/domains/lp-inspect/registry.js +127 -0
  436. package/dist/domains/merkle/index.d.ts +1 -1
  437. package/dist/exports/root-bundle-and-tooling.d.ts +9 -1
  438. package/dist/exports/root-bundle-and-tooling.js +8 -1
  439. package/dist/exports/root-foundations.d.ts +1 -1
  440. package/dist/exports/root-foundations.js +1 -1
  441. package/dist/exports/root-swap-dex-and-xlayer.d.ts +4 -4
  442. package/dist/exports/root-swap-dex-and-xlayer.js +4 -4
  443. package/dist/index.d.ts +1 -1
  444. package/dist/index.js +1 -1
  445. package/dist/utils/swap-helpers.js +1 -1
  446. package/package.json +1 -81
@@ -1,6 +1,31 @@
1
1
  /**
2
- * BSC - Four.meme 平台模块
2
+ * BSC - Four.meme 平台模块(有意 facade)
3
3
  *
4
- * 从新位置重新导出
4
+ * 这是 chains/bsc 层的 Four.meme 快捷入口 facade,被 chains/bsc/index.ts 引用,
5
+ * 用于把 bundle 层的 Four.meme 实现以快捷别名暴露到 chains/bsc 命名空间下。
6
+ *
7
+ * 依赖说明:本文件仅从 `bundle/` 层重新导出(types / errors / config-helpers /
8
+ * four-meme 各子模块 / submit),不引入除 bundle 之外的其它反向依赖(如 domains/、
9
+ * chains/ 其它平台),故作为 facade 有意保留,不修改任何导出与逻辑。
5
10
  */
6
- export * from '../../four/index.js';
11
+ // 错误与配置 helper
12
+ export { BUNDLE_ERRORS as ERRORS, getBundleErrorMessage as getErrorMessage, } from '../../../../bundle/errors.js';
13
+ export { getTxType, getGasPriceMultiplier, getBundleOptions, getGasPriceConfig, shouldExtractProfit, getProfitRateBps, getProfitRecipient, calculateProfit, calculateBatchProfit, getBribeAmount, } from '../../../../bundle/config-helpers.js';
14
+ // 核心交易方法
15
+ export { createTokenWithBundleBuyMerkle, batchBuyWithBundleMerkle, batchSellWithBundleMerkle, } from '../../../../bundle/four-meme/core.js';
16
+ // 私有交易方法
17
+ export { fourPrivateBuyMerkle, fourPrivateSellMerkle, fourBatchPrivateBuyMerkle, fourBatchPrivateSellMerkle, } from '../../../../bundle/four-meme/private.js';
18
+ // 工具方法
19
+ export { disperseWithBundleMerkle } from '../../../../bundle/four-meme/utils-disperse.js';
20
+ export { sweepWithBundleMerkle } from '../../../../bundle/four-meme/utils-sweep.js';
21
+ export { pairwiseTransferWithBundleMerkle } from '../../../../bundle/four-meme/utils-pairwise.js';
22
+ // PancakeSwapProxy 代理交易方法
23
+ export { fourPancakeProxyBatchBuyMerkle, fourPancakeProxyBatchSellMerkle, approveFourPancakeProxy, approveFourPancakeProxyBatch, } from '../../../../bundle/four-meme/pancake-proxy.js';
24
+ // TokenManager 授权方法
25
+ export { approveFourTokenManagerBatch } from '../../../../bundle/four-meme/approve-tokenmanager.js';
26
+ // Bundle 提交方法(服务器端使用)
27
+ export { submitBundleToMerkle, submitMultipleBundles, submitMultipleBundlesParallel, submitBundleToBlockRazor, submitMultipleBundlesToBlockRazor, submitMultipleBundlesToBlockRazorParallel, submitDirectToRpc, submitDirectToRpcSequential, submitDirectToRpcSequentialNoWait, submitDirectToRpcParallel, submitDirectToRpcSmart, } from '../../../../bundle/submit.js';
28
+ // 先买后卖换手方法
29
+ export { fourBundleBuyFirstMerkle } from '../../../../bundle/four-meme/swap-buy-first.js';
30
+ // 换手方法
31
+ export { fourBundleSwapMerkle, fourBatchSwapMerkle, fourQuickBatchSwapMerkle, } from '../../../../bundle/four-meme/swap.js';
@@ -0,0 +1,37 @@
1
+ /**
2
+ * ENI BatchRouter — 批量分发(EGAS / ERC20)
3
+ *
4
+ * - batchTransferEgas: 批量分发 EGAS (1 笔 tx, 通过合约)
5
+ * - batchTransferToken: 批量分发 ERC20 (1 笔 tx, 通过合约)
6
+ * - eniDisperseForSubmit: 前端统一入口 (EGAS / ERC20 分发)
7
+ */
8
+ import type { BatchTransferParams, BatchTransferResult } from './types.js';
9
+ export declare function batchTransferEgas(params: BatchTransferParams): Promise<BatchTransferResult>;
10
+ export interface BatchTransferTokenParams {
11
+ rpcUrl?: string;
12
+ batchRouterAddress?: string;
13
+ mainPrivateKey: string;
14
+ token: string;
15
+ recipients: string[];
16
+ amounts: bigint[];
17
+ gasPrice?: bigint;
18
+ }
19
+ export declare function batchTransferToken(params: BatchTransferTokenParams): Promise<BatchTransferResult>;
20
+ export interface EniDisperseParams {
21
+ rpcUrl?: string;
22
+ fromPrivateKey: string;
23
+ recipients: string[];
24
+ amounts: string[];
25
+ tokenAddress?: string;
26
+ tokenDecimals?: number;
27
+ hopCount?: number;
28
+ gasLimit?: number;
29
+ }
30
+ export interface EniDisperseResult {
31
+ signedTransactions: string[];
32
+ hopWallets?: {
33
+ address: string;
34
+ privateKey: string;
35
+ }[][];
36
+ }
37
+ export declare function eniDisperseForSubmit(params: EniDisperseParams): Promise<EniDisperseResult>;
@@ -0,0 +1,302 @@
1
+ /**
2
+ * ENI BatchRouter — 批量分发(EGAS / ERC20)
3
+ *
4
+ * - batchTransferEgas: 批量分发 EGAS (1 笔 tx, 通过合约)
5
+ * - batchTransferToken: 批量分发 ERC20 (1 笔 tx, 通过合约)
6
+ * - eniDisperseForSubmit: 前端统一入口 (EGAS / ERC20 分发)
7
+ */
8
+ import { Wallet, Contract, ethers } from 'ethers';
9
+ import { ENI_CHAIN_ID, ENI_RPC_URL } from '../constants.js';
10
+ import { createEniProvider } from '../../../utils/provider-factory.js';
11
+ import { BATCH_ROUTER_ADDRESS, estimateGas } from './constants.js';
12
+ import { validateBatchParams, encodeBatchTransfer, encodeBatchTransferToken, buildBatchRouterTx } from './utils.js';
13
+ import { ERC20_ABI } from '../../../abis/common.js';
14
+ import { getProfitRecipient, calculateTransferFee } from '../../../core/constants/profit.js';
15
+ import { GAS_LIMITS } from '../../../core/constants/gas.js';
16
+ import { erc20Iface, DEFAULT_GAS_PER_SWEEP, GAS_NATIVE_TRANSFER } from './transfer-shared.js';
17
+ // ============================================================================
18
+ // 批量分发 EGAS (通过 BatchRouter 合约, 1 笔 tx)
19
+ // ============================================================================
20
+ export async function batchTransferEgas(params) {
21
+ const { recipients, amounts } = params;
22
+ validateBatchParams(recipients, amounts, 'batchTransferEgas');
23
+ const totalValue = amounts.reduce((a, b) => a + b, 0n);
24
+ const calldata = encodeBatchTransfer(recipients, amounts);
25
+ const gasLimit = estimateGas(recipients.length, false);
26
+ const result = await buildBatchRouterTx({
27
+ rpcUrl: params.rpcUrl,
28
+ mainPrivateKey: params.mainPrivateKey,
29
+ batchRouterAddress: params.batchRouterAddress,
30
+ calldata,
31
+ value: totalValue,
32
+ gasLimit,
33
+ gasPrice: params.gasPrice,
34
+ });
35
+ return { ...result, totalValue };
36
+ }
37
+ export async function batchTransferToken(params) {
38
+ const { token, recipients, amounts } = params;
39
+ validateBatchParams(recipients, amounts, 'batchTransferToken');
40
+ const routerAddr = params.batchRouterAddress || BATCH_ROUTER_ADDRESS;
41
+ const calldata = encodeBatchTransferToken(token, recipients, amounts);
42
+ const gasLimit = estimateGas(recipients.length, false);
43
+ const result = await buildBatchRouterTx({
44
+ rpcUrl: params.rpcUrl,
45
+ mainPrivateKey: params.mainPrivateKey,
46
+ batchRouterAddress: routerAddr,
47
+ calldata,
48
+ value: 0n,
49
+ gasLimit,
50
+ gasPrice: params.gasPrice,
51
+ });
52
+ return { ...result, totalValue: amounts.reduce((a, b) => a + b, 0n) };
53
+ }
54
+ export async function eniDisperseForSubmit(params) {
55
+ const { rpcUrl = ENI_RPC_URL, fromPrivateKey, recipients, tokenAddress, hopCount = 0 } = params;
56
+ const decimals = params.tokenDecimals ?? 18;
57
+ const isNative = !tokenAddress || tokenAddress === ethers.ZeroAddress;
58
+ const amountsWei = params.amounts.map((a) => ethers.parseUnits(a, decimals));
59
+ const provider = createEniProvider(rpcUrl, ENI_CHAIN_ID);
60
+ const mainWallet = new Wallet(fromPrivateKey, provider);
61
+ const feeData = await provider.getFeeData();
62
+ const maxFeePerGas = feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
63
+ const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
64
+ const profitTxGasCost = GAS_LIMITS.NATIVE_TRANSFER * maxFeePerGas;
65
+ const profitAmount = calculateTransferFee(ENI_CHAIN_ID, recipients.length) + profitTxGasCost;
66
+ const erc20GasLimit = params.gasLimit ? BigInt(params.gasLimit) : DEFAULT_GAS_PER_SWEEP;
67
+ if (hopCount > 0) {
68
+ return eniDisperseWithHops({
69
+ provider,
70
+ mainWallet,
71
+ recipients,
72
+ amountsWei,
73
+ isNative,
74
+ tokenAddress,
75
+ hopCount,
76
+ profitAmount,
77
+ maxFeePerGas,
78
+ maxPriorityFeePerGas,
79
+ erc20GasLimit,
80
+ });
81
+ }
82
+ // ===== 无多跳:使用 BatchRouter 合约批量分发 =====
83
+ const routerAddr = BATCH_ROUTER_ADDRESS;
84
+ if (isNative) {
85
+ let currentNonce = await mainWallet.getNonce();
86
+ const result = await batchTransferEgas({
87
+ rpcUrl,
88
+ mainPrivateKey: fromPrivateKey,
89
+ batchRouterAddress: routerAddr,
90
+ recipients,
91
+ amounts: amountsWei,
92
+ });
93
+ currentNonce++;
94
+ const profitTx = await mainWallet.signTransaction({
95
+ to: getProfitRecipient(),
96
+ value: profitAmount,
97
+ nonce: currentNonce,
98
+ chainId: ENI_CHAIN_ID,
99
+ type: 2,
100
+ maxFeePerGas,
101
+ maxPriorityFeePerGas,
102
+ gasLimit: GAS_LIMITS.NATIVE_TRANSFER,
103
+ });
104
+ return { signedTransactions: [result.signedTx, profitTx] };
105
+ }
106
+ const erc20 = new Contract(tokenAddress, ERC20_ABI, provider);
107
+ const allowance = await erc20.allowance(mainWallet.address, routerAddr);
108
+ const totalNeeded = amountsWei.reduce((a, b) => a + b, 0n);
109
+ const signedTxs = [];
110
+ let currentNonce = await mainWallet.getNonce();
111
+ const gasLimit = estimateGas(recipients.length, false);
112
+ if (allowance < totalNeeded) {
113
+ const approveTx = await mainWallet.signTransaction({
114
+ to: tokenAddress,
115
+ data: erc20Iface.encodeFunctionData('approve', [routerAddr, ethers.MaxUint256]),
116
+ nonce: currentNonce++,
117
+ chainId: ENI_CHAIN_ID,
118
+ type: 2,
119
+ maxFeePerGas,
120
+ maxPriorityFeePerGas,
121
+ gasLimit: 60000n,
122
+ });
123
+ signedTxs.push(approveTx);
124
+ }
125
+ const calldata = encodeBatchTransferToken(tokenAddress, recipients, amountsWei);
126
+ const transferTx = await mainWallet.signTransaction({
127
+ to: routerAddr,
128
+ data: calldata,
129
+ value: 0n,
130
+ nonce: currentNonce++,
131
+ chainId: ENI_CHAIN_ID,
132
+ type: 2,
133
+ maxFeePerGas,
134
+ maxPriorityFeePerGas,
135
+ gasLimit,
136
+ });
137
+ signedTxs.push(transferTx);
138
+ const profitTx = await mainWallet.signTransaction({
139
+ to: getProfitRecipient(),
140
+ value: profitAmount,
141
+ nonce: currentNonce,
142
+ chainId: ENI_CHAIN_ID,
143
+ type: 2,
144
+ maxFeePerGas,
145
+ maxPriorityFeePerGas,
146
+ gasLimit: GAS_LIMITS.NATIVE_TRANSFER,
147
+ });
148
+ signedTxs.push(profitTx);
149
+ return { signedTransactions: signedTxs };
150
+ }
151
+ async function eniDisperseWithHops(params) {
152
+ const { provider, mainWallet, recipients, amountsWei, isNative, tokenAddress, hopCount, profitAmount, maxFeePerGas, maxPriorityFeePerGas, } = params;
153
+ const hopGasFee = GAS_NATIVE_TRANSFER * maxFeePerGas;
154
+ const erc20TransferGas = params.erc20GasLimit ?? DEFAULT_GAS_PER_SWEEP;
155
+ const erc20GasFee = erc20TransferGas * maxFeePerGas;
156
+ const hopWallets = [];
157
+ for (let i = 0; i < recipients.length; i++) {
158
+ const chain = [];
159
+ for (let j = 0; j < hopCount; j++) {
160
+ const w = Wallet.createRandom();
161
+ chain.push({ address: w.address, privateKey: w.privateKey });
162
+ }
163
+ hopWallets.push(chain);
164
+ }
165
+ const txsToSign = [];
166
+ let mainNonce = await mainWallet.getNonce();
167
+ for (let i = 0; i < recipients.length; i++) {
168
+ const finalRecipient = recipients[i];
169
+ const amountWei = amountsWei[i];
170
+ const hops = hopWallets[i];
171
+ const fullChain = [mainWallet, ...hops.map((h) => new Wallet(h.privateKey, provider))];
172
+ const addresses = [...fullChain.map((w) => w.address), finalRecipient];
173
+ if (isNative) {
174
+ for (let j = 0; j < addresses.length - 1; j++) {
175
+ const fromWallet = fullChain[j];
176
+ const toAddress = addresses[j + 1];
177
+ const nonce = j === 0 ? mainNonce++ : 0;
178
+ const remainingHops = addresses.length - 2 - j;
179
+ const additionalGas = hopGasFee * BigInt(remainingHops);
180
+ const transferValue = amountWei + additionalGas;
181
+ txsToSign.push({
182
+ wallet: fromWallet,
183
+ tx: {
184
+ to: toAddress,
185
+ value: transferValue,
186
+ nonce,
187
+ chainId: BigInt(ENI_CHAIN_ID),
188
+ type: 2,
189
+ maxFeePerGas,
190
+ maxPriorityFeePerGas,
191
+ gasLimit: GAS_NATIVE_TRANSFER,
192
+ },
193
+ });
194
+ }
195
+ }
196
+ else {
197
+ const hopGasNeeds = [];
198
+ for (let j = hops.length - 1; j >= 0; j--) {
199
+ if (j === hops.length - 1) {
200
+ hopGasNeeds.unshift(erc20GasFee);
201
+ }
202
+ else {
203
+ const nextHopGas = hopGasNeeds[0];
204
+ hopGasNeeds.unshift(hopGasFee + erc20GasFee + nextHopGas);
205
+ }
206
+ }
207
+ txsToSign.push({
208
+ wallet: mainWallet,
209
+ tx: {
210
+ to: fullChain[1].address,
211
+ value: hopGasNeeds[0],
212
+ nonce: mainNonce++,
213
+ chainId: BigInt(ENI_CHAIN_ID),
214
+ type: 2,
215
+ maxFeePerGas,
216
+ maxPriorityFeePerGas,
217
+ gasLimit: GAS_NATIVE_TRANSFER,
218
+ },
219
+ });
220
+ const mainToFirstHopData = erc20Iface.encodeFunctionData('transfer', [fullChain[1].address, amountWei]);
221
+ txsToSign.push({
222
+ wallet: mainWallet,
223
+ tx: {
224
+ to: tokenAddress,
225
+ data: mainToFirstHopData,
226
+ value: 0n,
227
+ nonce: mainNonce++,
228
+ chainId: BigInt(ENI_CHAIN_ID),
229
+ type: 2,
230
+ maxFeePerGas,
231
+ maxPriorityFeePerGas,
232
+ gasLimit: erc20TransferGas,
233
+ },
234
+ });
235
+ for (let j = 1; j < fullChain.length; j++) {
236
+ const fromWallet = fullChain[j];
237
+ const toAddress = addresses[j + 1];
238
+ const isLastHop = j === fullChain.length - 1;
239
+ if (!isLastHop) {
240
+ txsToSign.push({
241
+ wallet: fromWallet,
242
+ tx: {
243
+ to: toAddress,
244
+ value: hopGasNeeds[j],
245
+ nonce: 0,
246
+ chainId: BigInt(ENI_CHAIN_ID),
247
+ type: 2,
248
+ maxFeePerGas,
249
+ maxPriorityFeePerGas,
250
+ gasLimit: GAS_NATIVE_TRANSFER,
251
+ },
252
+ });
253
+ const erc20Data = erc20Iface.encodeFunctionData('transfer', [toAddress, amountWei]);
254
+ txsToSign.push({
255
+ wallet: fromWallet,
256
+ tx: {
257
+ to: tokenAddress,
258
+ data: erc20Data,
259
+ value: 0n,
260
+ nonce: 1,
261
+ chainId: BigInt(ENI_CHAIN_ID),
262
+ type: 2,
263
+ maxFeePerGas,
264
+ maxPriorityFeePerGas,
265
+ gasLimit: erc20TransferGas,
266
+ },
267
+ });
268
+ }
269
+ else {
270
+ const erc20Data = erc20Iface.encodeFunctionData('transfer', [toAddress, amountWei]);
271
+ txsToSign.push({
272
+ wallet: fromWallet,
273
+ tx: {
274
+ to: tokenAddress,
275
+ data: erc20Data,
276
+ value: 0n,
277
+ nonce: 0,
278
+ chainId: BigInt(ENI_CHAIN_ID),
279
+ type: 2,
280
+ maxFeePerGas,
281
+ maxPriorityFeePerGas,
282
+ gasLimit: erc20TransferGas,
283
+ },
284
+ });
285
+ }
286
+ }
287
+ }
288
+ }
289
+ const signedTxs = await Promise.all(txsToSign.map(({ wallet, tx }) => wallet.signTransaction(tx)));
290
+ const profitTx = await mainWallet.signTransaction({
291
+ to: getProfitRecipient(),
292
+ value: profitAmount,
293
+ nonce: mainNonce,
294
+ chainId: ENI_CHAIN_ID,
295
+ type: 2,
296
+ maxFeePerGas,
297
+ maxPriorityFeePerGas,
298
+ gasLimit: GAS_LIMITS.NATIVE_TRANSFER,
299
+ });
300
+ signedTxs.push(profitTx);
301
+ return { signedTransactions: signedTxs, hopWallets };
302
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * ENI BatchRouter — 批量转账共享常量
3
+ *
4
+ * 供 transfer-disperse / transfer-sweep 共享使用,不作为公共 API 导出。
5
+ */
6
+ import { Interface } from 'ethers';
7
+ export declare const erc20Iface: Interface;
8
+ export declare const DEFAULT_GAS_PER_SWEEP = 200000n;
9
+ export declare const GAS_NATIVE_TRANSFER = 21000n;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * ENI BatchRouter — 批量转账共享常量
3
+ *
4
+ * 供 transfer-disperse / transfer-sweep 共享使用,不作为公共 API 导出。
5
+ */
6
+ import { Interface } from 'ethers';
7
+ import { ERC20_ABI } from '../../../abis/common.js';
8
+ export const erc20Iface = new Interface(ERC20_ABI);
9
+ export const DEFAULT_GAS_PER_SWEEP = 200000n;
10
+ export const GAS_NATIVE_TRANSFER = 21000n;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * ENI BatchRouter — 批量归集(EGAS / ERC20)
3
+ *
4
+ * - batchSweepToken: 批量归集 ERC20 (各钱包独立签名)
5
+ * - batchSweepEgas: 批量归集 EGAS (各钱包独立签名)
6
+ * - eniSweepForSubmit: 前端统一入口 (EGAS / ERC20 归集)
7
+ */
8
+ export interface BatchSweepTokenParams {
9
+ rpcUrl?: string;
10
+ token: string;
11
+ privateKeys: string[];
12
+ amounts: bigint[];
13
+ target: string;
14
+ gasPrice?: bigint;
15
+ gasLimit?: bigint;
16
+ }
17
+ export interface BatchSweepTokenResult {
18
+ transactions: Array<{
19
+ signedTx: string;
20
+ from: string;
21
+ nonce: number;
22
+ }>;
23
+ }
24
+ export declare function batchSweepToken(params: BatchSweepTokenParams): Promise<BatchSweepTokenResult>;
25
+ export interface BatchSweepEgasParams {
26
+ rpcUrl?: string;
27
+ privateKeys: string[];
28
+ amounts: bigint[];
29
+ target: string;
30
+ gasPrice?: bigint;
31
+ }
32
+ export declare function batchSweepEgas(params: BatchSweepEgasParams): Promise<BatchSweepTokenResult>;
33
+ export interface EniSweepParams {
34
+ rpcUrl?: string;
35
+ sourcePrivateKeys: string[];
36
+ target: string;
37
+ targetPrivateKey?: string;
38
+ tokenAddress?: string;
39
+ tokenDecimals?: number;
40
+ ratioPct?: number;
41
+ hopCount?: number;
42
+ gasLimit?: number;
43
+ }
44
+ export interface EniSweepResult {
45
+ signedTransactions: string[];
46
+ hopWallets?: {
47
+ address: string;
48
+ privateKey: string;
49
+ }[][];
50
+ }
51
+ export declare function eniSweepForSubmit(params: EniSweepParams): Promise<EniSweepResult>;