four-flap-meme-sdk 2.2.0 → 2.2.2
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.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 +4 -4
- 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 +4 -8
- 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.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 +97 -26
- 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 +301 -58
- 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 +158 -83
- 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 +85 -20
- package/dist/index.js +215 -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 +252 -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 +5 -5
- package/dist/shared/clients/four.js +17 -21
- 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 +3 -2
- 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 +3 -3
- package/dist/shared/flap/index.js +3 -3
- package/dist/shared/flap/meta.d.ts +18 -16
- package/dist/shared/flap/meta.js +17 -12
- package/dist/shared/flap/permit.js +2 -5
- package/dist/shared/flap/pinata.d.ts +4 -11
- package/dist/shared/flap/pinata.js +16 -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 +172 -92
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +99 -106
- 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 +7 -73
- 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.d.ts +3 -1
- package/dist/shared/flap/portal.js +25 -32
- package/dist/shared/flap/vanity.d.ts +5 -1
- package/dist/shared/flap/vanity.js +17 -6
- package/dist/shared/flap/vault.d.ts +124 -17
- package/dist/shared/flap/vault.js +148 -67
- 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 +54 -40
- 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 +10 -5
- package/dist/utils/wallet.d.ts +25 -2
- package/dist/utils/wallet.js +8 -9
- package/package.json +4 -159
- 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 -260
- 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 -34
- 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 -39
- 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 -180
- 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,15 +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
|
-
|
|
7
|
+
import { buildNewTokenV6WithVaultParams, VAULT_PORTAL_ADDRESSES, VAULT_PORTAL_ABI } from '../vault.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;
|
|
24
|
+
/**
|
|
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
|
|
31
|
+
*/
|
|
32
|
+
async function getTokenToNativeQuote(provider, tokenAddress, tokenAmount, chainId) {
|
|
33
|
+
if (tokenAmount <= 0n)
|
|
34
|
+
return 0n;
|
|
35
|
+
try {
|
|
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;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// 报价失败返回 0(可能是流动性不足或路径不存在)
|
|
65
|
+
return 0n;
|
|
66
|
+
}
|
|
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
|
+
*/
|
|
13
90
|
export async function createTokenWithBundleBuyMerkle(params) {
|
|
14
91
|
const { chain, privateKeys, buyAmounts, tokenInfo, tokenAddress, config } = params;
|
|
15
92
|
if (privateKeys.length === 0) {
|
|
@@ -43,41 +120,31 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
43
120
|
if (total !== 10000) {
|
|
44
121
|
throw new Error(`Tax distribution must sum to 10000 (100%), got ${total}`);
|
|
45
122
|
}
|
|
46
|
-
// ✅ 判断是否使用金库模式(VaultPortal.
|
|
123
|
+
// ✅ 判断是否使用金库模式(VaultPortal.newTokenV6WithVault + TOKEN_TAXED_V3)
|
|
47
124
|
const hasVault = tv2.vaultConfig && tv2.vaultConfig.vaultType !== 'none';
|
|
48
125
|
if (hasVault) {
|
|
49
|
-
// ✅ 金库模式:通过 VaultPortal.
|
|
126
|
+
// ✅ 金库模式:通过 VaultPortal.newTokenV6WithVault 创建代币
|
|
50
127
|
const vaultPortalAddr = VAULT_PORTAL_ADDRESSES[chain];
|
|
51
128
|
if (!vaultPortalAddr) {
|
|
52
129
|
throw new Error(`链 "${chain}" 不支持 Tax Vault 金库功能`);
|
|
53
130
|
}
|
|
54
131
|
const vaultPortal = new ethers.Contract(vaultPortalAddr, VAULT_PORTAL_ABI, devWallet);
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
132
|
+
const v6Params = buildNewTokenV6WithVaultParams({
|
|
133
|
+
tokenInfo,
|
|
134
|
+
taxV2: tv2,
|
|
135
|
+
chain,
|
|
136
|
+
salt: params.salt ?? ('0x' + '00'.repeat(32)),
|
|
137
|
+
taxRate: params.taxRate ?? 0,
|
|
138
|
+
buyTaxRate: params.buyTaxRate,
|
|
139
|
+
sellTaxRate: params.sellTaxRate,
|
|
140
|
+
dexThresh: params.dexThresh,
|
|
141
|
+
migratorType: params.migratorType,
|
|
142
|
+
quoteToken: params.quoteToken,
|
|
65
143
|
quoteAmt: 0n,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
extensionData: '0x',
|
|
69
|
-
dexId: (params.dexId ?? 0) & 0xff,
|
|
70
|
-
lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff,
|
|
71
|
-
taxDuration: BigInt(tv2.taxDuration),
|
|
72
|
-
antiFarmerDuration: BigInt(tv2.antiFarmerDuration),
|
|
73
|
-
mktBps: dist.mktBps,
|
|
74
|
-
deflationBps: dist.deflationBps,
|
|
75
|
-
dividendBps: dist.dividendBps,
|
|
76
|
-
lpBps: dist.lpBps,
|
|
77
|
-
minimumShareBalance: BigInt(dist.minimumShareBalance ?? 10000) * 10n ** 18n,
|
|
78
|
-
vaultFactory,
|
|
79
|
-
vaultData,
|
|
144
|
+
dexId: params.dexId,
|
|
145
|
+
lpFeeProfile: params.lpFeeProfile,
|
|
80
146
|
});
|
|
147
|
+
createTxPromise = vaultPortal.newTokenV6WithVault.populateTransaction(v6Params);
|
|
81
148
|
}
|
|
82
149
|
else {
|
|
83
150
|
// 标准 V5: Portal.newTokenV5(无金库)
|
|
@@ -103,7 +170,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
103
170
|
deflationBps: dist.deflationBps,
|
|
104
171
|
dividendBps: dist.dividendBps,
|
|
105
172
|
lpBps: dist.lpBps,
|
|
106
|
-
minimumShareBalance: BigInt(dist.minimumShareBalance ?? 10000) * 10n ** 18n,
|
|
173
|
+
minimumShareBalance: BigInt(dist.minimumShareBalance ?? 10000) * (10n ** 18n),
|
|
107
174
|
});
|
|
108
175
|
}
|
|
109
176
|
}
|
|
@@ -124,7 +191,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
124
191
|
extensionID: params.extensionID ?? '0x' + '00'.repeat(32),
|
|
125
192
|
extensionData: params.extensionData ?? '0x',
|
|
126
193
|
dexId: (params.dexId ?? 0) & 0xff,
|
|
127
|
-
lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff
|
|
194
|
+
lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff
|
|
128
195
|
});
|
|
129
196
|
}
|
|
130
197
|
else if (useV3) {
|
|
@@ -142,7 +209,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
142
209
|
beneficiary: devWallet.address,
|
|
143
210
|
permitData: '0x',
|
|
144
211
|
extensionID: params.extensionID,
|
|
145
|
-
extensionData: params.extensionData ?? '0x'
|
|
212
|
+
extensionData: params.extensionData ?? '0x'
|
|
146
213
|
});
|
|
147
214
|
}
|
|
148
215
|
else {
|
|
@@ -158,13 +225,13 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
158
225
|
quoteToken: params.quoteToken || ZERO_ADDRESS,
|
|
159
226
|
quoteAmt: 0n,
|
|
160
227
|
beneficiary: devWallet.address,
|
|
161
|
-
permitData: '0x'
|
|
228
|
+
permitData: '0x'
|
|
162
229
|
});
|
|
163
230
|
}
|
|
164
231
|
const [gasPrice, createTxUnsigned, devNonce] = await Promise.all([
|
|
165
232
|
resolveGasPrice(provider, config),
|
|
166
233
|
createTxPromise,
|
|
167
|
-
nonceManager.getNextNonce(devWallet)
|
|
234
|
+
nonceManager.getNextNonce(devWallet)
|
|
168
235
|
]);
|
|
169
236
|
const createTxRequest = {
|
|
170
237
|
...createTxUnsigned,
|
|
@@ -173,12 +240,12 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
173
240
|
gasLimit: getGasLimit(config),
|
|
174
241
|
gasPrice,
|
|
175
242
|
chainId,
|
|
176
|
-
type: getTxType(config)
|
|
243
|
+
type: getTxType(config)
|
|
177
244
|
};
|
|
178
245
|
const signedCreateTx = await devWallet.signTransaction(createTxRequest);
|
|
179
246
|
signedTxs.push(signedCreateTx);
|
|
180
247
|
const buyers = createWallets(privateKeys.slice(1), provider);
|
|
181
|
-
const extractProfit = shouldExtractProfit();
|
|
248
|
+
const extractProfit = shouldExtractProfit(config);
|
|
182
249
|
const { fundsList, originalAmounts, totalBuyAmount, totalProfit } = analyzeBuyFunds(buyAmounts, config, extractProfit);
|
|
183
250
|
const maxFundsIndex = findMaxIndex(originalAmounts);
|
|
184
251
|
const gasLimits = buildGasLimitList(buyers.length, config);
|
|
@@ -191,13 +258,13 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
191
258
|
if (!useNativeToken && params.quoteTokenDecimals !== undefined && params.quoteTokenDecimals !== 18) {
|
|
192
259
|
const decimalsDiff = 18 - params.quoteTokenDecimals;
|
|
193
260
|
const divisor = BigInt(10 ** decimalsDiff);
|
|
194
|
-
adjustedFundsList = fundsList.map(
|
|
261
|
+
adjustedFundsList = fundsList.map(amount => amount / divisor);
|
|
195
262
|
profitTokenAmount = totalProfit / divisor;
|
|
196
263
|
}
|
|
197
264
|
// ✅ 优化:并行获取 unsignedBuys 和 buyerNonces
|
|
198
265
|
const [unsignedBuys, buyerNonces] = await Promise.all([
|
|
199
266
|
populateBuyTransactionsWithQuote(buyers, portalAddr, tokenAddress, adjustedFundsList, inputToken, useNativeToken),
|
|
200
|
-
allocateBuyerNonces(buyers, extractProfit, maxFundsIndex, useNativeToken ? totalProfit : profitTokenAmount, nonceManager)
|
|
267
|
+
allocateBuyerNonces(buyers, extractProfit, maxFundsIndex, useNativeToken ? totalProfit : profitTokenAmount, nonceManager)
|
|
201
268
|
]);
|
|
202
269
|
// ✅ 贿赂交易放在首位(提高 BlockRazor 打包优先级)
|
|
203
270
|
const bribeAmount = getBribeAmount(config);
|
|
@@ -212,7 +279,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
212
279
|
gasPrice,
|
|
213
280
|
gasLimit: GAS_LIMITS.BRIBE,
|
|
214
281
|
chainId,
|
|
215
|
-
type: getTxType(config)
|
|
282
|
+
type: getTxType(config)
|
|
216
283
|
});
|
|
217
284
|
bribeTxs.push(bribeTx);
|
|
218
285
|
// 调整 maxFundsIndex 钱包的 nonce(买入交易 +1)
|
|
@@ -227,7 +294,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
227
294
|
chainId,
|
|
228
295
|
config,
|
|
229
296
|
fundsList: adjustedFundsList, // ✅ 使用调整后的金额
|
|
230
|
-
useNativeToken
|
|
297
|
+
useNativeToken // ✅ 传递是否使用原生代币
|
|
231
298
|
});
|
|
232
299
|
// ✅ 利润多跳转账(强制 2 跳中转)
|
|
233
300
|
const profitTxs = [];
|
|
@@ -248,7 +315,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
248
315
|
gasPrice,
|
|
249
316
|
chainId,
|
|
250
317
|
txType: getTxType(config),
|
|
251
|
-
startNonce: profitNonce
|
|
318
|
+
startNonce: profitNonce
|
|
252
319
|
});
|
|
253
320
|
profitTxs.push(...profitHopResult.signedTransactions);
|
|
254
321
|
profitHopWallets = profitHopResult.hopWallets; // ✅ 收集利润多跳钱包
|
|
@@ -260,7 +327,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
260
327
|
signedTransactions: [...bribeTxs, ...signedTxs, ...signedBuys, ...profitTxs],
|
|
261
328
|
tokenAddress,
|
|
262
329
|
profitHopWallets, // ✅ 返回利润多跳钱包
|
|
263
|
-
metadata: buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, buyers.length)
|
|
330
|
+
metadata: buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, buyers.length)
|
|
264
331
|
};
|
|
265
332
|
}
|
|
266
333
|
/**
|
|
@@ -275,8 +342,9 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
275
342
|
}
|
|
276
343
|
const { provider, chainId } = createChainContext(chain, config.rpcUrl);
|
|
277
344
|
const nonceManager = new NonceManager(provider);
|
|
345
|
+
const signedTxs = [];
|
|
278
346
|
const buyers = createWallets(privateKeys, provider);
|
|
279
|
-
const extractProfit = shouldExtractProfit();
|
|
347
|
+
const extractProfit = shouldExtractProfit(config);
|
|
280
348
|
const { fundsList, originalAmounts, totalBuyAmount, totalProfit } = analyzeBuyFunds(buyAmounts, config, extractProfit);
|
|
281
349
|
const maxFundsIndex = findMaxIndex(originalAmounts);
|
|
282
350
|
const gasLimits = buildGasLimitList(buyers.length, config);
|
|
@@ -294,7 +362,7 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
294
362
|
// 转为 USDC (6位) = 100000 (0.1 USDC)
|
|
295
363
|
const decimalsDiff = 18 - quoteTokenDecimals;
|
|
296
364
|
const divisor = BigInt(10 ** decimalsDiff);
|
|
297
|
-
adjustedFundsList = fundsList.map(
|
|
365
|
+
adjustedFundsList = fundsList.map(amount => amount / divisor);
|
|
298
366
|
profitTokenAmount = totalProfit / divisor;
|
|
299
367
|
}
|
|
300
368
|
// ✅ ERC20 购买:获取代币利润等值的原生代币(BNB)报价
|
|
@@ -311,8 +379,10 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
311
379
|
populateBuyTransactionsWithQuote(buyers, FLAP_PORTAL_ADDRESSES[chain], tokenAddress, adjustedFundsList, inputToken, useNativeToken),
|
|
312
380
|
presetNonces && presetNonces.length === buyers.length
|
|
313
381
|
? adjustNoncesForProfit(presetNonces) // ✅ 调整 nonces 避免冲突
|
|
314
|
-
: allocateBuyerNonces(buyers, extractProfit, maxFundsIndex, nativeProfitAmount, nonceManager)
|
|
382
|
+
: allocateBuyerNonces(buyers, extractProfit, maxFundsIndex, nativeProfitAmount, nonceManager)
|
|
315
383
|
]);
|
|
384
|
+
if (presetNonces) {
|
|
385
|
+
}
|
|
316
386
|
// ✅ 贿赂交易放在首位(提高 BlockRazor 打包优先级)
|
|
317
387
|
const bribeAmount = getBribeAmount(config);
|
|
318
388
|
const bribeTxs = [];
|
|
@@ -325,7 +395,7 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
325
395
|
gasPrice,
|
|
326
396
|
gasLimit: GAS_LIMITS.BRIBE,
|
|
327
397
|
chainId,
|
|
328
|
-
type: getTxType(config)
|
|
398
|
+
type: getTxType(config)
|
|
329
399
|
});
|
|
330
400
|
bribeTxs.push(bribeTx);
|
|
331
401
|
// 调整 maxFundsIndex 钱包的 nonce(买入交易 +1)
|
|
@@ -340,18 +410,20 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
340
410
|
chainId,
|
|
341
411
|
config,
|
|
342
412
|
fundsList: adjustedFundsList, // ✅ 使用调整后的金额
|
|
343
|
-
useNativeToken
|
|
413
|
+
useNativeToken // ✅ USDT 购买时 value=0,BNB 购买时 value=金额
|
|
344
414
|
});
|
|
345
415
|
// ✅ 利润多跳转账
|
|
346
416
|
const profitTxs = [];
|
|
347
417
|
let profitHopWallets;
|
|
348
418
|
// ✅ 检查是否使用分布式利润模式
|
|
349
|
-
const profitMode = config.profitMode
|
|
419
|
+
const profitMode = config.profitMode || 'single';
|
|
420
|
+
console.log('🔧 [SDK batchBuyWithBundleMerkle] config.profitMode:', config.profitMode, '-> resolved:', profitMode, 'wallets:', buyers.length);
|
|
350
421
|
if (extractProfit && nativeProfitAmount > 0n) {
|
|
351
422
|
if (profitMode === 'distributed') {
|
|
352
423
|
// ✅ 分布式模式:每个钱包独立扣除自己的利润,每个都有独立的多跳
|
|
353
424
|
// 最多支持 12 个钱包(12 交易 + 36 多跳 + 1 贿赂 = 49 笔)
|
|
354
425
|
const MAX_DISTRIBUTED_WALLETS = 12;
|
|
426
|
+
console.log('🔧 [SDK] 使用分布式利润模式,钱包数:', buyers.length);
|
|
355
427
|
if (buyers.length > MAX_DISTRIBUTED_WALLETS) {
|
|
356
428
|
throw new Error(`分布式利润模式最多支持 ${MAX_DISTRIBUTED_WALLETS} 个钱包,当前 ${buyers.length} 个`);
|
|
357
429
|
}
|
|
@@ -361,7 +433,9 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
361
433
|
for (let i = 0; i < buyers.length; i++) {
|
|
362
434
|
const walletOriginalAmount = originalAmounts[i];
|
|
363
435
|
// 按比例计算该钱包应承担的利润
|
|
364
|
-
const walletProfit = totalBuyAmount > 0n
|
|
436
|
+
const walletProfit = totalBuyAmount > 0n
|
|
437
|
+
? (nativeProfitAmount * walletOriginalAmount) / totalBuyAmount
|
|
438
|
+
: 0n;
|
|
365
439
|
perWalletProfits.push(walletProfit);
|
|
366
440
|
}
|
|
367
441
|
// 为每个钱包生成独立的利润多跳交易
|
|
@@ -378,7 +452,7 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
378
452
|
gasPrice,
|
|
379
453
|
chainId,
|
|
380
454
|
txType: getTxType(config),
|
|
381
|
-
startNonce: profitNonce
|
|
455
|
+
startNonce: profitNonce
|
|
382
456
|
});
|
|
383
457
|
profitTxs.push(...profitHopResult.signedTransactions);
|
|
384
458
|
if (profitHopResult.hopWallets) {
|
|
@@ -400,7 +474,7 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
400
474
|
gasPrice,
|
|
401
475
|
chainId,
|
|
402
476
|
txType: getTxType(config),
|
|
403
|
-
startNonce: profitNonce
|
|
477
|
+
startNonce: profitNonce
|
|
404
478
|
});
|
|
405
479
|
profitTxs.push(...profitHopResult.signedTransactions);
|
|
406
480
|
profitHopWallets = profitHopResult.hopWallets;
|
|
@@ -415,7 +489,7 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
415
489
|
metadata: {
|
|
416
490
|
...buildProfitMetadata(extractProfit, totalBuyAmount, nativeProfitAmount, buyers.length),
|
|
417
491
|
profitMode, // ✅ 返回使用的利润模式
|
|
418
|
-
}
|
|
492
|
+
}
|
|
419
493
|
};
|
|
420
494
|
}
|
|
421
495
|
/**
|
|
@@ -430,22 +504,23 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
430
504
|
}
|
|
431
505
|
const { provider, chainId } = createChainContext(chain, config.rpcUrl);
|
|
432
506
|
const nonceManager = new NonceManager(provider);
|
|
507
|
+
const signedTxs = [];
|
|
433
508
|
const wallets = createWallets(privateKeys, provider);
|
|
434
|
-
const amountsWei = sellAmounts.map(
|
|
509
|
+
const amountsWei = sellAmounts.map(a => ethers.parseUnits(a, 18));
|
|
435
510
|
const portalAddr = FLAP_PORTAL_ADDRESSES[chain];
|
|
436
511
|
const readOnlyPortal = new ethers.Contract(portalAddr, PORTAL_ABI, provider);
|
|
437
512
|
const gasLimits = buildGasLimitList(wallets.length, config);
|
|
438
|
-
const portals = wallets.map(
|
|
513
|
+
const portals = wallets.map(w => new ethers.Contract(portalAddr, PORTAL_ABI, w));
|
|
439
514
|
// ✅ 确定 outputToken:如果传入了 quoteToken 且非零地址,则使用它;否则使用零地址(原生代币)
|
|
440
515
|
const outputToken = quoteToken && quoteToken !== ZERO_ADDRESS ? quoteToken : ZERO_ADDRESS;
|
|
441
516
|
const useNativeOutput = outputToken === ZERO_ADDRESS;
|
|
442
517
|
// ✅ 优化:如果前端传入了 nonces,直接使用(跳过 RPC 调用)
|
|
443
518
|
const presetNonces = config.nonces;
|
|
444
|
-
const extractProfit = shouldExtractProfit();
|
|
519
|
+
const extractProfit = shouldExtractProfit(config);
|
|
445
520
|
// ✅ 并行执行 gasPrice 和 quoteSellOutputs(Multicall3)
|
|
446
521
|
const [gasPrice, quotedOutputs] = await Promise.all([
|
|
447
522
|
resolveGasPrice(provider, config),
|
|
448
|
-
quoteSellOutputsWithQuote(readOnlyPortal, tokenAddress, amountsWei, outputToken)
|
|
523
|
+
quoteSellOutputsWithQuote(readOnlyPortal, tokenAddress, amountsWei, outputToken)
|
|
449
524
|
]);
|
|
450
525
|
// ✅ 计算利润和 maxRevenueIndex(用于 nonce 分配)
|
|
451
526
|
let totalTokenProfit = 0n;
|
|
@@ -455,7 +530,7 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
455
530
|
for (let i = 0; i < wallets.length; i++) {
|
|
456
531
|
const quoted = quotedOutputs[i];
|
|
457
532
|
if (quoted > 0n) {
|
|
458
|
-
const { profit } = calculateProfit(quoted);
|
|
533
|
+
const { profit } = calculateProfit(quoted, config);
|
|
459
534
|
totalTokenProfit += profit;
|
|
460
535
|
if (quoted > maxRevenue) {
|
|
461
536
|
maxRevenue = quoted;
|
|
@@ -487,7 +562,9 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
487
562
|
const maxRevenueNonces = await nonceManager.getNextNonceBatch(wallets[maxRevenueIndex], maxRevenueNonceCount);
|
|
488
563
|
// 其他钱包各需要 1 个 nonce
|
|
489
564
|
const otherWallets = wallets.filter((_, i) => i !== maxRevenueIndex);
|
|
490
|
-
const otherNonces = otherWallets.length > 0
|
|
565
|
+
const otherNonces = otherWallets.length > 0
|
|
566
|
+
? await nonceManager.getNextNoncesForWallets(otherWallets)
|
|
567
|
+
: [];
|
|
491
568
|
// 组装最终的 nonces 数组(保持原顺序)
|
|
492
569
|
nonces = [];
|
|
493
570
|
let otherIdx = 0;
|
|
@@ -518,7 +595,7 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
518
595
|
outputToken, // ✅ 使用动态 outputToken
|
|
519
596
|
inputAmount: amountsWei[i],
|
|
520
597
|
minOutputAmount: minOuts[i],
|
|
521
|
-
permitData: '0x'
|
|
598
|
+
permitData: '0x'
|
|
522
599
|
})));
|
|
523
600
|
// ✅ 贿赂交易放在首位
|
|
524
601
|
const bribeTxs = [];
|
|
@@ -530,7 +607,7 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
530
607
|
gasPrice,
|
|
531
608
|
gasLimit: GAS_LIMITS.BRIBE,
|
|
532
609
|
chainId,
|
|
533
|
-
type: getTxType(config)
|
|
610
|
+
type: getTxType(config)
|
|
534
611
|
});
|
|
535
612
|
bribeTxs.push(bribeTx);
|
|
536
613
|
}
|
|
@@ -544,13 +621,14 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
544
621
|
gasPrice,
|
|
545
622
|
chainId,
|
|
546
623
|
type: getTxType(config),
|
|
547
|
-
value: 0n
|
|
624
|
+
value: 0n // ✅ 卖出交易不发送原生代币
|
|
548
625
|
})));
|
|
549
626
|
// ✅ 利润多跳转账
|
|
550
627
|
const profitTxs = [];
|
|
551
628
|
let profitHopWallets;
|
|
552
629
|
// ✅ 检查是否使用分布式利润模式
|
|
553
|
-
const profitMode = config.profitMode
|
|
630
|
+
const profitMode = config.profitMode || 'single';
|
|
631
|
+
console.log('🔧 [SDK batchSellWithBundleMerkle] config.profitMode:', config.profitMode, '-> resolved:', profitMode, 'wallets:', wallets.length);
|
|
554
632
|
if (needProfitTx) {
|
|
555
633
|
// ERC20 输出时:获取代币利润等值的原生代币(BNB)报价
|
|
556
634
|
let totalNativeProfitAmount = totalTokenProfit;
|
|
@@ -584,7 +662,7 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
584
662
|
gasPrice,
|
|
585
663
|
chainId,
|
|
586
664
|
txType: getTxType(config),
|
|
587
|
-
startNonce: walletProfitNonce
|
|
665
|
+
startNonce: walletProfitNonce
|
|
588
666
|
});
|
|
589
667
|
profitTxs.push(...profitHopResult.signedTransactions);
|
|
590
668
|
if (profitHopResult.hopWallets) {
|
|
@@ -606,7 +684,7 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
606
684
|
gasPrice,
|
|
607
685
|
chainId,
|
|
608
686
|
txType: getTxType(config),
|
|
609
|
-
startNonce: profitNonce
|
|
687
|
+
startNonce: profitNonce
|
|
610
688
|
});
|
|
611
689
|
profitTxs.push(...profitHopResult.signedTransactions);
|
|
612
690
|
profitHopWallets = profitHopResult.hopWallets;
|
|
@@ -622,7 +700,7 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
622
700
|
metadata: {
|
|
623
701
|
profitMode, // ✅ 返回使用的利润模式
|
|
624
702
|
totalProfit: totalTokenProfit.toString(),
|
|
625
|
-
}
|
|
703
|
+
}
|
|
626
704
|
};
|
|
627
705
|
}
|
|
628
706
|
// ✅ Provider 缓存(复用连接,减少初始化开销)
|
|
@@ -643,27 +721,29 @@ function createChainContext(chain, rpcUrl) {
|
|
|
643
721
|
return { chainId, provider };
|
|
644
722
|
}
|
|
645
723
|
async function resolveGasPrice(provider, config) {
|
|
646
|
-
|
|
647
|
-
|
|
724
|
+
// ✅ 优化:如果前端传入了 gasPrice,直接使用(跳过 RPC 调用)
|
|
725
|
+
if (config.gasPrice !== undefined) {
|
|
726
|
+
const gasPrice = config.gasPrice;
|
|
727
|
+
return gasPrice;
|
|
648
728
|
}
|
|
649
729
|
return await getOptimizedGasPrice(provider, getGasPriceConfig(config));
|
|
650
730
|
}
|
|
651
731
|
function createWallets(privateKeys, provider) {
|
|
652
|
-
return privateKeys.map(
|
|
732
|
+
return privateKeys.map(key => new Wallet(key, provider));
|
|
653
733
|
}
|
|
654
734
|
function analyzeBuyFunds(buyAmounts, config, extractProfit) {
|
|
655
735
|
const result = {
|
|
656
736
|
fundsList: [],
|
|
657
737
|
originalAmounts: [],
|
|
658
738
|
totalBuyAmount: 0n,
|
|
659
|
-
totalProfit: 0n
|
|
739
|
+
totalProfit: 0n
|
|
660
740
|
};
|
|
661
|
-
buyAmounts.forEach(
|
|
741
|
+
buyAmounts.forEach(amount => {
|
|
662
742
|
const originalAmount = ethers.parseEther(amount);
|
|
663
743
|
result.originalAmounts.push(originalAmount);
|
|
664
744
|
result.totalBuyAmount += originalAmount;
|
|
665
745
|
if (extractProfit) {
|
|
666
|
-
const { remaining, profit } = calculateProfit(originalAmount);
|
|
746
|
+
const { remaining, profit } = calculateProfit(originalAmount, config);
|
|
667
747
|
result.totalProfit += profit;
|
|
668
748
|
result.fundsList.push(remaining);
|
|
669
749
|
}
|
|
@@ -692,13 +772,13 @@ function findMaxIndex(values) {
|
|
|
692
772
|
* 当 inputToken 为非零地址(如 USDC)时,value 为 0
|
|
693
773
|
*/
|
|
694
774
|
async function populateBuyTransactionsWithQuote(buyers, portalAddr, tokenAddress, fundsList, inputToken, useNativeToken) {
|
|
695
|
-
const portals = buyers.map(
|
|
775
|
+
const portals = buyers.map(wallet => new ethers.Contract(portalAddr, PORTAL_ABI, wallet));
|
|
696
776
|
return await Promise.all(portals.map((portal, i) => portal.swapExactInput.populateTransaction({
|
|
697
777
|
inputToken,
|
|
698
778
|
outputToken: tokenAddress,
|
|
699
779
|
inputAmount: fundsList[i],
|
|
700
780
|
minOutputAmount: 0n,
|
|
701
|
-
permitData: '0x'
|
|
781
|
+
permitData: '0x'
|
|
702
782
|
},
|
|
703
783
|
// ✅ 如果使用原生代币,value 为购买金额;否则为 0
|
|
704
784
|
useNativeToken ? { value: fundsList[i] } : {})));
|
|
@@ -735,7 +815,9 @@ async function allocateBuyerNonces(buyers, extractProfit, maxIndex, totalProfit,
|
|
|
735
815
|
const maxIndexNonces = await nonceManager.getNextNonceBatch(buyers[maxIndex], 2);
|
|
736
816
|
// 其他钱包各需要 1 个 nonce
|
|
737
817
|
const otherBuyers = buyers.filter((_, i) => i !== maxIndex);
|
|
738
|
-
const otherNonces = otherBuyers.length > 0
|
|
818
|
+
const otherNonces = otherBuyers.length > 0
|
|
819
|
+
? await nonceManager.getNextNoncesForWallets(otherBuyers)
|
|
820
|
+
: [];
|
|
739
821
|
// 组装最终的 nonces 数组(保持原顺序)
|
|
740
822
|
const nonces = [];
|
|
741
823
|
let otherIdx = 0;
|
|
@@ -749,7 +831,7 @@ async function allocateBuyerNonces(buyers, extractProfit, maxIndex, totalProfit,
|
|
|
749
831
|
}
|
|
750
832
|
return nonces;
|
|
751
833
|
}
|
|
752
|
-
async function signBuyTransactions({ unsignedBuys, buyers, nonces, gasLimits, gasPrice, chainId, config, fundsList, useNativeToken = true
|
|
834
|
+
async function signBuyTransactions({ unsignedBuys, buyers, nonces, gasLimits, gasPrice, chainId, config, fundsList, useNativeToken = true // ✅ 默认使用原生代币
|
|
753
835
|
}) {
|
|
754
836
|
return await Promise.all(unsignedBuys.map((unsigned, i) => buyers[i].signTransaction({
|
|
755
837
|
...unsigned,
|
|
@@ -759,7 +841,7 @@ async function signBuyTransactions({ unsignedBuys, buyers, nonces, gasLimits, ga
|
|
|
759
841
|
gasPrice,
|
|
760
842
|
chainId,
|
|
761
843
|
type: getTxType(config),
|
|
762
|
-
value: useNativeToken ? fundsList[i] : 0n
|
|
844
|
+
value: useNativeToken ? fundsList[i] : 0n // ✅ 非原生代币时 value 为 0
|
|
763
845
|
})));
|
|
764
846
|
}
|
|
765
847
|
function buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, buyerCount) {
|
|
@@ -770,7 +852,7 @@ function buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, buyerCo
|
|
|
770
852
|
totalBuyAmount: ethers.formatEther(totalBuyAmount),
|
|
771
853
|
profitAmount: ethers.formatEther(totalProfit),
|
|
772
854
|
profitRecipient: getProfitRecipient(),
|
|
773
|
-
buyerCount
|
|
855
|
+
buyerCount
|
|
774
856
|
};
|
|
775
857
|
}
|
|
776
858
|
/**
|
|
@@ -786,7 +868,7 @@ async function quoteSellOutputsWithQuote(portal, tokenAddress, amountsWei, outpu
|
|
|
786
868
|
const result = await portal.quoteExactInput.staticCall({
|
|
787
869
|
inputToken: tokenAddress,
|
|
788
870
|
outputToken,
|
|
789
|
-
inputAmount: amountsWei[0]
|
|
871
|
+
inputAmount: amountsWei[0]
|
|
790
872
|
});
|
|
791
873
|
return [result];
|
|
792
874
|
}
|
|
@@ -799,16 +881,14 @@ async function quoteSellOutputsWithQuote(portal, tokenAddress, amountsWei, outpu
|
|
|
799
881
|
const portalIface = new Interface(PORTAL_ABI);
|
|
800
882
|
const multicall = new Contract(MULTICALL3_ADDRESS, MULTICALL3_ABI, provider);
|
|
801
883
|
// 构建批量调用
|
|
802
|
-
const calls = amountsWei.map(
|
|
884
|
+
const calls = amountsWei.map(amount => ({
|
|
803
885
|
target: portalAddress,
|
|
804
886
|
allowFailure: true, // 允许单个失败
|
|
805
|
-
callData: portalIface.encodeFunctionData('quoteExactInput', [
|
|
806
|
-
{
|
|
887
|
+
callData: portalIface.encodeFunctionData('quoteExactInput', [{
|
|
807
888
|
inputToken: tokenAddress,
|
|
808
889
|
outputToken,
|
|
809
|
-
inputAmount: amount
|
|
810
|
-
}
|
|
811
|
-
]),
|
|
890
|
+
inputAmount: amount
|
|
891
|
+
}])
|
|
812
892
|
}));
|
|
813
893
|
try {
|
|
814
894
|
const results = await multicall.aggregate3.staticCall(calls);
|
|
@@ -832,7 +912,7 @@ async function quoteSellOutputsWithQuote(portal, tokenAddress, amountsWei, outpu
|
|
|
832
912
|
return await portal.quoteExactInput.staticCall({
|
|
833
913
|
inputToken: tokenAddress,
|
|
834
914
|
outputToken,
|
|
835
|
-
inputAmount: amount
|
|
915
|
+
inputAmount: amount
|
|
836
916
|
});
|
|
837
917
|
}
|
|
838
918
|
catch {
|