four-flap-meme-sdk 3.0.1 → 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/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/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 -85
|
@@ -1 +1 @@
|
|
|
1
|
-
export type * from '../../../bundle/four-meme/types.js';
|
|
1
|
+
export type * from '../../../bundle/four-meme/types/index.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PancakeSwap Buy-First 交易构建 helper(从 bundle-buy-first-helpers.ts 抽取)
|
|
3
|
+
*/
|
|
4
|
+
import { ethers, Wallet } from 'ethers';
|
|
5
|
+
import type { MultiSwapTxParams, MultiSwapUnsignedResult, RouteParams } from './bundle-buy-first-types.js';
|
|
6
|
+
/**
|
|
7
|
+
* ✅ 构建多笔买入和卖出交易
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildMultiRouteTransactions({ routeParams, buyAmountsWei, sellAmountsWei, buyer, seller, useNativeToken, v2RouterAddress, }: MultiSwapTxParams): Promise<MultiSwapUnsignedResult>;
|
|
10
|
+
export declare function buildSingleBuyTx({ routeParams, buyAmount, buyer, useNativeToken, deadline, v2RouterAddress, }: {
|
|
11
|
+
routeParams: RouteParams;
|
|
12
|
+
buyAmount: bigint;
|
|
13
|
+
buyer: Wallet;
|
|
14
|
+
useNativeToken: boolean;
|
|
15
|
+
deadline: bigint;
|
|
16
|
+
v2RouterAddress?: string;
|
|
17
|
+
}): Promise<ethers.TransactionLike>;
|
|
18
|
+
export declare function buildSingleSellTx({ routeParams, sellAmount, seller, useNativeToken, deadline, v2RouterAddress, }: {
|
|
19
|
+
routeParams: RouteParams;
|
|
20
|
+
sellAmount: bigint;
|
|
21
|
+
seller: Wallet;
|
|
22
|
+
useNativeToken: boolean;
|
|
23
|
+
deadline: bigint;
|
|
24
|
+
v2RouterAddress?: string;
|
|
25
|
+
}): Promise<ethers.TransactionLike>;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PancakeSwap Buy-First 交易构建 helper(从 bundle-buy-first-helpers.ts 抽取)
|
|
3
|
+
*/
|
|
4
|
+
import { ethers, Contract } from 'ethers';
|
|
5
|
+
import { getDeadline } from '../../../utils/bundle-helpers.js';
|
|
6
|
+
import { FLAT_FEE, PANCAKE_V2_ROUTER_ABI, PANCAKE_V2_ROUTER_ADDRESS, PANCAKE_V3_ROUTER_ABI, PANCAKE_V3_ROUTER_ADDRESS, } from './bundle-buy-first-constants.js';
|
|
7
|
+
/**
|
|
8
|
+
* ✅ 构建多笔买入和卖出交易
|
|
9
|
+
*/
|
|
10
|
+
export async function buildMultiRouteTransactions({ routeParams, buyAmountsWei, sellAmountsWei, buyer, seller, useNativeToken = true, v2RouterAddress, }) {
|
|
11
|
+
const deadline = getDeadline();
|
|
12
|
+
if (routeParams.routeType === 'v2') {
|
|
13
|
+
const { v2Path } = routeParams;
|
|
14
|
+
const reversePath = [...v2Path].reverse();
|
|
15
|
+
const v2Addr = v2RouterAddress || PANCAKE_V2_ROUTER_ADDRESS;
|
|
16
|
+
const v2RouterBuyer = new Contract(v2Addr, PANCAKE_V2_ROUTER_ABI, buyer);
|
|
17
|
+
const v2RouterSeller = new Contract(v2Addr, PANCAKE_V2_ROUTER_ABI, seller);
|
|
18
|
+
// ✅ 根据是否使用原生代币选择不同的函数
|
|
19
|
+
if (useNativeToken) {
|
|
20
|
+
// BNB 池子:使用 swapExactETHForTokens / swapExactTokensForETH
|
|
21
|
+
const buyUnsignedArray = await Promise.all(buyAmountsWei.map((amount) => {
|
|
22
|
+
const buyValue = amount + FLAT_FEE;
|
|
23
|
+
return v2RouterBuyer.swapExactETHForTokensSupportingFeeOnTransferTokens.populateTransaction(0n, v2Path, buyer.address, deadline, { value: buyValue });
|
|
24
|
+
}));
|
|
25
|
+
const sellUnsignedArray = await Promise.all(sellAmountsWei.map((amount) => v2RouterSeller.swapExactTokensForETHSupportingFeeOnTransferTokens.populateTransaction(amount, 0n, reversePath, seller.address, deadline)));
|
|
26
|
+
return { buyUnsignedArray, sellUnsignedArray };
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
// ✅ ERC20 池子(如 USDT):使用 swapExactTokensForTokens
|
|
30
|
+
const buyUnsignedArray = await Promise.all(buyAmountsWei.map((amount) => v2RouterBuyer.swapExactTokensForTokensSupportingFeeOnTransferTokens.populateTransaction(amount, 0n, v2Path, buyer.address, deadline)));
|
|
31
|
+
const sellUnsignedArray = await Promise.all(sellAmountsWei.map((amount) => v2RouterSeller.swapExactTokensForTokensSupportingFeeOnTransferTokens.populateTransaction(amount, 0n, reversePath, seller.address, deadline)));
|
|
32
|
+
return { buyUnsignedArray, sellUnsignedArray };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (routeParams.routeType === 'v3-single') {
|
|
36
|
+
const { v3TokenIn, v3TokenOut, v3Fee } = routeParams;
|
|
37
|
+
const v3RouterIface = new ethers.Interface(PANCAKE_V3_ROUTER_ABI);
|
|
38
|
+
const v3RouterBuyer = new Contract(PANCAKE_V3_ROUTER_ADDRESS, PANCAKE_V3_ROUTER_ABI, buyer);
|
|
39
|
+
const v3RouterSeller = new Contract(PANCAKE_V3_ROUTER_ADDRESS, PANCAKE_V3_ROUTER_ABI, seller);
|
|
40
|
+
// 构建多笔买入交易(ERC20 模式 value = 0,因为通过代币授权支付)
|
|
41
|
+
const buyUnsignedArray = await Promise.all(buyAmountsWei.map((amount) => {
|
|
42
|
+
const buyValue = useNativeToken ? amount + FLAT_FEE : 0n;
|
|
43
|
+
const buySwapData = v3RouterIface.encodeFunctionData('exactInputSingle', [
|
|
44
|
+
{
|
|
45
|
+
tokenIn: v3TokenIn,
|
|
46
|
+
tokenOut: v3TokenOut,
|
|
47
|
+
fee: v3Fee,
|
|
48
|
+
recipient: buyer.address,
|
|
49
|
+
amountIn: amount,
|
|
50
|
+
amountOutMinimum: 0n,
|
|
51
|
+
sqrtPriceLimitX96: 0n,
|
|
52
|
+
},
|
|
53
|
+
]);
|
|
54
|
+
return v3RouterBuyer.multicall.populateTransaction(deadline, [buySwapData], { value: buyValue });
|
|
55
|
+
}));
|
|
56
|
+
// ✅ 根据是否使用原生代币构建不同的卖出交易
|
|
57
|
+
if (useNativeToken) {
|
|
58
|
+
// BNB 池子:卖出后 unwrap WBNB 为 BNB
|
|
59
|
+
const sellUnsignedArray = await Promise.all(sellAmountsWei.map((amount) => {
|
|
60
|
+
const sellSwapData = v3RouterIface.encodeFunctionData('exactInputSingle', [
|
|
61
|
+
{
|
|
62
|
+
tokenIn: v3TokenOut,
|
|
63
|
+
tokenOut: v3TokenIn,
|
|
64
|
+
fee: v3Fee,
|
|
65
|
+
recipient: PANCAKE_V3_ROUTER_ADDRESS,
|
|
66
|
+
amountIn: amount,
|
|
67
|
+
amountOutMinimum: 0n,
|
|
68
|
+
sqrtPriceLimitX96: 0n,
|
|
69
|
+
},
|
|
70
|
+
]);
|
|
71
|
+
const sellUnwrapData = v3RouterIface.encodeFunctionData('unwrapWETH9', [0n, seller.address]);
|
|
72
|
+
return v3RouterSeller.multicall.populateTransaction(deadline, [sellSwapData, sellUnwrapData]);
|
|
73
|
+
}));
|
|
74
|
+
return { buyUnsignedArray, sellUnsignedArray };
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// ✅ ERC20 池子:卖出后直接获得 ERC20
|
|
78
|
+
const sellUnsignedArray = await Promise.all(sellAmountsWei.map((amount) => {
|
|
79
|
+
const sellSwapData = v3RouterIface.encodeFunctionData('exactInputSingle', [
|
|
80
|
+
{
|
|
81
|
+
tokenIn: v3TokenOut,
|
|
82
|
+
tokenOut: v3TokenIn,
|
|
83
|
+
fee: v3Fee,
|
|
84
|
+
recipient: seller.address, // 直接发送到卖方地址
|
|
85
|
+
amountIn: amount,
|
|
86
|
+
amountOutMinimum: 0n,
|
|
87
|
+
sqrtPriceLimitX96: 0n,
|
|
88
|
+
},
|
|
89
|
+
]);
|
|
90
|
+
return v3RouterSeller.multicall.populateTransaction(deadline, [sellSwapData]);
|
|
91
|
+
}));
|
|
92
|
+
return { buyUnsignedArray, sellUnsignedArray };
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
throw new Error('V3 多跳路由暂不支持官方合约,请使用 V2 路由或 V3 单跳');
|
|
96
|
+
}
|
|
97
|
+
// ✅ 构建单笔买入交易
|
|
98
|
+
export async function buildSingleBuyTx({ routeParams, buyAmount, buyer, useNativeToken, deadline, v2RouterAddress, }) {
|
|
99
|
+
if (routeParams.routeType === 'v2') {
|
|
100
|
+
const { v2Path } = routeParams;
|
|
101
|
+
const v2Router = new Contract(v2RouterAddress || PANCAKE_V2_ROUTER_ADDRESS, PANCAKE_V2_ROUTER_ABI, buyer);
|
|
102
|
+
if (useNativeToken) {
|
|
103
|
+
return await v2Router.swapExactETHForTokensSupportingFeeOnTransferTokens.populateTransaction(0n, v2Path, buyer.address, deadline, { value: buyAmount });
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
return await v2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens.populateTransaction(buyAmount, 0n, v2Path, buyer.address, deadline);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (routeParams.routeType === 'v3-single') {
|
|
110
|
+
const { v3TokenIn, v3TokenOut, v3Fee } = routeParams;
|
|
111
|
+
const v3RouterIface = new ethers.Interface(PANCAKE_V3_ROUTER_ABI);
|
|
112
|
+
const v3Router = new Contract(PANCAKE_V3_ROUTER_ADDRESS, PANCAKE_V3_ROUTER_ABI, buyer);
|
|
113
|
+
const buyValue = useNativeToken ? buyAmount : 0n;
|
|
114
|
+
const buySwapData = v3RouterIface.encodeFunctionData('exactInputSingle', [
|
|
115
|
+
{
|
|
116
|
+
tokenIn: v3TokenIn,
|
|
117
|
+
tokenOut: v3TokenOut,
|
|
118
|
+
fee: v3Fee,
|
|
119
|
+
recipient: buyer.address,
|
|
120
|
+
amountIn: buyAmount,
|
|
121
|
+
amountOutMinimum: 0n,
|
|
122
|
+
sqrtPriceLimitX96: 0n,
|
|
123
|
+
},
|
|
124
|
+
]);
|
|
125
|
+
return await v3Router.multicall.populateTransaction(deadline, [buySwapData], { value: buyValue });
|
|
126
|
+
}
|
|
127
|
+
throw new Error('V3 多跳路由暂不支持');
|
|
128
|
+
}
|
|
129
|
+
// ✅ 构建单笔卖出交易
|
|
130
|
+
export async function buildSingleSellTx({ routeParams, sellAmount, seller, useNativeToken, deadline, v2RouterAddress, }) {
|
|
131
|
+
if (routeParams.routeType === 'v2') {
|
|
132
|
+
const { v2Path } = routeParams;
|
|
133
|
+
const reversePath = [...v2Path].reverse();
|
|
134
|
+
const v2Router = new Contract(v2RouterAddress || PANCAKE_V2_ROUTER_ADDRESS, PANCAKE_V2_ROUTER_ABI, seller);
|
|
135
|
+
if (useNativeToken) {
|
|
136
|
+
return await v2Router.swapExactTokensForETHSupportingFeeOnTransferTokens.populateTransaction(sellAmount, 0n, reversePath, seller.address, deadline);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
return await v2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens.populateTransaction(sellAmount, 0n, reversePath, seller.address, deadline);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (routeParams.routeType === 'v3-single') {
|
|
143
|
+
const { v3TokenIn, v3TokenOut, v3Fee } = routeParams;
|
|
144
|
+
const v3RouterIface = new ethers.Interface(PANCAKE_V3_ROUTER_ABI);
|
|
145
|
+
const v3Router = new Contract(PANCAKE_V3_ROUTER_ADDRESS, PANCAKE_V3_ROUTER_ABI, seller);
|
|
146
|
+
if (useNativeToken) {
|
|
147
|
+
const sellSwapData = v3RouterIface.encodeFunctionData('exactInputSingle', [
|
|
148
|
+
{
|
|
149
|
+
tokenIn: v3TokenOut,
|
|
150
|
+
tokenOut: v3TokenIn,
|
|
151
|
+
fee: v3Fee,
|
|
152
|
+
recipient: PANCAKE_V3_ROUTER_ADDRESS,
|
|
153
|
+
amountIn: sellAmount,
|
|
154
|
+
amountOutMinimum: 0n,
|
|
155
|
+
sqrtPriceLimitX96: 0n,
|
|
156
|
+
},
|
|
157
|
+
]);
|
|
158
|
+
const sellUnwrapData = v3RouterIface.encodeFunctionData('unwrapWETH9', [0n, seller.address]);
|
|
159
|
+
return await v3Router.multicall.populateTransaction(deadline, [sellSwapData, sellUnwrapData]);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
const sellSwapData = v3RouterIface.encodeFunctionData('exactInputSingle', [
|
|
163
|
+
{
|
|
164
|
+
tokenIn: v3TokenOut,
|
|
165
|
+
tokenOut: v3TokenIn,
|
|
166
|
+
fee: v3Fee,
|
|
167
|
+
recipient: seller.address,
|
|
168
|
+
amountIn: sellAmount,
|
|
169
|
+
amountOutMinimum: 0n,
|
|
170
|
+
sqrtPriceLimitX96: 0n,
|
|
171
|
+
},
|
|
172
|
+
]);
|
|
173
|
+
return await v3Router.multicall.populateTransaction(deadline, [sellSwapData]);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
throw new Error('V3 多跳路由暂不支持');
|
|
177
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const PANCAKE_V2_ROUTER_ABI: string[];
|
|
2
|
+
export declare const PANCAKE_V3_ROUTER_ABI: (string | {
|
|
3
|
+
inputs: {
|
|
4
|
+
components: {
|
|
5
|
+
name: string;
|
|
6
|
+
type: string;
|
|
7
|
+
}[];
|
|
8
|
+
name: string;
|
|
9
|
+
type: string;
|
|
10
|
+
}[];
|
|
11
|
+
name: string;
|
|
12
|
+
outputs: {
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
}[];
|
|
16
|
+
stateMutability: string;
|
|
17
|
+
type: string;
|
|
18
|
+
})[];
|
|
19
|
+
export declare const ERC20_BALANCE_OF_ABI: string[];
|
|
20
|
+
export declare const PANCAKE_V2_ROUTER_ADDRESS: "0x10ED43C718714eb63d5aA57B78B54704E256024E";
|
|
21
|
+
export declare const PANCAKE_V3_ROUTER_ADDRESS: "0x13f4EA83D0bd40E75C8222255bc855a974568Dd4";
|
|
22
|
+
export declare const FLAT_FEE = 0n;
|
|
23
|
+
/** 最大 Bundle 签名数 */
|
|
24
|
+
export declare const MAX_BUNDLE_SIGNATURES = 50;
|
|
25
|
+
/** 贿赂交易数 */
|
|
26
|
+
export declare const BRIBE_TX_COUNT = 1;
|
|
27
|
+
/** 利润中转交易数(支付者 1 笔 + 中转钱包 PROFIT_HOP_COUNT 笔 + 最终接收 1 笔) */
|
|
28
|
+
export declare const PROFIT_TX_COUNT: number;
|
|
29
|
+
/** 最大买卖交易数 */
|
|
30
|
+
export declare const MAX_SWAP_TX_COUNT: number;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PancakeSwap Buy-First 常量与 ABI 别名(从 bundle-buy-first-helpers.ts 抽取)
|
|
3
|
+
*/
|
|
4
|
+
import { V2_ROUTER_ABI, V3_ROUTER02_ABI, ERC20_BALANCE_ABI } from '../../../abis/common.js';
|
|
5
|
+
import { ADDRESSES } from '../../../core/constants/index.js';
|
|
6
|
+
import { PROFIT_HOP_COUNT } from '../../../utils/bundle-helpers.js';
|
|
7
|
+
// ✅ ABI 别名(从公共模块导入)
|
|
8
|
+
export const PANCAKE_V2_ROUTER_ABI = V2_ROUTER_ABI;
|
|
9
|
+
export const PANCAKE_V3_ROUTER_ABI = V3_ROUTER02_ABI;
|
|
10
|
+
export const ERC20_BALANCE_OF_ABI = ERC20_BALANCE_ABI;
|
|
11
|
+
// ✅ 使用官方 PancakeSwap Router 地址
|
|
12
|
+
export const PANCAKE_V2_ROUTER_ADDRESS = ADDRESSES.BSC.PancakeV2Router;
|
|
13
|
+
export const PANCAKE_V3_ROUTER_ADDRESS = ADDRESSES.BSC.PancakeV3Router;
|
|
14
|
+
// 常量
|
|
15
|
+
export const FLAT_FEE = 0n;
|
|
16
|
+
// ==================== 多笔买卖常量 ====================
|
|
17
|
+
/** 最大 Bundle 签名数 */
|
|
18
|
+
export const MAX_BUNDLE_SIGNATURES = 50;
|
|
19
|
+
/** 贿赂交易数 */
|
|
20
|
+
export const BRIBE_TX_COUNT = 1;
|
|
21
|
+
/** 利润中转交易数(支付者 1 笔 + 中转钱包 PROFIT_HOP_COUNT 笔 + 最终接收 1 笔) */
|
|
22
|
+
export const PROFIT_TX_COUNT = PROFIT_HOP_COUNT + 2; // 2 + 2 = 4
|
|
23
|
+
/** 最大买卖交易数 */
|
|
24
|
+
export const MAX_SWAP_TX_COUNT = MAX_BUNDLE_SIGNATURES - BRIBE_TX_COUNT - PROFIT_TX_COUNT; // 50 - 1 - 4 = 45
|
|
@@ -2,154 +2,16 @@
|
|
|
2
2
|
* PancakeSwap V2/V3 通用捆绑换手(Merkle Bundle)- 先买后卖
|
|
3
3
|
*
|
|
4
4
|
* 功能:钱包B先买入代币 → 钱包A卖出相同数量 → 原子执行
|
|
5
|
+
*
|
|
6
|
+
* 拆分说明:类型/常量/报价/规划/构建/利润/校验/多钱包 已拆到同名子文件,
|
|
7
|
+
* 本文件作为 barrel 保持对外 export 符号/路径/签名不变。
|
|
5
8
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
maxGasPriceGwei?: number;
|
|
15
|
-
txType?: 0 | 2;
|
|
16
|
-
chainId?: number;
|
|
17
|
-
reserveGasBNB?: number;
|
|
18
|
-
skipQuoteOnError?: boolean;
|
|
19
|
-
userType?: UserType;
|
|
20
|
-
bribeAmount?: number;
|
|
21
|
-
v2RouterAddress?: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* 获取 Gas Limit
|
|
25
|
-
*/
|
|
26
|
-
export declare function getGasLimit(config: PancakeBuyFirstSignConfig | PancakeBuyFirstConfig, defaultGas?: number): bigint;
|
|
27
|
-
export declare function getGasPrice(provider: ethers.JsonRpcProvider, config: PancakeBuyFirstSignConfig | PancakeBuyFirstConfig): Promise<bigint>;
|
|
28
|
-
export declare const PANCAKE_V2_ROUTER_ABI: string[];
|
|
29
|
-
export declare const PANCAKE_V3_ROUTER_ABI: (string | {
|
|
30
|
-
inputs: {
|
|
31
|
-
components: {
|
|
32
|
-
name: string;
|
|
33
|
-
type: string;
|
|
34
|
-
}[];
|
|
35
|
-
name: string;
|
|
36
|
-
type: string;
|
|
37
|
-
}[];
|
|
38
|
-
name: string;
|
|
39
|
-
outputs: {
|
|
40
|
-
name: string;
|
|
41
|
-
type: string;
|
|
42
|
-
}[];
|
|
43
|
-
stateMutability: string;
|
|
44
|
-
type: string;
|
|
45
|
-
})[];
|
|
46
|
-
export declare const ERC20_BALANCE_OF_ABI: string[];
|
|
47
|
-
export declare const PANCAKE_V2_ROUTER_ADDRESS: "0x10ED43C718714eb63d5aA57B78B54704E256024E";
|
|
48
|
-
export declare const PANCAKE_V3_ROUTER_ADDRESS: "0x13f4EA83D0bd40E75C8222255bc855a974568Dd4";
|
|
49
|
-
export declare const FLAT_FEE = 0n;
|
|
50
|
-
/** 最大 Bundle 签名数 */
|
|
51
|
-
export declare const MAX_BUNDLE_SIGNATURES = 50;
|
|
52
|
-
/** 贿赂交易数 */
|
|
53
|
-
export declare const BRIBE_TX_COUNT = 1;
|
|
54
|
-
/** 利润中转交易数(支付者 1 笔 + 中转钱包 PROFIT_HOP_COUNT 笔 + 最终接收 1 笔) */
|
|
55
|
-
export declare const PROFIT_TX_COUNT: number;
|
|
56
|
-
/** 最大买卖交易数 */
|
|
57
|
-
export declare const MAX_SWAP_TX_COUNT: number;
|
|
58
|
-
export type UserType = 'v0' | 'v1';
|
|
59
|
-
/**
|
|
60
|
-
* 根据 userType 获取每笔交易的利润率
|
|
61
|
-
*/
|
|
62
|
-
export declare function getProfitRatePerTxBps(userType?: UserType): number;
|
|
63
|
-
/**
|
|
64
|
-
* 验证买卖笔数
|
|
65
|
-
*/
|
|
66
|
-
export declare function validateSwapCounts(buyCount: number, sellCount: number): void;
|
|
9
|
+
export * from './bundle-buy-first-types.js';
|
|
10
|
+
export * from './bundle-buy-first-constants.js';
|
|
11
|
+
export * from './bundle-buy-first-quote.js';
|
|
12
|
+
export * from './bundle-buy-first-plan.js';
|
|
13
|
+
export * from './bundle-buy-first-build.js';
|
|
14
|
+
export * from './bundle-buy-first-profit.js';
|
|
15
|
+
export * from './bundle-buy-first-validate.js';
|
|
16
|
+
export * from './bundle-buy-first-multi-wallet.js';
|
|
67
17
|
export { splitAmountByWeight as splitAmount } from '../../../core/amount/split-by-weight.js';
|
|
68
|
-
/** 多笔买卖 nonce 规划(与 Flap 一致) */
|
|
69
|
-
export type MultiNoncePlan = {
|
|
70
|
-
buyerNonces: number[];
|
|
71
|
-
sellerNonces: number[];
|
|
72
|
-
bribeNonce?: number;
|
|
73
|
-
profitNonce?: number;
|
|
74
|
-
};
|
|
75
|
-
export type SwapRouteType = 'v2' | 'v3-single' | 'v3-multi';
|
|
76
|
-
export interface V2RouteParams {
|
|
77
|
-
routeType: 'v2';
|
|
78
|
-
v2Path: string[];
|
|
79
|
-
}
|
|
80
|
-
export interface V3SingleRouteParams {
|
|
81
|
-
routeType: 'v3-single';
|
|
82
|
-
v3TokenIn: string;
|
|
83
|
-
v3TokenOut: string;
|
|
84
|
-
v3Fee: number;
|
|
85
|
-
v2Path?: string[];
|
|
86
|
-
}
|
|
87
|
-
export interface V3MultiRouteParams {
|
|
88
|
-
routeType: 'v3-multi';
|
|
89
|
-
v3LpAddresses: string[];
|
|
90
|
-
v3ExactTokenIn: string;
|
|
91
|
-
v2Path?: string[];
|
|
92
|
-
}
|
|
93
|
-
export type RouteParams = V2RouteParams | V3SingleRouteParams | V3MultiRouteParams;
|
|
94
|
-
export interface PancakeBuyFirstConfig extends CommonBundleConfig {
|
|
95
|
-
apiKey: string;
|
|
96
|
-
customRpcUrl?: string;
|
|
97
|
-
bundleBlockOffset?: number;
|
|
98
|
-
reserveGasBNB?: number;
|
|
99
|
-
waitForConfirmation?: boolean;
|
|
100
|
-
waitTimeoutMs?: number;
|
|
101
|
-
}
|
|
102
|
-
export interface PancakeBundleBuyFirstSignParams {
|
|
103
|
-
buyerPrivateKey?: string;
|
|
104
|
-
buyerPrivateKeys?: string[];
|
|
105
|
-
sellerPrivateKey?: string;
|
|
106
|
-
sellerPrivateKeys?: string[];
|
|
107
|
-
tokenAddress: string;
|
|
108
|
-
routeParams: RouteParams;
|
|
109
|
-
buyerFunds?: string;
|
|
110
|
-
buyerFundsPercentage?: number;
|
|
111
|
-
config: PancakeBuyFirstSignConfig;
|
|
112
|
-
quoteToken?: string;
|
|
113
|
-
quoteTokenDecimals?: number;
|
|
114
|
-
startNonces?: number[];
|
|
115
|
-
buyCount?: number;
|
|
116
|
-
sellCount?: number;
|
|
117
|
-
taxRateBps?: number;
|
|
118
|
-
}
|
|
119
|
-
export interface PancakeBundleBuyFirstParams {
|
|
120
|
-
buyerPrivateKey: string;
|
|
121
|
-
sellerPrivateKey: string;
|
|
122
|
-
tokenAddress: string;
|
|
123
|
-
routeParams: RouteParams;
|
|
124
|
-
buyerFunds?: string;
|
|
125
|
-
buyerFundsPercentage?: number;
|
|
126
|
-
config: PancakeBuyFirstConfig;
|
|
127
|
-
}
|
|
128
|
-
/** ✅ Pancake BuyFirst 结果(简化版) */
|
|
129
|
-
export type PancakeBuyFirstResult = {
|
|
130
|
-
signedTransactions: string[];
|
|
131
|
-
profitHopWallets?: GeneratedWallet[];
|
|
132
|
-
metadata?: {
|
|
133
|
-
buyerAddress: string;
|
|
134
|
-
sellerAddress: string;
|
|
135
|
-
buyAmount: string;
|
|
136
|
-
sellAmount: string;
|
|
137
|
-
profitAmount?: string;
|
|
138
|
-
buyCount?: number;
|
|
139
|
-
sellCount?: number;
|
|
140
|
-
buyAmounts?: string[];
|
|
141
|
-
sellAmounts?: string[];
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
export type PancakeContext = {
|
|
145
|
-
chainId: number;
|
|
146
|
-
provider: ethers.JsonRpcProvider;
|
|
147
|
-
};
|
|
148
|
-
export type BuyerFundsResult = {
|
|
149
|
-
buyerFundsWei: bigint;
|
|
150
|
-
buyerBalance: bigint;
|
|
151
|
-
reserveGas: bigint;
|
|
152
|
-
};
|
|
153
|
-
export type QuoteTokenResult = {
|
|
154
|
-
quotedTokenOut: bigint;
|
|
155
|
-
};
|
|
@@ -2,79 +2,17 @@
|
|
|
2
2
|
* PancakeSwap V2/V3 通用捆绑换手(Merkle Bundle)- 先买后卖
|
|
3
3
|
*
|
|
4
4
|
* 功能:钱包B先买入代币 → 钱包A卖出相同数量 → 原子执行
|
|
5
|
+
*
|
|
6
|
+
* 拆分说明:类型/常量/报价/规划/构建/利润/校验/多钱包 已拆到同名子文件,
|
|
7
|
+
* 本文件作为 barrel 保持对外 export 符号/路径/签名不变。
|
|
5
8
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (config.gasLimit !== undefined) {
|
|
16
|
-
return typeof config.gasLimit === 'bigint' ? config.gasLimit : BigInt(config.gasLimit);
|
|
17
|
-
}
|
|
18
|
-
const multiplier = config.gasLimitMultiplier ?? 1.0;
|
|
19
|
-
const calculatedGas = Math.ceil(defaultGas * multiplier);
|
|
20
|
-
return BigInt(calculatedGas);
|
|
21
|
-
}
|
|
22
|
-
export async function getGasPrice(provider, config) {
|
|
23
|
-
const feeData = await provider.getFeeData();
|
|
24
|
-
let gasPrice = feeData.gasPrice || ethers.parseUnits('3', 'gwei');
|
|
25
|
-
if (config.minGasPriceGwei) {
|
|
26
|
-
const minGas = ethers.parseUnits(config.minGasPriceGwei.toString(), 'gwei');
|
|
27
|
-
if (gasPrice < minGas)
|
|
28
|
-
gasPrice = minGas;
|
|
29
|
-
}
|
|
30
|
-
if (config.maxGasPriceGwei) {
|
|
31
|
-
const maxGas = ethers.parseUnits(config.maxGasPriceGwei.toString(), 'gwei');
|
|
32
|
-
if (gasPrice > maxGas)
|
|
33
|
-
gasPrice = maxGas;
|
|
34
|
-
}
|
|
35
|
-
return gasPrice;
|
|
36
|
-
}
|
|
37
|
-
// ✅ ABI 别名(从公共模块导入)
|
|
38
|
-
export const PANCAKE_V2_ROUTER_ABI = V2_ROUTER_ABI;
|
|
39
|
-
export const PANCAKE_V3_ROUTER_ABI = V3_ROUTER02_ABI;
|
|
40
|
-
export const ERC20_BALANCE_OF_ABI = ERC20_BALANCE_ABI;
|
|
41
|
-
// ✅ 使用官方 PancakeSwap Router 地址
|
|
42
|
-
export const PANCAKE_V2_ROUTER_ADDRESS = ADDRESSES.BSC.PancakeV2Router;
|
|
43
|
-
export const PANCAKE_V3_ROUTER_ADDRESS = ADDRESSES.BSC.PancakeV3Router;
|
|
44
|
-
// 常量
|
|
45
|
-
export const FLAT_FEE = 0n;
|
|
46
|
-
// ==================== 多笔买卖常量 ====================
|
|
47
|
-
/** 最大 Bundle 签名数 */
|
|
48
|
-
export const MAX_BUNDLE_SIGNATURES = 50;
|
|
49
|
-
/** 贿赂交易数 */
|
|
50
|
-
export const BRIBE_TX_COUNT = 1;
|
|
51
|
-
/** 利润中转交易数(支付者 1 笔 + 中转钱包 PROFIT_HOP_COUNT 笔 + 最终接收 1 笔) */
|
|
52
|
-
export const PROFIT_TX_COUNT = PROFIT_HOP_COUNT + 2; // 2 + 2 = 4
|
|
53
|
-
/** 最大买卖交易数 */
|
|
54
|
-
export const MAX_SWAP_TX_COUNT = MAX_BUNDLE_SIGNATURES - BRIBE_TX_COUNT - PROFIT_TX_COUNT; // 50 - 1 - 4 = 45
|
|
55
|
-
/**
|
|
56
|
-
* 根据 userType 获取每笔交易的利润率
|
|
57
|
-
*/
|
|
58
|
-
export function getProfitRatePerTxBps(userType) {
|
|
59
|
-
if (userType === 'v1') {
|
|
60
|
-
return getProfitRateBps('v1Double');
|
|
61
|
-
}
|
|
62
|
-
return getProfitRateBps('v0Double'); // v0 或默认
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* 验证买卖笔数
|
|
66
|
-
*/
|
|
67
|
-
export function validateSwapCounts(buyCount, sellCount) {
|
|
68
|
-
if (buyCount < 1) {
|
|
69
|
-
throw new Error(`买入笔数必须至少为 1,当前为 ${buyCount}`);
|
|
70
|
-
}
|
|
71
|
-
if (sellCount < 1) {
|
|
72
|
-
throw new Error(`卖出笔数必须至少为 1,当前为 ${sellCount}`);
|
|
73
|
-
}
|
|
74
|
-
const totalSwaps = buyCount + sellCount;
|
|
75
|
-
if (totalSwaps > MAX_SWAP_TX_COUNT) {
|
|
76
|
-
throw new Error(`买卖笔数总和 (${totalSwaps}) 超出限制 (${MAX_SWAP_TX_COUNT}),` +
|
|
77
|
-
`最大签名数为 ${MAX_BUNDLE_SIGNATURES}(${BRIBE_TX_COUNT} 贿赂 + ${PROFIT_TX_COUNT} 利润 + ${MAX_SWAP_TX_COUNT} 买卖)`);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
9
|
+
export * from './bundle-buy-first-types.js';
|
|
10
|
+
export * from './bundle-buy-first-constants.js';
|
|
11
|
+
export * from './bundle-buy-first-quote.js';
|
|
12
|
+
export * from './bundle-buy-first-plan.js';
|
|
13
|
+
export * from './bundle-buy-first-build.js';
|
|
14
|
+
export * from './bundle-buy-first-profit.js';
|
|
15
|
+
export * from './bundle-buy-first-validate.js';
|
|
16
|
+
export * from './bundle-buy-first-multi-wallet.js';
|
|
17
|
+
// ✅ splitAmount 别名(原文件从 split-by-weight 重导出,保持向后兼容)
|
|
80
18
|
export { splitAmountByWeight as splitAmount } from '../../../core/amount/split-by-weight.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MultiWalletParams, PancakeBuyFirstResult } from './bundle-buy-first-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* ✅ 多钱包捆绑换手
|
|
4
|
+
* - 多个买方钱包执行买入(每个钱包1笔)
|
|
5
|
+
* - 多个卖方钱包执行卖出(每个钱包1笔)
|
|
6
|
+
* - 买入总价值 = 卖出总价值
|
|
7
|
+
* - ✅ 优化:最大化并行操作
|
|
8
|
+
*/
|
|
9
|
+
export declare function pancakeBundleBuyFirstMultiWallet(params: MultiWalletParams): Promise<PancakeBuyFirstResult>;
|