four-flap-meme-sdk 2.2.18 → 2.2.20
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/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 +240 -0
- package/dist/abis/contracts/TaxToken.json +969 -0
- package/dist/abis/contracts/TokenManager.json +836 -0
- package/dist/abis/contracts/TokenManager2.json +136 -0
- package/dist/abis/contracts/TokenManagerHelper3.json +993 -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 +5 -0
- package/dist/abis/flap/index.js +5 -0
- package/dist/abis/flap/portal-eip7702.d.ts +4 -0
- package/dist/abis/flap/portal-eip7702.js +39 -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-merkle.d.ts +4 -0
- package/dist/abis/flap/portal-merkle.js +25 -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 +37 -0
- package/dist/bundle-core/config-helpers.js +58 -0
- package/dist/bundle-core/errors.d.ts +50 -0
- package/dist/bundle-core/errors.js +38 -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 +41 -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 +456 -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 +28 -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 +16 -0
- package/dist/bundle-core/internal.js +160 -0
- package/dist/bundle-core/sign-context-helpers.d.ts +26 -0
- package/dist/bundle-core/sign-context-helpers.js +63 -0
- package/dist/bundle-core/submit.d.ts +293 -0
- package/dist/bundle-core/submit.js +731 -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 +155 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +80 -0
- package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +1 -91
- package/dist/chains/bsc/pancake/bundle-buy-first.js +98 -213
- 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 +287 -0
- package/dist/chains/index.d.ts +13 -0
- package/dist/chains/index.js +13 -0
- package/dist/chains/xlayer/constants.d.ts +5 -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 +104 -74
- 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 +11 -26
- package/dist/chains/xlayer/eip7702/constants.js +15 -68
- 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 +58 -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.d.ts +1 -1
- package/dist/chains/xlayer/eoa/constants.js +2 -16
- package/dist/chains/xlayer/eoa/dex-helpers.d.ts +1 -1
- package/dist/chains/xlayer/eoa/dex-helpers.js +7 -37
- 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 +5 -4
- 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 +73 -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 +120 -187
- package/dist/contracts/tm.d.ts +10 -8
- package/dist/contracts/tm.js +39 -35
- package/dist/contracts/tm1.js +9 -4
- package/dist/contracts/tm2.js +10 -5
- package/dist/dex/direct-router-helpers.d.ts +269 -0
- package/dist/dex/direct-router-helpers.js +536 -0
- package/dist/dex/direct-router.d.ts +3 -125
- package/dist/dex/direct-router.js +244 -672
- 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 +11 -0
- package/dist/flap/index.js +9 -0
- package/dist/flows/create.d.ts +2 -1
- package/dist/flows/create.js +6 -6
- package/dist/flows/index.d.ts +9 -0
- package/dist/flows/index.js +9 -0
- package/dist/index.d.ts +20 -88
- package/dist/index.js +20 -218
- 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 -254
- package/dist/shared/abis/index.d.ts +5 -6
- package/dist/shared/abis/index.js +5 -7
- package/dist/shared/clients/blockrazor.d.ts +4 -8
- package/dist/shared/clients/blockrazor.js +43 -35
- package/dist/shared/clients/club48.d.ts +2 -2
- package/dist/shared/clients/club48.js +36 -30
- 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.d.ts +4 -3
- package/dist/shared/clients/merkle.js +30 -47
- package/dist/shared/constants/addresses.d.ts +27 -1
- package/dist/shared/constants/addresses.js +39 -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 +4 -1
- package/dist/shared/constants/index.js +2 -1
- 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 +3 -4
- 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 +4 -5
- package/dist/shared/flap/index.js +4 -5
- package/dist/shared/flap/launch-v6.d.ts +0 -5
- package/dist/shared/flap/launch-v6.js +2 -16
- package/dist/shared/flap/meta.d.ts +22 -18
- package/dist/shared/flap/meta.js +32 -24
- package/dist/shared/flap/permit.js +10 -3
- 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 +168 -175
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.d.ts +17 -4
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +96 -117
- package/dist/shared/flap/portal-bundle-merkle/curve-to-dex.js +104 -122
- 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-batch.d.ts +8 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-batch.js +227 -0
- 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 +69 -288
- package/dist/shared/flap/portal-bundle-merkle/swap-cross.d.ts +9 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-cross.js +139 -0
- 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-planning.d.ts +70 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-planning.js +182 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-quick-batch.d.ts +16 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-quick-batch.js +327 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-single.d.ts +2 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-single.js +184 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-types.d.ts +101 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-types.js +1 -0
- package/dist/shared/flap/portal-bundle-merkle/swap.d.ts +6 -199
- package/dist/shared/flap/portal-bundle-merkle/swap.js +5 -1357
- package/dist/shared/flap/portal-bundle-merkle/types.d.ts +88 -12
- 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 +83 -78
- package/dist/shared/flap/portal-create-token.d.ts +39 -21
- package/dist/shared/flap/portal-create-token.js +121 -124
- package/dist/shared/flap/portal.d.ts +1 -2
- package/dist/shared/flap/portal.js +36 -28
- package/dist/shared/flap/vanity.d.ts +6 -6
- package/dist/shared/flap/vanity.js +15 -21
- package/dist/shared/flap/vault.d.ts +25 -93
- package/dist/shared/flap/vault.js +77 -127
- package/dist/shared/foundation/amount/split-by-weight.d.ts +5 -0
- package/dist/shared/foundation/amount/split-by-weight.js +35 -0
- package/dist/shared/foundation/dex/v3-path.d.ts +6 -0
- package/dist/shared/foundation/dex/v3-path.js +35 -0
- package/dist/shared/foundation/erc20/decimals.d.ts +7 -0
- package/dist/shared/foundation/erc20/decimals.js +24 -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 +15 -0
- package/dist/shared/foundation/index.js +14 -0
- package/dist/shared/foundation/nonce/nonce-manager.d.ts +19 -0
- package/dist/shared/foundation/nonce/nonce-manager.js +217 -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/foundation/wallet/generate.d.ts +5 -0
- package/dist/shared/foundation/wallet/generate.js +8 -0
- package/dist/shared/four/tax-token.d.ts +1 -1
- package/dist/shared/four/tax-token.js +31 -10
- 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 +98 -129
- 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 +50 -671
- 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 +78 -293
- 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 +39 -19
- 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 +4 -25
- package/dist/utils/wallet.js +27 -22
- package/dist/vanity/index.d.ts +5 -0
- package/dist/vanity/index.js +5 -0
- package/package.json +100 -2
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Contract, JsonRpcProvider } from 'ethers';
|
|
2
|
-
import TokenManager2Abi from '../
|
|
3
|
-
import { ADDRESSES } from '
|
|
2
|
+
import TokenManager2Abi from '../abis/contracts/TokenManager2.json' with { type: 'json' };
|
|
3
|
+
import { ADDRESSES } from '../shared/constants/index.js';
|
|
4
|
+
const TOKEN_MANAGER2_ABI = TokenManager2Abi;
|
|
4
5
|
// 链上识别:template & 0x10000 > 0
|
|
5
6
|
export async function isExclusiveOnChain(params) {
|
|
6
7
|
const { chain, tokenAddress, rpcUrl } = params;
|
|
7
8
|
const tokenManager2Address = ADDRESSES[chain].TokenManagerV2;
|
|
8
9
|
const provider = new JsonRpcProvider(rpcUrl);
|
|
9
|
-
const tm2 = new Contract(tokenManager2Address,
|
|
10
|
+
const tm2 = new Contract(tokenManager2Address, TOKEN_MANAGER2_ABI, provider);
|
|
10
11
|
const info = await tm2._tokenInfos(tokenAddress);
|
|
11
12
|
const template = info.template;
|
|
12
13
|
return (template & 0x10000n) > 0n;
|
|
@@ -5,64 +5,7 @@
|
|
|
5
5
|
* - 贿赂交易:向 BlockRazor Builder EOA 转账 BNB 提高优先级
|
|
6
6
|
* - 利润提取:千分之三(30 bps)
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
9
|
-
/** 私募签名配置 */
|
|
10
|
-
export interface PrivateSaleSignConfig {
|
|
11
|
-
/** RPC URL */
|
|
12
|
-
rpcUrl: string;
|
|
13
|
-
/** 链 ID */
|
|
14
|
-
chainId?: number;
|
|
15
|
-
/** Gas Limit(默认 21000) */
|
|
16
|
-
gasLimit?: number;
|
|
17
|
-
/** Gas Price(Gwei,默认 0.1) */
|
|
18
|
-
gasPriceGwei?: number;
|
|
19
|
-
/** 贿赂金额(BNB,默认 0.000001) */
|
|
20
|
-
bribeAmount?: number;
|
|
21
|
-
/** 是否提取利润(默认 true) */
|
|
22
|
-
extractProfit?: boolean;
|
|
23
|
-
/** 利润比例基点(默认 30 = 千分之三) */
|
|
24
|
-
profitBps?: number;
|
|
25
|
-
}
|
|
26
|
-
/** 单个转账参数 */
|
|
27
|
-
export interface PrivateSaleTransferParams {
|
|
28
|
-
/** 发送者私钥 */
|
|
29
|
-
senderPrivateKey: string;
|
|
30
|
-
/** 接收者地址(合约地址) */
|
|
31
|
-
recipient: string;
|
|
32
|
-
/** 转账金额(单位:原生代币,如 BNB) */
|
|
33
|
-
amount: number;
|
|
34
|
-
}
|
|
35
|
-
/** 批量转账参数 */
|
|
36
|
-
export interface BatchPrivateSaleParams {
|
|
37
|
-
/** 转账列表 */
|
|
38
|
-
transfers: PrivateSaleTransferParams[];
|
|
39
|
-
/** 签名配置 */
|
|
40
|
-
config: PrivateSaleSignConfig;
|
|
41
|
-
}
|
|
42
|
-
/** 私募结果 */
|
|
43
|
-
export interface PrivateSaleResult {
|
|
44
|
-
/** 签名交易数组(包含贿赂 + 转账 + 利润) */
|
|
45
|
-
signedTransactions: string[];
|
|
46
|
-
/** ✅ 利润多跳钱包 */
|
|
47
|
-
profitHopWallets?: GeneratedWallet[];
|
|
48
|
-
/** 元数据 */
|
|
49
|
-
metadata: {
|
|
50
|
-
/** 总交易数 */
|
|
51
|
-
totalCount: number;
|
|
52
|
-
/** 贿赂交易数 */
|
|
53
|
-
bribeCount: number;
|
|
54
|
-
/** 转账交易数 */
|
|
55
|
-
transferCount: number;
|
|
56
|
-
/** 利润交易数 */
|
|
57
|
-
profitCount: number;
|
|
58
|
-
/** 总转账金额(Wei) */
|
|
59
|
-
totalAmountWei: string;
|
|
60
|
-
/** 总利润金额(Wei) */
|
|
61
|
-
totalProfitWei: string;
|
|
62
|
-
/** 贿赂金额(Wei) */
|
|
63
|
-
bribeAmountWei: string;
|
|
64
|
-
};
|
|
65
|
-
}
|
|
8
|
+
import type { BatchPrivateSaleParams, PrivateSaleResult, PrivateSaleSignConfig, PrivateSaleTransferParams } from './types/private-sale.js';
|
|
66
9
|
/**
|
|
67
10
|
* 生成私募转账签名交易(带贿赂和利润提取)
|
|
68
11
|
*
|
|
@@ -88,3 +31,4 @@ export declare function batchPrivateSaleMerkle(params: BatchPrivateSaleParams):
|
|
|
88
31
|
* @returns 签名交易结果
|
|
89
32
|
*/
|
|
90
33
|
export declare function privateSaleMerkle(transfer: PrivateSaleTransferParams, config: PrivateSaleSignConfig): Promise<PrivateSaleResult>;
|
|
34
|
+
export type { PrivateSaleSignConfig, PrivateSaleTransferParams, BatchPrivateSaleParams, PrivateSaleResult, } from './types/private-sale.js';
|
|
@@ -6,11 +6,8 @@
|
|
|
6
6
|
* - 利润提取:千分之三(30 bps)
|
|
7
7
|
*/
|
|
8
8
|
import { ethers, Wallet, JsonRpcProvider } from 'ethers';
|
|
9
|
-
import {
|
|
9
|
+
import { getProfitRecipient, getProfitRateBps, BLOCKRAZOR_BUILDER_EOA } from '../shared/constants/index.js';
|
|
10
10
|
import { NonceManager, buildProfitHopTransactions, PROFIT_HOP_COUNT } from './bundle-helpers.js';
|
|
11
|
-
// ============================================================================
|
|
12
|
-
// 核心功能
|
|
13
|
-
// ============================================================================
|
|
14
11
|
/**
|
|
15
12
|
* 生成私募转账签名交易(带贿赂和利润提取)
|
|
16
13
|
*
|
|
@@ -38,7 +35,7 @@ export async function batchPrivateSaleMerkle(params) {
|
|
|
38
35
|
const gasPrice = ethers.parseUnits(String(config.gasPriceGwei || 0.1), 'gwei');
|
|
39
36
|
const bribeAmount = ethers.parseEther(String(config.bribeAmount || 0.000001));
|
|
40
37
|
const extractProfit = config.extractProfit !== false;
|
|
41
|
-
const profitBps = config.profitBps ??
|
|
38
|
+
const profitBps = config.profitBps ?? getProfitRateBps('normal');
|
|
42
39
|
// 创建 Provider
|
|
43
40
|
const provider = new JsonRpcProvider(config.rpcUrl);
|
|
44
41
|
const nonceManager = new NonceManager(provider);
|
|
@@ -68,16 +65,8 @@ export async function batchPrivateSaleMerkle(params) {
|
|
|
68
65
|
uniqueWallets.forEach((wallet, i) => {
|
|
69
66
|
nonceMap.set(wallet.address.toLowerCase(), noncesArray[i]);
|
|
70
67
|
});
|
|
71
|
-
// ✅ 预计算每个钱包的 nonce 分配
|
|
72
68
|
// 第一个钱包:baseNonce(贿赂) → baseNonce+1...+N(转账) → 最后(利润)
|
|
73
69
|
const firstWalletBaseNonce = nonceMap.get(firstWalletKey);
|
|
74
|
-
// 统计第一个钱包的转账数量
|
|
75
|
-
let firstWalletTransferCount = 0;
|
|
76
|
-
for (let i = 0; i < transfers.length; i++) {
|
|
77
|
-
if (transferWallets[i].address.toLowerCase() === firstWalletKey) {
|
|
78
|
-
firstWalletTransferCount++;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
70
|
// ✅ 为每个转账预分配 nonce
|
|
82
71
|
const transferNonces = [];
|
|
83
72
|
const currentNonces = new Map();
|
|
@@ -132,12 +121,12 @@ export async function batchPrivateSaleMerkle(params) {
|
|
|
132
121
|
provider,
|
|
133
122
|
payerWallet: firstWallet,
|
|
134
123
|
profitAmount: profitWei,
|
|
135
|
-
profitRecipient:
|
|
124
|
+
profitRecipient: getProfitRecipient(),
|
|
136
125
|
hopCount: PROFIT_HOP_COUNT,
|
|
137
126
|
gasPrice,
|
|
138
127
|
chainId,
|
|
139
128
|
txType: 0,
|
|
140
|
-
startNonce: profitNonce
|
|
129
|
+
startNonce: profitNonce,
|
|
141
130
|
});
|
|
142
131
|
signedTransactions.push(...profitHopResult.signedTransactions);
|
|
143
132
|
profitHopWallets = profitHopResult.hopWallets; // ✅ 收集利润多跳钱包
|
|
@@ -25,6 +25,10 @@ export declare function createCachedProvider(rpcUrl: string, chainId: number, ch
|
|
|
25
25
|
* 清除 Provider 缓存
|
|
26
26
|
*/
|
|
27
27
|
export declare function clearProviderCache(): void;
|
|
28
|
+
/**
|
|
29
|
+
* ENI 专用 Provider(staticNetwork,适合批量 RPC)
|
|
30
|
+
*/
|
|
31
|
+
export declare function createEniProvider(rpcUrl: string, chainId?: number): JsonRpcProvider;
|
|
28
32
|
/**
|
|
29
33
|
* XLayer 专用 Provider 创建函数
|
|
30
34
|
*/
|
|
@@ -72,6 +72,16 @@ export function createCachedProvider(rpcUrl, chainId, chainName) {
|
|
|
72
72
|
export function clearProviderCache() {
|
|
73
73
|
providerCache.clear();
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* ENI 专用 Provider(staticNetwork,适合批量 RPC)
|
|
77
|
+
*/
|
|
78
|
+
export function createEniProvider(rpcUrl, chainId = 173) {
|
|
79
|
+
return new JsonRpcProvider(rpcUrl, chainId, {
|
|
80
|
+
staticNetwork: true,
|
|
81
|
+
batchMaxCount: 20,
|
|
82
|
+
batchStallTime: 30,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
75
85
|
/**
|
|
76
86
|
* XLayer 专用 Provider 创建函数
|
|
77
87
|
*/
|
|
@@ -7,51 +7,9 @@
|
|
|
7
7
|
* - ERC20 → 原生代币转换报价
|
|
8
8
|
*/
|
|
9
9
|
import { JsonRpcProvider } from 'ethers';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export declare const QUOTE_CONFIG: {
|
|
14
|
-
readonly BSC: {
|
|
15
|
-
readonly v2Router: "0x10ED43C718714eb63d5aA57B78B54704E256024E";
|
|
16
|
-
readonly v3Quoter: "0xB048Bbc1Ee6b733FFfCFb9e9CeF7375518e25997";
|
|
17
|
-
readonly wrappedNative: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c";
|
|
18
|
-
readonly stableCoins: readonly ["0x55d398326f99059fF775485246999027B3197955", "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"];
|
|
19
|
-
};
|
|
20
|
-
readonly MONAD: {
|
|
21
|
-
readonly v2Router: "0xb1bc24c34e88f7d43d5923034e3a14b24daacff9";
|
|
22
|
-
readonly v3Quoter: "";
|
|
23
|
-
readonly wrappedNative: "0x3bd359c1119da7da1d913d1c4d2b7c461115433a";
|
|
24
|
-
readonly stableCoins: readonly [];
|
|
25
|
-
};
|
|
26
|
-
readonly XLAYER: {
|
|
27
|
-
readonly v2Router: "0x881fb2f98c13d521009464e7d1cbf16e1b394e8e";
|
|
28
|
-
readonly v3Quoter: "0x5A6f3723346aF54a4D0693bfC1718D64d4915C3e";
|
|
29
|
-
readonly wrappedNative: "0xe538905cf8410324e03a5a23c1c177a474d59b2b";
|
|
30
|
-
readonly stableCoins: readonly ["0x1E4a5963aBFD975d8c9021ce480b42188849D41d", "0x74b7f16337b8972027f6196a17a631ac6de26d22", "0x779ded0c9e1022225f8e0630b35a9b54be713736"];
|
|
31
|
-
};
|
|
32
|
-
readonly ENI: {
|
|
33
|
-
readonly v2Router: "0x97ed8be49d9a8b86247090aa41e908e76b8fcf22";
|
|
34
|
-
readonly v3Quoter: "";
|
|
35
|
-
readonly wrappedNative: "0x6d1e851446f4d004ae2a72f9afed85e8829a205e";
|
|
36
|
-
readonly stableCoins: readonly ["0xDC1a8A35b0BaA3229b13f348ED708a2fd50b5e3a", "0xaFF944b96c1BAEA587159ec446280E468B32ee15"];
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export type SupportedChain = keyof typeof QUOTE_CONFIG;
|
|
40
|
-
export interface QuoteParams {
|
|
41
|
-
provider: JsonRpcProvider;
|
|
42
|
-
tokenIn: string;
|
|
43
|
-
tokenOut: string;
|
|
44
|
-
amountIn: bigint;
|
|
45
|
-
chain: string;
|
|
46
|
-
version?: 'v2' | 'v3';
|
|
47
|
-
fee?: number;
|
|
48
|
-
routerOverride?: string;
|
|
49
|
-
}
|
|
50
|
-
export interface QuoteResult {
|
|
51
|
-
amountOut: bigint;
|
|
52
|
-
path?: string[];
|
|
53
|
-
fee?: number;
|
|
54
|
-
}
|
|
10
|
+
import { QUOTE_CONFIG, QUOTE_V3_FEE_TIERS } from '../shared/constants/quote.js';
|
|
11
|
+
import type { QuoteParams, QuoteResult } from './types/quote-helpers.js';
|
|
12
|
+
export { QUOTE_CONFIG, QUOTE_V3_FEE_TIERS };
|
|
55
13
|
/**
|
|
56
14
|
* V2 报价(直接路径 + 多跳路径)
|
|
57
15
|
* ✅ 优化:并行尝试直接路径和多跳路径
|
|
@@ -117,3 +75,4 @@ export declare function getWrappedNativeAddress(chain: string): string;
|
|
|
117
75
|
* 获取链的稳定币列表
|
|
118
76
|
*/
|
|
119
77
|
export declare function getStableCoins(chain: string): string[];
|
|
78
|
+
export type { SupportedChain, QuoteParams, QuoteResult } from './types/quote-helpers.js';
|
|
@@ -6,56 +6,11 @@
|
|
|
6
6
|
* - V3 Quoter 报价(多费率尝试 + 多跳路径)
|
|
7
7
|
* - ERC20 → 原生代币转换报价
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import { V2_ROUTER_QUOTE_ABI, V3_QUOTER_ABI } from '../
|
|
11
|
-
|
|
12
|
-
// 常量配置
|
|
13
|
-
// ============================================================================
|
|
14
|
-
// ✅ V2_ROUTER_ABI 和 V3_QUOTER_ABI 从公共模块导入
|
|
9
|
+
import { Contract } from 'ethers';
|
|
10
|
+
import { V2_ROUTER_QUOTE_ABI, V3_QUOTER_ABI } from '../abis/common.js';
|
|
11
|
+
import { QUOTE_CONFIG, QUOTE_V3_FEE_TIERS } from '../shared/constants/quote.js';
|
|
15
12
|
const V2_ROUTER_ABI = V2_ROUTER_QUOTE_ABI;
|
|
16
|
-
|
|
17
|
-
export const V3_FEE_TIERS = [100, 500, 2500, 10000]; // 0.01%, 0.05%, 0.25%, 1%
|
|
18
|
-
/** 各链的报价配置 */
|
|
19
|
-
export const QUOTE_CONFIG = {
|
|
20
|
-
BSC: {
|
|
21
|
-
v2Router: '0x10ED43C718714eb63d5aA57B78B54704E256024E', // PancakeSwap V2 Router
|
|
22
|
-
v3Quoter: '0xB048Bbc1Ee6b733FFfCFb9e9CeF7375518e25997', // PancakeSwap V3 Quoter
|
|
23
|
-
wrappedNative: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // WBNB
|
|
24
|
-
stableCoins: [
|
|
25
|
-
'0x55d398326f99059fF775485246999027B3197955', // USDT
|
|
26
|
-
'0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', // USDC
|
|
27
|
-
'0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', // BUSD
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
MONAD: {
|
|
31
|
-
v2Router: '0xb1bc24c34e88f7d43d5923034e3a14b24daacff9', // PancakeSwap V2
|
|
32
|
-
v3Quoter: '', // TODO: 添加 Monad V3 Quoter
|
|
33
|
-
wrappedNative: '0x3bd359c1119da7da1d913d1c4d2b7c461115433a', // WMON
|
|
34
|
-
stableCoins: [],
|
|
35
|
-
},
|
|
36
|
-
XLAYER: {
|
|
37
|
-
v2Router: '0x881fb2f98c13d521009464e7d1cbf16e1b394e8e', // PotatoSwap V2
|
|
38
|
-
v3Quoter: '0x5A6f3723346aF54a4D0693bfC1718D64d4915C3e', // ✅ PotatoSwap V3 QuoterV2
|
|
39
|
-
wrappedNative: '0xe538905cf8410324e03a5a23c1c177a474d59b2b', // WOKB
|
|
40
|
-
stableCoins: [
|
|
41
|
-
'0x1E4a5963aBFD975d8c9021ce480b42188849D41d', // USDT
|
|
42
|
-
'0x74b7f16337b8972027f6196a17a631ac6de26d22', // USDC
|
|
43
|
-
'0x779ded0c9e1022225f8e0630b35a9b54be713736', // USD₮0
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
ENI: {
|
|
47
|
-
v2Router: '0x97ed8be49d9a8b86247090aa41e908e76b8fcf22', // DSWAP V2 Router
|
|
48
|
-
v3Quoter: '',
|
|
49
|
-
wrappedNative: '0x6d1e851446f4d004ae2a72f9afed85e8829a205e', // WEGAS
|
|
50
|
-
stableCoins: [
|
|
51
|
-
'0xDC1a8A35b0BaA3229b13f348ED708a2fd50b5e3a', // USDT (18 decimals)
|
|
52
|
-
'0xaFF944b96c1BAEA587159ec446280E468B32ee15', // USDC (18 decimals)
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
// ============================================================================
|
|
57
|
-
// V2 报价
|
|
58
|
-
// ============================================================================
|
|
13
|
+
export { QUOTE_CONFIG, QUOTE_V3_FEE_TIERS };
|
|
59
14
|
/**
|
|
60
15
|
* V2 报价(直接路径 + 多跳路径)
|
|
61
16
|
* ✅ 优化:并行尝试直接路径和多跳路径
|
|
@@ -74,7 +29,6 @@ export async function quoteV2(provider, tokenIn, tokenOut, amountIn, chain, rout
|
|
|
74
29
|
const chainUpper = chain.toUpperCase();
|
|
75
30
|
const config = QUOTE_CONFIG[chainUpper];
|
|
76
31
|
if (!config) {
|
|
77
|
-
console.warn(`[quoteV2] 不支持的链: ${chain}`);
|
|
78
32
|
return { amountOut: 0n };
|
|
79
33
|
}
|
|
80
34
|
const routerAddress = routerOverride || config.v2Router;
|
|
@@ -93,16 +47,13 @@ export async function quoteV2(provider, tokenIn, tokenOut, amountIn, chain, rout
|
|
|
93
47
|
}
|
|
94
48
|
}
|
|
95
49
|
// ✅ 并行尝试所有路径
|
|
96
|
-
console.log(`[quoteV2] 输入: ${amountIn} wei, tokenIn=${tokenIn}, tokenOut=${tokenOut}`);
|
|
97
50
|
const quotePromises = paths.map(async (path) => {
|
|
98
51
|
try {
|
|
99
52
|
const amounts = await router.getAmountsOut(amountIn, path);
|
|
100
53
|
const amountOut = amounts[amounts.length - 1];
|
|
101
|
-
console.log(`[quoteV2] 路径 ${path.map(p => p.slice(0, 10) + '...').join(' → ')}: ${amountOut} wei`);
|
|
102
54
|
return { amountOut, path, success: amountOut > 0n };
|
|
103
55
|
}
|
|
104
|
-
catch
|
|
105
|
-
console.log(`[quoteV2] 路径失败 ${path.map(p => p.slice(0, 10) + '...').join(' → ')}: ${e.message?.slice(0, 50)}`);
|
|
56
|
+
catch {
|
|
106
57
|
return { amountOut: 0n, path, success: false };
|
|
107
58
|
}
|
|
108
59
|
});
|
|
@@ -110,11 +61,9 @@ export async function quoteV2(provider, tokenIn, tokenOut, amountIn, chain, rout
|
|
|
110
61
|
// 找到第一个成功的结果(优先直接路径)
|
|
111
62
|
for (const result of results) {
|
|
112
63
|
if (result.success) {
|
|
113
|
-
console.log(`[quoteV2] 路径成功 (${result.path.length === 2 ? '直接' : '多跳'}): ${ethers.formatEther(result.amountOut)}`);
|
|
114
64
|
return { amountOut: result.amountOut, path: result.path };
|
|
115
65
|
}
|
|
116
66
|
}
|
|
117
|
-
console.warn(`[quoteV2] 所有路径均失败`);
|
|
118
67
|
return { amountOut: 0n };
|
|
119
68
|
}
|
|
120
69
|
// ============================================================================
|
|
@@ -139,19 +88,18 @@ export async function quoteV3(provider, tokenIn, tokenOut, amountIn, chain, pref
|
|
|
139
88
|
const chainUpper = chain.toUpperCase();
|
|
140
89
|
const config = QUOTE_CONFIG[chainUpper];
|
|
141
90
|
if (!config) {
|
|
142
|
-
console.warn(`[quoteV3] 不支持的链: ${chain}`);
|
|
143
91
|
return { amountOut: 0n };
|
|
144
92
|
}
|
|
145
93
|
if (!config.v3Quoter) {
|
|
146
|
-
console.warn(`[quoteV3] 该链不支持 V3 Quoter: ${chain}`);
|
|
147
94
|
return { amountOut: 0n };
|
|
148
95
|
}
|
|
149
96
|
const quoter = new Contract(config.v3Quoter, V3_QUOTER_ABI, provider);
|
|
150
97
|
const tokenInLower = tokenIn.toLowerCase();
|
|
151
98
|
const tokenOutLower = tokenOut.toLowerCase();
|
|
152
99
|
// 如果指定了费率,优先尝试;否则尝试所有费率
|
|
153
|
-
const feesToTry = preferredFee
|
|
154
|
-
|
|
100
|
+
const feesToTry = preferredFee
|
|
101
|
+
? [preferredFee, ...QUOTE_V3_FEE_TIERS.filter((f) => f !== preferredFee)]
|
|
102
|
+
: [...QUOTE_V3_FEE_TIERS];
|
|
155
103
|
// ✅ 策略 1:并行尝试所有费率的直接路径
|
|
156
104
|
const directQuotePromises = feesToTry.map(async (fee) => {
|
|
157
105
|
try {
|
|
@@ -160,7 +108,7 @@ export async function quoteV3(provider, tokenIn, tokenOut, amountIn, chain, pref
|
|
|
160
108
|
tokenOut,
|
|
161
109
|
amountIn,
|
|
162
110
|
fee,
|
|
163
|
-
sqrtPriceLimitX96: 0n
|
|
111
|
+
sqrtPriceLimitX96: 0n,
|
|
164
112
|
});
|
|
165
113
|
const amountOut = Array.isArray(result) ? result[0] : result;
|
|
166
114
|
return { amountOut: amountOut || 0n, fee, success: amountOut && amountOut > 0n };
|
|
@@ -173,24 +121,23 @@ export async function quoteV3(provider, tokenIn, tokenOut, amountIn, chain, pref
|
|
|
173
121
|
// 按费率优先级返回第一个成功的结果
|
|
174
122
|
for (const result of directResults) {
|
|
175
123
|
if (result.success) {
|
|
176
|
-
console.log(`[quoteV3] 直接路径成功 (fee=${result.fee}): ${ethers.formatEther(result.amountOut)}`);
|
|
177
124
|
return { amountOut: result.amountOut, fee: result.fee };
|
|
178
125
|
}
|
|
179
126
|
}
|
|
180
127
|
// ✅ 策略 2:并行尝试多跳路径(通过稳定币)
|
|
181
|
-
const validStableCoins = config.stableCoins.filter(sc => {
|
|
128
|
+
const validStableCoins = config.stableCoins.filter((sc) => {
|
|
182
129
|
const stableLower = sc.toLowerCase();
|
|
183
130
|
return tokenInLower !== stableLower && tokenOutLower !== stableLower;
|
|
184
131
|
});
|
|
185
132
|
// 并行尝试所有稳定币的第一跳
|
|
186
|
-
const firstHopPromises = validStableCoins.flatMap(stableCoin => feesToTry.map(async (fee1) => {
|
|
133
|
+
const firstHopPromises = validStableCoins.flatMap((stableCoin) => feesToTry.map(async (fee1) => {
|
|
187
134
|
try {
|
|
188
135
|
const midResult = await quoter.quoteExactInputSingle.staticCall({
|
|
189
136
|
tokenIn,
|
|
190
137
|
tokenOut: stableCoin,
|
|
191
138
|
amountIn,
|
|
192
139
|
fee: fee1,
|
|
193
|
-
sqrtPriceLimitX96: 0n
|
|
140
|
+
sqrtPriceLimitX96: 0n,
|
|
194
141
|
});
|
|
195
142
|
const midAmount = Array.isArray(midResult) ? midResult[0] : midResult;
|
|
196
143
|
return { midAmount: midAmount || 0n, stableCoin, fee1, success: midAmount && midAmount > 0n };
|
|
@@ -200,17 +147,17 @@ export async function quoteV3(provider, tokenIn, tokenOut, amountIn, chain, pref
|
|
|
200
147
|
}
|
|
201
148
|
}));
|
|
202
149
|
const firstHopResults = await Promise.all(firstHopPromises);
|
|
203
|
-
const successfulFirstHops = firstHopResults.filter(r => r.success);
|
|
150
|
+
const successfulFirstHops = firstHopResults.filter((r) => r.success);
|
|
204
151
|
// 对成功的第一跳,并行尝试第二跳
|
|
205
152
|
const stableFees = [100, 500, 2500];
|
|
206
|
-
const secondHopPromises = successfulFirstHops.flatMap(hop => stableFees.map(async (fee2) => {
|
|
153
|
+
const secondHopPromises = successfulFirstHops.flatMap((hop) => stableFees.map(async (fee2) => {
|
|
207
154
|
try {
|
|
208
155
|
const finalResult = await quoter.quoteExactInputSingle.staticCall({
|
|
209
156
|
tokenIn: hop.stableCoin,
|
|
210
157
|
tokenOut,
|
|
211
158
|
amountIn: hop.midAmount,
|
|
212
159
|
fee: fee2,
|
|
213
|
-
sqrtPriceLimitX96: 0n
|
|
160
|
+
sqrtPriceLimitX96: 0n,
|
|
214
161
|
});
|
|
215
162
|
const amountOut = Array.isArray(finalResult) ? finalResult[0] : finalResult;
|
|
216
163
|
return { amountOut: amountOut || 0n, fee1: hop.fee1, fee2, success: amountOut && amountOut > 0n };
|
|
@@ -223,11 +170,9 @@ export async function quoteV3(provider, tokenIn, tokenOut, amountIn, chain, pref
|
|
|
223
170
|
// 返回第一个成功的多跳结果
|
|
224
171
|
for (const result of secondHopResults) {
|
|
225
172
|
if (result.success) {
|
|
226
|
-
console.log(`[quoteV3] 多跳路径成功 (${result.fee1}→${result.fee2}): ${ethers.formatEther(result.amountOut)}`);
|
|
227
173
|
return { amountOut: result.amountOut, fee: result.fee1 };
|
|
228
174
|
}
|
|
229
175
|
}
|
|
230
|
-
console.warn(`[quoteV3] 所有路径均失败`);
|
|
231
176
|
return { amountOut: 0n };
|
|
232
177
|
}
|
|
233
178
|
// ============================================================================
|
|
@@ -267,7 +212,6 @@ export async function getTokenToNativeQuote(provider, tokenAddress, tokenAmount,
|
|
|
267
212
|
const chainUpper = chain.toUpperCase();
|
|
268
213
|
const config = QUOTE_CONFIG[chainUpper];
|
|
269
214
|
if (!config) {
|
|
270
|
-
console.warn(`[getTokenToNativeQuote] 不支持的链: ${chain}`);
|
|
271
215
|
return 0n;
|
|
272
216
|
}
|
|
273
217
|
const tokenLower = tokenAddress.toLowerCase();
|
|
@@ -284,7 +228,7 @@ export async function getTokenToNativeQuote(provider, tokenAddress, tokenAmount,
|
|
|
284
228
|
chain,
|
|
285
229
|
version,
|
|
286
230
|
fee,
|
|
287
|
-
routerOverride
|
|
231
|
+
routerOverride,
|
|
288
232
|
});
|
|
289
233
|
return result.amountOut;
|
|
290
234
|
}
|
|
@@ -305,7 +249,6 @@ export async function getNativeToTokenQuote(provider, tokenAddress, nativeAmount
|
|
|
305
249
|
const chainUpper = chain.toUpperCase();
|
|
306
250
|
const config = QUOTE_CONFIG[chainUpper];
|
|
307
251
|
if (!config) {
|
|
308
|
-
console.warn(`[getNativeToTokenQuote] 不支持的链: ${chain}`);
|
|
309
252
|
return 0n;
|
|
310
253
|
}
|
|
311
254
|
const tokenLower = tokenAddress.toLowerCase();
|
|
@@ -321,7 +264,7 @@ export async function getNativeToTokenQuote(provider, tokenAddress, nativeAmount
|
|
|
321
264
|
amountIn: nativeAmount,
|
|
322
265
|
chain,
|
|
323
266
|
version,
|
|
324
|
-
fee
|
|
267
|
+
fee,
|
|
325
268
|
});
|
|
326
269
|
return result.amountOut;
|
|
327
270
|
}
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type StealthTransferResult
|
|
3
|
-
bundleUuid: string;
|
|
4
|
-
txs: string[];
|
|
5
|
-
hopAddresses: string[];
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* 简化版隐秘转账参数
|
|
9
|
-
* - 仅需人类可读金额与(可选)代币地址,其余自动处理
|
|
10
|
-
* - 未提供 tokenAddress → 原生币模式;提供 tokenAddress → 自动读取 decimals 转换为 wei 的代币模式
|
|
11
|
-
*/
|
|
12
|
-
export type StealthTransferSimpleParams = {
|
|
13
|
-
rpcUrl: string;
|
|
14
|
-
chainId: number;
|
|
15
|
-
rootPrivateKey: string;
|
|
16
|
-
finalTo: string;
|
|
17
|
-
hopCount: number;
|
|
18
|
-
amount: string;
|
|
19
|
-
tokenAddress?: string;
|
|
20
|
-
tokenHolderPrivateKey?: string;
|
|
21
|
-
bundleEndpoint?: string;
|
|
22
|
-
gasPriceGwei?: string;
|
|
23
|
-
gasLimit?: bigint;
|
|
24
|
-
blockOffset?: number;
|
|
25
|
-
spMode?: SoulPointSignatureMode;
|
|
26
|
-
spPrivateKey?: string;
|
|
27
|
-
spVMode?: VNormalizationMode;
|
|
28
|
-
};
|
|
1
|
+
import type { StealthTransferResult, StealthTransferSimpleParams } from './types/stealth-transfer.js';
|
|
2
|
+
export type { StealthTransferResult, StealthTransferSimpleParams } from './types/stealth-transfer.js';
|
|
29
3
|
/**
|
|
30
4
|
* 隐秘转账(简化版)
|
|
31
5
|
* - 原生模式:amount 按 parseEther 转 wei
|
|
@@ -54,8 +54,8 @@ async function _stealthTransferInternal(params) {
|
|
|
54
54
|
throw new Error(`insufficient balance: need ${needed.toString()}, have ${rootBal.toString()}`);
|
|
55
55
|
}
|
|
56
56
|
// ✅ 并行预取所有 nonce
|
|
57
|
-
const allAddresses = [rootAddr, ...hops.map(w => w.address)];
|
|
58
|
-
const nonces = await Promise.all(allAddresses.map(addr => provider.getTransactionCount(addr, 'pending')));
|
|
57
|
+
const allAddresses = [rootAddr, ...hops.map((w) => w.address)];
|
|
58
|
+
const nonces = await Promise.all(allAddresses.map((addr) => provider.getTransactionCount(addr, 'pending')));
|
|
59
59
|
const signed = [];
|
|
60
60
|
const hopAddresses = [];
|
|
61
61
|
if (mode !== 'erc20') {
|
|
@@ -92,10 +92,14 @@ async function _stealthTransferInternal(params) {
|
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
94
94
|
// ============== ERC20 代币多跳路径 ==============
|
|
95
|
+
const erc20Config = erc20;
|
|
96
|
+
if (!erc20Config?.address) {
|
|
97
|
+
throw new Error('erc20.address is required in erc20 mode');
|
|
98
|
+
}
|
|
95
99
|
const erc20Iface = new ethers.Interface(['function transfer(address,uint256) returns (bool)']);
|
|
96
|
-
const transferGas =
|
|
100
|
+
const transferGas = erc20Config.transferGasLimit ?? GAS_LIMITS.ERC20_TRANSFER;
|
|
97
101
|
// 填充 hopAddresses
|
|
98
|
-
hops.forEach(hop => hopAddresses.push(hop.address));
|
|
102
|
+
hops.forEach((hop) => hopAddresses.push(hop.address));
|
|
99
103
|
// ✅ 并行签名所有 gas 注资交易(root -> hop[i])
|
|
100
104
|
const fundTxs = await Promise.all(hops.map((hop, i) => root.signTransaction({
|
|
101
105
|
to: hop.address,
|
|
@@ -108,14 +112,14 @@ async function _stealthTransferInternal(params) {
|
|
|
108
112
|
})));
|
|
109
113
|
signed.push(...fundTxs);
|
|
110
114
|
// 代币持有者:可选独立私钥,未提供则用 root
|
|
111
|
-
const tokenOwner =
|
|
112
|
-
? new ethers.Wallet(
|
|
115
|
+
const tokenOwner = erc20Config.holderPrivateKey && erc20Config.holderPrivateKey.length > 0
|
|
116
|
+
? new ethers.Wallet(erc20Config.holderPrivateKey, provider)
|
|
113
117
|
: root;
|
|
114
118
|
// tokenOwner -> hop0: ERC20 transfer 全量 token
|
|
115
119
|
const callDataRoot = erc20Iface.encodeFunctionData('transfer', [hops[0].address, amountWei]);
|
|
116
120
|
const rootTokenNonce = nonces[0] + hops.length;
|
|
117
121
|
const erc20TxRoot = await tokenOwner.signTransaction({
|
|
118
|
-
to:
|
|
122
|
+
to: erc20Config.address,
|
|
119
123
|
data: callDataRoot,
|
|
120
124
|
value: 0n,
|
|
121
125
|
nonce: rootTokenNonce,
|
|
@@ -131,7 +135,7 @@ async function _stealthTransferInternal(params) {
|
|
|
131
135
|
const nextTo = isLast ? finalTo : hops[i + 1].address;
|
|
132
136
|
const callData = erc20Iface.encodeFunctionData('transfer', [nextTo, amountWei]);
|
|
133
137
|
return hop.signTransaction({
|
|
134
|
-
to:
|
|
138
|
+
to: erc20Config.address,
|
|
135
139
|
data: callData,
|
|
136
140
|
value: 0n,
|
|
137
141
|
nonce: nonces[i + 1],
|
|
@@ -148,9 +152,7 @@ async function _stealthTransferInternal(params) {
|
|
|
148
152
|
const bundleUuid = await club48.sendBundle({
|
|
149
153
|
txs: signed,
|
|
150
154
|
maxBlockNumber: (await provider.getBlockNumber()) + blockOffset,
|
|
151
|
-
}, spPrivateKey
|
|
152
|
-
? { spMode: spMode ?? 'timestampPersonalSign', spPrivateKey, spVMode }
|
|
153
|
-
: undefined);
|
|
155
|
+
}, spPrivateKey ? { spMode: spMode ?? 'timestampPersonalSign', spPrivateKey, spVMode } : undefined);
|
|
154
156
|
return { bundleUuid, txs: signed, hopAddresses };
|
|
155
157
|
}
|
|
156
158
|
/**
|
|
@@ -160,21 +162,30 @@ async function _stealthTransferInternal(params) {
|
|
|
160
162
|
* - 自动生成 hopCount 个中转地址,并通过 48.club Bundle 原子提交
|
|
161
163
|
*/
|
|
162
164
|
export async function stealthTransfer(params) {
|
|
163
|
-
const { rpcUrl, chainId, rootPrivateKey, finalTo, hopCount, amount, tokenAddress, tokenHolderPrivateKey, bundleEndpoint, gasPriceGwei, gasLimit, blockOffset, spMode, spPrivateKey, spVMode } = params;
|
|
165
|
+
const { rpcUrl, chainId, rootPrivateKey, finalTo, hopCount, amount, tokenAddress, tokenHolderPrivateKey, bundleEndpoint, gasPriceGwei, gasLimit, blockOffset, spMode, spPrivateKey, spVMode, } = params;
|
|
164
166
|
if (!tokenAddress) {
|
|
165
167
|
// 原生:直接 parseEther
|
|
166
168
|
const amountWei = ethers.parseEther(amount);
|
|
167
169
|
return await _stealthTransferInternal({
|
|
168
|
-
rpcUrl,
|
|
170
|
+
rpcUrl,
|
|
171
|
+
chainId,
|
|
172
|
+
rootPrivateKey,
|
|
173
|
+
finalTo,
|
|
174
|
+
hopCount,
|
|
169
175
|
amountWei,
|
|
170
176
|
mode: 'native',
|
|
171
|
-
bundleEndpoint,
|
|
172
|
-
|
|
177
|
+
bundleEndpoint,
|
|
178
|
+
gasPriceGwei,
|
|
179
|
+
gasLimit,
|
|
180
|
+
blockOffset,
|
|
181
|
+
spMode,
|
|
182
|
+
spPrivateKey,
|
|
183
|
+
spVMode,
|
|
173
184
|
});
|
|
174
185
|
}
|
|
175
186
|
// ERC20:自动读取 decimals(读取失败则回退 18)
|
|
176
187
|
const provider = new JsonRpcProvider(rpcUrl, chainId);
|
|
177
|
-
let decimals
|
|
188
|
+
let decimals;
|
|
178
189
|
try {
|
|
179
190
|
const erc20 = new ethers.Contract(tokenAddress, ['function decimals() view returns (uint8)'], provider);
|
|
180
191
|
decimals = Number(await erc20.decimals());
|
|
@@ -186,11 +197,20 @@ export async function stealthTransfer(params) {
|
|
|
186
197
|
}
|
|
187
198
|
const amountWei = ethers.parseUnits(amount, decimals);
|
|
188
199
|
return await _stealthTransferInternal({
|
|
189
|
-
rpcUrl,
|
|
200
|
+
rpcUrl,
|
|
201
|
+
chainId,
|
|
202
|
+
rootPrivateKey,
|
|
203
|
+
finalTo,
|
|
204
|
+
hopCount,
|
|
190
205
|
amountWei,
|
|
191
206
|
mode: 'erc20',
|
|
192
207
|
erc20: { address: tokenAddress, holderPrivateKey: tokenHolderPrivateKey },
|
|
193
|
-
bundleEndpoint,
|
|
194
|
-
|
|
208
|
+
bundleEndpoint,
|
|
209
|
+
gasPriceGwei,
|
|
210
|
+
gasLimit,
|
|
211
|
+
blockOffset,
|
|
212
|
+
spMode,
|
|
213
|
+
spPrivateKey,
|
|
214
|
+
spVMode,
|
|
195
215
|
});
|
|
196
216
|
}
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* 换手交易通用工具函数
|
|
3
3
|
*/
|
|
4
4
|
import { Wallet, JsonRpcProvider } from 'ethers';
|
|
5
|
+
import type { MerkleClient } from '../shared/clients/merkle.js';
|
|
5
6
|
/**
|
|
6
7
|
* 检查并执行代币授权(如果需要)
|
|
7
8
|
* ✅ 与 pancake-proxy.ts 的授权逻辑一致
|
|
8
9
|
*/
|
|
9
|
-
export declare function ensureTokenApproval(provider: JsonRpcProvider, merkle:
|
|
10
|
+
export declare function ensureTokenApproval(provider: JsonRpcProvider, merkle: MerkleClient, wallet: Wallet, tokenAddress: string, spenderAddress: string, config: {
|
|
10
11
|
gasLimit?: number;
|
|
11
12
|
gasLimitMultiplier?: number;
|
|
12
13
|
minGasPriceGwei?: number;
|
|
@@ -38,17 +39,3 @@ export declare function calculateSwapLoss(sellAmount: bigint, buyAmount: bigint)
|
|
|
38
39
|
* 验证钱包BNB余额
|
|
39
40
|
*/
|
|
40
41
|
export declare function validateBNBBalance(provider: JsonRpcProvider, walletAddress: string, requiredBNB: bigint, purpose: string): Promise<void>;
|
|
41
|
-
/**
|
|
42
|
-
* 格式化换手结果日志
|
|
43
|
-
*/
|
|
44
|
-
export declare function logSwapResult(params: {
|
|
45
|
-
sellerAddress: string;
|
|
46
|
-
buyerAddress: string;
|
|
47
|
-
tokenAddress: string;
|
|
48
|
-
sellAmount: bigint;
|
|
49
|
-
buyAmount: bigint;
|
|
50
|
-
decimals: number;
|
|
51
|
-
sellerGotBNB: bigint;
|
|
52
|
-
buyerSpentBNB: bigint;
|
|
53
|
-
swapType: string;
|
|
54
|
-
}): void;
|