four-flap-meme-sdk 2.2.8 → 2.2.11
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 +6 -41
- package/README.md +0 -31
- package/README.zh-CN.md +6 -41
- package/dist/chains/bsc/four/approve-tokenmanager.d.ts +26 -1
- package/dist/chains/bsc/four/approve-tokenmanager.js +113 -1
- package/dist/chains/bsc/four/config.d.ts +67 -5
- package/dist/chains/bsc/four/config.js +114 -2
- package/dist/chains/bsc/four/core.d.ts +4 -1
- package/dist/chains/bsc/four/core.js +592 -1
- 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 +46 -2
- package/dist/chains/bsc/four/internal.js +239 -2
- package/dist/chains/bsc/four/pancake-proxy.d.ts +28 -1
- package/dist/chains/bsc/four/pancake-proxy.js +687 -1
- package/dist/chains/bsc/four/private.d.ts +27 -1
- package/dist/chains/bsc/four/private.js +477 -1
- package/dist/chains/bsc/four/submit.d.ts +315 -2
- package/dist/chains/bsc/four/submit.js +752 -2
- package/dist/chains/bsc/four/swap-buy-first.d.ts +55 -2
- package/dist/chains/bsc/four/swap-buy-first.js +507 -2
- package/dist/chains/bsc/four/swap-internal.d.ts +3 -1
- package/dist/chains/bsc/four/swap-internal.js +18 -1
- package/dist/chains/bsc/four/swap.d.ts +144 -2
- package/dist/chains/bsc/four/swap.js +766 -2
- package/dist/chains/bsc/four/types.d.ts +476 -1
- package/dist/chains/bsc/four/utils.d.ts +18 -5
- package/dist/chains/bsc/four/utils.js +1552 -5
- package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +91 -1
- package/dist/chains/bsc/pancake/bundle-buy-first.js +212 -97
- package/dist/chains/bsc/pancake/bundle-swap.d.ts +79 -1
- package/dist/chains/bsc/pancake/bundle-swap.js +726 -114
- package/dist/chains/bsc/pancake/index.d.ts +2 -4
- package/dist/chains/bsc/pancake/index.js +3 -1
- package/dist/chains/bsc/platforms/iro/factory.d.ts +2 -2
- package/dist/chains/bsc/platforms/iro/factory.js +1 -3
- 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 +10 -31
- package/dist/chains/bsc/platforms/iro/token.js +1 -4
- package/dist/chains/eni/batch-router/bundle-approve.js +3 -4
- package/dist/chains/eni/batch-router/transfer.js +25 -55
- package/dist/chains/eni/batch-router/utils.js +6 -32
- package/dist/chains/eni/bundler/sign.js +6 -5
- package/dist/chains/eni/bundler/submit.js +4 -1
- package/dist/chains/eni/constants.js +1 -1
- package/dist/chains/eni/index.d.ts +1 -2
- package/dist/chains/eni/index.js +0 -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 +6 -9
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +44 -28
- package/dist/chains/eni/platforms/daoaas/portal.js +6 -10
- package/dist/chains/eni/platforms/dswap/liquidity.js +26 -58
- 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 +46 -87
- package/dist/chains/eni/platforms/fair-launch/pool.js +1 -4
- 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 +1 -3
- 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 +26 -90
- package/dist/chains/eni/platforms/iro/token.js +31 -107
- package/dist/chains/eni/platforms/iro/whitelist.js +18 -6
- package/dist/chains/index.d.ts +0 -13
- package/dist/chains/index.js +0 -13
- package/dist/chains/xlayer/eip7702/bundle-approve.d.ts +26 -2
- package/dist/chains/xlayer/eip7702/bundle-approve.js +21 -11
- package/dist/chains/xlayer/eip7702/bundle-buy.d.ts +6 -2
- package/dist/chains/xlayer/eip7702/bundle-buy.js +51 -13
- package/dist/chains/xlayer/eip7702/bundle-create.js +59 -93
- package/dist/chains/xlayer/eip7702/bundle-sell.d.ts +6 -2
- package/dist/chains/xlayer/eip7702/bundle-sell.js +111 -29
- package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +65 -3
- package/dist/chains/xlayer/eip7702/bundle-swap.js +245 -51
- package/dist/chains/xlayer/eip7702/constants.d.ts +16 -1
- package/dist/chains/xlayer/eip7702/constants.js +21 -3
- package/dist/chains/xlayer/eip7702/index.d.ts +46 -28
- package/dist/chains/xlayer/eip7702/index.js +81 -28
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.d.ts +203 -2
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.js +307 -63
- package/dist/chains/xlayer/eip7702/types.d.ts +0 -88
- package/dist/chains/xlayer/eip7702/utils.d.ts +3 -0
- package/dist/chains/xlayer/eip7702/utils.js +28 -23
- package/dist/chains/xlayer/eip7702/volume.d.ts +184 -6
- package/dist/chains/xlayer/eip7702/volume.js +164 -89
- 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.d.ts +95 -1
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.js +299 -66
- package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +1 -1
- package/dist/chains/xlayer/eoa/eoa-wash-volume.js +23 -18
- package/dist/chains/xlayer/eoa/index.d.ts +6 -10
- package/dist/chains/xlayer/eoa/index.js +23 -8
- package/dist/chains/xlayer/eoa/portal-ops.js +2 -7
- 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 +3 -1
- package/dist/chains/xlayer/index.d.ts +2 -3
- package/dist/chains/xlayer/index.js +7 -4
- package/dist/contracts/helper3.d.ts +5 -20
- package/dist/contracts/helper3.js +20 -56
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.d.ts +26 -1
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.js +113 -1
- package/dist/contracts/tm-bundle-merkle/config.d.ts +67 -5
- package/dist/contracts/tm-bundle-merkle/config.js +114 -2
- package/dist/contracts/tm-bundle-merkle/core.d.ts +4 -1
- package/dist/contracts/tm-bundle-merkle/core.js +591 -1
- 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 +46 -2
- package/dist/contracts/tm-bundle-merkle/internal.js +238 -2
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.d.ts +28 -1
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.js +686 -1
- package/dist/contracts/tm-bundle-merkle/private.d.ts +27 -1
- package/dist/contracts/tm-bundle-merkle/private.js +476 -1
- package/dist/contracts/tm-bundle-merkle/submit.d.ts +314 -3
- package/dist/contracts/tm-bundle-merkle/submit.js +928 -3
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.d.ts +55 -2
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.js +506 -2
- package/dist/contracts/tm-bundle-merkle/swap-internal.d.ts +3 -1
- package/dist/contracts/tm-bundle-merkle/swap-internal.js +18 -1
- package/dist/contracts/tm-bundle-merkle/swap.d.ts +144 -2
- package/dist/contracts/tm-bundle-merkle/swap.js +764 -2
- package/dist/contracts/tm-bundle-merkle/types.d.ts +476 -1
- package/dist/contracts/tm-bundle-merkle/utils.d.ts +18 -6
- package/dist/contracts/tm-bundle-merkle/utils.js +1501 -6
- package/dist/contracts/tm-bundle.d.ts +51 -3
- package/dist/contracts/tm-bundle.js +177 -108
- package/dist/contracts/tm.d.ts +2 -3
- package/dist/contracts/tm.js +32 -37
- package/dist/contracts/tm1.js +4 -9
- package/dist/contracts/tm2.js +4 -9
- package/dist/dex/direct-router.d.ts +125 -3
- package/dist/dex/direct-router.js +666 -237
- package/dist/flows/create.d.ts +1 -2
- package/dist/flows/create.js +6 -6
- package/dist/index.d.ts +87 -20
- package/dist/index.js +217 -20
- package/dist/shared/abis/TaxToken.json +105 -0
- package/dist/shared/abis/TokenManager2.json +60 -0
- package/dist/shared/abis/common.d.ts +83 -2
- package/dist/shared/abis/common.js +254 -2
- package/dist/shared/abis/index.d.ts +6 -5
- package/dist/shared/abis/index.js +7 -5
- package/dist/shared/clients/blockrazor.js +25 -39
- package/dist/shared/clients/club48.d.ts +2 -2
- package/dist/shared/clients/club48.js +29 -34
- package/dist/shared/clients/emitservice.js +0 -2
- package/dist/shared/clients/four.d.ts +6 -21
- package/dist/shared/clients/four.js +24 -29
- package/dist/shared/clients/merkle.js +34 -27
- package/dist/shared/constants/addresses.d.ts +1 -1
- package/dist/shared/constants/addresses.js +2 -11
- 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 +6 -2
- package/dist/shared/constants/index.d.ts +0 -3
- package/dist/shared/constants/index.js +0 -1
- package/dist/shared/flap/abi.js +1 -1
- package/dist/shared/flap/constants.d.ts +2 -1
- package/dist/shared/flap/constants.js +4 -3
- package/dist/shared/flap/curve.js +0 -3
- package/dist/shared/flap/errors.d.ts +4 -1
- package/dist/shared/flap/errors.js +1 -20
- package/dist/shared/flap/index.d.ts +5 -4
- package/dist/shared/flap/index.js +5 -4
- package/dist/shared/flap/launch-v6.d.ts +127 -0
- package/dist/shared/flap/launch-v6.js +123 -0
- package/dist/shared/flap/meta.d.ts +18 -22
- package/dist/shared/flap/meta.js +17 -12
- package/dist/shared/flap/permit.js +2 -5
- package/dist/shared/flap/pinata.d.ts +6 -22
- package/dist/shared/flap/pinata.js +26 -21
- package/dist/shared/flap/portal-bundle-merkle/config.d.ts +72 -3
- package/dist/shared/flap/portal-bundle-merkle/config.js +124 -4
- package/dist/shared/flap/portal-bundle-merkle/core.d.ts +4 -0
- package/dist/shared/flap/portal-bundle-merkle/core.js +151 -142
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.d.ts +4 -17
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +86 -86
- package/dist/shared/flap/portal-bundle-merkle/curve-to-dex.js +92 -100
- package/dist/shared/flap/portal-bundle-merkle/index.d.ts +7 -11
- package/dist/shared/flap/portal-bundle-merkle/index.js +7 -4
- package/dist/shared/flap/portal-bundle-merkle/pancake-proxy.js +68 -71
- package/dist/shared/flap/portal-bundle-merkle/private.js +114 -61
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.d.ts +64 -1
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.js +247 -66
- package/dist/shared/flap/portal-bundle-merkle/swap.d.ts +71 -2
- package/dist/shared/flap/portal-bundle-merkle/swap.js +410 -103
- package/dist/shared/flap/portal-bundle-merkle/types.d.ts +12 -88
- package/dist/shared/flap/portal-bundle-merkle/utils.d.ts +80 -1
- package/dist/shared/flap/portal-bundle-merkle/utils.js +265 -145
- package/dist/shared/flap/portal-bundle.js +56 -55
- package/dist/shared/flap/portal-create-token.d.ts +19 -37
- package/dist/shared/flap/portal-create-token.js +124 -121
- package/dist/shared/flap/portal.d.ts +2 -1
- package/dist/shared/flap/portal.js +28 -36
- package/dist/shared/flap/vanity.d.ts +6 -6
- package/dist/shared/flap/vanity.js +21 -15
- package/dist/shared/flap/vault.d.ts +93 -25
- package/dist/shared/flap/vault.js +126 -75
- package/dist/shared/four/tax-token.d.ts +1 -1
- package/dist/shared/four/tax-token.js +7 -27
- package/dist/shared/index.d.ts +0 -6
- package/dist/shared/index.js +0 -4
- package/dist/utils/airdrop-sweep.d.ts +76 -4
- package/dist/utils/airdrop-sweep.js +55 -42
- package/dist/utils/bundle-helpers.d.ts +243 -9
- package/dist/utils/bundle-helpers.js +584 -10
- package/dist/utils/constants.d.ts +61 -5
- package/dist/utils/constants.js +80 -5
- package/dist/utils/contract-factory.d.ts +4 -2
- package/dist/utils/contract-factory.js +18 -25
- package/dist/utils/erc20.d.ts +89 -7
- package/dist/utils/erc20.js +125 -94
- package/dist/utils/errors.d.ts +1 -12
- package/dist/utils/errors.js +1 -60
- package/dist/utils/holders-maker.d.ts +138 -2
- package/dist/utils/holders-maker.js +661 -26
- package/dist/utils/lp-inspect.d.ts +112 -2
- package/dist/utils/lp-inspect.js +223 -73
- package/dist/utils/mpcExclusive.d.ts +5 -2
- package/dist/utils/mpcExclusive.js +3 -4
- package/dist/utils/private-sale.d.ts +58 -2
- package/dist/utils/private-sale.js +15 -4
- package/dist/utils/provider-factory.d.ts +0 -4
- package/dist/utils/provider-factory.js +0 -10
- package/dist/utils/quote-helpers.d.ts +45 -4
- package/dist/utils/quote-helpers.js +74 -17
- package/dist/utils/stealth-transfer.d.ts +28 -2
- package/dist/utils/stealth-transfer.js +15 -31
- package/dist/utils/swap-helpers.d.ts +15 -2
- package/dist/utils/swap-helpers.js +11 -6
- package/dist/utils/wallet.d.ts +25 -2
- package/dist/utils/wallet.js +10 -13
- package/package.json +4 -160
- package/dist/__tests__/subpath-exports.test.d.ts +0 -1
- package/dist/__tests__/subpath-exports.test.js +0 -64
- package/dist/abis/common.d.ts +0 -85
- package/dist/abis/common.js +0 -264
- package/dist/abis/contracts/TaxToken.json +0 -969
- package/dist/abis/contracts/TokenManager2.json +0 -136
- package/dist/abis/contracts/index.d.ts +0 -5
- package/dist/abis/contracts/index.js +0 -5
- package/dist/abis/flap/index.d.ts +0 -3
- package/dist/abis/flap/index.js +0 -3
- package/dist/abis/flap/portal-events.d.ts +0 -6
- package/dist/abis/flap/portal-events.js +0 -17
- package/dist/abis/flap/portal.d.ts +0 -6
- package/dist/abis/flap/portal.js +0 -37
- package/dist/abis/flap/vault.d.ts +0 -171
- package/dist/abis/flap/vault.js +0 -91
- package/dist/abis/index.d.ts +0 -8
- package/dist/abis/index.js +0 -11
- package/dist/bundle-core/__tests__/config-helpers.test.d.ts +0 -1
- package/dist/bundle-core/__tests__/config-helpers.test.js +0 -28
- package/dist/bundle-core/__tests__/facade-parity.test.d.ts +0 -1
- package/dist/bundle-core/__tests__/facade-parity.test.js +0 -33
- package/dist/bundle-core/__tests__/sign-context-helpers.test.d.ts +0 -1
- package/dist/bundle-core/__tests__/sign-context-helpers.test.js +0 -60
- package/dist/bundle-core/__tests__/sign-fixture.test.d.ts +0 -1
- package/dist/bundle-core/__tests__/sign-fixture.test.js +0 -220
- package/dist/bundle-core/__tests__/sign-fixtures.d.ts +0 -10
- package/dist/bundle-core/__tests__/sign-fixtures.js +0 -16
- package/dist/bundle-core/config-helpers.d.ts +0 -36
- package/dist/bundle-core/config-helpers.js +0 -57
- package/dist/bundle-core/errors.d.ts +0 -50
- package/dist/bundle-core/errors.js +0 -35
- package/dist/bundle-core/four-meme/approve-tokenmanager.d.ts +0 -7
- package/dist/bundle-core/four-meme/approve-tokenmanager.js +0 -99
- package/dist/bundle-core/four-meme/core-helpers.d.ts +0 -8
- package/dist/bundle-core/four-meme/core-helpers.js +0 -40
- package/dist/bundle-core/four-meme/core.d.ts +0 -4
- package/dist/bundle-core/four-meme/core.js +0 -515
- package/dist/bundle-core/four-meme/pancake-proxy.d.ts +0 -28
- package/dist/bundle-core/four-meme/pancake-proxy.js +0 -679
- package/dist/bundle-core/four-meme/private.d.ts +0 -27
- package/dist/bundle-core/four-meme/private.js +0 -465
- package/dist/bundle-core/four-meme/sign-context-helpers.d.ts +0 -2
- package/dist/bundle-core/four-meme/sign-context-helpers.js +0 -2
- package/dist/bundle-core/four-meme/swap-buy-first.d.ts +0 -8
- package/dist/bundle-core/four-meme/swap-buy-first.js +0 -493
- package/dist/bundle-core/four-meme/swap-hop-helpers.d.ts +0 -6
- package/dist/bundle-core/four-meme/swap-hop-helpers.js +0 -63
- package/dist/bundle-core/four-meme/swap-internal.d.ts +0 -3
- package/dist/bundle-core/four-meme/swap-internal.js +0 -18
- package/dist/bundle-core/four-meme/swap-sign-helpers.d.ts +0 -27
- package/dist/bundle-core/four-meme/swap-sign-helpers.js +0 -105
- package/dist/bundle-core/four-meme/swap.d.ts +0 -17
- package/dist/bundle-core/four-meme/swap.js +0 -505
- package/dist/bundle-core/four-meme/types/buy-first.d.ts +0 -50
- package/dist/bundle-core/four-meme/types/buy-first.js +0 -1
- package/dist/bundle-core/four-meme/types/core-flow.d.ts +0 -63
- package/dist/bundle-core/four-meme/types/core-flow.js +0 -1
- package/dist/bundle-core/four-meme/types/index.d.ts +0 -600
- package/dist/bundle-core/four-meme/types/index.js +0 -1
- package/dist/bundle-core/four-meme/types/swap-internal.d.ts +0 -19
- package/dist/bundle-core/four-meme/types/swap-internal.js +0 -1
- package/dist/bundle-core/four-meme/types.d.ts +0 -1
- package/dist/bundle-core/four-meme/types.js +0 -1
- package/dist/bundle-core/four-meme/utils-disperse.d.ts +0 -7
- package/dist/bundle-core/four-meme/utils-disperse.js +0 -396
- package/dist/bundle-core/four-meme/utils-pairwise.d.ts +0 -8
- package/dist/bundle-core/four-meme/utils-pairwise.js +0 -328
- package/dist/bundle-core/four-meme/utils-sweep.d.ts +0 -8
- package/dist/bundle-core/four-meme/utils-sweep.js +0 -744
- package/dist/bundle-core/index.d.ts +0 -8
- package/dist/bundle-core/index.js +0 -8
- package/dist/bundle-core/internal.d.ts +0 -21
- package/dist/bundle-core/internal.js +0 -182
- package/dist/bundle-core/sign-context-helpers.d.ts +0 -25
- package/dist/bundle-core/sign-context-helpers.js +0 -67
- package/dist/bundle-core/submit.d.ts +0 -293
- package/dist/bundle-core/submit.js +0 -727
- package/dist/bundle-core/types/index.d.ts +0 -8
- package/dist/bundle-core/types/index.js +0 -1
- package/dist/bundle-core/types.d.ts +0 -1
- package/dist/bundle-core/types.js +0 -1
- package/dist/chains/bsc/four/utils-disperse.d.ts +0 -1
- package/dist/chains/bsc/four/utils-disperse.js +0 -1
- package/dist/chains/bsc/four/utils-pairwise.d.ts +0 -1
- package/dist/chains/bsc/four/utils-pairwise.js +0 -1
- package/dist/chains/bsc/four/utils-sweep.d.ts +0 -1
- package/dist/chains/bsc/four/utils-sweep.js +0 -1
- package/dist/chains/bsc/iro.d.ts +0 -5
- package/dist/chains/bsc/iro.js +0 -4
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +0 -159
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +0 -117
- package/dist/chains/bsc/pancake/bundle-swap-helpers.d.ts +0 -241
- package/dist/chains/bsc/pancake/bundle-swap-helpers.js +0 -565
- package/dist/chains/eni/flat-aliases.d.ts +0 -10
- package/dist/chains/eni/flat-aliases.js +0 -8
- package/dist/chains/eni/submit.d.ts +0 -43
- package/dist/chains/eni/submit.js +0 -286
- package/dist/chains/xlayer/eip7702/flat-aliases.d.ts +0 -13
- package/dist/chains/xlayer/eip7702/flat-aliases.js +0 -10
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.d.ts +0 -79
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.js +0 -1
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.d.ts +0 -26
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.js +0 -57
- package/dist/chains/xlayer/eip7702/volume-helpers.d.ts +0 -148
- package/dist/chains/xlayer/eip7702/volume-helpers.js +0 -48
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts +0 -126
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +0 -228
- package/dist/contracts/tm-bundle-helpers.d.ts +0 -88
- package/dist/contracts/tm-bundle-helpers.js +0 -72
- package/dist/contracts/tm-bundle-merkle/utils-disperse.d.ts +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-disperse.js +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.d.ts +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.js +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-sweep.d.ts +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-sweep.js +0 -1
- package/dist/dex/direct-router-helpers.d.ts +0 -264
- package/dist/dex/direct-router-helpers.js +0 -539
- package/dist/dex/types.d.ts +0 -81
- package/dist/dex/types.js +0 -1
- package/dist/exports/root-bundle-and-tooling.d.ts +0 -27
- package/dist/exports/root-bundle-and-tooling.js +0 -30
- package/dist/exports/root-eni-and-bsc-iro.d.ts +0 -26
- package/dist/exports/root-eni-and-bsc-iro.js +0 -66
- package/dist/exports/root-foundations.d.ts +0 -35
- package/dist/exports/root-foundations.js +0 -70
- package/dist/exports/root-swap-dex-and-xlayer.d.ts +0 -30
- package/dist/exports/root-swap-dex-and-xlayer.js +0 -78
- package/dist/flap/index.d.ts +0 -10
- package/dist/flap/index.js +0 -8
- package/dist/flows/index.d.ts +0 -1
- package/dist/flows/index.js +0 -1
- package/dist/merkle/index.d.ts +0 -12
- package/dist/merkle/index.js +0 -11
- package/dist/shared/clients/index.d.ts +0 -8
- package/dist/shared/clients/index.js +0 -8
- package/dist/shared/constants/quote.d.ts +0 -30
- package/dist/shared/constants/quote.js +0 -37
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.d.ts +0 -32
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.js +0 -83
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +0 -125
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.js +0 -113
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.d.ts +0 -149
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.js +0 -259
- package/dist/shared/foundation/dex/v3-path.d.ts +0 -6
- package/dist/shared/foundation/dex/v3-path.js +0 -35
- package/dist/shared/foundation/gas/bundle-gas.d.ts +0 -49
- package/dist/shared/foundation/gas/bundle-gas.js +0 -93
- package/dist/shared/foundation/gas/profit-hop.d.ts +0 -20
- package/dist/shared/foundation/gas/profit-hop.js +0 -72
- package/dist/shared/foundation/index.d.ts +0 -13
- package/dist/shared/foundation/index.js +0 -12
- package/dist/shared/foundation/nonce/nonce-manager.d.ts +0 -17
- package/dist/shared/foundation/nonce/nonce-manager.js +0 -183
- package/dist/shared/foundation/normalize-unknown.d.ts +0 -9
- package/dist/shared/foundation/normalize-unknown.js +0 -29
- package/dist/shared/foundation/sdk-logger.d.ts +0 -13
- package/dist/shared/foundation/sdk-logger.js +0 -12
- package/dist/shared/foundation/tx/build-request.d.ts +0 -17
- package/dist/shared/foundation/tx/build-request.js +0 -25
- package/dist/shared/foundation/tx/sign-batch.d.ts +0 -5
- package/dist/shared/foundation/tx/sign-batch.js +0 -26
- package/dist/shared/foundation/tx/wallet-sign-patch.d.ts +0 -1
- package/dist/shared/foundation/tx/wallet-sign-patch.js +0 -18
- package/dist/shared/foundation/types/airdrop-sweep.d.ts +0 -79
- package/dist/shared/foundation/types/airdrop-sweep.js +0 -1
- package/dist/shared/foundation/types/erc20.d.ts +0 -65
- package/dist/shared/foundation/types/erc20.js +0 -1
- package/dist/shared/foundation/types/holders-maker.d.ts +0 -64
- package/dist/shared/foundation/types/holders-maker.js +0 -1
- package/dist/shared/foundation/types/index.d.ts +0 -7
- package/dist/shared/foundation/types/index.js +0 -1
- package/dist/shared/foundation/types/lp-inspect.d.ts +0 -102
- package/dist/shared/foundation/types/lp-inspect.js +0 -1
- package/dist/shared/foundation/types/multicall.d.ts +0 -5
- package/dist/shared/foundation/types/multicall.js +0 -1
- package/dist/shared/foundation/types/private-sale.d.ts +0 -35
- package/dist/shared/foundation/types/private-sale.js +0 -1
- package/dist/shared/foundation/types/quote-helpers.d.ts +0 -17
- package/dist/shared/foundation/types/quote-helpers.js +0 -1
- package/dist/types/errors.d.ts +0 -27
- package/dist/types/errors.js +0 -34
- package/dist/utils/holders-maker/addresses.d.ts +0 -12
- package/dist/utils/holders-maker/addresses.js +0 -15
- package/dist/utils/holders-maker/buy-tx.d.ts +0 -44
- package/dist/utils/holders-maker/buy-tx.js +0 -278
- package/dist/utils/holders-maker/constants.d.ts +0 -6
- package/dist/utils/holders-maker/constants.js +0 -7
- package/dist/utils/holders-maker/disperse.d.ts +0 -18
- package/dist/utils/holders-maker/disperse.js +0 -90
- package/dist/utils/holders-maker/routing.d.ts +0 -4
- package/dist/utils/holders-maker/routing.js +0 -45
- package/dist/utils/holders-maker/transfer-tx.d.ts +0 -4
- package/dist/utils/holders-maker/transfer-tx.js +0 -67
- package/dist/utils/holders-maker-helpers.d.ts +0 -9
- package/dist/utils/holders-maker-helpers.js +0 -9
- package/dist/utils/hop-chains.d.ts +0 -35
- package/dist/utils/hop-chains.js +0 -215
- package/dist/utils/lp-inspect-helpers.d.ts +0 -9
- package/dist/utils/lp-inspect-helpers.js +0 -109
- package/dist/utils/types/airdrop-sweep.d.ts +0 -1
- package/dist/utils/types/airdrop-sweep.js +0 -1
- package/dist/utils/types/contract-factory.d.ts +0 -1
- package/dist/utils/types/contract-factory.js +0 -1
- package/dist/utils/types/erc20.d.ts +0 -1
- package/dist/utils/types/erc20.js +0 -1
- package/dist/utils/types/errors.d.ts +0 -1
- package/dist/utils/types/errors.js +0 -1
- package/dist/utils/types/holders-maker.d.ts +0 -1
- package/dist/utils/types/holders-maker.js +0 -1
- package/dist/utils/types/hop-chains.d.ts +0 -8
- package/dist/utils/types/hop-chains.js +0 -1
- package/dist/utils/types/index.d.ts +0 -13
- package/dist/utils/types/index.js +0 -1
- package/dist/utils/types/lp-inspect.d.ts +0 -1
- package/dist/utils/types/lp-inspect.js +0 -1
- package/dist/utils/types/mpc-exclusive.d.ts +0 -5
- package/dist/utils/types/mpc-exclusive.js +0 -1
- package/dist/utils/types/private-sale.d.ts +0 -1
- package/dist/utils/types/private-sale.js +0 -1
- package/dist/utils/types/quote-helpers.d.ts +0 -1
- package/dist/utils/types/quote-helpers.js +0 -1
- package/dist/utils/types/stealth-transfer.d.ts +0 -44
- package/dist/utils/types/stealth-transfer.js +0 -1
- package/dist/utils/types/wallet.d.ts +0 -25
- package/dist/utils/types/wallet.js +0 -1
- package/dist/vanity/index.d.ts +0 -5
- package/dist/vanity/index.js +0 -5
- package/src/abis/contracts/TaxToken.json +0 -969
- package/src/abis/contracts/TokenManager.json +0 -836
- package/src/abis/contracts/TokenManager2.json +0 -136
- package/src/abis/contracts/TokenManagerHelper3.json +0 -993
- /package/dist/{abis/contracts → shared/abis}/TokenManager.json +0 -0
- /package/dist/{abis/contracts → shared/abis}/TokenManagerHelper3.json +0 -0
|
@@ -1,42 +1,92 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* core - 主函数
|
|
3
|
-
*/
|
|
4
1
|
import { ethers, Wallet, Contract, Interface } from 'ethers';
|
|
5
|
-
import { NonceManager, getOptimizedGasPrice, buildProfitHopTransactions, PROFIT_HOP_COUNT
|
|
6
|
-
import { ZERO_ADDRESS } from '../../../
|
|
7
|
-
import { GAS_LIMITS } from '../../constants/index.js';
|
|
8
|
-
import { MULTICALL3_ABI } from '../../abis/common.js';
|
|
2
|
+
import { NonceManager, getOptimizedGasPrice, buildProfitHopTransactions, PROFIT_HOP_COUNT } from '../../../utils/bundle-helpers.js';
|
|
3
|
+
import { ADDRESSES, ZERO_ADDRESS } from '../../../utils/constants.js';
|
|
4
|
+
import { GAS_LIMITS, CHAINS } from '../../constants/index.js';
|
|
5
|
+
import { MULTICALL3_ABI, V2_ROUTER_QUOTE_ABI } from '../../abis/common.js';
|
|
9
6
|
import { FLAP_PORTAL_ADDRESSES, FLAP_ORIGINAL_PORTAL_ADDRESSES } from '../constants.js';
|
|
10
|
-
import {
|
|
11
|
-
import { CHAIN_ID_MAP, PORTAL_ABI, getErrorMessage, getTxType, getGasPriceConfig, shouldExtractProfit, calculateProfit, getProfitRecipient, getBribeAmount, BLOCKRAZOR_BUILDER_EOA
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
7
|
+
import { populateCreateTokenTransaction, resolveCreateTokenLaunchFlags, } from '../portal-create-token.js';
|
|
8
|
+
import { CHAIN_ID_MAP, PORTAL_ABI, getErrorMessage, getTxType, getGasPriceConfig, shouldExtractProfit, calculateProfit, getProfitRecipient, getBribeAmount, BLOCKRAZOR_BUILDER_EOA } from './config.js';
|
|
9
|
+
// ✅ 常量
|
|
10
|
+
const MULTICALL3_ADDRESS = ADDRESSES.BSC.Multicall3;
|
|
11
|
+
// ==================== ERC20 → 原生代币报价 ====================
|
|
12
|
+
// BSC 链常量
|
|
13
|
+
const BSC_PANCAKE_V2_ROUTER = ADDRESSES.BSC.PancakeV2Router;
|
|
14
|
+
const BSC_WBNB = ADDRESSES.BSC.WBNB;
|
|
15
|
+
// ✅ Monad 链常量
|
|
16
|
+
const MONAD_PANCAKE_V2_ROUTER = '0xb1bc24c34e88f7d43d5923034e3a14b24daacff9';
|
|
17
|
+
const MONAD_WMON = ADDRESSES.MONAD.WMON;
|
|
18
|
+
// ✅ XLAYER 链常量(PotatoSwap V2)
|
|
19
|
+
const XLAYER_POTATOSWAP_V2_ROUTER = ADDRESSES.XLAYER.PotatoSwapV2Router;
|
|
20
|
+
const XLAYER_WOKB = ADDRESSES.XLAYER.WOKB;
|
|
21
|
+
// ✅ Base 链常量(Uniswap V3 SwapRouter02)
|
|
22
|
+
const BASE_WETH = ADDRESSES.BASE.WETH;
|
|
23
|
+
const ROUTER_ABI = V2_ROUTER_QUOTE_ABI;
|
|
25
24
|
/**
|
|
26
|
-
*
|
|
25
|
+
* 获取 ERC20 代币 → 原生代币的报价
|
|
26
|
+
* @param provider - Provider 实例
|
|
27
|
+
* @param tokenAddress - ERC20 代币地址
|
|
28
|
+
* @param tokenAmount - 代币数量(wei)
|
|
29
|
+
* @param chainId - 链 ID(56=BSC, 143=Monad)
|
|
30
|
+
* @returns 等值的原生代币数量(wei),失败返回 0n
|
|
27
31
|
*/
|
|
28
|
-
function
|
|
29
|
-
if (
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
+
async function getTokenToNativeQuote(provider, tokenAddress, tokenAmount, chainId) {
|
|
33
|
+
if (tokenAmount <= 0n)
|
|
34
|
+
return 0n;
|
|
32
35
|
try {
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
if (chainId === CHAINS.BSC.chainId) {
|
|
37
|
+
// BSC: 使用 PancakeSwap V2 Router
|
|
38
|
+
const router = new Contract(BSC_PANCAKE_V2_ROUTER, ROUTER_ABI, provider);
|
|
39
|
+
const amounts = await router.getAmountsOut(tokenAmount, [tokenAddress, BSC_WBNB]);
|
|
40
|
+
return amounts[1];
|
|
41
|
+
}
|
|
42
|
+
if (chainId === CHAINS.MONAD.chainId) {
|
|
43
|
+
// ✅ Monad: 使用 PancakeSwap V2 Router
|
|
44
|
+
const router = new Contract(MONAD_PANCAKE_V2_ROUTER, ROUTER_ABI, provider);
|
|
45
|
+
const amounts = await router.getAmountsOut(tokenAmount, [tokenAddress, MONAD_WMON]);
|
|
46
|
+
return amounts[1];
|
|
47
|
+
}
|
|
48
|
+
if (chainId === CHAINS.XLAYER.chainId) {
|
|
49
|
+
// ✅ XLAYER: 使用 PotatoSwap V2 Router(USDT0 → WOKB)
|
|
50
|
+
const router = new Contract(XLAYER_POTATOSWAP_V2_ROUTER, ROUTER_ABI, provider);
|
|
51
|
+
const amounts = await router.getAmountsOut(tokenAmount, [tokenAddress, XLAYER_WOKB]);
|
|
52
|
+
return amounts[1];
|
|
53
|
+
}
|
|
54
|
+
if (chainId === CHAINS.BASE.chainId) {
|
|
55
|
+
// ✅ Base: 目前大部分 Flap 交易使用 ETH(原生代币),ERC20 报价暂不支持
|
|
56
|
+
// Base 主力 DEX 是 Uniswap V3,V2 Router 流动性有限,暂返回 0
|
|
57
|
+
// TODO: 后续可接入 Uniswap V3 QuoterV2 进行精确报价
|
|
58
|
+
return 0n;
|
|
59
|
+
}
|
|
60
|
+
// 其他链暂不支持报价,返回 0
|
|
61
|
+
return 0n;
|
|
35
62
|
}
|
|
36
63
|
catch {
|
|
37
|
-
|
|
64
|
+
// 报价失败返回 0(可能是流动性不足或路径不存在)
|
|
65
|
+
return 0n;
|
|
38
66
|
}
|
|
39
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* 获取 Gas Limit
|
|
70
|
+
* 优先使用 config.gasLimit,否则使用默认值 * multiplier
|
|
71
|
+
*
|
|
72
|
+
* ✅ ethers v6 最佳实践:直接使用 bigint 类型
|
|
73
|
+
*/
|
|
74
|
+
function getGasLimit(config, defaultGas = 800000) {
|
|
75
|
+
// 优先使用前端传入的 gasLimit
|
|
76
|
+
if (config.gasLimit !== undefined) {
|
|
77
|
+
// 如果已经是 bigint,直接返回;否则转换
|
|
78
|
+
return typeof config.gasLimit === 'bigint' ? config.gasLimit : BigInt(config.gasLimit);
|
|
79
|
+
}
|
|
80
|
+
// 使用默认值 * multiplier
|
|
81
|
+
const multiplier = config.gasLimitMultiplier ?? 1.0;
|
|
82
|
+
const calculatedGas = Math.ceil(defaultGas * multiplier);
|
|
83
|
+
// JavaScript 原生 BigInt 转换(ethers v6 兼容)
|
|
84
|
+
return BigInt(calculatedGas);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Flap Protocol: 创建代币 + 捆绑购买(仅签名版本 - 不依赖 Merkle)
|
|
88
|
+
* ✅ 精简版:只负责签名交易,不提交到 Merkle
|
|
89
|
+
*/
|
|
40
90
|
export async function createTokenWithBundleBuyMerkle(params) {
|
|
41
91
|
const { chain, privateKeys, buyAmounts, tokenInfo, tokenAddress, config } = params;
|
|
42
92
|
if (privateKeys.length === 0) {
|
|
@@ -53,16 +103,6 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
53
103
|
const originalPortalAddr = FLAP_ORIGINAL_PORTAL_ADDRESSES[chain];
|
|
54
104
|
const portal = new ethers.Contract(originalPortalAddr, PORTAL_ABI, devWallet);
|
|
55
105
|
const { normalizedTax, useV7Portal } = resolveCreateTokenLaunchFlags(params);
|
|
56
|
-
const inputToken = params.quoteToken && params.quoteToken !== ZERO_ADDRESS ? params.quoteToken : ZERO_ADDRESS;
|
|
57
|
-
const useNativeToken = inputToken === ZERO_ADDRESS;
|
|
58
|
-
const extractProfit = config.extractProfitOnLaunch === false ? false : shouldExtractProfit(config);
|
|
59
|
-
const useMethodA = canUseLaunchMethodA(privateKeys, buyAmounts, devWallet.address, useNativeToken);
|
|
60
|
-
let methodAQuoteAmt = 0n;
|
|
61
|
-
let methodABuyMeta;
|
|
62
|
-
if (useMethodA) {
|
|
63
|
-
methodABuyMeta = analyzeBuyFunds(buyAmounts, config, extractProfit);
|
|
64
|
-
methodAQuoteAmt = methodABuyMeta.fundsList[0] ?? 0n;
|
|
65
|
-
}
|
|
66
106
|
const createTxPromise = populateCreateTokenTransaction({
|
|
67
107
|
chain,
|
|
68
108
|
devWallet,
|
|
@@ -74,18 +114,20 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
74
114
|
salt: params.salt,
|
|
75
115
|
migratorType: params.migratorType,
|
|
76
116
|
taxRate: params.taxRate,
|
|
117
|
+
buyTaxRate: params.buyTaxRate,
|
|
118
|
+
sellTaxRate: params.sellTaxRate,
|
|
77
119
|
dexId: params.dexId,
|
|
78
120
|
lpFeeProfile: params.lpFeeProfile,
|
|
79
121
|
extensionID: params.extensionID,
|
|
80
122
|
extensionData: params.extensionData,
|
|
81
123
|
useV7Portal,
|
|
82
124
|
taxConfig: normalizedTax,
|
|
83
|
-
initialQuoteAmt:
|
|
125
|
+
initialQuoteAmt: 0n,
|
|
84
126
|
});
|
|
85
127
|
const [gasPrice, createTxUnsigned, devNonce] = await Promise.all([
|
|
86
128
|
resolveGasPrice(provider, config),
|
|
87
129
|
createTxPromise,
|
|
88
|
-
nonceManager.getNextNonce(devWallet)
|
|
130
|
+
nonceManager.getNextNonce(devWallet)
|
|
89
131
|
]);
|
|
90
132
|
const createTxRequest = {
|
|
91
133
|
...createTxUnsigned,
|
|
@@ -94,74 +136,31 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
94
136
|
gasLimit: getGasLimit(config),
|
|
95
137
|
gasPrice,
|
|
96
138
|
chainId,
|
|
97
|
-
type: getTxType(config)
|
|
98
|
-
value: useMethodA ? methodAQuoteAmt : 0n,
|
|
139
|
+
type: getTxType(config)
|
|
99
140
|
};
|
|
100
141
|
const signedCreateTx = await devWallet.signTransaction(createTxRequest);
|
|
101
142
|
signedTxs.push(signedCreateTx);
|
|
102
|
-
if (useMethodA && methodABuyMeta) {
|
|
103
|
-
const { totalBuyAmount, totalProfit } = methodABuyMeta;
|
|
104
|
-
const bribeAmount = getBribeAmount(config);
|
|
105
|
-
const bribeTxs = [];
|
|
106
|
-
let nextDevNonce = devNonce + 1;
|
|
107
|
-
if (bribeAmount > 0n) {
|
|
108
|
-
const bribeTx = await devWallet.signTransaction({
|
|
109
|
-
to: BLOCKRAZOR_BUILDER_EOA,
|
|
110
|
-
value: bribeAmount,
|
|
111
|
-
nonce: nextDevNonce,
|
|
112
|
-
gasPrice,
|
|
113
|
-
gasLimit: GAS_LIMITS.BRIBE,
|
|
114
|
-
chainId,
|
|
115
|
-
type: getTxType(config),
|
|
116
|
-
});
|
|
117
|
-
bribeTxs.push(bribeTx);
|
|
118
|
-
nextDevNonce += 1;
|
|
119
|
-
}
|
|
120
|
-
const profitTxs = [];
|
|
121
|
-
let profitHopWallets;
|
|
122
|
-
if (extractProfit && totalProfit > 0n) {
|
|
123
|
-
const profitHopResult = await buildProfitHopTransactions({
|
|
124
|
-
provider,
|
|
125
|
-
payerWallet: devWallet,
|
|
126
|
-
profitAmount: totalProfit,
|
|
127
|
-
profitRecipient: getProfitRecipient(),
|
|
128
|
-
hopCount: PROFIT_HOP_COUNT,
|
|
129
|
-
gasPrice,
|
|
130
|
-
chainId,
|
|
131
|
-
txType: getTxType(config),
|
|
132
|
-
startNonce: nextDevNonce,
|
|
133
|
-
});
|
|
134
|
-
profitTxs.push(...profitHopResult.signedTransactions);
|
|
135
|
-
profitHopWallets = profitHopResult.hopWallets;
|
|
136
|
-
}
|
|
137
|
-
nonceManager.clearTemp();
|
|
138
|
-
return {
|
|
139
|
-
signedTransactions: [...bribeTxs, ...signedTxs, ...profitTxs],
|
|
140
|
-
tokenAddress,
|
|
141
|
-
profitHopWallets,
|
|
142
|
-
metadata: {
|
|
143
|
-
...buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, 0),
|
|
144
|
-
launchMethod: 'quoteAmt',
|
|
145
|
-
},
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
143
|
const buyers = createWallets(privateKeys.slice(1), provider);
|
|
144
|
+
const extractProfit = shouldExtractProfit(config);
|
|
149
145
|
const { fundsList, originalAmounts, totalBuyAmount, totalProfit } = analyzeBuyFunds(buyAmounts, config, extractProfit);
|
|
150
146
|
const maxFundsIndex = findMaxIndex(originalAmounts);
|
|
151
147
|
const gasLimits = buildGasLimitList(buyers.length, config);
|
|
148
|
+
// ✅ 支持 quoteToken:如果传入了 quoteToken 且非零地址,则使用它
|
|
149
|
+
const inputToken = params.quoteToken && params.quoteToken !== ZERO_ADDRESS ? params.quoteToken : ZERO_ADDRESS;
|
|
150
|
+
const useNativeToken = inputToken === ZERO_ADDRESS;
|
|
152
151
|
// ✅ 如果使用非原生代币(如 USDC),需要根据精度转换金额
|
|
153
152
|
let adjustedFundsList = fundsList;
|
|
154
153
|
let profitTokenAmount = totalProfit;
|
|
155
154
|
if (!useNativeToken && params.quoteTokenDecimals !== undefined && params.quoteTokenDecimals !== 18) {
|
|
156
155
|
const decimalsDiff = 18 - params.quoteTokenDecimals;
|
|
157
156
|
const divisor = BigInt(10 ** decimalsDiff);
|
|
158
|
-
adjustedFundsList = fundsList.map(
|
|
157
|
+
adjustedFundsList = fundsList.map(amount => amount / divisor);
|
|
159
158
|
profitTokenAmount = totalProfit / divisor;
|
|
160
159
|
}
|
|
161
160
|
// ✅ 优化:并行获取 unsignedBuys 和 buyerNonces
|
|
162
161
|
const [unsignedBuys, buyerNonces] = await Promise.all([
|
|
163
162
|
populateBuyTransactionsWithQuote(buyers, portalAddr, tokenAddress, adjustedFundsList, inputToken, useNativeToken),
|
|
164
|
-
allocateBuyerNonces(buyers, extractProfit, maxFundsIndex, useNativeToken ? totalProfit : profitTokenAmount, nonceManager)
|
|
163
|
+
allocateBuyerNonces(buyers, extractProfit, maxFundsIndex, useNativeToken ? totalProfit : profitTokenAmount, nonceManager)
|
|
165
164
|
]);
|
|
166
165
|
// ✅ 贿赂交易放在首位(提高 BlockRazor 打包优先级)
|
|
167
166
|
const bribeAmount = getBribeAmount(config);
|
|
@@ -176,7 +175,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
176
175
|
gasPrice,
|
|
177
176
|
gasLimit: GAS_LIMITS.BRIBE,
|
|
178
177
|
chainId,
|
|
179
|
-
type: getTxType(config)
|
|
178
|
+
type: getTxType(config)
|
|
180
179
|
});
|
|
181
180
|
bribeTxs.push(bribeTx);
|
|
182
181
|
// 调整 maxFundsIndex 钱包的 nonce(买入交易 +1)
|
|
@@ -191,7 +190,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
191
190
|
chainId,
|
|
192
191
|
config,
|
|
193
192
|
fundsList: adjustedFundsList, // ✅ 使用调整后的金额
|
|
194
|
-
useNativeToken
|
|
193
|
+
useNativeToken // ✅ 传递是否使用原生代币
|
|
195
194
|
});
|
|
196
195
|
// ✅ 利润多跳转账(强制 2 跳中转)
|
|
197
196
|
const profitTxs = [];
|
|
@@ -212,7 +211,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
212
211
|
gasPrice,
|
|
213
212
|
chainId,
|
|
214
213
|
txType: getTxType(config),
|
|
215
|
-
startNonce: profitNonce
|
|
214
|
+
startNonce: profitNonce
|
|
216
215
|
});
|
|
217
216
|
profitTxs.push(...profitHopResult.signedTransactions);
|
|
218
217
|
profitHopWallets = profitHopResult.hopWallets; // ✅ 收集利润多跳钱包
|
|
@@ -224,10 +223,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
224
223
|
signedTransactions: [...bribeTxs, ...signedTxs, ...signedBuys, ...profitTxs],
|
|
225
224
|
tokenAddress,
|
|
226
225
|
profitHopWallets, // ✅ 返回利润多跳钱包
|
|
227
|
-
metadata:
|
|
228
|
-
...buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, buyers.length),
|
|
229
|
-
launchMethod: 'swapExactInput',
|
|
230
|
-
},
|
|
226
|
+
metadata: buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, buyers.length)
|
|
231
227
|
};
|
|
232
228
|
}
|
|
233
229
|
/**
|
|
@@ -242,8 +238,9 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
242
238
|
}
|
|
243
239
|
const { provider, chainId } = createChainContext(chain, config.rpcUrl);
|
|
244
240
|
const nonceManager = new NonceManager(provider);
|
|
241
|
+
const signedTxs = [];
|
|
245
242
|
const buyers = createWallets(privateKeys, provider);
|
|
246
|
-
const extractProfit = shouldExtractProfit();
|
|
243
|
+
const extractProfit = shouldExtractProfit(config);
|
|
247
244
|
const { fundsList, originalAmounts, totalBuyAmount, totalProfit } = analyzeBuyFunds(buyAmounts, config, extractProfit);
|
|
248
245
|
const maxFundsIndex = findMaxIndex(originalAmounts);
|
|
249
246
|
const gasLimits = buildGasLimitList(buyers.length, config);
|
|
@@ -261,7 +258,7 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
261
258
|
// 转为 USDC (6位) = 100000 (0.1 USDC)
|
|
262
259
|
const decimalsDiff = 18 - quoteTokenDecimals;
|
|
263
260
|
const divisor = BigInt(10 ** decimalsDiff);
|
|
264
|
-
adjustedFundsList = fundsList.map(
|
|
261
|
+
adjustedFundsList = fundsList.map(amount => amount / divisor);
|
|
265
262
|
profitTokenAmount = totalProfit / divisor;
|
|
266
263
|
}
|
|
267
264
|
// ✅ ERC20 购买:获取代币利润等值的原生代币(BNB)报价
|
|
@@ -278,8 +275,10 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
278
275
|
populateBuyTransactionsWithQuote(buyers, FLAP_PORTAL_ADDRESSES[chain], tokenAddress, adjustedFundsList, inputToken, useNativeToken),
|
|
279
276
|
presetNonces && presetNonces.length === buyers.length
|
|
280
277
|
? adjustNoncesForProfit(presetNonces) // ✅ 调整 nonces 避免冲突
|
|
281
|
-
: allocateBuyerNonces(buyers, extractProfit, maxFundsIndex, nativeProfitAmount, nonceManager)
|
|
278
|
+
: allocateBuyerNonces(buyers, extractProfit, maxFundsIndex, nativeProfitAmount, nonceManager)
|
|
282
279
|
]);
|
|
280
|
+
if (presetNonces) {
|
|
281
|
+
}
|
|
283
282
|
// ✅ 贿赂交易放在首位(提高 BlockRazor 打包优先级)
|
|
284
283
|
const bribeAmount = getBribeAmount(config);
|
|
285
284
|
const bribeTxs = [];
|
|
@@ -292,7 +291,7 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
292
291
|
gasPrice,
|
|
293
292
|
gasLimit: GAS_LIMITS.BRIBE,
|
|
294
293
|
chainId,
|
|
295
|
-
type: getTxType(config)
|
|
294
|
+
type: getTxType(config)
|
|
296
295
|
});
|
|
297
296
|
bribeTxs.push(bribeTx);
|
|
298
297
|
// 调整 maxFundsIndex 钱包的 nonce(买入交易 +1)
|
|
@@ -307,18 +306,20 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
307
306
|
chainId,
|
|
308
307
|
config,
|
|
309
308
|
fundsList: adjustedFundsList, // ✅ 使用调整后的金额
|
|
310
|
-
useNativeToken
|
|
309
|
+
useNativeToken // ✅ USDT 购买时 value=0,BNB 购买时 value=金额
|
|
311
310
|
});
|
|
312
311
|
// ✅ 利润多跳转账
|
|
313
312
|
const profitTxs = [];
|
|
314
313
|
let profitHopWallets;
|
|
315
314
|
// ✅ 检查是否使用分布式利润模式
|
|
316
|
-
const profitMode = config.profitMode
|
|
315
|
+
const profitMode = config.profitMode || 'single';
|
|
316
|
+
console.log('🔧 [SDK batchBuyWithBundleMerkle] config.profitMode:', config.profitMode, '-> resolved:', profitMode, 'wallets:', buyers.length);
|
|
317
317
|
if (extractProfit && nativeProfitAmount > 0n) {
|
|
318
318
|
if (profitMode === 'distributed') {
|
|
319
319
|
// ✅ 分布式模式:每个钱包独立扣除自己的利润,每个都有独立的多跳
|
|
320
320
|
// 最多支持 12 个钱包(12 交易 + 36 多跳 + 1 贿赂 = 49 笔)
|
|
321
321
|
const MAX_DISTRIBUTED_WALLETS = 12;
|
|
322
|
+
console.log('🔧 [SDK] 使用分布式利润模式,钱包数:', buyers.length);
|
|
322
323
|
if (buyers.length > MAX_DISTRIBUTED_WALLETS) {
|
|
323
324
|
throw new Error(`分布式利润模式最多支持 ${MAX_DISTRIBUTED_WALLETS} 个钱包,当前 ${buyers.length} 个`);
|
|
324
325
|
}
|
|
@@ -328,7 +329,9 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
328
329
|
for (let i = 0; i < buyers.length; i++) {
|
|
329
330
|
const walletOriginalAmount = originalAmounts[i];
|
|
330
331
|
// 按比例计算该钱包应承担的利润
|
|
331
|
-
const walletProfit = totalBuyAmount > 0n
|
|
332
|
+
const walletProfit = totalBuyAmount > 0n
|
|
333
|
+
? (nativeProfitAmount * walletOriginalAmount) / totalBuyAmount
|
|
334
|
+
: 0n;
|
|
332
335
|
perWalletProfits.push(walletProfit);
|
|
333
336
|
}
|
|
334
337
|
// 为每个钱包生成独立的利润多跳交易
|
|
@@ -345,7 +348,7 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
345
348
|
gasPrice,
|
|
346
349
|
chainId,
|
|
347
350
|
txType: getTxType(config),
|
|
348
|
-
startNonce: profitNonce
|
|
351
|
+
startNonce: profitNonce
|
|
349
352
|
});
|
|
350
353
|
profitTxs.push(...profitHopResult.signedTransactions);
|
|
351
354
|
if (profitHopResult.hopWallets) {
|
|
@@ -367,7 +370,7 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
367
370
|
gasPrice,
|
|
368
371
|
chainId,
|
|
369
372
|
txType: getTxType(config),
|
|
370
|
-
startNonce: profitNonce
|
|
373
|
+
startNonce: profitNonce
|
|
371
374
|
});
|
|
372
375
|
profitTxs.push(...profitHopResult.signedTransactions);
|
|
373
376
|
profitHopWallets = profitHopResult.hopWallets;
|
|
@@ -382,7 +385,7 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
382
385
|
metadata: {
|
|
383
386
|
...buildProfitMetadata(extractProfit, totalBuyAmount, nativeProfitAmount, buyers.length),
|
|
384
387
|
profitMode, // ✅ 返回使用的利润模式
|
|
385
|
-
}
|
|
388
|
+
}
|
|
386
389
|
};
|
|
387
390
|
}
|
|
388
391
|
/**
|
|
@@ -397,22 +400,23 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
397
400
|
}
|
|
398
401
|
const { provider, chainId } = createChainContext(chain, config.rpcUrl);
|
|
399
402
|
const nonceManager = new NonceManager(provider);
|
|
403
|
+
const signedTxs = [];
|
|
400
404
|
const wallets = createWallets(privateKeys, provider);
|
|
401
|
-
const amountsWei = sellAmounts.map(
|
|
405
|
+
const amountsWei = sellAmounts.map(a => ethers.parseUnits(a, 18));
|
|
402
406
|
const portalAddr = FLAP_PORTAL_ADDRESSES[chain];
|
|
403
407
|
const readOnlyPortal = new ethers.Contract(portalAddr, PORTAL_ABI, provider);
|
|
404
408
|
const gasLimits = buildGasLimitList(wallets.length, config);
|
|
405
|
-
const portals = wallets.map(
|
|
409
|
+
const portals = wallets.map(w => new ethers.Contract(portalAddr, PORTAL_ABI, w));
|
|
406
410
|
// ✅ 确定 outputToken:如果传入了 quoteToken 且非零地址,则使用它;否则使用零地址(原生代币)
|
|
407
411
|
const outputToken = quoteToken && quoteToken !== ZERO_ADDRESS ? quoteToken : ZERO_ADDRESS;
|
|
408
412
|
const useNativeOutput = outputToken === ZERO_ADDRESS;
|
|
409
413
|
// ✅ 优化:如果前端传入了 nonces,直接使用(跳过 RPC 调用)
|
|
410
414
|
const presetNonces = config.nonces;
|
|
411
|
-
const extractProfit = shouldExtractProfit();
|
|
415
|
+
const extractProfit = shouldExtractProfit(config);
|
|
412
416
|
// ✅ 并行执行 gasPrice 和 quoteSellOutputs(Multicall3)
|
|
413
417
|
const [gasPrice, quotedOutputs] = await Promise.all([
|
|
414
418
|
resolveGasPrice(provider, config),
|
|
415
|
-
quoteSellOutputsWithQuote(readOnlyPortal, tokenAddress, amountsWei, outputToken)
|
|
419
|
+
quoteSellOutputsWithQuote(readOnlyPortal, tokenAddress, amountsWei, outputToken)
|
|
416
420
|
]);
|
|
417
421
|
// ✅ 计算利润和 maxRevenueIndex(用于 nonce 分配)
|
|
418
422
|
let totalTokenProfit = 0n;
|
|
@@ -422,7 +426,7 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
422
426
|
for (let i = 0; i < wallets.length; i++) {
|
|
423
427
|
const quoted = quotedOutputs[i];
|
|
424
428
|
if (quoted > 0n) {
|
|
425
|
-
const { profit } = calculateProfit(quoted);
|
|
429
|
+
const { profit } = calculateProfit(quoted, config);
|
|
426
430
|
totalTokenProfit += profit;
|
|
427
431
|
if (quoted > maxRevenue) {
|
|
428
432
|
maxRevenue = quoted;
|
|
@@ -454,7 +458,9 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
454
458
|
const maxRevenueNonces = await nonceManager.getNextNonceBatch(wallets[maxRevenueIndex], maxRevenueNonceCount);
|
|
455
459
|
// 其他钱包各需要 1 个 nonce
|
|
456
460
|
const otherWallets = wallets.filter((_, i) => i !== maxRevenueIndex);
|
|
457
|
-
const otherNonces = otherWallets.length > 0
|
|
461
|
+
const otherNonces = otherWallets.length > 0
|
|
462
|
+
? await nonceManager.getNextNoncesForWallets(otherWallets)
|
|
463
|
+
: [];
|
|
458
464
|
// 组装最终的 nonces 数组(保持原顺序)
|
|
459
465
|
nonces = [];
|
|
460
466
|
let otherIdx = 0;
|
|
@@ -485,7 +491,7 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
485
491
|
outputToken, // ✅ 使用动态 outputToken
|
|
486
492
|
inputAmount: amountsWei[i],
|
|
487
493
|
minOutputAmount: minOuts[i],
|
|
488
|
-
permitData: '0x'
|
|
494
|
+
permitData: '0x'
|
|
489
495
|
})));
|
|
490
496
|
// ✅ 贿赂交易放在首位
|
|
491
497
|
const bribeTxs = [];
|
|
@@ -497,7 +503,7 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
497
503
|
gasPrice,
|
|
498
504
|
gasLimit: GAS_LIMITS.BRIBE,
|
|
499
505
|
chainId,
|
|
500
|
-
type: getTxType(config)
|
|
506
|
+
type: getTxType(config)
|
|
501
507
|
});
|
|
502
508
|
bribeTxs.push(bribeTx);
|
|
503
509
|
}
|
|
@@ -511,13 +517,14 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
511
517
|
gasPrice,
|
|
512
518
|
chainId,
|
|
513
519
|
type: getTxType(config),
|
|
514
|
-
value: 0n
|
|
520
|
+
value: 0n // ✅ 卖出交易不发送原生代币
|
|
515
521
|
})));
|
|
516
522
|
// ✅ 利润多跳转账
|
|
517
523
|
const profitTxs = [];
|
|
518
524
|
let profitHopWallets;
|
|
519
525
|
// ✅ 检查是否使用分布式利润模式
|
|
520
|
-
const profitMode = config.profitMode
|
|
526
|
+
const profitMode = config.profitMode || 'single';
|
|
527
|
+
console.log('🔧 [SDK batchSellWithBundleMerkle] config.profitMode:', config.profitMode, '-> resolved:', profitMode, 'wallets:', wallets.length);
|
|
521
528
|
if (needProfitTx) {
|
|
522
529
|
// ERC20 输出时:获取代币利润等值的原生代币(BNB)报价
|
|
523
530
|
let totalNativeProfitAmount = totalTokenProfit;
|
|
@@ -551,7 +558,7 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
551
558
|
gasPrice,
|
|
552
559
|
chainId,
|
|
553
560
|
txType: getTxType(config),
|
|
554
|
-
startNonce: walletProfitNonce
|
|
561
|
+
startNonce: walletProfitNonce
|
|
555
562
|
});
|
|
556
563
|
profitTxs.push(...profitHopResult.signedTransactions);
|
|
557
564
|
if (profitHopResult.hopWallets) {
|
|
@@ -573,7 +580,7 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
573
580
|
gasPrice,
|
|
574
581
|
chainId,
|
|
575
582
|
txType: getTxType(config),
|
|
576
|
-
startNonce: profitNonce
|
|
583
|
+
startNonce: profitNonce
|
|
577
584
|
});
|
|
578
585
|
profitTxs.push(...profitHopResult.signedTransactions);
|
|
579
586
|
profitHopWallets = profitHopResult.hopWallets;
|
|
@@ -589,7 +596,7 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
589
596
|
metadata: {
|
|
590
597
|
profitMode, // ✅ 返回使用的利润模式
|
|
591
598
|
totalProfit: totalTokenProfit.toString(),
|
|
592
|
-
}
|
|
599
|
+
}
|
|
593
600
|
};
|
|
594
601
|
}
|
|
595
602
|
// ✅ Provider 缓存(复用连接,减少初始化开销)
|
|
@@ -610,27 +617,29 @@ function createChainContext(chain, rpcUrl) {
|
|
|
610
617
|
return { chainId, provider };
|
|
611
618
|
}
|
|
612
619
|
async function resolveGasPrice(provider, config) {
|
|
613
|
-
|
|
614
|
-
|
|
620
|
+
// ✅ 优化:如果前端传入了 gasPrice,直接使用(跳过 RPC 调用)
|
|
621
|
+
if (config.gasPrice !== undefined) {
|
|
622
|
+
const gasPrice = config.gasPrice;
|
|
623
|
+
return gasPrice;
|
|
615
624
|
}
|
|
616
625
|
return await getOptimizedGasPrice(provider, getGasPriceConfig(config));
|
|
617
626
|
}
|
|
618
627
|
function createWallets(privateKeys, provider) {
|
|
619
|
-
return privateKeys.map(
|
|
628
|
+
return privateKeys.map(key => new Wallet(key, provider));
|
|
620
629
|
}
|
|
621
630
|
function analyzeBuyFunds(buyAmounts, config, extractProfit) {
|
|
622
631
|
const result = {
|
|
623
632
|
fundsList: [],
|
|
624
633
|
originalAmounts: [],
|
|
625
634
|
totalBuyAmount: 0n,
|
|
626
|
-
totalProfit: 0n
|
|
635
|
+
totalProfit: 0n
|
|
627
636
|
};
|
|
628
|
-
buyAmounts.forEach(
|
|
637
|
+
buyAmounts.forEach(amount => {
|
|
629
638
|
const originalAmount = ethers.parseEther(amount);
|
|
630
639
|
result.originalAmounts.push(originalAmount);
|
|
631
640
|
result.totalBuyAmount += originalAmount;
|
|
632
641
|
if (extractProfit) {
|
|
633
|
-
const { remaining, profit } = calculateProfit(originalAmount);
|
|
642
|
+
const { remaining, profit } = calculateProfit(originalAmount, config);
|
|
634
643
|
result.totalProfit += profit;
|
|
635
644
|
result.fundsList.push(remaining);
|
|
636
645
|
}
|
|
@@ -659,13 +668,13 @@ function findMaxIndex(values) {
|
|
|
659
668
|
* 当 inputToken 为非零地址(如 USDC)时,value 为 0
|
|
660
669
|
*/
|
|
661
670
|
async function populateBuyTransactionsWithQuote(buyers, portalAddr, tokenAddress, fundsList, inputToken, useNativeToken) {
|
|
662
|
-
const portals = buyers.map(
|
|
671
|
+
const portals = buyers.map(wallet => new ethers.Contract(portalAddr, PORTAL_ABI, wallet));
|
|
663
672
|
return await Promise.all(portals.map((portal, i) => portal.swapExactInput.populateTransaction({
|
|
664
673
|
inputToken,
|
|
665
674
|
outputToken: tokenAddress,
|
|
666
675
|
inputAmount: fundsList[i],
|
|
667
676
|
minOutputAmount: 0n,
|
|
668
|
-
permitData: '0x'
|
|
677
|
+
permitData: '0x'
|
|
669
678
|
},
|
|
670
679
|
// ✅ 如果使用原生代币,value 为购买金额;否则为 0
|
|
671
680
|
useNativeToken ? { value: fundsList[i] } : {})));
|
|
@@ -702,7 +711,9 @@ async function allocateBuyerNonces(buyers, extractProfit, maxIndex, totalProfit,
|
|
|
702
711
|
const maxIndexNonces = await nonceManager.getNextNonceBatch(buyers[maxIndex], 2);
|
|
703
712
|
// 其他钱包各需要 1 个 nonce
|
|
704
713
|
const otherBuyers = buyers.filter((_, i) => i !== maxIndex);
|
|
705
|
-
const otherNonces = otherBuyers.length > 0
|
|
714
|
+
const otherNonces = otherBuyers.length > 0
|
|
715
|
+
? await nonceManager.getNextNoncesForWallets(otherBuyers)
|
|
716
|
+
: [];
|
|
706
717
|
// 组装最终的 nonces 数组(保持原顺序)
|
|
707
718
|
const nonces = [];
|
|
708
719
|
let otherIdx = 0;
|
|
@@ -716,7 +727,7 @@ async function allocateBuyerNonces(buyers, extractProfit, maxIndex, totalProfit,
|
|
|
716
727
|
}
|
|
717
728
|
return nonces;
|
|
718
729
|
}
|
|
719
|
-
async function signBuyTransactions({ unsignedBuys, buyers, nonces, gasLimits, gasPrice, chainId, config, fundsList, useNativeToken = true
|
|
730
|
+
async function signBuyTransactions({ unsignedBuys, buyers, nonces, gasLimits, gasPrice, chainId, config, fundsList, useNativeToken = true // ✅ 默认使用原生代币
|
|
720
731
|
}) {
|
|
721
732
|
return await Promise.all(unsignedBuys.map((unsigned, i) => buyers[i].signTransaction({
|
|
722
733
|
...unsigned,
|
|
@@ -726,7 +737,7 @@ async function signBuyTransactions({ unsignedBuys, buyers, nonces, gasLimits, ga
|
|
|
726
737
|
gasPrice,
|
|
727
738
|
chainId,
|
|
728
739
|
type: getTxType(config),
|
|
729
|
-
value: useNativeToken ? fundsList[i] : 0n
|
|
740
|
+
value: useNativeToken ? fundsList[i] : 0n // ✅ 非原生代币时 value 为 0
|
|
730
741
|
})));
|
|
731
742
|
}
|
|
732
743
|
function buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, buyerCount) {
|
|
@@ -737,7 +748,7 @@ function buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, buyerCo
|
|
|
737
748
|
totalBuyAmount: ethers.formatEther(totalBuyAmount),
|
|
738
749
|
profitAmount: ethers.formatEther(totalProfit),
|
|
739
750
|
profitRecipient: getProfitRecipient(),
|
|
740
|
-
buyerCount
|
|
751
|
+
buyerCount
|
|
741
752
|
};
|
|
742
753
|
}
|
|
743
754
|
/**
|
|
@@ -753,7 +764,7 @@ async function quoteSellOutputsWithQuote(portal, tokenAddress, amountsWei, outpu
|
|
|
753
764
|
const result = await portal.quoteExactInput.staticCall({
|
|
754
765
|
inputToken: tokenAddress,
|
|
755
766
|
outputToken,
|
|
756
|
-
inputAmount: amountsWei[0]
|
|
767
|
+
inputAmount: amountsWei[0]
|
|
757
768
|
});
|
|
758
769
|
return [result];
|
|
759
770
|
}
|
|
@@ -766,16 +777,14 @@ async function quoteSellOutputsWithQuote(portal, tokenAddress, amountsWei, outpu
|
|
|
766
777
|
const portalIface = new Interface(PORTAL_ABI);
|
|
767
778
|
const multicall = new Contract(MULTICALL3_ADDRESS, MULTICALL3_ABI, provider);
|
|
768
779
|
// 构建批量调用
|
|
769
|
-
const calls = amountsWei.map(
|
|
780
|
+
const calls = amountsWei.map(amount => ({
|
|
770
781
|
target: portalAddress,
|
|
771
782
|
allowFailure: true, // 允许单个失败
|
|
772
|
-
callData: portalIface.encodeFunctionData('quoteExactInput', [
|
|
773
|
-
{
|
|
783
|
+
callData: portalIface.encodeFunctionData('quoteExactInput', [{
|
|
774
784
|
inputToken: tokenAddress,
|
|
775
785
|
outputToken,
|
|
776
|
-
inputAmount: amount
|
|
777
|
-
}
|
|
778
|
-
]),
|
|
786
|
+
inputAmount: amount
|
|
787
|
+
}])
|
|
779
788
|
}));
|
|
780
789
|
try {
|
|
781
790
|
const results = await multicall.aggregate3.staticCall(calls);
|
|
@@ -799,7 +808,7 @@ async function quoteSellOutputsWithQuote(portal, tokenAddress, amountsWei, outpu
|
|
|
799
808
|
return await portal.quoteExactInput.staticCall({
|
|
800
809
|
inputToken: tokenAddress,
|
|
801
810
|
outputToken,
|
|
802
|
-
inputAmount: amount
|
|
811
|
+
inputAmount: amount
|
|
803
812
|
});
|
|
804
813
|
}
|
|
805
814
|
catch {
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* 3. 买到毕业(代币上 DEX)
|
|
8
8
|
* 4. 多个钱包在 PancakeSwap(外盘)继续买入
|
|
9
9
|
*/
|
|
10
|
-
import type { TaxVaultConfig } from '../vault.js';
|
|
11
10
|
import { type FlapSignConfig } from './config.js';
|
|
12
11
|
import type { MerkleSignedResult } from './types.js';
|
|
13
12
|
export type CreateToDexChain = 'bsc' | 'xlayer' | 'base';
|
|
@@ -76,22 +75,10 @@ export interface FlapCreateToDexParams {
|
|
|
76
75
|
dexId?: number;
|
|
77
76
|
/** V4 参数:LP 费率档位(0=STANDARD 0.25%, 1=LOW 0.01%, 2=HIGH 1%) */
|
|
78
77
|
lpFeeProfile?: number;
|
|
79
|
-
/**
|
|
80
|
-
taxV2Config?:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
buyTaxRate?: number;
|
|
84
|
-
sellTaxRate?: number;
|
|
85
|
-
dividendToken?: string;
|
|
86
|
-
commissionReceiver?: string;
|
|
87
|
-
mktBps: number;
|
|
88
|
-
deflationBps: number;
|
|
89
|
-
dividendBps: number;
|
|
90
|
-
lpBps: number;
|
|
91
|
-
minimumShareBalance?: number;
|
|
92
|
-
/** ✅ Tax Vault 金库配置(可选) */
|
|
93
|
-
vaultConfig?: TaxVaultConfig;
|
|
94
|
-
};
|
|
78
|
+
/** 高级税收配置(newTokenV6 / newTokenV6WithVault) */
|
|
79
|
+
taxV2Config?: import('./types.js').TaxV2Config;
|
|
80
|
+
buyTaxRate?: number;
|
|
81
|
+
sellTaxRate?: number;
|
|
95
82
|
/** V3 扩展 ID */
|
|
96
83
|
extensionID?: string;
|
|
97
84
|
/** V3 扩展数据 */
|