four-flap-meme-sdk 2.2.2 → 2.2.4
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/__tests__/subpath-exports.test.d.ts +1 -0
- package/dist/__tests__/subpath-exports.test.js +64 -0
- package/dist/abis/common.d.ts +85 -0
- package/dist/abis/common.js +264 -0
- package/dist/abis/contracts/TaxToken.json +969 -0
- package/dist/abis/contracts/TokenManager2.json +136 -0
- package/dist/abis/contracts/index.d.ts +5 -0
- package/dist/abis/contracts/index.js +5 -0
- package/dist/abis/flap/index.d.ts +3 -0
- package/dist/abis/flap/index.js +3 -0
- package/dist/abis/flap/portal-events.d.ts +6 -0
- package/dist/abis/flap/portal-events.js +17 -0
- package/dist/abis/flap/portal.d.ts +6 -0
- package/dist/abis/flap/portal.js +37 -0
- package/dist/abis/flap/vault.d.ts +171 -0
- package/dist/abis/flap/vault.js +91 -0
- package/dist/abis/index.d.ts +8 -0
- package/dist/abis/index.js +11 -0
- package/dist/bundle-core/__tests__/config-helpers.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/config-helpers.test.js +28 -0
- package/dist/bundle-core/__tests__/facade-parity.test.d.ts +1 -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 +35 -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 -113
- package/dist/chains/bsc/four/config.d.ts +5 -67
- package/dist/chains/bsc/four/config.js +2 -114
- package/dist/chains/bsc/four/core.d.ts +1 -4
- package/dist/chains/bsc/four/core.js +1 -592
- 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 -46
- package/dist/chains/bsc/four/internal.js +2 -239
- package/dist/chains/bsc/four/pancake-proxy.d.ts +1 -28
- package/dist/chains/bsc/four/pancake-proxy.js +1 -687
- 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 -752
- package/dist/chains/bsc/four/swap-buy-first.d.ts +2 -55
- package/dist/chains/bsc/four/swap-buy-first.js +2 -507
- 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 -766
- 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 -1552
- package/dist/chains/bsc/iro.d.ts +5 -0
- package/dist/chains/bsc/iro.js +4 -0
- 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 -212
- 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 +114 -726
- 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.d.ts +2 -2
- 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 +55 -25
- package/dist/chains/eni/batch-router/utils.js +32 -6
- package/dist/chains/eni/bundler/sign.js +5 -6
- package/dist/chains/eni/bundler/submit.js +1 -4
- package/dist/chains/eni/constants.js +1 -1
- package/dist/chains/eni/flat-aliases.d.ts +10 -0
- package/dist/chains/eni/flat-aliases.js +8 -0
- package/dist/chains/eni/index.d.ts +2 -1
- package/dist/chains/eni/index.js +1 -0
- 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 +9 -6
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +28 -44
- 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 -46
- 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.d.ts +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.d.ts +43 -0
- package/dist/chains/eni/submit.js +286 -0
- package/dist/chains/index.d.ts +13 -0
- package/dist/chains/index.js +13 -0
- package/dist/chains/xlayer/eip7702/bundle-approve.d.ts +2 -26
- package/dist/chains/xlayer/eip7702/bundle-approve.js +11 -21
- 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 -59
- package/dist/chains/xlayer/eip7702/bundle-sell.d.ts +2 -6
- package/dist/chains/xlayer/eip7702/bundle-sell.js +29 -111
- package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +3 -65
- package/dist/chains/xlayer/eip7702/bundle-swap.js +51 -245
- package/dist/chains/xlayer/eip7702/constants.d.ts +1 -16
- package/dist/chains/xlayer/eip7702/constants.js +3 -21
- package/dist/chains/xlayer/eip7702/flat-aliases.d.ts +13 -0
- package/dist/chains/xlayer/eip7702/flat-aliases.js +10 -0
- package/dist/chains/xlayer/eip7702/index.d.ts +28 -46
- package/dist/chains/xlayer/eip7702/index.js +28 -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 +63 -307
- 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 +89 -164
- 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 +66 -299
- package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +1 -1
- package/dist/chains/xlayer/eoa/eoa-wash-volume.js +18 -23
- 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.d.ts +2 -2
- package/dist/chains/xlayer/eoa/types.js +1 -3
- package/dist/chains/xlayer/index.d.ts +3 -2
- package/dist/chains/xlayer/index.js +4 -7
- package/dist/contracts/helper3.d.ts +20 -5
- 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 -113
- package/dist/contracts/tm-bundle-merkle/config.d.ts +5 -67
- package/dist/contracts/tm-bundle-merkle/config.js +2 -114
- package/dist/contracts/tm-bundle-merkle/core.d.ts +1 -4
- package/dist/contracts/tm-bundle-merkle/core.js +1 -591
- 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 -46
- package/dist/contracts/tm-bundle-merkle/internal.js +2 -238
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.d.ts +1 -28
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.js +1 -686
- 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 -928
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.d.ts +2 -55
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.js +2 -506
- 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 -764
- 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 +6 -18
- package/dist/contracts/tm-bundle-merkle/utils.js +6 -1501
- package/dist/contracts/tm-bundle.d.ts +3 -51
- package/dist/contracts/tm-bundle.js +108 -177
- package/dist/contracts/tm.d.ts +3 -2
- package/dist/contracts/tm.js +37 -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 -666
- 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/flap/index.d.ts +10 -0
- package/dist/flap/index.js +8 -0
- package/dist/flows/create.d.ts +2 -1
- 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 -85
- package/dist/index.js +20 -215
- package/dist/merkle/index.d.ts +12 -0
- package/dist/merkle/index.js +11 -0
- 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 +39 -25
- package/dist/shared/clients/club48.d.ts +2 -2
- package/dist/shared/clients/club48.js +34 -29
- package/dist/shared/clients/emitservice.js +2 -0
- package/dist/shared/clients/four.d.ts +21 -6
- package/dist/shared/clients/four.js +29 -24
- package/dist/shared/clients/index.d.ts +8 -0
- package/dist/shared/clients/index.js +8 -0
- package/dist/shared/clients/merkle.js +27 -34
- 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 +3 -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/abi.js +1 -1
- package/dist/shared/flap/constants.d.ts +1 -2
- package/dist/shared/flap/constants.js +2 -3
- package/dist/shared/flap/curve.js +3 -0
- package/dist/shared/flap/errors.d.ts +1 -4
- package/dist/shared/flap/errors.js +20 -1
- package/dist/shared/flap/index.d.ts +5 -4
- package/dist/shared/flap/index.js +5 -4
- package/dist/shared/flap/meta.d.ts +22 -18
- package/dist/shared/flap/meta.js +12 -17
- package/dist/shared/flap/permit.js +5 -2
- package/dist/shared/flap/pinata.d.ts +22 -6
- package/dist/shared/flap/pinata.js +21 -26
- 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 +96 -277
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.d.ts +7 -2
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +107 -206
- 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 +88 -9
- 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 +55 -56
- package/dist/shared/flap/portal-create-token.d.ts +80 -0
- package/dist/shared/flap/portal-create-token.js +257 -0
- package/dist/shared/flap/portal.d.ts +14 -3
- package/dist/shared/flap/portal.js +50 -25
- package/dist/shared/flap/vanity.d.ts +1 -5
- package/dist/shared/flap/vanity.js +6 -17
- package/dist/shared/flap/vault.d.ts +17 -124
- package/dist/shared/flap/vault.js +67 -148
- 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 +49 -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 +183 -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 +6 -0
- package/dist/shared/index.js +4 -0
- package/dist/types/errors.d.ts +27 -0
- package/dist/types/errors.js +34 -0
- package/dist/utils/airdrop-sweep.d.ts +4 -76
- package/dist/utils/airdrop-sweep.js +42 -55
- 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.d.ts +7 -89
- package/dist/utils/erc20.js +94 -125
- package/dist/utils/errors.d.ts +12 -1
- package/dist/utils/errors.js +60 -1
- 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.d.ts +2 -138
- package/dist/utils/holders-maker.js +26 -661
- 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.d.ts +2 -112
- package/dist/utils/lp-inspect.js +73 -223
- package/dist/utils/mpcExclusive.d.ts +2 -5
- package/dist/utils/mpcExclusive.js +4 -3
- package/dist/utils/private-sale.d.ts +2 -58
- package/dist/utils/private-sale.js +4 -15
- package/dist/utils/provider-factory.d.ts +4 -0
- package/dist/utils/provider-factory.js +10 -0
- package/dist/utils/quote-helpers.d.ts +4 -45
- package/dist/utils/quote-helpers.js +17 -74
- package/dist/utils/stealth-transfer.d.ts +2 -28
- package/dist/utils/stealth-transfer.js +31 -15
- package/dist/utils/swap-helpers.d.ts +2 -15
- package/dist/utils/swap-helpers.js +6 -11
- 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 +13 -10
- package/dist/vanity/index.d.ts +5 -0
- package/dist/vanity/index.js +5 -0
- package/package.json +160 -4
- 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/abis/TaxToken.json +0 -105
- package/dist/shared/abis/TokenManager2.json +0 -60
- /package/dist/{shared/abis → abis/contracts}/TokenManager.json +0 -0
- /package/dist/{shared/abis → abis/contracts}/TokenManagerHelper3.json +0 -0
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* 支持两种模式:
|
|
5
|
-
* 1. 无币模式 (Wash): 单钱包买入+卖出,不需要预先持有代币
|
|
6
|
-
* 2. 捆绑模式 (Bundle): 多钱包批量买入 + 批量卖出
|
|
7
|
-
*
|
|
8
|
-
* 支持池子类型:
|
|
9
|
-
* - FLAP: 内盘 (Flap Portal)
|
|
10
|
-
* - V2: PotatoSwap V2 外盘
|
|
11
|
-
* - V3: PotatoSwap V3 外盘
|
|
12
|
-
*
|
|
13
|
-
* 只生成签名,由调用方决定如何提交
|
|
2
|
+
* volume - 主函数
|
|
14
3
|
*/
|
|
15
4
|
import { ethers, Contract } from 'ethers';
|
|
16
5
|
import { getCachedProvider, createWallet, signAuthorizationsWithNonces, batchGetNonces, buildEIP7702TransactionSync, calculateProfitAmountByTxCount, getProfitRecipient, } from './utils.js';
|
|
@@ -18,40 +7,8 @@ import { UNIFIED_DELEGATE_ADDRESS, UNIFIED_DELEGATE_ABI, FLAP_PORTAL_ABI, FLAP_P
|
|
|
18
7
|
import { bundleBuy } from './bundle-buy.js';
|
|
19
8
|
import { bundleSell } from './bundle-sell.js';
|
|
20
9
|
import { bundleSwap } from './bundle-swap.js';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* @param value 数值字符串
|
|
24
|
-
* @param decimals 保留的小数位数(默认 18)
|
|
25
|
-
*/
|
|
26
|
-
function truncateDecimals(value, decimals = 18) {
|
|
27
|
-
if (!value || value === '0')
|
|
28
|
-
return value;
|
|
29
|
-
const parts = String(value).split('.');
|
|
30
|
-
if (parts.length === 1)
|
|
31
|
-
return value;
|
|
32
|
-
const intPart = parts[0] || '0';
|
|
33
|
-
const decPart = (parts[1] || '').slice(0, decimals);
|
|
34
|
-
return decPart ? `${intPart}.${decPart}` : intPart;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* 无币刷量 - 每个钱包执行买入+卖出
|
|
38
|
-
*
|
|
39
|
-
* 核心逻辑:[利润刮取] + [钱包1买入] + [钱包1卖出] + [钱包2买入] + [钱包2卖出] + ...
|
|
40
|
-
*
|
|
41
|
-
* 特点:
|
|
42
|
-
* - 钱包不需要预先持有代币
|
|
43
|
-
* - 每个钱包在同一笔交易中完成买入和卖出
|
|
44
|
-
* - 利润从主钱包统一支付
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* const result = await washVolume({
|
|
48
|
-
* privateKeys: ['0x...', '0x...'],
|
|
49
|
-
* tokenAddress: '0x...',
|
|
50
|
-
* buyAmountPerWallet: '0.01',
|
|
51
|
-
* sellPercent: 100,
|
|
52
|
-
* poolType: 'V3',
|
|
53
|
-
* });
|
|
54
|
-
*/
|
|
10
|
+
import { quoteV2, quoteV3 } from '../../../utils/quote-helpers.js';
|
|
11
|
+
import { truncateDecimals, } from './volume-helpers.js';
|
|
55
12
|
export async function washVolume(params) {
|
|
56
13
|
const { mainPrivateKey, privateKeys, tokenAddress, tokenDecimals = 18, buyAmountPerWallet, sellPercent = 100, poolType = 'V3', routerAddress, fee = V3_FEE_TIERS.MEDIUM, userType = 'v0', // ✅ 用户类型(影响利润率)
|
|
57
14
|
config, } = params;
|
|
@@ -69,14 +26,10 @@ export async function washVolume(params) {
|
|
|
69
26
|
if (!isValidPrivateKey(mainPrivateKey)) {
|
|
70
27
|
throw new Error('mainPrivateKey 格式无效');
|
|
71
28
|
}
|
|
72
|
-
const validPrivateKeys = privateKeys.filter(pk => isValidPrivateKey(pk));
|
|
29
|
+
const validPrivateKeys = privateKeys.filter((pk) => isValidPrivateKey(pk));
|
|
73
30
|
if (validPrivateKeys.length === 0) {
|
|
74
31
|
throw new Error('没有有效的私钥(私钥必须是 0x 开头的 66 位或 64 位十六进制字符串)');
|
|
75
32
|
}
|
|
76
|
-
if (validPrivateKeys.length !== privateKeys.length) {
|
|
77
|
-
console.warn(`[washVolume] 跳过 ${privateKeys.length - validPrivateKeys.length} 个无效私钥`);
|
|
78
|
-
}
|
|
79
|
-
// 使用验证后的私钥
|
|
80
33
|
const actualPrivateKeys = validPrivateKeys;
|
|
81
34
|
const provider = getCachedProvider(config?.rpcUrl);
|
|
82
35
|
// ✅ 空字符串也使用默认值
|
|
@@ -88,7 +41,7 @@ export async function washVolume(params) {
|
|
|
88
41
|
// ✅ 创建 Payer 钱包(支付 Gas 费)
|
|
89
42
|
const mainWallet = createWallet(mainPrivateKey, provider);
|
|
90
43
|
// 创建交易钱包(使用验证后的私钥)
|
|
91
|
-
const wallets = actualPrivateKeys.map(pk => createWallet(pk, provider));
|
|
44
|
+
const wallets = actualPrivateKeys.map((pk) => createWallet(pk, provider));
|
|
92
45
|
// 计算金额(无币刷量:每个钱包 1买 + 1卖 = 2笔交易)
|
|
93
46
|
const buyAmountWei = ethers.parseEther(truncateDecimals(buyAmountPerWallet));
|
|
94
47
|
const totalBuyAmount = buyAmountWei * BigInt(wallets.length);
|
|
@@ -101,21 +54,20 @@ export async function washVolume(params) {
|
|
|
101
54
|
// ========================================
|
|
102
55
|
const allWalletsMap = new Map();
|
|
103
56
|
allWalletsMap.set(mainWallet.address.toLowerCase(), mainWallet);
|
|
104
|
-
wallets.forEach(w => allWalletsMap.set(w.address.toLowerCase(), w));
|
|
57
|
+
wallets.forEach((w) => allWalletsMap.set(w.address.toLowerCase(), w));
|
|
105
58
|
const allWallets = Array.from(allWalletsMap.values());
|
|
106
59
|
// 找出 mainWallet 在 allWallets 中的索引
|
|
107
|
-
const mainWalletIndex = allWallets.findIndex(w => w.address.toLowerCase() === mainWallet.address.toLowerCase());
|
|
60
|
+
const mainWalletIndex = allWallets.findIndex((w) => w.address.toLowerCase() === mainWallet.address.toLowerCase());
|
|
108
61
|
// ========================================
|
|
109
62
|
// 并行获取数据
|
|
110
63
|
// ========================================
|
|
111
|
-
const allAddresses = allWallets.map(w => w.address);
|
|
64
|
+
const allAddresses = allWallets.map((w) => w.address);
|
|
112
65
|
// ✅ 对所有模式,使用【总金额报价 + 按比例分配】
|
|
113
66
|
// 因为所有钱包在同一笔交易中执行,会累积影响价格
|
|
114
67
|
// 这确保了「买多少就卖多少」,避免清空钱包预存代币
|
|
115
68
|
let estimatedTokenAmounts = [];
|
|
116
69
|
const totalBuyWei = buyAmountWei * BigInt(wallets.length);
|
|
117
70
|
if (poolType === 'FLAP') {
|
|
118
|
-
console.log(`[washVolume] FLAP 总金额报价: ${wallets.length} 个钱包, 每个 ${buyAmountWei} wei, 总计 ${totalBuyWei} wei`);
|
|
119
71
|
try {
|
|
120
72
|
const portalContract = new Contract(FLAP_PORTAL_ADDRESS, FLAP_PORTAL_ABI, provider);
|
|
121
73
|
// ✅ 使用 previewBuy(与 AA 模式一致),降级到 quoteExactInput
|
|
@@ -123,21 +75,16 @@ export async function washVolume(params) {
|
|
|
123
75
|
let totalTokenAmount = 0n;
|
|
124
76
|
try {
|
|
125
77
|
totalTokenAmount = await portalContract.previewBuy(tokenAddress, totalBuyWei);
|
|
126
|
-
console.log(`[washVolume] FLAP previewBuy 总预估: ${totalBuyWei} wei OKB -> ${totalTokenAmount} wei 代币`);
|
|
127
78
|
}
|
|
128
|
-
catch
|
|
129
|
-
console.warn(`[washVolume] previewBuy 失败,尝试 quoteExactInput:`, previewErr);
|
|
79
|
+
catch {
|
|
130
80
|
try {
|
|
131
|
-
// ✅ 降级到 quoteExactInput(与 AA 模式相同的降级策略)
|
|
132
81
|
totalTokenAmount = await portalContract.quoteExactInput.staticCall({
|
|
133
82
|
inputToken: ethers.ZeroAddress, // OKB
|
|
134
83
|
outputToken: tokenAddress, // Token
|
|
135
84
|
inputAmount: totalBuyWei,
|
|
136
85
|
});
|
|
137
|
-
console.log(`[washVolume] FLAP quoteExactInput 总预估: ${totalBuyWei} wei OKB -> ${totalTokenAmount} wei 代币`);
|
|
138
86
|
}
|
|
139
|
-
catch
|
|
140
|
-
console.warn(`[washVolume] quoteExactInput 也失败:`, quoteErr);
|
|
87
|
+
catch {
|
|
141
88
|
totalTokenAmount = 0n;
|
|
142
89
|
}
|
|
143
90
|
}
|
|
@@ -154,27 +101,22 @@ export async function washVolume(params) {
|
|
|
154
101
|
return sharePerWallet;
|
|
155
102
|
});
|
|
156
103
|
}
|
|
157
|
-
console.log(`[washVolume] FLAP 代币分配:`, estimatedTokenAmounts.map(a => a.toString()));
|
|
158
104
|
}
|
|
159
|
-
catch
|
|
160
|
-
|
|
105
|
+
catch {
|
|
106
|
+
// FLAP quote failed
|
|
161
107
|
}
|
|
162
108
|
}
|
|
163
109
|
else if (poolType === 'V2' || poolType === 'V3') {
|
|
164
110
|
// ✅ V2/V3 外盘模式:通过报价获取预估代币数量,确保买卖对等
|
|
165
|
-
console.log(`[washVolume] ${poolType} 总金额报价: ${wallets.length} 个钱包, 每个 ${buyAmountWei} wei, 总计 ${totalBuyWei} wei`);
|
|
166
111
|
try {
|
|
167
|
-
const { quoteV2, quoteV3 } = await import('../../../utils/quote-helpers.js');
|
|
168
112
|
let totalTokenAmount = 0n;
|
|
169
113
|
if (poolType === 'V3') {
|
|
170
114
|
const result = await quoteV3(provider, WOKB_ADDRESS, tokenAddress, totalBuyWei, 'XLAYER', fee);
|
|
171
115
|
totalTokenAmount = result.amountOut;
|
|
172
|
-
console.log(`[washVolume] V3 报价成功: ${totalBuyWei} wei OKB -> ${totalTokenAmount} wei 代币 (fee: ${fee})`);
|
|
173
116
|
}
|
|
174
117
|
else {
|
|
175
118
|
const result = await quoteV2(provider, WOKB_ADDRESS, tokenAddress, totalBuyWei, 'XLAYER');
|
|
176
119
|
totalTokenAmount = result.amountOut;
|
|
177
|
-
console.log(`[washVolume] V2 报价成功: ${totalBuyWei} wei OKB -> ${totalTokenAmount} wei 代币`);
|
|
178
120
|
}
|
|
179
121
|
// 均分到每个钱包
|
|
180
122
|
if (totalBuyWei > 0n && totalTokenAmount > 0n) {
|
|
@@ -187,22 +129,17 @@ export async function washVolume(params) {
|
|
|
187
129
|
allocated += sharePerWallet;
|
|
188
130
|
return sharePerWallet;
|
|
189
131
|
});
|
|
190
|
-
console.log(`[washVolume] ${poolType} 代币分配:`, estimatedTokenAmounts.map(a => a.toString()));
|
|
191
132
|
}
|
|
192
133
|
}
|
|
193
|
-
catch
|
|
194
|
-
|
|
134
|
+
catch {
|
|
135
|
+
// V2/V3 quote failed
|
|
195
136
|
}
|
|
196
137
|
}
|
|
197
|
-
const [nonces, feeData] = await Promise.all([
|
|
198
|
-
batchGetNonces(allAddresses, provider),
|
|
199
|
-
provider.getFeeData(),
|
|
200
|
-
]);
|
|
138
|
+
const [nonces, feeData] = await Promise.all([batchGetNonces(allAddresses, provider), provider.getFeeData()]);
|
|
201
139
|
// ========================================
|
|
202
140
|
// 同步签署授权
|
|
203
141
|
// ========================================
|
|
204
|
-
const authorizations = signAuthorizationsWithNonces(allWallets, nonces, delegateAddress, mainWalletIndex
|
|
205
|
-
);
|
|
142
|
+
const authorizations = signAuthorizationsWithNonces(allWallets, nonces, delegateAddress, mainWalletIndex);
|
|
206
143
|
// ========================================
|
|
207
144
|
// 构建调用
|
|
208
145
|
// ========================================
|
|
@@ -251,25 +188,13 @@ export async function washVolume(params) {
|
|
|
251
188
|
},
|
|
252
189
|
};
|
|
253
190
|
}
|
|
191
|
+
// ========================================
|
|
192
|
+
// 捆绑刷量 (Bundle Mode)
|
|
193
|
+
// ========================================
|
|
254
194
|
/**
|
|
255
195
|
* 捆绑刷量 - 多钱包批量买入 + 批量卖出
|
|
256
196
|
*
|
|
257
197
|
* 核心逻辑:[利润刮取] + [买入Ops...] + [卖出Ops...]
|
|
258
|
-
*
|
|
259
|
-
* 特点:
|
|
260
|
-
* - 买入和卖出可以使用不同的钱包
|
|
261
|
-
* - 所有操作在一笔交易中原子执行
|
|
262
|
-
* - 卖出钱包需要预先持有代币
|
|
263
|
-
*
|
|
264
|
-
* @example
|
|
265
|
-
* const result = await bundleVolume({
|
|
266
|
-
* buyerPrivateKeys: ['0x...', '0x...'],
|
|
267
|
-
* buyAmounts: ['0.01', '0.02'],
|
|
268
|
-
* sellerPrivateKeys: ['0x...'],
|
|
269
|
-
* sellPercent: 100,
|
|
270
|
-
* tokenAddress: '0x...',
|
|
271
|
-
* poolType: 'FLAP',
|
|
272
|
-
* });
|
|
273
198
|
*/
|
|
274
199
|
export async function bundleVolume(params) {
|
|
275
200
|
const { mainPrivateKey, buyerPrivateKeys, buyAmounts, sellerPrivateKeys, sellAmounts, sellPercent = 100, tokenAddress, tokenDecimals = 18, poolType = 'V3', routerAddress, fee = V3_FEE_TIERS.MEDIUM, userType = 'v0', // ✅ 用户类型(影响利润率)
|
|
@@ -297,13 +222,10 @@ export async function bundleVolume(params) {
|
|
|
297
222
|
throw new Error('没有有效的买家私钥');
|
|
298
223
|
}
|
|
299
224
|
// ✅ 验证卖家私钥
|
|
300
|
-
const validSellerPrivateKeys = sellerPrivateKeys.filter(pk => isValidPrivateKey(pk));
|
|
225
|
+
const validSellerPrivateKeys = sellerPrivateKeys.filter((pk) => isValidPrivateKey(pk));
|
|
301
226
|
if (validSellerPrivateKeys.length === 0) {
|
|
302
227
|
throw new Error('没有有效的卖家私钥');
|
|
303
228
|
}
|
|
304
|
-
if (validBuyerPrivateKeys.length !== buyerPrivateKeys.length || validSellerPrivateKeys.length !== sellerPrivateKeys.length) {
|
|
305
|
-
console.warn(`[bundleVolume] 跳过无效私钥: 买家 ${buyerPrivateKeys.length - validBuyerPrivateKeys.length} 个, 卖家 ${sellerPrivateKeys.length - validSellerPrivateKeys.length} 个`);
|
|
306
|
-
}
|
|
307
229
|
const provider = getCachedProvider(config?.rpcUrl);
|
|
308
230
|
// ✅ 空字符串也使用默认值
|
|
309
231
|
const delegateAddress = (config?.delegateAddress && config.delegateAddress.trim()) || UNIFIED_DELEGATE_ADDRESS;
|
|
@@ -313,18 +235,18 @@ export async function bundleVolume(params) {
|
|
|
313
235
|
// ✅ 创建 Payer 钱包(支付 Gas 费)
|
|
314
236
|
const mainWallet = createWallet(mainPrivateKey, provider);
|
|
315
237
|
// 创建钱包(使用验证后的私钥)
|
|
316
|
-
const buyerWallets = validBuyerPrivateKeys.map(pk => createWallet(pk, provider));
|
|
317
|
-
const sellerWallets = validSellerPrivateKeys.map(pk => createWallet(pk, provider));
|
|
238
|
+
const buyerWallets = validBuyerPrivateKeys.map((pk) => createWallet(pk, provider));
|
|
239
|
+
const sellerWallets = validSellerPrivateKeys.map((pk) => createWallet(pk, provider));
|
|
318
240
|
// 合并所有钱包(去重,包括 mainWallet)
|
|
319
241
|
const allWalletsMap = new Map();
|
|
320
242
|
allWalletsMap.set(mainWallet.address.toLowerCase(), mainWallet);
|
|
321
|
-
buyerWallets.forEach(w => allWalletsMap.set(w.address.toLowerCase(), w));
|
|
322
|
-
sellerWallets.forEach(w => allWalletsMap.set(w.address.toLowerCase(), w));
|
|
243
|
+
buyerWallets.forEach((w) => allWalletsMap.set(w.address.toLowerCase(), w));
|
|
244
|
+
sellerWallets.forEach((w) => allWalletsMap.set(w.address.toLowerCase(), w));
|
|
323
245
|
const allWallets = Array.from(allWalletsMap.values());
|
|
324
246
|
// 找出 mainWallet 在 allWallets 中的索引
|
|
325
|
-
const mainWalletIndex = allWallets.findIndex(w => w.address.toLowerCase() === mainWallet.address.toLowerCase());
|
|
247
|
+
const mainWalletIndex = allWallets.findIndex((w) => w.address.toLowerCase() === mainWallet.address.toLowerCase());
|
|
326
248
|
// 计算买入金额(使用验证后的金额数组)
|
|
327
|
-
const buyAmountsWei = validBuyAmounts.map(amt => ethers.parseEther(truncateDecimals(amt)));
|
|
249
|
+
const buyAmountsWei = validBuyAmounts.map((amt) => ethers.parseEther(truncateDecimals(amt)));
|
|
328
250
|
const totalBuyAmount = buyAmountsWei.reduce((sum, amt) => sum + amt, 0n);
|
|
329
251
|
// ✅ 计算利润(捆绑刷量:买家数 + 卖家数 = 总交易数)
|
|
330
252
|
const totalTxCount = buyerWallets.length + sellerWallets.length;
|
|
@@ -333,30 +255,24 @@ export async function bundleVolume(params) {
|
|
|
333
255
|
// ========================================
|
|
334
256
|
// 并行获取数据
|
|
335
257
|
// ========================================
|
|
336
|
-
const allAddresses = allWallets.map(w => w.address);
|
|
258
|
+
const allAddresses = allWallets.map((w) => w.address);
|
|
337
259
|
// 获取卖出钱包的代币余额(如果需要)
|
|
338
260
|
const needBalanceQuery = !sellAmounts || sellAmounts.length !== sellerWallets.length;
|
|
339
|
-
const
|
|
261
|
+
const tokenContract = needBalanceQuery && sellerWallets.length > 0 ? new ethers.Contract(tokenAddress, ERC20_ABI, provider) : null;
|
|
262
|
+
const [nonces, feeData, sellerBalancesRaw] = await Promise.all([
|
|
340
263
|
batchGetNonces(allAddresses, provider),
|
|
341
264
|
provider.getFeeData(),
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
const results = await Promise.all(parallelPromises);
|
|
348
|
-
const nonces = results[0];
|
|
349
|
-
const feeData = results[1];
|
|
265
|
+
needBalanceQuery && sellerWallets.length > 0 && tokenContract
|
|
266
|
+
? Promise.all(sellerWallets.map((w) => tokenContract.balanceOf(w.address)))
|
|
267
|
+
: Promise.resolve(null),
|
|
268
|
+
]);
|
|
350
269
|
// 计算卖出金额
|
|
351
270
|
let sellAmountsWei;
|
|
352
271
|
if (sellAmounts && sellAmounts.length === sellerWallets.length) {
|
|
353
272
|
// ✅ 如果有指定卖出金额,直接使用
|
|
354
|
-
sellAmountsWei = sellAmounts.map(amt => ethers.parseUnits(truncateDecimals(amt, tokenDecimals), tokenDecimals));
|
|
273
|
+
sellAmountsWei = sellAmounts.map((amt) => ethers.parseUnits(truncateDecimals(amt, tokenDecimals), tokenDecimals));
|
|
355
274
|
}
|
|
356
|
-
else if (needBalanceQuery &&
|
|
357
|
-
// ✅ 没有指定卖出金额,需要根据买入金额预估应卖出的代币数量
|
|
358
|
-
const balances = results[2].map(b => typeof b === 'bigint' ? b : BigInt(b.toString()));
|
|
359
|
-
const totalSellerBalance = balances.reduce((sum, b) => sum + b, 0n);
|
|
275
|
+
else if (needBalanceQuery && sellerBalancesRaw) {
|
|
360
276
|
// ✅ 根据 poolType 预估买入能获得的代币数量
|
|
361
277
|
let estimatedTokenAmount = 0n;
|
|
362
278
|
try {
|
|
@@ -365,36 +281,28 @@ export async function bundleVolume(params) {
|
|
|
365
281
|
const portalContract = new ethers.Contract(FLAP_PORTAL_ADDRESS, FLAP_PORTAL_ABI, provider);
|
|
366
282
|
try {
|
|
367
283
|
estimatedTokenAmount = await portalContract.previewBuy(tokenAddress, totalBuyAmount);
|
|
368
|
-
console.log(`[bundleVolume] FLAP previewBuy: ${totalBuyAmount} wei OKB -> ${estimatedTokenAmount} wei 代币`);
|
|
369
284
|
}
|
|
370
|
-
catch
|
|
371
|
-
console.warn(`[bundleVolume] previewBuy 失败,尝试 quoteBuy:`, previewErr);
|
|
285
|
+
catch {
|
|
372
286
|
try {
|
|
373
287
|
estimatedTokenAmount = await portalContract.quoteBuy(tokenAddress, totalBuyAmount);
|
|
374
|
-
console.log(`[bundleVolume] FLAP quoteBuy: ${totalBuyAmount} wei OKB -> ${estimatedTokenAmount} wei 代币`);
|
|
375
288
|
}
|
|
376
|
-
catch
|
|
377
|
-
console.warn(`[bundleVolume] quoteBuy 失败,尝试 quoteExactInput:`, quoteBuyErr);
|
|
289
|
+
catch {
|
|
378
290
|
try {
|
|
379
291
|
estimatedTokenAmount = await portalContract.quoteExactInput.staticCall({
|
|
380
292
|
inputToken: ethers.ZeroAddress,
|
|
381
293
|
outputToken: tokenAddress,
|
|
382
294
|
inputAmount: totalBuyAmount,
|
|
383
295
|
});
|
|
384
|
-
console.log(`[bundleVolume] FLAP quoteExactInput: ${totalBuyAmount} wei OKB -> ${estimatedTokenAmount} wei 代币`);
|
|
385
296
|
}
|
|
386
|
-
catch
|
|
387
|
-
console.warn(`[bundleVolume] quoteExactInput 也失败,尝试 V2 路由作为终极兜底:`, quoteErr);
|
|
297
|
+
catch {
|
|
388
298
|
try {
|
|
389
|
-
// 终极兜底:当内盘接口全部失效时,尝试使用 V2 代码进行报价
|
|
390
299
|
const v2Router = new ethers.Contract(POTATOSWAP_V2_ROUTER, V2_ROUTER_ABI, provider);
|
|
391
300
|
const path = [WOKB_ADDRESS, tokenAddress];
|
|
392
301
|
const amounts = await v2Router.getAmountsOut(totalBuyAmount, path);
|
|
393
302
|
estimatedTokenAmount = amounts[amounts.length - 1];
|
|
394
|
-
console.log(`[bundleVolume] FLAP 终极回退 V2 quote: ${totalBuyAmount} wei OKB -> ${estimatedTokenAmount} wei 代币`);
|
|
395
303
|
}
|
|
396
|
-
catch
|
|
397
|
-
|
|
304
|
+
catch {
|
|
305
|
+
// all quote paths failed
|
|
398
306
|
}
|
|
399
307
|
}
|
|
400
308
|
}
|
|
@@ -412,7 +320,7 @@ export async function bundleVolume(params) {
|
|
|
412
320
|
else {
|
|
413
321
|
// V3: 使用 V3 Quoter
|
|
414
322
|
const v3Quoter = new ethers.Contract('0x27d52F6D9Ed2eBb3E6a4c0Af6b1f5dc85A4d5b2C', [
|
|
415
|
-
'function quoteExactInputSingle((address tokenIn, address tokenOut, uint256 amountIn, uint24 fee, uint160 sqrtPriceLimitX96)) external returns (uint256 amountOut)'
|
|
323
|
+
'function quoteExactInputSingle((address tokenIn, address tokenOut, uint256 amountIn, uint24 fee, uint160 sqrtPriceLimitX96)) external returns (uint256 amountOut)',
|
|
416
324
|
], provider);
|
|
417
325
|
estimatedTokenAmount = await v3Quoter.quoteExactInputSingle.staticCall({
|
|
418
326
|
tokenIn: WOKB_ADDRESS,
|
|
@@ -422,15 +330,14 @@ export async function bundleVolume(params) {
|
|
|
422
330
|
sqrtPriceLimitX96: 0n,
|
|
423
331
|
});
|
|
424
332
|
}
|
|
425
|
-
console.log(`[bundleVolume] ${poolType} quote: ${totalBuyAmount} wei OKB -> ${estimatedTokenAmount} wei 代币`);
|
|
426
333
|
}
|
|
427
|
-
catch
|
|
428
|
-
|
|
334
|
+
catch {
|
|
335
|
+
// pool quote failed
|
|
429
336
|
}
|
|
430
337
|
}
|
|
431
338
|
}
|
|
432
|
-
catch
|
|
433
|
-
|
|
339
|
+
catch {
|
|
340
|
+
// quote estimate failed
|
|
434
341
|
}
|
|
435
342
|
// ✅ 修正卖出数量计算逻辑:卖出数额仅基于本次交易买入的代币预估值,忽略原有余额
|
|
436
343
|
const percentBigInt = BigInt(Math.min(100, Math.max(0, sellPercent)));
|
|
@@ -460,11 +367,9 @@ export async function bundleVolume(params) {
|
|
|
460
367
|
}
|
|
461
368
|
});
|
|
462
369
|
}
|
|
463
|
-
console.log(`[bundleVolume] 每个卖家随机分配的卖出量:`, walletSellAmounts.map(a => a.toString()));
|
|
464
370
|
}
|
|
465
371
|
// ✅ 修复:不再重复应用 sellPercent,因为 totalToSell 已经按 sellPercent 计算过了
|
|
466
372
|
sellAmountsWei = walletSellAmounts;
|
|
467
|
-
console.log(`[bundleVolume] 最终卖出数量 (sellPercent=${sellPercent}%):`, sellAmountsWei.map(a => a.toString()));
|
|
468
373
|
}
|
|
469
374
|
else {
|
|
470
375
|
// ✅ 即使没有余额查询结果,也初始化数组
|
|
@@ -525,11 +430,10 @@ export async function bundleVolume(params) {
|
|
|
525
430
|
},
|
|
526
431
|
};
|
|
527
432
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
*/
|
|
433
|
+
// ========================================
|
|
434
|
+
// 单轮刷量(买入+卖出分开签名)
|
|
435
|
+
// ========================================
|
|
436
|
+
/** 生成单轮刷量签名(买入 + 卖出分开,两笔独立交易) */
|
|
533
437
|
export async function singleRoundVolume(params) {
|
|
534
438
|
const { privateKeys, tokenAddress, tokenDecimals = 18, buyAmountPerWallet, sellPercent = 100, tradeType = 'V3', routerAddress, fee = V3_FEE_TIERS.MEDIUM, config, } = params;
|
|
535
439
|
const mainPrivateKey = privateKeys[0];
|
|
@@ -567,12 +471,10 @@ export async function singleRoundVolume(params) {
|
|
|
567
471
|
},
|
|
568
472
|
};
|
|
569
473
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
* 后续轮次需要在前一轮交易确认后才能生成
|
|
575
|
-
*/
|
|
474
|
+
// ========================================
|
|
475
|
+
// 多轮刷量
|
|
476
|
+
// ========================================
|
|
477
|
+
/** 生成多轮刷量签名(由于 nonce 限制,仅预生成第一轮) */
|
|
576
478
|
export async function makeVolume(params) {
|
|
577
479
|
const { privateKeys, tokenAddress, tokenDecimals = 18, buyAmountPerRound, rounds, tradeType = 'V3', routerAddress, fee = V3_FEE_TIERS.MEDIUM, onProgress, config, } = params;
|
|
578
480
|
const buyAmountPerWallet = (parseFloat(buyAmountPerRound) / privateKeys.length).toString();
|
|
@@ -603,9 +505,10 @@ export async function makeVolume(params) {
|
|
|
603
505
|
},
|
|
604
506
|
};
|
|
605
507
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
508
|
+
// ========================================
|
|
509
|
+
// 换手刷量
|
|
510
|
+
// ========================================
|
|
511
|
+
/** 生成换手刷量签名 */
|
|
609
512
|
export async function makeVolumeWithSwap(params) {
|
|
610
513
|
const { sellerPrivateKey, buyerPrivateKey, tokenAddress, tokenDecimals = 18, sellAmount, hopCount = 2, tradeType = 'V3', routerAddress, fee = V3_FEE_TIERS.MEDIUM, config, } = params;
|
|
611
514
|
const result = await bundleSwap({
|
|
@@ -648,13 +551,15 @@ function buildBuyCall(wallet, amount, tokenAddress, poolType, routerAddress, fee
|
|
|
648
551
|
case 'FLAP': {
|
|
649
552
|
// ✅ 修复:使用 swapExactInput 代替 buy 函数,明确指定 inputAmount
|
|
650
553
|
// buy(token) 依赖 msg.value,当 value=0n 时会失败
|
|
651
|
-
const portalCallData = portalInterface.encodeFunctionData('swapExactInput', [
|
|
554
|
+
const portalCallData = portalInterface.encodeFunctionData('swapExactInput', [
|
|
555
|
+
{
|
|
652
556
|
inputToken: ethers.ZeroAddress, // 0x0 = OKB (原生代币)
|
|
653
557
|
outputToken: tokenAddress,
|
|
654
558
|
inputAmount: amount,
|
|
655
559
|
minOutputAmount: 0n,
|
|
656
560
|
permitData: '0x',
|
|
657
|
-
}
|
|
561
|
+
},
|
|
562
|
+
]);
|
|
658
563
|
const batchCalls = [{ target: FLAP_PORTAL_ADDRESS, value: amount, data: portalCallData }];
|
|
659
564
|
return {
|
|
660
565
|
target: wallet.address,
|
|
@@ -680,7 +585,11 @@ function buildBuyCall(wallet, amount, tokenAddress, poolType, routerAddress, fee
|
|
|
680
585
|
allowFailure: false,
|
|
681
586
|
value: 0n,
|
|
682
587
|
callData: delegateInterface.encodeFunctionData('executeBuy', [
|
|
683
|
-
routerAddress,
|
|
588
|
+
routerAddress,
|
|
589
|
+
WOKB_ADDRESS,
|
|
590
|
+
tokenAddress,
|
|
591
|
+
fee,
|
|
592
|
+
amount,
|
|
684
593
|
]),
|
|
685
594
|
};
|
|
686
595
|
}
|
|
@@ -695,13 +604,15 @@ tokenAddress, sellPercent, tokenDecimals, poolType, routerAddress, fee, delegate
|
|
|
695
604
|
// ✅ 使用 swapExactInput 卖出(与 AA 模式保持一致)
|
|
696
605
|
// 注意:inputAmount=0 会失败,FLAP 需要先获取余额再调用
|
|
697
606
|
// 这里需要传入实际的代币余额,外层调用者应该提前查询
|
|
698
|
-
const portalCallData = portalInterface.encodeFunctionData('swapExactInput', [
|
|
607
|
+
const portalCallData = portalInterface.encodeFunctionData('swapExactInput', [
|
|
608
|
+
{
|
|
699
609
|
inputToken: tokenAddress,
|
|
700
610
|
outputToken: ethers.ZeroAddress, // 0x0 = OKB
|
|
701
611
|
inputAmount: 1n, // 占位符,如果调用 buildSellCall 时不指定 amount,通常意味逻辑上有问题
|
|
702
612
|
minOutputAmount: 0n,
|
|
703
613
|
permitData: '0x',
|
|
704
|
-
}
|
|
614
|
+
},
|
|
615
|
+
]);
|
|
705
616
|
const batchCalls = [{ target: FLAP_PORTAL_ADDRESS, value: 0n, data: portalCallData }];
|
|
706
617
|
return {
|
|
707
618
|
target: wallet.address,
|
|
@@ -717,7 +628,11 @@ tokenAddress, sellPercent, tokenDecimals, poolType, routerAddress, fee, delegate
|
|
|
717
628
|
target: wallet.address,
|
|
718
629
|
allowFailure: false,
|
|
719
630
|
value: 0n,
|
|
720
|
-
callData: delegateInterface.encodeFunctionData('executeSellV2', [
|
|
631
|
+
callData: delegateInterface.encodeFunctionData('executeSellV2', [
|
|
632
|
+
routerAddress,
|
|
633
|
+
path,
|
|
634
|
+
sellPercent === 100 ? 0 : amount,
|
|
635
|
+
]),
|
|
721
636
|
};
|
|
722
637
|
}
|
|
723
638
|
case 'V3': {
|
|
@@ -727,7 +642,11 @@ tokenAddress, sellPercent, tokenDecimals, poolType, routerAddress, fee, delegate
|
|
|
727
642
|
allowFailure: false,
|
|
728
643
|
value: 0n,
|
|
729
644
|
callData: delegateInterface.encodeFunctionData('executeSell', [
|
|
730
|
-
routerAddress,
|
|
645
|
+
routerAddress,
|
|
646
|
+
tokenAddress,
|
|
647
|
+
WOKB_ADDRESS,
|
|
648
|
+
fee,
|
|
649
|
+
sellPercent === 100 ? 0 : amount,
|
|
731
650
|
]),
|
|
732
651
|
};
|
|
733
652
|
}
|
|
@@ -737,13 +656,15 @@ function buildSellCallWithAmount(wallet, amount, tokenAddress, poolType, routerA
|
|
|
737
656
|
switch (poolType) {
|
|
738
657
|
case 'FLAP': {
|
|
739
658
|
// ✅ 使用 swapExactInput 卖出(与 AA 模式保持一致)
|
|
740
|
-
const portalCallData = portalInterface.encodeFunctionData('swapExactInput', [
|
|
659
|
+
const portalCallData = portalInterface.encodeFunctionData('swapExactInput', [
|
|
660
|
+
{
|
|
741
661
|
inputToken: tokenAddress,
|
|
742
662
|
outputToken: ethers.ZeroAddress, // 0x0 = OKB
|
|
743
663
|
inputAmount: amount,
|
|
744
664
|
minOutputAmount: 0n,
|
|
745
665
|
permitData: '0x',
|
|
746
|
-
}
|
|
666
|
+
},
|
|
667
|
+
]);
|
|
747
668
|
const batchCalls = [{ target: FLAP_PORTAL_ADDRESS, value: 0n, data: portalCallData }];
|
|
748
669
|
return {
|
|
749
670
|
target: wallet.address,
|
|
@@ -767,7 +688,11 @@ function buildSellCallWithAmount(wallet, amount, tokenAddress, poolType, routerA
|
|
|
767
688
|
allowFailure: false,
|
|
768
689
|
value: 0n,
|
|
769
690
|
callData: delegateInterface.encodeFunctionData('executeSell', [
|
|
770
|
-
routerAddress,
|
|
691
|
+
routerAddress,
|
|
692
|
+
tokenAddress,
|
|
693
|
+
WOKB_ADDRESS,
|
|
694
|
+
fee,
|
|
695
|
+
amount,
|
|
771
696
|
]),
|
|
772
697
|
};
|
|
773
698
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* ⚠️ 通用常量请使用 shared/constants,此文件仅包含 XLayer 特有的配置
|
|
8
8
|
*/
|
|
9
|
-
import { CHAINS, ADDRESSES, GAS_LIMITS, GAS_CONFIG, ZERO_ADDRESS as SHARED_ZERO_ADDRESS } from '../../../shared/constants/index.js';
|
|
9
|
+
import { CHAINS, ADDRESSES, GAS_LIMITS, GAS_CONFIG, ZERO_ADDRESS as SHARED_ZERO_ADDRESS, } from '../../../shared/constants/index.js';
|
|
10
10
|
// ============================================================================
|
|
11
11
|
// 从 shared/constants 重新导出(向后兼容)
|
|
12
12
|
// ============================================================================
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* XLayer AA DEX 工具函数
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { getProfitRecipient, getProfitRateBps } from '../../../shared/constants/index.js';
|
|
5
5
|
export function getDexDeadline(minutes = 20) {
|
|
6
6
|
return Math.floor(Date.now() / 1000) + minutes * 60;
|
|
7
7
|
}
|
|
@@ -14,9 +14,9 @@ export function calculateProfitWei(amountWei, profitBps) {
|
|
|
14
14
|
}
|
|
15
15
|
export function resolveProfitSettings(config) {
|
|
16
16
|
const extractProfit = config?.extractProfit !== false;
|
|
17
|
-
const profitBpsRaw = config?.profitBps ??
|
|
18
|
-
const profitBps = Math.max(0, Math.min(
|
|
19
|
-
const profitRecipient = config?.profitRecipient ??
|
|
17
|
+
const profitBpsRaw = config?.profitBps ?? getProfitRateBps('bundleSwap');
|
|
18
|
+
const profitBps = Math.max(0, Math.min(10_000, Number(profitBpsRaw)));
|
|
19
|
+
const profitRecipient = config?.profitRecipient ?? getProfitRecipient();
|
|
20
20
|
return { extractProfit, profitBps, profitRecipient };
|
|
21
21
|
}
|
|
22
22
|
function shuffle(arr) {
|
|
@@ -36,7 +36,7 @@ export function splitAmount(totalAmount, count) {
|
|
|
36
36
|
return new Array(count).fill(0n);
|
|
37
37
|
const weights = [];
|
|
38
38
|
for (let i = 0; i < count; i++) {
|
|
39
|
-
const w = BigInt(
|
|
39
|
+
const w = BigInt(500_000 + Math.floor(Math.random() * 1_000_000));
|
|
40
40
|
weights.push(w);
|
|
41
41
|
}
|
|
42
42
|
const totalWeight = weights.reduce((a, b) => a + b, 0n);
|