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,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flap 内盘买到外盘 — 主流程(flapBundleCurveToDex)
|
|
3
|
+
*/
|
|
4
|
+
import type { FlapCurveToDexParams, FlapCurveToDexResult } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Flap 内盘买到外盘捆绑交易
|
|
7
|
+
*
|
|
8
|
+
* 交易顺序:
|
|
9
|
+
* 1. 贿赂交易(BlockRazor)
|
|
10
|
+
* 2. 内盘买入(多个钱包在 Bonding Curve 买入)
|
|
11
|
+
* 3. 毕业触发(最后一个买家买入触发上 DEX)
|
|
12
|
+
* 4. 外盘买入(多个钱包在 PancakeSwap 买入)
|
|
13
|
+
* 5. 利润多跳转账
|
|
14
|
+
*/
|
|
15
|
+
export declare function flapBundleCurveToDex(params: FlapCurveToDexParams): Promise<FlapCurveToDexResult>;
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flap 内盘买到外盘 — 主流程(flapBundleCurveToDex)
|
|
3
|
+
*/
|
|
4
|
+
import { getGasLimit } from '../../../../core/gas/bundle-gas.js';
|
|
5
|
+
import { ethers, Contract, Wallet } from 'ethers';
|
|
6
|
+
import { NonceManager, getOptimizedGasPrice, buildProfitHopTransactions, PROFIT_HOP_COUNT, } from '../../../../utils/bundle-helpers.js';
|
|
7
|
+
import { FLAP_PORTAL_ADDRESSES } from '../../constants.js';
|
|
8
|
+
import { ZERO_ADDRESS, GAS_LIMITS } from '../../../../core/constants/index.js';
|
|
9
|
+
import { getGasPriceConfig, getTxType, getProfitRecipient, getProfitRateBps, getBribeAmount, BLOCKRAZOR_BUILDER_EOA, PORTAL_ABI, } from '../config.js';
|
|
10
|
+
import { createSignProvider } from '../../../../bundle/sign-context-helpers.js';
|
|
11
|
+
import { splitAmountByWeight as splitAmount } from '../../../../core/amount/split-by-weight.js';
|
|
12
|
+
import { PANCAKE_V3_ROUTER_ABI, getCurveToDexChainConfig } from './constants.js';
|
|
13
|
+
// ==================== 主函数 ====================
|
|
14
|
+
/**
|
|
15
|
+
* Flap 内盘买到外盘捆绑交易
|
|
16
|
+
*
|
|
17
|
+
* 交易顺序:
|
|
18
|
+
* 1. 贿赂交易(BlockRazor)
|
|
19
|
+
* 2. 内盘买入(多个钱包在 Bonding Curve 买入)
|
|
20
|
+
* 3. 毕业触发(最后一个买家买入触发上 DEX)
|
|
21
|
+
* 4. 外盘买入(多个钱包在 PancakeSwap 买入)
|
|
22
|
+
* 5. 利润多跳转账
|
|
23
|
+
*/
|
|
24
|
+
export async function flapBundleCurveToDex(params) {
|
|
25
|
+
const { chain, tokenAddress, quoteToken, quoteTokenDecimals = 18, curveBuyers, curveTotalBuyAmount, triggerGraduate = true, graduateWallet, dexBuyers = [], dexTotalBuyAmount, dexPoolType = 'v3', v3Fee = 2500, config, } = params;
|
|
26
|
+
// 验证参数
|
|
27
|
+
if (curveBuyers.length === 0) {
|
|
28
|
+
throw new Error('至少需要一个内盘买入钱包');
|
|
29
|
+
}
|
|
30
|
+
// 判断是否使用原生代币
|
|
31
|
+
const useNativeToken = !quoteToken || quoteToken === ZERO_ADDRESS;
|
|
32
|
+
const inputToken = useNativeToken ? ZERO_ADDRESS : quoteToken;
|
|
33
|
+
// ✅ 获取链配置
|
|
34
|
+
const chainConfig = getCurveToDexChainConfig(chain);
|
|
35
|
+
const chainId = chainConfig.chainId;
|
|
36
|
+
// 创建 Provider
|
|
37
|
+
const provider = createSignProvider(config.rpcUrl, chainId, chain.toUpperCase());
|
|
38
|
+
const portalAddress = FLAP_PORTAL_ADDRESSES[chain.toUpperCase()];
|
|
39
|
+
const nonceManager = new NonceManager(provider);
|
|
40
|
+
// 创建钱包实例
|
|
41
|
+
const curveWallets = curveBuyers.map((b) => ({
|
|
42
|
+
wallet: new Wallet(b.privateKey, provider),
|
|
43
|
+
buyAmount: b.buyAmount,
|
|
44
|
+
}));
|
|
45
|
+
const graduateWalletInfo = graduateWallet
|
|
46
|
+
? {
|
|
47
|
+
wallet: new Wallet(graduateWallet.privateKey, provider),
|
|
48
|
+
buyAmount: graduateWallet.buyAmount,
|
|
49
|
+
}
|
|
50
|
+
: null;
|
|
51
|
+
const dexWallets = dexBuyers.map((b) => ({
|
|
52
|
+
wallet: new Wallet(b.privateKey, provider),
|
|
53
|
+
buyAmount: b.buyAmount,
|
|
54
|
+
}));
|
|
55
|
+
// 使用第一个内盘买家作为主钱包(支付贿赂和利润)
|
|
56
|
+
const mainWallet = curveWallets[0].wallet;
|
|
57
|
+
// ✅ 第一批并行:获取 gasPrice + 所有钱包 nonces
|
|
58
|
+
const allWallets = [
|
|
59
|
+
...curveWallets.map((c) => c.wallet),
|
|
60
|
+
...(graduateWalletInfo ? [graduateWalletInfo.wallet] : []),
|
|
61
|
+
...dexWallets.map((d) => d.wallet),
|
|
62
|
+
];
|
|
63
|
+
const uniqueWallets = allWallets.filter((w, i) => {
|
|
64
|
+
const addr = w.address.toLowerCase();
|
|
65
|
+
return allWallets.findIndex((x) => x.address.toLowerCase() === addr) === i;
|
|
66
|
+
});
|
|
67
|
+
const [gasPrice, noncesArray] = await Promise.all([
|
|
68
|
+
getOptimizedGasPrice(provider, getGasPriceConfig(config)),
|
|
69
|
+
nonceManager.getNextNoncesForWallets(uniqueWallets),
|
|
70
|
+
]);
|
|
71
|
+
// 构建 nonces Map
|
|
72
|
+
const noncesMap = new Map();
|
|
73
|
+
uniqueWallets.forEach((wallet, i) => {
|
|
74
|
+
noncesMap.set(wallet.address.toLowerCase(), noncesArray[i]);
|
|
75
|
+
});
|
|
76
|
+
const finalGasLimit = getGasLimit(config, 800000);
|
|
77
|
+
const txType = getTxType(config);
|
|
78
|
+
const priorityFee = gasPrice / 10n === 0n ? 1n : gasPrice / 10n;
|
|
79
|
+
const bribeAmount = getBribeAmount(config);
|
|
80
|
+
const needBribeTx = bribeAmount > 0n;
|
|
81
|
+
// ✅ 计算内盘买入金额
|
|
82
|
+
let curveBuyAmounts;
|
|
83
|
+
if (curveTotalBuyAmount) {
|
|
84
|
+
const total = useNativeToken
|
|
85
|
+
? ethers.parseEther(curveTotalBuyAmount)
|
|
86
|
+
: ethers.parseUnits(curveTotalBuyAmount, quoteTokenDecimals);
|
|
87
|
+
curveBuyAmounts = splitAmount(total, curveBuyers.length);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
// 使用各自指定的金额
|
|
91
|
+
curveBuyAmounts = curveBuyers.map((b) => {
|
|
92
|
+
if (!b.buyAmount)
|
|
93
|
+
throw new Error('未指定 curveTotalBuyAmount 时,每个钱包必须指定 buyAmount');
|
|
94
|
+
return useNativeToken ? ethers.parseEther(b.buyAmount) : ethers.parseUnits(b.buyAmount, quoteTokenDecimals);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
// ✅ 计算毕业买入金额
|
|
98
|
+
let graduateBuyAmount = 0n;
|
|
99
|
+
if (triggerGraduate && graduateWalletInfo) {
|
|
100
|
+
if (graduateWalletInfo.buyAmount) {
|
|
101
|
+
graduateBuyAmount = useNativeToken
|
|
102
|
+
? ethers.parseEther(graduateWalletInfo.buyAmount)
|
|
103
|
+
: ethers.parseUnits(graduateWalletInfo.buyAmount, quoteTokenDecimals);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
throw new Error('触发毕业时必须指定 graduateWallet.buyAmount');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// ✅ 计算外盘买入金额
|
|
110
|
+
let dexBuyAmounts = [];
|
|
111
|
+
if (dexBuyers.length > 0) {
|
|
112
|
+
if (dexTotalBuyAmount) {
|
|
113
|
+
const total = useNativeToken
|
|
114
|
+
? ethers.parseEther(dexTotalBuyAmount)
|
|
115
|
+
: ethers.parseUnits(dexTotalBuyAmount, quoteTokenDecimals);
|
|
116
|
+
dexBuyAmounts = splitAmount(total, dexBuyers.length);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
dexBuyAmounts = dexBuyers.map((b) => {
|
|
120
|
+
if (!b.buyAmount)
|
|
121
|
+
throw new Error('未指定 dexTotalBuyAmount 时,每个钱包必须指定 buyAmount');
|
|
122
|
+
return useNativeToken ? ethers.parseEther(b.buyAmount) : ethers.parseUnits(b.buyAmount, quoteTokenDecimals);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// ✅ 计算利润
|
|
127
|
+
const totalBuyAmount = curveBuyAmounts.reduce((a, b) => a + b, 0n) + graduateBuyAmount + dexBuyAmounts.reduce((a, b) => a + b, 0n);
|
|
128
|
+
const profitAmount = (totalBuyAmount * BigInt(getProfitRateBps())) / 10000n;
|
|
129
|
+
// ==================== 构建交易 ====================
|
|
130
|
+
const allTransactions = [];
|
|
131
|
+
// 1. 贿赂交易
|
|
132
|
+
if (needBribeTx) {
|
|
133
|
+
const mainAddr = mainWallet.address.toLowerCase();
|
|
134
|
+
const bribeNonce = noncesMap.get(mainAddr);
|
|
135
|
+
noncesMap.set(mainAddr, bribeNonce + 1);
|
|
136
|
+
const bribeTx = await mainWallet.signTransaction({
|
|
137
|
+
to: BLOCKRAZOR_BUILDER_EOA,
|
|
138
|
+
value: bribeAmount,
|
|
139
|
+
nonce: bribeNonce,
|
|
140
|
+
gasPrice,
|
|
141
|
+
gasLimit: GAS_LIMITS.BRIBE,
|
|
142
|
+
chainId,
|
|
143
|
+
type: txType,
|
|
144
|
+
});
|
|
145
|
+
allTransactions.push(bribeTx);
|
|
146
|
+
}
|
|
147
|
+
// 2. 内盘买入交易
|
|
148
|
+
const curveBuyTxPromises = curveWallets.map(async ({ wallet }, i) => {
|
|
149
|
+
const addr = wallet.address.toLowerCase();
|
|
150
|
+
const nonce = noncesMap.get(addr);
|
|
151
|
+
noncesMap.set(addr, nonce + 1);
|
|
152
|
+
const portal = new Contract(portalAddress, PORTAL_ABI, wallet);
|
|
153
|
+
const unsigned = await portal.swapExactInput.populateTransaction({
|
|
154
|
+
inputToken,
|
|
155
|
+
outputToken: tokenAddress,
|
|
156
|
+
inputAmount: curveBuyAmounts[i],
|
|
157
|
+
minOutputAmount: 0n,
|
|
158
|
+
permitData: '0x',
|
|
159
|
+
}, useNativeToken ? { value: curveBuyAmounts[i] } : {});
|
|
160
|
+
const tx = {
|
|
161
|
+
...unsigned,
|
|
162
|
+
from: wallet.address,
|
|
163
|
+
nonce,
|
|
164
|
+
gasLimit: finalGasLimit,
|
|
165
|
+
chainId,
|
|
166
|
+
type: txType,
|
|
167
|
+
value: useNativeToken ? curveBuyAmounts[i] : 0n,
|
|
168
|
+
};
|
|
169
|
+
if (txType === 2) {
|
|
170
|
+
tx.maxFeePerGas = gasPrice;
|
|
171
|
+
tx.maxPriorityFeePerGas = priorityFee;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
tx.gasPrice = gasPrice;
|
|
175
|
+
}
|
|
176
|
+
return wallet.signTransaction(tx);
|
|
177
|
+
});
|
|
178
|
+
const signedCurveBuys = await Promise.all(curveBuyTxPromises);
|
|
179
|
+
allTransactions.push(...signedCurveBuys);
|
|
180
|
+
// 3. 毕业触发交易
|
|
181
|
+
if (triggerGraduate && graduateWalletInfo && graduateBuyAmount > 0n) {
|
|
182
|
+
const { wallet } = graduateWalletInfo;
|
|
183
|
+
const addr = wallet.address.toLowerCase();
|
|
184
|
+
const nonce = noncesMap.get(addr);
|
|
185
|
+
noncesMap.set(addr, nonce + 1);
|
|
186
|
+
const portal = new Contract(portalAddress, PORTAL_ABI, wallet);
|
|
187
|
+
const unsigned = await portal.swapExactInput.populateTransaction({
|
|
188
|
+
inputToken,
|
|
189
|
+
outputToken: tokenAddress,
|
|
190
|
+
inputAmount: graduateBuyAmount,
|
|
191
|
+
minOutputAmount: 0n,
|
|
192
|
+
permitData: '0x',
|
|
193
|
+
}, useNativeToken ? { value: graduateBuyAmount } : {});
|
|
194
|
+
const tx = {
|
|
195
|
+
...unsigned,
|
|
196
|
+
from: wallet.address,
|
|
197
|
+
nonce,
|
|
198
|
+
gasLimit: BigInt(1_500_000), // 毕业交易需要更多 gas
|
|
199
|
+
chainId,
|
|
200
|
+
type: txType,
|
|
201
|
+
value: useNativeToken ? graduateBuyAmount : 0n,
|
|
202
|
+
};
|
|
203
|
+
if (txType === 2) {
|
|
204
|
+
tx.maxFeePerGas = gasPrice;
|
|
205
|
+
tx.maxPriorityFeePerGas = priorityFee;
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
tx.gasPrice = gasPrice;
|
|
209
|
+
}
|
|
210
|
+
const graduateTx = await wallet.signTransaction(tx);
|
|
211
|
+
allTransactions.push(graduateTx);
|
|
212
|
+
}
|
|
213
|
+
// 4. 外盘买入交易(PancakeSwap)
|
|
214
|
+
if (dexWallets.length > 0) {
|
|
215
|
+
const dexBuyTxPromises = dexWallets.map(async ({ wallet }, i) => {
|
|
216
|
+
const addr = wallet.address.toLowerCase();
|
|
217
|
+
const nonce = noncesMap.get(addr);
|
|
218
|
+
noncesMap.set(addr, nonce + 1);
|
|
219
|
+
const buyAmount = dexBuyAmounts[i];
|
|
220
|
+
// ✅ 使用链配置中的 SmartRouter 和 WrappedNative(支持 BSC/Base)
|
|
221
|
+
const smartRouter = chainConfig.smartRouter;
|
|
222
|
+
const wrappedNative = chainConfig.wrappedNative;
|
|
223
|
+
let calldata;
|
|
224
|
+
let value;
|
|
225
|
+
if (dexPoolType === 'v3') {
|
|
226
|
+
// V3: exactInputSingle
|
|
227
|
+
if (useNativeToken) {
|
|
228
|
+
const params = {
|
|
229
|
+
tokenIn: wrappedNative,
|
|
230
|
+
tokenOut: tokenAddress,
|
|
231
|
+
fee: v3Fee,
|
|
232
|
+
recipient: wallet.address,
|
|
233
|
+
amountIn: buyAmount,
|
|
234
|
+
amountOutMinimum: 0n,
|
|
235
|
+
sqrtPriceLimitX96: 0n,
|
|
236
|
+
};
|
|
237
|
+
const exactInputSingleData = new ethers.Interface(PANCAKE_V3_ROUTER_ABI).encodeFunctionData('exactInputSingle', [params]);
|
|
238
|
+
calldata = new ethers.Interface(PANCAKE_V3_ROUTER_ABI).encodeFunctionData('multicall', [
|
|
239
|
+
[exactInputSingleData],
|
|
240
|
+
]);
|
|
241
|
+
value = buyAmount;
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
// ERC20 需要先 approve,这里简化处理(假设已授权)
|
|
245
|
+
const params = {
|
|
246
|
+
tokenIn: quoteToken,
|
|
247
|
+
tokenOut: tokenAddress,
|
|
248
|
+
fee: v3Fee,
|
|
249
|
+
recipient: wallet.address,
|
|
250
|
+
amountIn: buyAmount,
|
|
251
|
+
amountOutMinimum: 0n,
|
|
252
|
+
sqrtPriceLimitX96: 0n,
|
|
253
|
+
};
|
|
254
|
+
const exactInputSingleData = new ethers.Interface(PANCAKE_V3_ROUTER_ABI).encodeFunctionData('exactInputSingle', [params]);
|
|
255
|
+
calldata = new ethers.Interface(PANCAKE_V3_ROUTER_ABI).encodeFunctionData('multicall', [
|
|
256
|
+
[exactInputSingleData],
|
|
257
|
+
]);
|
|
258
|
+
value = 0n;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
// V2: swapExactTokensForTokens
|
|
263
|
+
if (useNativeToken) {
|
|
264
|
+
const swapData = new ethers.Interface(PANCAKE_V3_ROUTER_ABI).encodeFunctionData('swapExactTokensForTokens', [
|
|
265
|
+
buyAmount,
|
|
266
|
+
0n,
|
|
267
|
+
[wrappedNative, tokenAddress],
|
|
268
|
+
wallet.address,
|
|
269
|
+
]);
|
|
270
|
+
calldata = new ethers.Interface(PANCAKE_V3_ROUTER_ABI).encodeFunctionData('multicall', [[swapData]]);
|
|
271
|
+
value = buyAmount;
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
const swapData = new ethers.Interface(PANCAKE_V3_ROUTER_ABI).encodeFunctionData('swapExactTokensForTokens', [
|
|
275
|
+
buyAmount,
|
|
276
|
+
0n,
|
|
277
|
+
[quoteToken, tokenAddress],
|
|
278
|
+
wallet.address,
|
|
279
|
+
]);
|
|
280
|
+
calldata = new ethers.Interface(PANCAKE_V3_ROUTER_ABI).encodeFunctionData('multicall', [[swapData]]);
|
|
281
|
+
value = 0n;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
const tx = {
|
|
285
|
+
to: smartRouter,
|
|
286
|
+
data: calldata,
|
|
287
|
+
from: wallet.address,
|
|
288
|
+
nonce,
|
|
289
|
+
gasLimit: BigInt(500_000),
|
|
290
|
+
chainId,
|
|
291
|
+
type: txType,
|
|
292
|
+
value,
|
|
293
|
+
};
|
|
294
|
+
if (txType === 2) {
|
|
295
|
+
tx.maxFeePerGas = gasPrice;
|
|
296
|
+
tx.maxPriorityFeePerGas = priorityFee;
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
tx.gasPrice = gasPrice;
|
|
300
|
+
}
|
|
301
|
+
return wallet.signTransaction(tx);
|
|
302
|
+
});
|
|
303
|
+
const signedDexBuys = await Promise.all(dexBuyTxPromises);
|
|
304
|
+
allTransactions.push(...signedDexBuys);
|
|
305
|
+
}
|
|
306
|
+
// 5. 利润多跳转账
|
|
307
|
+
let profitHopWallets;
|
|
308
|
+
if (profitAmount > 0n) {
|
|
309
|
+
const mainAddr = mainWallet.address.toLowerCase();
|
|
310
|
+
const profitNonce = noncesMap.get(mainAddr);
|
|
311
|
+
const profitResult = await buildProfitHopTransactions({
|
|
312
|
+
provider,
|
|
313
|
+
payerWallet: mainWallet,
|
|
314
|
+
profitAmount,
|
|
315
|
+
profitRecipient: getProfitRecipient(),
|
|
316
|
+
hopCount: PROFIT_HOP_COUNT,
|
|
317
|
+
gasPrice,
|
|
318
|
+
chainId,
|
|
319
|
+
txType,
|
|
320
|
+
startNonce: profitNonce,
|
|
321
|
+
});
|
|
322
|
+
allTransactions.push(...profitResult.signedTransactions);
|
|
323
|
+
profitHopWallets = profitResult.hopWallets;
|
|
324
|
+
}
|
|
325
|
+
nonceManager.clearTemp();
|
|
326
|
+
// 返回结果
|
|
327
|
+
return {
|
|
328
|
+
signedTransactions: allTransactions,
|
|
329
|
+
profitHopWallets,
|
|
330
|
+
metadata: {
|
|
331
|
+
curveBuyerCount: curveBuyers.length,
|
|
332
|
+
curveTotalBuy: ethers.formatEther(curveBuyAmounts.reduce((a, b) => a + b, 0n)),
|
|
333
|
+
graduated: triggerGraduate,
|
|
334
|
+
dexBuyerCount: dexBuyers.length,
|
|
335
|
+
dexTotalBuy: ethers.formatEther(dexBuyAmounts.reduce((a, b) => a + b, 0n)),
|
|
336
|
+
profitAmount: profitAmount > 0n ? ethers.formatEther(profitAmount) : undefined,
|
|
337
|
+
},
|
|
338
|
+
};
|
|
339
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flap 内盘买到外盘 — 类型定义
|
|
3
|
+
*/
|
|
4
|
+
import type { FlapSignConfig } from '../config.js';
|
|
5
|
+
import type { MerkleSignedResult } from '../types.js';
|
|
6
|
+
export type CurveToDexChain = 'bsc' | 'base';
|
|
7
|
+
export type DexPoolType = 'v2' | 'v3';
|
|
8
|
+
/** 签名配置 */
|
|
9
|
+
export interface CurveToDexSignConfig extends FlapSignConfig {
|
|
10
|
+
reserveGasETH?: number;
|
|
11
|
+
skipQuoteOnError?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** 内盘买入钱包配置 */
|
|
14
|
+
export interface CurveBuyerConfig {
|
|
15
|
+
privateKey: string;
|
|
16
|
+
/** 买入金额(BNB 或 USD1),为空则自动分配 */
|
|
17
|
+
buyAmount?: string;
|
|
18
|
+
}
|
|
19
|
+
/** 外盘买入钱包配置 */
|
|
20
|
+
export interface DexBuyerConfig {
|
|
21
|
+
privateKey: string;
|
|
22
|
+
/** 买入金额(BNB 或 USD1),为空则自动分配 */
|
|
23
|
+
buyAmount?: string;
|
|
24
|
+
}
|
|
25
|
+
/** 内盘买到外盘参数 */
|
|
26
|
+
export interface FlapCurveToDexParams {
|
|
27
|
+
chain: CurveToDexChain;
|
|
28
|
+
/** 代币地址(已存在的代币) */
|
|
29
|
+
tokenAddress: string;
|
|
30
|
+
/** 报价代币(BNB 或 USD1),不传默认 BNB */
|
|
31
|
+
quoteToken?: string;
|
|
32
|
+
/** 报价代币精度,默认 18 */
|
|
33
|
+
quoteTokenDecimals?: number;
|
|
34
|
+
/** 内盘买入钱包(这些钱包会在 Bonding Curve 上买入) */
|
|
35
|
+
curveBuyers: CurveBuyerConfig[];
|
|
36
|
+
/** 内盘总买入金额(用于自动分配) */
|
|
37
|
+
curveTotalBuyAmount?: string;
|
|
38
|
+
/** 是否触发毕业(上 DEX) */
|
|
39
|
+
triggerGraduate?: boolean;
|
|
40
|
+
/** 毕业触发者(内盘最后一个买家,如果不提供则使用 curveBuyers 的最后一个) */
|
|
41
|
+
graduateWallet?: {
|
|
42
|
+
privateKey: string;
|
|
43
|
+
buyAmount?: string;
|
|
44
|
+
};
|
|
45
|
+
/** 外盘买入钱包(这些钱包会在 PancakeSwap 上买入) */
|
|
46
|
+
dexBuyers?: DexBuyerConfig[];
|
|
47
|
+
/** 外盘总买入金额(用于自动分配) */
|
|
48
|
+
dexTotalBuyAmount?: string;
|
|
49
|
+
/** 外盘池类型(V2 或 V3),默认 V3 */
|
|
50
|
+
dexPoolType?: DexPoolType;
|
|
51
|
+
/** V3 费率(100/500/2500/10000),默认 2500 */
|
|
52
|
+
v3Fee?: number;
|
|
53
|
+
/** 配置 */
|
|
54
|
+
config: CurveToDexSignConfig;
|
|
55
|
+
}
|
|
56
|
+
/** 结果类型 */
|
|
57
|
+
export interface FlapCurveToDexResult extends MerkleSignedResult {
|
|
58
|
+
metadata?: {
|
|
59
|
+
/** 内盘买入钱包数 */
|
|
60
|
+
curveBuyerCount: number;
|
|
61
|
+
/** 内盘总买入金额 */
|
|
62
|
+
curveTotalBuy: string;
|
|
63
|
+
/** 是否触发毕业 */
|
|
64
|
+
graduated: boolean;
|
|
65
|
+
/** 外盘买入钱包数 */
|
|
66
|
+
dexBuyerCount: number;
|
|
67
|
+
/** 外盘总买入金额 */
|
|
68
|
+
dexTotalBuy: string;
|
|
69
|
+
/** 利润金额 */
|
|
70
|
+
profitAmount?: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -1,88 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flap
|
|
2
|
+
* Flap 内盘买到外盘(Curve → DEX)
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 2. 最后一个买家触发毕业(代币上 DEX)
|
|
7
|
-
* 3. 多个钱包在 PancakeSwap(外盘)继续买入
|
|
4
|
+
* 原超长文件按职责拆分为 curve-to-dex/ 目录下的多个子文件,
|
|
5
|
+
* 对外 export 符号与路径保持不变(见 curve-to-dex/index.ts)。
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
|
-
import type { MerkleSignedResult } from './types.js';
|
|
11
|
-
export type CurveToDexChain = 'bsc' | 'base';
|
|
12
|
-
export type DexPoolType = 'v2' | 'v3';
|
|
13
|
-
/** 签名配置 */
|
|
14
|
-
export interface CurveToDexSignConfig extends FlapSignConfig {
|
|
15
|
-
reserveGasETH?: number;
|
|
16
|
-
skipQuoteOnError?: boolean;
|
|
17
|
-
}
|
|
18
|
-
/** 内盘买入钱包配置 */
|
|
19
|
-
export interface CurveBuyerConfig {
|
|
20
|
-
privateKey: string;
|
|
21
|
-
/** 买入金额(BNB 或 USD1),为空则自动分配 */
|
|
22
|
-
buyAmount?: string;
|
|
23
|
-
}
|
|
24
|
-
/** 外盘买入钱包配置 */
|
|
25
|
-
export interface DexBuyerConfig {
|
|
26
|
-
privateKey: string;
|
|
27
|
-
/** 买入金额(BNB 或 USD1),为空则自动分配 */
|
|
28
|
-
buyAmount?: string;
|
|
29
|
-
}
|
|
30
|
-
/** 内盘买到外盘参数 */
|
|
31
|
-
export interface FlapCurveToDexParams {
|
|
32
|
-
chain: CurveToDexChain;
|
|
33
|
-
/** 代币地址(已存在的代币) */
|
|
34
|
-
tokenAddress: string;
|
|
35
|
-
/** 报价代币(BNB 或 USD1),不传默认 BNB */
|
|
36
|
-
quoteToken?: string;
|
|
37
|
-
/** 报价代币精度,默认 18 */
|
|
38
|
-
quoteTokenDecimals?: number;
|
|
39
|
-
/** 内盘买入钱包(这些钱包会在 Bonding Curve 上买入) */
|
|
40
|
-
curveBuyers: CurveBuyerConfig[];
|
|
41
|
-
/** 内盘总买入金额(用于自动分配) */
|
|
42
|
-
curveTotalBuyAmount?: string;
|
|
43
|
-
/** 是否触发毕业(上 DEX) */
|
|
44
|
-
triggerGraduate?: boolean;
|
|
45
|
-
/** 毕业触发者(内盘最后一个买家,如果不提供则使用 curveBuyers 的最后一个) */
|
|
46
|
-
graduateWallet?: {
|
|
47
|
-
privateKey: string;
|
|
48
|
-
buyAmount?: string;
|
|
49
|
-
};
|
|
50
|
-
/** 外盘买入钱包(这些钱包会在 PancakeSwap 上买入) */
|
|
51
|
-
dexBuyers?: DexBuyerConfig[];
|
|
52
|
-
/** 外盘总买入金额(用于自动分配) */
|
|
53
|
-
dexTotalBuyAmount?: string;
|
|
54
|
-
/** 外盘池类型(V2 或 V3),默认 V3 */
|
|
55
|
-
dexPoolType?: DexPoolType;
|
|
56
|
-
/** V3 费率(100/500/2500/10000),默认 2500 */
|
|
57
|
-
v3Fee?: number;
|
|
58
|
-
/** 配置 */
|
|
59
|
-
config: CurveToDexSignConfig;
|
|
60
|
-
}
|
|
61
|
-
/** 结果类型 */
|
|
62
|
-
export interface FlapCurveToDexResult extends MerkleSignedResult {
|
|
63
|
-
metadata?: {
|
|
64
|
-
/** 内盘买入钱包数 */
|
|
65
|
-
curveBuyerCount: number;
|
|
66
|
-
/** 内盘总买入金额 */
|
|
67
|
-
curveTotalBuy: string;
|
|
68
|
-
/** 是否触发毕业 */
|
|
69
|
-
graduated: boolean;
|
|
70
|
-
/** 外盘买入钱包数 */
|
|
71
|
-
dexBuyerCount: number;
|
|
72
|
-
/** 外盘总买入金额 */
|
|
73
|
-
dexTotalBuy: string;
|
|
74
|
-
/** 利润金额 */
|
|
75
|
-
profitAmount?: string;
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Flap 内盘买到外盘捆绑交易
|
|
80
|
-
*
|
|
81
|
-
* 交易顺序:
|
|
82
|
-
* 1. 贿赂交易(BlockRazor)
|
|
83
|
-
* 2. 内盘买入(多个钱包在 Bonding Curve 买入)
|
|
84
|
-
* 3. 毕业触发(最后一个买家买入触发上 DEX)
|
|
85
|
-
* 4. 外盘买入(多个钱包在 PancakeSwap 买入)
|
|
86
|
-
* 5. 利润多跳转账
|
|
87
|
-
*/
|
|
88
|
-
export declare function flapBundleCurveToDex(params: FlapCurveToDexParams): Promise<FlapCurveToDexResult>;
|
|
7
|
+
export * from './curve-to-dex/index.js';
|