four-flap-meme-sdk 1.9.49 → 2.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/README.en.md +41 -6
- package/README.md +31 -0
- package/README.zh-CN.md +41 -6
- package/dist/abis/common.js +74 -68
- package/dist/abis/flap/vault.js +9 -7
- package/dist/abis/index.d.ts +3 -4
- package/dist/abis/index.js +3 -4
- package/dist/bundle-core/__tests__/config-helpers.test.js +28 -0
- package/dist/bundle-core/__tests__/facade-parity.test.js +33 -0
- package/dist/bundle-core/__tests__/sign-context-helpers.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/sign-context-helpers.test.js +60 -0
- package/dist/bundle-core/__tests__/sign-fixture.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/sign-fixture.test.js +220 -0
- package/dist/bundle-core/__tests__/sign-fixtures.d.ts +10 -0
- package/dist/bundle-core/__tests__/sign-fixtures.js +16 -0
- package/dist/bundle-core/config-helpers.d.ts +36 -0
- package/dist/bundle-core/config-helpers.js +57 -0
- package/dist/bundle-core/errors.d.ts +50 -0
- package/dist/bundle-core/errors.js +34 -0
- package/dist/bundle-core/four-meme/approve-tokenmanager.d.ts +7 -0
- package/dist/bundle-core/four-meme/approve-tokenmanager.js +99 -0
- package/dist/bundle-core/four-meme/core-helpers.d.ts +8 -0
- package/dist/bundle-core/four-meme/core-helpers.js +40 -0
- package/dist/bundle-core/four-meme/core.d.ts +4 -0
- package/dist/bundle-core/four-meme/core.js +515 -0
- package/dist/bundle-core/four-meme/pancake-proxy.d.ts +28 -0
- package/dist/bundle-core/four-meme/pancake-proxy.js +679 -0
- package/dist/bundle-core/four-meme/private.d.ts +27 -0
- package/dist/bundle-core/four-meme/private.js +465 -0
- package/dist/bundle-core/four-meme/sign-context-helpers.d.ts +2 -0
- package/dist/bundle-core/four-meme/sign-context-helpers.js +2 -0
- package/dist/bundle-core/four-meme/swap-buy-first.d.ts +8 -0
- package/dist/bundle-core/four-meme/swap-buy-first.js +493 -0
- package/dist/bundle-core/four-meme/swap-hop-helpers.d.ts +6 -0
- package/dist/bundle-core/four-meme/swap-hop-helpers.js +63 -0
- package/dist/bundle-core/four-meme/swap-internal.d.ts +3 -0
- package/dist/bundle-core/four-meme/swap-internal.js +18 -0
- package/dist/bundle-core/four-meme/swap-sign-helpers.d.ts +27 -0
- package/dist/bundle-core/four-meme/swap-sign-helpers.js +105 -0
- package/dist/bundle-core/four-meme/swap.d.ts +17 -0
- package/dist/bundle-core/four-meme/swap.js +505 -0
- package/dist/bundle-core/four-meme/types/buy-first.d.ts +50 -0
- package/dist/bundle-core/four-meme/types/buy-first.js +1 -0
- package/dist/bundle-core/four-meme/types/core-flow.d.ts +63 -0
- package/dist/bundle-core/four-meme/types/core-flow.js +1 -0
- package/dist/bundle-core/four-meme/types/index.d.ts +600 -0
- package/dist/bundle-core/four-meme/types/index.js +1 -0
- package/dist/bundle-core/four-meme/types/swap-internal.d.ts +19 -0
- package/dist/bundle-core/four-meme/types/swap-internal.js +1 -0
- package/dist/bundle-core/four-meme/types.d.ts +1 -0
- package/dist/bundle-core/four-meme/types.js +1 -0
- package/dist/bundle-core/four-meme/utils-disperse.d.ts +7 -0
- package/dist/bundle-core/four-meme/utils-disperse.js +396 -0
- package/dist/bundle-core/four-meme/utils-pairwise.d.ts +8 -0
- package/dist/bundle-core/four-meme/utils-pairwise.js +328 -0
- package/dist/bundle-core/four-meme/utils-sweep.d.ts +8 -0
- package/dist/bundle-core/four-meme/utils-sweep.js +744 -0
- package/dist/bundle-core/index.d.ts +8 -0
- package/dist/bundle-core/index.js +8 -0
- package/dist/bundle-core/internal.d.ts +21 -0
- package/dist/bundle-core/internal.js +182 -0
- package/dist/bundle-core/sign-context-helpers.d.ts +25 -0
- package/dist/bundle-core/sign-context-helpers.js +67 -0
- package/dist/bundle-core/submit.d.ts +293 -0
- package/dist/bundle-core/submit.js +727 -0
- package/dist/bundle-core/types/index.d.ts +8 -0
- package/dist/bundle-core/types/index.js +1 -0
- package/dist/bundle-core/types.d.ts +1 -0
- package/dist/bundle-core/types.js +1 -0
- package/dist/chains/bsc/four/approve-tokenmanager.d.ts +1 -26
- package/dist/chains/bsc/four/approve-tokenmanager.js +1 -116
- package/dist/chains/bsc/four/config.d.ts +5 -70
- package/dist/chains/bsc/four/config.js +2 -115
- package/dist/chains/bsc/four/core.d.ts +1 -4
- package/dist/chains/bsc/four/core.js +1 -589
- package/dist/chains/bsc/four/disperse.d.ts +12 -0
- package/dist/chains/bsc/four/disperse.js +470 -0
- package/dist/chains/bsc/four/index.d.ts +6 -6
- package/dist/chains/bsc/four/index.js +6 -6
- package/dist/chains/bsc/four/internal.d.ts +2 -50
- package/dist/chains/bsc/four/internal.js +2 -237
- package/dist/chains/bsc/four/pairwise.d.ts +7 -0
- package/dist/chains/bsc/four/pairwise.js +308 -0
- package/dist/chains/bsc/four/pancake-proxy.d.ts +1 -28
- package/dist/chains/bsc/four/pancake-proxy.js +1 -688
- package/dist/chains/bsc/four/private.d.ts +1 -27
- package/dist/chains/bsc/four/private.js +1 -477
- package/dist/chains/bsc/four/submit.d.ts +2 -315
- package/dist/chains/bsc/four/submit.js +2 -746
- package/dist/chains/bsc/four/swap-buy-first.d.ts +2 -55
- package/dist/chains/bsc/four/swap-buy-first.js +2 -506
- package/dist/chains/bsc/four/swap-internal.d.ts +1 -3
- package/dist/chains/bsc/four/swap-internal.js +1 -18
- package/dist/chains/bsc/four/swap.d.ts +2 -144
- package/dist/chains/bsc/four/swap.js +2 -760
- package/dist/chains/bsc/four/sweep.d.ts +13 -0
- package/dist/chains/bsc/four/sweep.js +788 -0
- package/dist/chains/bsc/four/types.d.ts +1 -476
- package/dist/chains/bsc/four/utils-disperse.d.ts +1 -0
- package/dist/chains/bsc/four/utils-disperse.js +1 -0
- package/dist/chains/bsc/four/utils-pairwise.d.ts +1 -0
- package/dist/chains/bsc/four/utils-pairwise.js +1 -0
- package/dist/chains/bsc/four/utils-sweep.d.ts +1 -0
- package/dist/chains/bsc/four/utils-sweep.js +1 -0
- package/dist/chains/bsc/four/utils.d.ts +5 -18
- package/dist/chains/bsc/four/utils.js +5 -1534
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +159 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +117 -0
- package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +1 -91
- package/dist/chains/bsc/pancake/bundle-buy-first.js +97 -207
- package/dist/chains/bsc/pancake/bundle-swap-helpers.d.ts +241 -0
- package/dist/chains/bsc/pancake/bundle-swap-helpers.js +565 -0
- package/dist/chains/bsc/pancake/bundle-swap.d.ts +1 -79
- package/dist/chains/bsc/pancake/bundle-swap.js +111 -686
- package/dist/chains/bsc/pancake/index.d.ts +4 -2
- package/dist/chains/bsc/pancake/index.js +1 -3
- package/dist/chains/bsc/platforms/iro/factory.js +3 -1
- package/dist/chains/bsc/platforms/iro/index.d.ts +5 -5
- package/dist/chains/bsc/platforms/iro/index.js +3 -3
- package/dist/chains/bsc/platforms/iro/pool.js +31 -10
- package/dist/chains/bsc/platforms/iro/token.js +4 -1
- package/dist/chains/eni/batch-router/bundle-approve.js +4 -3
- package/dist/chains/eni/batch-router/transfer.js +54 -23
- package/dist/chains/eni/batch-router/utils.js +32 -6
- package/dist/chains/eni/bundler/sign.js +4 -4
- package/dist/chains/eni/bundler/submit.js +1 -4
- package/dist/chains/eni/constants.js +1 -1
- package/dist/chains/eni/index.d.ts +1 -1
- package/dist/chains/eni/platforms/daoaas/create.js +2 -2
- package/dist/chains/eni/platforms/daoaas/index.d.ts +3 -3
- package/dist/chains/eni/platforms/daoaas/index.js +3 -3
- package/dist/chains/eni/platforms/daoaas/meta.js +8 -4
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +28 -43
- package/dist/chains/eni/platforms/daoaas/portal.js +10 -6
- package/dist/chains/eni/platforms/dswap/liquidity.js +58 -26
- package/dist/chains/eni/platforms/fair-launch/index.d.ts +2 -2
- package/dist/chains/eni/platforms/fair-launch/index.js +1 -1
- package/dist/chains/eni/platforms/fair-launch/launcher.js +87 -47
- package/dist/chains/eni/platforms/fair-launch/pool.js +4 -1
- package/dist/chains/eni/platforms/fair-launch/presets.js +2 -2
- package/dist/chains/eni/platforms/iro/factory.js +3 -1
- package/dist/chains/eni/platforms/iro/index.d.ts +6 -6
- package/dist/chains/eni/platforms/iro/index.js +4 -4
- package/dist/chains/eni/platforms/iro/pool.js +90 -26
- package/dist/chains/eni/platforms/iro/token.js +107 -31
- package/dist/chains/eni/platforms/iro/whitelist.js +6 -18
- package/dist/chains/eni/submit.js +5 -13
- package/dist/chains/xlayer/eip7702/bundle-approve.d.ts +2 -26
- package/dist/chains/xlayer/eip7702/bundle-approve.js +11 -20
- package/dist/chains/xlayer/eip7702/bundle-buy.d.ts +2 -6
- package/dist/chains/xlayer/eip7702/bundle-buy.js +13 -51
- package/dist/chains/xlayer/eip7702/bundle-create.js +93 -56
- package/dist/chains/xlayer/eip7702/bundle-sell.d.ts +2 -6
- package/dist/chains/xlayer/eip7702/bundle-sell.js +26 -74
- package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +3 -65
- package/dist/chains/xlayer/eip7702/bundle-swap.js +51 -68
- package/dist/chains/xlayer/eip7702/constants.d.ts +1 -16
- package/dist/chains/xlayer/eip7702/constants.js +3 -21
- package/dist/chains/xlayer/eip7702/index.d.ts +27 -46
- package/dist/chains/xlayer/eip7702/index.js +27 -81
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.d.ts +79 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.js +1 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.d.ts +2 -203
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.js +58 -291
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.d.ts +26 -0
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.js +57 -0
- package/dist/chains/xlayer/eip7702/types.d.ts +88 -0
- package/dist/chains/xlayer/eip7702/utils.d.ts +0 -3
- package/dist/chains/xlayer/eip7702/utils.js +23 -28
- package/dist/chains/xlayer/eip7702/volume-helpers.d.ts +148 -0
- package/dist/chains/xlayer/eip7702/volume-helpers.js +48 -0
- package/dist/chains/xlayer/eip7702/volume.d.ts +6 -184
- package/dist/chains/xlayer/eip7702/volume.js +83 -158
- package/dist/chains/xlayer/eoa/constants.js +1 -1
- package/dist/chains/xlayer/eoa/dex-helpers.js +5 -5
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts +126 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +228 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.d.ts +1 -95
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.js +64 -276
- package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +1 -1
- package/dist/chains/xlayer/eoa/eoa-wash-volume.js +14 -14
- package/dist/chains/xlayer/eoa/index.d.ts +10 -6
- package/dist/chains/xlayer/eoa/index.js +8 -23
- package/dist/chains/xlayer/eoa/portal-ops.js +7 -2
- package/dist/chains/xlayer/eoa/router-manager.js +3 -3
- package/dist/chains/xlayer/eoa/types-core.d.ts +363 -0
- package/dist/chains/xlayer/eoa/types-core.js +53 -0
- package/dist/chains/xlayer/eoa/types-create.d.ts +413 -0
- package/dist/chains/xlayer/eoa/types-create.js +9 -0
- package/dist/chains/xlayer/eoa/types-volume.d.ts +209 -0
- package/dist/chains/xlayer/eoa/types-volume.js +13 -0
- package/dist/chains/xlayer/eoa/types.d.ts +2 -2
- package/dist/chains/xlayer/eoa/types.js +1 -3
- package/dist/contracts/helper3.d.ts +20 -17
- package/dist/contracts/helper3.js +56 -20
- package/dist/contracts/tm-bundle-helpers.d.ts +88 -0
- package/dist/contracts/tm-bundle-helpers.js +72 -0
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.d.ts +1 -26
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.js +1 -117
- package/dist/contracts/tm-bundle-merkle/config.d.ts +5 -70
- package/dist/contracts/tm-bundle-merkle/config.js +2 -115
- package/dist/contracts/tm-bundle-merkle/core.d.ts +1 -4
- package/dist/contracts/tm-bundle-merkle/core.js +1 -588
- package/dist/contracts/tm-bundle-merkle/index.d.ts +5 -5
- package/dist/contracts/tm-bundle-merkle/index.js +5 -5
- package/dist/contracts/tm-bundle-merkle/internal.d.ts +2 -50
- package/dist/contracts/tm-bundle-merkle/internal.js +2 -236
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.d.ts +1 -28
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.js +1 -687
- package/dist/contracts/tm-bundle-merkle/private.d.ts +1 -27
- package/dist/contracts/tm-bundle-merkle/private.js +1 -476
- package/dist/contracts/tm-bundle-merkle/submit.d.ts +3 -314
- package/dist/contracts/tm-bundle-merkle/submit.js +3 -919
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.d.ts +2 -55
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.js +2 -505
- package/dist/contracts/tm-bundle-merkle/swap-internal.d.ts +1 -3
- package/dist/contracts/tm-bundle-merkle/swap-internal.js +1 -18
- package/dist/contracts/tm-bundle-merkle/swap.d.ts +2 -144
- package/dist/contracts/tm-bundle-merkle/swap.js +2 -757
- package/dist/contracts/tm-bundle-merkle/types.d.ts +1 -476
- package/dist/contracts/tm-bundle-merkle/utils-disperse.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-disperse.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-sweep.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-sweep.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils.d.ts +5 -6
- package/dist/contracts/tm-bundle-merkle/utils.js +5 -6
- package/dist/contracts/tm-bundle.d.ts +3 -51
- package/dist/contracts/tm-bundle.js +102 -142
- package/dist/contracts/tm.d.ts +3 -2
- package/dist/contracts/tm.js +36 -32
- package/dist/contracts/tm1.js +9 -4
- package/dist/contracts/tm2.js +9 -4
- package/dist/dex/direct-router-helpers.d.ts +264 -0
- package/dist/dex/direct-router-helpers.js +539 -0
- package/dist/dex/direct-router.d.ts +3 -125
- package/dist/dex/direct-router.js +237 -652
- package/dist/dex/types.d.ts +81 -0
- package/dist/dex/types.js +1 -0
- package/dist/exports/root-bundle-and-tooling.d.ts +27 -0
- package/dist/exports/root-bundle-and-tooling.js +30 -0
- package/dist/exports/root-eni-and-bsc-iro.d.ts +26 -0
- package/dist/exports/root-eni-and-bsc-iro.js +66 -0
- package/dist/exports/root-foundations.d.ts +35 -0
- package/dist/exports/root-foundations.js +70 -0
- package/dist/exports/root-swap-dex-and-xlayer.d.ts +30 -0
- package/dist/exports/root-swap-dex-and-xlayer.js +78 -0
- package/dist/flows/create.d.ts +2 -2
- package/dist/flows/create.js +6 -6
- package/dist/flows/index.d.ts +1 -0
- package/dist/flows/index.js +1 -0
- package/dist/index.d.ts +20 -91
- package/dist/index.js +20 -215
- package/dist/shared/abis/common.d.ts +2 -83
- package/dist/shared/abis/common.js +2 -252
- package/dist/shared/abis/index.d.ts +5 -6
- package/dist/shared/abis/index.js +5 -7
- package/dist/shared/clients/blockrazor.js +41 -24
- package/dist/shared/clients/club48.js +30 -26
- package/dist/shared/clients/emitservice.js +2 -0
- package/dist/shared/clients/four.js +23 -18
- package/dist/shared/clients/index.d.ts +8 -0
- package/dist/shared/clients/index.js +8 -0
- package/dist/shared/clients/merkle.js +26 -30
- package/dist/shared/constants/addresses.d.ts +1 -1
- package/dist/shared/constants/addresses.js +11 -2
- package/dist/shared/constants/chains.d.ts +1 -1
- package/dist/shared/constants/chains.js +1 -1
- package/dist/shared/constants/gas.d.ts +1 -1
- package/dist/shared/constants/gas.js +2 -6
- package/dist/shared/constants/index.d.ts +1 -0
- package/dist/shared/constants/index.js +1 -0
- package/dist/shared/constants/quote.d.ts +30 -0
- package/dist/shared/constants/quote.js +37 -0
- package/dist/shared/flap/__tests__/curve.test.js +3 -3
- package/dist/shared/flap/abi.js +1 -1
- package/dist/shared/flap/constants.d.ts +1 -1
- package/dist/shared/flap/constants.js +2 -2
- package/dist/shared/flap/curve.js +3 -0
- package/dist/shared/flap/errors.d.ts +1 -4
- package/dist/shared/flap/errors.js +21 -3
- package/dist/shared/flap/index.d.ts +2 -2
- package/dist/shared/flap/index.js +2 -2
- package/dist/shared/flap/meta.d.ts +16 -18
- package/dist/shared/flap/meta.js +14 -26
- package/dist/shared/flap/permit.js +6 -5
- package/dist/shared/flap/pinata.d.ts +9 -2
- package/dist/shared/flap/pinata.js +20 -18
- package/dist/shared/flap/portal-bundle-merkle/config.d.ts +3 -72
- package/dist/shared/flap/portal-bundle-merkle/config.js +4 -124
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.d.ts +32 -0
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.js +83 -0
- package/dist/shared/flap/portal-bundle-merkle/core.d.ts +0 -4
- package/dist/shared/flap/portal-bundle-merkle/core.js +66 -156
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +81 -86
- package/dist/shared/flap/portal-bundle-merkle/curve-to-dex.js +100 -92
- package/dist/shared/flap/portal-bundle-merkle/index.d.ts +11 -7
- package/dist/shared/flap/portal-bundle-merkle/index.js +4 -7
- package/dist/shared/flap/portal-bundle-merkle/pancake-proxy.js +71 -68
- package/dist/shared/flap/portal-bundle-merkle/private.js +61 -114
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +125 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.js +113 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.d.ts +1 -64
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.js +66 -247
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.d.ts +149 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.js +259 -0
- package/dist/shared/flap/portal-bundle-merkle/swap.d.ts +2 -71
- package/dist/shared/flap/portal-bundle-merkle/swap.js +103 -410
- package/dist/shared/flap/portal-bundle-merkle/types.d.ts +73 -3
- package/dist/shared/flap/portal-bundle-merkle/utils-helpers.d.ts +100 -0
- package/dist/shared/flap/portal-bundle-merkle/utils-helpers.js +133 -0
- package/dist/shared/flap/portal-bundle-merkle/utils.d.ts +1 -80
- package/dist/shared/flap/portal-bundle-merkle/utils.js +145 -265
- package/dist/shared/flap/portal-bundle.js +54 -42
- package/dist/shared/flap/portal.js +32 -10
- package/dist/shared/flap/vanity.js +4 -7
- package/dist/shared/flap/vault.d.ts +1 -1
- package/dist/shared/flap/vault.js +54 -48
- package/dist/shared/flap 2/__tests__/curve.test.d.ts +1 -0
- package/dist/shared/flap 2/portal-bundle-merkle/types.js +1 -0
- package/dist/shared/foundation/dex/v3-path.d.ts +6 -0
- package/dist/shared/foundation/dex/v3-path.js +35 -0
- package/dist/shared/foundation/gas/bundle-gas.d.ts +39 -0
- package/dist/shared/foundation/gas/bundle-gas.js +93 -0
- package/dist/shared/foundation/gas/profit-hop.d.ts +20 -0
- package/dist/shared/foundation/gas/profit-hop.js +72 -0
- package/dist/shared/foundation/index.d.ts +13 -0
- package/dist/shared/foundation/index.js +12 -0
- package/dist/shared/foundation/nonce/nonce-manager.d.ts +17 -0
- package/dist/shared/foundation/nonce/nonce-manager.js +180 -0
- package/dist/shared/foundation/normalize-unknown.d.ts +9 -0
- package/dist/shared/foundation/normalize-unknown.js +29 -0
- package/dist/shared/foundation/sdk-logger.d.ts +13 -0
- package/dist/shared/foundation/sdk-logger.js +12 -0
- package/dist/shared/foundation/tx/build-request.d.ts +17 -0
- package/dist/shared/foundation/tx/build-request.js +25 -0
- package/dist/shared/foundation/tx/sign-batch.d.ts +5 -0
- package/dist/shared/foundation/tx/sign-batch.js +26 -0
- package/dist/shared/foundation/tx/wallet-sign-patch.d.ts +1 -0
- package/dist/shared/foundation/tx/wallet-sign-patch.js +18 -0
- package/dist/shared/foundation/types/airdrop-sweep.d.ts +79 -0
- package/dist/shared/foundation/types/airdrop-sweep.js +1 -0
- package/dist/shared/foundation/types/erc20.d.ts +65 -0
- package/dist/shared/foundation/types/erc20.js +1 -0
- package/dist/shared/foundation/types/holders-maker.d.ts +64 -0
- package/dist/shared/foundation/types/holders-maker.js +1 -0
- package/dist/shared/foundation/types/index.d.ts +7 -0
- package/dist/shared/foundation/types/index.js +1 -0
- package/dist/shared/foundation/types/lp-inspect.d.ts +102 -0
- package/dist/shared/foundation/types/lp-inspect.js +1 -0
- package/dist/shared/foundation/types/multicall.d.ts +5 -0
- package/dist/shared/foundation/types/multicall.js +1 -0
- package/dist/shared/foundation/types/private-sale.d.ts +35 -0
- package/dist/shared/foundation/types/private-sale.js +1 -0
- package/dist/shared/foundation/types/quote-helpers.d.ts +17 -0
- package/dist/shared/foundation/types/quote-helpers.js +1 -0
- package/dist/shared/four/tax-token.d.ts +1 -1
- package/dist/shared/four/tax-token.js +27 -7
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/index.js +4 -0
- package/dist/types/distribute.d.ts +72 -0
- package/dist/types/distribute.js +1 -0
- package/dist/types 2/errors.d.ts +27 -0
- package/dist/types 2/errors.js +34 -0
- package/dist/utils/airdrop-sweep-types.d.ts +1 -0
- package/dist/utils/airdrop-sweep-types.js +1 -0
- package/dist/utils/airdrop-sweep.d.ts +4 -76
- package/dist/utils/airdrop-sweep.js +38 -52
- package/dist/utils/bundle-helpers.d.ts +9 -243
- package/dist/utils/bundle-helpers.js +10 -584
- package/dist/utils/constants.d.ts +5 -61
- package/dist/utils/constants.js +5 -80
- package/dist/utils/contract-factory.d.ts +2 -4
- package/dist/utils/contract-factory.js +25 -18
- package/dist/utils/erc20-types.d.ts +1 -0
- package/dist/utils/erc20-types.js +1 -0
- package/dist/utils/erc20.d.ts +8 -90
- package/dist/utils/erc20.js +94 -153
- package/dist/utils/errors.d.ts +10 -22
- package/dist/utils/errors.js +61 -79
- package/dist/utils/holders-maker/addresses.d.ts +12 -0
- package/dist/utils/holders-maker/addresses.js +15 -0
- package/dist/utils/holders-maker/buy-tx.d.ts +44 -0
- package/dist/utils/holders-maker/buy-tx.js +278 -0
- package/dist/utils/holders-maker/constants.d.ts +6 -0
- package/dist/utils/holders-maker/constants.js +7 -0
- package/dist/utils/holders-maker/disperse.d.ts +18 -0
- package/dist/utils/holders-maker/disperse.js +90 -0
- package/dist/utils/holders-maker/routing.d.ts +4 -0
- package/dist/utils/holders-maker/routing.js +45 -0
- package/dist/utils/holders-maker/transfer-tx.d.ts +4 -0
- package/dist/utils/holders-maker/transfer-tx.js +67 -0
- package/dist/utils/holders-maker-helpers.d.ts +9 -0
- package/dist/utils/holders-maker-helpers.js +9 -0
- package/dist/utils/holders-maker-types.d.ts +1 -0
- package/dist/utils/holders-maker-types.js +1 -0
- package/dist/utils/holders-maker.d.ts +2 -138
- package/dist/utils/holders-maker.js +23 -651
- package/dist/utils/hop-chains.d.ts +35 -0
- package/dist/utils/hop-chains.js +215 -0
- package/dist/utils/lp-inspect-helpers.d.ts +9 -0
- package/dist/utils/lp-inspect-helpers.js +109 -0
- package/dist/utils/lp-inspect-types.d.ts +1 -0
- package/dist/utils/lp-inspect-types.js +1 -0
- package/dist/utils/lp-inspect.d.ts +2 -112
- package/dist/utils/lp-inspect.js +63 -195
- package/dist/utils/mpcExclusive.d.ts +2 -5
- package/dist/utils/mpcExclusive.js +4 -3
- package/dist/utils/private-sale-types.d.ts +1 -0
- package/dist/utils/private-sale-types.js +1 -0
- package/dist/utils/private-sale.d.ts +2 -58
- package/dist/utils/private-sale.js +2 -7
- package/dist/utils/provider-factory.d.ts +4 -0
- package/dist/utils/provider-factory.js +10 -0
- package/dist/utils/quote-helpers-types.d.ts +1 -0
- package/dist/utils/quote-helpers-types.js +1 -0
- package/dist/utils/quote-helpers.d.ts +4 -45
- package/dist/utils/quote-helpers.js +15 -65
- package/dist/utils/stealth-transfer.d.ts +2 -28
- package/dist/utils/stealth-transfer.js +30 -14
- package/dist/utils/swap-helpers.d.ts +0 -3
- package/dist/utils/swap-helpers.js +6 -9
- package/dist/utils/types/airdrop-sweep.d.ts +1 -0
- package/dist/utils/types/airdrop-sweep.js +1 -0
- package/dist/utils/types/contract-factory.d.ts +1 -0
- package/dist/utils/types/contract-factory.js +1 -0
- package/dist/utils/types/erc20.d.ts +1 -0
- package/dist/utils/types/erc20.js +1 -0
- package/dist/utils/types/errors.d.ts +1 -0
- package/dist/utils/types/errors.js +1 -0
- package/dist/utils/types/holders-maker.d.ts +1 -0
- package/dist/utils/types/holders-maker.js +1 -0
- package/dist/utils/types/hop-chains.d.ts +8 -0
- package/dist/utils/types/hop-chains.js +1 -0
- package/dist/utils/types/index.d.ts +13 -0
- package/dist/utils/types/index.js +1 -0
- package/dist/utils/types/lp-inspect.d.ts +1 -0
- package/dist/utils/types/lp-inspect.js +1 -0
- package/dist/utils/types/mpc-exclusive.d.ts +5 -0
- package/dist/utils/types/mpc-exclusive.js +1 -0
- package/dist/utils/types/private-sale.d.ts +1 -0
- package/dist/utils/types/private-sale.js +1 -0
- package/dist/utils/types/quote-helpers.d.ts +1 -0
- package/dist/utils/types/quote-helpers.js +1 -0
- package/dist/utils/types/stealth-transfer.d.ts +44 -0
- package/dist/utils/types/stealth-transfer.js +1 -0
- package/dist/utils/types/wallet.d.ts +25 -0
- package/dist/utils/types/wallet.js +1 -0
- package/dist/utils/wallet.d.ts +2 -25
- package/dist/utils/wallet.js +9 -10
- package/package.json +55 -2
- package/src/abis/contracts/TaxToken.json +969 -0
- package/src/abis/contracts/TokenManager.json +836 -0
- package/src/abis/contracts/TokenManager2.json +136 -0
- package/src/abis/contracts/TokenManagerHelper3.json +993 -0
- /package/dist/{shared 2/flap/__tests__/curve.test.d.ts → bundle-core/__tests__/config-helpers.test.d.ts} +0 -0
- /package/dist/{shared 2/flap/portal-bundle-merkle/types.js → bundle-core/__tests__/facade-parity.test.d.ts} +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/TaxToken.json +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/TokenManager.json +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/TokenManager2.json +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/TokenManagerHelper3.json +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/common.d.ts +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/common.js +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/index.d.ts +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/index.js +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/blockrazor.d.ts +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/blockrazor.js +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/club48.d.ts +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/club48.js +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/emitservice.d.ts +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/emitservice.js +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/four.d.ts +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/four.js +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/merkle.d.ts +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/merkle.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/__tests__/curve.test.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/abi.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/abi.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/constants.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/constants.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/curve.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/curve.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/errors.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/errors.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/index.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/index.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/ipfs.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/ipfs.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/meta.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/meta.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/permit.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/permit.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/pinata.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/pinata.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/config.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/config.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/core.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/core.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/create-to-dex.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/create-to-dex.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/curve-to-dex.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/curve-to-dex.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/index.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/index.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/pancake-proxy.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/pancake-proxy.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/private.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/private.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/swap-buy-first.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/swap-buy-first.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/swap.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/swap.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/types.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/utils.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/utils.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/vanity.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/vanity.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/vault.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/vault.js +0 -0
- /package/dist/{shared 2/four → shared/four 2}/index.d.ts +0 -0
- /package/dist/{shared 2/four → shared/four 2}/index.js +0 -0
- /package/dist/{shared 2/four → shared/four 2}/tax-token.d.ts +0 -0
- /package/dist/{shared 2/four → shared/four 2}/tax-token.js +0 -0
- /package/dist/{shared 2/index.d.ts → shared/index 2.js} +0 -0
- /package/dist/{shared 2/index.js → shared/index.d 2.ts} +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PancakeSwap V2/V3 通用捆绑换手(Merkle Bundle)- 先买后卖
|
|
3
|
+
*
|
|
4
|
+
* 功能:钱包B先买入代币 → 钱包A卖出相同数量 → 原子执行
|
|
5
|
+
*/
|
|
6
|
+
import { ethers } from 'ethers';
|
|
7
|
+
import type { GeneratedWallet } from '../../../utils/wallet.js';
|
|
8
|
+
import { CommonBundleConfig } from '../../../utils/bundle-helpers.js';
|
|
9
|
+
export interface PancakeBuyFirstSignConfig {
|
|
10
|
+
rpcUrl: string;
|
|
11
|
+
gasLimit?: number | bigint;
|
|
12
|
+
gasLimitMultiplier?: number;
|
|
13
|
+
minGasPriceGwei?: number;
|
|
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;
|
|
67
|
+
/**
|
|
68
|
+
* ✅ 将金额随机拆分成多份(更自然,不像机器人)
|
|
69
|
+
* 每份金额在平均值的 50%-150% 之间随机浮动
|
|
70
|
+
*/
|
|
71
|
+
export declare function splitAmount(totalAmount: bigint, count: number): bigint[];
|
|
72
|
+
/** 多笔买卖 nonce 规划(与 Flap 一致) */
|
|
73
|
+
export type MultiNoncePlan = {
|
|
74
|
+
buyerNonces: number[];
|
|
75
|
+
sellerNonces: number[];
|
|
76
|
+
bribeNonce?: number;
|
|
77
|
+
profitNonce?: number;
|
|
78
|
+
};
|
|
79
|
+
export type SwapRouteType = 'v2' | 'v3-single' | 'v3-multi';
|
|
80
|
+
export interface V2RouteParams {
|
|
81
|
+
routeType: 'v2';
|
|
82
|
+
v2Path: string[];
|
|
83
|
+
}
|
|
84
|
+
export interface V3SingleRouteParams {
|
|
85
|
+
routeType: 'v3-single';
|
|
86
|
+
v3TokenIn: string;
|
|
87
|
+
v3TokenOut: string;
|
|
88
|
+
v3Fee: number;
|
|
89
|
+
v2Path?: string[];
|
|
90
|
+
}
|
|
91
|
+
export interface V3MultiRouteParams {
|
|
92
|
+
routeType: 'v3-multi';
|
|
93
|
+
v3LpAddresses: string[];
|
|
94
|
+
v3ExactTokenIn: string;
|
|
95
|
+
v2Path?: string[];
|
|
96
|
+
}
|
|
97
|
+
export type RouteParams = V2RouteParams | V3SingleRouteParams | V3MultiRouteParams;
|
|
98
|
+
export interface PancakeBuyFirstConfig extends CommonBundleConfig {
|
|
99
|
+
apiKey: string;
|
|
100
|
+
customRpcUrl?: string;
|
|
101
|
+
bundleBlockOffset?: number;
|
|
102
|
+
reserveGasBNB?: number;
|
|
103
|
+
waitForConfirmation?: boolean;
|
|
104
|
+
waitTimeoutMs?: number;
|
|
105
|
+
}
|
|
106
|
+
export interface PancakeBundleBuyFirstSignParams {
|
|
107
|
+
buyerPrivateKey?: string;
|
|
108
|
+
buyerPrivateKeys?: string[];
|
|
109
|
+
sellerPrivateKey?: string;
|
|
110
|
+
sellerPrivateKeys?: string[];
|
|
111
|
+
tokenAddress: string;
|
|
112
|
+
routeParams: RouteParams;
|
|
113
|
+
buyerFunds?: string;
|
|
114
|
+
buyerFundsPercentage?: number;
|
|
115
|
+
config: PancakeBuyFirstSignConfig;
|
|
116
|
+
quoteToken?: string;
|
|
117
|
+
quoteTokenDecimals?: number;
|
|
118
|
+
startNonces?: number[];
|
|
119
|
+
buyCount?: number;
|
|
120
|
+
sellCount?: number;
|
|
121
|
+
taxRateBps?: number;
|
|
122
|
+
}
|
|
123
|
+
export interface PancakeBundleBuyFirstParams {
|
|
124
|
+
buyerPrivateKey: string;
|
|
125
|
+
sellerPrivateKey: string;
|
|
126
|
+
tokenAddress: string;
|
|
127
|
+
routeParams: RouteParams;
|
|
128
|
+
buyerFunds?: string;
|
|
129
|
+
buyerFundsPercentage?: number;
|
|
130
|
+
config: PancakeBuyFirstConfig;
|
|
131
|
+
}
|
|
132
|
+
/** ✅ Pancake BuyFirst 结果(简化版) */
|
|
133
|
+
export type PancakeBuyFirstResult = {
|
|
134
|
+
signedTransactions: string[];
|
|
135
|
+
profitHopWallets?: GeneratedWallet[];
|
|
136
|
+
metadata?: {
|
|
137
|
+
buyerAddress: string;
|
|
138
|
+
sellerAddress: string;
|
|
139
|
+
buyAmount: string;
|
|
140
|
+
sellAmount: string;
|
|
141
|
+
profitAmount?: string;
|
|
142
|
+
buyCount?: number;
|
|
143
|
+
sellCount?: number;
|
|
144
|
+
buyAmounts?: string[];
|
|
145
|
+
sellAmounts?: string[];
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
export type PancakeContext = {
|
|
149
|
+
chainId: number;
|
|
150
|
+
provider: ethers.JsonRpcProvider;
|
|
151
|
+
};
|
|
152
|
+
export type BuyerFundsResult = {
|
|
153
|
+
buyerFundsWei: bigint;
|
|
154
|
+
buyerBalance: bigint;
|
|
155
|
+
reserveGas: bigint;
|
|
156
|
+
};
|
|
157
|
+
export type QuoteTokenResult = {
|
|
158
|
+
quotedTokenOut: bigint;
|
|
159
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PancakeSwap V2/V3 通用捆绑换手(Merkle Bundle)- 先买后卖
|
|
3
|
+
*
|
|
4
|
+
* 功能:钱包B先买入代币 → 钱包A卖出相同数量 → 原子执行
|
|
5
|
+
*/
|
|
6
|
+
import { ethers } from 'ethers';
|
|
7
|
+
import { PROFIT_HOP_COUNT } from '../../../utils/bundle-helpers.js';
|
|
8
|
+
import { V2_ROUTER_ABI, V3_ROUTER02_ABI, ERC20_BALANCE_ABI } from '../../../abis/common.js';
|
|
9
|
+
import { getProfitRateBps } from '../../../shared/constants/index.js';
|
|
10
|
+
import { ADDRESSES } from '../../../shared/constants/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* 获取 Gas Limit
|
|
13
|
+
*/
|
|
14
|
+
export function getGasLimit(config, defaultGas = 800000) {
|
|
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
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* ✅ 将金额随机拆分成多份(更自然,不像机器人)
|
|
82
|
+
* 每份金额在平均值的 50%-150% 之间随机浮动
|
|
83
|
+
*/
|
|
84
|
+
export function splitAmount(totalAmount, count) {
|
|
85
|
+
if (count <= 0) {
|
|
86
|
+
throw new Error('拆分份数必须大于 0');
|
|
87
|
+
}
|
|
88
|
+
if (count === 1) {
|
|
89
|
+
return [totalAmount];
|
|
90
|
+
}
|
|
91
|
+
// 生成随机权重(0.5 - 1.5 之间)
|
|
92
|
+
const weights = [];
|
|
93
|
+
for (let i = 0; i < count; i++) {
|
|
94
|
+
// 随机值在 0.5 - 1.5 之间,使每份金额有 ±50% 的浮动
|
|
95
|
+
weights.push(0.5 + Math.random());
|
|
96
|
+
}
|
|
97
|
+
// 计算权重总和
|
|
98
|
+
const totalWeight = weights.reduce((a, b) => a + b, 0);
|
|
99
|
+
// 根据权重分配金额
|
|
100
|
+
const amounts = [];
|
|
101
|
+
let allocated = 0n;
|
|
102
|
+
for (let i = 0; i < count - 1; i++) {
|
|
103
|
+
// 按权重比例分配
|
|
104
|
+
const ratio = weights[i] / totalWeight;
|
|
105
|
+
const amount = BigInt(Math.floor(Number(totalAmount) * ratio));
|
|
106
|
+
amounts.push(amount);
|
|
107
|
+
allocated += amount;
|
|
108
|
+
}
|
|
109
|
+
// 最后一份分配剩余的全部(确保总和精确)
|
|
110
|
+
amounts.push(totalAmount - allocated);
|
|
111
|
+
// 随机打乱顺序(让大小金额交错出现)
|
|
112
|
+
for (let i = amounts.length - 1; i > 0; i--) {
|
|
113
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
114
|
+
[amounts[i], amounts[j]] = [amounts[j], amounts[i]];
|
|
115
|
+
}
|
|
116
|
+
return amounts;
|
|
117
|
+
}
|
|
@@ -1,92 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* PancakeSwap V2/V3 通用捆绑换手(Merkle Bundle)- 先买后卖
|
|
3
|
-
*
|
|
4
|
-
* 功能:钱包B先买入代币 → 钱包A卖出相同数量 → 原子执行
|
|
5
|
-
*/
|
|
6
|
-
import { CommonBundleConfig } from '../../../utils/bundle-helpers.js';
|
|
7
|
-
import type { GeneratedWallet } from '../../../utils/wallet.js';
|
|
8
|
-
export interface PancakeBuyFirstSignConfig {
|
|
9
|
-
rpcUrl: string;
|
|
10
|
-
gasLimit?: number | bigint;
|
|
11
|
-
gasLimitMultiplier?: number;
|
|
12
|
-
minGasPriceGwei?: number;
|
|
13
|
-
maxGasPriceGwei?: number;
|
|
14
|
-
txType?: 0 | 2;
|
|
15
|
-
chainId?: number;
|
|
16
|
-
reserveGasBNB?: number;
|
|
17
|
-
skipQuoteOnError?: boolean;
|
|
18
|
-
userType?: UserType;
|
|
19
|
-
bribeAmount?: number;
|
|
20
|
-
v2RouterAddress?: string;
|
|
21
|
-
}
|
|
22
|
-
export type UserType = 'v0' | 'v1';
|
|
23
|
-
export type SwapRouteType = 'v2' | 'v3-single' | 'v3-multi';
|
|
24
|
-
export interface V2RouteParams {
|
|
25
|
-
routeType: 'v2';
|
|
26
|
-
v2Path: string[];
|
|
27
|
-
}
|
|
28
|
-
export interface V3SingleRouteParams {
|
|
29
|
-
routeType: 'v3-single';
|
|
30
|
-
v3TokenIn: string;
|
|
31
|
-
v3TokenOut: string;
|
|
32
|
-
v3Fee: number;
|
|
33
|
-
v2Path?: string[];
|
|
34
|
-
}
|
|
35
|
-
export interface V3MultiRouteParams {
|
|
36
|
-
routeType: 'v3-multi';
|
|
37
|
-
v3LpAddresses: string[];
|
|
38
|
-
v3ExactTokenIn: string;
|
|
39
|
-
v2Path?: string[];
|
|
40
|
-
}
|
|
41
|
-
export type RouteParams = V2RouteParams | V3SingleRouteParams | V3MultiRouteParams;
|
|
42
|
-
export interface PancakeBuyFirstConfig extends CommonBundleConfig {
|
|
43
|
-
apiKey: string;
|
|
44
|
-
customRpcUrl?: string;
|
|
45
|
-
bundleBlockOffset?: number;
|
|
46
|
-
reserveGasBNB?: number;
|
|
47
|
-
waitForConfirmation?: boolean;
|
|
48
|
-
waitTimeoutMs?: number;
|
|
49
|
-
}
|
|
50
|
-
export interface PancakeBundleBuyFirstSignParams {
|
|
51
|
-
buyerPrivateKey?: string;
|
|
52
|
-
buyerPrivateKeys?: string[];
|
|
53
|
-
sellerPrivateKey?: string;
|
|
54
|
-
sellerPrivateKeys?: string[];
|
|
55
|
-
tokenAddress: string;
|
|
56
|
-
routeParams: RouteParams;
|
|
57
|
-
buyerFunds?: string;
|
|
58
|
-
buyerFundsPercentage?: number;
|
|
59
|
-
config: PancakeBuyFirstSignConfig;
|
|
60
|
-
quoteToken?: string;
|
|
61
|
-
quoteTokenDecimals?: number;
|
|
62
|
-
startNonces?: number[];
|
|
63
|
-
buyCount?: number;
|
|
64
|
-
sellCount?: number;
|
|
65
|
-
taxRateBps?: number;
|
|
66
|
-
}
|
|
67
|
-
export interface PancakeBundleBuyFirstParams {
|
|
68
|
-
buyerPrivateKey: string;
|
|
69
|
-
sellerPrivateKey: string;
|
|
70
|
-
tokenAddress: string;
|
|
71
|
-
routeParams: RouteParams;
|
|
72
|
-
buyerFunds?: string;
|
|
73
|
-
buyerFundsPercentage?: number;
|
|
74
|
-
config: PancakeBuyFirstConfig;
|
|
75
|
-
}
|
|
76
|
-
/** ✅ Pancake BuyFirst 结果(简化版) */
|
|
77
|
-
export type PancakeBuyFirstResult = {
|
|
78
|
-
signedTransactions: string[];
|
|
79
|
-
profitHopWallets?: GeneratedWallet[];
|
|
80
|
-
metadata?: {
|
|
81
|
-
buyerAddress: string;
|
|
82
|
-
sellerAddress: string;
|
|
83
|
-
buyAmount: string;
|
|
84
|
-
sellAmount: string;
|
|
85
|
-
profitAmount?: string;
|
|
86
|
-
buyCount?: number;
|
|
87
|
-
sellCount?: number;
|
|
88
|
-
buyAmounts?: string[];
|
|
89
|
-
sellAmounts?: string[];
|
|
90
|
-
};
|
|
91
|
-
};
|
|
1
|
+
import { PancakeBundleBuyFirstSignParams, PancakeBuyFirstResult } from './bundle-buy-first-helpers.js';
|
|
92
2
|
export declare function pancakeBundleBuyFirstMerkle(params: PancakeBundleBuyFirstSignParams): Promise<PancakeBuyFirstResult>;
|