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.
- package/dist/bundle/four-meme/approve-tokenmanager.d.ts +2 -2
- package/dist/bundle/four-meme/approve-tokenmanager.js +3 -3
- package/dist/bundle/four-meme/core/buy-flow.d.ts +5 -0
- package/dist/bundle/four-meme/core/buy-flow.js +147 -0
- package/dist/bundle/four-meme/core/constants.d.ts +6 -0
- package/dist/bundle/four-meme/core/constants.js +15 -0
- package/dist/bundle/four-meme/core/create-token.d.ts +5 -0
- package/dist/bundle/four-meme/core/create-token.js +137 -0
- package/dist/bundle/four-meme/core/index.d.ts +14 -0
- package/dist/bundle/four-meme/core/index.js +14 -0
- package/dist/bundle/four-meme/core/sell-flow.d.ts +5 -0
- package/dist/bundle/four-meme/core/sell-flow.js +240 -0
- package/dist/bundle/four-meme/core-helpers.js +1 -1
- package/dist/bundle/four-meme/core.d.ts +7 -4
- package/dist/bundle/four-meme/core.js +5 -513
- package/dist/bundle/four-meme/pancake-proxy/approve.d.ts +15 -0
- package/dist/bundle/four-meme/pancake-proxy/approve.js +113 -0
- package/dist/bundle/four-meme/pancake-proxy/buy.d.ts +8 -0
- package/dist/bundle/four-meme/pancake-proxy/buy.js +143 -0
- package/dist/bundle/four-meme/pancake-proxy/constants.d.ts +25 -0
- package/dist/bundle/four-meme/pancake-proxy/constants.js +14 -0
- package/dist/bundle/four-meme/pancake-proxy/helpers.d.ts +45 -0
- package/dist/bundle/four-meme/pancake-proxy/helpers.js +232 -0
- package/dist/bundle/four-meme/pancake-proxy/index.d.ts +15 -0
- package/dist/bundle/four-meme/pancake-proxy/index.js +15 -0
- package/dist/bundle/four-meme/pancake-proxy/sell.d.ts +8 -0
- package/dist/bundle/four-meme/pancake-proxy/sell.js +194 -0
- package/dist/bundle/four-meme/pancake-proxy.d.ts +4 -20
- package/dist/bundle/four-meme/pancake-proxy.js +3 -670
- package/dist/bundle/four-meme/private/buy.d.ts +16 -0
- package/dist/bundle/four-meme/private/buy.js +225 -0
- package/dist/bundle/four-meme/private/index.d.ts +11 -0
- package/dist/bundle/four-meme/private/index.js +11 -0
- package/dist/bundle/four-meme/private/sell.d.ts +18 -0
- package/dist/bundle/four-meme/private/sell.js +245 -0
- package/dist/bundle/four-meme/private.d.ts +5 -25
- package/dist/bundle/four-meme/private.js +5 -463
- package/dist/bundle/four-meme/swap/batch.d.ts +8 -0
- package/dist/bundle/four-meme/swap/batch.js +170 -0
- package/dist/bundle/four-meme/swap/bundle.d.ts +8 -0
- package/dist/bundle/four-meme/swap/bundle.js +147 -0
- package/dist/bundle/four-meme/swap/index.d.ts +14 -0
- package/dist/bundle/four-meme/swap/index.js +13 -0
- package/dist/bundle/four-meme/swap/quick-batch.d.ts +8 -0
- package/dist/bundle/four-meme/swap/quick-batch.js +206 -0
- package/dist/bundle/four-meme/swap-buy-first/helpers.d.ts +20 -0
- package/dist/bundle/four-meme/swap-buy-first/helpers.js +39 -0
- package/dist/bundle/four-meme/swap-buy-first/index.d.ts +12 -0
- package/dist/bundle/four-meme/swap-buy-first/index.js +11 -0
- package/dist/bundle/four-meme/swap-buy-first/multi-wallet.d.ts +20 -0
- package/dist/bundle/four-meme/swap-buy-first/multi-wallet.js +198 -0
- package/dist/bundle/four-meme/swap-buy-first/single.d.ts +7 -0
- package/dist/bundle/four-meme/swap-buy-first/single.js +232 -0
- package/dist/bundle/four-meme/swap-buy-first.d.ts +4 -3
- package/dist/bundle/four-meme/swap-buy-first.js +4 -451
- package/dist/bundle/four-meme/swap-hop-helpers.d.ts +2 -2
- package/dist/bundle/four-meme/swap-sign-helpers.d.ts +2 -2
- package/dist/bundle/four-meme/swap-sign-helpers.js +1 -1
- package/dist/bundle/four-meme/swap.d.ts +4 -14
- package/dist/bundle/four-meme/swap.js +4 -502
- package/dist/bundle/four-meme/types/index.d.ts +1 -1
- package/dist/bundle/four-meme/utils-disperse.d.ts +1 -1
- package/dist/bundle/four-meme/utils-disperse.js +1 -1
- package/dist/bundle/four-meme/utils-pairwise.d.ts +1 -1
- package/dist/bundle/four-meme/utils-pairwise.js +1 -1
- package/dist/bundle/four-meme/utils-sweep/context.d.ts +39 -0
- package/dist/bundle/four-meme/utils-sweep/context.js +7 -0
- package/dist/bundle/four-meme/utils-sweep/erc20-no-hop.d.ts +5 -0
- package/dist/bundle/four-meme/utils-sweep/erc20-no-hop.js +162 -0
- package/dist/bundle/four-meme/utils-sweep/index.d.ts +13 -0
- package/dist/bundle/four-meme/utils-sweep/index.js +13 -0
- package/dist/bundle/four-meme/utils-sweep/main.d.ts +8 -0
- package/dist/bundle/four-meme/utils-sweep/main.js +114 -0
- package/dist/bundle/four-meme/utils-sweep/native-no-hop.d.ts +5 -0
- package/dist/bundle/four-meme/utils-sweep/native-no-hop.js +156 -0
- package/dist/bundle/four-meme/utils-sweep/with-hops.d.ts +6 -0
- package/dist/bundle/four-meme/utils-sweep/with-hops.js +382 -0
- package/dist/bundle/four-meme/utils-sweep.d.ts +3 -4
- package/dist/bundle/four-meme/utils-sweep.js +3 -740
- package/dist/bundle/internal.d.ts +2 -2
- package/dist/bundle/sign-context-helpers.d.ts +1 -26
- package/dist/bundle/sign-context-helpers.js +1 -63
- package/dist/bundle/submit/blockrazor.d.ts +94 -0
- package/dist/bundle/submit/blockrazor.js +122 -0
- package/dist/bundle/submit/direct.d.ts +118 -0
- package/dist/bundle/submit/direct.js +484 -0
- package/dist/bundle/submit/helpers.d.ts +7 -0
- package/dist/bundle/submit/helpers.js +15 -0
- package/dist/bundle/submit/index.d.ts +14 -0
- package/dist/bundle/submit/index.js +14 -0
- package/dist/bundle/submit/merkle.d.ts +84 -0
- package/dist/bundle/submit/merkle.js +121 -0
- package/dist/bundle/submit.d.ts +3 -286
- package/dist/bundle/submit.js +3 -724
- package/dist/chains/bsc/four/types.d.ts +1 -1
- package/dist/chains/bsc/index.d.ts +1 -1
- package/dist/chains/bsc/index.js +2 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-build.d.ts +25 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-build.js +177 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-constants.d.ts +30 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-constants.js +24 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +11 -149
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +12 -74
- package/dist/chains/bsc/pancake/bundle-buy-first-multi-wallet.d.ts +9 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-multi-wallet.js +225 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-plan.d.ts +14 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-plan.js +64 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-profit.d.ts +12 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-profit.js +22 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-quote.d.ts +15 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-quote.js +122 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-types.d.ts +179 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-types.js +1 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-validate.d.ts +2 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-validate.js +41 -0
- package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +1 -1
- package/dist/chains/bsc/pancake/bundle-buy-first.js +8 -578
- package/dist/chains/bsc/pancake/bundle-swap-helpers.d.ts +11 -239
- package/dist/chains/bsc/pancake/bundle-swap-helpers.js +12 -564
- package/dist/chains/bsc/pancake/bundle-swap-types.d.ts +183 -0
- package/dist/chains/bsc/pancake/bundle-swap-types.js +17 -0
- package/dist/chains/bsc/pancake/bundle-swap.d.ts +10 -132
- package/dist/chains/bsc/pancake/bundle-swap.js +12 -1003
- package/dist/chains/bsc/pancake/hop-chain.d.ts +18 -0
- package/dist/chains/bsc/pancake/hop-chain.js +227 -0
- package/dist/chains/bsc/pancake/quote.d.ts +14 -0
- package/dist/chains/bsc/pancake/quote.js +84 -0
- package/dist/chains/bsc/pancake/swap-batch.d.ts +42 -0
- package/dist/chains/bsc/pancake/swap-batch.js +283 -0
- package/dist/chains/bsc/pancake/swap-build.d.ts +19 -0
- package/dist/chains/bsc/pancake/swap-build.js +226 -0
- package/dist/chains/bsc/pancake/swap-cross.d.ts +42 -0
- package/dist/chains/bsc/pancake/swap-cross.js +140 -0
- package/dist/chains/bsc/pancake/swap-quick.d.ts +54 -0
- package/dist/chains/bsc/pancake/swap-quick.js +424 -0
- package/dist/chains/bsc/pancake/swap-single.d.ts +2 -0
- package/dist/chains/bsc/pancake/swap-single.js +182 -0
- package/dist/chains/bsc/platforms/four/index.d.ts +21 -3
- package/dist/chains/bsc/platforms/four/index.js +28 -3
- package/dist/chains/eni/batch-router/transfer-disperse.d.ts +37 -0
- package/dist/chains/eni/batch-router/transfer-disperse.js +302 -0
- package/dist/chains/eni/batch-router/transfer-shared.d.ts +9 -0
- package/dist/chains/eni/batch-router/transfer-shared.js +10 -0
- package/dist/chains/eni/batch-router/transfer-sweep.d.ts +51 -0
- package/dist/chains/eni/batch-router/transfer-sweep.js +364 -0
- package/dist/chains/eni/batch-router/transfer.d.ts +4 -74
- package/dist/chains/eni/batch-router/transfer.js +2 -647
- package/dist/chains/eni/index.d.ts +2 -0
- package/dist/chains/eni/index.js +4 -0
- package/dist/chains/eni/platforms/daoaas/portal-direct-profit.d.ts +17 -0
- package/dist/chains/eni/platforms/daoaas/portal-direct-profit.js +30 -0
- package/dist/chains/eni/platforms/daoaas/portal-direct-submit.d.ts +12 -0
- package/dist/chains/eni/platforms/daoaas/portal-direct-submit.js +396 -0
- package/dist/chains/eni/platforms/daoaas/portal-direct-tx.d.ts +20 -0
- package/dist/chains/eni/platforms/daoaas/portal-direct-tx.js +165 -0
- package/dist/chains/eni/platforms/daoaas/portal-direct.d.ts +3 -32
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +3 -571
- package/dist/chains/eni/submit.js +1 -1
- package/dist/chains/xlayer/constants.d.ts +0 -2
- package/dist/chains/xlayer/constants.js +0 -2
- package/dist/chains/xlayer/eip7702/auth.d.ts +16 -0
- package/dist/chains/xlayer/eip7702/auth.js +81 -0
- package/dist/chains/xlayer/eip7702/bundle-create-buy.d.ts +22 -0
- package/dist/chains/xlayer/eip7702/bundle-create-buy.js +201 -0
- package/dist/chains/xlayer/eip7702/bundle-create-helpers.d.ts +114 -0
- package/dist/chains/xlayer/eip7702/bundle-create-helpers.js +139 -0
- package/dist/chains/xlayer/eip7702/bundle-create-to-dex.d.ts +24 -0
- package/dist/chains/xlayer/eip7702/bundle-create-to-dex.js +233 -0
- package/dist/chains/xlayer/eip7702/bundle-create.d.ts +3 -35
- package/dist/chains/xlayer/eip7702/bundle-create.js +3 -746
- package/dist/chains/xlayer/eip7702/bundle-graduate-buy.d.ts +22 -0
- package/dist/chains/xlayer/eip7702/bundle-graduate-buy.js +214 -0
- package/dist/chains/xlayer/eip7702/bundle-sell.js +1 -1
- package/dist/chains/xlayer/eip7702/bundle-swap-batch.d.ts +31 -0
- package/dist/chains/xlayer/eip7702/bundle-swap-batch.js +216 -0
- package/dist/chains/xlayer/eip7702/bundle-swap-helpers.d.ts +21 -0
- package/dist/chains/xlayer/eip7702/bundle-swap-helpers.js +206 -0
- package/dist/chains/xlayer/eip7702/bundle-swap-multi.d.ts +33 -0
- package/dist/chains/xlayer/eip7702/bundle-swap-multi.js +146 -0
- package/dist/chains/xlayer/eip7702/bundle-swap-single.d.ts +31 -0
- package/dist/chains/xlayer/eip7702/bundle-swap-single.js +177 -0
- package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +6 -61
- package/dist/chains/xlayer/eip7702/bundle-swap.js +3 -712
- package/dist/chains/xlayer/eip7702/bytes.d.ts +4 -0
- package/dist/chains/xlayer/eip7702/bytes.js +31 -0
- package/dist/chains/xlayer/eip7702/gas.d.ts +19 -0
- package/dist/chains/xlayer/eip7702/gas.js +152 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-disperse.d.ts +5 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-disperse.js +196 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-pairwise.d.ts +5 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-pairwise.js +188 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-sweep.d.ts +5 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-sweep.js +220 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.d.ts +8 -4
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.js +5 -591
- package/dist/chains/xlayer/eip7702/profit.d.ts +32 -0
- package/dist/chains/xlayer/eip7702/profit.js +59 -0
- package/dist/chains/xlayer/eip7702/provider.d.ts +3 -0
- package/dist/chains/xlayer/eip7702/provider.js +17 -0
- package/dist/chains/xlayer/eip7702/time.d.ts +2 -0
- package/dist/chains/xlayer/eip7702/time.js +10 -0
- package/dist/chains/xlayer/eip7702/tx-build.d.ts +10 -0
- package/dist/chains/xlayer/eip7702/tx-build.js +128 -0
- package/dist/chains/xlayer/eip7702/utils.d.ts +19 -85
- package/dist/chains/xlayer/eip7702/utils.js +19 -484
- package/dist/chains/xlayer/eip7702/volume-bundle.d.ts +13 -0
- package/dist/chains/xlayer/eip7702/volume-bundle.js +250 -0
- package/dist/chains/xlayer/eip7702/volume-internal.d.ts +13 -0
- package/dist/chains/xlayer/eip7702/volume-internal.js +169 -0
- package/dist/chains/xlayer/eip7702/volume-make.d.ts +8 -0
- package/dist/chains/xlayer/eip7702/volume-make.js +38 -0
- package/dist/chains/xlayer/eip7702/volume-single-round.d.ts +17 -0
- package/dist/chains/xlayer/eip7702/volume-single-round.js +44 -0
- package/dist/chains/xlayer/eip7702/volume-swap.d.ts +18 -0
- package/dist/chains/xlayer/eip7702/volume-swap.js +30 -0
- package/dist/chains/xlayer/eip7702/volume-wash.d.ts +8 -0
- package/dist/chains/xlayer/eip7702/volume-wash.js +191 -0
- package/dist/chains/xlayer/eip7702/volume.d.ts +7 -35
- package/dist/chains/xlayer/eip7702/volume.js +5 -697
- package/dist/chains/xlayer/eip7702/wallet.d.ts +6 -0
- package/dist/chains/xlayer/eip7702/wallet.js +17 -0
- package/dist/chains/xlayer/eoa/aa-types.d.ts +176 -0
- package/dist/chains/xlayer/eoa/aa-types.js +6 -0
- package/dist/chains/xlayer/eoa/constants.d.ts +0 -2
- package/dist/chains/xlayer/eoa/constants.js +0 -2
- package/dist/chains/xlayer/eoa/context.d.ts +8 -0
- package/dist/chains/xlayer/eoa/context.js +23 -0
- package/dist/chains/xlayer/eoa/encoders.d.ts +147 -0
- package/dist/chains/xlayer/eoa/encoders.js +147 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-cross.d.ts +5 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-cross.js +113 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts +10 -123
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +10 -225
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-pure.d.ts +50 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-pure.js +170 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-quick.d.ts +5 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-quick.js +257 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-types.d.ts +99 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-types.js +11 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.d.ts +5 -47
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.js +3 -522
- package/dist/chains/xlayer/eoa/eoa-types.d.ts +776 -0
- package/dist/chains/xlayer/eoa/eoa-types.js +6 -0
- package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +8 -0
- package/dist/chains/xlayer/eoa/eoa-wash-volume.js +8 -0
- package/dist/chains/xlayer/eoa/format.d.ts +34 -0
- package/dist/chains/xlayer/eoa/format.js +56 -0
- package/dist/chains/xlayer/eoa/hop-chain.d.ts +4 -0
- package/dist/chains/xlayer/eoa/hop-chain.js +87 -0
- package/dist/chains/xlayer/eoa/nonce-map.d.ts +20 -0
- package/dist/chains/xlayer/eoa/nonce-map.js +51 -0
- package/dist/chains/xlayer/eoa/portal-ops.d.ts +9 -292
- package/dist/chains/xlayer/eoa/portal-ops.js +9 -486
- package/dist/chains/xlayer/eoa/query.d.ts +117 -0
- package/dist/chains/xlayer/eoa/query.js +285 -0
- package/dist/chains/xlayer/eoa/quote.d.ts +6 -0
- package/dist/chains/xlayer/eoa/quote.js +90 -0
- package/dist/chains/xlayer/eoa/types.d.ts +9 -959
- package/dist/chains/xlayer/eoa/types.js +9 -49
- package/dist/core/clients/blockrazor.js +1 -1
- package/dist/core/clients/merkle.js +1 -1
- package/dist/core/erc20/allowances.d.ts +104 -0
- package/dist/core/erc20/allowances.js +205 -0
- package/dist/core/erc20/approve.d.ts +141 -0
- package/dist/core/erc20/approve.js +325 -0
- package/dist/core/erc20/helpers.d.ts +20 -0
- package/dist/core/erc20/helpers.js +109 -0
- package/dist/core/erc20/index.d.ts +13 -0
- package/dist/core/erc20/index.js +12 -0
- package/dist/core/gas/bundle-gas.d.ts +6 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/quote/index.d.ts +1 -0
- package/dist/core/quote/index.js +1 -0
- package/dist/core/quote/quote-helpers.d.ts +78 -0
- package/dist/core/quote/quote-helpers.js +289 -0
- package/dist/core/quote/types.d.ts +1 -0
- package/dist/core/quote/types.js +1 -0
- package/dist/core/sign-context-helpers.d.ts +29 -0
- package/dist/core/sign-context-helpers.js +63 -0
- package/dist/domains/dex/direct-router-helpers.d.ts +16 -268
- package/dist/domains/dex/direct-router-helpers.js +16 -535
- package/dist/domains/dex/direct-router-types.d.ts +104 -0
- package/dist/domains/dex/direct-router-types.js +81 -0
- package/dist/domains/dex/direct-router-v2-buy.d.ts +2 -0
- package/dist/domains/dex/direct-router-v2-buy.js +249 -0
- package/dist/domains/dex/direct-router-v2-sell.d.ts +5 -0
- package/dist/domains/dex/direct-router-v2-sell.js +270 -0
- package/dist/domains/dex/direct-router-v2.d.ts +9 -0
- package/dist/domains/dex/direct-router-v2.js +9 -0
- package/dist/domains/dex/direct-router-v3.d.ts +17 -0
- package/dist/domains/dex/direct-router-v3.js +432 -0
- package/dist/domains/dex/direct-router.d.ts +11 -26
- package/dist/domains/dex/direct-router.js +10 -977
- package/dist/domains/dex/dyo-encode.d.ts +62 -0
- package/dist/domains/dex/dyo-encode.js +124 -0
- package/dist/domains/dex/profit.d.ts +24 -0
- package/dist/domains/dex/profit.js +86 -0
- package/dist/domains/dex/provider.d.ts +10 -0
- package/dist/domains/dex/provider.js +27 -0
- package/dist/domains/dex/quote.d.ts +7 -0
- package/dist/domains/dex/quote.js +52 -0
- package/dist/domains/dex/router.d.ts +56 -0
- package/dist/domains/dex/router.js +193 -0
- package/dist/domains/flap/portal-bundle/batch.d.ts +9 -0
- package/dist/domains/flap/portal-bundle/batch.js +193 -0
- package/dist/domains/flap/portal-bundle/create.d.ts +5 -0
- package/dist/domains/flap/portal-bundle/create.js +153 -0
- package/dist/domains/flap/portal-bundle/helpers.d.ts +32 -0
- package/dist/domains/flap/portal-bundle/helpers.js +50 -0
- package/dist/domains/flap/portal-bundle/index.d.ts +16 -0
- package/dist/domains/flap/portal-bundle/index.js +15 -0
- package/dist/domains/flap/portal-bundle/private.d.ts +5 -0
- package/dist/domains/flap/portal-bundle/private.js +198 -0
- package/dist/domains/flap/portal-bundle/types.d.ts +102 -0
- package/dist/domains/flap/portal-bundle/types.js +1 -0
- package/dist/domains/flap/portal-bundle-merkle/core-batch.d.ts +13 -0
- package/dist/domains/flap/portal-bundle-merkle/core-batch.js +376 -0
- package/dist/domains/flap/portal-bundle-merkle/core-helpers.d.ts +75 -7
- package/dist/domains/flap/portal-bundle-merkle/core-helpers.js +259 -20
- package/dist/domains/flap/portal-bundle-merkle/core.d.ts +2 -13
- package/dist/domains/flap/portal-bundle-merkle/core.js +12 -629
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/constants.d.ts +70 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/constants.js +90 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/index.d.ts +12 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/index.js +11 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/main.d.ts +15 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/main.js +432 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/types.d.ts +113 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/types.js +4 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex.d.ts +4 -127
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex.js +4 -527
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/constants.d.ts +42 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/constants.js +81 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/index.d.ts +12 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/index.js +11 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/main.d.ts +15 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/main.js +339 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/types.d.ts +72 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/types.js +4 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex.d.ts +4 -85
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex.js +4 -425
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/approve.d.ts +12 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/approve.js +102 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/buy.d.ts +5 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/buy.js +135 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/helpers.d.ts +52 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/helpers.js +267 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/index.d.ts +14 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/index.js +14 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/sell.d.ts +5 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/sell.js +195 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy.d.ts +3 -24
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy.js +3 -700
- package/dist/domains/flap/portal-bundle-merkle/private/buy.d.ts +9 -0
- package/dist/domains/flap/portal-bundle-merkle/private/buy.js +188 -0
- package/dist/domains/flap/portal-bundle-merkle/private/helpers.d.ts +36 -0
- package/dist/domains/flap/portal-bundle-merkle/private/helpers.js +127 -0
- package/dist/domains/flap/portal-bundle-merkle/private/index.d.ts +12 -0
- package/dist/domains/flap/portal-bundle-merkle/private/index.js +12 -0
- package/dist/domains/flap/portal-bundle-merkle/private/sell.d.ts +9 -0
- package/dist/domains/flap/portal-bundle-merkle/private/sell.js +191 -0
- package/dist/domains/flap/portal-bundle-merkle/private.d.ts +5 -15
- package/dist/domains/flap/portal-bundle-merkle/private.js +5 -494
- package/dist/domains/flap/portal-bundle-merkle/swap-batch.js +3 -2
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-chain.d.ts +4 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-chain.js +43 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-constants.d.ts +13 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-constants.js +21 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +11 -121
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-helpers.js +11 -109
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-multi-wallet.d.ts +20 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-multi-wallet.js +223 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-plan.d.ts +32 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-plan.js +66 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-profit.d.ts +22 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-profit.js +22 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-quote.d.ts +51 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-quote.js +149 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-types.d.ts +87 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-types.js +1 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first.js +5 -404
- package/dist/domains/flap/portal-bundle-merkle/swap-helpers.d.ts +0 -1
- package/dist/domains/flap/portal-bundle-merkle/swap-helpers.js +0 -7
- package/dist/domains/flap/portal-bundle-merkle/swap-planning.js +1 -1
- package/dist/domains/flap/portal-bundle-merkle/swap-quick-batch.js +3 -2
- package/dist/domains/flap/portal-bundle-merkle/swap-single.js +3 -2
- package/dist/domains/flap/portal-bundle-merkle/utils/disperse.d.ts +2 -0
- package/dist/domains/flap/portal-bundle-merkle/utils/disperse.js +275 -0
- package/dist/domains/flap/portal-bundle-merkle/utils/index.d.ts +11 -0
- package/dist/domains/flap/portal-bundle-merkle/utils/index.js +11 -0
- package/dist/domains/flap/portal-bundle-merkle/utils/sweep.d.ts +9 -0
- package/dist/domains/flap/portal-bundle-merkle/utils/sweep.js +570 -0
- package/dist/domains/flap/portal-bundle-merkle/utils.d.ts +5 -8
- package/dist/domains/flap/portal-bundle-merkle/utils.js +5 -841
- package/dist/domains/flap/portal-bundle.d.ts +5 -117
- package/dist/domains/flap/portal-bundle.js +5 -587
- package/dist/domains/flap/portal.d.ts +13 -404
- package/dist/domains/flap/portal.js +12 -619
- package/dist/domains/flap/reader.d.ts +51 -0
- package/dist/domains/flap/reader.js +275 -0
- package/dist/domains/flap/types.d.ts +246 -0
- package/dist/domains/flap/types.js +104 -0
- package/dist/domains/flap/vault/constants.d.ts +220 -0
- package/dist/domains/flap/vault/constants.js +173 -0
- package/dist/domains/flap/vault/encode.d.ts +39 -0
- package/dist/domains/flap/vault/encode.js +135 -0
- package/dist/domains/flap/vault/index.d.ts +15 -0
- package/dist/domains/flap/vault/index.js +14 -0
- package/dist/domains/flap/vault/query.d.ts +40 -0
- package/dist/domains/flap/vault/query.js +104 -0
- package/dist/domains/flap/vault/types.d.ts +147 -0
- package/dist/domains/flap/vault/types.js +29 -0
- package/dist/domains/flap/vault.d.ts +3 -413
- package/dist/domains/flap/vault.js +3 -467
- package/dist/domains/flap/writer.d.ts +124 -0
- package/dist/domains/flap/writer.js +255 -0
- package/dist/domains/four/contracts/tm-bundle-batch.d.ts +35 -0
- package/dist/domains/four/contracts/tm-bundle-batch.js +286 -0
- package/dist/domains/four/contracts/tm-bundle-create.d.ts +2 -0
- package/dist/domains/four/contracts/tm-bundle-create.js +304 -0
- package/dist/domains/four/contracts/tm-bundle-helpers.d.ts +2 -1
- package/dist/domains/four/contracts/tm-bundle-helpers.js +3 -0
- package/dist/domains/four/contracts/tm-bundle-private.d.ts +36 -0
- package/dist/domains/four/contracts/tm-bundle-private.js +164 -0
- package/dist/domains/four/contracts/tm-bundle.d.ts +10 -71
- package/dist/domains/four/contracts/tm-bundle.js +9 -738
- package/dist/domains/lp-inspect/inspect-helpers.d.ts +25 -0
- package/dist/domains/lp-inspect/inspect-helpers.js +343 -0
- package/dist/domains/lp-inspect/inspect.d.ts +8 -0
- package/dist/domains/lp-inspect/inspect.js +332 -0
- package/dist/domains/lp-inspect/lp-inspect.d.ts +9 -37
- package/dist/domains/lp-inspect/lp-inspect.js +9 -775
- package/dist/domains/lp-inspect/registry.d.ts +43 -0
- package/dist/domains/lp-inspect/registry.js +127 -0
- package/dist/domains/merkle/index.d.ts +1 -1
- package/dist/exports/root-bundle-and-tooling.d.ts +9 -1
- package/dist/exports/root-bundle-and-tooling.js +8 -1
- package/dist/exports/root-foundations.d.ts +1 -1
- package/dist/exports/root-foundations.js +1 -1
- package/dist/exports/root-swap-dex-and-xlayer.d.ts +4 -4
- package/dist/exports/root-swap-dex-and-xlayer.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/swap-helpers.js +1 -1
- 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
|
-
|
|
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>;
|