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
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FlapPrivateBuyMerkleParams, FlapPrivateTransactionResult, FlapBatchPrivateBuyMerkleParams, FlapBatchPrivateMerkleResult } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 私有购买(单笔)(Merkle 版本)
|
|
4
|
+
*/
|
|
5
|
+
export declare function flapPrivateBuyMerkle(params: FlapPrivateBuyMerkleParams): Promise<FlapPrivateTransactionResult>;
|
|
6
|
+
/**
|
|
7
|
+
* 批量私有购买(Merkle 版本)
|
|
8
|
+
*/
|
|
9
|
+
export declare function flapBatchPrivateBuyMerkle(params: FlapBatchPrivateBuyMerkleParams): Promise<FlapBatchPrivateMerkleResult>;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { ethers, Wallet } from 'ethers';
|
|
2
|
+
import { getOptimizedGasPrice, buildProfitHopTransactions, PROFIT_HOP_COUNT } from '../../../../utils/bundle-helpers.js';
|
|
3
|
+
import { FLAP_PORTAL_ADDRESSES } from '../../constants.js';
|
|
4
|
+
import { ZERO_ADDRESS } from '../../../../core/constants/index.js';
|
|
5
|
+
import { GAS_LIMITS } from '../../../../core/constants/index.js';
|
|
6
|
+
import { PORTAL_ABI, getTxType, getGasPriceConfig, shouldExtractProfit, calculateBatchProfit, getProfitRecipient, getBribeAmount, BLOCKRAZOR_BUILDER_EOA, } from '../config.js';
|
|
7
|
+
import { createMerkleContext, splitBuyAmount, parseMinOutput, resolveGasLimit, resolveBatchMinOutputs, findMaxIndex, signBatchTransactions, } from './helpers.js';
|
|
8
|
+
/**
|
|
9
|
+
* 私有购买(单笔)(Merkle 版本)
|
|
10
|
+
*/
|
|
11
|
+
export async function flapPrivateBuyMerkle(params) {
|
|
12
|
+
const { chain, privateKey, tokenAddress, amountIn, minOutputAmount, config } = params;
|
|
13
|
+
const { chainId, provider } = createMerkleContext(chain, config);
|
|
14
|
+
const wallet = new Wallet(privateKey, provider);
|
|
15
|
+
const portalAddr = FLAP_PORTAL_ADDRESSES[chain];
|
|
16
|
+
const originalAmountWei = ethers.parseEther(amountIn);
|
|
17
|
+
// ✅ 利润提取配置
|
|
18
|
+
const extractProfit = shouldExtractProfit();
|
|
19
|
+
const { actualAmountWei, profitWei } = splitBuyAmount(originalAmountWei, extractProfit);
|
|
20
|
+
const minAmountOut = parseMinOutput(minOutputAmount);
|
|
21
|
+
const portal = new ethers.Contract(portalAddr, PORTAL_ABI, wallet);
|
|
22
|
+
// ✅ 并行获取 gasPrice、nonce 和构建未签名交易
|
|
23
|
+
const [gasPrice, currentNonce, unsigned] = await Promise.all([
|
|
24
|
+
getOptimizedGasPrice(provider, getGasPriceConfig(config)),
|
|
25
|
+
// ✅ 使用 pending nonce,避免 xLayer 等链上“已有 pending 交易”导致 nonce too low
|
|
26
|
+
provider.getTransactionCount(wallet.address, 'pending'),
|
|
27
|
+
portal.swapExactInput.populateTransaction({
|
|
28
|
+
inputToken: ZERO_ADDRESS,
|
|
29
|
+
outputToken: tokenAddress,
|
|
30
|
+
inputAmount: actualAmountWei,
|
|
31
|
+
minOutputAmount: minAmountOut,
|
|
32
|
+
permitData: '0x',
|
|
33
|
+
}, { value: actualAmountWei }),
|
|
34
|
+
]);
|
|
35
|
+
const gasLimit = resolveGasLimit(config.gasLimitMultiplier);
|
|
36
|
+
// ✅ 获取贿赂金额
|
|
37
|
+
const bribeAmount = getBribeAmount(config);
|
|
38
|
+
const needBribeTx = bribeAmount > 0n;
|
|
39
|
+
const needProfitTx = extractProfit && profitWei > 0n;
|
|
40
|
+
// ✅ 分配 nonces:贿赂 → 买入 → 利润
|
|
41
|
+
let nonceIdx = 0;
|
|
42
|
+
const bribeNonce = needBribeTx ? currentNonce + nonceIdx++ : undefined;
|
|
43
|
+
const buyNonce = currentNonce + nonceIdx++;
|
|
44
|
+
const profitNonce = needProfitTx ? currentNonce + nonceIdx : undefined;
|
|
45
|
+
// ✅ 并行签名所有交易(贿赂、买入、利润)
|
|
46
|
+
const signPromises = [];
|
|
47
|
+
const txType = getTxType(config);
|
|
48
|
+
// 贿赂交易
|
|
49
|
+
if (needBribeTx && bribeNonce !== undefined) {
|
|
50
|
+
signPromises.push(wallet.signTransaction({
|
|
51
|
+
to: BLOCKRAZOR_BUILDER_EOA,
|
|
52
|
+
value: bribeAmount,
|
|
53
|
+
nonce: bribeNonce,
|
|
54
|
+
gasPrice,
|
|
55
|
+
gasLimit: GAS_LIMITS.BRIBE,
|
|
56
|
+
chainId,
|
|
57
|
+
type: txType,
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
// 买入交易
|
|
61
|
+
signPromises.push(wallet.signTransaction({
|
|
62
|
+
...unsigned,
|
|
63
|
+
from: wallet.address,
|
|
64
|
+
nonce: buyNonce,
|
|
65
|
+
gasLimit,
|
|
66
|
+
gasPrice,
|
|
67
|
+
chainId,
|
|
68
|
+
type: txType,
|
|
69
|
+
value: actualAmountWei,
|
|
70
|
+
}));
|
|
71
|
+
// ✅ 并行签名完成后按顺序返回
|
|
72
|
+
const signedTxs = await Promise.all(signPromises);
|
|
73
|
+
// ✅ 利润多跳转账(强制 2 跳中转)
|
|
74
|
+
let profitHopWallets;
|
|
75
|
+
if (needProfitTx && profitNonce !== undefined) {
|
|
76
|
+
const profitHopResult = await buildProfitHopTransactions({
|
|
77
|
+
provider,
|
|
78
|
+
payerWallet: wallet,
|
|
79
|
+
profitAmount: profitWei,
|
|
80
|
+
profitRecipient: getProfitRecipient(),
|
|
81
|
+
hopCount: PROFIT_HOP_COUNT,
|
|
82
|
+
gasPrice,
|
|
83
|
+
chainId,
|
|
84
|
+
txType,
|
|
85
|
+
startNonce: profitNonce,
|
|
86
|
+
});
|
|
87
|
+
signedTxs.push(...profitHopResult.signedTransactions);
|
|
88
|
+
profitHopWallets = profitHopResult.hopWallets; // ✅ 收集利润多跳钱包
|
|
89
|
+
}
|
|
90
|
+
return { signedTransactions: signedTxs, profitHopWallets }; // ✅ 返回利润多跳钱包
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 批量私有购买(Merkle 版本)
|
|
94
|
+
*/
|
|
95
|
+
export async function flapBatchPrivateBuyMerkle(params) {
|
|
96
|
+
const { chain, privateKeys, amountsIn, tokenAddress, minOutputAmounts, config } = params;
|
|
97
|
+
if (privateKeys.length !== amountsIn.length) {
|
|
98
|
+
throw new Error('privateKeys and amountsIn length mismatch');
|
|
99
|
+
}
|
|
100
|
+
const { chainId, provider } = createMerkleContext(chain, config);
|
|
101
|
+
const portalAddr = FLAP_PORTAL_ADDRESSES[chain];
|
|
102
|
+
const wallets = privateKeys.map((k) => new Wallet(k, provider));
|
|
103
|
+
const originalAmountsWei = amountsIn.map((a) => ethers.parseEther(a));
|
|
104
|
+
// ✅ 利润提取配置
|
|
105
|
+
const extractProfit = shouldExtractProfit();
|
|
106
|
+
const { totalProfit, remainingAmounts } = calculateBatchProfit(originalAmountsWei);
|
|
107
|
+
const actualAmountsWei = remainingAmounts;
|
|
108
|
+
const maxFundsIndex = findMaxIndex(originalAmountsWei);
|
|
109
|
+
const minOuts = resolveBatchMinOutputs(minOutputAmounts, wallets.length);
|
|
110
|
+
const portals = wallets.map((w) => new ethers.Contract(portalAddr, PORTAL_ABI, w));
|
|
111
|
+
// ✅ 获取贿赂金额
|
|
112
|
+
const bribeAmount = getBribeAmount(config);
|
|
113
|
+
const needBribeTx = bribeAmount > 0n;
|
|
114
|
+
const needProfitTx = extractProfit && totalProfit > 0n;
|
|
115
|
+
// ✅ 并行获取 gasPrice、所有 nonces 和构建未签名交易
|
|
116
|
+
const [gasPrice, initialNonces, unsignedList] = await Promise.all([
|
|
117
|
+
getOptimizedGasPrice(provider, getGasPriceConfig(config)),
|
|
118
|
+
// ✅ 使用 pending nonce,避免 xLayer 等链上“已有 pending 交易”导致 nonce too low
|
|
119
|
+
Promise.all(wallets.map((w) => provider.getTransactionCount(w.address, 'pending'))),
|
|
120
|
+
Promise.all(portals.map((portal, i) => portal.swapExactInput.populateTransaction({
|
|
121
|
+
inputToken: ZERO_ADDRESS,
|
|
122
|
+
outputToken: tokenAddress,
|
|
123
|
+
inputAmount: actualAmountsWei[i],
|
|
124
|
+
minOutputAmount: minOuts[i],
|
|
125
|
+
permitData: '0x',
|
|
126
|
+
}, { value: actualAmountsWei[i] }))),
|
|
127
|
+
]);
|
|
128
|
+
// ✅ 分配 nonces:贿赂(可选) → 买入 → 利润(可选)
|
|
129
|
+
let payerNonceOffset = 0;
|
|
130
|
+
let bribeNonce;
|
|
131
|
+
if (needBribeTx && maxFundsIndex >= 0) {
|
|
132
|
+
bribeNonce = initialNonces[maxFundsIndex];
|
|
133
|
+
payerNonceOffset++;
|
|
134
|
+
}
|
|
135
|
+
const nonces = initialNonces.map((n, i) => {
|
|
136
|
+
if (i === maxFundsIndex) {
|
|
137
|
+
return n + payerNonceOffset; // payer 的买入 nonce 需要偏移
|
|
138
|
+
}
|
|
139
|
+
return n;
|
|
140
|
+
});
|
|
141
|
+
const profitNonce = needProfitTx && maxFundsIndex >= 0 ? initialNonces[maxFundsIndex] + payerNonceOffset + 1 : undefined;
|
|
142
|
+
const gasLimit = resolveGasLimit(config.gasLimitMultiplier);
|
|
143
|
+
const gasLimits = new Array(wallets.length).fill(gasLimit);
|
|
144
|
+
const signedTxs = [];
|
|
145
|
+
// ✅ 贿赂交易放在首位
|
|
146
|
+
if (needBribeTx && bribeNonce !== undefined && maxFundsIndex >= 0) {
|
|
147
|
+
const bribeTx = await wallets[maxFundsIndex].signTransaction({
|
|
148
|
+
to: BLOCKRAZOR_BUILDER_EOA,
|
|
149
|
+
value: bribeAmount,
|
|
150
|
+
nonce: bribeNonce,
|
|
151
|
+
gasPrice,
|
|
152
|
+
gasLimit: GAS_LIMITS.BRIBE,
|
|
153
|
+
chainId,
|
|
154
|
+
type: getTxType(config),
|
|
155
|
+
});
|
|
156
|
+
signedTxs.push(bribeTx);
|
|
157
|
+
}
|
|
158
|
+
// ✅ 并行签名所有买入交易
|
|
159
|
+
const signedList = await signBatchTransactions({
|
|
160
|
+
unsignedList,
|
|
161
|
+
wallets,
|
|
162
|
+
nonces,
|
|
163
|
+
gasLimits,
|
|
164
|
+
gasPrice,
|
|
165
|
+
chainId,
|
|
166
|
+
config,
|
|
167
|
+
values: actualAmountsWei,
|
|
168
|
+
});
|
|
169
|
+
signedTxs.push(...signedList);
|
|
170
|
+
// ✅ 利润多跳转账(强制 2 跳中转)
|
|
171
|
+
let profitHopWallets;
|
|
172
|
+
if (needProfitTx && profitNonce !== undefined && maxFundsIndex >= 0) {
|
|
173
|
+
const profitHopResult = await buildProfitHopTransactions({
|
|
174
|
+
provider,
|
|
175
|
+
payerWallet: wallets[maxFundsIndex],
|
|
176
|
+
profitAmount: totalProfit,
|
|
177
|
+
profitRecipient: getProfitRecipient(),
|
|
178
|
+
hopCount: PROFIT_HOP_COUNT,
|
|
179
|
+
gasPrice,
|
|
180
|
+
chainId,
|
|
181
|
+
txType: getTxType(config),
|
|
182
|
+
startNonce: profitNonce,
|
|
183
|
+
});
|
|
184
|
+
signedTxs.push(...profitHopResult.signedTransactions);
|
|
185
|
+
profitHopWallets = profitHopResult.hopWallets; // ✅ 收集利润多跳钱包
|
|
186
|
+
}
|
|
187
|
+
return { signedTransactions: signedTxs, profitHopWallets }; // ✅ 返回利润多跳钱包
|
|
188
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ethers, Wallet } from 'ethers';
|
|
2
|
+
import type { FlapPrivateBuyMerkleParams } from '../types.js';
|
|
3
|
+
type FlapChain = FlapPrivateBuyMerkleParams['chain'];
|
|
4
|
+
type FlapConfig = FlapPrivateBuyMerkleParams['config'];
|
|
5
|
+
export declare function createMerkleContext(chain: FlapChain, config: FlapConfig): {
|
|
6
|
+
chainId: number;
|
|
7
|
+
provider: ethers.JsonRpcProvider;
|
|
8
|
+
};
|
|
9
|
+
export declare function splitBuyAmount(amount: bigint, extractProfit: boolean): {
|
|
10
|
+
actualAmountWei: bigint;
|
|
11
|
+
profitWei: bigint;
|
|
12
|
+
};
|
|
13
|
+
export declare function parseMinOutput(value?: string | bigint): bigint;
|
|
14
|
+
export declare function resolveGasLimit(multiplier?: number, defaultGas?: number): bigint;
|
|
15
|
+
export declare function resolveSingleSellOutputs(portal: ethers.Contract, tokenAddress: string, amountWei: bigint, minOutputAmount?: string | bigint): Promise<{
|
|
16
|
+
quotedOutput: any;
|
|
17
|
+
minOut: bigint;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function resolveBatchMinOutputs(minOutputAmounts: (string | bigint)[] | undefined, walletCount: number): any[];
|
|
20
|
+
export declare function findMaxIndex(values: bigint[]): number;
|
|
21
|
+
type SignBatchParams = {
|
|
22
|
+
unsignedList: ethers.TransactionLike[];
|
|
23
|
+
wallets: Wallet[];
|
|
24
|
+
nonces: number[];
|
|
25
|
+
gasLimits: bigint[];
|
|
26
|
+
gasPrice: bigint;
|
|
27
|
+
chainId: number;
|
|
28
|
+
config: FlapConfig;
|
|
29
|
+
values?: bigint[];
|
|
30
|
+
};
|
|
31
|
+
export declare function signBatchTransactions({ unsignedList, wallets, nonces, gasLimits, gasPrice, chainId, config, values, }: SignBatchParams): Promise<string[]>;
|
|
32
|
+
export declare function summarizeSellProfits(quotedOutputs: bigint[], extractProfit: boolean): {
|
|
33
|
+
totalProfit: bigint;
|
|
34
|
+
maxRevenueIndex: number;
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { ethers, JsonRpcProvider } from 'ethers';
|
|
2
|
+
import { MerkleClient } from '../../../../core/clients/merkle.js';
|
|
3
|
+
import { ZERO_ADDRESS, CHAINS } from '../../../../core/constants/index.js';
|
|
4
|
+
import { CHAIN_ID_MAP, getTxType, calculateProfit, } from '../config.js';
|
|
5
|
+
const DEFAULT_GAS_LIMIT = 800000;
|
|
6
|
+
export function createMerkleContext(chain, config) {
|
|
7
|
+
const chainId = CHAIN_ID_MAP[chain];
|
|
8
|
+
// ✅ 检查是否为 Merkle 支持的链(BSC, ETH)
|
|
9
|
+
// Monad 不支持 Merkle 捆绑服务,使用普通 RPC
|
|
10
|
+
if (chainId !== CHAINS.BSC.chainId && chainId !== CHAINS.ETHEREUM.chainId) {
|
|
11
|
+
// 对于不支持 Merkle 的链(如 Monad),必须提供自定义 RPC
|
|
12
|
+
if (!config.customRpcUrl) {
|
|
13
|
+
throw new Error(`Chain ${chain} (chainId: ${chainId}) does not support Merkle bundle service. Please provide customRpcUrl.`);
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
chainId,
|
|
17
|
+
// ✅ 禁用 ENS: 避免 "network does not support ENS" 错误
|
|
18
|
+
provider: new JsonRpcProvider(config.customRpcUrl, { chainId, name: chain.toLowerCase(), ensAddress: undefined }),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const merkle = new MerkleClient({
|
|
22
|
+
apiKey: config.apiKey,
|
|
23
|
+
chainId: chainId, // 类型断言为 Merkle 支持的 chainId
|
|
24
|
+
customRpcUrl: config.customRpcUrl,
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
chainId,
|
|
28
|
+
provider: merkle.getProvider(),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function splitBuyAmount(amount, extractProfit) {
|
|
32
|
+
if (!extractProfit) {
|
|
33
|
+
return { actualAmountWei: amount, profitWei: 0n };
|
|
34
|
+
}
|
|
35
|
+
const { remaining, profit } = calculateProfit(amount);
|
|
36
|
+
return { actualAmountWei: remaining, profitWei: profit };
|
|
37
|
+
}
|
|
38
|
+
export function parseMinOutput(value) {
|
|
39
|
+
if (value === undefined) {
|
|
40
|
+
return 0n;
|
|
41
|
+
}
|
|
42
|
+
return typeof value === 'string' ? ethers.parseUnits(value, 18) : value;
|
|
43
|
+
}
|
|
44
|
+
export function resolveGasLimit(multiplier, defaultGas = DEFAULT_GAS_LIMIT) {
|
|
45
|
+
const factor = multiplier ?? 1.0;
|
|
46
|
+
return BigInt(Math.ceil(defaultGas * factor));
|
|
47
|
+
}
|
|
48
|
+
export async function resolveSingleSellOutputs(portal, tokenAddress, amountWei, minOutputAmount) {
|
|
49
|
+
if (minOutputAmount !== undefined) {
|
|
50
|
+
const minOut = typeof minOutputAmount === 'string' ? ethers.parseEther(minOutputAmount) : minOutputAmount;
|
|
51
|
+
return {
|
|
52
|
+
quotedOutput: minOut,
|
|
53
|
+
minOut,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const quotedOutput = await portal.quoteExactInput.staticCall({
|
|
58
|
+
inputToken: tokenAddress,
|
|
59
|
+
outputToken: ZERO_ADDRESS,
|
|
60
|
+
inputAmount: amountWei,
|
|
61
|
+
});
|
|
62
|
+
return {
|
|
63
|
+
quotedOutput,
|
|
64
|
+
minOut: 0n, // ✅ 已移除滑点保护:minOut 固定为 0
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return {
|
|
69
|
+
quotedOutput: 0n,
|
|
70
|
+
minOut: 0n,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export function resolveBatchMinOutputs(minOutputAmounts, walletCount) {
|
|
75
|
+
if (minOutputAmounts && minOutputAmounts.length === walletCount) {
|
|
76
|
+
return minOutputAmounts.map((m) => (typeof m === 'string' ? ethers.parseUnits(m, 18) : m));
|
|
77
|
+
}
|
|
78
|
+
return new Array(walletCount).fill(0n);
|
|
79
|
+
}
|
|
80
|
+
export function findMaxIndex(values) {
|
|
81
|
+
if (values.length === 0) {
|
|
82
|
+
return -1;
|
|
83
|
+
}
|
|
84
|
+
let maxIndex = 0;
|
|
85
|
+
let maxValue = values[0];
|
|
86
|
+
for (let i = 1; i < values.length; i++) {
|
|
87
|
+
if (values[i] > maxValue) {
|
|
88
|
+
maxValue = values[i];
|
|
89
|
+
maxIndex = i;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return maxIndex;
|
|
93
|
+
}
|
|
94
|
+
export async function signBatchTransactions({ unsignedList, wallets, nonces, gasLimits, gasPrice, chainId, config, values, }) {
|
|
95
|
+
return await Promise.all(unsignedList.map((unsigned, i) => {
|
|
96
|
+
const value = values ? values[i] : (unsigned.value ?? 0n);
|
|
97
|
+
return wallets[i].signTransaction({
|
|
98
|
+
...unsigned,
|
|
99
|
+
from: wallets[i].address,
|
|
100
|
+
nonce: nonces[i],
|
|
101
|
+
gasLimit: gasLimits[i],
|
|
102
|
+
gasPrice,
|
|
103
|
+
chainId,
|
|
104
|
+
type: getTxType(config),
|
|
105
|
+
value,
|
|
106
|
+
});
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
export function summarizeSellProfits(quotedOutputs, extractProfit) {
|
|
110
|
+
let totalProfit = 0n;
|
|
111
|
+
let maxRevenueIndex = -1;
|
|
112
|
+
let maxRevenue = 0n;
|
|
113
|
+
if (extractProfit) {
|
|
114
|
+
for (let i = 0; i < quotedOutputs.length; i++) {
|
|
115
|
+
const quoted = quotedOutputs[i];
|
|
116
|
+
if (quoted > 0n) {
|
|
117
|
+
const { profit } = calculateProfit(quoted);
|
|
118
|
+
totalProfit += profit;
|
|
119
|
+
if (quoted > maxRevenue) {
|
|
120
|
+
maxRevenue = quoted;
|
|
121
|
+
maxRevenueIndex = i;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return { totalProfit, maxRevenueIndex: maxRevenueIndex < 0 ? 0 : maxRevenueIndex };
|
|
127
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 私有交易(Merkle 版本)barrel
|
|
3
|
+
*
|
|
4
|
+
* 原超长文件按职责拆分为:
|
|
5
|
+
* - helpers.ts:Merkle 上下文 / 金额解析 / nonce 分配 / 批量签名 / 利润汇总
|
|
6
|
+
* - buy.ts:flapPrivateBuyMerkle / flapBatchPrivateBuyMerkle
|
|
7
|
+
* - sell.ts:flapPrivateSellMerkle / flapBatchPrivateSellMerkle
|
|
8
|
+
*
|
|
9
|
+
* 对外 export 符号与路径保持不变。
|
|
10
|
+
*/
|
|
11
|
+
export { flapPrivateBuyMerkle, flapBatchPrivateBuyMerkle } from './buy.js';
|
|
12
|
+
export { flapPrivateSellMerkle, flapBatchPrivateSellMerkle } from './sell.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 私有交易(Merkle 版本)barrel
|
|
3
|
+
*
|
|
4
|
+
* 原超长文件按职责拆分为:
|
|
5
|
+
* - helpers.ts:Merkle 上下文 / 金额解析 / nonce 分配 / 批量签名 / 利润汇总
|
|
6
|
+
* - buy.ts:flapPrivateBuyMerkle / flapBatchPrivateBuyMerkle
|
|
7
|
+
* - sell.ts:flapPrivateSellMerkle / flapBatchPrivateSellMerkle
|
|
8
|
+
*
|
|
9
|
+
* 对外 export 符号与路径保持不变。
|
|
10
|
+
*/
|
|
11
|
+
export { flapPrivateBuyMerkle, flapBatchPrivateBuyMerkle } from './buy.js';
|
|
12
|
+
export { flapPrivateSellMerkle, flapBatchPrivateSellMerkle } from './sell.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FlapPrivateSellMerkleParams, FlapPrivateTransactionResult, FlapBatchPrivateSellMerkleParams, FlapBatchPrivateMerkleResult } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 私有卖出(单笔)(Merkle 版本)
|
|
4
|
+
*/
|
|
5
|
+
export declare function flapPrivateSellMerkle(params: FlapPrivateSellMerkleParams): Promise<FlapPrivateTransactionResult>;
|
|
6
|
+
/**
|
|
7
|
+
* 批量私有卖出(Merkle 版本)
|
|
8
|
+
*/
|
|
9
|
+
export declare function flapBatchPrivateSellMerkle(params: FlapBatchPrivateSellMerkleParams): Promise<FlapBatchPrivateMerkleResult>;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { ethers, Wallet } from 'ethers';
|
|
2
|
+
import { getOptimizedGasPrice, buildProfitHopTransactions, PROFIT_HOP_COUNT } from '../../../../utils/bundle-helpers.js';
|
|
3
|
+
import { FLAP_PORTAL_ADDRESSES } from '../../constants.js';
|
|
4
|
+
import { ZERO_ADDRESS } from '../../../../core/constants/index.js';
|
|
5
|
+
import { GAS_LIMITS } from '../../../../core/constants/index.js';
|
|
6
|
+
import { PORTAL_ABI, getTxType, getGasPriceConfig, shouldExtractProfit, calculateProfit, getProfitRecipient, getBribeAmount, BLOCKRAZOR_BUILDER_EOA, } from '../config.js';
|
|
7
|
+
import { createMerkleContext, resolveGasLimit, resolveSingleSellOutputs, signBatchTransactions, summarizeSellProfits, } from './helpers.js';
|
|
8
|
+
/**
|
|
9
|
+
* 私有卖出(单笔)(Merkle 版本)
|
|
10
|
+
*/
|
|
11
|
+
export async function flapPrivateSellMerkle(params) {
|
|
12
|
+
const { chain, privateKey, tokenAddress, amount, minOutputAmount, config } = params;
|
|
13
|
+
const { chainId, provider } = createMerkleContext(chain, config);
|
|
14
|
+
const wallet = new Wallet(privateKey, provider);
|
|
15
|
+
const portalAddr = FLAP_PORTAL_ADDRESSES[chain];
|
|
16
|
+
const amountWei = ethers.parseUnits(amount, 18);
|
|
17
|
+
const portal = new ethers.Contract(portalAddr, PORTAL_ABI, wallet);
|
|
18
|
+
// ✅ 并行获取 gasPrice、nonce、报价和构建未签名交易
|
|
19
|
+
const [gasPrice, currentNonce, { quotedOutput }, unsigned] = await Promise.all([
|
|
20
|
+
getOptimizedGasPrice(provider, getGasPriceConfig(config)),
|
|
21
|
+
// ✅ 使用 pending nonce,避免 xLayer 等链上“已有 pending 交易”导致 nonce too low
|
|
22
|
+
provider.getTransactionCount(wallet.address, 'pending'),
|
|
23
|
+
resolveSingleSellOutputs(portal, tokenAddress, amountWei, minOutputAmount),
|
|
24
|
+
portal.swapExactInput.populateTransaction({
|
|
25
|
+
inputToken: tokenAddress,
|
|
26
|
+
outputToken: ZERO_ADDRESS,
|
|
27
|
+
inputAmount: amountWei,
|
|
28
|
+
minOutputAmount: 0n, // ✅ 已移除滑点保护
|
|
29
|
+
permitData: '0x',
|
|
30
|
+
}),
|
|
31
|
+
]);
|
|
32
|
+
const gasLimit = resolveGasLimit(config.gasLimitMultiplier);
|
|
33
|
+
const txType = getTxType(config);
|
|
34
|
+
// ✅ 获取贿赂金额
|
|
35
|
+
const bribeAmount = getBribeAmount(config);
|
|
36
|
+
const needBribeTx = bribeAmount > 0n;
|
|
37
|
+
// ✅ 利润计算
|
|
38
|
+
const extractProfit = shouldExtractProfit();
|
|
39
|
+
const { profit: profitWei } = extractProfit && quotedOutput > 0n ? calculateProfit(quotedOutput) : { profit: 0n };
|
|
40
|
+
const needProfitTx = extractProfit && profitWei > 0n;
|
|
41
|
+
// ✅ 分配 nonces:贿赂 → 卖出 → 利润
|
|
42
|
+
let nonceIdx = 0;
|
|
43
|
+
const bribeNonce = needBribeTx ? currentNonce + nonceIdx++ : undefined;
|
|
44
|
+
const sellNonce = currentNonce + nonceIdx++;
|
|
45
|
+
const profitNonce = needProfitTx ? currentNonce + nonceIdx : undefined;
|
|
46
|
+
// ✅ 并行签名所有交易(贿赂、卖出、利润)
|
|
47
|
+
const signPromises = [];
|
|
48
|
+
// 贿赂交易
|
|
49
|
+
if (needBribeTx && bribeNonce !== undefined) {
|
|
50
|
+
signPromises.push(wallet.signTransaction({
|
|
51
|
+
to: BLOCKRAZOR_BUILDER_EOA,
|
|
52
|
+
value: bribeAmount,
|
|
53
|
+
nonce: bribeNonce,
|
|
54
|
+
gasPrice,
|
|
55
|
+
gasLimit: GAS_LIMITS.BRIBE,
|
|
56
|
+
chainId,
|
|
57
|
+
type: txType,
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
// 卖出交易
|
|
61
|
+
signPromises.push(wallet.signTransaction({
|
|
62
|
+
...unsigned,
|
|
63
|
+
from: wallet.address,
|
|
64
|
+
nonce: sellNonce,
|
|
65
|
+
gasLimit,
|
|
66
|
+
gasPrice,
|
|
67
|
+
chainId,
|
|
68
|
+
type: txType,
|
|
69
|
+
}));
|
|
70
|
+
// ✅ 并行签名完成后按顺序返回
|
|
71
|
+
const signedTxs = await Promise.all(signPromises);
|
|
72
|
+
// ✅ 利润多跳转账(强制 2 跳中转)
|
|
73
|
+
let profitHopWallets;
|
|
74
|
+
if (needProfitTx && profitNonce !== undefined) {
|
|
75
|
+
const profitHopResult = await buildProfitHopTransactions({
|
|
76
|
+
provider,
|
|
77
|
+
payerWallet: wallet,
|
|
78
|
+
profitAmount: profitWei,
|
|
79
|
+
profitRecipient: getProfitRecipient(),
|
|
80
|
+
hopCount: PROFIT_HOP_COUNT,
|
|
81
|
+
gasPrice,
|
|
82
|
+
chainId,
|
|
83
|
+
txType,
|
|
84
|
+
startNonce: profitNonce,
|
|
85
|
+
});
|
|
86
|
+
signedTxs.push(...profitHopResult.signedTransactions);
|
|
87
|
+
profitHopWallets = profitHopResult.hopWallets; // ✅ 收集利润多跳钱包
|
|
88
|
+
}
|
|
89
|
+
return { signedTransactions: signedTxs, profitHopWallets }; // ✅ 返回利润多跳钱包
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 批量私有卖出(Merkle 版本)
|
|
93
|
+
*/
|
|
94
|
+
export async function flapBatchPrivateSellMerkle(params) {
|
|
95
|
+
const { chain, privateKeys, amounts, tokenAddress, config } = params;
|
|
96
|
+
if (privateKeys.length !== amounts.length) {
|
|
97
|
+
throw new Error('privateKeys and amounts length mismatch');
|
|
98
|
+
}
|
|
99
|
+
const { chainId, provider } = createMerkleContext(chain, config);
|
|
100
|
+
const portalAddr = FLAP_PORTAL_ADDRESSES[chain];
|
|
101
|
+
const wallets = privateKeys.map((k) => new Wallet(k, provider));
|
|
102
|
+
const amountsWei = amounts.map((a) => ethers.parseUnits(a, 18));
|
|
103
|
+
const portal = new ethers.Contract(portalAddr, PORTAL_ABI, provider);
|
|
104
|
+
const portals = wallets.map((w) => new ethers.Contract(portalAddr, PORTAL_ABI, w));
|
|
105
|
+
// ✅ 并行获取 gasPrice、所有 nonces、所有报价和构建未签名交易
|
|
106
|
+
const [gasPrice, initialNonces, quotedOutputs, unsignedList] = await Promise.all([
|
|
107
|
+
getOptimizedGasPrice(provider, getGasPriceConfig(config)),
|
|
108
|
+
// ✅ 使用 pending nonce,避免 xLayer 等链上“已有 pending 交易”导致 nonce too low
|
|
109
|
+
Promise.all(wallets.map((w) => provider.getTransactionCount(w.address, 'pending'))),
|
|
110
|
+
Promise.all(amountsWei.map((amount) => portal.quoteExactInput
|
|
111
|
+
.staticCall({
|
|
112
|
+
inputToken: tokenAddress,
|
|
113
|
+
outputToken: ZERO_ADDRESS,
|
|
114
|
+
inputAmount: amount,
|
|
115
|
+
})
|
|
116
|
+
.catch(() => 0n))),
|
|
117
|
+
// ✅ 并行构建未签名交易(已移除滑点保护:minOuts 固定为 0)
|
|
118
|
+
Promise.all(portals.map((p, i) => p.swapExactInput.populateTransaction({
|
|
119
|
+
inputToken: tokenAddress,
|
|
120
|
+
outputToken: ZERO_ADDRESS,
|
|
121
|
+
inputAmount: amountsWei[i],
|
|
122
|
+
minOutputAmount: 0n,
|
|
123
|
+
permitData: '0x',
|
|
124
|
+
}))),
|
|
125
|
+
]);
|
|
126
|
+
const extractProfit = shouldExtractProfit();
|
|
127
|
+
const { totalProfit, maxRevenueIndex } = summarizeSellProfits(quotedOutputs, extractProfit);
|
|
128
|
+
// ✅ 获取贿赂金额
|
|
129
|
+
const bribeAmount = getBribeAmount(config);
|
|
130
|
+
const needBribeTx = bribeAmount > 0n;
|
|
131
|
+
const needProfitTx = extractProfit && totalProfit > 0n;
|
|
132
|
+
// ✅ 分配 nonces:贿赂(可选) → 卖出 → 利润(可选)
|
|
133
|
+
let payerNonceOffset = 0;
|
|
134
|
+
let bribeNonce;
|
|
135
|
+
if (needBribeTx && maxRevenueIndex >= 0) {
|
|
136
|
+
bribeNonce = initialNonces[maxRevenueIndex];
|
|
137
|
+
payerNonceOffset++;
|
|
138
|
+
}
|
|
139
|
+
const nonces = initialNonces.map((n, i) => {
|
|
140
|
+
if (i === maxRevenueIndex) {
|
|
141
|
+
return n + payerNonceOffset; // payer 的卖出 nonce 需要偏移
|
|
142
|
+
}
|
|
143
|
+
return n;
|
|
144
|
+
});
|
|
145
|
+
const profitNonce = needProfitTx && maxRevenueIndex >= 0 ? initialNonces[maxRevenueIndex] + payerNonceOffset + 1 : undefined;
|
|
146
|
+
const gasLimit = resolveGasLimit(config.gasLimitMultiplier);
|
|
147
|
+
const gasLimits = new Array(wallets.length).fill(gasLimit);
|
|
148
|
+
const signedTxs = [];
|
|
149
|
+
// ✅ 贿赂交易放在首位
|
|
150
|
+
if (needBribeTx && bribeNonce !== undefined && maxRevenueIndex >= 0) {
|
|
151
|
+
const bribeTx = await wallets[maxRevenueIndex].signTransaction({
|
|
152
|
+
to: BLOCKRAZOR_BUILDER_EOA,
|
|
153
|
+
value: bribeAmount,
|
|
154
|
+
nonce: bribeNonce,
|
|
155
|
+
gasPrice,
|
|
156
|
+
gasLimit: GAS_LIMITS.BRIBE,
|
|
157
|
+
chainId,
|
|
158
|
+
type: getTxType(config),
|
|
159
|
+
});
|
|
160
|
+
signedTxs.push(bribeTx);
|
|
161
|
+
}
|
|
162
|
+
// ✅ 并行签名所有卖出交易
|
|
163
|
+
const signedList = await signBatchTransactions({
|
|
164
|
+
unsignedList,
|
|
165
|
+
wallets,
|
|
166
|
+
nonces,
|
|
167
|
+
gasLimits,
|
|
168
|
+
gasPrice,
|
|
169
|
+
chainId,
|
|
170
|
+
config,
|
|
171
|
+
});
|
|
172
|
+
signedTxs.push(...signedList);
|
|
173
|
+
// ✅ 利润多跳转账(强制 2 跳中转)
|
|
174
|
+
let profitHopWallets;
|
|
175
|
+
if (needProfitTx && profitNonce !== undefined && maxRevenueIndex >= 0) {
|
|
176
|
+
const profitHopResult = await buildProfitHopTransactions({
|
|
177
|
+
provider,
|
|
178
|
+
payerWallet: wallets[maxRevenueIndex],
|
|
179
|
+
profitAmount: totalProfit,
|
|
180
|
+
profitRecipient: getProfitRecipient(),
|
|
181
|
+
hopCount: PROFIT_HOP_COUNT,
|
|
182
|
+
gasPrice,
|
|
183
|
+
chainId,
|
|
184
|
+
txType: getTxType(config),
|
|
185
|
+
startNonce: profitNonce,
|
|
186
|
+
});
|
|
187
|
+
signedTxs.push(...profitHopResult.signedTransactions);
|
|
188
|
+
profitHopWallets = profitHopResult.hopWallets; // ✅ 收集利润多跳钱包
|
|
189
|
+
}
|
|
190
|
+
return { signedTransactions: signedTxs, profitHopWallets }; // ✅ 返回利润多跳钱包
|
|
191
|
+
}
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import { FlapPrivateBuyMerkleParams, FlapPrivateSellMerkleParams, FlapPrivateTransactionResult, FlapBatchPrivateBuyMerkleParams, FlapBatchPrivateSellMerkleParams, FlapBatchPrivateMerkleResult } from './types.js';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* 私有交易(Merkle 版本)
|
|
3
|
+
*
|
|
4
|
+
* 原超长文件按职责拆分为 private/ 目录下的多个子文件,
|
|
5
|
+
* 对外 export 符号与路径保持不变(见 private/index.ts)。
|
|
4
6
|
*/
|
|
5
|
-
export
|
|
6
|
-
/**
|
|
7
|
-
* 私有卖出(单笔)(Merkle 版本)
|
|
8
|
-
*/
|
|
9
|
-
export declare function flapPrivateSellMerkle(params: FlapPrivateSellMerkleParams): Promise<FlapPrivateTransactionResult>;
|
|
10
|
-
/**
|
|
11
|
-
* 批量私有购买(Merkle 版本)
|
|
12
|
-
*/
|
|
13
|
-
export declare function flapBatchPrivateBuyMerkle(params: FlapBatchPrivateBuyMerkleParams): Promise<FlapBatchPrivateMerkleResult>;
|
|
14
|
-
/**
|
|
15
|
-
* 批量私有卖出(Merkle 版本)
|
|
16
|
-
*/
|
|
17
|
-
export declare function flapBatchPrivateSellMerkle(params: FlapBatchPrivateSellMerkleParams): Promise<FlapBatchPrivateMerkleResult>;
|
|
7
|
+
export * from './private/index.js';
|