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
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { ethers, Contract } from 'ethers';
|
|
2
|
+
import { getDeadline } from '../bundle-helpers.js';
|
|
3
|
+
import { ADDRESSES } from '../constants.js';
|
|
4
|
+
import { FLAP_PORTAL_ADDRESSES } from '../../shared/flap/constants.js';
|
|
5
|
+
import { V2_ROUTER_ABI, V3_ROUTER02_ABI, V3_ROUTER_LEGACY_ABI } from '../../abis/common.js';
|
|
6
|
+
import { ENI_DAOAAS_PORTAL_ADDRESS, FOUR_TM2_ABI, PANCAKE_V3_ROUTER_ADDRESS, XLAYER_V3_ROUTER_ADDRESS, } from './addresses.js';
|
|
7
|
+
import { getRouterAddress, getWrappedNativeAddress } from './routing.js';
|
|
8
|
+
/**
|
|
9
|
+
* 构建 Flap 买入交易
|
|
10
|
+
* 使用 swapExactInput 方法
|
|
11
|
+
*/
|
|
12
|
+
export async function buildFlapBuyTx(wallet, tokenAddress, buyAmount, nonce, gasPrice, gasLimit, chainId, txType, chain) {
|
|
13
|
+
const portalAddress = FLAP_PORTAL_ADDRESSES[chain];
|
|
14
|
+
// ✅ 使用正确的 Flap Portal ABI
|
|
15
|
+
const iface = new ethers.Interface([
|
|
16
|
+
'function swapExactInput((address inputToken,address outputToken,uint256 inputAmount,uint256 minOutputAmount,bytes permitData)) external payable returns (uint256)',
|
|
17
|
+
]);
|
|
18
|
+
// ✅ 构建 swapExactInput 参数
|
|
19
|
+
// inputToken = 0x0 表示原生代币(BNB)
|
|
20
|
+
// outputToken = tokenAddress(要买入的代币)
|
|
21
|
+
const data = iface.encodeFunctionData('swapExactInput', [
|
|
22
|
+
{
|
|
23
|
+
inputToken: ethers.ZeroAddress, // 原生代币(BNB)
|
|
24
|
+
outputToken: tokenAddress, // 要买入的代币
|
|
25
|
+
inputAmount: buyAmount,
|
|
26
|
+
minOutputAmount: 0n, // 不设滑点保护
|
|
27
|
+
permitData: '0x',
|
|
28
|
+
},
|
|
29
|
+
]);
|
|
30
|
+
const tx = {
|
|
31
|
+
to: portalAddress,
|
|
32
|
+
data,
|
|
33
|
+
value: buyAmount,
|
|
34
|
+
nonce,
|
|
35
|
+
gasLimit: BigInt(gasLimit),
|
|
36
|
+
chainId,
|
|
37
|
+
};
|
|
38
|
+
if (txType === 2) {
|
|
39
|
+
tx.maxFeePerGas = gasPrice;
|
|
40
|
+
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
41
|
+
tx.type = 2;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
tx.gasPrice = gasPrice;
|
|
45
|
+
tx.type = 0;
|
|
46
|
+
}
|
|
47
|
+
return await wallet.signTransaction(tx);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 构建 Four 内盘买入交易
|
|
51
|
+
* 使用 buyTokenAMAP 方法
|
|
52
|
+
*/
|
|
53
|
+
export async function buildFourBuyTx(wallet, tokenAddress, buyAmount, nonce, gasPrice, gasLimit, chainId, txType) {
|
|
54
|
+
const tmAddress = ADDRESSES.BSC.TokenManagerOriginal;
|
|
55
|
+
const iface = new ethers.Interface(FOUR_TM2_ABI);
|
|
56
|
+
const data = iface.encodeFunctionData('buyTokenAMAP', [
|
|
57
|
+
0n, // origin
|
|
58
|
+
tokenAddress, // token
|
|
59
|
+
wallet.address, // to(接收者为自己)
|
|
60
|
+
buyAmount, // funds
|
|
61
|
+
0n, // minAmount(不设滑点保护)
|
|
62
|
+
]);
|
|
63
|
+
const tx = {
|
|
64
|
+
to: tmAddress,
|
|
65
|
+
data,
|
|
66
|
+
value: buyAmount,
|
|
67
|
+
nonce,
|
|
68
|
+
gasLimit: BigInt(gasLimit),
|
|
69
|
+
chainId,
|
|
70
|
+
};
|
|
71
|
+
if (txType === 2) {
|
|
72
|
+
tx.maxFeePerGas = gasPrice;
|
|
73
|
+
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
74
|
+
tx.type = 2;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
tx.gasPrice = gasPrice;
|
|
78
|
+
tx.type = 0;
|
|
79
|
+
}
|
|
80
|
+
return await wallet.signTransaction(tx);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 构建 DAOaaS 内盘买入交易 (ENI 链)
|
|
84
|
+
* EGAS → Token (使用 DAOaaS Portal buy)
|
|
85
|
+
*/
|
|
86
|
+
export async function buildDaoaasBuyTx(wallet, tokenAddress, buyAmount, nonce, gasPrice, gasLimit, chainId) {
|
|
87
|
+
const portalAbi = ['function purchaseToken(address token, uint256 AmountMin) payable'];
|
|
88
|
+
const iface = new ethers.Interface(portalAbi);
|
|
89
|
+
const data = iface.encodeFunctionData('purchaseToken', [tokenAddress, 0n]);
|
|
90
|
+
const tx = {
|
|
91
|
+
to: ENI_DAOAAS_PORTAL_ADDRESS,
|
|
92
|
+
data,
|
|
93
|
+
value: buyAmount,
|
|
94
|
+
nonce,
|
|
95
|
+
gasLimit: BigInt(gasLimit),
|
|
96
|
+
chainId,
|
|
97
|
+
type: 2,
|
|
98
|
+
maxFeePerGas: gasPrice,
|
|
99
|
+
maxPriorityFeePerGas: gasPrice / 10n || 1n,
|
|
100
|
+
};
|
|
101
|
+
return await wallet.signTransaction(tx);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 构建 V2 买入交易
|
|
105
|
+
* BNB/OKB → Token (使用 swapExactETHForTokensSupportingFeeOnTransferTokens)
|
|
106
|
+
*/
|
|
107
|
+
export async function buildV2BuyTx(wallet, tokenAddress, buyAmount, nonce, gasPrice, gasLimit, chainId, txType, v2Path, chain, v2RouterOverride) {
|
|
108
|
+
const wrappedNative = getWrappedNativeAddress(chain);
|
|
109
|
+
const routerAddress = v2RouterOverride || getRouterAddress('v2', chain);
|
|
110
|
+
const path = v2Path ? [...v2Path].reverse() : [wrappedNative, tokenAddress];
|
|
111
|
+
const deadline = getDeadline();
|
|
112
|
+
const v2Router = new Contract(routerAddress, V2_ROUTER_ABI, wallet);
|
|
113
|
+
const unsigned = await v2Router.swapExactETHForTokensSupportingFeeOnTransferTokens.populateTransaction(0n, // amountOutMin(不设滑点保护)
|
|
114
|
+
path, wallet.address, deadline, { value: buyAmount });
|
|
115
|
+
const tx = {
|
|
116
|
+
...unsigned,
|
|
117
|
+
nonce,
|
|
118
|
+
gasLimit: BigInt(gasLimit),
|
|
119
|
+
chainId,
|
|
120
|
+
};
|
|
121
|
+
if (txType === 2) {
|
|
122
|
+
tx.maxFeePerGas = gasPrice;
|
|
123
|
+
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
124
|
+
tx.type = 2;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
tx.gasPrice = gasPrice;
|
|
128
|
+
tx.type = 0;
|
|
129
|
+
}
|
|
130
|
+
return await wallet.signTransaction(tx);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 构建 V3 单跳买入交易
|
|
134
|
+
* BNB/OKB → Token (使用 exactInputSingle + multicall)
|
|
135
|
+
*
|
|
136
|
+
* ✅ 修复:根据链类型选择正确的 Router ABI 版本
|
|
137
|
+
* - XLayer/Monad: 旧版 Router(exactInputSingle 包含 deadline,multicall(bytes[]))
|
|
138
|
+
* - BSC: 新版 SwapRouter02(exactInputSingle 不含 deadline,multicall(uint256,bytes[]))
|
|
139
|
+
*/
|
|
140
|
+
export async function buildV3BuyTx(wallet, tokenAddress, buyAmount, nonce, gasPrice, gasLimit, chainId, txType, v3Fee = 2500, // 默认 0.25% 手续费
|
|
141
|
+
chain) {
|
|
142
|
+
const deadline = getDeadline();
|
|
143
|
+
const wrappedNative = getWrappedNativeAddress(chain);
|
|
144
|
+
const routerAddress = chain === 'XLAYER' ? XLAYER_V3_ROUTER_ADDRESS : PANCAKE_V3_ROUTER_ADDRESS;
|
|
145
|
+
// ✅ 根据链类型选择正确的 ABI 版本
|
|
146
|
+
// XLayer/Monad 使用旧版 Router(exactInputSingle 包含 deadline)
|
|
147
|
+
// BSC 使用新版 SwapRouter02(exactInputSingle 不含 deadline)
|
|
148
|
+
const useLegacyRouter = chain === 'XLAYER' || chain === 'MONAD';
|
|
149
|
+
const v3RouterIface = new ethers.Interface(useLegacyRouter ? V3_ROUTER_LEGACY_ABI : V3_ROUTER02_ABI);
|
|
150
|
+
let multicallData;
|
|
151
|
+
if (useLegacyRouter) {
|
|
152
|
+
// ✅ 旧版 Router:swapParams 包含 deadline,multicall(bytes[])
|
|
153
|
+
const swapParams = {
|
|
154
|
+
tokenIn: wrappedNative,
|
|
155
|
+
tokenOut: tokenAddress,
|
|
156
|
+
fee: v3Fee,
|
|
157
|
+
recipient: wallet.address,
|
|
158
|
+
deadline, // ✅ 旧版包含 deadline
|
|
159
|
+
amountIn: buyAmount,
|
|
160
|
+
amountOutMinimum: 0n,
|
|
161
|
+
sqrtPriceLimitX96: 0n,
|
|
162
|
+
};
|
|
163
|
+
const exactInputSingleData = v3RouterIface.encodeFunctionData('exactInputSingle', [swapParams]);
|
|
164
|
+
const refundETHData = v3RouterIface.encodeFunctionData('refundETH', []);
|
|
165
|
+
// ✅ 旧版 multicall:只有 bytes[] 参数
|
|
166
|
+
multicallData = v3RouterIface.encodeFunctionData('multicall(bytes[])', [[exactInputSingleData, refundETHData]]);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
// ✅ 新版 SwapRouter02:swapParams 不含 deadline,multicall(uint256,bytes[])
|
|
170
|
+
const swapParams = {
|
|
171
|
+
tokenIn: wrappedNative,
|
|
172
|
+
tokenOut: tokenAddress,
|
|
173
|
+
fee: v3Fee,
|
|
174
|
+
recipient: wallet.address,
|
|
175
|
+
amountIn: buyAmount,
|
|
176
|
+
amountOutMinimum: 0n,
|
|
177
|
+
sqrtPriceLimitX96: 0n,
|
|
178
|
+
};
|
|
179
|
+
const exactInputSingleData = v3RouterIface.encodeFunctionData('exactInputSingle', [swapParams]);
|
|
180
|
+
const refundETHData = v3RouterIface.encodeFunctionData('refundETH', []);
|
|
181
|
+
// ✅ 新版 multicall:deadline 作为第一个参数
|
|
182
|
+
multicallData = v3RouterIface.encodeFunctionData('multicall(uint256,bytes[])', [
|
|
183
|
+
deadline,
|
|
184
|
+
[exactInputSingleData, refundETHData],
|
|
185
|
+
]);
|
|
186
|
+
}
|
|
187
|
+
const tx = {
|
|
188
|
+
to: routerAddress,
|
|
189
|
+
data: multicallData,
|
|
190
|
+
value: buyAmount,
|
|
191
|
+
nonce,
|
|
192
|
+
gasLimit: BigInt(gasLimit),
|
|
193
|
+
chainId,
|
|
194
|
+
};
|
|
195
|
+
if (txType === 2) {
|
|
196
|
+
tx.maxFeePerGas = gasPrice;
|
|
197
|
+
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
198
|
+
tx.type = 2;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
tx.gasPrice = gasPrice;
|
|
202
|
+
tx.type = 0;
|
|
203
|
+
}
|
|
204
|
+
return await wallet.signTransaction(tx);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* 构建 V2 买入交易(ERC20 输入)
|
|
208
|
+
* USDT/USDC → Token (使用 swapExactTokensForTokensSupportingFeeOnTransferTokens)
|
|
209
|
+
*/
|
|
210
|
+
export async function buildV2BuyTxWithERC20(wallet, tokenAddress, baseTokenAddress, buyAmount, nonce, gasPrice, gasLimit, chainId, txType, v2RouterOverride, chain) {
|
|
211
|
+
const path = [baseTokenAddress, tokenAddress];
|
|
212
|
+
const deadline = getDeadline();
|
|
213
|
+
const routerAddress = v2RouterOverride || getRouterAddress('v2', chain);
|
|
214
|
+
const v2Router = new Contract(routerAddress, V2_ROUTER_ABI, wallet);
|
|
215
|
+
const unsigned = await v2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens.populateTransaction(buyAmount, // amountIn
|
|
216
|
+
0n, // amountOutMin(不设滑点保护)
|
|
217
|
+
path, wallet.address, deadline);
|
|
218
|
+
const tx = {
|
|
219
|
+
...unsigned,
|
|
220
|
+
nonce,
|
|
221
|
+
gasLimit: BigInt(gasLimit),
|
|
222
|
+
chainId,
|
|
223
|
+
};
|
|
224
|
+
if (txType === 2) {
|
|
225
|
+
tx.maxFeePerGas = gasPrice;
|
|
226
|
+
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
227
|
+
tx.type = 2;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
tx.gasPrice = gasPrice;
|
|
231
|
+
tx.type = 0;
|
|
232
|
+
}
|
|
233
|
+
return await wallet.signTransaction(tx);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* 构建 V3 买入交易(ERC20 输入)
|
|
237
|
+
* USDT/USDC → Token (使用 exactInputSingle + multicall)
|
|
238
|
+
*
|
|
239
|
+
* ✅ 修复:使用 ethers.Interface 手动编码 calldata,避免 multicall 重载问题
|
|
240
|
+
*/
|
|
241
|
+
export async function buildV3BuyTxWithERC20(wallet, tokenAddress, baseTokenAddress, buyAmount, nonce, gasPrice, gasLimit, chainId, txType, v3Fee = 2500) {
|
|
242
|
+
const deadline = getDeadline();
|
|
243
|
+
const v3RouterIface = new ethers.Interface(V3_ROUTER02_ABI);
|
|
244
|
+
// 构建 exactInputSingle calldata
|
|
245
|
+
const swapParams = {
|
|
246
|
+
tokenIn: baseTokenAddress,
|
|
247
|
+
tokenOut: tokenAddress,
|
|
248
|
+
fee: v3Fee,
|
|
249
|
+
recipient: wallet.address,
|
|
250
|
+
amountIn: buyAmount,
|
|
251
|
+
amountOutMinimum: 0n,
|
|
252
|
+
sqrtPriceLimitX96: 0n,
|
|
253
|
+
};
|
|
254
|
+
const exactInputSingleData = v3RouterIface.encodeFunctionData('exactInputSingle', [swapParams]);
|
|
255
|
+
// ✅ 使用明确的函数签名编码 multicall,避免重载问题
|
|
256
|
+
const multicallData = v3RouterIface.encodeFunctionData('multicall(uint256,bytes[])', [
|
|
257
|
+
deadline,
|
|
258
|
+
[exactInputSingleData],
|
|
259
|
+
]);
|
|
260
|
+
const tx = {
|
|
261
|
+
to: PANCAKE_V3_ROUTER_ADDRESS,
|
|
262
|
+
data: multicallData,
|
|
263
|
+
value: 0n,
|
|
264
|
+
nonce,
|
|
265
|
+
gasLimit: BigInt(gasLimit),
|
|
266
|
+
chainId,
|
|
267
|
+
};
|
|
268
|
+
if (txType === 2) {
|
|
269
|
+
tx.maxFeePerGas = gasPrice;
|
|
270
|
+
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
271
|
+
tx.type = 2;
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
tx.gasPrice = gasPrice;
|
|
275
|
+
tx.type = 0;
|
|
276
|
+
}
|
|
277
|
+
return await wallet.signTransaction(tx);
|
|
278
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const ERC20_TRANSFER_GAS_LIMIT: 65000n;
|
|
2
|
+
export declare const ERC20_APPROVE_GAS_LIMIT = 50000n;
|
|
3
|
+
export declare const DEFAULT_GAS_LIMIT = 800000;
|
|
4
|
+
export declare const DEFAULT_GAS_PRICE_GWEI = 3;
|
|
5
|
+
export declare const GAS_BUFFER_MULTIPLIER = 2;
|
|
6
|
+
export declare const NATIVE_TRANSFER_GAS_LIMIT: 21055n;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GAS_LIMITS } from '../../shared/constants/index.js';
|
|
2
|
+
export const ERC20_TRANSFER_GAS_LIMIT = GAS_LIMITS.ERC20_TRANSFER;
|
|
3
|
+
export const ERC20_APPROVE_GAS_LIMIT = 50000n;
|
|
4
|
+
export const DEFAULT_GAS_LIMIT = 800000;
|
|
5
|
+
export const DEFAULT_GAS_PRICE_GWEI = 3;
|
|
6
|
+
export const GAS_BUFFER_MULTIPLIER = 2;
|
|
7
|
+
export const NATIVE_TRANSFER_GAS_LIMIT = GAS_LIMITS.NATIVE_TRANSFER;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { JsonRpcProvider, Wallet } from 'ethers';
|
|
2
|
+
import type { GeneratedWallet } from '../types/wallet.js';
|
|
3
|
+
import type { DisperseHopPath } from '../types/hop-chains.js';
|
|
4
|
+
import type { HoldersMakerChain } from '../../shared/foundation/types/holders-maker.js';
|
|
5
|
+
export type { DisperseHopPath } from '../types/hop-chains.js';
|
|
6
|
+
export declare function generateDisperseHopPaths(targetWallets: GeneratedWallet[], hopCount: number, provider: JsonRpcProvider): DisperseHopPath[];
|
|
7
|
+
export declare function buildDisperseHopChainNative(payer: Wallet, path: DisperseHopPath, finalAmount: bigint, gasPrice: bigint, chainId: number, txType: 0 | 2, payerNonce: number, isERC20Mode?: boolean): Promise<{
|
|
8
|
+
signedTxs: string[];
|
|
9
|
+
payerNoncesUsed: number;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function buildDisperseHopChainERC20(payer: Wallet, path: DisperseHopPath, erc20Address: string, erc20Amount: bigint, gasPrice: bigint, chainId: number, txType: 0 | 2, payerNonce: number): Promise<{
|
|
12
|
+
signedTxs: string[];
|
|
13
|
+
payerNoncesUsed: number;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function calculateMaxWalletsPerBatch(isERC20Mode: boolean, disperseHopCount: number, chain?: HoldersMakerChain): number;
|
|
16
|
+
export declare const DEFAULT_MAX_WALLETS_PER_BATCH_NATIVE: number;
|
|
17
|
+
export declare const DEFAULT_MAX_WALLETS_PER_BATCH_ERC20: number;
|
|
18
|
+
export declare function chunkArray<T>(arr: T[], size: number): T[][];
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Wallet } from 'ethers';
|
|
2
|
+
import { generateWallets } from '../wallet.js';
|
|
3
|
+
import { PROFIT_HOP_COUNT } from '../bundle-helpers.js';
|
|
4
|
+
import { ERC20_TRANSFER_GAS_LIMIT, NATIVE_TRANSFER_GAS_LIMIT } from './constants.js';
|
|
5
|
+
import { buildERC20TransferTx, buildNativeTransferTx } from './transfer-tx.js';
|
|
6
|
+
export function generateDisperseHopPaths(targetWallets, hopCount, provider) {
|
|
7
|
+
if (hopCount <= 0) {
|
|
8
|
+
return targetWallets.map((w) => ({
|
|
9
|
+
targetAddress: w.address,
|
|
10
|
+
hopWallets: [],
|
|
11
|
+
hopWalletsInfo: [],
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
return targetWallets.map((targetWallet) => {
|
|
15
|
+
const hopWalletsInfo = generateWallets(hopCount);
|
|
16
|
+
const hopWallets = hopWalletsInfo.map((w) => new Wallet(w.privateKey, provider));
|
|
17
|
+
return {
|
|
18
|
+
targetAddress: targetWallet.address,
|
|
19
|
+
hopWallets,
|
|
20
|
+
hopWalletsInfo,
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export async function buildDisperseHopChainNative(payer, path, finalAmount, gasPrice, chainId, txType, payerNonce, isERC20Mode = false) {
|
|
25
|
+
const signedTxs = [];
|
|
26
|
+
const hopCount = path.hopWallets.length;
|
|
27
|
+
if (hopCount === 0) {
|
|
28
|
+
const tx = await buildNativeTransferTx(payer, path.targetAddress, finalAmount, payerNonce, gasPrice, chainId, txType);
|
|
29
|
+
signedTxs.push(tx);
|
|
30
|
+
return { signedTxs, payerNoncesUsed: 1 };
|
|
31
|
+
}
|
|
32
|
+
const hopGasCost = NATIVE_TRANSFER_GAS_LIMIT * gasPrice;
|
|
33
|
+
const erc20TransferGasCost = isERC20Mode ? ERC20_TRANSFER_GAS_LIMIT * gasPrice : 0n;
|
|
34
|
+
const amountsPerHop = [];
|
|
35
|
+
for (let i = 0; i < hopCount; i++) {
|
|
36
|
+
const remainingHops = hopCount - i;
|
|
37
|
+
const amount = finalAmount +
|
|
38
|
+
hopGasCost * BigInt(remainingHops) +
|
|
39
|
+
(isERC20Mode ? erc20TransferGasCost * BigInt(remainingHops) : 0n);
|
|
40
|
+
amountsPerHop.push(amount);
|
|
41
|
+
}
|
|
42
|
+
const firstTx = await buildNativeTransferTx(payer, path.hopWallets[0].address, amountsPerHop[0], payerNonce, gasPrice, chainId, txType);
|
|
43
|
+
signedTxs.push(firstTx);
|
|
44
|
+
for (let i = 0; i < hopCount; i++) {
|
|
45
|
+
const fromWallet = path.hopWallets[i];
|
|
46
|
+
const toAddress = i === hopCount - 1 ? path.targetAddress : path.hopWallets[i + 1].address;
|
|
47
|
+
const amount = i === hopCount - 1 ? finalAmount : amountsPerHop[i + 1];
|
|
48
|
+
const tx = await buildNativeTransferTx(fromWallet, toAddress, amount, 0, gasPrice, chainId, txType);
|
|
49
|
+
signedTxs.push(tx);
|
|
50
|
+
}
|
|
51
|
+
return { signedTxs, payerNoncesUsed: 1 };
|
|
52
|
+
}
|
|
53
|
+
export async function buildDisperseHopChainERC20(payer, path, erc20Address, erc20Amount, gasPrice, chainId, txType, payerNonce) {
|
|
54
|
+
const signedTxs = [];
|
|
55
|
+
const hopCount = path.hopWallets.length;
|
|
56
|
+
if (hopCount === 0) {
|
|
57
|
+
const tx = await buildERC20TransferTx(payer, erc20Address, path.targetAddress, erc20Amount, payerNonce, gasPrice, chainId, txType);
|
|
58
|
+
signedTxs.push(tx);
|
|
59
|
+
return { signedTxs, payerNoncesUsed: 1 };
|
|
60
|
+
}
|
|
61
|
+
const firstTx = await buildERC20TransferTx(payer, erc20Address, path.hopWallets[0].address, erc20Amount, payerNonce, gasPrice, chainId, txType);
|
|
62
|
+
signedTxs.push(firstTx);
|
|
63
|
+
for (let i = 0; i < hopCount; i++) {
|
|
64
|
+
const fromWallet = path.hopWallets[i];
|
|
65
|
+
const toAddress = i === hopCount - 1 ? path.targetAddress : path.hopWallets[i + 1].address;
|
|
66
|
+
const tx = await buildERC20TransferTx(fromWallet, erc20Address, toAddress, erc20Amount, 1, gasPrice, chainId, txType);
|
|
67
|
+
signedTxs.push(tx);
|
|
68
|
+
}
|
|
69
|
+
return { signedTxs, payerNoncesUsed: 1 };
|
|
70
|
+
}
|
|
71
|
+
export function calculateMaxWalletsPerBatch(isERC20Mode, disperseHopCount, chain) {
|
|
72
|
+
const isSimpleChain = chain === 'XLAYER' || chain === 'ENI';
|
|
73
|
+
const fixedOverhead = isSimpleChain ? 1 : 1 + PROFIT_HOP_COUNT + 1;
|
|
74
|
+
const maxTxs = 50 - fixedOverhead;
|
|
75
|
+
if (isERC20Mode) {
|
|
76
|
+
const perWalletTxs = 2 * (disperseHopCount + 1) + 2;
|
|
77
|
+
return Math.floor(maxTxs / perWalletTxs);
|
|
78
|
+
}
|
|
79
|
+
const perWalletTxs = disperseHopCount + 2;
|
|
80
|
+
return Math.floor(maxTxs / perWalletTxs);
|
|
81
|
+
}
|
|
82
|
+
export const DEFAULT_MAX_WALLETS_PER_BATCH_NATIVE = calculateMaxWalletsPerBatch(false, 0);
|
|
83
|
+
export const DEFAULT_MAX_WALLETS_PER_BATCH_ERC20 = calculateMaxWalletsPerBatch(true, 0);
|
|
84
|
+
export function chunkArray(arr, size) {
|
|
85
|
+
const chunks = [];
|
|
86
|
+
for (let i = 0; i < arr.length; i += size) {
|
|
87
|
+
chunks.push(arr.slice(i, i + size));
|
|
88
|
+
}
|
|
89
|
+
return chunks;
|
|
90
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BaseTokenType, HoldersMakerChain, HoldersMakerTradeType } from '../../shared/foundation/types/holders-maker.js';
|
|
2
|
+
export declare function getBaseTokenAddress(baseToken: BaseTokenType, chain: HoldersMakerChain, customAddress?: string): string;
|
|
3
|
+
export declare function getRouterAddress(tradeType: HoldersMakerTradeType, chain?: HoldersMakerChain, v2RouterOverride?: string): string;
|
|
4
|
+
export declare function getWrappedNativeAddress(chain?: HoldersMakerChain): string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ADDRESSES } from '../constants.js';
|
|
2
|
+
import { ENI_DAOAAS_PORTAL_ADDRESS, ENI_V2_ROUTER_ADDRESS, PANCAKE_V2_ROUTER_ADDRESS, PANCAKE_V3_ROUTER_ADDRESS, USDC_ADDRESS, USDT_ADDRESS, WBNB_ADDRESS, WEGAS_ADDRESS, WOKB_ADDRESS, XLAYER_V2_ROUTER_ADDRESS, XLAYER_V3_ROUTER_ADDRESS, } from './addresses.js';
|
|
3
|
+
export function getBaseTokenAddress(baseToken, chain, customAddress) {
|
|
4
|
+
if (customAddress)
|
|
5
|
+
return customAddress;
|
|
6
|
+
if (chain === 'ENI') {
|
|
7
|
+
if (baseToken === 'usdt')
|
|
8
|
+
return ADDRESSES.ENI.USDT;
|
|
9
|
+
if (baseToken === 'usdc')
|
|
10
|
+
return ADDRESSES.ENI.USDC;
|
|
11
|
+
}
|
|
12
|
+
if (baseToken === 'usdt')
|
|
13
|
+
return USDT_ADDRESS;
|
|
14
|
+
if (baseToken === 'usdc')
|
|
15
|
+
return USDC_ADDRESS;
|
|
16
|
+
throw new Error(`未知的基础代币类型: ${baseToken}`);
|
|
17
|
+
}
|
|
18
|
+
export function getRouterAddress(tradeType, chain, v2RouterOverride) {
|
|
19
|
+
if (chain === 'ENI') {
|
|
20
|
+
switch (tradeType) {
|
|
21
|
+
case 'v2':
|
|
22
|
+
return v2RouterOverride || ENI_V2_ROUTER_ADDRESS;
|
|
23
|
+
case 'daoaas':
|
|
24
|
+
return ENI_DAOAAS_PORTAL_ADDRESS;
|
|
25
|
+
default:
|
|
26
|
+
throw new Error(`ENI 链不支持交易类型: ${tradeType},仅支持 daoaas/v2`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const isXLayer = chain === 'XLAYER';
|
|
30
|
+
switch (tradeType) {
|
|
31
|
+
case 'v2':
|
|
32
|
+
if (v2RouterOverride)
|
|
33
|
+
return v2RouterOverride;
|
|
34
|
+
return isXLayer ? XLAYER_V2_ROUTER_ADDRESS : PANCAKE_V2_ROUTER_ADDRESS;
|
|
35
|
+
case 'v3':
|
|
36
|
+
return isXLayer ? XLAYER_V3_ROUTER_ADDRESS : PANCAKE_V3_ROUTER_ADDRESS;
|
|
37
|
+
default:
|
|
38
|
+
throw new Error(`ERC20 模式不支持交易类型: ${tradeType},仅支持 v2/v3`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export function getWrappedNativeAddress(chain) {
|
|
42
|
+
if (chain === 'ENI')
|
|
43
|
+
return WEGAS_ADDRESS;
|
|
44
|
+
return chain === 'XLAYER' ? WOKB_ADDRESS : WBNB_ADDRESS;
|
|
45
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Wallet } from 'ethers';
|
|
2
|
+
export declare function buildERC20TransferTx(wallet: Wallet, tokenAddress: string, to: string, amount: bigint, nonce: number, gasPrice: bigint, chainId: number, txType: 0 | 2): Promise<string>;
|
|
3
|
+
export declare function buildERC20ApproveTx(wallet: Wallet, tokenAddress: string, spender: string, amount: bigint, nonce: number, gasPrice: bigint, chainId: number, txType: 0 | 2): Promise<string>;
|
|
4
|
+
export declare function buildNativeTransferTx(wallet: Wallet, to: string, amount: bigint, nonce: number, gasPrice: bigint, chainId: number, txType: 0 | 2): Promise<string>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
import { ERC20_ABI } from '../../abis/common.js';
|
|
3
|
+
import { GAS_LIMITS } from '../../shared/constants/index.js';
|
|
4
|
+
import { ERC20_APPROVE_GAS_LIMIT, ERC20_TRANSFER_GAS_LIMIT } from './constants.js';
|
|
5
|
+
export async function buildERC20TransferTx(wallet, tokenAddress, to, amount, nonce, gasPrice, chainId, txType) {
|
|
6
|
+
const iface = new ethers.Interface(ERC20_ABI);
|
|
7
|
+
const data = iface.encodeFunctionData('transfer', [to, amount]);
|
|
8
|
+
const tx = {
|
|
9
|
+
to: tokenAddress,
|
|
10
|
+
data,
|
|
11
|
+
value: 0n,
|
|
12
|
+
nonce,
|
|
13
|
+
gasLimit: ERC20_TRANSFER_GAS_LIMIT,
|
|
14
|
+
chainId,
|
|
15
|
+
};
|
|
16
|
+
if (txType === 2) {
|
|
17
|
+
tx.maxFeePerGas = gasPrice;
|
|
18
|
+
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
19
|
+
tx.type = 2;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
tx.gasPrice = gasPrice;
|
|
23
|
+
tx.type = 0;
|
|
24
|
+
}
|
|
25
|
+
return wallet.signTransaction(tx);
|
|
26
|
+
}
|
|
27
|
+
export async function buildERC20ApproveTx(wallet, tokenAddress, spender, amount, nonce, gasPrice, chainId, txType) {
|
|
28
|
+
const iface = new ethers.Interface(ERC20_ABI);
|
|
29
|
+
const data = iface.encodeFunctionData('approve', [spender, amount]);
|
|
30
|
+
const tx = {
|
|
31
|
+
to: tokenAddress,
|
|
32
|
+
data,
|
|
33
|
+
value: 0n,
|
|
34
|
+
nonce,
|
|
35
|
+
gasLimit: ERC20_APPROVE_GAS_LIMIT,
|
|
36
|
+
chainId,
|
|
37
|
+
};
|
|
38
|
+
if (txType === 2) {
|
|
39
|
+
tx.maxFeePerGas = gasPrice;
|
|
40
|
+
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
41
|
+
tx.type = 2;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
tx.gasPrice = gasPrice;
|
|
45
|
+
tx.type = 0;
|
|
46
|
+
}
|
|
47
|
+
return wallet.signTransaction(tx);
|
|
48
|
+
}
|
|
49
|
+
export async function buildNativeTransferTx(wallet, to, amount, nonce, gasPrice, chainId, txType) {
|
|
50
|
+
const tx = {
|
|
51
|
+
to,
|
|
52
|
+
value: amount,
|
|
53
|
+
nonce,
|
|
54
|
+
gasLimit: GAS_LIMITS.BRIBE,
|
|
55
|
+
chainId,
|
|
56
|
+
};
|
|
57
|
+
if (txType === 2) {
|
|
58
|
+
tx.maxFeePerGas = gasPrice;
|
|
59
|
+
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
60
|
+
tx.type = 2;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
tx.gasPrice = gasPrice;
|
|
64
|
+
tx.type = 0;
|
|
65
|
+
}
|
|
66
|
+
return wallet.signTransaction(tx);
|
|
67
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 刷持有人 helpers — facade re-export(实现见 holders-maker/ 子模块)
|
|
3
|
+
*/
|
|
4
|
+
export * from './holders-maker/addresses.js';
|
|
5
|
+
export * from './holders-maker/constants.js';
|
|
6
|
+
export { generateDisperseHopPaths, buildDisperseHopChainNative, buildDisperseHopChainERC20, calculateMaxWalletsPerBatch, DEFAULT_MAX_WALLETS_PER_BATCH_NATIVE, DEFAULT_MAX_WALLETS_PER_BATCH_ERC20, chunkArray, } from './holders-maker/disperse.js';
|
|
7
|
+
export { buildERC20TransferTx, buildERC20ApproveTx, buildNativeTransferTx } from './holders-maker/transfer-tx.js';
|
|
8
|
+
export { getBaseTokenAddress, getRouterAddress, getWrappedNativeAddress } from './holders-maker/routing.js';
|
|
9
|
+
export { buildFlapBuyTx, buildFourBuyTx, buildDaoaasBuyTx, buildV2BuyTx, buildV3BuyTx, buildV2BuyTxWithERC20, buildV3BuyTxWithERC20, } from './holders-maker/buy-tx.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 刷持有人 helpers — facade re-export(实现见 holders-maker/ 子模块)
|
|
3
|
+
*/
|
|
4
|
+
export * from './holders-maker/addresses.js';
|
|
5
|
+
export * from './holders-maker/constants.js';
|
|
6
|
+
export { generateDisperseHopPaths, buildDisperseHopChainNative, buildDisperseHopChainERC20, calculateMaxWalletsPerBatch, DEFAULT_MAX_WALLETS_PER_BATCH_NATIVE, DEFAULT_MAX_WALLETS_PER_BATCH_ERC20, chunkArray, } from './holders-maker/disperse.js';
|
|
7
|
+
export { buildERC20TransferTx, buildERC20ApproveTx, buildNativeTransferTx } from './holders-maker/transfer-tx.js';
|
|
8
|
+
export { getBaseTokenAddress, getRouterAddress, getWrappedNativeAddress } from './holders-maker/routing.js';
|
|
9
|
+
export { buildFlapBuyTx, buildFourBuyTx, buildDaoaasBuyTx, buildV2BuyTx, buildV3BuyTx, buildV2BuyTxWithERC20, buildV3BuyTxWithERC20, } from './holders-maker/buy-tx.js';
|