four-flap-meme-sdk 2.2.2 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +41 -6
- package/README.md +31 -0
- package/README.zh-CN.md +41 -6
- package/dist/__tests__/subpath-exports.test.d.ts +1 -0
- package/dist/__tests__/subpath-exports.test.js +64 -0
- package/dist/abis/common.d.ts +85 -0
- package/dist/abis/common.js +264 -0
- package/dist/abis/contracts/TaxToken.json +969 -0
- package/dist/abis/contracts/TokenManager2.json +136 -0
- package/dist/abis/contracts/index.d.ts +5 -0
- package/dist/abis/contracts/index.js +5 -0
- package/dist/abis/flap/index.d.ts +3 -0
- package/dist/abis/flap/index.js +3 -0
- package/dist/abis/flap/portal-events.d.ts +6 -0
- package/dist/abis/flap/portal-events.js +17 -0
- package/dist/abis/flap/portal.d.ts +6 -0
- package/dist/abis/flap/portal.js +37 -0
- package/dist/abis/flap/vault.d.ts +171 -0
- package/dist/abis/flap/vault.js +91 -0
- package/dist/abis/index.d.ts +8 -0
- package/dist/abis/index.js +11 -0
- package/dist/bundle-core/__tests__/config-helpers.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/config-helpers.test.js +28 -0
- package/dist/bundle-core/__tests__/facade-parity.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/facade-parity.test.js +33 -0
- package/dist/bundle-core/__tests__/sign-context-helpers.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/sign-context-helpers.test.js +60 -0
- package/dist/bundle-core/__tests__/sign-fixture.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/sign-fixture.test.js +220 -0
- package/dist/bundle-core/__tests__/sign-fixtures.d.ts +10 -0
- package/dist/bundle-core/__tests__/sign-fixtures.js +16 -0
- package/dist/bundle-core/config-helpers.d.ts +36 -0
- package/dist/bundle-core/config-helpers.js +57 -0
- package/dist/bundle-core/errors.d.ts +50 -0
- package/dist/bundle-core/errors.js +35 -0
- package/dist/bundle-core/four-meme/approve-tokenmanager.d.ts +7 -0
- package/dist/bundle-core/four-meme/approve-tokenmanager.js +99 -0
- package/dist/bundle-core/four-meme/core-helpers.d.ts +8 -0
- package/dist/bundle-core/four-meme/core-helpers.js +40 -0
- package/dist/bundle-core/four-meme/core.d.ts +4 -0
- package/dist/bundle-core/four-meme/core.js +515 -0
- package/dist/bundle-core/four-meme/pancake-proxy.d.ts +28 -0
- package/dist/bundle-core/four-meme/pancake-proxy.js +679 -0
- package/dist/bundle-core/four-meme/private.d.ts +27 -0
- package/dist/bundle-core/four-meme/private.js +465 -0
- package/dist/bundle-core/four-meme/sign-context-helpers.d.ts +2 -0
- package/dist/bundle-core/four-meme/sign-context-helpers.js +2 -0
- package/dist/bundle-core/four-meme/swap-buy-first.d.ts +8 -0
- package/dist/bundle-core/four-meme/swap-buy-first.js +493 -0
- package/dist/bundle-core/four-meme/swap-hop-helpers.d.ts +6 -0
- package/dist/bundle-core/four-meme/swap-hop-helpers.js +63 -0
- package/dist/bundle-core/four-meme/swap-internal.d.ts +3 -0
- package/dist/bundle-core/four-meme/swap-internal.js +18 -0
- package/dist/bundle-core/four-meme/swap-sign-helpers.d.ts +27 -0
- package/dist/bundle-core/four-meme/swap-sign-helpers.js +105 -0
- package/dist/bundle-core/four-meme/swap.d.ts +17 -0
- package/dist/bundle-core/four-meme/swap.js +505 -0
- package/dist/bundle-core/four-meme/types/buy-first.d.ts +50 -0
- package/dist/bundle-core/four-meme/types/buy-first.js +1 -0
- package/dist/bundle-core/four-meme/types/core-flow.d.ts +63 -0
- package/dist/bundle-core/four-meme/types/core-flow.js +1 -0
- package/dist/bundle-core/four-meme/types/index.d.ts +600 -0
- package/dist/bundle-core/four-meme/types/index.js +1 -0
- package/dist/bundle-core/four-meme/types/swap-internal.d.ts +19 -0
- package/dist/bundle-core/four-meme/types/swap-internal.js +1 -0
- package/dist/bundle-core/four-meme/types.d.ts +1 -0
- package/dist/bundle-core/four-meme/types.js +1 -0
- package/dist/bundle-core/four-meme/utils-disperse.d.ts +7 -0
- package/dist/bundle-core/four-meme/utils-disperse.js +396 -0
- package/dist/bundle-core/four-meme/utils-pairwise.d.ts +8 -0
- package/dist/bundle-core/four-meme/utils-pairwise.js +328 -0
- package/dist/bundle-core/four-meme/utils-sweep.d.ts +8 -0
- package/dist/bundle-core/four-meme/utils-sweep.js +744 -0
- package/dist/bundle-core/index.d.ts +8 -0
- package/dist/bundle-core/index.js +8 -0
- package/dist/bundle-core/internal.d.ts +21 -0
- package/dist/bundle-core/internal.js +182 -0
- package/dist/bundle-core/sign-context-helpers.d.ts +25 -0
- package/dist/bundle-core/sign-context-helpers.js +67 -0
- package/dist/bundle-core/submit.d.ts +293 -0
- package/dist/bundle-core/submit.js +727 -0
- package/dist/bundle-core/types/index.d.ts +8 -0
- package/dist/bundle-core/types/index.js +1 -0
- package/dist/bundle-core/types.d.ts +1 -0
- package/dist/bundle-core/types.js +1 -0
- package/dist/chains/bsc/four/approve-tokenmanager.d.ts +1 -26
- package/dist/chains/bsc/four/approve-tokenmanager.js +1 -113
- package/dist/chains/bsc/four/config.d.ts +5 -67
- package/dist/chains/bsc/four/config.js +2 -114
- package/dist/chains/bsc/four/core.d.ts +1 -4
- package/dist/chains/bsc/four/core.js +1 -592
- package/dist/chains/bsc/four/index.d.ts +6 -6
- package/dist/chains/bsc/four/index.js +6 -6
- package/dist/chains/bsc/four/internal.d.ts +2 -46
- package/dist/chains/bsc/four/internal.js +2 -239
- package/dist/chains/bsc/four/pancake-proxy.d.ts +1 -28
- package/dist/chains/bsc/four/pancake-proxy.js +1 -687
- package/dist/chains/bsc/four/private.d.ts +1 -27
- package/dist/chains/bsc/four/private.js +1 -477
- package/dist/chains/bsc/four/submit.d.ts +2 -315
- package/dist/chains/bsc/four/submit.js +2 -752
- package/dist/chains/bsc/four/swap-buy-first.d.ts +2 -55
- package/dist/chains/bsc/four/swap-buy-first.js +2 -507
- package/dist/chains/bsc/four/swap-internal.d.ts +1 -3
- package/dist/chains/bsc/four/swap-internal.js +1 -18
- package/dist/chains/bsc/four/swap.d.ts +2 -144
- package/dist/chains/bsc/four/swap.js +2 -766
- package/dist/chains/bsc/four/types.d.ts +1 -476
- package/dist/chains/bsc/four/utils-disperse.d.ts +1 -0
- package/dist/chains/bsc/four/utils-disperse.js +1 -0
- package/dist/chains/bsc/four/utils-pairwise.d.ts +1 -0
- package/dist/chains/bsc/four/utils-pairwise.js +1 -0
- package/dist/chains/bsc/four/utils-sweep.d.ts +1 -0
- package/dist/chains/bsc/four/utils-sweep.js +1 -0
- package/dist/chains/bsc/four/utils.d.ts +5 -18
- package/dist/chains/bsc/four/utils.js +5 -1552
- package/dist/chains/bsc/iro.d.ts +5 -0
- package/dist/chains/bsc/iro.js +4 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +159 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +117 -0
- package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +1 -91
- package/dist/chains/bsc/pancake/bundle-buy-first.js +97 -212
- package/dist/chains/bsc/pancake/bundle-swap-helpers.d.ts +241 -0
- package/dist/chains/bsc/pancake/bundle-swap-helpers.js +565 -0
- package/dist/chains/bsc/pancake/bundle-swap.d.ts +1 -79
- package/dist/chains/bsc/pancake/bundle-swap.js +114 -726
- package/dist/chains/bsc/pancake/index.d.ts +4 -2
- package/dist/chains/bsc/pancake/index.js +1 -3
- package/dist/chains/bsc/platforms/iro/factory.d.ts +2 -2
- package/dist/chains/bsc/platforms/iro/factory.js +3 -1
- package/dist/chains/bsc/platforms/iro/index.d.ts +5 -5
- package/dist/chains/bsc/platforms/iro/index.js +3 -3
- package/dist/chains/bsc/platforms/iro/pool.js +31 -10
- package/dist/chains/bsc/platforms/iro/token.js +4 -1
- package/dist/chains/eni/batch-router/bundle-approve.js +4 -3
- package/dist/chains/eni/batch-router/transfer.js +55 -25
- package/dist/chains/eni/batch-router/utils.js +32 -6
- package/dist/chains/eni/bundler/sign.js +5 -6
- package/dist/chains/eni/bundler/submit.js +1 -4
- package/dist/chains/eni/constants.js +1 -1
- package/dist/chains/eni/flat-aliases.d.ts +10 -0
- package/dist/chains/eni/flat-aliases.js +8 -0
- package/dist/chains/eni/index.d.ts +2 -1
- package/dist/chains/eni/index.js +1 -0
- package/dist/chains/eni/platforms/daoaas/create.js +2 -2
- package/dist/chains/eni/platforms/daoaas/index.d.ts +3 -3
- package/dist/chains/eni/platforms/daoaas/index.js +3 -3
- package/dist/chains/eni/platforms/daoaas/meta.js +9 -6
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +28 -44
- package/dist/chains/eni/platforms/daoaas/portal.js +10 -6
- package/dist/chains/eni/platforms/dswap/liquidity.js +58 -26
- package/dist/chains/eni/platforms/fair-launch/index.d.ts +2 -2
- package/dist/chains/eni/platforms/fair-launch/index.js +1 -1
- package/dist/chains/eni/platforms/fair-launch/launcher.js +87 -46
- package/dist/chains/eni/platforms/fair-launch/pool.js +4 -1
- package/dist/chains/eni/platforms/fair-launch/presets.js +2 -2
- package/dist/chains/eni/platforms/iro/factory.d.ts +2 -2
- package/dist/chains/eni/platforms/iro/factory.js +3 -1
- package/dist/chains/eni/platforms/iro/index.d.ts +6 -6
- package/dist/chains/eni/platforms/iro/index.js +4 -4
- package/dist/chains/eni/platforms/iro/pool.js +90 -26
- package/dist/chains/eni/platforms/iro/token.js +107 -31
- package/dist/chains/eni/platforms/iro/whitelist.js +6 -18
- package/dist/chains/eni/submit.d.ts +43 -0
- package/dist/chains/eni/submit.js +286 -0
- package/dist/chains/index.d.ts +13 -0
- package/dist/chains/index.js +13 -0
- package/dist/chains/xlayer/eip7702/bundle-approve.d.ts +2 -26
- package/dist/chains/xlayer/eip7702/bundle-approve.js +11 -21
- package/dist/chains/xlayer/eip7702/bundle-buy.d.ts +2 -6
- package/dist/chains/xlayer/eip7702/bundle-buy.js +13 -51
- package/dist/chains/xlayer/eip7702/bundle-create.js +93 -59
- package/dist/chains/xlayer/eip7702/bundle-sell.d.ts +2 -6
- package/dist/chains/xlayer/eip7702/bundle-sell.js +29 -111
- package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +3 -65
- package/dist/chains/xlayer/eip7702/bundle-swap.js +51 -245
- package/dist/chains/xlayer/eip7702/constants.d.ts +1 -16
- package/dist/chains/xlayer/eip7702/constants.js +3 -21
- package/dist/chains/xlayer/eip7702/flat-aliases.d.ts +13 -0
- package/dist/chains/xlayer/eip7702/flat-aliases.js +10 -0
- package/dist/chains/xlayer/eip7702/index.d.ts +28 -46
- package/dist/chains/xlayer/eip7702/index.js +28 -81
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.d.ts +79 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.js +1 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.d.ts +2 -203
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.js +63 -307
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.d.ts +26 -0
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.js +57 -0
- package/dist/chains/xlayer/eip7702/types.d.ts +88 -0
- package/dist/chains/xlayer/eip7702/utils.d.ts +0 -3
- package/dist/chains/xlayer/eip7702/utils.js +23 -28
- package/dist/chains/xlayer/eip7702/volume-helpers.d.ts +148 -0
- package/dist/chains/xlayer/eip7702/volume-helpers.js +48 -0
- package/dist/chains/xlayer/eip7702/volume.d.ts +6 -184
- package/dist/chains/xlayer/eip7702/volume.js +89 -164
- package/dist/chains/xlayer/eoa/constants.js +1 -1
- package/dist/chains/xlayer/eoa/dex-helpers.js +5 -5
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts +126 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +228 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.d.ts +1 -95
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.js +66 -299
- package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +1 -1
- package/dist/chains/xlayer/eoa/eoa-wash-volume.js +18 -23
- package/dist/chains/xlayer/eoa/index.d.ts +10 -6
- package/dist/chains/xlayer/eoa/index.js +8 -23
- package/dist/chains/xlayer/eoa/portal-ops.js +7 -2
- package/dist/chains/xlayer/eoa/router-manager.js +3 -3
- package/dist/chains/xlayer/eoa/types.d.ts +2 -2
- package/dist/chains/xlayer/eoa/types.js +1 -3
- package/dist/chains/xlayer/index.d.ts +3 -2
- package/dist/chains/xlayer/index.js +4 -7
- package/dist/contracts/helper3.d.ts +20 -5
- package/dist/contracts/helper3.js +56 -20
- package/dist/contracts/tm-bundle-helpers.d.ts +88 -0
- package/dist/contracts/tm-bundle-helpers.js +72 -0
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.d.ts +1 -26
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.js +1 -113
- package/dist/contracts/tm-bundle-merkle/config.d.ts +5 -67
- package/dist/contracts/tm-bundle-merkle/config.js +2 -114
- package/dist/contracts/tm-bundle-merkle/core.d.ts +1 -4
- package/dist/contracts/tm-bundle-merkle/core.js +1 -591
- package/dist/contracts/tm-bundle-merkle/index.d.ts +5 -5
- package/dist/contracts/tm-bundle-merkle/index.js +5 -5
- package/dist/contracts/tm-bundle-merkle/internal.d.ts +2 -46
- package/dist/contracts/tm-bundle-merkle/internal.js +2 -238
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.d.ts +1 -28
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.js +1 -686
- package/dist/contracts/tm-bundle-merkle/private.d.ts +1 -27
- package/dist/contracts/tm-bundle-merkle/private.js +1 -476
- package/dist/contracts/tm-bundle-merkle/submit.d.ts +3 -314
- package/dist/contracts/tm-bundle-merkle/submit.js +3 -928
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.d.ts +2 -55
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.js +2 -506
- package/dist/contracts/tm-bundle-merkle/swap-internal.d.ts +1 -3
- package/dist/contracts/tm-bundle-merkle/swap-internal.js +1 -18
- package/dist/contracts/tm-bundle-merkle/swap.d.ts +2 -144
- package/dist/contracts/tm-bundle-merkle/swap.js +2 -764
- package/dist/contracts/tm-bundle-merkle/types.d.ts +1 -476
- package/dist/contracts/tm-bundle-merkle/utils-disperse.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-disperse.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-sweep.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-sweep.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils.d.ts +6 -18
- package/dist/contracts/tm-bundle-merkle/utils.js +6 -1501
- package/dist/contracts/tm-bundle.d.ts +3 -51
- package/dist/contracts/tm-bundle.js +108 -177
- package/dist/contracts/tm.d.ts +3 -2
- package/dist/contracts/tm.js +37 -32
- package/dist/contracts/tm1.js +9 -4
- package/dist/contracts/tm2.js +9 -4
- package/dist/dex/direct-router-helpers.d.ts +264 -0
- package/dist/dex/direct-router-helpers.js +539 -0
- package/dist/dex/direct-router.d.ts +3 -125
- package/dist/dex/direct-router.js +237 -666
- package/dist/dex/types.d.ts +81 -0
- package/dist/dex/types.js +1 -0
- package/dist/exports/root-bundle-and-tooling.d.ts +27 -0
- package/dist/exports/root-bundle-and-tooling.js +30 -0
- package/dist/exports/root-eni-and-bsc-iro.d.ts +26 -0
- package/dist/exports/root-eni-and-bsc-iro.js +66 -0
- package/dist/exports/root-foundations.d.ts +35 -0
- package/dist/exports/root-foundations.js +70 -0
- package/dist/exports/root-swap-dex-and-xlayer.d.ts +30 -0
- package/dist/exports/root-swap-dex-and-xlayer.js +78 -0
- package/dist/flap/index.d.ts +10 -0
- package/dist/flap/index.js +8 -0
- package/dist/flows/create.d.ts +2 -1
- package/dist/flows/create.js +6 -6
- package/dist/flows/index.d.ts +1 -0
- package/dist/flows/index.js +1 -0
- package/dist/index.d.ts +20 -85
- package/dist/index.js +20 -215
- package/dist/merkle/index.d.ts +12 -0
- package/dist/merkle/index.js +11 -0
- package/dist/shared/abis/common.d.ts +2 -83
- package/dist/shared/abis/common.js +2 -252
- package/dist/shared/abis/index.d.ts +5 -6
- package/dist/shared/abis/index.js +5 -7
- package/dist/shared/clients/blockrazor.js +39 -25
- package/dist/shared/clients/club48.d.ts +2 -2
- package/dist/shared/clients/club48.js +34 -29
- package/dist/shared/clients/emitservice.js +2 -0
- package/dist/shared/clients/four.d.ts +21 -6
- package/dist/shared/clients/four.js +29 -24
- package/dist/shared/clients/index.d.ts +8 -0
- package/dist/shared/clients/index.js +8 -0
- package/dist/shared/clients/merkle.js +27 -34
- package/dist/shared/constants/addresses.d.ts +1 -1
- package/dist/shared/constants/addresses.js +11 -2
- package/dist/shared/constants/chains.d.ts +1 -1
- package/dist/shared/constants/chains.js +1 -1
- package/dist/shared/constants/gas.d.ts +1 -1
- package/dist/shared/constants/gas.js +2 -6
- package/dist/shared/constants/index.d.ts +3 -0
- package/dist/shared/constants/index.js +1 -0
- package/dist/shared/constants/quote.d.ts +30 -0
- package/dist/shared/constants/quote.js +37 -0
- package/dist/shared/flap/abi.js +1 -1
- package/dist/shared/flap/constants.d.ts +1 -2
- package/dist/shared/flap/constants.js +2 -3
- package/dist/shared/flap/curve.js +3 -0
- package/dist/shared/flap/errors.d.ts +1 -4
- package/dist/shared/flap/errors.js +20 -1
- package/dist/shared/flap/index.d.ts +5 -4
- package/dist/shared/flap/index.js +5 -4
- package/dist/shared/flap/meta.d.ts +22 -18
- package/dist/shared/flap/meta.js +12 -17
- package/dist/shared/flap/permit.js +5 -2
- package/dist/shared/flap/pinata.d.ts +22 -6
- package/dist/shared/flap/pinata.js +21 -26
- package/dist/shared/flap/portal-bundle-merkle/config.d.ts +3 -72
- package/dist/shared/flap/portal-bundle-merkle/config.js +4 -124
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.d.ts +32 -0
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.js +83 -0
- package/dist/shared/flap/portal-bundle-merkle/core.d.ts +0 -4
- package/dist/shared/flap/portal-bundle-merkle/core.js +96 -277
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.d.ts +7 -2
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +107 -206
- package/dist/shared/flap/portal-bundle-merkle/curve-to-dex.js +100 -92
- package/dist/shared/flap/portal-bundle-merkle/index.d.ts +11 -7
- package/dist/shared/flap/portal-bundle-merkle/index.js +4 -7
- package/dist/shared/flap/portal-bundle-merkle/pancake-proxy.js +71 -68
- package/dist/shared/flap/portal-bundle-merkle/private.js +61 -114
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +125 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.js +113 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.d.ts +1 -64
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.js +66 -247
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.d.ts +149 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.js +259 -0
- package/dist/shared/flap/portal-bundle-merkle/swap.d.ts +2 -71
- package/dist/shared/flap/portal-bundle-merkle/swap.js +103 -410
- package/dist/shared/flap/portal-bundle-merkle/types.d.ts +88 -9
- package/dist/shared/flap/portal-bundle-merkle/utils.d.ts +1 -80
- package/dist/shared/flap/portal-bundle-merkle/utils.js +145 -265
- package/dist/shared/flap/portal-bundle.js +55 -56
- package/dist/shared/flap/portal-create-token.d.ts +80 -0
- package/dist/shared/flap/portal-create-token.js +257 -0
- package/dist/shared/flap/portal.d.ts +14 -3
- package/dist/shared/flap/portal.js +50 -25
- package/dist/shared/flap/vanity.d.ts +1 -5
- package/dist/shared/flap/vanity.js +6 -17
- package/dist/shared/flap/vault.d.ts +17 -124
- package/dist/shared/flap/vault.js +67 -148
- package/dist/shared/foundation/dex/v3-path.d.ts +6 -0
- package/dist/shared/foundation/dex/v3-path.js +35 -0
- package/dist/shared/foundation/gas/bundle-gas.d.ts +49 -0
- package/dist/shared/foundation/gas/bundle-gas.js +93 -0
- package/dist/shared/foundation/gas/profit-hop.d.ts +20 -0
- package/dist/shared/foundation/gas/profit-hop.js +72 -0
- package/dist/shared/foundation/index.d.ts +13 -0
- package/dist/shared/foundation/index.js +12 -0
- package/dist/shared/foundation/nonce/nonce-manager.d.ts +17 -0
- package/dist/shared/foundation/nonce/nonce-manager.js +183 -0
- package/dist/shared/foundation/normalize-unknown.d.ts +9 -0
- package/dist/shared/foundation/normalize-unknown.js +29 -0
- package/dist/shared/foundation/sdk-logger.d.ts +13 -0
- package/dist/shared/foundation/sdk-logger.js +12 -0
- package/dist/shared/foundation/tx/build-request.d.ts +17 -0
- package/dist/shared/foundation/tx/build-request.js +25 -0
- package/dist/shared/foundation/tx/sign-batch.d.ts +5 -0
- package/dist/shared/foundation/tx/sign-batch.js +26 -0
- package/dist/shared/foundation/tx/wallet-sign-patch.d.ts +1 -0
- package/dist/shared/foundation/tx/wallet-sign-patch.js +18 -0
- package/dist/shared/foundation/types/airdrop-sweep.d.ts +79 -0
- package/dist/shared/foundation/types/airdrop-sweep.js +1 -0
- package/dist/shared/foundation/types/erc20.d.ts +65 -0
- package/dist/shared/foundation/types/erc20.js +1 -0
- package/dist/shared/foundation/types/holders-maker.d.ts +64 -0
- package/dist/shared/foundation/types/holders-maker.js +1 -0
- package/dist/shared/foundation/types/index.d.ts +7 -0
- package/dist/shared/foundation/types/index.js +1 -0
- package/dist/shared/foundation/types/lp-inspect.d.ts +102 -0
- package/dist/shared/foundation/types/lp-inspect.js +1 -0
- package/dist/shared/foundation/types/multicall.d.ts +5 -0
- package/dist/shared/foundation/types/multicall.js +1 -0
- package/dist/shared/foundation/types/private-sale.d.ts +35 -0
- package/dist/shared/foundation/types/private-sale.js +1 -0
- package/dist/shared/foundation/types/quote-helpers.d.ts +17 -0
- package/dist/shared/foundation/types/quote-helpers.js +1 -0
- package/dist/shared/four/tax-token.d.ts +1 -1
- package/dist/shared/four/tax-token.js +27 -7
- package/dist/shared/index.d.ts +6 -0
- package/dist/shared/index.js +4 -0
- package/dist/types/errors.d.ts +27 -0
- package/dist/types/errors.js +34 -0
- package/dist/utils/airdrop-sweep.d.ts +4 -76
- package/dist/utils/airdrop-sweep.js +42 -55
- package/dist/utils/bundle-helpers.d.ts +9 -243
- package/dist/utils/bundle-helpers.js +10 -584
- package/dist/utils/constants.d.ts +5 -61
- package/dist/utils/constants.js +5 -80
- package/dist/utils/contract-factory.d.ts +2 -4
- package/dist/utils/contract-factory.js +25 -18
- package/dist/utils/erc20.d.ts +7 -89
- package/dist/utils/erc20.js +94 -125
- package/dist/utils/errors.d.ts +12 -1
- package/dist/utils/errors.js +60 -1
- package/dist/utils/holders-maker/addresses.d.ts +12 -0
- package/dist/utils/holders-maker/addresses.js +15 -0
- package/dist/utils/holders-maker/buy-tx.d.ts +44 -0
- package/dist/utils/holders-maker/buy-tx.js +278 -0
- package/dist/utils/holders-maker/constants.d.ts +6 -0
- package/dist/utils/holders-maker/constants.js +7 -0
- package/dist/utils/holders-maker/disperse.d.ts +18 -0
- package/dist/utils/holders-maker/disperse.js +90 -0
- package/dist/utils/holders-maker/routing.d.ts +4 -0
- package/dist/utils/holders-maker/routing.js +45 -0
- package/dist/utils/holders-maker/transfer-tx.d.ts +4 -0
- package/dist/utils/holders-maker/transfer-tx.js +67 -0
- package/dist/utils/holders-maker-helpers.d.ts +9 -0
- package/dist/utils/holders-maker-helpers.js +9 -0
- package/dist/utils/holders-maker.d.ts +2 -138
- package/dist/utils/holders-maker.js +26 -661
- package/dist/utils/hop-chains.d.ts +35 -0
- package/dist/utils/hop-chains.js +215 -0
- package/dist/utils/lp-inspect-helpers.d.ts +9 -0
- package/dist/utils/lp-inspect-helpers.js +109 -0
- package/dist/utils/lp-inspect.d.ts +2 -112
- package/dist/utils/lp-inspect.js +73 -223
- package/dist/utils/mpcExclusive.d.ts +2 -5
- package/dist/utils/mpcExclusive.js +4 -3
- package/dist/utils/private-sale.d.ts +2 -58
- package/dist/utils/private-sale.js +4 -15
- package/dist/utils/provider-factory.d.ts +4 -0
- package/dist/utils/provider-factory.js +10 -0
- package/dist/utils/quote-helpers.d.ts +4 -45
- package/dist/utils/quote-helpers.js +17 -74
- package/dist/utils/stealth-transfer.d.ts +2 -28
- package/dist/utils/stealth-transfer.js +31 -15
- package/dist/utils/swap-helpers.d.ts +2 -15
- package/dist/utils/swap-helpers.js +6 -11
- package/dist/utils/types/airdrop-sweep.d.ts +1 -0
- package/dist/utils/types/airdrop-sweep.js +1 -0
- package/dist/utils/types/contract-factory.d.ts +1 -0
- package/dist/utils/types/contract-factory.js +1 -0
- package/dist/utils/types/erc20.d.ts +1 -0
- package/dist/utils/types/erc20.js +1 -0
- package/dist/utils/types/errors.d.ts +1 -0
- package/dist/utils/types/errors.js +1 -0
- package/dist/utils/types/holders-maker.d.ts +1 -0
- package/dist/utils/types/holders-maker.js +1 -0
- package/dist/utils/types/hop-chains.d.ts +8 -0
- package/dist/utils/types/hop-chains.js +1 -0
- package/dist/utils/types/index.d.ts +13 -0
- package/dist/utils/types/index.js +1 -0
- package/dist/utils/types/lp-inspect.d.ts +1 -0
- package/dist/utils/types/lp-inspect.js +1 -0
- package/dist/utils/types/mpc-exclusive.d.ts +5 -0
- package/dist/utils/types/mpc-exclusive.js +1 -0
- package/dist/utils/types/private-sale.d.ts +1 -0
- package/dist/utils/types/private-sale.js +1 -0
- package/dist/utils/types/quote-helpers.d.ts +1 -0
- package/dist/utils/types/quote-helpers.js +1 -0
- package/dist/utils/types/stealth-transfer.d.ts +44 -0
- package/dist/utils/types/stealth-transfer.js +1 -0
- package/dist/utils/types/wallet.d.ts +25 -0
- package/dist/utils/types/wallet.js +1 -0
- package/dist/utils/wallet.d.ts +2 -25
- package/dist/utils/wallet.js +13 -10
- package/dist/vanity/index.d.ts +5 -0
- package/dist/vanity/index.js +5 -0
- package/package.json +160 -4
- package/src/abis/contracts/TaxToken.json +969 -0
- package/src/abis/contracts/TokenManager.json +836 -0
- package/src/abis/contracts/TokenManager2.json +136 -0
- package/src/abis/contracts/TokenManagerHelper3.json +993 -0
- package/dist/shared/abis/TaxToken.json +0 -105
- package/dist/shared/abis/TokenManager2.json +0 -60
- /package/dist/{shared/abis → abis/contracts}/TokenManager.json +0 -0
- /package/dist/{shared/abis → abis/contracts}/TokenManagerHelper3.json +0 -0
|
@@ -25,7 +25,7 @@ export async function getTokenWhiteList(params) {
|
|
|
25
25
|
const provider = new JsonRpcProvider(params.rpcUrl || ENI_RPC, params.chainId || ENI_CHAIN_ID);
|
|
26
26
|
const contract = new Contract(params.iroOwnerAddress, IRO_OWNER_WHITELIST_ABI, provider);
|
|
27
27
|
const addresses = await contract.getTokenWhiteList(params.tokenAddress);
|
|
28
|
-
return addresses.map(a => ethers.getAddress(a));
|
|
28
|
+
return addresses.map((a) => ethers.getAddress(a));
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* 添加单个白名单地址 (返回签名交易)
|
|
@@ -34,11 +34,7 @@ export async function addTokenWhiteListForSubmit(params) {
|
|
|
34
34
|
const provider = new JsonRpcProvider(params.rpcUrl || ENI_RPC, params.chainId || ENI_CHAIN_ID);
|
|
35
35
|
const wallet = new Wallet(params.privateKey, provider);
|
|
36
36
|
const iface = new ethers.Interface(IRO_OWNER_WHITELIST_ABI);
|
|
37
|
-
const data = iface.encodeFunctionData('addTokenWhiteList', [
|
|
38
|
-
params.tokenAddress,
|
|
39
|
-
params.addr,
|
|
40
|
-
params.quota,
|
|
41
|
-
]);
|
|
37
|
+
const data = iface.encodeFunctionData('addTokenWhiteList', [params.tokenAddress, params.addr, params.quota]);
|
|
42
38
|
const feeData = await provider.getFeeData();
|
|
43
39
|
const nonce = await provider.getTransactionCount(wallet.address, 'pending');
|
|
44
40
|
const tx = await wallet.signTransaction({
|
|
@@ -59,17 +55,12 @@ export async function addTokenWhiteListForSubmit(params) {
|
|
|
59
55
|
export async function batchAddTokenWhiteListForSubmit(params) {
|
|
60
56
|
const provider = new JsonRpcProvider(params.rpcUrl || ENI_RPC, params.chainId || ENI_CHAIN_ID);
|
|
61
57
|
const wallet = new Wallet(params.privateKey, provider);
|
|
62
|
-
const tuples = params.entries.map(e => ({ account: e.addr, quota: e.quota }));
|
|
58
|
+
const tuples = params.entries.map((e) => ({ account: e.addr, quota: e.quota }));
|
|
63
59
|
const iface = new ethers.Interface(IRO_OWNER_WHITELIST_ABI);
|
|
64
|
-
const data = iface.encodeFunctionData('batchAddTokenWhiteList', [
|
|
65
|
-
params.tokenAddress,
|
|
66
|
-
tuples,
|
|
67
|
-
]);
|
|
60
|
+
const data = iface.encodeFunctionData('batchAddTokenWhiteList', [params.tokenAddress, tuples]);
|
|
68
61
|
const feeData = await provider.getFeeData();
|
|
69
62
|
const nonce = await provider.getTransactionCount(wallet.address, 'pending');
|
|
70
|
-
const gasLimit = params.entries.length > 5
|
|
71
|
-
? BATCH_WHITELIST_GAS_LIMIT * 2n
|
|
72
|
-
: BATCH_WHITELIST_GAS_LIMIT;
|
|
63
|
+
const gasLimit = params.entries.length > 5 ? BATCH_WHITELIST_GAS_LIMIT * 2n : BATCH_WHITELIST_GAS_LIMIT;
|
|
73
64
|
const tx = await wallet.signTransaction({
|
|
74
65
|
to: params.iroOwnerAddress,
|
|
75
66
|
data,
|
|
@@ -89,10 +80,7 @@ export async function removeTokenWhiteListForSubmit(params) {
|
|
|
89
80
|
const provider = new JsonRpcProvider(params.rpcUrl || ENI_RPC, params.chainId || ENI_CHAIN_ID);
|
|
90
81
|
const wallet = new Wallet(params.privateKey, provider);
|
|
91
82
|
const iface = new ethers.Interface(IRO_OWNER_WHITELIST_ABI);
|
|
92
|
-
const data = iface.encodeFunctionData('removeTokenWhiteList', [
|
|
93
|
-
params.tokenAddress,
|
|
94
|
-
params.addr,
|
|
95
|
-
]);
|
|
83
|
+
const data = iface.encodeFunctionData('removeTokenWhiteList', [params.tokenAddress, params.addr]);
|
|
96
84
|
const feeData = await provider.getFeeData();
|
|
97
85
|
const nonce = await provider.getTransactionCount(wallet.address, 'pending');
|
|
98
86
|
const tx = await wallet.signTransaction({
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ENI 链交易提交方法
|
|
3
|
+
*
|
|
4
|
+
* 包括快速顺序广播、同块确认等提交策略。
|
|
5
|
+
*/
|
|
6
|
+
export interface EniBundleSubmitConfig {
|
|
7
|
+
rpcUrl: string;
|
|
8
|
+
chainId?: number;
|
|
9
|
+
chainName?: string;
|
|
10
|
+
simulationTimeout?: number;
|
|
11
|
+
blockConfirmTimeout?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface EniTxResult {
|
|
14
|
+
index: number;
|
|
15
|
+
success: boolean;
|
|
16
|
+
txHash?: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface EniBundleSubmitResult {
|
|
20
|
+
code: boolean;
|
|
21
|
+
totalTransactions: number;
|
|
22
|
+
successCount: number;
|
|
23
|
+
failedCount: number;
|
|
24
|
+
txHashes: string[];
|
|
25
|
+
results: EniTxResult[];
|
|
26
|
+
sameBlock: boolean;
|
|
27
|
+
blockNumber?: number;
|
|
28
|
+
blockNumbers?: number[];
|
|
29
|
+
simulationDurationMs?: number;
|
|
30
|
+
broadcastDurationMs?: number;
|
|
31
|
+
errorSummary?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* ENI 快速并行广播:业务交易并行 + 利润交易顺序跟随
|
|
35
|
+
*/
|
|
36
|
+
export declare function submitEniParallelThenProfit(signedTransactions: string[], config: EniBundleSubmitConfig): Promise<EniBundleSubmitResult>;
|
|
37
|
+
/**
|
|
38
|
+
* ENI Bundle 提交:模拟验证 → 快速顺序广播 → 同块确认
|
|
39
|
+
*
|
|
40
|
+
* 复用同一 Provider 快速顺序广播,最小化延迟、最大化同块概率。
|
|
41
|
+
* ENI 出块 ~1.08s,连续 nonce 快速提交同块率极高。
|
|
42
|
+
*/
|
|
43
|
+
export declare function submitBundleToEni(signedTransactions: string[], config: EniBundleSubmitConfig): Promise<EniBundleSubmitResult>;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ENI 链交易提交方法
|
|
3
|
+
*
|
|
4
|
+
* 包括快速顺序广播、同块确认等提交策略。
|
|
5
|
+
*/
|
|
6
|
+
import { ethers } from 'ethers';
|
|
7
|
+
import { createSignProvider } from '../../bundle-core/sign-context-helpers.js';
|
|
8
|
+
// ==================== 内部辅助 ====================
|
|
9
|
+
function shouldTreatBroadcastErrorAsMaybeSent(m) {
|
|
10
|
+
return (m.includes('nonce too low') || m.includes('already known') || m.includes('replacement transaction underpriced'));
|
|
11
|
+
}
|
|
12
|
+
async function recoverTxHashIfAlreadySeen(provider, signedTx, errorMessage) {
|
|
13
|
+
if (!shouldTreatBroadcastErrorAsMaybeSent(errorMessage))
|
|
14
|
+
return undefined;
|
|
15
|
+
try {
|
|
16
|
+
const hash = ethers.keccak256(signedTx);
|
|
17
|
+
if (!hash)
|
|
18
|
+
return undefined;
|
|
19
|
+
const tx = await provider.getTransaction(hash);
|
|
20
|
+
return tx ? hash : undefined;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// ==================== 提交方法 ====================
|
|
27
|
+
/**
|
|
28
|
+
* ENI 快速并行广播:业务交易并行 + 利润交易顺序跟随
|
|
29
|
+
*/
|
|
30
|
+
export async function submitEniParallelThenProfit(signedTransactions, config) {
|
|
31
|
+
const totalTransactions = signedTransactions?.length ?? 0;
|
|
32
|
+
const emptyFail = (msg) => ({
|
|
33
|
+
code: false,
|
|
34
|
+
totalTransactions,
|
|
35
|
+
successCount: 0,
|
|
36
|
+
failedCount: totalTransactions,
|
|
37
|
+
txHashes: [],
|
|
38
|
+
results: [],
|
|
39
|
+
sameBlock: false,
|
|
40
|
+
errorSummary: msg,
|
|
41
|
+
});
|
|
42
|
+
if (!signedTransactions || signedTransactions.length === 0)
|
|
43
|
+
return emptyFail('signedTransactions cannot be empty');
|
|
44
|
+
if (!config.rpcUrl)
|
|
45
|
+
return emptyFail('rpcUrl is required');
|
|
46
|
+
const chainId = config.chainId ?? 173;
|
|
47
|
+
const chainName = config.chainName ?? 'ENI';
|
|
48
|
+
const provider = createSignProvider(config.rpcUrl, chainId, chainName);
|
|
49
|
+
// Step 1: 按 from 地址分组,识别独立交易和依赖交易
|
|
50
|
+
const fromCounts = new Map();
|
|
51
|
+
const txMeta = [];
|
|
52
|
+
for (let i = 0; i < signedTransactions.length; i++) {
|
|
53
|
+
const tx = ethers.Transaction.from(signedTransactions[i]);
|
|
54
|
+
const from = tx.from;
|
|
55
|
+
const count = fromCounts.get(from) ?? 0;
|
|
56
|
+
fromCounts.set(from, count + 1);
|
|
57
|
+
txMeta.push({ from, index: i, seqInFrom: count });
|
|
58
|
+
}
|
|
59
|
+
const independentTxs = txMeta.filter((t) => t.seqInFrom === 0);
|
|
60
|
+
const allResults = [];
|
|
61
|
+
const txHashes = [];
|
|
62
|
+
const errors = [];
|
|
63
|
+
// Step 2: 并行广播独立交易
|
|
64
|
+
await Promise.all(independentTxs.map(async ({ index }) => {
|
|
65
|
+
try {
|
|
66
|
+
const txResponse = await provider.broadcastTransaction(signedTransactions[index]);
|
|
67
|
+
allResults[index] = {
|
|
68
|
+
index,
|
|
69
|
+
success: true,
|
|
70
|
+
txHash: txResponse.hash,
|
|
71
|
+
};
|
|
72
|
+
txHashes.push(txResponse.hash);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
76
|
+
const recovered = await recoverTxHashIfAlreadySeen(provider, signedTransactions[index], errorMessage);
|
|
77
|
+
if (recovered) {
|
|
78
|
+
allResults[index] = {
|
|
79
|
+
index,
|
|
80
|
+
success: true,
|
|
81
|
+
txHash: recovered,
|
|
82
|
+
error: errorMessage,
|
|
83
|
+
};
|
|
84
|
+
txHashes.push(recovered);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
allResults[index] = { index, success: false, error: errorMessage };
|
|
88
|
+
errors.push(`独立交易 ${index + 1}: ${errorMessage}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}));
|
|
92
|
+
// Step 3: 逐 from 处理依赖交易(利润尾随)
|
|
93
|
+
const independentFroms = independentTxs.map((t) => t.from);
|
|
94
|
+
const fromDependents = new Map();
|
|
95
|
+
for (const meta of txMeta) {
|
|
96
|
+
if (meta.seqInFrom > 0) {
|
|
97
|
+
const deps = fromDependents.get(meta.from) ?? [];
|
|
98
|
+
deps.push(meta);
|
|
99
|
+
fromDependents.set(meta.from, deps);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
for (const from of independentFroms) {
|
|
103
|
+
const deps = fromDependents.get(from);
|
|
104
|
+
if (!deps || deps.length === 0)
|
|
105
|
+
continue;
|
|
106
|
+
for (const dep of deps) {
|
|
107
|
+
try {
|
|
108
|
+
const txResponse = await provider.broadcastTransaction(signedTransactions[dep.index]);
|
|
109
|
+
allResults[dep.index] = {
|
|
110
|
+
index: dep.index,
|
|
111
|
+
success: true,
|
|
112
|
+
txHash: txResponse.hash,
|
|
113
|
+
};
|
|
114
|
+
txHashes.push(txResponse.hash);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
118
|
+
const recovered = await recoverTxHashIfAlreadySeen(provider, signedTransactions[dep.index], errorMessage);
|
|
119
|
+
if (recovered) {
|
|
120
|
+
allResults[dep.index] = {
|
|
121
|
+
index: dep.index,
|
|
122
|
+
success: true,
|
|
123
|
+
txHash: recovered,
|
|
124
|
+
error: errorMessage,
|
|
125
|
+
};
|
|
126
|
+
txHashes.push(recovered);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
allResults[dep.index] = {
|
|
130
|
+
index: dep.index,
|
|
131
|
+
success: false,
|
|
132
|
+
error: errorMessage,
|
|
133
|
+
};
|
|
134
|
+
errors.push(`依赖交易 ${dep.index + 1}(${from}): ${errorMessage}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
code: errors.length === 0,
|
|
141
|
+
totalTransactions,
|
|
142
|
+
successCount: txHashes.length,
|
|
143
|
+
failedCount: totalTransactions - txHashes.length,
|
|
144
|
+
txHashes,
|
|
145
|
+
results: allResults.filter(Boolean),
|
|
146
|
+
sameBlock: false,
|
|
147
|
+
errorSummary: errors.length > 0 ? errors.join('; ') : undefined,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* ENI Bundle 提交:模拟验证 → 快速顺序广播 → 同块确认
|
|
152
|
+
*
|
|
153
|
+
* 复用同一 Provider 快速顺序广播,最小化延迟、最大化同块概率。
|
|
154
|
+
* ENI 出块 ~1.08s,连续 nonce 快速提交同块率极高。
|
|
155
|
+
*/
|
|
156
|
+
export async function submitBundleToEni(signedTransactions, config) {
|
|
157
|
+
const totalTransactions = signedTransactions?.length ?? 0;
|
|
158
|
+
const emptyFail = (msg) => ({
|
|
159
|
+
code: false,
|
|
160
|
+
totalTransactions,
|
|
161
|
+
successCount: 0,
|
|
162
|
+
failedCount: totalTransactions,
|
|
163
|
+
txHashes: [],
|
|
164
|
+
results: [],
|
|
165
|
+
sameBlock: false,
|
|
166
|
+
errorSummary: msg,
|
|
167
|
+
});
|
|
168
|
+
if (!signedTransactions || signedTransactions.length === 0)
|
|
169
|
+
return emptyFail('signedTransactions cannot be empty');
|
|
170
|
+
if (!config.rpcUrl)
|
|
171
|
+
return emptyFail('rpcUrl is required');
|
|
172
|
+
const chainId = config.chainId ?? 173;
|
|
173
|
+
const chainName = config.chainName ?? 'ENI';
|
|
174
|
+
const simulationTimeout = config.simulationTimeout ?? 10000;
|
|
175
|
+
const blockConfirmTimeout = config.blockConfirmTimeout ?? 15000;
|
|
176
|
+
const provider = createSignProvider(config.rpcUrl, chainId, chainName);
|
|
177
|
+
// Phase 1: 模拟验证
|
|
178
|
+
const simStart = Date.now();
|
|
179
|
+
const simErrors = [];
|
|
180
|
+
for (let i = 0; i < signedTransactions.length; i++) {
|
|
181
|
+
try {
|
|
182
|
+
const tx = ethers.Transaction.from(signedTransactions[i]);
|
|
183
|
+
await Promise.race([
|
|
184
|
+
provider.call({
|
|
185
|
+
to: tx.to,
|
|
186
|
+
data: tx.data,
|
|
187
|
+
value: tx.value,
|
|
188
|
+
from: tx.from,
|
|
189
|
+
}),
|
|
190
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error('simulation timeout')), simulationTimeout)),
|
|
191
|
+
]);
|
|
192
|
+
}
|
|
193
|
+
catch (e) {
|
|
194
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
195
|
+
if (msg.includes('simulation timeout')) {
|
|
196
|
+
console.warn(`⚠️ [${chainName}] 交易 ${i + 1} 模拟超时,跳过验证`);
|
|
197
|
+
}
|
|
198
|
+
else if (msg.includes('execution reverted') || msg.includes('CALL_EXCEPTION')) {
|
|
199
|
+
simErrors.push(`交易 ${i + 1} 模拟失败: ${msg.slice(0, 200)}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const simulationDurationMs = Date.now() - simStart;
|
|
204
|
+
if (simErrors.length > 0) {
|
|
205
|
+
return { ...emptyFail(simErrors.join('; ')), simulationDurationMs };
|
|
206
|
+
}
|
|
207
|
+
// Phase 2: 快速顺序广播
|
|
208
|
+
const broadStart = Date.now();
|
|
209
|
+
const results = [];
|
|
210
|
+
const txHashes = [];
|
|
211
|
+
for (let i = 0; i < signedTransactions.length; i++) {
|
|
212
|
+
try {
|
|
213
|
+
const txResponse = await provider.broadcastTransaction(signedTransactions[i]);
|
|
214
|
+
results.push({ index: i, success: true, txHash: txResponse.hash });
|
|
215
|
+
txHashes.push(txResponse.hash);
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
219
|
+
const recovered = await recoverTxHashIfAlreadySeen(provider, signedTransactions[i], errorMessage);
|
|
220
|
+
if (recovered) {
|
|
221
|
+
results.push({ index: i, success: true, txHash: recovered, error: errorMessage });
|
|
222
|
+
txHashes.push(recovered);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
results.push({ index: i, success: false, error: errorMessage });
|
|
226
|
+
console.error(`❌ [${chainName}] Bundle tx ${i + 1}/${totalTransactions} 失败: ${errorMessage}`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const broadcastDurationMs = Date.now() - broadStart;
|
|
231
|
+
const successCount = txHashes.length;
|
|
232
|
+
const failedCount = totalTransactions - successCount;
|
|
233
|
+
if (successCount === 0) {
|
|
234
|
+
return {
|
|
235
|
+
code: false,
|
|
236
|
+
totalTransactions,
|
|
237
|
+
successCount,
|
|
238
|
+
failedCount,
|
|
239
|
+
txHashes,
|
|
240
|
+
results,
|
|
241
|
+
sameBlock: false,
|
|
242
|
+
simulationDurationMs,
|
|
243
|
+
broadcastDurationMs,
|
|
244
|
+
errorSummary: results
|
|
245
|
+
.filter((r) => !r.success)
|
|
246
|
+
.map((r) => r.error)
|
|
247
|
+
.join('; '),
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
// Phase 3: 同块确认
|
|
251
|
+
let sameBlock = false;
|
|
252
|
+
let blockNumber;
|
|
253
|
+
const blockNumbers = [];
|
|
254
|
+
try {
|
|
255
|
+
const receipts = await Promise.all(txHashes.map((hash) => Promise.race([
|
|
256
|
+
provider.waitForTransaction(hash, 1, blockConfirmTimeout),
|
|
257
|
+
new Promise((resolve) => setTimeout(() => resolve(null), blockConfirmTimeout)),
|
|
258
|
+
])));
|
|
259
|
+
for (const receipt of receipts) {
|
|
260
|
+
if (receipt && receipt.blockNumber) {
|
|
261
|
+
blockNumbers.push(receipt.blockNumber);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (blockNumbers.length === txHashes.length && blockNumbers.length > 0) {
|
|
265
|
+
const uniqueBlocks = new Set(blockNumbers);
|
|
266
|
+
sameBlock = uniqueBlocks.size === 1;
|
|
267
|
+
blockNumber = sameBlock ? blockNumbers[0] : undefined;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
console.warn(`⚠️ [${chainName}] Bundle 区块确认超时`);
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
code: true,
|
|
275
|
+
totalTransactions,
|
|
276
|
+
successCount,
|
|
277
|
+
failedCount,
|
|
278
|
+
txHashes,
|
|
279
|
+
results,
|
|
280
|
+
sameBlock,
|
|
281
|
+
blockNumber,
|
|
282
|
+
blockNumbers: blockNumbers.length > 0 ? blockNumbers : undefined,
|
|
283
|
+
simulationDurationMs,
|
|
284
|
+
broadcastDurationMs,
|
|
285
|
+
};
|
|
286
|
+
}
|
package/dist/chains/index.d.ts
CHANGED
|
@@ -7,3 +7,16 @@ export * as bsc from './bsc/index.js';
|
|
|
7
7
|
export * as xlayer from './xlayer/index.js';
|
|
8
8
|
export * as monad from './monad/index.js';
|
|
9
9
|
export * as eni from './eni/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* 与包根 `export * as chains` 一致的命名空间(`chains.bsc` / `chains.eni` …)
|
|
12
|
+
*/
|
|
13
|
+
import * as bscNs from './bsc/index.js';
|
|
14
|
+
import * as xlayerNs from './xlayer/index.js';
|
|
15
|
+
import * as monadNs from './monad/index.js';
|
|
16
|
+
import * as eniNs from './eni/index.js';
|
|
17
|
+
export declare const chains: {
|
|
18
|
+
readonly bsc: typeof bscNs;
|
|
19
|
+
readonly xlayer: typeof xlayerNs;
|
|
20
|
+
readonly monad: typeof monadNs;
|
|
21
|
+
readonly eni: typeof eniNs;
|
|
22
|
+
};
|
package/dist/chains/index.js
CHANGED
|
@@ -11,3 +11,16 @@ export * as xlayer from './xlayer/index.js';
|
|
|
11
11
|
export * as monad from './monad/index.js';
|
|
12
12
|
// ENI 链
|
|
13
13
|
export * as eni from './eni/index.js';
|
|
14
|
+
/**
|
|
15
|
+
* 与包根 `export * as chains` 一致的命名空间(`chains.bsc` / `chains.eni` …)
|
|
16
|
+
*/
|
|
17
|
+
import * as bscNs from './bsc/index.js';
|
|
18
|
+
import * as xlayerNs from './xlayer/index.js';
|
|
19
|
+
import * as monadNs from './monad/index.js';
|
|
20
|
+
import * as eniNs from './eni/index.js';
|
|
21
|
+
export const chains = {
|
|
22
|
+
bsc: bscNs,
|
|
23
|
+
xlayer: xlayerNs,
|
|
24
|
+
monad: monadNs,
|
|
25
|
+
eni: eniNs,
|
|
26
|
+
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* 在 EIP-7702 中,通过 delegate 调用时 msg.sender 是 EOA 本身
|
|
8
8
|
* 需要使用 executeApprove 函数
|
|
9
9
|
*/
|
|
10
|
-
import type { BundleApproveParams, BundleApproveResult, EIP7702Config } from './types.js';
|
|
10
|
+
import type { BundleApproveParams, BundleApproveResult, BundleApproveMultiSpendersParams, BundleApproveMultiSpendersResult, EIP7702Config } from './types.js';
|
|
11
11
|
/**
|
|
12
12
|
* 批量授权 - 生成签名后的交易
|
|
13
13
|
*
|
|
@@ -15,31 +15,7 @@ import type { BundleApproveParams, BundleApproveResult, EIP7702Config } from './
|
|
|
15
15
|
* @returns 签名后的交易和元数据
|
|
16
16
|
*/
|
|
17
17
|
export declare function bundleApprove(params: BundleApproveParams): Promise<BundleApproveResult>;
|
|
18
|
-
export
|
|
19
|
-
/** 主钱包(发起交易,支付 gas) */
|
|
20
|
-
mainPrivateKey: string;
|
|
21
|
-
/** 需要授权的钱包私钥列表 */
|
|
22
|
-
privateKeys: string[];
|
|
23
|
-
/** 代币地址 */
|
|
24
|
-
tokenAddress: string;
|
|
25
|
-
/** 授权给的地址列表(多个 spender) */
|
|
26
|
-
spenderAddresses: string[];
|
|
27
|
-
/** 授权金额(可选,默认 MaxUint256) */
|
|
28
|
-
amount?: bigint;
|
|
29
|
-
/** 配置 */
|
|
30
|
-
config?: EIP7702Config;
|
|
31
|
-
}
|
|
32
|
-
export interface BundleApproveMultiSpendersResult {
|
|
33
|
-
/** 签名后的交易 */
|
|
34
|
-
signedTransaction: string;
|
|
35
|
-
/** 元数据 */
|
|
36
|
-
metadata: {
|
|
37
|
-
walletCount: number;
|
|
38
|
-
tokenAddress: string;
|
|
39
|
-
spenderAddresses: string[];
|
|
40
|
-
totalApproveCalls: number;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
18
|
+
export type { BundleApproveMultiSpendersParams, BundleApproveMultiSpendersResult } from './types.js';
|
|
43
19
|
/**
|
|
44
20
|
* 多 spender 批量授权 - 生成签名后的交易
|
|
45
21
|
*
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* 需要使用 executeApprove 函数
|
|
9
9
|
*/
|
|
10
10
|
import { ethers, Contract } from 'ethers';
|
|
11
|
-
import { getCachedProvider, createWallet, signAuthorizationsBatch, buildEIP7702Transaction
|
|
12
|
-
import { UNIFIED_DELEGATE_ADDRESS, UNIFIED_DELEGATE_ABI, ERC20_ABI
|
|
11
|
+
import { getCachedProvider, createWallet, signAuthorizationsBatch, buildEIP7702Transaction } from './utils.js';
|
|
12
|
+
import { UNIFIED_DELEGATE_ADDRESS, UNIFIED_DELEGATE_ABI, ERC20_ABI } from './constants.js';
|
|
13
13
|
// 扩展 ABI 包含 executeApprove
|
|
14
14
|
const EXTENDED_DELEGATE_ABI = [
|
|
15
15
|
...UNIFIED_DELEGATE_ABI,
|
|
@@ -22,11 +22,7 @@ function buildApproveCalls(wallets, tokenAddress, spenderAddress, amount) {
|
|
|
22
22
|
const delegateInterface = new ethers.Interface(EXTENDED_DELEGATE_ABI);
|
|
23
23
|
const calls = [];
|
|
24
24
|
for (const wallet of wallets) {
|
|
25
|
-
const callData = delegateInterface.encodeFunctionData('executeApprove', [
|
|
26
|
-
tokenAddress,
|
|
27
|
-
spenderAddress,
|
|
28
|
-
amount,
|
|
29
|
-
]);
|
|
25
|
+
const callData = delegateInterface.encodeFunctionData('executeApprove', [tokenAddress, spenderAddress, amount]);
|
|
30
26
|
calls.push({
|
|
31
27
|
target: wallet.address,
|
|
32
28
|
allowFailure: false,
|
|
@@ -43,20 +39,19 @@ function buildApproveCalls(wallets, tokenAddress, spenderAddress, amount) {
|
|
|
43
39
|
* @returns 签名后的交易和元数据
|
|
44
40
|
*/
|
|
45
41
|
export async function bundleApprove(params) {
|
|
46
|
-
const { mainPrivateKey, privateKeys, tokenAddress, spenderAddress, amount = ethers.MaxUint256, config
|
|
42
|
+
const { mainPrivateKey, privateKeys, tokenAddress, spenderAddress, amount = ethers.MaxUint256, config } = params;
|
|
47
43
|
if (privateKeys.length === 0) {
|
|
48
44
|
throw new Error('privateKeys 不能为空');
|
|
49
45
|
}
|
|
50
46
|
const provider = getCachedProvider(config?.rpcUrl);
|
|
51
47
|
const delegateAddress = (config?.delegateAddress && config.delegateAddress.trim()) || UNIFIED_DELEGATE_ADDRESS;
|
|
52
48
|
const mainWallet = createWallet(mainPrivateKey, provider);
|
|
53
|
-
const wallets = privateKeys.map(pk => createWallet(pk, provider));
|
|
49
|
+
const wallets = privateKeys.map((pk) => createWallet(pk, provider));
|
|
54
50
|
// 检查 mainWallet 是否在 wallets 中
|
|
55
|
-
const mainWalletIndex = wallets.findIndex(w => w.address.toLowerCase() === mainWallet.address.toLowerCase());
|
|
51
|
+
const mainWalletIndex = wallets.findIndex((w) => w.address.toLowerCase() === mainWallet.address.toLowerCase());
|
|
56
52
|
// 只为需要执行授权操作的钱包生成 authorization
|
|
57
53
|
// mainWallet 如果不在 privateKeys 中,只是支付 gas,不需要 authorization
|
|
58
|
-
const authorizations = await signAuthorizationsBatch(wallets, delegateAddress, provider, mainWalletIndex
|
|
59
|
-
);
|
|
54
|
+
const authorizations = await signAuthorizationsBatch(wallets, delegateAddress, provider, mainWalletIndex);
|
|
60
55
|
const calls = buildApproveCalls(wallets, tokenAddress, spenderAddress, amount);
|
|
61
56
|
const signedTransaction = await buildEIP7702Transaction(mainWallet, authorizations, calls, 0n, config);
|
|
62
57
|
return {
|
|
@@ -78,11 +73,7 @@ function buildApproveCallsMultiSpenders(wallets, tokenAddress, spenderAddresses,
|
|
|
78
73
|
// 对每个钱包,授权所有 spender
|
|
79
74
|
for (const wallet of wallets) {
|
|
80
75
|
for (const spender of spenderAddresses) {
|
|
81
|
-
const callData = delegateInterface.encodeFunctionData('executeApprove', [
|
|
82
|
-
tokenAddress,
|
|
83
|
-
spender,
|
|
84
|
-
amount,
|
|
85
|
-
]);
|
|
76
|
+
const callData = delegateInterface.encodeFunctionData('executeApprove', [tokenAddress, spender, amount]);
|
|
86
77
|
calls.push({
|
|
87
78
|
target: wallet.address,
|
|
88
79
|
allowFailure: false,
|
|
@@ -103,7 +94,7 @@ function buildApproveCallsMultiSpenders(wallets, tokenAddress, spenderAddresses,
|
|
|
103
94
|
* @returns 签名后的交易和元数据
|
|
104
95
|
*/
|
|
105
96
|
export async function bundleApproveMultiSpenders(params) {
|
|
106
|
-
const { mainPrivateKey, privateKeys, tokenAddress, spenderAddresses, amount = ethers.MaxUint256, config
|
|
97
|
+
const { mainPrivateKey, privateKeys, tokenAddress, spenderAddresses, amount = ethers.MaxUint256, config } = params;
|
|
107
98
|
if (privateKeys.length === 0) {
|
|
108
99
|
throw new Error('privateKeys 不能为空');
|
|
109
100
|
}
|
|
@@ -113,14 +104,13 @@ export async function bundleApproveMultiSpenders(params) {
|
|
|
113
104
|
const provider = getCachedProvider(config?.rpcUrl);
|
|
114
105
|
const delegateAddress = (config?.delegateAddress && config.delegateAddress.trim()) || UNIFIED_DELEGATE_ADDRESS;
|
|
115
106
|
const mainWallet = createWallet(mainPrivateKey, provider);
|
|
116
|
-
const wallets = privateKeys.map(pk => createWallet(pk, provider));
|
|
107
|
+
const wallets = privateKeys.map((pk) => createWallet(pk, provider));
|
|
117
108
|
// 检查 mainWallet 是否在 wallets 中
|
|
118
|
-
const mainWalletIndex = wallets.findIndex(w => w.address.toLowerCase() === mainWallet.address.toLowerCase());
|
|
109
|
+
const mainWalletIndex = wallets.findIndex((w) => w.address.toLowerCase() === mainWallet.address.toLowerCase());
|
|
119
110
|
// 只为需要执行授权操作的钱包生成 authorization
|
|
120
111
|
const authorizations = await signAuthorizationsBatch(wallets, delegateAddress, provider, mainWalletIndex);
|
|
121
112
|
// ✅ 关键:一次性构建所有 approve 调用
|
|
122
113
|
const calls = buildApproveCallsMultiSpenders(wallets, tokenAddress, spenderAddresses, amount);
|
|
123
|
-
console.log(`[bundleApproveMultiSpenders] 钱包数: ${wallets.length}, spender数: ${spenderAddresses.length}, 总调用数: ${calls.length}`);
|
|
124
114
|
const signedTransaction = await buildEIP7702Transaction(mainWallet, authorizations, calls, 0n, config);
|
|
125
115
|
return {
|
|
126
116
|
signedTransaction,
|
|
@@ -6,12 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* 只生成签名,由调用方决定如何提交
|
|
8
8
|
*/
|
|
9
|
-
import type { BundleBuyParams
|
|
10
|
-
import { type UserType } from './utils.js';
|
|
11
|
-
export interface BundleBuyParams extends BaseBundleBuyParams {
|
|
12
|
-
/** 用户类型(影响利润率) */
|
|
13
|
-
userType?: UserType;
|
|
14
|
-
}
|
|
9
|
+
import type { BundleBuyParams, BundleBuyResult } from './types.js';
|
|
15
10
|
/**
|
|
16
11
|
* 批量买入 - 生成签名后的交易
|
|
17
12
|
*
|
|
@@ -49,4 +44,5 @@ export interface BundleBuyParams extends BaseBundleBuyParams {
|
|
|
49
44
|
* fee: 2500, // 0.25%
|
|
50
45
|
* });
|
|
51
46
|
*/
|
|
47
|
+
export type { BundleBuyParams } from './types.js';
|
|
52
48
|
export declare function bundleBuy(params: BundleBuyParams): Promise<BundleBuyResult>;
|
|
@@ -36,18 +36,22 @@ function buildFlapBuyCalls(wallets, buyAmounts, tokenAddress) {
|
|
|
36
36
|
continue;
|
|
37
37
|
// ✅ 修复:使用 swapExactInput 代替 buy 函数,与 bundle-create.ts 保持一致
|
|
38
38
|
// buy(token) 是旧 API,swapExactInput 是新的标准 API
|
|
39
|
-
const portalCallData = portalInterface.encodeFunctionData('swapExactInput', [
|
|
39
|
+
const portalCallData = portalInterface.encodeFunctionData('swapExactInput', [
|
|
40
|
+
{
|
|
40
41
|
inputToken: ethers.ZeroAddress, // 0x0 = OKB (原生代币)
|
|
41
42
|
outputToken: tokenAddress,
|
|
42
43
|
inputAmount: amount,
|
|
43
44
|
minOutputAmount: 0n, // 无滑点保护
|
|
44
45
|
permitData: '0x',
|
|
45
|
-
}
|
|
46
|
-
|
|
46
|
+
},
|
|
47
|
+
]);
|
|
48
|
+
const batchCalls = [
|
|
49
|
+
{
|
|
47
50
|
target: FLAP_PORTAL_ADDRESS,
|
|
48
51
|
value: amount,
|
|
49
52
|
data: portalCallData,
|
|
50
|
-
}
|
|
53
|
+
},
|
|
54
|
+
];
|
|
51
55
|
const callData = delegateInterface.encodeFunctionData('executeBatch', [batchCalls]);
|
|
52
56
|
calls.push({
|
|
53
57
|
target: wallet.address, // 以钱包身份调用,代币会到钱包
|
|
@@ -142,46 +146,6 @@ function buildProfitCall(mainWallet, profitAmount, profitRecipient) {
|
|
|
142
146
|
callData,
|
|
143
147
|
};
|
|
144
148
|
}
|
|
145
|
-
// ========================================
|
|
146
|
-
// 批量买入主函数
|
|
147
|
-
// ========================================
|
|
148
|
-
/**
|
|
149
|
-
* 批量买入 - 生成签名后的交易
|
|
150
|
-
*
|
|
151
|
-
* @param params 买入参数
|
|
152
|
-
* @returns 签名后的交易和元数据
|
|
153
|
-
*
|
|
154
|
-
* @example
|
|
155
|
-
* // FLAP 内盘买入
|
|
156
|
-
* const result = await bundleBuy({
|
|
157
|
-
* mainPrivateKey: '0x...',
|
|
158
|
-
* privateKeys: ['0x...', '0x...'],
|
|
159
|
-
* buyAmounts: ['0.01', '0.02'],
|
|
160
|
-
* tokenAddress: '0x...',
|
|
161
|
-
* tradeType: 'FLAP',
|
|
162
|
-
* });
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* // V2 买入
|
|
166
|
-
* const result = await bundleBuy({
|
|
167
|
-
* mainPrivateKey: '0x...',
|
|
168
|
-
* privateKeys: ['0x...', '0x...'],
|
|
169
|
-
* buyAmounts: ['0.01', '0.02'],
|
|
170
|
-
* tokenAddress: '0x...',
|
|
171
|
-
* tradeType: 'V2',
|
|
172
|
-
* });
|
|
173
|
-
*
|
|
174
|
-
* @example
|
|
175
|
-
* // V3 买入(默认)
|
|
176
|
-
* const result = await bundleBuy({
|
|
177
|
-
* mainPrivateKey: '0x...',
|
|
178
|
-
* privateKeys: ['0x...', '0x...'],
|
|
179
|
-
* buyAmounts: ['0.01', '0.02'],
|
|
180
|
-
* tokenAddress: '0x...',
|
|
181
|
-
* tradeType: 'V3',
|
|
182
|
-
* fee: 2500, // 0.25%
|
|
183
|
-
* });
|
|
184
|
-
*/
|
|
185
149
|
export async function bundleBuy(params) {
|
|
186
150
|
const { mainPrivateKey, privateKeys, buyAmounts, tokenAddress, tradeType = 'V3', routerAddress, fee = V3_FEE_TIERS.MEDIUM, userType = 'v0', // ✅ 用户类型(影响利润率)
|
|
187
151
|
config, } = params;
|
|
@@ -195,22 +159,20 @@ export async function bundleBuy(params) {
|
|
|
195
159
|
// 同步操作 - 批量创建钱包和解析金额
|
|
196
160
|
// ========================================
|
|
197
161
|
const mainWallet = createWallet(mainPrivateKey, provider);
|
|
198
|
-
const wallets = privateKeys.map(pk => createWallet(pk, provider));
|
|
162
|
+
const wallets = privateKeys.map((pk) => createWallet(pk, provider));
|
|
199
163
|
// 批量解析金额(同步)
|
|
200
|
-
const buyAmountsWei = buyAmounts.map(amt => ethers.parseEther(amt));
|
|
164
|
+
const buyAmountsWei = buyAmounts.map((amt) => ethers.parseEther(amt));
|
|
201
165
|
const totalBuyAmount = buyAmountsWei.reduce((sum, amt) => sum + amt, 0n);
|
|
202
166
|
// ✅ 使用 userType 计算利润
|
|
203
167
|
const profitAmount = calculateProfitAmountByTxCount(totalBuyAmount, wallets.length, userType);
|
|
204
168
|
const profitRecipient = getProfitRecipient(config);
|
|
205
169
|
// 确定需要授权的钱包
|
|
206
|
-
const mainWalletIndex = wallets.findIndex(w => w.address.toLowerCase() === mainWallet.address.toLowerCase());
|
|
207
|
-
const allWallets = mainWalletIndex === -1
|
|
208
|
-
? [mainWallet, ...wallets]
|
|
209
|
-
: wallets;
|
|
170
|
+
const mainWalletIndex = wallets.findIndex((w) => w.address.toLowerCase() === mainWallet.address.toLowerCase());
|
|
171
|
+
const allWallets = mainWalletIndex === -1 ? [mainWallet, ...wallets] : wallets;
|
|
210
172
|
// ========================================
|
|
211
173
|
// 并行获取所有异步数据
|
|
212
174
|
// ========================================
|
|
213
|
-
const allAddresses = allWallets.map(w => w.address);
|
|
175
|
+
const allAddresses = allWallets.map((w) => w.address);
|
|
214
176
|
const [walletNonces, mainNonce, feeData] = await Promise.all([
|
|
215
177
|
// 1. 批量获取授权钱包的 nonce
|
|
216
178
|
batchGetNonces(allAddresses, provider),
|