four-flap-meme-sdk 1.9.49 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +41 -6
- package/README.md +31 -0
- package/README.zh-CN.md +41 -6
- package/dist/abis/common.js +74 -68
- package/dist/abis/flap/vault.js +9 -7
- package/dist/abis/index.d.ts +3 -4
- package/dist/abis/index.js +3 -4
- package/dist/bundle-core/__tests__/config-helpers.test.js +28 -0
- package/dist/bundle-core/__tests__/facade-parity.test.js +33 -0
- package/dist/bundle-core/__tests__/sign-context-helpers.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/sign-context-helpers.test.js +60 -0
- package/dist/bundle-core/__tests__/sign-fixture.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/sign-fixture.test.js +220 -0
- package/dist/bundle-core/__tests__/sign-fixtures.d.ts +10 -0
- package/dist/bundle-core/__tests__/sign-fixtures.js +16 -0
- package/dist/bundle-core/config-helpers.d.ts +36 -0
- package/dist/bundle-core/config-helpers.js +57 -0
- package/dist/bundle-core/errors.d.ts +50 -0
- package/dist/bundle-core/errors.js +34 -0
- package/dist/bundle-core/four-meme/approve-tokenmanager.d.ts +7 -0
- package/dist/bundle-core/four-meme/approve-tokenmanager.js +99 -0
- package/dist/bundle-core/four-meme/core-helpers.d.ts +8 -0
- package/dist/bundle-core/four-meme/core-helpers.js +40 -0
- package/dist/bundle-core/four-meme/core.d.ts +4 -0
- package/dist/bundle-core/four-meme/core.js +515 -0
- package/dist/bundle-core/four-meme/pancake-proxy.d.ts +28 -0
- package/dist/bundle-core/four-meme/pancake-proxy.js +679 -0
- package/dist/bundle-core/four-meme/private.d.ts +27 -0
- package/dist/bundle-core/four-meme/private.js +465 -0
- package/dist/bundle-core/four-meme/sign-context-helpers.d.ts +2 -0
- package/dist/bundle-core/four-meme/sign-context-helpers.js +2 -0
- package/dist/bundle-core/four-meme/swap-buy-first.d.ts +8 -0
- package/dist/bundle-core/four-meme/swap-buy-first.js +493 -0
- package/dist/bundle-core/four-meme/swap-hop-helpers.d.ts +6 -0
- package/dist/bundle-core/four-meme/swap-hop-helpers.js +63 -0
- package/dist/bundle-core/four-meme/swap-internal.d.ts +3 -0
- package/dist/bundle-core/four-meme/swap-internal.js +18 -0
- package/dist/bundle-core/four-meme/swap-sign-helpers.d.ts +27 -0
- package/dist/bundle-core/four-meme/swap-sign-helpers.js +105 -0
- package/dist/bundle-core/four-meme/swap.d.ts +17 -0
- package/dist/bundle-core/four-meme/swap.js +505 -0
- package/dist/bundle-core/four-meme/types/buy-first.d.ts +50 -0
- package/dist/bundle-core/four-meme/types/buy-first.js +1 -0
- package/dist/bundle-core/four-meme/types/core-flow.d.ts +63 -0
- package/dist/bundle-core/four-meme/types/core-flow.js +1 -0
- package/dist/bundle-core/four-meme/types/index.d.ts +600 -0
- package/dist/bundle-core/four-meme/types/index.js +1 -0
- package/dist/bundle-core/four-meme/types/swap-internal.d.ts +19 -0
- package/dist/bundle-core/four-meme/types/swap-internal.js +1 -0
- package/dist/bundle-core/four-meme/types.d.ts +1 -0
- package/dist/bundle-core/four-meme/types.js +1 -0
- package/dist/bundle-core/four-meme/utils-disperse.d.ts +7 -0
- package/dist/bundle-core/four-meme/utils-disperse.js +396 -0
- package/dist/bundle-core/four-meme/utils-pairwise.d.ts +8 -0
- package/dist/bundle-core/four-meme/utils-pairwise.js +328 -0
- package/dist/bundle-core/four-meme/utils-sweep.d.ts +8 -0
- package/dist/bundle-core/four-meme/utils-sweep.js +744 -0
- package/dist/bundle-core/index.d.ts +8 -0
- package/dist/bundle-core/index.js +8 -0
- package/dist/bundle-core/internal.d.ts +21 -0
- package/dist/bundle-core/internal.js +182 -0
- package/dist/bundle-core/sign-context-helpers.d.ts +25 -0
- package/dist/bundle-core/sign-context-helpers.js +67 -0
- package/dist/bundle-core/submit.d.ts +293 -0
- package/dist/bundle-core/submit.js +727 -0
- package/dist/bundle-core/types/index.d.ts +8 -0
- package/dist/bundle-core/types/index.js +1 -0
- package/dist/bundle-core/types.d.ts +1 -0
- package/dist/bundle-core/types.js +1 -0
- package/dist/chains/bsc/four/approve-tokenmanager.d.ts +1 -26
- package/dist/chains/bsc/four/approve-tokenmanager.js +1 -116
- package/dist/chains/bsc/four/config.d.ts +5 -70
- package/dist/chains/bsc/four/config.js +2 -115
- package/dist/chains/bsc/four/core.d.ts +1 -4
- package/dist/chains/bsc/four/core.js +1 -589
- package/dist/chains/bsc/four/disperse.d.ts +12 -0
- package/dist/chains/bsc/four/disperse.js +470 -0
- 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 -50
- package/dist/chains/bsc/four/internal.js +2 -237
- package/dist/chains/bsc/four/pairwise.d.ts +7 -0
- package/dist/chains/bsc/four/pairwise.js +308 -0
- package/dist/chains/bsc/four/pancake-proxy.d.ts +1 -28
- package/dist/chains/bsc/four/pancake-proxy.js +1 -688
- 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 -746
- package/dist/chains/bsc/four/swap-buy-first.d.ts +2 -55
- package/dist/chains/bsc/four/swap-buy-first.js +2 -506
- 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 -760
- package/dist/chains/bsc/four/sweep.d.ts +13 -0
- package/dist/chains/bsc/four/sweep.js +788 -0
- 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 -1534
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +159 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +117 -0
- package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +1 -91
- package/dist/chains/bsc/pancake/bundle-buy-first.js +97 -207
- 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 +111 -686
- 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.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 +54 -23
- package/dist/chains/eni/batch-router/utils.js +32 -6
- package/dist/chains/eni/bundler/sign.js +4 -4
- package/dist/chains/eni/bundler/submit.js +1 -4
- package/dist/chains/eni/constants.js +1 -1
- package/dist/chains/eni/index.d.ts +1 -1
- package/dist/chains/eni/platforms/daoaas/create.js +2 -2
- package/dist/chains/eni/platforms/daoaas/index.d.ts +3 -3
- package/dist/chains/eni/platforms/daoaas/index.js +3 -3
- package/dist/chains/eni/platforms/daoaas/meta.js +8 -4
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +28 -43
- 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 -47
- 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.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.js +5 -13
- package/dist/chains/xlayer/eip7702/bundle-approve.d.ts +2 -26
- package/dist/chains/xlayer/eip7702/bundle-approve.js +11 -20
- package/dist/chains/xlayer/eip7702/bundle-buy.d.ts +2 -6
- package/dist/chains/xlayer/eip7702/bundle-buy.js +13 -51
- package/dist/chains/xlayer/eip7702/bundle-create.js +93 -56
- package/dist/chains/xlayer/eip7702/bundle-sell.d.ts +2 -6
- package/dist/chains/xlayer/eip7702/bundle-sell.js +26 -74
- package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +3 -65
- package/dist/chains/xlayer/eip7702/bundle-swap.js +51 -68
- package/dist/chains/xlayer/eip7702/constants.d.ts +1 -16
- package/dist/chains/xlayer/eip7702/constants.js +3 -21
- package/dist/chains/xlayer/eip7702/index.d.ts +27 -46
- package/dist/chains/xlayer/eip7702/index.js +27 -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 +58 -291
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.d.ts +26 -0
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.js +57 -0
- package/dist/chains/xlayer/eip7702/types.d.ts +88 -0
- package/dist/chains/xlayer/eip7702/utils.d.ts +0 -3
- package/dist/chains/xlayer/eip7702/utils.js +23 -28
- package/dist/chains/xlayer/eip7702/volume-helpers.d.ts +148 -0
- package/dist/chains/xlayer/eip7702/volume-helpers.js +48 -0
- package/dist/chains/xlayer/eip7702/volume.d.ts +6 -184
- package/dist/chains/xlayer/eip7702/volume.js +83 -158
- package/dist/chains/xlayer/eoa/constants.js +1 -1
- package/dist/chains/xlayer/eoa/dex-helpers.js +5 -5
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts +126 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +228 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.d.ts +1 -95
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.js +64 -276
- package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +1 -1
- package/dist/chains/xlayer/eoa/eoa-wash-volume.js +14 -14
- package/dist/chains/xlayer/eoa/index.d.ts +10 -6
- package/dist/chains/xlayer/eoa/index.js +8 -23
- package/dist/chains/xlayer/eoa/portal-ops.js +7 -2
- package/dist/chains/xlayer/eoa/router-manager.js +3 -3
- package/dist/chains/xlayer/eoa/types-core.d.ts +363 -0
- package/dist/chains/xlayer/eoa/types-core.js +53 -0
- package/dist/chains/xlayer/eoa/types-create.d.ts +413 -0
- package/dist/chains/xlayer/eoa/types-create.js +9 -0
- package/dist/chains/xlayer/eoa/types-volume.d.ts +209 -0
- package/dist/chains/xlayer/eoa/types-volume.js +13 -0
- package/dist/chains/xlayer/eoa/types.d.ts +2 -2
- package/dist/chains/xlayer/eoa/types.js +1 -3
- package/dist/contracts/helper3.d.ts +20 -17
- package/dist/contracts/helper3.js +56 -20
- package/dist/contracts/tm-bundle-helpers.d.ts +88 -0
- package/dist/contracts/tm-bundle-helpers.js +72 -0
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.d.ts +1 -26
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.js +1 -117
- package/dist/contracts/tm-bundle-merkle/config.d.ts +5 -70
- package/dist/contracts/tm-bundle-merkle/config.js +2 -115
- package/dist/contracts/tm-bundle-merkle/core.d.ts +1 -4
- package/dist/contracts/tm-bundle-merkle/core.js +1 -588
- 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 -50
- package/dist/contracts/tm-bundle-merkle/internal.js +2 -236
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.d.ts +1 -28
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.js +1 -687
- 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 -919
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.d.ts +2 -55
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.js +2 -505
- 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 -757
- 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 +5 -6
- package/dist/contracts/tm-bundle-merkle/utils.js +5 -6
- package/dist/contracts/tm-bundle.d.ts +3 -51
- package/dist/contracts/tm-bundle.js +102 -142
- package/dist/contracts/tm.d.ts +3 -2
- package/dist/contracts/tm.js +36 -32
- package/dist/contracts/tm1.js +9 -4
- package/dist/contracts/tm2.js +9 -4
- package/dist/dex/direct-router-helpers.d.ts +264 -0
- package/dist/dex/direct-router-helpers.js +539 -0
- package/dist/dex/direct-router.d.ts +3 -125
- package/dist/dex/direct-router.js +237 -652
- 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/flows/create.d.ts +2 -2
- package/dist/flows/create.js +6 -6
- package/dist/flows/index.d.ts +1 -0
- package/dist/flows/index.js +1 -0
- package/dist/index.d.ts +20 -91
- package/dist/index.js +20 -215
- package/dist/shared/abis/common.d.ts +2 -83
- package/dist/shared/abis/common.js +2 -252
- package/dist/shared/abis/index.d.ts +5 -6
- package/dist/shared/abis/index.js +5 -7
- package/dist/shared/clients/blockrazor.js +41 -24
- package/dist/shared/clients/club48.js +30 -26
- package/dist/shared/clients/emitservice.js +2 -0
- package/dist/shared/clients/four.js +23 -18
- package/dist/shared/clients/index.d.ts +8 -0
- package/dist/shared/clients/index.js +8 -0
- package/dist/shared/clients/merkle.js +26 -30
- package/dist/shared/constants/addresses.d.ts +1 -1
- package/dist/shared/constants/addresses.js +11 -2
- package/dist/shared/constants/chains.d.ts +1 -1
- package/dist/shared/constants/chains.js +1 -1
- package/dist/shared/constants/gas.d.ts +1 -1
- package/dist/shared/constants/gas.js +2 -6
- package/dist/shared/constants/index.d.ts +1 -0
- package/dist/shared/constants/index.js +1 -0
- package/dist/shared/constants/quote.d.ts +30 -0
- package/dist/shared/constants/quote.js +37 -0
- package/dist/shared/flap/__tests__/curve.test.js +3 -3
- package/dist/shared/flap/abi.js +1 -1
- package/dist/shared/flap/constants.d.ts +1 -1
- package/dist/shared/flap/constants.js +2 -2
- package/dist/shared/flap/curve.js +3 -0
- package/dist/shared/flap/errors.d.ts +1 -4
- package/dist/shared/flap/errors.js +21 -3
- package/dist/shared/flap/index.d.ts +2 -2
- package/dist/shared/flap/index.js +2 -2
- package/dist/shared/flap/meta.d.ts +16 -18
- package/dist/shared/flap/meta.js +14 -26
- package/dist/shared/flap/permit.js +6 -5
- package/dist/shared/flap/pinata.d.ts +9 -2
- package/dist/shared/flap/pinata.js +20 -18
- 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 +66 -156
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +81 -86
- package/dist/shared/flap/portal-bundle-merkle/curve-to-dex.js +100 -92
- package/dist/shared/flap/portal-bundle-merkle/index.d.ts +11 -7
- package/dist/shared/flap/portal-bundle-merkle/index.js +4 -7
- package/dist/shared/flap/portal-bundle-merkle/pancake-proxy.js +71 -68
- package/dist/shared/flap/portal-bundle-merkle/private.js +61 -114
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +125 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.js +113 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.d.ts +1 -64
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.js +66 -247
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.d.ts +149 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.js +259 -0
- package/dist/shared/flap/portal-bundle-merkle/swap.d.ts +2 -71
- package/dist/shared/flap/portal-bundle-merkle/swap.js +103 -410
- package/dist/shared/flap/portal-bundle-merkle/types.d.ts +73 -3
- package/dist/shared/flap/portal-bundle-merkle/utils-helpers.d.ts +100 -0
- package/dist/shared/flap/portal-bundle-merkle/utils-helpers.js +133 -0
- 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 +54 -42
- package/dist/shared/flap/portal.js +32 -10
- package/dist/shared/flap/vanity.js +4 -7
- package/dist/shared/flap/vault.d.ts +1 -1
- package/dist/shared/flap/vault.js +54 -48
- package/dist/shared/flap 2/__tests__/curve.test.d.ts +1 -0
- package/dist/shared/flap 2/portal-bundle-merkle/types.js +1 -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/gas/bundle-gas.d.ts +39 -0
- package/dist/shared/foundation/gas/bundle-gas.js +93 -0
- package/dist/shared/foundation/gas/profit-hop.d.ts +20 -0
- package/dist/shared/foundation/gas/profit-hop.js +72 -0
- package/dist/shared/foundation/index.d.ts +13 -0
- package/dist/shared/foundation/index.js +12 -0
- package/dist/shared/foundation/nonce/nonce-manager.d.ts +17 -0
- package/dist/shared/foundation/nonce/nonce-manager.js +180 -0
- package/dist/shared/foundation/normalize-unknown.d.ts +9 -0
- package/dist/shared/foundation/normalize-unknown.js +29 -0
- package/dist/shared/foundation/sdk-logger.d.ts +13 -0
- package/dist/shared/foundation/sdk-logger.js +12 -0
- package/dist/shared/foundation/tx/build-request.d.ts +17 -0
- package/dist/shared/foundation/tx/build-request.js +25 -0
- package/dist/shared/foundation/tx/sign-batch.d.ts +5 -0
- package/dist/shared/foundation/tx/sign-batch.js +26 -0
- package/dist/shared/foundation/tx/wallet-sign-patch.d.ts +1 -0
- package/dist/shared/foundation/tx/wallet-sign-patch.js +18 -0
- package/dist/shared/foundation/types/airdrop-sweep.d.ts +79 -0
- package/dist/shared/foundation/types/airdrop-sweep.js +1 -0
- package/dist/shared/foundation/types/erc20.d.ts +65 -0
- package/dist/shared/foundation/types/erc20.js +1 -0
- package/dist/shared/foundation/types/holders-maker.d.ts +64 -0
- package/dist/shared/foundation/types/holders-maker.js +1 -0
- package/dist/shared/foundation/types/index.d.ts +7 -0
- package/dist/shared/foundation/types/index.js +1 -0
- package/dist/shared/foundation/types/lp-inspect.d.ts +102 -0
- package/dist/shared/foundation/types/lp-inspect.js +1 -0
- package/dist/shared/foundation/types/multicall.d.ts +5 -0
- package/dist/shared/foundation/types/multicall.js +1 -0
- package/dist/shared/foundation/types/private-sale.d.ts +35 -0
- package/dist/shared/foundation/types/private-sale.js +1 -0
- package/dist/shared/foundation/types/quote-helpers.d.ts +17 -0
- package/dist/shared/foundation/types/quote-helpers.js +1 -0
- package/dist/shared/four/tax-token.d.ts +1 -1
- package/dist/shared/four/tax-token.js +27 -7
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/index.js +4 -0
- package/dist/types/distribute.d.ts +72 -0
- package/dist/types/distribute.js +1 -0
- package/dist/types 2/errors.d.ts +27 -0
- package/dist/types 2/errors.js +34 -0
- package/dist/utils/airdrop-sweep-types.d.ts +1 -0
- package/dist/utils/airdrop-sweep-types.js +1 -0
- package/dist/utils/airdrop-sweep.d.ts +4 -76
- package/dist/utils/airdrop-sweep.js +38 -52
- 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-types.d.ts +1 -0
- package/dist/utils/erc20-types.js +1 -0
- package/dist/utils/erc20.d.ts +8 -90
- package/dist/utils/erc20.js +94 -153
- package/dist/utils/errors.d.ts +10 -22
- package/dist/utils/errors.js +61 -79
- 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-types.d.ts +1 -0
- package/dist/utils/holders-maker-types.js +1 -0
- package/dist/utils/holders-maker.d.ts +2 -138
- package/dist/utils/holders-maker.js +23 -651
- 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-types.d.ts +1 -0
- package/dist/utils/lp-inspect-types.js +1 -0
- package/dist/utils/lp-inspect.d.ts +2 -112
- package/dist/utils/lp-inspect.js +63 -195
- package/dist/utils/mpcExclusive.d.ts +2 -5
- package/dist/utils/mpcExclusive.js +4 -3
- package/dist/utils/private-sale-types.d.ts +1 -0
- package/dist/utils/private-sale-types.js +1 -0
- package/dist/utils/private-sale.d.ts +2 -58
- package/dist/utils/private-sale.js +2 -7
- package/dist/utils/provider-factory.d.ts +4 -0
- package/dist/utils/provider-factory.js +10 -0
- package/dist/utils/quote-helpers-types.d.ts +1 -0
- package/dist/utils/quote-helpers-types.js +1 -0
- package/dist/utils/quote-helpers.d.ts +4 -45
- package/dist/utils/quote-helpers.js +15 -65
- package/dist/utils/stealth-transfer.d.ts +2 -28
- package/dist/utils/stealth-transfer.js +30 -14
- package/dist/utils/swap-helpers.d.ts +0 -3
- package/dist/utils/swap-helpers.js +6 -9
- package/dist/utils/types/airdrop-sweep.d.ts +1 -0
- package/dist/utils/types/airdrop-sweep.js +1 -0
- package/dist/utils/types/contract-factory.d.ts +1 -0
- package/dist/utils/types/contract-factory.js +1 -0
- package/dist/utils/types/erc20.d.ts +1 -0
- package/dist/utils/types/erc20.js +1 -0
- package/dist/utils/types/errors.d.ts +1 -0
- package/dist/utils/types/errors.js +1 -0
- package/dist/utils/types/holders-maker.d.ts +1 -0
- package/dist/utils/types/holders-maker.js +1 -0
- package/dist/utils/types/hop-chains.d.ts +8 -0
- package/dist/utils/types/hop-chains.js +1 -0
- package/dist/utils/types/index.d.ts +13 -0
- package/dist/utils/types/index.js +1 -0
- package/dist/utils/types/lp-inspect.d.ts +1 -0
- package/dist/utils/types/lp-inspect.js +1 -0
- package/dist/utils/types/mpc-exclusive.d.ts +5 -0
- package/dist/utils/types/mpc-exclusive.js +1 -0
- package/dist/utils/types/private-sale.d.ts +1 -0
- package/dist/utils/types/private-sale.js +1 -0
- package/dist/utils/types/quote-helpers.d.ts +1 -0
- package/dist/utils/types/quote-helpers.js +1 -0
- package/dist/utils/types/stealth-transfer.d.ts +44 -0
- package/dist/utils/types/stealth-transfer.js +1 -0
- package/dist/utils/types/wallet.d.ts +25 -0
- package/dist/utils/types/wallet.js +1 -0
- package/dist/utils/wallet.d.ts +2 -25
- package/dist/utils/wallet.js +9 -10
- package/package.json +55 -2
- package/src/abis/contracts/TaxToken.json +969 -0
- package/src/abis/contracts/TokenManager.json +836 -0
- package/src/abis/contracts/TokenManager2.json +136 -0
- package/src/abis/contracts/TokenManagerHelper3.json +993 -0
- /package/dist/{shared 2/flap/__tests__/curve.test.d.ts → bundle-core/__tests__/config-helpers.test.d.ts} +0 -0
- /package/dist/{shared 2/flap/portal-bundle-merkle/types.js → bundle-core/__tests__/facade-parity.test.d.ts} +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/TaxToken.json +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/TokenManager.json +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/TokenManager2.json +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/TokenManagerHelper3.json +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/common.d.ts +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/common.js +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/index.d.ts +0 -0
- /package/dist/{shared 2/abis → shared/abis 2}/index.js +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/blockrazor.d.ts +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/blockrazor.js +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/club48.d.ts +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/club48.js +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/emitservice.d.ts +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/emitservice.js +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/four.d.ts +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/four.js +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/merkle.d.ts +0 -0
- /package/dist/{shared 2/clients → shared/clients 2}/merkle.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/__tests__/curve.test.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/abi.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/abi.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/constants.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/constants.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/curve.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/curve.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/errors.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/errors.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/index.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/index.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/ipfs.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/ipfs.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/meta.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/meta.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/permit.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/permit.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/pinata.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/pinata.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/config.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/config.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/core.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/core.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/create-to-dex.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/create-to-dex.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/curve-to-dex.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/curve-to-dex.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/index.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/index.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/pancake-proxy.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/pancake-proxy.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/private.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/private.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/swap-buy-first.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/swap-buy-first.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/swap.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/swap.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/types.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/utils.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle-merkle/utils.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal-bundle.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/portal.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/vanity.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/vanity.js +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/vault.d.ts +0 -0
- /package/dist/{shared 2/flap → shared/flap 2}/vault.js +0 -0
- /package/dist/{shared 2/four → shared/four 2}/index.d.ts +0 -0
- /package/dist/{shared 2/four → shared/four 2}/index.js +0 -0
- /package/dist/{shared 2/four → shared/four 2}/tax-token.d.ts +0 -0
- /package/dist/{shared 2/four → shared/four 2}/tax-token.js +0 -0
- /package/dist/{shared 2/index.d.ts → shared/index 2.js} +0 -0
- /package/dist/{shared 2/index.js → shared/index.d 2.ts} +0 -0
|
@@ -85,6 +85,10 @@ export type MerkleBundleStatus = {
|
|
|
85
85
|
totalGasUsed: bigint;
|
|
86
86
|
targetBlock: number;
|
|
87
87
|
};
|
|
88
|
+
/** Merkle 结果 metadata 字段值(各方法返回的键不固定,值类型统一收窄) */
|
|
89
|
+
export type MerkleResultMetadataValue = string | number | boolean | string[] | undefined;
|
|
90
|
+
/** Merkle 结果 metadata */
|
|
91
|
+
export type MerkleResultMetadata = Record<string, MerkleResultMetadataValue>;
|
|
88
92
|
/**
|
|
89
93
|
* 统一的 Merkle 方法返回类型
|
|
90
94
|
* SDK 不再内部提交,只返回签名交易和元数据
|
|
@@ -97,9 +101,7 @@ export type MerkleSignedResult = {
|
|
|
97
101
|
/** ✅ 利润多跳钱包(用于导出私钥) */
|
|
98
102
|
profitHopWallets?: GeneratedWallet[];
|
|
99
103
|
/** 元数据(如利润信息等) */
|
|
100
|
-
metadata?:
|
|
101
|
-
[key: string]: any;
|
|
102
|
-
};
|
|
104
|
+
metadata?: MerkleResultMetadata;
|
|
103
105
|
};
|
|
104
106
|
/** ✅ Flap 创建代币 + 购买参数(Merkle 版本 - 完整) */
|
|
105
107
|
export type FlapCreateWithBundleBuyMerkleParams = {
|
|
@@ -356,3 +358,71 @@ export type PancakeProxyApprovalBatchResult = {
|
|
|
356
358
|
bundleHash?: string;
|
|
357
359
|
message: string;
|
|
358
360
|
};
|
|
361
|
+
export type FlapDisperseSignParams = {
|
|
362
|
+
chain: 'BSC' | 'MONAD' | 'XLAYER';
|
|
363
|
+
fromPrivateKey: string;
|
|
364
|
+
recipients: string[];
|
|
365
|
+
amount?: string;
|
|
366
|
+
amounts?: string[];
|
|
367
|
+
tokenAddress?: string;
|
|
368
|
+
tokenDecimals?: number;
|
|
369
|
+
hopCount?: number | number[];
|
|
370
|
+
hopPrivateKeys?: string[][];
|
|
371
|
+
items?: {
|
|
372
|
+
recipient: string;
|
|
373
|
+
amount: string | bigint;
|
|
374
|
+
hopCount?: number;
|
|
375
|
+
hopPrivateKeys?: string[];
|
|
376
|
+
}[];
|
|
377
|
+
config: FlapSignConfig;
|
|
378
|
+
startNonce?: number;
|
|
379
|
+
};
|
|
380
|
+
export type FlapDisperseMerkleResult = {
|
|
381
|
+
signedTransactions: string[];
|
|
382
|
+
hopWallets?: (string | GeneratedWallet)[][];
|
|
383
|
+
profitHopWallets?: GeneratedWallet[];
|
|
384
|
+
metadata?: {
|
|
385
|
+
totalAmount: string;
|
|
386
|
+
profitAmount: string;
|
|
387
|
+
profitRecipient: string;
|
|
388
|
+
recipientCount: number;
|
|
389
|
+
isNative: boolean;
|
|
390
|
+
tokenAddress?: string;
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
export type FlapSweepSignParams = {
|
|
394
|
+
chain: 'BSC' | 'MONAD' | 'XLAYER';
|
|
395
|
+
sourcePrivateKeys: string[];
|
|
396
|
+
target: string;
|
|
397
|
+
ratioPct?: number;
|
|
398
|
+
ratios?: number[];
|
|
399
|
+
amount?: string;
|
|
400
|
+
amounts?: string[];
|
|
401
|
+
tokenAddress?: string;
|
|
402
|
+
tokenDecimals?: number;
|
|
403
|
+
skipIfInsufficient?: boolean;
|
|
404
|
+
hopCount?: number | number[];
|
|
405
|
+
hopPrivateKeys?: string[][];
|
|
406
|
+
sources?: {
|
|
407
|
+
privateKey: string;
|
|
408
|
+
ratioPct?: number;
|
|
409
|
+
amount?: string;
|
|
410
|
+
hopCount?: number;
|
|
411
|
+
hopPrivateKeys?: string[];
|
|
412
|
+
}[];
|
|
413
|
+
config: FlapSignConfig;
|
|
414
|
+
startNonce?: number;
|
|
415
|
+
};
|
|
416
|
+
export type FlapSweepMerkleResult = {
|
|
417
|
+
signedTransactions: string[];
|
|
418
|
+
hopWallets?: (string | GeneratedWallet)[][];
|
|
419
|
+
profitHopWallets?: GeneratedWallet[];
|
|
420
|
+
metadata?: {
|
|
421
|
+
totalAmount: string;
|
|
422
|
+
profitAmount: string;
|
|
423
|
+
profitRecipient: string;
|
|
424
|
+
sourceCount: number;
|
|
425
|
+
isNative: boolean;
|
|
426
|
+
tokenAddress?: string;
|
|
427
|
+
};
|
|
428
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { JsonRpcProvider } from 'ethers';
|
|
2
|
+
import type { FlapSignConfig } from './types.js';
|
|
3
|
+
import type { GeneratedWallet } from '../../../utils/wallet.js';
|
|
4
|
+
/** 分散参数 */
|
|
5
|
+
export type FlapDisperseSignParams = {
|
|
6
|
+
chain: 'BSC' | 'MONAD' | 'XLAYER';
|
|
7
|
+
fromPrivateKey: string;
|
|
8
|
+
recipients: string[];
|
|
9
|
+
amount?: string;
|
|
10
|
+
amounts?: string[];
|
|
11
|
+
tokenAddress?: string;
|
|
12
|
+
tokenDecimals?: number;
|
|
13
|
+
hopCount?: number | number[];
|
|
14
|
+
hopPrivateKeys?: string[][];
|
|
15
|
+
items?: {
|
|
16
|
+
recipient: string;
|
|
17
|
+
amount: string | bigint;
|
|
18
|
+
hopCount?: number;
|
|
19
|
+
hopPrivateKeys?: string[];
|
|
20
|
+
}[];
|
|
21
|
+
config: FlapSignConfig;
|
|
22
|
+
startNonce?: number;
|
|
23
|
+
};
|
|
24
|
+
/** 分散结果 */
|
|
25
|
+
export type FlapDisperseMerkleResult = {
|
|
26
|
+
signedTransactions: string[];
|
|
27
|
+
hopWallets?: (string | GeneratedWallet)[][];
|
|
28
|
+
profitHopWallets?: GeneratedWallet[];
|
|
29
|
+
metadata?: {
|
|
30
|
+
totalAmount: string;
|
|
31
|
+
profitAmount: string;
|
|
32
|
+
profitRecipient: string;
|
|
33
|
+
recipientCount: number;
|
|
34
|
+
isNative: boolean;
|
|
35
|
+
tokenAddress?: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/** 归集参数 */
|
|
39
|
+
export type FlapSweepSignParams = {
|
|
40
|
+
chain: 'BSC' | 'MONAD' | 'XLAYER';
|
|
41
|
+
sourcePrivateKeys: string[];
|
|
42
|
+
target: string;
|
|
43
|
+
ratioPct?: number;
|
|
44
|
+
ratios?: number[];
|
|
45
|
+
amount?: string;
|
|
46
|
+
amounts?: string[];
|
|
47
|
+
tokenAddress?: string;
|
|
48
|
+
tokenDecimals?: number;
|
|
49
|
+
skipIfInsufficient?: boolean;
|
|
50
|
+
hopCount?: number | number[];
|
|
51
|
+
hopPrivateKeys?: string[][];
|
|
52
|
+
sources?: {
|
|
53
|
+
privateKey: string;
|
|
54
|
+
ratioPct?: number;
|
|
55
|
+
amount?: string;
|
|
56
|
+
hopCount?: number;
|
|
57
|
+
hopPrivateKeys?: string[];
|
|
58
|
+
}[];
|
|
59
|
+
config: FlapSignConfig;
|
|
60
|
+
startNonce?: number;
|
|
61
|
+
};
|
|
62
|
+
/** 归集结果 */
|
|
63
|
+
export type FlapSweepMerkleResult = {
|
|
64
|
+
signedTransactions: string[];
|
|
65
|
+
hopWallets?: (string | GeneratedWallet)[][];
|
|
66
|
+
profitHopWallets?: GeneratedWallet[];
|
|
67
|
+
metadata?: {
|
|
68
|
+
totalAmount: string;
|
|
69
|
+
profitAmount: string;
|
|
70
|
+
profitRecipient: string;
|
|
71
|
+
sourceCount: number;
|
|
72
|
+
isNative: boolean;
|
|
73
|
+
tokenAddress?: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export declare const CHAIN_ID_MAP: Record<string, number>;
|
|
77
|
+
export declare const MULTICALL3_ADDRESS: "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
78
|
+
export declare const decimalsCache: Map<string, number>;
|
|
79
|
+
export declare function getErc20Decimals(provider: JsonRpcProvider, token: string): Promise<number>;
|
|
80
|
+
/**
|
|
81
|
+
* ✅ 生成多跳中间钱包(返回完整钱包信息:地址 + 私钥)
|
|
82
|
+
*/
|
|
83
|
+
export declare function generateHopWallets(recipientCount: number, hopCount: number | number[]): GeneratedWallet[][] | null;
|
|
84
|
+
export declare function normalizeAmounts(recipients: string[], amount?: string, amounts?: string[]): string[];
|
|
85
|
+
export declare function batchGetBalances(provider: JsonRpcProvider, addresses: string[], tokenAddress?: string): Promise<bigint[]>;
|
|
86
|
+
/**
|
|
87
|
+
* 计算 Gas Limit
|
|
88
|
+
* - 原生代币转账:21000 gas(固定)
|
|
89
|
+
* - ERC20 标准 transfer:约 45000-55000 gas,使用 55000 作为安全值
|
|
90
|
+
*
|
|
91
|
+
* ✅ 优化:降低 ERC20 gas limit,减少中转钱包 BNB 残留
|
|
92
|
+
*/
|
|
93
|
+
export declare function calculateGasLimit(config: FlapSignConfig, isNative: boolean, hasHops: boolean, _hopCount?: number): bigint;
|
|
94
|
+
export declare function isNativeTokenAddress(tokenAddress?: string): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Flap Protocol: 分散(仅签名版本)
|
|
97
|
+
* ✅ 支持利润提取(按地址数量收取固定费用)
|
|
98
|
+
* ✅ 支持多跳
|
|
99
|
+
* ✅ 支持 Multicall3 批量获取余额
|
|
100
|
+
*/
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { ethers, Wallet } from 'ethers';
|
|
2
|
+
import { ADDRESSES } from '../../../utils/constants.js';
|
|
3
|
+
import { MULTICALL3_ABI, ERC20_BALANCE_ABI } from '../../abis/common.js';
|
|
4
|
+
// ==================== 链配置 ====================
|
|
5
|
+
export const CHAIN_ID_MAP = {
|
|
6
|
+
'BSC': 56,
|
|
7
|
+
'MONAD': 143,
|
|
8
|
+
'XLAYER': 196
|
|
9
|
+
};
|
|
10
|
+
// ==================== 链常量 ====================
|
|
11
|
+
// ✅ 使用公共模块
|
|
12
|
+
export const MULTICALL3_ADDRESS = ADDRESSES.BSC.Multicall3;
|
|
13
|
+
// ==================== 内部辅助函数 ====================
|
|
14
|
+
export const decimalsCache = new Map();
|
|
15
|
+
export async function getErc20Decimals(provider, token) {
|
|
16
|
+
const network = await provider.getNetwork();
|
|
17
|
+
const key = `${network.chainId}_${token.toLowerCase()}`;
|
|
18
|
+
if (decimalsCache.has(key))
|
|
19
|
+
return decimalsCache.get(key);
|
|
20
|
+
try {
|
|
21
|
+
const erc20 = new ethers.Contract(token, ['function decimals() view returns (uint8)'], provider);
|
|
22
|
+
const d = await erc20.decimals();
|
|
23
|
+
if (!Number.isFinite(d) || d < 0 || d > 36)
|
|
24
|
+
return 18;
|
|
25
|
+
decimalsCache.set(key, d);
|
|
26
|
+
return d;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return 18;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* ✅ 生成多跳中间钱包(返回完整钱包信息:地址 + 私钥)
|
|
34
|
+
*/
|
|
35
|
+
export function generateHopWallets(recipientCount, hopCount) {
|
|
36
|
+
const hopCounts = Array.isArray(hopCount) ? hopCount : new Array(recipientCount).fill(hopCount);
|
|
37
|
+
if (hopCounts.every(h => h <= 0))
|
|
38
|
+
return null;
|
|
39
|
+
const result = [];
|
|
40
|
+
for (let i = 0; i < recipientCount; i++) {
|
|
41
|
+
const chain = [];
|
|
42
|
+
for (let j = 0; j < hopCounts[i]; j++) {
|
|
43
|
+
const wallet = Wallet.createRandom();
|
|
44
|
+
chain.push({
|
|
45
|
+
address: wallet.address,
|
|
46
|
+
privateKey: wallet.privateKey
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
result.push(chain);
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
export function normalizeAmounts(recipients, amount, amounts) {
|
|
54
|
+
if (amounts && amounts.length > 0) {
|
|
55
|
+
if (amounts.length !== recipients.length) {
|
|
56
|
+
throw new Error(`amounts length (${amounts.length}) must match recipients length (${recipients.length})`);
|
|
57
|
+
}
|
|
58
|
+
return amounts;
|
|
59
|
+
}
|
|
60
|
+
if (amount !== undefined && amount.trim().length > 0) {
|
|
61
|
+
return new Array(recipients.length).fill(amount);
|
|
62
|
+
}
|
|
63
|
+
throw new Error('Either amount or amounts must be provided');
|
|
64
|
+
}
|
|
65
|
+
export async function batchGetBalances(provider, addresses, tokenAddress) {
|
|
66
|
+
if (addresses.length === 0)
|
|
67
|
+
return [];
|
|
68
|
+
if (!tokenAddress) {
|
|
69
|
+
return Promise.all(addresses.map(addr => provider.getBalance(addr).catch(() => 0n)));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// ✅ 使用公共模块
|
|
73
|
+
const multicall = new ethers.Contract(MULTICALL3_ADDRESS, MULTICALL3_ABI, provider);
|
|
74
|
+
const iface = new ethers.Interface(ERC20_BALANCE_ABI);
|
|
75
|
+
const calls = addresses.map(addr => ({
|
|
76
|
+
target: tokenAddress,
|
|
77
|
+
allowFailure: true,
|
|
78
|
+
callData: iface.encodeFunctionData('balanceOf', [addr])
|
|
79
|
+
}));
|
|
80
|
+
try {
|
|
81
|
+
const results = await multicall.aggregate3(calls);
|
|
82
|
+
return results.map((result) => {
|
|
83
|
+
if (result.success) {
|
|
84
|
+
return iface.decodeFunctionResult('balanceOf', result.returnData)[0];
|
|
85
|
+
}
|
|
86
|
+
return 0n;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
const fallbackCalls = addresses.map(addr => provider
|
|
91
|
+
.call({ to: tokenAddress, data: iface.encodeFunctionData('balanceOf', [addr]) })
|
|
92
|
+
.then(raw => iface.decodeFunctionResult('balanceOf', raw)[0])
|
|
93
|
+
.catch(() => 0n));
|
|
94
|
+
return Promise.all(fallbackCalls);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* 计算 Gas Limit
|
|
100
|
+
* - 原生代币转账:21000 gas(固定)
|
|
101
|
+
* - ERC20 标准 transfer:约 45000-55000 gas,使用 55000 作为安全值
|
|
102
|
+
*
|
|
103
|
+
* ✅ 优化:降低 ERC20 gas limit,减少中转钱包 BNB 残留
|
|
104
|
+
*/
|
|
105
|
+
export function calculateGasLimit(config, isNative, hasHops, _hopCount = 0) {
|
|
106
|
+
if (config.gasLimit !== undefined) {
|
|
107
|
+
return BigInt(config.gasLimit);
|
|
108
|
+
}
|
|
109
|
+
// ✅ 原生代币: 21000, ERC20 标准 transfer: 48000(USDT 最低约 46815)
|
|
110
|
+
const baseGas = isNative ? 21000 : 48000;
|
|
111
|
+
// ✅ 多跳时每个中转钱包只执行一笔 transfer,使用较小的安全系数
|
|
112
|
+
const multiplier = config.gasLimitMultiplier ?? 1.1;
|
|
113
|
+
return BigInt(Math.ceil(baseGas * multiplier));
|
|
114
|
+
}
|
|
115
|
+
export function isNativeTokenAddress(tokenAddress) {
|
|
116
|
+
if (!tokenAddress)
|
|
117
|
+
return true;
|
|
118
|
+
const v = tokenAddress.trim().toLowerCase();
|
|
119
|
+
if (!v)
|
|
120
|
+
return true;
|
|
121
|
+
if (v === 'native')
|
|
122
|
+
return true;
|
|
123
|
+
if (v === '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee')
|
|
124
|
+
return true;
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
// ==================== 分散函数 ====================
|
|
128
|
+
/**
|
|
129
|
+
* Flap Protocol: 分散(仅签名版本)
|
|
130
|
+
* ✅ 支持利润提取(按地址数量收取固定费用)
|
|
131
|
+
* ✅ 支持多跳
|
|
132
|
+
* ✅ 支持 Multicall3 批量获取余额
|
|
133
|
+
*/
|
|
@@ -1,83 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { GeneratedWallet } from '../../../utils/wallet.js';
|
|
3
|
-
/** 分散参数 */
|
|
4
|
-
export type FlapDisperseSignParams = {
|
|
5
|
-
chain: 'BSC' | 'MONAD' | 'XLAYER';
|
|
6
|
-
fromPrivateKey: string;
|
|
7
|
-
recipients: string[];
|
|
8
|
-
amount?: string;
|
|
9
|
-
amounts?: string[];
|
|
10
|
-
tokenAddress?: string;
|
|
11
|
-
tokenDecimals?: number;
|
|
12
|
-
hopCount?: number | number[];
|
|
13
|
-
hopPrivateKeys?: string[][];
|
|
14
|
-
items?: {
|
|
15
|
-
recipient: string;
|
|
16
|
-
amount: string | bigint;
|
|
17
|
-
hopCount?: number;
|
|
18
|
-
hopPrivateKeys?: string[];
|
|
19
|
-
}[];
|
|
20
|
-
config: FlapSignConfig;
|
|
21
|
-
startNonce?: number;
|
|
22
|
-
};
|
|
23
|
-
/** 分散结果 */
|
|
24
|
-
export type FlapDisperseMerkleResult = {
|
|
25
|
-
signedTransactions: string[];
|
|
26
|
-
hopWallets?: (string | GeneratedWallet)[][];
|
|
27
|
-
profitHopWallets?: GeneratedWallet[];
|
|
28
|
-
metadata?: {
|
|
29
|
-
totalAmount: string;
|
|
30
|
-
profitAmount: string;
|
|
31
|
-
profitRecipient: string;
|
|
32
|
-
recipientCount: number;
|
|
33
|
-
isNative: boolean;
|
|
34
|
-
tokenAddress?: string;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
/** 归集参数 */
|
|
38
|
-
export type FlapSweepSignParams = {
|
|
39
|
-
chain: 'BSC' | 'MONAD' | 'XLAYER';
|
|
40
|
-
sourcePrivateKeys: string[];
|
|
41
|
-
target: string;
|
|
42
|
-
ratioPct?: number;
|
|
43
|
-
ratios?: number[];
|
|
44
|
-
amount?: string;
|
|
45
|
-
amounts?: string[];
|
|
46
|
-
tokenAddress?: string;
|
|
47
|
-
tokenDecimals?: number;
|
|
48
|
-
skipIfInsufficient?: boolean;
|
|
49
|
-
hopCount?: number | number[];
|
|
50
|
-
hopPrivateKeys?: string[][];
|
|
51
|
-
sources?: {
|
|
52
|
-
privateKey: string;
|
|
53
|
-
ratioPct?: number;
|
|
54
|
-
amount?: string;
|
|
55
|
-
hopCount?: number;
|
|
56
|
-
hopPrivateKeys?: string[];
|
|
57
|
-
}[];
|
|
58
|
-
config: FlapSignConfig;
|
|
59
|
-
startNonce?: number;
|
|
60
|
-
};
|
|
61
|
-
/** 归集结果 */
|
|
62
|
-
export type FlapSweepMerkleResult = {
|
|
63
|
-
signedTransactions: string[];
|
|
64
|
-
hopWallets?: (string | GeneratedWallet)[][];
|
|
65
|
-
profitHopWallets?: GeneratedWallet[];
|
|
66
|
-
metadata?: {
|
|
67
|
-
totalAmount: string;
|
|
68
|
-
profitAmount: string;
|
|
69
|
-
profitRecipient: string;
|
|
70
|
-
sourceCount: number;
|
|
71
|
-
isNative: boolean;
|
|
72
|
-
tokenAddress?: string;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Flap Protocol: 分散(仅签名版本)
|
|
77
|
-
* ✅ 支持利润提取(按地址数量收取固定费用)
|
|
78
|
-
* ✅ 支持多跳
|
|
79
|
-
* ✅ 支持 Multicall3 批量获取余额
|
|
80
|
-
*/
|
|
1
|
+
import type { FlapDisperseMerkleResult, FlapDisperseSignParams, FlapSweepMerkleResult, FlapSweepSignParams } from './types.js';
|
|
81
2
|
export declare function flapDisperseWithBundleMerkle(params: FlapDisperseSignParams): Promise<FlapDisperseMerkleResult>;
|
|
82
3
|
/**
|
|
83
4
|
* Flap Protocol: 归集(仅签名版本)
|