four-flap-meme-sdk 2.2.18 → 2.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/subpath-exports.test.d.ts +1 -0
- package/dist/__tests__/subpath-exports.test.js +64 -0
- package/dist/abis/common.d.ts +85 -0
- package/dist/abis/common.js +240 -0
- package/dist/abis/contracts/TaxToken.json +969 -0
- package/dist/abis/contracts/TokenManager.json +836 -0
- package/dist/abis/contracts/TokenManager2.json +136 -0
- package/dist/abis/contracts/TokenManagerHelper3.json +993 -0
- package/dist/abis/contracts/index.d.ts +5 -0
- package/dist/abis/contracts/index.js +5 -0
- package/dist/abis/flap/index.d.ts +5 -0
- package/dist/abis/flap/index.js +5 -0
- package/dist/abis/flap/portal-eip7702.d.ts +4 -0
- package/dist/abis/flap/portal-eip7702.js +39 -0
- package/dist/abis/flap/portal-events.d.ts +6 -0
- package/dist/abis/flap/portal-events.js +17 -0
- package/dist/abis/flap/portal-merkle.d.ts +4 -0
- package/dist/abis/flap/portal-merkle.js +25 -0
- package/dist/abis/flap/portal.d.ts +6 -0
- package/dist/abis/flap/portal.js +37 -0
- package/dist/abis/flap/vault.d.ts +171 -0
- package/dist/abis/flap/vault.js +91 -0
- package/dist/abis/index.d.ts +8 -0
- package/dist/abis/index.js +11 -0
- package/dist/bundle-core/__tests__/config-helpers.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/config-helpers.test.js +28 -0
- package/dist/bundle-core/__tests__/facade-parity.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/facade-parity.test.js +33 -0
- package/dist/bundle-core/__tests__/sign-context-helpers.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/sign-context-helpers.test.js +60 -0
- package/dist/bundle-core/__tests__/sign-fixture.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/sign-fixture.test.js +220 -0
- package/dist/bundle-core/__tests__/sign-fixtures.d.ts +10 -0
- package/dist/bundle-core/__tests__/sign-fixtures.js +16 -0
- package/dist/bundle-core/config-helpers.d.ts +37 -0
- package/dist/bundle-core/config-helpers.js +58 -0
- package/dist/bundle-core/errors.d.ts +50 -0
- package/dist/bundle-core/errors.js +38 -0
- package/dist/bundle-core/four-meme/approve-tokenmanager.d.ts +7 -0
- package/dist/bundle-core/four-meme/approve-tokenmanager.js +99 -0
- package/dist/bundle-core/four-meme/core-helpers.d.ts +8 -0
- package/dist/bundle-core/four-meme/core-helpers.js +41 -0
- package/dist/bundle-core/four-meme/core.d.ts +4 -0
- package/dist/bundle-core/four-meme/core.js +515 -0
- package/dist/bundle-core/four-meme/pancake-proxy.d.ts +28 -0
- package/dist/bundle-core/four-meme/pancake-proxy.js +679 -0
- package/dist/bundle-core/four-meme/private.d.ts +27 -0
- package/dist/bundle-core/four-meme/private.js +465 -0
- package/dist/bundle-core/four-meme/sign-context-helpers.d.ts +2 -0
- package/dist/bundle-core/four-meme/sign-context-helpers.js +2 -0
- package/dist/bundle-core/four-meme/swap-buy-first.d.ts +8 -0
- package/dist/bundle-core/four-meme/swap-buy-first.js +456 -0
- package/dist/bundle-core/four-meme/swap-hop-helpers.d.ts +6 -0
- package/dist/bundle-core/four-meme/swap-hop-helpers.js +63 -0
- package/dist/bundle-core/four-meme/swap-internal.d.ts +3 -0
- package/dist/bundle-core/four-meme/swap-internal.js +18 -0
- package/dist/bundle-core/four-meme/swap-sign-helpers.d.ts +28 -0
- package/dist/bundle-core/four-meme/swap-sign-helpers.js +105 -0
- package/dist/bundle-core/four-meme/swap.d.ts +17 -0
- package/dist/bundle-core/four-meme/swap.js +505 -0
- package/dist/bundle-core/four-meme/types/buy-first.d.ts +50 -0
- package/dist/bundle-core/four-meme/types/buy-first.js +1 -0
- package/dist/bundle-core/four-meme/types/core-flow.d.ts +63 -0
- package/dist/bundle-core/four-meme/types/core-flow.js +1 -0
- package/dist/bundle-core/four-meme/types/index.d.ts +600 -0
- package/dist/bundle-core/four-meme/types/index.js +1 -0
- package/dist/bundle-core/four-meme/types/swap-internal.d.ts +19 -0
- package/dist/bundle-core/four-meme/types/swap-internal.js +1 -0
- package/dist/bundle-core/four-meme/types.d.ts +1 -0
- package/dist/bundle-core/four-meme/types.js +1 -0
- package/dist/bundle-core/four-meme/utils-disperse.d.ts +7 -0
- package/dist/bundle-core/four-meme/utils-disperse.js +396 -0
- package/dist/bundle-core/four-meme/utils-pairwise.d.ts +8 -0
- package/dist/bundle-core/four-meme/utils-pairwise.js +328 -0
- package/dist/bundle-core/four-meme/utils-sweep.d.ts +8 -0
- package/dist/bundle-core/four-meme/utils-sweep.js +744 -0
- package/dist/bundle-core/index.d.ts +8 -0
- package/dist/bundle-core/index.js +8 -0
- package/dist/bundle-core/internal.d.ts +16 -0
- package/dist/bundle-core/internal.js +160 -0
- package/dist/bundle-core/sign-context-helpers.d.ts +26 -0
- package/dist/bundle-core/sign-context-helpers.js +63 -0
- package/dist/bundle-core/submit.d.ts +293 -0
- package/dist/bundle-core/submit.js +731 -0
- package/dist/bundle-core/types/index.d.ts +8 -0
- package/dist/bundle-core/types/index.js +1 -0
- package/dist/bundle-core/types.d.ts +1 -0
- package/dist/bundle-core/types.js +1 -0
- package/dist/chains/bsc/four/approve-tokenmanager.d.ts +1 -26
- package/dist/chains/bsc/four/approve-tokenmanager.js +1 -113
- package/dist/chains/bsc/four/config.d.ts +5 -67
- package/dist/chains/bsc/four/config.js +2 -114
- package/dist/chains/bsc/four/core.d.ts +1 -4
- package/dist/chains/bsc/four/core.js +1 -592
- package/dist/chains/bsc/four/index.d.ts +6 -6
- package/dist/chains/bsc/four/index.js +6 -6
- package/dist/chains/bsc/four/internal.d.ts +2 -46
- package/dist/chains/bsc/four/internal.js +2 -239
- package/dist/chains/bsc/four/pancake-proxy.d.ts +1 -28
- package/dist/chains/bsc/four/pancake-proxy.js +1 -687
- package/dist/chains/bsc/four/private.d.ts +1 -27
- package/dist/chains/bsc/four/private.js +1 -477
- package/dist/chains/bsc/four/submit.d.ts +2 -315
- package/dist/chains/bsc/four/submit.js +2 -752
- package/dist/chains/bsc/four/swap-buy-first.d.ts +2 -55
- package/dist/chains/bsc/four/swap-buy-first.js +2 -507
- package/dist/chains/bsc/four/swap-internal.d.ts +1 -3
- package/dist/chains/bsc/four/swap-internal.js +1 -18
- package/dist/chains/bsc/four/swap.d.ts +2 -144
- package/dist/chains/bsc/four/swap.js +2 -766
- package/dist/chains/bsc/four/types.d.ts +1 -476
- package/dist/chains/bsc/four/utils-disperse.d.ts +1 -0
- package/dist/chains/bsc/four/utils-disperse.js +1 -0
- package/dist/chains/bsc/four/utils-pairwise.d.ts +1 -0
- package/dist/chains/bsc/four/utils-pairwise.js +1 -0
- package/dist/chains/bsc/four/utils-sweep.d.ts +1 -0
- package/dist/chains/bsc/four/utils-sweep.js +1 -0
- package/dist/chains/bsc/four/utils.d.ts +5 -18
- package/dist/chains/bsc/four/utils.js +5 -1552
- package/dist/chains/bsc/iro.d.ts +5 -0
- package/dist/chains/bsc/iro.js +4 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +155 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +80 -0
- package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +1 -91
- package/dist/chains/bsc/pancake/bundle-buy-first.js +98 -213
- package/dist/chains/bsc/pancake/bundle-swap-helpers.d.ts +241 -0
- package/dist/chains/bsc/pancake/bundle-swap-helpers.js +565 -0
- package/dist/chains/bsc/pancake/bundle-swap.d.ts +1 -79
- package/dist/chains/bsc/pancake/bundle-swap.js +114 -726
- package/dist/chains/bsc/pancake/index.d.ts +4 -2
- package/dist/chains/bsc/pancake/index.js +1 -3
- package/dist/chains/bsc/platforms/iro/factory.d.ts +2 -2
- package/dist/chains/bsc/platforms/iro/factory.js +3 -1
- package/dist/chains/bsc/platforms/iro/index.d.ts +5 -5
- package/dist/chains/bsc/platforms/iro/index.js +3 -3
- package/dist/chains/bsc/platforms/iro/pool.js +31 -10
- package/dist/chains/bsc/platforms/iro/token.js +4 -1
- package/dist/chains/eni/batch-router/bundle-approve.js +4 -3
- package/dist/chains/eni/batch-router/transfer.js +55 -25
- package/dist/chains/eni/batch-router/utils.js +32 -6
- package/dist/chains/eni/bundler/sign.js +5 -6
- package/dist/chains/eni/bundler/submit.js +1 -4
- package/dist/chains/eni/constants.js +1 -1
- package/dist/chains/eni/flat-aliases.d.ts +10 -0
- package/dist/chains/eni/flat-aliases.js +8 -0
- package/dist/chains/eni/index.d.ts +2 -1
- package/dist/chains/eni/index.js +1 -0
- package/dist/chains/eni/platforms/daoaas/create.js +2 -2
- package/dist/chains/eni/platforms/daoaas/index.d.ts +3 -3
- package/dist/chains/eni/platforms/daoaas/index.js +3 -3
- package/dist/chains/eni/platforms/daoaas/meta.js +9 -6
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +28 -44
- package/dist/chains/eni/platforms/daoaas/portal.js +10 -6
- package/dist/chains/eni/platforms/dswap/liquidity.js +58 -26
- package/dist/chains/eni/platforms/fair-launch/index.d.ts +2 -2
- package/dist/chains/eni/platforms/fair-launch/index.js +1 -1
- package/dist/chains/eni/platforms/fair-launch/launcher.js +87 -46
- package/dist/chains/eni/platforms/fair-launch/pool.js +4 -1
- package/dist/chains/eni/platforms/fair-launch/presets.js +2 -2
- package/dist/chains/eni/platforms/iro/factory.d.ts +2 -2
- package/dist/chains/eni/platforms/iro/factory.js +3 -1
- package/dist/chains/eni/platforms/iro/index.d.ts +6 -6
- package/dist/chains/eni/platforms/iro/index.js +4 -4
- package/dist/chains/eni/platforms/iro/pool.js +90 -26
- package/dist/chains/eni/platforms/iro/token.js +107 -31
- package/dist/chains/eni/platforms/iro/whitelist.js +6 -18
- package/dist/chains/eni/submit.d.ts +43 -0
- package/dist/chains/eni/submit.js +287 -0
- package/dist/chains/index.d.ts +13 -0
- package/dist/chains/index.js +13 -0
- package/dist/chains/xlayer/constants.d.ts +5 -0
- package/dist/chains/xlayer/eip7702/bundle-approve.d.ts +2 -26
- package/dist/chains/xlayer/eip7702/bundle-approve.js +11 -21
- package/dist/chains/xlayer/eip7702/bundle-buy.d.ts +2 -6
- package/dist/chains/xlayer/eip7702/bundle-buy.js +13 -51
- package/dist/chains/xlayer/eip7702/bundle-create.js +104 -74
- package/dist/chains/xlayer/eip7702/bundle-sell.d.ts +2 -6
- package/dist/chains/xlayer/eip7702/bundle-sell.js +29 -111
- package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +3 -65
- package/dist/chains/xlayer/eip7702/bundle-swap.js +51 -245
- package/dist/chains/xlayer/eip7702/constants.d.ts +11 -26
- package/dist/chains/xlayer/eip7702/constants.js +15 -68
- package/dist/chains/xlayer/eip7702/flat-aliases.d.ts +13 -0
- package/dist/chains/xlayer/eip7702/flat-aliases.js +10 -0
- package/dist/chains/xlayer/eip7702/index.d.ts +28 -46
- package/dist/chains/xlayer/eip7702/index.js +28 -81
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.d.ts +79 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.js +1 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.d.ts +2 -203
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.js +63 -307
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.d.ts +26 -0
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.js +58 -0
- package/dist/chains/xlayer/eip7702/types.d.ts +88 -0
- package/dist/chains/xlayer/eip7702/utils.d.ts +0 -3
- package/dist/chains/xlayer/eip7702/utils.js +23 -28
- package/dist/chains/xlayer/eip7702/volume-helpers.d.ts +148 -0
- package/dist/chains/xlayer/eip7702/volume-helpers.js +48 -0
- package/dist/chains/xlayer/eip7702/volume.d.ts +6 -184
- package/dist/chains/xlayer/eip7702/volume.js +89 -164
- package/dist/chains/xlayer/eoa/constants.d.ts +1 -1
- package/dist/chains/xlayer/eoa/constants.js +2 -16
- package/dist/chains/xlayer/eoa/dex-helpers.d.ts +1 -1
- package/dist/chains/xlayer/eoa/dex-helpers.js +7 -37
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts +126 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +228 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.d.ts +1 -95
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.js +66 -299
- package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +1 -1
- package/dist/chains/xlayer/eoa/eoa-wash-volume.js +18 -23
- package/dist/chains/xlayer/eoa/index.d.ts +10 -6
- package/dist/chains/xlayer/eoa/index.js +8 -23
- package/dist/chains/xlayer/eoa/portal-ops.js +7 -2
- package/dist/chains/xlayer/eoa/router-manager.js +5 -4
- package/dist/chains/xlayer/eoa/types.d.ts +2 -2
- package/dist/chains/xlayer/eoa/types.js +1 -3
- package/dist/chains/xlayer/index.d.ts +3 -2
- package/dist/chains/xlayer/index.js +4 -7
- package/dist/contracts/helper3.d.ts +20 -5
- package/dist/contracts/helper3.js +56 -20
- package/dist/contracts/tm-bundle-helpers.d.ts +88 -0
- package/dist/contracts/tm-bundle-helpers.js +73 -0
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.d.ts +1 -26
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.js +1 -113
- package/dist/contracts/tm-bundle-merkle/config.d.ts +5 -67
- package/dist/contracts/tm-bundle-merkle/config.js +2 -114
- package/dist/contracts/tm-bundle-merkle/core.d.ts +1 -4
- package/dist/contracts/tm-bundle-merkle/core.js +1 -591
- package/dist/contracts/tm-bundle-merkle/index.d.ts +5 -5
- package/dist/contracts/tm-bundle-merkle/index.js +5 -5
- package/dist/contracts/tm-bundle-merkle/internal.d.ts +2 -46
- package/dist/contracts/tm-bundle-merkle/internal.js +2 -238
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.d.ts +1 -28
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.js +1 -686
- package/dist/contracts/tm-bundle-merkle/private.d.ts +1 -27
- package/dist/contracts/tm-bundle-merkle/private.js +1 -476
- package/dist/contracts/tm-bundle-merkle/submit.d.ts +3 -314
- package/dist/contracts/tm-bundle-merkle/submit.js +3 -928
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.d.ts +2 -55
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.js +2 -506
- package/dist/contracts/tm-bundle-merkle/swap-internal.d.ts +1 -3
- package/dist/contracts/tm-bundle-merkle/swap-internal.js +1 -18
- package/dist/contracts/tm-bundle-merkle/swap.d.ts +2 -144
- package/dist/contracts/tm-bundle-merkle/swap.js +2 -764
- package/dist/contracts/tm-bundle-merkle/types.d.ts +1 -476
- package/dist/contracts/tm-bundle-merkle/utils-disperse.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-disperse.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-sweep.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-sweep.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils.d.ts +6 -18
- package/dist/contracts/tm-bundle-merkle/utils.js +6 -1501
- package/dist/contracts/tm-bundle.d.ts +3 -51
- package/dist/contracts/tm-bundle.js +120 -187
- package/dist/contracts/tm.d.ts +10 -8
- package/dist/contracts/tm.js +39 -35
- package/dist/contracts/tm1.js +9 -4
- package/dist/contracts/tm2.js +10 -5
- package/dist/dex/direct-router-helpers.d.ts +269 -0
- package/dist/dex/direct-router-helpers.js +536 -0
- package/dist/dex/direct-router.d.ts +3 -125
- package/dist/dex/direct-router.js +244 -672
- package/dist/dex/types.d.ts +81 -0
- package/dist/dex/types.js +1 -0
- package/dist/exports/root-bundle-and-tooling.d.ts +27 -0
- package/dist/exports/root-bundle-and-tooling.js +30 -0
- package/dist/exports/root-eni-and-bsc-iro.d.ts +26 -0
- package/dist/exports/root-eni-and-bsc-iro.js +66 -0
- package/dist/exports/root-foundations.d.ts +35 -0
- package/dist/exports/root-foundations.js +70 -0
- package/dist/exports/root-swap-dex-and-xlayer.d.ts +30 -0
- package/dist/exports/root-swap-dex-and-xlayer.js +78 -0
- package/dist/flap/index.d.ts +11 -0
- package/dist/flap/index.js +9 -0
- package/dist/flows/create.d.ts +2 -1
- package/dist/flows/create.js +6 -6
- package/dist/flows/index.d.ts +9 -0
- package/dist/flows/index.js +9 -0
- package/dist/index.d.ts +20 -88
- package/dist/index.js +20 -218
- package/dist/merkle/index.d.ts +12 -0
- package/dist/merkle/index.js +11 -0
- package/dist/shared/abis/common.d.ts +2 -83
- package/dist/shared/abis/common.js +2 -254
- package/dist/shared/abis/index.d.ts +5 -6
- package/dist/shared/abis/index.js +5 -7
- package/dist/shared/clients/blockrazor.d.ts +4 -8
- package/dist/shared/clients/blockrazor.js +43 -35
- package/dist/shared/clients/club48.d.ts +2 -2
- package/dist/shared/clients/club48.js +36 -30
- package/dist/shared/clients/emitservice.js +2 -0
- package/dist/shared/clients/four.d.ts +21 -6
- package/dist/shared/clients/four.js +29 -24
- package/dist/shared/clients/index.d.ts +8 -0
- package/dist/shared/clients/index.js +8 -0
- package/dist/shared/clients/merkle.d.ts +4 -3
- package/dist/shared/clients/merkle.js +30 -47
- package/dist/shared/constants/addresses.d.ts +27 -1
- package/dist/shared/constants/addresses.js +39 -2
- package/dist/shared/constants/chains.d.ts +1 -1
- package/dist/shared/constants/chains.js +1 -1
- package/dist/shared/constants/gas.d.ts +1 -1
- package/dist/shared/constants/gas.js +2 -6
- package/dist/shared/constants/index.d.ts +4 -1
- package/dist/shared/constants/index.js +2 -1
- package/dist/shared/constants/quote.d.ts +30 -0
- package/dist/shared/constants/quote.js +37 -0
- package/dist/shared/flap/abi.js +1 -1
- package/dist/shared/flap/constants.d.ts +1 -2
- package/dist/shared/flap/constants.js +3 -4
- package/dist/shared/flap/curve.js +3 -0
- package/dist/shared/flap/errors.d.ts +1 -4
- package/dist/shared/flap/errors.js +20 -1
- package/dist/shared/flap/index.d.ts +4 -5
- package/dist/shared/flap/index.js +4 -5
- package/dist/shared/flap/launch-v6.d.ts +0 -5
- package/dist/shared/flap/launch-v6.js +2 -16
- package/dist/shared/flap/meta.d.ts +22 -18
- package/dist/shared/flap/meta.js +32 -24
- package/dist/shared/flap/permit.js +10 -3
- package/dist/shared/flap/pinata.d.ts +22 -6
- package/dist/shared/flap/pinata.js +21 -26
- package/dist/shared/flap/portal-bundle-merkle/config.d.ts +3 -72
- package/dist/shared/flap/portal-bundle-merkle/config.js +4 -124
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.d.ts +32 -0
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.js +83 -0
- package/dist/shared/flap/portal-bundle-merkle/core.d.ts +0 -4
- package/dist/shared/flap/portal-bundle-merkle/core.js +168 -175
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.d.ts +17 -4
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +96 -117
- package/dist/shared/flap/portal-bundle-merkle/curve-to-dex.js +104 -122
- package/dist/shared/flap/portal-bundle-merkle/index.d.ts +11 -7
- package/dist/shared/flap/portal-bundle-merkle/index.js +4 -7
- package/dist/shared/flap/portal-bundle-merkle/pancake-proxy.js +71 -68
- package/dist/shared/flap/portal-bundle-merkle/private.js +61 -114
- package/dist/shared/flap/portal-bundle-merkle/swap-batch.d.ts +8 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-batch.js +227 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +125 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.js +113 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.d.ts +1 -64
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.js +69 -288
- package/dist/shared/flap/portal-bundle-merkle/swap-cross.d.ts +9 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-cross.js +139 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.d.ts +149 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.js +259 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-planning.d.ts +70 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-planning.js +182 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-quick-batch.d.ts +16 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-quick-batch.js +327 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-single.d.ts +2 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-single.js +184 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-types.d.ts +101 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-types.js +1 -0
- package/dist/shared/flap/portal-bundle-merkle/swap.d.ts +6 -199
- package/dist/shared/flap/portal-bundle-merkle/swap.js +5 -1357
- package/dist/shared/flap/portal-bundle-merkle/types.d.ts +88 -12
- package/dist/shared/flap/portal-bundle-merkle/utils.d.ts +1 -80
- package/dist/shared/flap/portal-bundle-merkle/utils.js +145 -265
- package/dist/shared/flap/portal-bundle.js +83 -78
- package/dist/shared/flap/portal-create-token.d.ts +39 -21
- package/dist/shared/flap/portal-create-token.js +121 -124
- package/dist/shared/flap/portal.d.ts +1 -2
- package/dist/shared/flap/portal.js +36 -28
- package/dist/shared/flap/vanity.d.ts +6 -6
- package/dist/shared/flap/vanity.js +15 -21
- package/dist/shared/flap/vault.d.ts +25 -93
- package/dist/shared/flap/vault.js +77 -127
- package/dist/shared/foundation/amount/split-by-weight.d.ts +5 -0
- package/dist/shared/foundation/amount/split-by-weight.js +35 -0
- package/dist/shared/foundation/dex/v3-path.d.ts +6 -0
- package/dist/shared/foundation/dex/v3-path.js +35 -0
- package/dist/shared/foundation/erc20/decimals.d.ts +7 -0
- package/dist/shared/foundation/erc20/decimals.js +24 -0
- package/dist/shared/foundation/gas/bundle-gas.d.ts +49 -0
- package/dist/shared/foundation/gas/bundle-gas.js +93 -0
- package/dist/shared/foundation/gas/profit-hop.d.ts +20 -0
- package/dist/shared/foundation/gas/profit-hop.js +72 -0
- package/dist/shared/foundation/index.d.ts +15 -0
- package/dist/shared/foundation/index.js +14 -0
- package/dist/shared/foundation/nonce/nonce-manager.d.ts +19 -0
- package/dist/shared/foundation/nonce/nonce-manager.js +217 -0
- package/dist/shared/foundation/normalize-unknown.d.ts +9 -0
- package/dist/shared/foundation/normalize-unknown.js +29 -0
- package/dist/shared/foundation/sdk-logger.d.ts +13 -0
- package/dist/shared/foundation/sdk-logger.js +12 -0
- package/dist/shared/foundation/tx/build-request.d.ts +17 -0
- package/dist/shared/foundation/tx/build-request.js +25 -0
- package/dist/shared/foundation/tx/sign-batch.d.ts +5 -0
- package/dist/shared/foundation/tx/sign-batch.js +26 -0
- package/dist/shared/foundation/tx/wallet-sign-patch.d.ts +1 -0
- package/dist/shared/foundation/tx/wallet-sign-patch.js +18 -0
- package/dist/shared/foundation/types/airdrop-sweep.d.ts +79 -0
- package/dist/shared/foundation/types/airdrop-sweep.js +1 -0
- package/dist/shared/foundation/types/erc20.d.ts +65 -0
- package/dist/shared/foundation/types/erc20.js +1 -0
- package/dist/shared/foundation/types/holders-maker.d.ts +64 -0
- package/dist/shared/foundation/types/holders-maker.js +1 -0
- package/dist/shared/foundation/types/index.d.ts +7 -0
- package/dist/shared/foundation/types/index.js +1 -0
- package/dist/shared/foundation/types/lp-inspect.d.ts +102 -0
- package/dist/shared/foundation/types/lp-inspect.js +1 -0
- package/dist/shared/foundation/types/multicall.d.ts +5 -0
- package/dist/shared/foundation/types/multicall.js +1 -0
- package/dist/shared/foundation/types/private-sale.d.ts +35 -0
- package/dist/shared/foundation/types/private-sale.js +1 -0
- package/dist/shared/foundation/types/quote-helpers.d.ts +17 -0
- package/dist/shared/foundation/types/quote-helpers.js +1 -0
- package/dist/shared/foundation/wallet/generate.d.ts +5 -0
- package/dist/shared/foundation/wallet/generate.js +8 -0
- package/dist/shared/four/tax-token.d.ts +1 -1
- package/dist/shared/four/tax-token.js +31 -10
- package/dist/shared/index.d.ts +6 -0
- package/dist/shared/index.js +4 -0
- package/dist/types/errors.d.ts +27 -0
- package/dist/types/errors.js +34 -0
- package/dist/utils/airdrop-sweep.d.ts +4 -76
- package/dist/utils/airdrop-sweep.js +42 -55
- package/dist/utils/bundle-helpers.d.ts +9 -243
- package/dist/utils/bundle-helpers.js +10 -584
- package/dist/utils/constants.d.ts +5 -61
- package/dist/utils/constants.js +5 -80
- package/dist/utils/contract-factory.d.ts +2 -4
- package/dist/utils/contract-factory.js +25 -18
- package/dist/utils/erc20.d.ts +7 -89
- package/dist/utils/erc20.js +98 -129
- package/dist/utils/errors.d.ts +12 -1
- package/dist/utils/errors.js +60 -1
- package/dist/utils/holders-maker/addresses.d.ts +12 -0
- package/dist/utils/holders-maker/addresses.js +15 -0
- package/dist/utils/holders-maker/buy-tx.d.ts +44 -0
- package/dist/utils/holders-maker/buy-tx.js +278 -0
- package/dist/utils/holders-maker/constants.d.ts +6 -0
- package/dist/utils/holders-maker/constants.js +7 -0
- package/dist/utils/holders-maker/disperse.d.ts +18 -0
- package/dist/utils/holders-maker/disperse.js +90 -0
- package/dist/utils/holders-maker/routing.d.ts +4 -0
- package/dist/utils/holders-maker/routing.js +45 -0
- package/dist/utils/holders-maker/transfer-tx.d.ts +4 -0
- package/dist/utils/holders-maker/transfer-tx.js +67 -0
- package/dist/utils/holders-maker-helpers.d.ts +9 -0
- package/dist/utils/holders-maker-helpers.js +9 -0
- package/dist/utils/holders-maker.d.ts +2 -138
- package/dist/utils/holders-maker.js +50 -671
- package/dist/utils/hop-chains.d.ts +35 -0
- package/dist/utils/hop-chains.js +215 -0
- package/dist/utils/lp-inspect-helpers.d.ts +9 -0
- package/dist/utils/lp-inspect-helpers.js +109 -0
- package/dist/utils/lp-inspect.d.ts +2 -112
- package/dist/utils/lp-inspect.js +78 -293
- package/dist/utils/mpcExclusive.d.ts +2 -5
- package/dist/utils/mpcExclusive.js +4 -3
- package/dist/utils/private-sale.d.ts +2 -58
- package/dist/utils/private-sale.js +4 -15
- package/dist/utils/provider-factory.d.ts +4 -0
- package/dist/utils/provider-factory.js +10 -0
- package/dist/utils/quote-helpers.d.ts +4 -45
- package/dist/utils/quote-helpers.js +17 -74
- package/dist/utils/stealth-transfer.d.ts +2 -28
- package/dist/utils/stealth-transfer.js +39 -19
- package/dist/utils/swap-helpers.d.ts +2 -15
- package/dist/utils/swap-helpers.js +6 -11
- package/dist/utils/types/airdrop-sweep.d.ts +1 -0
- package/dist/utils/types/airdrop-sweep.js +1 -0
- package/dist/utils/types/contract-factory.d.ts +1 -0
- package/dist/utils/types/contract-factory.js +1 -0
- package/dist/utils/types/erc20.d.ts +1 -0
- package/dist/utils/types/erc20.js +1 -0
- package/dist/utils/types/errors.d.ts +1 -0
- package/dist/utils/types/errors.js +1 -0
- package/dist/utils/types/holders-maker.d.ts +1 -0
- package/dist/utils/types/holders-maker.js +1 -0
- package/dist/utils/types/hop-chains.d.ts +8 -0
- package/dist/utils/types/hop-chains.js +1 -0
- package/dist/utils/types/index.d.ts +13 -0
- package/dist/utils/types/index.js +1 -0
- package/dist/utils/types/lp-inspect.d.ts +1 -0
- package/dist/utils/types/lp-inspect.js +1 -0
- package/dist/utils/types/mpc-exclusive.d.ts +5 -0
- package/dist/utils/types/mpc-exclusive.js +1 -0
- package/dist/utils/types/private-sale.d.ts +1 -0
- package/dist/utils/types/private-sale.js +1 -0
- package/dist/utils/types/quote-helpers.d.ts +1 -0
- package/dist/utils/types/quote-helpers.js +1 -0
- package/dist/utils/types/stealth-transfer.d.ts +44 -0
- package/dist/utils/types/stealth-transfer.js +1 -0
- package/dist/utils/types/wallet.d.ts +25 -0
- package/dist/utils/types/wallet.js +1 -0
- package/dist/utils/wallet.d.ts +4 -25
- package/dist/utils/wallet.js +27 -22
- package/dist/vanity/index.d.ts +5 -0
- package/dist/vanity/index.js +5 -0
- package/package.json +100 -2
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Flap Tax Vaults(税收金库)
|
|
3
3
|
*
|
|
4
|
+
* ⚠️ 重要:基于 flap.sh/launch 实际源码分析,金库模式架构如下:
|
|
5
|
+
*
|
|
4
6
|
* 1. 金库代币通过 VaultPortal 合约创建(不是普通 Portal)
|
|
5
|
-
* 2. 调用函数:VaultPortal.
|
|
6
|
-
* 3.
|
|
7
|
-
* 4.
|
|
7
|
+
* 2. 调用函数:VaultPortal.newTaxTokenWithVault(params)
|
|
8
|
+
* 3. 参数中 extensionID/extensionData 始终为零值
|
|
9
|
+
* 4. 真正的金库配置通过 vaultFactory(工厂地址)和 vaultData(ABI 编码数据)传递
|
|
10
|
+
* 5. 每种金库类型对应一个具体的 VaultFactory 合约地址
|
|
8
11
|
*
|
|
9
|
-
*
|
|
12
|
+
* VaultPortal.newTaxTokenWithVault 参数结构:
|
|
13
|
+
* - 基础参数(与 Portal.newTokenV5 相同):name, symbol, meta, dexThresh, salt, taxRate,
|
|
14
|
+
* migratorType, quoteToken, quoteAmt, permitData, extensionID(全零), extensionData("0x"),
|
|
15
|
+
* dexId, lpFeeProfile, taxDuration, antiFarmerDuration, mktBps, deflationBps, dividendBps,
|
|
16
|
+
* lpBps, minimumShareBalance
|
|
17
|
+
* - 金库专属参数:vaultFactory(address), vaultData(bytes)
|
|
10
18
|
*
|
|
11
19
|
* 金库分类(来自 flap.sh 源码):
|
|
12
20
|
* 官方金库 (official):
|
|
@@ -20,8 +28,6 @@
|
|
|
20
28
|
* @module vault
|
|
21
29
|
*/
|
|
22
30
|
import { type JsonRpcProvider } from 'ethers';
|
|
23
|
-
import { TokenVersion } from './portal.js';
|
|
24
|
-
import type { TaxV2Config } from './portal-bundle-merkle/types.js';
|
|
25
31
|
/**
|
|
26
32
|
* FieldDescriptor — 字段描述符
|
|
27
33
|
* 对应 Solidity 结构体 IVaultSchemasV1.FieldDescriptor
|
|
@@ -111,18 +117,19 @@ export declare const VAULT_EXTRA_CONFIG: Record<string, Record<string, Record<st
|
|
|
111
117
|
export declare const FLAP_GUARDIAN_ADDRESSES: {
|
|
112
118
|
readonly BSC: "0x9e27098dcD8844bcc6287a557E0b4D09C86B8a4b";
|
|
113
119
|
};
|
|
114
|
-
/** VaultPortal 金库发射必须使用 TOKEN_TAXED_V3(enum = 6) */
|
|
115
|
-
export declare const TOKEN_TAXED_V3_VERSION = TokenVersion.TOKEN_TAXED_V3;
|
|
116
120
|
/**
|
|
117
|
-
* VaultPortal ABI —
|
|
121
|
+
* VaultPortal ABI — newTaxTokenWithVault
|
|
122
|
+
*
|
|
123
|
+
* ⚠️ 从 flap.sh 前端 JS 源码提取的真实 ABI
|
|
124
|
+
* 来源:flap.sh/_next/static/chunks/6288-*.js(VaultPortal 合约 ABI)
|
|
118
125
|
*/
|
|
119
126
|
export declare const VAULT_PORTAL_ABI: readonly [{
|
|
120
127
|
readonly type: "function";
|
|
121
|
-
readonly name: "
|
|
128
|
+
readonly name: "newTaxTokenWithVault";
|
|
122
129
|
readonly inputs: readonly [{
|
|
123
130
|
readonly name: "params";
|
|
124
131
|
readonly type: "tuple";
|
|
125
|
-
readonly internalType: "struct IVaultPortalTypes.
|
|
132
|
+
readonly internalType: "struct IVaultPortalTypes.NewTaxTokenWithVaultParams";
|
|
126
133
|
readonly components: readonly [{
|
|
127
134
|
readonly name: "name";
|
|
128
135
|
readonly type: "string";
|
|
@@ -138,11 +145,15 @@ export declare const VAULT_PORTAL_ABI: readonly [{
|
|
|
138
145
|
}, {
|
|
139
146
|
readonly name: "dexThresh";
|
|
140
147
|
readonly type: "uint8";
|
|
141
|
-
readonly internalType: "enum
|
|
148
|
+
readonly internalType: "enum IPortalCommonTypes.DexThreshType";
|
|
142
149
|
}, {
|
|
143
150
|
readonly name: "salt";
|
|
144
151
|
readonly type: "bytes32";
|
|
145
152
|
readonly internalType: "bytes32";
|
|
153
|
+
}, {
|
|
154
|
+
readonly name: "taxRate";
|
|
155
|
+
readonly type: "uint16";
|
|
156
|
+
readonly internalType: "uint16";
|
|
146
157
|
}, {
|
|
147
158
|
readonly name: "migratorType";
|
|
148
159
|
readonly type: "uint8";
|
|
@@ -175,14 +186,6 @@ export declare const VAULT_PORTAL_ABI: readonly [{
|
|
|
175
186
|
readonly name: "lpFeeProfile";
|
|
176
187
|
readonly type: "uint8";
|
|
177
188
|
readonly internalType: "enum IPortalTypes.V3LPFeeProfile";
|
|
178
|
-
}, {
|
|
179
|
-
readonly name: "buyTaxRate";
|
|
180
|
-
readonly type: "uint16";
|
|
181
|
-
readonly internalType: "uint16";
|
|
182
|
-
}, {
|
|
183
|
-
readonly name: "sellTaxRate";
|
|
184
|
-
readonly type: "uint16";
|
|
185
|
-
readonly internalType: "uint16";
|
|
186
189
|
}, {
|
|
187
190
|
readonly name: "taxDuration";
|
|
188
191
|
readonly type: "uint64";
|
|
@@ -211,18 +214,6 @@ export declare const VAULT_PORTAL_ABI: readonly [{
|
|
|
211
214
|
readonly name: "minimumShareBalance";
|
|
212
215
|
readonly type: "uint256";
|
|
213
216
|
readonly internalType: "uint256";
|
|
214
|
-
}, {
|
|
215
|
-
readonly name: "dividendToken";
|
|
216
|
-
readonly type: "address";
|
|
217
|
-
readonly internalType: "address";
|
|
218
|
-
}, {
|
|
219
|
-
readonly name: "commissionReceiver";
|
|
220
|
-
readonly type: "address";
|
|
221
|
-
readonly internalType: "address";
|
|
222
|
-
}, {
|
|
223
|
-
readonly name: "tokenVersion";
|
|
224
|
-
readonly type: "uint8";
|
|
225
|
-
readonly internalType: "enum IPortalTypes.TokenVersion";
|
|
226
217
|
}, {
|
|
227
218
|
readonly name: "vaultFactory";
|
|
228
219
|
readonly type: "address";
|
|
@@ -351,67 +342,8 @@ export declare function getVaultFactoryAddress(chain: string, vaultType: VaultTy
|
|
|
351
342
|
* 获取指定链的 VaultPortal 合约地址
|
|
352
343
|
*/
|
|
353
344
|
export declare function getVaultPortalAddress(chain: string): string | null;
|
|
354
|
-
export type BuildNewTokenV6WithVaultInput = {
|
|
355
|
-
tokenInfo: {
|
|
356
|
-
name: string;
|
|
357
|
-
symbol: string;
|
|
358
|
-
meta: string;
|
|
359
|
-
};
|
|
360
|
-
taxV2: TaxV2Config;
|
|
361
|
-
chain: string;
|
|
362
|
-
salt?: string;
|
|
363
|
-
taxRate?: number;
|
|
364
|
-
buyTaxRate?: number;
|
|
365
|
-
sellTaxRate?: number;
|
|
366
|
-
dexThresh?: number;
|
|
367
|
-
migratorType?: number;
|
|
368
|
-
quoteToken?: string;
|
|
369
|
-
quoteAmt?: bigint;
|
|
370
|
-
dexId?: number;
|
|
371
|
-
lpFeeProfile?: number;
|
|
372
|
-
};
|
|
373
|
-
/**
|
|
374
|
-
* 构建 VaultPortal.newTokenV6WithVault 参数(TOKEN_TAXED_V3)
|
|
375
|
-
*/
|
|
376
|
-
export declare function buildNewTokenV6WithVaultParams(input: BuildNewTokenV6WithVaultInput): {
|
|
377
|
-
name: string;
|
|
378
|
-
symbol: string;
|
|
379
|
-
meta: string;
|
|
380
|
-
dexThresh: number;
|
|
381
|
-
salt: string;
|
|
382
|
-
migratorType: number;
|
|
383
|
-
quoteToken: string;
|
|
384
|
-
quoteAmt: bigint;
|
|
385
|
-
permitData: string;
|
|
386
|
-
extensionID: string;
|
|
387
|
-
extensionData: string;
|
|
388
|
-
dexId: number;
|
|
389
|
-
lpFeeProfile: number;
|
|
390
|
-
buyTaxRate: number;
|
|
391
|
-
sellTaxRate: number;
|
|
392
|
-
taxDuration: bigint;
|
|
393
|
-
antiFarmerDuration: bigint;
|
|
394
|
-
mktBps: number;
|
|
395
|
-
deflationBps: number;
|
|
396
|
-
dividendBps: number;
|
|
397
|
-
lpBps: number;
|
|
398
|
-
minimumShareBalance: bigint;
|
|
399
|
-
dividendToken: string;
|
|
400
|
-
commissionReceiver: string;
|
|
401
|
-
tokenVersion: TokenVersion;
|
|
402
|
-
vaultFactory: string;
|
|
403
|
-
vaultData: string;
|
|
404
|
-
};
|
|
405
|
-
/** 金库发射 Vanity:TOKEN_TAXED_V3 + 后缀 7777 */
|
|
406
|
-
export declare function getVaultLaunchVanityOptions(chain: string): {
|
|
407
|
-
taxed: boolean;
|
|
408
|
-
taxedV3: boolean;
|
|
409
|
-
taxedV5: boolean;
|
|
410
|
-
suffix: string;
|
|
411
|
-
chain: "BSC" | "XLAYER" | "MONAD" | "BASE" | "MORPH";
|
|
412
|
-
};
|
|
413
345
|
/**
|
|
414
|
-
* 构建金库参数(用于 VaultPortal.
|
|
346
|
+
* 构建金库参数(用于 VaultPortal.newTaxTokenWithVault)
|
|
415
347
|
*
|
|
416
348
|
* ⚠️ 重要:返回的是 vaultFactory 和 vaultData,不是 extensionID/extensionData
|
|
417
349
|
* extensionID/extensionData 在金库模式下始终为零值
|
|
@@ -429,7 +361,7 @@ export declare function buildVaultParams(config?: TaxVaultConfig, chain?: string
|
|
|
429
361
|
* 金库参数通过 VaultPortal 的 vaultFactory/vaultData 传递
|
|
430
362
|
* 此函数仅用于向后兼容
|
|
431
363
|
*/
|
|
432
|
-
export declare function buildVaultExtensionParams(
|
|
364
|
+
export declare function buildVaultExtensionParams(): {
|
|
433
365
|
extensionID: string;
|
|
434
366
|
extensionData: string;
|
|
435
367
|
};
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Flap Tax Vaults(税收金库)
|
|
3
3
|
*
|
|
4
|
+
* ⚠️ 重要:基于 flap.sh/launch 实际源码分析,金库模式架构如下:
|
|
5
|
+
*
|
|
4
6
|
* 1. 金库代币通过 VaultPortal 合约创建(不是普通 Portal)
|
|
5
|
-
* 2. 调用函数:VaultPortal.
|
|
6
|
-
* 3.
|
|
7
|
-
* 4.
|
|
7
|
+
* 2. 调用函数:VaultPortal.newTaxTokenWithVault(params)
|
|
8
|
+
* 3. 参数中 extensionID/extensionData 始终为零值
|
|
9
|
+
* 4. 真正的金库配置通过 vaultFactory(工厂地址)和 vaultData(ABI 编码数据)传递
|
|
10
|
+
* 5. 每种金库类型对应一个具体的 VaultFactory 合约地址
|
|
8
11
|
*
|
|
9
|
-
*
|
|
12
|
+
* VaultPortal.newTaxTokenWithVault 参数结构:
|
|
13
|
+
* - 基础参数(与 Portal.newTokenV5 相同):name, symbol, meta, dexThresh, salt, taxRate,
|
|
14
|
+
* migratorType, quoteToken, quoteAmt, permitData, extensionID(全零), extensionData("0x"),
|
|
15
|
+
* dexId, lpFeeProfile, taxDuration, antiFarmerDuration, mktBps, deflationBps, dividendBps,
|
|
16
|
+
* lpBps, minimumShareBalance
|
|
17
|
+
* - 金库专属参数:vaultFactory(address), vaultData(bytes)
|
|
10
18
|
*
|
|
11
19
|
* 金库分类(来自 flap.sh 源码):
|
|
12
20
|
* 官方金库 (official):
|
|
@@ -20,9 +28,33 @@
|
|
|
20
28
|
* @module vault
|
|
21
29
|
*/
|
|
22
30
|
import { Contract, AbiCoder, ZeroAddress } from 'ethers';
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
import { getErrorMessageFromUnknown } from '../foundation/index.js';
|
|
32
|
+
function mapFieldDescriptor(f) {
|
|
33
|
+
return {
|
|
34
|
+
name: f.name,
|
|
35
|
+
fieldType: f.fieldType,
|
|
36
|
+
description: f.description,
|
|
37
|
+
decimals: Number(f.decimals),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function mapApproveAction(a) {
|
|
41
|
+
return {
|
|
42
|
+
tokenType: a.tokenType,
|
|
43
|
+
amountFieldName: a.amountFieldName,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function mapVaultMethodSchema(m) {
|
|
47
|
+
return {
|
|
48
|
+
name: m.name,
|
|
49
|
+
description: m.description,
|
|
50
|
+
inputs: m.inputs.map(mapFieldDescriptor),
|
|
51
|
+
outputs: m.outputs.map(mapFieldDescriptor),
|
|
52
|
+
approvals: m.approvals.map(mapApproveAction),
|
|
53
|
+
isInputArray: m.isInputArray,
|
|
54
|
+
isOutputArray: m.isOutputArray,
|
|
55
|
+
isWriteMethod: m.isWriteMethod,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
26
58
|
/**
|
|
27
59
|
* 金库类型显示标签
|
|
28
60
|
*/
|
|
@@ -100,25 +132,28 @@ export const FLAP_GUARDIAN_ADDRESSES = {
|
|
|
100
132
|
// ============================================================================
|
|
101
133
|
// ABI 定义
|
|
102
134
|
// ============================================================================
|
|
103
|
-
/** VaultPortal 金库发射必须使用 TOKEN_TAXED_V3(enum = 6) */
|
|
104
|
-
export const TOKEN_TAXED_V3_VERSION = TokenVersion.TOKEN_TAXED_V3;
|
|
105
135
|
/**
|
|
106
|
-
* VaultPortal ABI —
|
|
136
|
+
* VaultPortal ABI — newTaxTokenWithVault
|
|
137
|
+
*
|
|
138
|
+
* ⚠️ 从 flap.sh 前端 JS 源码提取的真实 ABI
|
|
139
|
+
* 来源:flap.sh/_next/static/chunks/6288-*.js(VaultPortal 合约 ABI)
|
|
107
140
|
*/
|
|
108
141
|
export const VAULT_PORTAL_ABI = [
|
|
109
142
|
{
|
|
110
143
|
type: 'function',
|
|
111
|
-
name: '
|
|
112
|
-
inputs: [
|
|
144
|
+
name: 'newTaxTokenWithVault',
|
|
145
|
+
inputs: [
|
|
146
|
+
{
|
|
113
147
|
name: 'params',
|
|
114
148
|
type: 'tuple',
|
|
115
|
-
internalType: 'struct IVaultPortalTypes.
|
|
149
|
+
internalType: 'struct IVaultPortalTypes.NewTaxTokenWithVaultParams',
|
|
116
150
|
components: [
|
|
117
151
|
{ name: 'name', type: 'string', internalType: 'string' },
|
|
118
152
|
{ name: 'symbol', type: 'string', internalType: 'string' },
|
|
119
153
|
{ name: 'meta', type: 'string', internalType: 'string' },
|
|
120
|
-
{ name: 'dexThresh', type: 'uint8', internalType: 'enum
|
|
154
|
+
{ name: 'dexThresh', type: 'uint8', internalType: 'enum IPortalCommonTypes.DexThreshType' },
|
|
121
155
|
{ name: 'salt', type: 'bytes32', internalType: 'bytes32' },
|
|
156
|
+
{ name: 'taxRate', type: 'uint16', internalType: 'uint16' },
|
|
122
157
|
{ name: 'migratorType', type: 'uint8', internalType: 'enum IPortalTypes.MigratorType' },
|
|
123
158
|
{ name: 'quoteToken', type: 'address', internalType: 'address' },
|
|
124
159
|
{ name: 'quoteAmt', type: 'uint256', internalType: 'uint256' },
|
|
@@ -127,8 +162,6 @@ export const VAULT_PORTAL_ABI = [
|
|
|
127
162
|
{ name: 'extensionData', type: 'bytes', internalType: 'bytes' },
|
|
128
163
|
{ name: 'dexId', type: 'uint8', internalType: 'enum IPortalTypes.DEXId' },
|
|
129
164
|
{ name: 'lpFeeProfile', type: 'uint8', internalType: 'enum IPortalTypes.V3LPFeeProfile' },
|
|
130
|
-
{ name: 'buyTaxRate', type: 'uint16', internalType: 'uint16' },
|
|
131
|
-
{ name: 'sellTaxRate', type: 'uint16', internalType: 'uint16' },
|
|
132
165
|
{ name: 'taxDuration', type: 'uint64', internalType: 'uint64' },
|
|
133
166
|
{ name: 'antiFarmerDuration', type: 'uint64', internalType: 'uint64' },
|
|
134
167
|
{ name: 'mktBps', type: 'uint16', internalType: 'uint16' },
|
|
@@ -136,13 +169,11 @@ export const VAULT_PORTAL_ABI = [
|
|
|
136
169
|
{ name: 'dividendBps', type: 'uint16', internalType: 'uint16' },
|
|
137
170
|
{ name: 'lpBps', type: 'uint16', internalType: 'uint16' },
|
|
138
171
|
{ name: 'minimumShareBalance', type: 'uint256', internalType: 'uint256' },
|
|
139
|
-
{ name: 'dividendToken', type: 'address', internalType: 'address' },
|
|
140
|
-
{ name: 'commissionReceiver', type: 'address', internalType: 'address' },
|
|
141
|
-
{ name: 'tokenVersion', type: 'uint8', internalType: 'enum IPortalTypes.TokenVersion' },
|
|
142
172
|
{ name: 'vaultFactory', type: 'address', internalType: 'address' },
|
|
143
173
|
{ name: 'vaultData', type: 'bytes', internalType: 'bytes' },
|
|
144
|
-
]
|
|
145
|
-
}
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
],
|
|
146
177
|
outputs: [{ name: 'token', type: 'address', internalType: 'address' }],
|
|
147
178
|
stateMutability: 'payable',
|
|
148
179
|
},
|
|
@@ -150,7 +181,8 @@ export const VAULT_PORTAL_ABI = [
|
|
|
150
181
|
type: 'function',
|
|
151
182
|
name: 'getVault',
|
|
152
183
|
inputs: [{ name: 'taxToken', type: 'address', internalType: 'address' }],
|
|
153
|
-
outputs: [
|
|
184
|
+
outputs: [
|
|
185
|
+
{
|
|
154
186
|
name: 'info',
|
|
155
187
|
type: 'tuple',
|
|
156
188
|
internalType: 'struct IVaultPortalTypes.VaultInfo',
|
|
@@ -160,8 +192,9 @@ export const VAULT_PORTAL_ABI = [
|
|
|
160
192
|
{ name: 'description', type: 'string', internalType: 'string' },
|
|
161
193
|
{ name: 'isOfficial', type: 'bool', internalType: 'bool' },
|
|
162
194
|
{ name: 'riskLevel', type: 'uint8', internalType: 'enum IVaultPortalTypes.RiskLevel' },
|
|
163
|
-
]
|
|
164
|
-
}
|
|
195
|
+
],
|
|
196
|
+
},
|
|
197
|
+
],
|
|
165
198
|
stateMutability: 'view',
|
|
166
199
|
},
|
|
167
200
|
{
|
|
@@ -188,9 +221,7 @@ export const VAULT_FACTORY_V2_ABI = [
|
|
|
188
221
|
/**
|
|
189
222
|
* VaultBase ABI(V1)
|
|
190
223
|
*/
|
|
191
|
-
export const VAULT_BASE_ABI = [
|
|
192
|
-
'function description() public view returns (string)',
|
|
193
|
-
];
|
|
224
|
+
export const VAULT_BASE_ABI = ['function description() public view returns (string)'];
|
|
194
225
|
/**
|
|
195
226
|
* VaultBaseV2 ABI
|
|
196
227
|
*/
|
|
@@ -239,16 +270,21 @@ function mapFieldTypeToAbiType(fieldType) {
|
|
|
239
270
|
function processFieldValue(field, rawValue) {
|
|
240
271
|
if (rawValue === undefined || rawValue === null) {
|
|
241
272
|
switch (field.fieldType) {
|
|
242
|
-
case 'address':
|
|
243
|
-
|
|
244
|
-
case '
|
|
273
|
+
case 'address':
|
|
274
|
+
return ZeroAddress;
|
|
275
|
+
case 'bool':
|
|
276
|
+
return false;
|
|
277
|
+
case 'string':
|
|
278
|
+
return '';
|
|
245
279
|
case 'bytes':
|
|
246
|
-
case 'bytes32':
|
|
247
|
-
|
|
280
|
+
case 'bytes32':
|
|
281
|
+
return '0x' + '00'.repeat(32);
|
|
282
|
+
default:
|
|
283
|
+
return 0;
|
|
248
284
|
}
|
|
249
285
|
}
|
|
250
286
|
if (field.decimals > 0 && typeof rawValue === 'number') {
|
|
251
|
-
return BigInt(Math.round(rawValue *
|
|
287
|
+
return BigInt(Math.round(rawValue * 10 ** field.decimals));
|
|
252
288
|
}
|
|
253
289
|
if (field.fieldType === 'bool') {
|
|
254
290
|
return Boolean(rawValue);
|
|
@@ -273,66 +309,7 @@ export function getVaultPortalAddress(chain) {
|
|
|
273
309
|
return VAULT_PORTAL_ADDRESSES[chainKey] || null;
|
|
274
310
|
}
|
|
275
311
|
/**
|
|
276
|
-
*
|
|
277
|
-
*/
|
|
278
|
-
export function buildNewTokenV6WithVaultParams(input) {
|
|
279
|
-
const tv2 = normalizeTaxV2Fields(input.taxV2);
|
|
280
|
-
const total = tv2.mktBps + tv2.deflationBps + tv2.dividendBps + tv2.lpBps;
|
|
281
|
-
if (total !== 10000) {
|
|
282
|
-
throw new Error(`Tax distribution must sum to 10000 (100%), got ${total}`);
|
|
283
|
-
}
|
|
284
|
-
if (tv2.mktBps <= 0) {
|
|
285
|
-
throw new Error('Vault launch requires mktBps > 0');
|
|
286
|
-
}
|
|
287
|
-
const buyTaxRate = (input.buyTaxRate ?? input.taxRate ?? 0) & 0xffff;
|
|
288
|
-
const sellTaxRate = (input.sellTaxRate ?? input.taxRate ?? 0) & 0xffff;
|
|
289
|
-
if (buyTaxRate <= 0 || sellTaxRate <= 0) {
|
|
290
|
-
throw new Error('Vault launch requires buyTaxRate and sellTaxRate > 0');
|
|
291
|
-
}
|
|
292
|
-
const { vaultFactory, vaultData } = buildVaultParams(tv2.vaultConfig, input.chain);
|
|
293
|
-
return {
|
|
294
|
-
name: input.tokenInfo.name,
|
|
295
|
-
symbol: input.tokenInfo.symbol,
|
|
296
|
-
meta: input.tokenInfo.meta,
|
|
297
|
-
dexThresh: (input.dexThresh ?? 1) & 0xff,
|
|
298
|
-
salt: input.salt ?? ('0x' + '00'.repeat(32)),
|
|
299
|
-
migratorType: (input.migratorType ?? 0) & 0xff,
|
|
300
|
-
quoteToken: input.quoteToken || ZeroAddress,
|
|
301
|
-
quoteAmt: input.quoteAmt ?? 0n,
|
|
302
|
-
permitData: '0x',
|
|
303
|
-
extensionID: NONE_EXTENSION_ID,
|
|
304
|
-
extensionData: '0x',
|
|
305
|
-
dexId: (input.dexId ?? 0) & 0xff,
|
|
306
|
-
lpFeeProfile: (input.lpFeeProfile ?? 0) & 0xff,
|
|
307
|
-
buyTaxRate,
|
|
308
|
-
sellTaxRate,
|
|
309
|
-
taxDuration: BigInt(tv2.taxDuration),
|
|
310
|
-
antiFarmerDuration: BigInt(tv2.antiFarmerDuration),
|
|
311
|
-
mktBps: tv2.mktBps & 0xffff,
|
|
312
|
-
deflationBps: tv2.deflationBps & 0xffff,
|
|
313
|
-
dividendBps: tv2.dividendBps & 0xffff,
|
|
314
|
-
lpBps: tv2.lpBps & 0xffff,
|
|
315
|
-
minimumShareBalance: BigInt(tv2.minimumShareBalance ?? 10000) * (10n ** 18n),
|
|
316
|
-
dividendToken: resolveDividendTokenForQuote(input.quoteToken),
|
|
317
|
-
commissionReceiver: ZeroAddress,
|
|
318
|
-
tokenVersion: TOKEN_TAXED_V3_VERSION,
|
|
319
|
-
vaultFactory,
|
|
320
|
-
vaultData,
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
/** 金库发射 Vanity:TOKEN_TAXED_V3 + 后缀 7777 */
|
|
324
|
-
export function getVaultLaunchVanityOptions(chain) {
|
|
325
|
-
const c = chain.toUpperCase();
|
|
326
|
-
return {
|
|
327
|
-
taxed: true,
|
|
328
|
-
taxedV3: true,
|
|
329
|
-
taxedV5: false,
|
|
330
|
-
suffix: getVanitySuffix(c, true),
|
|
331
|
-
chain: c,
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* 构建金库参数(用于 VaultPortal.newTokenV6WithVault)
|
|
312
|
+
* 构建金库参数(用于 VaultPortal.newTaxTokenWithVault)
|
|
336
313
|
*
|
|
337
314
|
* ⚠️ 重要:返回的是 vaultFactory 和 vaultData,不是 extensionID/extensionData
|
|
338
315
|
* extensionID/extensionData 在金库模式下始终为零值
|
|
@@ -385,7 +362,7 @@ export function buildVaultParams(config, chain) {
|
|
|
385
362
|
* 金库参数通过 VaultPortal 的 vaultFactory/vaultData 传递
|
|
386
363
|
* 此函数仅用于向后兼容
|
|
387
364
|
*/
|
|
388
|
-
export function buildVaultExtensionParams(
|
|
365
|
+
export function buildVaultExtensionParams() {
|
|
389
366
|
// 金库模式下 extensionID/extensionData 始终为零值
|
|
390
367
|
return {
|
|
391
368
|
extensionID: NONE_EXTENSION_ID,
|
|
@@ -401,15 +378,10 @@ export function buildVaultExtensionParams(config) {
|
|
|
401
378
|
export async function queryVaultDataSchema(provider, factoryAddress) {
|
|
402
379
|
try {
|
|
403
380
|
const factory = new Contract(factoryAddress, VAULT_FACTORY_V2_ABI, provider);
|
|
404
|
-
const raw = await factory.vaultDataSchema();
|
|
381
|
+
const raw = (await factory.vaultDataSchema());
|
|
405
382
|
return {
|
|
406
383
|
description: raw.description,
|
|
407
|
-
fields: raw.fields.map(
|
|
408
|
-
name: f.name,
|
|
409
|
-
fieldType: f.fieldType,
|
|
410
|
-
description: f.description,
|
|
411
|
-
decimals: Number(f.decimals),
|
|
412
|
-
})),
|
|
384
|
+
fields: raw.fields.map(mapFieldDescriptor),
|
|
413
385
|
isArray: raw.isArray,
|
|
414
386
|
};
|
|
415
387
|
}
|
|
@@ -423,33 +395,11 @@ export async function queryVaultDataSchema(provider, factoryAddress) {
|
|
|
423
395
|
export async function queryVaultUISchema(provider, vaultAddress) {
|
|
424
396
|
try {
|
|
425
397
|
const vault = new Contract(vaultAddress, VAULT_BASE_V2_ABI, provider);
|
|
426
|
-
const raw = await vault.vaultUISchema();
|
|
398
|
+
const raw = (await vault.vaultUISchema());
|
|
427
399
|
return {
|
|
428
400
|
vaultType: raw.vaultType,
|
|
429
401
|
description: raw.description,
|
|
430
|
-
methods: raw.methods.map(
|
|
431
|
-
name: m.name,
|
|
432
|
-
description: m.description,
|
|
433
|
-
inputs: m.inputs.map((f) => ({
|
|
434
|
-
name: f.name,
|
|
435
|
-
fieldType: f.fieldType,
|
|
436
|
-
description: f.description,
|
|
437
|
-
decimals: Number(f.decimals),
|
|
438
|
-
})),
|
|
439
|
-
outputs: m.outputs.map((f) => ({
|
|
440
|
-
name: f.name,
|
|
441
|
-
fieldType: f.fieldType,
|
|
442
|
-
description: f.description,
|
|
443
|
-
decimals: Number(f.decimals),
|
|
444
|
-
})),
|
|
445
|
-
approvals: m.approvals.map((a) => ({
|
|
446
|
-
tokenType: a.tokenType,
|
|
447
|
-
amountFieldName: a.amountFieldName,
|
|
448
|
-
})),
|
|
449
|
-
isInputArray: m.isInputArray,
|
|
450
|
-
isOutputArray: m.isOutputArray,
|
|
451
|
-
isWriteMethod: m.isWriteMethod,
|
|
452
|
-
})),
|
|
402
|
+
methods: raw.methods.map(mapVaultMethodSchema),
|
|
453
403
|
};
|
|
454
404
|
}
|
|
455
405
|
catch {
|
|
@@ -485,7 +435,7 @@ export async function validateVaultFactory(provider, factoryAddress) {
|
|
|
485
435
|
};
|
|
486
436
|
}
|
|
487
437
|
catch (e) {
|
|
488
|
-
return { isValid: false, isV2: false, schema: null, error:
|
|
438
|
+
return { isValid: false, isV2: false, schema: null, error: getErrorMessageFromUnknown(e) };
|
|
489
439
|
}
|
|
490
440
|
}
|
|
491
441
|
/**
|
|
@@ -494,7 +444,7 @@ export async function validateVaultFactory(provider, factoryAddress) {
|
|
|
494
444
|
export async function getVaultInfo(provider, vaultPortalAddress, taxTokenAddress) {
|
|
495
445
|
try {
|
|
496
446
|
const portal = new Contract(vaultPortalAddress, VAULT_PORTAL_ABI, provider);
|
|
497
|
-
const info = await portal.getVault(taxTokenAddress);
|
|
447
|
+
const info = (await portal.getVault(taxTokenAddress));
|
|
498
448
|
return {
|
|
499
449
|
vault: info.vault,
|
|
500
450
|
vaultFactory: info.vaultFactory,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function shuffle(arr) {
|
|
2
|
+
const a = arr.slice();
|
|
3
|
+
for (let i = a.length - 1; i > 0; i--) {
|
|
4
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
5
|
+
[a[i], a[j]] = [a[j], a[i]];
|
|
6
|
+
}
|
|
7
|
+
return a;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 将 bigint 金额按随机权重拆分为多份,末份取 remainder,保证总和精确。
|
|
11
|
+
* 权重范围 500_000–1_500_000(与 dex-helpers 一致),全程 bigint 运算。
|
|
12
|
+
*/
|
|
13
|
+
export function splitAmountByWeight(totalAmount, count) {
|
|
14
|
+
if (count <= 0)
|
|
15
|
+
throw new Error('拆分份数必须大于 0');
|
|
16
|
+
if (count === 1)
|
|
17
|
+
return [totalAmount];
|
|
18
|
+
if (totalAmount <= 0n)
|
|
19
|
+
return new Array(count).fill(0n);
|
|
20
|
+
const weights = [];
|
|
21
|
+
for (let i = 0; i < count; i++) {
|
|
22
|
+
const w = BigInt(500_000 + Math.floor(Math.random() * 1_000_000));
|
|
23
|
+
weights.push(w);
|
|
24
|
+
}
|
|
25
|
+
const totalWeight = weights.reduce((a, b) => a + b, 0n);
|
|
26
|
+
const amounts = [];
|
|
27
|
+
let allocated = 0n;
|
|
28
|
+
for (let i = 0; i < count - 1; i++) {
|
|
29
|
+
const amt = (totalAmount * weights[i]) / totalWeight;
|
|
30
|
+
amounts.push(amt);
|
|
31
|
+
allocated += amt;
|
|
32
|
+
}
|
|
33
|
+
amounts.push(totalAmount - allocated);
|
|
34
|
+
return shuffle(amounts);
|
|
35
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { GAS_CONFIG } from '../../constants/gas.js';
|
|
2
|
+
export function getDeadline(minutes = GAS_CONFIG.DEFAULT_DEADLINE_MINUTES) {
|
|
3
|
+
return Math.floor(Date.now() / 1000) + 60 * minutes;
|
|
4
|
+
}
|
|
5
|
+
export function encodeV3Path(tokens, fees) {
|
|
6
|
+
if (tokens.length < 2) {
|
|
7
|
+
throw new Error('V3 path 需要至少 2 个代币');
|
|
8
|
+
}
|
|
9
|
+
if (fees.length !== tokens.length - 1) {
|
|
10
|
+
throw new Error(`费率数量 (${fees.length}) 必须等于代币数量 - 1 (${tokens.length - 1})`);
|
|
11
|
+
}
|
|
12
|
+
let path = '0x';
|
|
13
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
14
|
+
path += tokens[i].slice(2).toLowerCase().padStart(40, '0');
|
|
15
|
+
if (i < fees.length) {
|
|
16
|
+
path += fees[i].toString(16).padStart(6, '0');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return path;
|
|
20
|
+
}
|
|
21
|
+
export function decodeV3Path(path) {
|
|
22
|
+
const cleanPath = path.startsWith('0x') ? path.slice(2) : path;
|
|
23
|
+
const tokens = [];
|
|
24
|
+
const fees = [];
|
|
25
|
+
let offset = 0;
|
|
26
|
+
while (offset < cleanPath.length) {
|
|
27
|
+
tokens.push('0x' + cleanPath.slice(offset, offset + 40));
|
|
28
|
+
offset += 40;
|
|
29
|
+
if (offset < cleanPath.length) {
|
|
30
|
+
fees.push(parseInt(cleanPath.slice(offset, offset + 6), 16));
|
|
31
|
+
offset += 6;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return { tokens, fees };
|
|
35
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { JsonRpcProvider } from 'ethers';
|
|
2
|
+
/**
|
|
3
|
+
* 获取 ERC20 代币精度(带缓存)
|
|
4
|
+
*/
|
|
5
|
+
export declare function getErc20Decimals(provider: JsonRpcProvider, token: string, chainId?: number): Promise<number>;
|
|
6
|
+
/** @deprecated 使用 getErc20Decimals */
|
|
7
|
+
export declare const getErc20DecimalsMerkle: typeof getErc20Decimals;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
const decimalsCache = new Map();
|
|
3
|
+
/**
|
|
4
|
+
* 获取 ERC20 代币精度(带缓存)
|
|
5
|
+
*/
|
|
6
|
+
export async function getErc20Decimals(provider, token, chainId) {
|
|
7
|
+
const resolvedChainId = chainId ?? Number((await provider.getNetwork()).chainId);
|
|
8
|
+
const key = `${resolvedChainId}_${token.toLowerCase()}`;
|
|
9
|
+
if (decimalsCache.has(key))
|
|
10
|
+
return decimalsCache.get(key);
|
|
11
|
+
try {
|
|
12
|
+
const erc20 = new ethers.Contract(token, ['function decimals() view returns (uint8)'], provider);
|
|
13
|
+
const d = await erc20.decimals();
|
|
14
|
+
if (!Number.isFinite(d) || d < 0 || d > 36)
|
|
15
|
+
return 18;
|
|
16
|
+
decimalsCache.set(key, d);
|
|
17
|
+
return d;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return 18;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** @deprecated 使用 getErc20Decimals */
|
|
24
|
+
export const getErc20DecimalsMerkle = getErc20Decimals;
|