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
|
@@ -8,650 +8,5 @@
|
|
|
8
8
|
* - eniDisperseForSubmit: 前端统一入口 (EGAS / ERC20 分发)
|
|
9
9
|
* - eniSweepForSubmit: 前端统一入口 (EGAS / ERC20 归集)
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import { createEniProvider } from '../../../utils/provider-factory.js';
|
|
14
|
-
import { BATCH_ROUTER_ADDRESS, estimateGas } from './constants.js';
|
|
15
|
-
import { validateBatchParams, encodeBatchTransfer, encodeBatchTransferToken, buildBatchRouterTx } from './utils.js';
|
|
16
|
-
import { ERC20_ABI } from '../../../abis/common.js';
|
|
17
|
-
import { getProfitRecipient, calculateTransferFee } from '../../../core/constants/profit.js';
|
|
18
|
-
import { GAS_LIMITS } from '../../../core/constants/gas.js';
|
|
19
|
-
const erc20Iface = new Interface(ERC20_ABI);
|
|
20
|
-
const DEFAULT_GAS_PER_SWEEP = 200000n;
|
|
21
|
-
const GAS_NATIVE_TRANSFER = 21000n;
|
|
22
|
-
// ============================================================================
|
|
23
|
-
// 批量分发 EGAS (通过 BatchRouter 合约, 1 笔 tx)
|
|
24
|
-
// ============================================================================
|
|
25
|
-
export async function batchTransferEgas(params) {
|
|
26
|
-
const { recipients, amounts } = params;
|
|
27
|
-
validateBatchParams(recipients, amounts, 'batchTransferEgas');
|
|
28
|
-
const totalValue = amounts.reduce((a, b) => a + b, 0n);
|
|
29
|
-
const calldata = encodeBatchTransfer(recipients, amounts);
|
|
30
|
-
const gasLimit = estimateGas(recipients.length, false);
|
|
31
|
-
const result = await buildBatchRouterTx({
|
|
32
|
-
rpcUrl: params.rpcUrl,
|
|
33
|
-
mainPrivateKey: params.mainPrivateKey,
|
|
34
|
-
batchRouterAddress: params.batchRouterAddress,
|
|
35
|
-
calldata,
|
|
36
|
-
value: totalValue,
|
|
37
|
-
gasLimit,
|
|
38
|
-
gasPrice: params.gasPrice,
|
|
39
|
-
});
|
|
40
|
-
return { ...result, totalValue };
|
|
41
|
-
}
|
|
42
|
-
export async function batchTransferToken(params) {
|
|
43
|
-
const { token, recipients, amounts } = params;
|
|
44
|
-
validateBatchParams(recipients, amounts, 'batchTransferToken');
|
|
45
|
-
const routerAddr = params.batchRouterAddress || BATCH_ROUTER_ADDRESS;
|
|
46
|
-
const calldata = encodeBatchTransferToken(token, recipients, amounts);
|
|
47
|
-
const gasLimit = estimateGas(recipients.length, false);
|
|
48
|
-
const result = await buildBatchRouterTx({
|
|
49
|
-
rpcUrl: params.rpcUrl,
|
|
50
|
-
mainPrivateKey: params.mainPrivateKey,
|
|
51
|
-
batchRouterAddress: routerAddr,
|
|
52
|
-
calldata,
|
|
53
|
-
value: 0n,
|
|
54
|
-
gasLimit,
|
|
55
|
-
gasPrice: params.gasPrice,
|
|
56
|
-
});
|
|
57
|
-
return { ...result, totalValue: amounts.reduce((a, b) => a + b, 0n) };
|
|
58
|
-
}
|
|
59
|
-
export async function batchSweepToken(params) {
|
|
60
|
-
const { rpcUrl = ENI_RPC_URL, token, privateKeys, amounts, target, gasPrice, gasLimit: customGasLimit } = params;
|
|
61
|
-
if (privateKeys.length !== amounts.length) {
|
|
62
|
-
throw new Error(`privateKeys.length (${privateKeys.length}) !== amounts.length (${amounts.length})`);
|
|
63
|
-
}
|
|
64
|
-
const provider = createEniProvider(rpcUrl, ENI_CHAIN_ID);
|
|
65
|
-
const feeData = await provider.getFeeData();
|
|
66
|
-
const maxFeePerGas = gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
67
|
-
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
68
|
-
const transactions = await Promise.all(privateKeys.map(async (key, i) => {
|
|
69
|
-
const wallet = new Wallet(key, provider);
|
|
70
|
-
const nonce = await wallet.getNonce();
|
|
71
|
-
const data = erc20Iface.encodeFunctionData('transfer', [target, amounts[i]]);
|
|
72
|
-
const signedTx = await wallet.signTransaction({
|
|
73
|
-
to: token,
|
|
74
|
-
data,
|
|
75
|
-
nonce,
|
|
76
|
-
chainId: ENI_CHAIN_ID,
|
|
77
|
-
type: 2,
|
|
78
|
-
maxFeePerGas,
|
|
79
|
-
maxPriorityFeePerGas,
|
|
80
|
-
gasLimit: customGasLimit ?? DEFAULT_GAS_PER_SWEEP,
|
|
81
|
-
});
|
|
82
|
-
return { signedTx, from: wallet.address, nonce };
|
|
83
|
-
}));
|
|
84
|
-
return { transactions };
|
|
85
|
-
}
|
|
86
|
-
export async function batchSweepEgas(params) {
|
|
87
|
-
const { rpcUrl = ENI_RPC_URL, privateKeys, amounts, target, gasPrice } = params;
|
|
88
|
-
if (privateKeys.length !== amounts.length) {
|
|
89
|
-
throw new Error(`privateKeys.length (${privateKeys.length}) !== amounts.length (${amounts.length})`);
|
|
90
|
-
}
|
|
91
|
-
const provider = createEniProvider(rpcUrl, ENI_CHAIN_ID);
|
|
92
|
-
const feeData = await provider.getFeeData();
|
|
93
|
-
const maxFeePerGas = gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
94
|
-
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
95
|
-
const transactions = await Promise.all(privateKeys.map(async (key, i) => {
|
|
96
|
-
const wallet = new Wallet(key, provider);
|
|
97
|
-
const nonce = await wallet.getNonce();
|
|
98
|
-
const signedTx = await wallet.signTransaction({
|
|
99
|
-
to: target,
|
|
100
|
-
value: amounts[i],
|
|
101
|
-
nonce,
|
|
102
|
-
chainId: ENI_CHAIN_ID,
|
|
103
|
-
type: 2,
|
|
104
|
-
maxFeePerGas,
|
|
105
|
-
maxPriorityFeePerGas,
|
|
106
|
-
gasLimit: GAS_NATIVE_TRANSFER,
|
|
107
|
-
});
|
|
108
|
-
return { signedTx, from: wallet.address, nonce };
|
|
109
|
-
}));
|
|
110
|
-
return { transactions };
|
|
111
|
-
}
|
|
112
|
-
export async function eniDisperseForSubmit(params) {
|
|
113
|
-
const { rpcUrl = ENI_RPC_URL, fromPrivateKey, recipients, tokenAddress, hopCount = 0 } = params;
|
|
114
|
-
const decimals = params.tokenDecimals ?? 18;
|
|
115
|
-
const isNative = !tokenAddress || tokenAddress === ethers.ZeroAddress;
|
|
116
|
-
const amountsWei = params.amounts.map((a) => ethers.parseUnits(a, decimals));
|
|
117
|
-
const provider = createEniProvider(rpcUrl, ENI_CHAIN_ID);
|
|
118
|
-
const mainWallet = new Wallet(fromPrivateKey, provider);
|
|
119
|
-
const feeData = await provider.getFeeData();
|
|
120
|
-
const maxFeePerGas = feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
121
|
-
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
122
|
-
const profitTxGasCost = GAS_LIMITS.NATIVE_TRANSFER * maxFeePerGas;
|
|
123
|
-
const profitAmount = calculateTransferFee(ENI_CHAIN_ID, recipients.length) + profitTxGasCost;
|
|
124
|
-
const erc20GasLimit = params.gasLimit ? BigInt(params.gasLimit) : DEFAULT_GAS_PER_SWEEP;
|
|
125
|
-
if (hopCount > 0) {
|
|
126
|
-
return eniDisperseWithHops({
|
|
127
|
-
provider,
|
|
128
|
-
mainWallet,
|
|
129
|
-
recipients,
|
|
130
|
-
amountsWei,
|
|
131
|
-
isNative,
|
|
132
|
-
tokenAddress,
|
|
133
|
-
hopCount,
|
|
134
|
-
profitAmount,
|
|
135
|
-
maxFeePerGas,
|
|
136
|
-
maxPriorityFeePerGas,
|
|
137
|
-
erc20GasLimit,
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
// ===== 无多跳:使用 BatchRouter 合约批量分发 =====
|
|
141
|
-
const routerAddr = BATCH_ROUTER_ADDRESS;
|
|
142
|
-
if (isNative) {
|
|
143
|
-
let currentNonce = await mainWallet.getNonce();
|
|
144
|
-
const result = await batchTransferEgas({
|
|
145
|
-
rpcUrl,
|
|
146
|
-
mainPrivateKey: fromPrivateKey,
|
|
147
|
-
batchRouterAddress: routerAddr,
|
|
148
|
-
recipients,
|
|
149
|
-
amounts: amountsWei,
|
|
150
|
-
});
|
|
151
|
-
currentNonce++;
|
|
152
|
-
const profitTx = await mainWallet.signTransaction({
|
|
153
|
-
to: getProfitRecipient(),
|
|
154
|
-
value: profitAmount,
|
|
155
|
-
nonce: currentNonce,
|
|
156
|
-
chainId: ENI_CHAIN_ID,
|
|
157
|
-
type: 2,
|
|
158
|
-
maxFeePerGas,
|
|
159
|
-
maxPriorityFeePerGas,
|
|
160
|
-
gasLimit: GAS_LIMITS.NATIVE_TRANSFER,
|
|
161
|
-
});
|
|
162
|
-
return { signedTransactions: [result.signedTx, profitTx] };
|
|
163
|
-
}
|
|
164
|
-
const erc20 = new Contract(tokenAddress, ERC20_ABI, provider);
|
|
165
|
-
const allowance = await erc20.allowance(mainWallet.address, routerAddr);
|
|
166
|
-
const totalNeeded = amountsWei.reduce((a, b) => a + b, 0n);
|
|
167
|
-
const signedTxs = [];
|
|
168
|
-
let currentNonce = await mainWallet.getNonce();
|
|
169
|
-
const gasLimit = estimateGas(recipients.length, false);
|
|
170
|
-
if (allowance < totalNeeded) {
|
|
171
|
-
const approveTx = await mainWallet.signTransaction({
|
|
172
|
-
to: tokenAddress,
|
|
173
|
-
data: erc20Iface.encodeFunctionData('approve', [routerAddr, ethers.MaxUint256]),
|
|
174
|
-
nonce: currentNonce++,
|
|
175
|
-
chainId: ENI_CHAIN_ID,
|
|
176
|
-
type: 2,
|
|
177
|
-
maxFeePerGas,
|
|
178
|
-
maxPriorityFeePerGas,
|
|
179
|
-
gasLimit: 60000n,
|
|
180
|
-
});
|
|
181
|
-
signedTxs.push(approveTx);
|
|
182
|
-
}
|
|
183
|
-
const calldata = encodeBatchTransferToken(tokenAddress, recipients, amountsWei);
|
|
184
|
-
const transferTx = await mainWallet.signTransaction({
|
|
185
|
-
to: routerAddr,
|
|
186
|
-
data: calldata,
|
|
187
|
-
value: 0n,
|
|
188
|
-
nonce: currentNonce++,
|
|
189
|
-
chainId: ENI_CHAIN_ID,
|
|
190
|
-
type: 2,
|
|
191
|
-
maxFeePerGas,
|
|
192
|
-
maxPriorityFeePerGas,
|
|
193
|
-
gasLimit,
|
|
194
|
-
});
|
|
195
|
-
signedTxs.push(transferTx);
|
|
196
|
-
const profitTx = await mainWallet.signTransaction({
|
|
197
|
-
to: getProfitRecipient(),
|
|
198
|
-
value: profitAmount,
|
|
199
|
-
nonce: currentNonce,
|
|
200
|
-
chainId: ENI_CHAIN_ID,
|
|
201
|
-
type: 2,
|
|
202
|
-
maxFeePerGas,
|
|
203
|
-
maxPriorityFeePerGas,
|
|
204
|
-
gasLimit: GAS_LIMITS.NATIVE_TRANSFER,
|
|
205
|
-
});
|
|
206
|
-
signedTxs.push(profitTx);
|
|
207
|
-
return { signedTransactions: signedTxs };
|
|
208
|
-
}
|
|
209
|
-
async function eniDisperseWithHops(params) {
|
|
210
|
-
const { provider, mainWallet, recipients, amountsWei, isNative, tokenAddress, hopCount, profitAmount, maxFeePerGas, maxPriorityFeePerGas, } = params;
|
|
211
|
-
const hopGasFee = GAS_NATIVE_TRANSFER * maxFeePerGas;
|
|
212
|
-
const erc20TransferGas = params.erc20GasLimit ?? DEFAULT_GAS_PER_SWEEP;
|
|
213
|
-
const erc20GasFee = erc20TransferGas * maxFeePerGas;
|
|
214
|
-
const hopWallets = [];
|
|
215
|
-
for (let i = 0; i < recipients.length; i++) {
|
|
216
|
-
const chain = [];
|
|
217
|
-
for (let j = 0; j < hopCount; j++) {
|
|
218
|
-
const w = Wallet.createRandom();
|
|
219
|
-
chain.push({ address: w.address, privateKey: w.privateKey });
|
|
220
|
-
}
|
|
221
|
-
hopWallets.push(chain);
|
|
222
|
-
}
|
|
223
|
-
const txsToSign = [];
|
|
224
|
-
let mainNonce = await mainWallet.getNonce();
|
|
225
|
-
for (let i = 0; i < recipients.length; i++) {
|
|
226
|
-
const finalRecipient = recipients[i];
|
|
227
|
-
const amountWei = amountsWei[i];
|
|
228
|
-
const hops = hopWallets[i];
|
|
229
|
-
const fullChain = [mainWallet, ...hops.map((h) => new Wallet(h.privateKey, provider))];
|
|
230
|
-
const addresses = [...fullChain.map((w) => w.address), finalRecipient];
|
|
231
|
-
if (isNative) {
|
|
232
|
-
for (let j = 0; j < addresses.length - 1; j++) {
|
|
233
|
-
const fromWallet = fullChain[j];
|
|
234
|
-
const toAddress = addresses[j + 1];
|
|
235
|
-
const nonce = j === 0 ? mainNonce++ : 0;
|
|
236
|
-
const remainingHops = addresses.length - 2 - j;
|
|
237
|
-
const additionalGas = hopGasFee * BigInt(remainingHops);
|
|
238
|
-
const transferValue = amountWei + additionalGas;
|
|
239
|
-
txsToSign.push({
|
|
240
|
-
wallet: fromWallet,
|
|
241
|
-
tx: {
|
|
242
|
-
to: toAddress,
|
|
243
|
-
value: transferValue,
|
|
244
|
-
nonce,
|
|
245
|
-
chainId: BigInt(ENI_CHAIN_ID),
|
|
246
|
-
type: 2,
|
|
247
|
-
maxFeePerGas,
|
|
248
|
-
maxPriorityFeePerGas,
|
|
249
|
-
gasLimit: GAS_NATIVE_TRANSFER,
|
|
250
|
-
},
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
const hopGasNeeds = [];
|
|
256
|
-
for (let j = hops.length - 1; j >= 0; j--) {
|
|
257
|
-
if (j === hops.length - 1) {
|
|
258
|
-
hopGasNeeds.unshift(erc20GasFee);
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
const nextHopGas = hopGasNeeds[0];
|
|
262
|
-
hopGasNeeds.unshift(hopGasFee + erc20GasFee + nextHopGas);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
txsToSign.push({
|
|
266
|
-
wallet: mainWallet,
|
|
267
|
-
tx: {
|
|
268
|
-
to: fullChain[1].address,
|
|
269
|
-
value: hopGasNeeds[0],
|
|
270
|
-
nonce: mainNonce++,
|
|
271
|
-
chainId: BigInt(ENI_CHAIN_ID),
|
|
272
|
-
type: 2,
|
|
273
|
-
maxFeePerGas,
|
|
274
|
-
maxPriorityFeePerGas,
|
|
275
|
-
gasLimit: GAS_NATIVE_TRANSFER,
|
|
276
|
-
},
|
|
277
|
-
});
|
|
278
|
-
const mainToFirstHopData = erc20Iface.encodeFunctionData('transfer', [fullChain[1].address, amountWei]);
|
|
279
|
-
txsToSign.push({
|
|
280
|
-
wallet: mainWallet,
|
|
281
|
-
tx: {
|
|
282
|
-
to: tokenAddress,
|
|
283
|
-
data: mainToFirstHopData,
|
|
284
|
-
value: 0n,
|
|
285
|
-
nonce: mainNonce++,
|
|
286
|
-
chainId: BigInt(ENI_CHAIN_ID),
|
|
287
|
-
type: 2,
|
|
288
|
-
maxFeePerGas,
|
|
289
|
-
maxPriorityFeePerGas,
|
|
290
|
-
gasLimit: erc20TransferGas,
|
|
291
|
-
},
|
|
292
|
-
});
|
|
293
|
-
for (let j = 1; j < fullChain.length; j++) {
|
|
294
|
-
const fromWallet = fullChain[j];
|
|
295
|
-
const toAddress = addresses[j + 1];
|
|
296
|
-
const isLastHop = j === fullChain.length - 1;
|
|
297
|
-
if (!isLastHop) {
|
|
298
|
-
txsToSign.push({
|
|
299
|
-
wallet: fromWallet,
|
|
300
|
-
tx: {
|
|
301
|
-
to: toAddress,
|
|
302
|
-
value: hopGasNeeds[j],
|
|
303
|
-
nonce: 0,
|
|
304
|
-
chainId: BigInt(ENI_CHAIN_ID),
|
|
305
|
-
type: 2,
|
|
306
|
-
maxFeePerGas,
|
|
307
|
-
maxPriorityFeePerGas,
|
|
308
|
-
gasLimit: GAS_NATIVE_TRANSFER,
|
|
309
|
-
},
|
|
310
|
-
});
|
|
311
|
-
const erc20Data = erc20Iface.encodeFunctionData('transfer', [toAddress, amountWei]);
|
|
312
|
-
txsToSign.push({
|
|
313
|
-
wallet: fromWallet,
|
|
314
|
-
tx: {
|
|
315
|
-
to: tokenAddress,
|
|
316
|
-
data: erc20Data,
|
|
317
|
-
value: 0n,
|
|
318
|
-
nonce: 1,
|
|
319
|
-
chainId: BigInt(ENI_CHAIN_ID),
|
|
320
|
-
type: 2,
|
|
321
|
-
maxFeePerGas,
|
|
322
|
-
maxPriorityFeePerGas,
|
|
323
|
-
gasLimit: erc20TransferGas,
|
|
324
|
-
},
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
else {
|
|
328
|
-
const erc20Data = erc20Iface.encodeFunctionData('transfer', [toAddress, amountWei]);
|
|
329
|
-
txsToSign.push({
|
|
330
|
-
wallet: fromWallet,
|
|
331
|
-
tx: {
|
|
332
|
-
to: tokenAddress,
|
|
333
|
-
data: erc20Data,
|
|
334
|
-
value: 0n,
|
|
335
|
-
nonce: 0,
|
|
336
|
-
chainId: BigInt(ENI_CHAIN_ID),
|
|
337
|
-
type: 2,
|
|
338
|
-
maxFeePerGas,
|
|
339
|
-
maxPriorityFeePerGas,
|
|
340
|
-
gasLimit: erc20TransferGas,
|
|
341
|
-
},
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
const signedTxs = await Promise.all(txsToSign.map(({ wallet, tx }) => wallet.signTransaction(tx)));
|
|
348
|
-
const profitTx = await mainWallet.signTransaction({
|
|
349
|
-
to: getProfitRecipient(),
|
|
350
|
-
value: profitAmount,
|
|
351
|
-
nonce: mainNonce,
|
|
352
|
-
chainId: ENI_CHAIN_ID,
|
|
353
|
-
type: 2,
|
|
354
|
-
maxFeePerGas,
|
|
355
|
-
maxPriorityFeePerGas,
|
|
356
|
-
gasLimit: GAS_LIMITS.NATIVE_TRANSFER,
|
|
357
|
-
});
|
|
358
|
-
signedTxs.push(profitTx);
|
|
359
|
-
return { signedTransactions: signedTxs, hopWallets };
|
|
360
|
-
}
|
|
361
|
-
export async function eniSweepForSubmit(params) {
|
|
362
|
-
const { rpcUrl = ENI_RPC_URL, sourcePrivateKeys, target, targetPrivateKey, tokenAddress, hopCount = 0 } = params;
|
|
363
|
-
const isNative = !tokenAddress || tokenAddress === ethers.ZeroAddress;
|
|
364
|
-
const ratioPct = params.ratioPct ?? 100;
|
|
365
|
-
const erc20GasLimit = params.gasLimit ? BigInt(params.gasLimit) : DEFAULT_GAS_PER_SWEEP;
|
|
366
|
-
const provider = createEniProvider(rpcUrl, ENI_CHAIN_ID);
|
|
367
|
-
const feeData = await provider.getFeeData();
|
|
368
|
-
const maxFeePerGas = feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
369
|
-
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
370
|
-
const gasForTransfer = GAS_NATIVE_TRANSFER * maxFeePerGas;
|
|
371
|
-
if (isNative) {
|
|
372
|
-
const balances = await Promise.all(sourcePrivateKeys.map(async (key) => {
|
|
373
|
-
const wallet = new Wallet(key, provider);
|
|
374
|
-
return provider.getBalance(wallet.address);
|
|
375
|
-
}));
|
|
376
|
-
const totalHopGasReserve = hopCount > 0 ? gasForTransfer * BigInt(hopCount) : 0n;
|
|
377
|
-
const validKeys = [];
|
|
378
|
-
const validAmounts = [];
|
|
379
|
-
for (let i = 0; i < sourcePrivateKeys.length; i++) {
|
|
380
|
-
const bal = balances[i];
|
|
381
|
-
const sweepable = bal - gasForTransfer - totalHopGasReserve;
|
|
382
|
-
if (sweepable <= 0n)
|
|
383
|
-
continue;
|
|
384
|
-
const amount = ratioPct >= 100 ? sweepable : (sweepable * BigInt(ratioPct)) / 100n;
|
|
385
|
-
if (amount <= 0n)
|
|
386
|
-
continue;
|
|
387
|
-
validKeys.push(sourcePrivateKeys[i]);
|
|
388
|
-
validAmounts.push(amount);
|
|
389
|
-
}
|
|
390
|
-
if (validKeys.length === 0)
|
|
391
|
-
return { signedTransactions: [] };
|
|
392
|
-
if (hopCount > 0) {
|
|
393
|
-
return eniSweepWithHops({
|
|
394
|
-
provider,
|
|
395
|
-
validKeys,
|
|
396
|
-
validAmounts,
|
|
397
|
-
target,
|
|
398
|
-
targetPrivateKey,
|
|
399
|
-
isNative: true,
|
|
400
|
-
hopCount,
|
|
401
|
-
maxFeePerGas,
|
|
402
|
-
maxPriorityFeePerGas,
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
const result = await batchSweepEgas({ rpcUrl, privateKeys: validKeys, amounts: validAmounts, target });
|
|
406
|
-
const signedTxs = result.transactions.map((tx) => tx.signedTx);
|
|
407
|
-
if (targetPrivateKey) {
|
|
408
|
-
const profitTxGasCost = GAS_LIMITS.NATIVE_TRANSFER * maxFeePerGas;
|
|
409
|
-
const profitAmount = calculateTransferFee(ENI_CHAIN_ID, validKeys.length) + profitTxGasCost;
|
|
410
|
-
const targetWallet = new Wallet(targetPrivateKey, provider);
|
|
411
|
-
const targetNonce = await targetWallet.getNonce();
|
|
412
|
-
const profitTx = await targetWallet.signTransaction({
|
|
413
|
-
to: getProfitRecipient(),
|
|
414
|
-
value: profitAmount,
|
|
415
|
-
nonce: targetNonce,
|
|
416
|
-
chainId: ENI_CHAIN_ID,
|
|
417
|
-
type: 2,
|
|
418
|
-
maxFeePerGas,
|
|
419
|
-
maxPriorityFeePerGas,
|
|
420
|
-
gasLimit: GAS_LIMITS.NATIVE_TRANSFER,
|
|
421
|
-
});
|
|
422
|
-
signedTxs.push(profitTx);
|
|
423
|
-
}
|
|
424
|
-
return { signedTransactions: signedTxs };
|
|
425
|
-
}
|
|
426
|
-
// ===== ERC20 归集 =====
|
|
427
|
-
const erc20 = new Contract(tokenAddress, ERC20_ABI, provider);
|
|
428
|
-
const erc20TransferGasCost = erc20GasLimit * maxFeePerGas;
|
|
429
|
-
const hopGasCostPerWallet = hopCount > 0 ? gasForTransfer * BigInt(hopCount) + erc20GasLimit * maxFeePerGas * BigInt(hopCount) : 0n;
|
|
430
|
-
const minNativeRequired = erc20TransferGasCost + hopGasCostPerWallet;
|
|
431
|
-
const walletsData = await Promise.all(sourcePrivateKeys.map(async (key) => {
|
|
432
|
-
const wallet = new Wallet(key, provider);
|
|
433
|
-
const [tokenBal, nativeBal] = await Promise.all([
|
|
434
|
-
erc20.balanceOf(wallet.address),
|
|
435
|
-
provider.getBalance(wallet.address),
|
|
436
|
-
]);
|
|
437
|
-
return { tokenBal, nativeBal };
|
|
438
|
-
}));
|
|
439
|
-
const validKeys = [];
|
|
440
|
-
const validAmounts = [];
|
|
441
|
-
for (let i = 0; i < sourcePrivateKeys.length; i++) {
|
|
442
|
-
const { tokenBal, nativeBal } = walletsData[i];
|
|
443
|
-
if (tokenBal <= 0n)
|
|
444
|
-
continue;
|
|
445
|
-
if (nativeBal < minNativeRequired) {
|
|
446
|
-
continue;
|
|
447
|
-
}
|
|
448
|
-
const amount = ratioPct >= 100 ? tokenBal : (tokenBal * BigInt(ratioPct)) / 100n;
|
|
449
|
-
if (amount <= 0n)
|
|
450
|
-
continue;
|
|
451
|
-
validKeys.push(sourcePrivateKeys[i]);
|
|
452
|
-
validAmounts.push(amount);
|
|
453
|
-
}
|
|
454
|
-
if (validKeys.length === 0)
|
|
455
|
-
return { signedTransactions: [] };
|
|
456
|
-
if (hopCount > 0) {
|
|
457
|
-
return eniSweepWithHops({
|
|
458
|
-
provider,
|
|
459
|
-
validKeys,
|
|
460
|
-
validAmounts,
|
|
461
|
-
target,
|
|
462
|
-
targetPrivateKey,
|
|
463
|
-
isNative: false,
|
|
464
|
-
tokenAddress,
|
|
465
|
-
hopCount,
|
|
466
|
-
maxFeePerGas,
|
|
467
|
-
maxPriorityFeePerGas,
|
|
468
|
-
erc20GasLimit,
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
const result = await batchSweepToken({
|
|
472
|
-
rpcUrl,
|
|
473
|
-
token: tokenAddress,
|
|
474
|
-
privateKeys: validKeys,
|
|
475
|
-
amounts: validAmounts,
|
|
476
|
-
target,
|
|
477
|
-
gasLimit: erc20GasLimit,
|
|
478
|
-
});
|
|
479
|
-
const signedTxs = result.transactions.map((tx) => tx.signedTx);
|
|
480
|
-
if (targetPrivateKey) {
|
|
481
|
-
const profitTxGasCost = GAS_LIMITS.NATIVE_TRANSFER * maxFeePerGas;
|
|
482
|
-
const profitAmount = calculateTransferFee(ENI_CHAIN_ID, validKeys.length) + profitTxGasCost;
|
|
483
|
-
const targetWallet = new Wallet(targetPrivateKey, provider);
|
|
484
|
-
const targetNonce = await targetWallet.getNonce();
|
|
485
|
-
const profitTx = await targetWallet.signTransaction({
|
|
486
|
-
to: getProfitRecipient(),
|
|
487
|
-
value: profitAmount,
|
|
488
|
-
nonce: targetNonce,
|
|
489
|
-
chainId: ENI_CHAIN_ID,
|
|
490
|
-
type: 2,
|
|
491
|
-
maxFeePerGas,
|
|
492
|
-
maxPriorityFeePerGas,
|
|
493
|
-
gasLimit: GAS_LIMITS.NATIVE_TRANSFER,
|
|
494
|
-
});
|
|
495
|
-
signedTxs.push(profitTx);
|
|
496
|
-
}
|
|
497
|
-
return { signedTransactions: signedTxs };
|
|
498
|
-
}
|
|
499
|
-
async function eniSweepWithHops(params) {
|
|
500
|
-
const { provider, validKeys, validAmounts, target, targetPrivateKey, isNative, tokenAddress, hopCount, maxFeePerGas, maxPriorityFeePerGas, } = params;
|
|
501
|
-
const hopGasFee = GAS_NATIVE_TRANSFER * maxFeePerGas;
|
|
502
|
-
const erc20TransferGas = params.erc20GasLimit ?? DEFAULT_GAS_PER_SWEEP;
|
|
503
|
-
const erc20GasFee = erc20TransferGas * maxFeePerGas;
|
|
504
|
-
const hopWallets = [];
|
|
505
|
-
for (let i = 0; i < validKeys.length; i++) {
|
|
506
|
-
const chain = [];
|
|
507
|
-
for (let j = 0; j < hopCount; j++) {
|
|
508
|
-
const w = Wallet.createRandom();
|
|
509
|
-
chain.push({ address: w.address, privateKey: w.privateKey });
|
|
510
|
-
}
|
|
511
|
-
hopWallets.push(chain);
|
|
512
|
-
}
|
|
513
|
-
const txsToSign = [];
|
|
514
|
-
for (let i = 0; i < validKeys.length; i++) {
|
|
515
|
-
const sourceWallet = new Wallet(validKeys[i], provider);
|
|
516
|
-
const amountWei = validAmounts[i];
|
|
517
|
-
const hops = hopWallets[i];
|
|
518
|
-
const fullChain = [sourceWallet, ...hops.map((h) => new Wallet(h.privateKey, provider))];
|
|
519
|
-
const addresses = [...fullChain.map((w) => w.address), target];
|
|
520
|
-
const sourceNonce = await sourceWallet.getNonce();
|
|
521
|
-
if (isNative) {
|
|
522
|
-
for (let j = 0; j < addresses.length - 1; j++) {
|
|
523
|
-
const fromWallet = fullChain[j];
|
|
524
|
-
const toAddress = addresses[j + 1];
|
|
525
|
-
const nonce = j === 0 ? sourceNonce : 0;
|
|
526
|
-
const remainingHops = addresses.length - 2 - j;
|
|
527
|
-
const additionalGas = hopGasFee * BigInt(remainingHops);
|
|
528
|
-
const transferValue = amountWei + additionalGas;
|
|
529
|
-
txsToSign.push({
|
|
530
|
-
wallet: fromWallet,
|
|
531
|
-
tx: {
|
|
532
|
-
to: toAddress,
|
|
533
|
-
value: transferValue,
|
|
534
|
-
nonce,
|
|
535
|
-
chainId: BigInt(ENI_CHAIN_ID),
|
|
536
|
-
type: 2,
|
|
537
|
-
maxFeePerGas,
|
|
538
|
-
maxPriorityFeePerGas,
|
|
539
|
-
gasLimit: GAS_NATIVE_TRANSFER,
|
|
540
|
-
},
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
else {
|
|
545
|
-
const hopGasNeeds = [];
|
|
546
|
-
for (let j = hops.length - 1; j >= 0; j--) {
|
|
547
|
-
if (j === hops.length - 1) {
|
|
548
|
-
hopGasNeeds.unshift(erc20GasFee);
|
|
549
|
-
}
|
|
550
|
-
else {
|
|
551
|
-
const nextHopGas = hopGasNeeds[0];
|
|
552
|
-
hopGasNeeds.unshift(hopGasFee + erc20GasFee + nextHopGas);
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
let srcNonce = sourceNonce;
|
|
556
|
-
txsToSign.push({
|
|
557
|
-
wallet: sourceWallet,
|
|
558
|
-
tx: {
|
|
559
|
-
to: fullChain[1].address,
|
|
560
|
-
value: hopGasNeeds[0],
|
|
561
|
-
nonce: srcNonce++,
|
|
562
|
-
chainId: BigInt(ENI_CHAIN_ID),
|
|
563
|
-
type: 2,
|
|
564
|
-
maxFeePerGas,
|
|
565
|
-
maxPriorityFeePerGas,
|
|
566
|
-
gasLimit: GAS_NATIVE_TRANSFER,
|
|
567
|
-
},
|
|
568
|
-
});
|
|
569
|
-
const srcToFirstHopData = erc20Iface.encodeFunctionData('transfer', [fullChain[1].address, amountWei]);
|
|
570
|
-
txsToSign.push({
|
|
571
|
-
wallet: sourceWallet,
|
|
572
|
-
tx: {
|
|
573
|
-
to: tokenAddress,
|
|
574
|
-
data: srcToFirstHopData,
|
|
575
|
-
value: 0n,
|
|
576
|
-
nonce: srcNonce,
|
|
577
|
-
chainId: BigInt(ENI_CHAIN_ID),
|
|
578
|
-
type: 2,
|
|
579
|
-
maxFeePerGas,
|
|
580
|
-
maxPriorityFeePerGas,
|
|
581
|
-
gasLimit: erc20TransferGas,
|
|
582
|
-
},
|
|
583
|
-
});
|
|
584
|
-
for (let j = 1; j < fullChain.length; j++) {
|
|
585
|
-
const fromWallet = fullChain[j];
|
|
586
|
-
const toAddress = addresses[j + 1];
|
|
587
|
-
const isLastHop = j === fullChain.length - 1;
|
|
588
|
-
if (!isLastHop) {
|
|
589
|
-
txsToSign.push({
|
|
590
|
-
wallet: fromWallet,
|
|
591
|
-
tx: {
|
|
592
|
-
to: toAddress,
|
|
593
|
-
value: hopGasNeeds[j],
|
|
594
|
-
nonce: 0,
|
|
595
|
-
chainId: BigInt(ENI_CHAIN_ID),
|
|
596
|
-
type: 2,
|
|
597
|
-
maxFeePerGas,
|
|
598
|
-
maxPriorityFeePerGas,
|
|
599
|
-
gasLimit: GAS_NATIVE_TRANSFER,
|
|
600
|
-
},
|
|
601
|
-
});
|
|
602
|
-
const erc20Data = erc20Iface.encodeFunctionData('transfer', [toAddress, amountWei]);
|
|
603
|
-
txsToSign.push({
|
|
604
|
-
wallet: fromWallet,
|
|
605
|
-
tx: {
|
|
606
|
-
to: tokenAddress,
|
|
607
|
-
data: erc20Data,
|
|
608
|
-
value: 0n,
|
|
609
|
-
nonce: 1,
|
|
610
|
-
chainId: BigInt(ENI_CHAIN_ID),
|
|
611
|
-
type: 2,
|
|
612
|
-
maxFeePerGas,
|
|
613
|
-
maxPriorityFeePerGas,
|
|
614
|
-
gasLimit: erc20TransferGas,
|
|
615
|
-
},
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
else {
|
|
619
|
-
const erc20Data = erc20Iface.encodeFunctionData('transfer', [toAddress, amountWei]);
|
|
620
|
-
txsToSign.push({
|
|
621
|
-
wallet: fromWallet,
|
|
622
|
-
tx: {
|
|
623
|
-
to: tokenAddress,
|
|
624
|
-
data: erc20Data,
|
|
625
|
-
value: 0n,
|
|
626
|
-
nonce: 0,
|
|
627
|
-
chainId: BigInt(ENI_CHAIN_ID),
|
|
628
|
-
type: 2,
|
|
629
|
-
maxFeePerGas,
|
|
630
|
-
maxPriorityFeePerGas,
|
|
631
|
-
gasLimit: erc20TransferGas,
|
|
632
|
-
},
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
const signedTxs = await Promise.all(txsToSign.map(({ wallet, tx }) => wallet.signTransaction(tx)));
|
|
639
|
-
if (targetPrivateKey) {
|
|
640
|
-
const profitTxGasCost = GAS_LIMITS.NATIVE_TRANSFER * maxFeePerGas;
|
|
641
|
-
const profitAmount = calculateTransferFee(ENI_CHAIN_ID, validKeys.length) + profitTxGasCost;
|
|
642
|
-
const targetWallet = new Wallet(targetPrivateKey, provider);
|
|
643
|
-
const targetNonce = await targetWallet.getNonce();
|
|
644
|
-
const profitTx = await targetWallet.signTransaction({
|
|
645
|
-
to: getProfitRecipient(),
|
|
646
|
-
value: profitAmount,
|
|
647
|
-
nonce: targetNonce,
|
|
648
|
-
chainId: ENI_CHAIN_ID,
|
|
649
|
-
type: 2,
|
|
650
|
-
maxFeePerGas,
|
|
651
|
-
maxPriorityFeePerGas,
|
|
652
|
-
gasLimit: GAS_LIMITS.NATIVE_TRANSFER,
|
|
653
|
-
});
|
|
654
|
-
signedTxs.push(profitTx);
|
|
655
|
-
}
|
|
656
|
-
return { signedTransactions: signedTxs, hopWallets };
|
|
657
|
-
}
|
|
11
|
+
export { batchTransferEgas, batchTransferToken, eniDisperseForSubmit } from './transfer-disperse.js';
|
|
12
|
+
export { batchSweepToken, batchSweepEgas, eniSweepForSubmit } from './transfer-sweep.js';
|
|
@@ -21,3 +21,5 @@ export type { LPPairInfo, GetLPInfoParams, BatchGetLPInfoParams, AddLiquidityETH
|
|
|
21
21
|
export { IroFactoryQuery as EniIroFactoryQuery, encodeCreateProjectCall as eniIroEncodeCreateProjectCall, createProject as eniIroCreateProject, parseCreateProjectEvent as eniIroParseCreateProjectEvent, IroTokenQuery as EniIroTokenQuery, subscribe as eniIroSubscribe, pledge as eniIroPledge, batchSubscribe as eniIroBatchSubscribe, batchSubscribeForSubmit as eniIroBatchSubscribeForSubmit, IroPoolQuery as EniIroPoolQuery, poolRemovePledge as eniIroPoolRemovePledge, poolExtract as eniIroPoolExtract, poolTransferAwards as eniIroPoolTransferAwards, batchExtract as eniIroBatchExtract, ENI_IRO_FACTORY_ADDRESS, ENI_IRO_OWNER_ADDRESS, ENI_IRO_SELL_FEE_CONTRACT, ENI_IROSWAP_V2_ROUTER, ENI_IROSWAP_V2_FACTORY, IRO_FACTORY_ABI as ENI_IRO_FACTORY_ABI, IRO_TOKEN_ABI as ENI_IRO_TOKEN_ABI, IRO_POOL_ABI as ENI_IRO_POOL_ABI, CREATE_PROJECT_GAS_LIMIT as ENI_CREATE_PROJECT_GAS_LIMIT, ENI_IRO_PLATFORM_URL, setIroApiBase as setEniIroApiBase, iroApiCreateProject as eniIroApiCreateProject, iroApiUploadImage as eniIroApiUploadImage, getTokenWhiteList as eniIroGetTokenWhiteList, addTokenWhiteListForSubmit as eniIroAddTokenWhiteListForSubmit, batchAddTokenWhiteListForSubmit as eniIroBatchAddTokenWhiteListForSubmit, removeTokenWhiteListForSubmit as eniIroRemoveTokenWhiteListForSubmit, IRO_OWNER_WHITELIST_ABI as ENI_IRO_OWNER_WHITELIST_ABI, } from './platforms/iro/index.js';
|
|
22
22
|
export type { WhiteListQuota as EniWhiteListQuota, IroCreateProjectParams as EniIroCreateProjectParams, IroSubscribeParams as EniIroSubscribeParams, IroPledgeParams as EniIroPledgeParams, IroTokenInfo as EniIroTokenInfo, IroTxResult as EniIroTxResult, IroCreateProjectResult as EniIroCreateProjectResult, IroQueryConfig as EniIroQueryConfig, IroCreateParams as EniIroCreateParams, IroBatchSubscribeForSubmitParams as EniIroBatchSubscribeForSubmitParams, IroBatchSubscribeForSubmitResult as EniIroBatchSubscribeForSubmitResult, WhitelistManageConfig as EniWhitelistManageConfig, AddWhitelistParams as EniAddWhitelistParams, BatchAddWhitelistParams as EniBatchAddWhitelistParams, RemoveWhitelistParams as EniRemoveWhitelistParams, GetWhitelistParams as EniGetWhitelistParams, } from './platforms/iro/index.js';
|
|
23
23
|
export * from './flat-aliases.js';
|
|
24
|
+
export { submitBundleToEni, submitEniParallelThenProfit, } from './submit.js';
|
|
25
|
+
export type { EniBundleSubmitConfig, EniBundleSubmitResult, EniTxResult, } from './submit.js';
|
package/dist/chains/eni/index.js
CHANGED
|
@@ -32,3 +32,7 @@ export { getLPPairInfo, batchGetLPPairInfo, getPairAddress, addLiquidityETHForSu
|
|
|
32
32
|
// ============================================================================
|
|
33
33
|
export { IroFactoryQuery as EniIroFactoryQuery, encodeCreateProjectCall as eniIroEncodeCreateProjectCall, createProject as eniIroCreateProject, parseCreateProjectEvent as eniIroParseCreateProjectEvent, IroTokenQuery as EniIroTokenQuery, subscribe as eniIroSubscribe, pledge as eniIroPledge, batchSubscribe as eniIroBatchSubscribe, batchSubscribeForSubmit as eniIroBatchSubscribeForSubmit, IroPoolQuery as EniIroPoolQuery, poolRemovePledge as eniIroPoolRemovePledge, poolExtract as eniIroPoolExtract, poolTransferAwards as eniIroPoolTransferAwards, batchExtract as eniIroBatchExtract, ENI_IRO_FACTORY_ADDRESS, ENI_IRO_OWNER_ADDRESS, ENI_IRO_SELL_FEE_CONTRACT, ENI_IROSWAP_V2_ROUTER, ENI_IROSWAP_V2_FACTORY, IRO_FACTORY_ABI as ENI_IRO_FACTORY_ABI, IRO_TOKEN_ABI as ENI_IRO_TOKEN_ABI, IRO_POOL_ABI as ENI_IRO_POOL_ABI, CREATE_PROJECT_GAS_LIMIT as ENI_CREATE_PROJECT_GAS_LIMIT, ENI_IRO_PLATFORM_URL, setIroApiBase as setEniIroApiBase, iroApiCreateProject as eniIroApiCreateProject, iroApiUploadImage as eniIroApiUploadImage, getTokenWhiteList as eniIroGetTokenWhiteList, addTokenWhiteListForSubmit as eniIroAddTokenWhiteListForSubmit, batchAddTokenWhiteListForSubmit as eniIroBatchAddTokenWhiteListForSubmit, removeTokenWhiteListForSubmit as eniIroRemoveTokenWhiteListForSubmit, IRO_OWNER_WHITELIST_ABI as ENI_IRO_OWNER_WHITELIST_ABI, } from './platforms/iro/index.js';
|
|
34
34
|
export * from './flat-aliases.js';
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// 快捷导出 - Bundle 提交
|
|
37
|
+
// ============================================================================
|
|
38
|
+
export { submitBundleToEni, submitEniParallelThenProfit, } from './submit.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DAOaaS Portal 利润转账 (Phase 1: 直接转到收益地址)
|
|
3
|
+
*/
|
|
4
|
+
import type { DaoaasTxResult } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* 构建利润转账交易
|
|
7
|
+
* ENI 不需要多跳,直接转到收益地址
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildProfitTransfer(params: {
|
|
10
|
+
rpcUrl?: string;
|
|
11
|
+
payerKey: string;
|
|
12
|
+
profitAmount: bigint;
|
|
13
|
+
gasPrice?: bigint;
|
|
14
|
+
nonce?: number;
|
|
15
|
+
maxFeePerGas?: bigint;
|
|
16
|
+
maxPriorityFeePerGas?: bigint;
|
|
17
|
+
}): Promise<DaoaasTxResult>;
|