four-flap-meme-sdk 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +41 -6
- package/README.md +31 -0
- package/README.zh-CN.md +41 -6
- package/dist/__tests__/subpath-exports.test.d.ts +1 -0
- package/dist/__tests__/subpath-exports.test.js +64 -0
- package/dist/abis/common.d.ts +85 -0
- package/dist/abis/common.js +264 -0
- package/dist/abis/contracts/TaxToken.json +969 -0
- package/dist/abis/contracts/TokenManager2.json +136 -0
- package/dist/abis/contracts/index.d.ts +5 -0
- package/dist/abis/contracts/index.js +5 -0
- package/dist/abis/flap/index.d.ts +3 -0
- package/dist/abis/flap/index.js +3 -0
- package/dist/abis/flap/portal-events.d.ts +6 -0
- package/dist/abis/flap/portal-events.js +17 -0
- package/dist/abis/flap/portal.d.ts +6 -0
- package/dist/abis/flap/portal.js +37 -0
- package/dist/abis/flap/vault.d.ts +171 -0
- package/dist/abis/flap/vault.js +91 -0
- package/dist/abis/index.d.ts +8 -0
- package/dist/abis/index.js +11 -0
- package/dist/bundle-core/__tests__/config-helpers.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/config-helpers.test.js +28 -0
- package/dist/bundle-core/__tests__/facade-parity.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/facade-parity.test.js +33 -0
- package/dist/bundle-core/__tests__/sign-context-helpers.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/sign-context-helpers.test.js +60 -0
- package/dist/bundle-core/__tests__/sign-fixture.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/sign-fixture.test.js +220 -0
- package/dist/bundle-core/__tests__/sign-fixtures.d.ts +10 -0
- package/dist/bundle-core/__tests__/sign-fixtures.js +16 -0
- package/dist/bundle-core/config-helpers.d.ts +36 -0
- package/dist/bundle-core/config-helpers.js +57 -0
- package/dist/bundle-core/errors.d.ts +50 -0
- package/dist/bundle-core/errors.js +35 -0
- package/dist/bundle-core/four-meme/approve-tokenmanager.d.ts +7 -0
- package/dist/bundle-core/four-meme/approve-tokenmanager.js +99 -0
- package/dist/bundle-core/four-meme/core-helpers.d.ts +8 -0
- package/dist/bundle-core/four-meme/core-helpers.js +40 -0
- package/dist/bundle-core/four-meme/core.d.ts +4 -0
- package/dist/bundle-core/four-meme/core.js +515 -0
- package/dist/bundle-core/four-meme/pancake-proxy.d.ts +28 -0
- package/dist/bundle-core/four-meme/pancake-proxy.js +679 -0
- package/dist/bundle-core/four-meme/private.d.ts +27 -0
- package/dist/bundle-core/four-meme/private.js +465 -0
- package/dist/bundle-core/four-meme/sign-context-helpers.d.ts +2 -0
- package/dist/bundle-core/four-meme/sign-context-helpers.js +2 -0
- package/dist/bundle-core/four-meme/swap-buy-first.d.ts +8 -0
- package/dist/bundle-core/four-meme/swap-buy-first.js +493 -0
- package/dist/bundle-core/four-meme/swap-hop-helpers.d.ts +6 -0
- package/dist/bundle-core/four-meme/swap-hop-helpers.js +63 -0
- package/dist/bundle-core/four-meme/swap-internal.d.ts +3 -0
- package/dist/bundle-core/four-meme/swap-internal.js +18 -0
- package/dist/bundle-core/four-meme/swap-sign-helpers.d.ts +27 -0
- package/dist/bundle-core/four-meme/swap-sign-helpers.js +105 -0
- package/dist/bundle-core/four-meme/swap.d.ts +17 -0
- package/dist/bundle-core/four-meme/swap.js +505 -0
- package/dist/bundle-core/four-meme/types/buy-first.d.ts +50 -0
- package/dist/bundle-core/four-meme/types/buy-first.js +1 -0
- package/dist/bundle-core/four-meme/types/core-flow.d.ts +63 -0
- package/dist/bundle-core/four-meme/types/core-flow.js +1 -0
- package/dist/bundle-core/four-meme/types/index.d.ts +600 -0
- package/dist/bundle-core/four-meme/types/index.js +1 -0
- package/dist/bundle-core/four-meme/types/swap-internal.d.ts +19 -0
- package/dist/bundle-core/four-meme/types/swap-internal.js +1 -0
- package/dist/bundle-core/four-meme/types.d.ts +1 -0
- package/dist/bundle-core/four-meme/types.js +1 -0
- package/dist/bundle-core/four-meme/utils-disperse.d.ts +7 -0
- package/dist/bundle-core/four-meme/utils-disperse.js +396 -0
- package/dist/bundle-core/four-meme/utils-pairwise.d.ts +8 -0
- package/dist/bundle-core/four-meme/utils-pairwise.js +328 -0
- package/dist/bundle-core/four-meme/utils-sweep.d.ts +8 -0
- package/dist/bundle-core/four-meme/utils-sweep.js +744 -0
- package/dist/bundle-core/index.d.ts +8 -0
- package/dist/bundle-core/index.js +8 -0
- package/dist/bundle-core/internal.d.ts +21 -0
- package/dist/bundle-core/internal.js +182 -0
- package/dist/bundle-core/sign-context-helpers.d.ts +25 -0
- package/dist/bundle-core/sign-context-helpers.js +67 -0
- package/dist/bundle-core/submit.d.ts +293 -0
- package/dist/bundle-core/submit.js +727 -0
- package/dist/bundle-core/types/index.d.ts +8 -0
- package/dist/bundle-core/types/index.js +1 -0
- package/dist/bundle-core/types.d.ts +1 -0
- package/dist/bundle-core/types.js +1 -0
- package/dist/chains/bsc/four/approve-tokenmanager.d.ts +1 -26
- package/dist/chains/bsc/four/approve-tokenmanager.js +1 -113
- package/dist/chains/bsc/four/config.d.ts +5 -67
- package/dist/chains/bsc/four/config.js +2 -114
- package/dist/chains/bsc/four/core.d.ts +1 -4
- package/dist/chains/bsc/four/core.js +1 -592
- package/dist/chains/bsc/four/index.d.ts +6 -6
- package/dist/chains/bsc/four/index.js +6 -6
- package/dist/chains/bsc/four/internal.d.ts +2 -46
- package/dist/chains/bsc/four/internal.js +2 -239
- package/dist/chains/bsc/four/pancake-proxy.d.ts +1 -28
- package/dist/chains/bsc/four/pancake-proxy.js +1 -687
- package/dist/chains/bsc/four/private.d.ts +1 -27
- package/dist/chains/bsc/four/private.js +1 -477
- package/dist/chains/bsc/four/submit.d.ts +2 -315
- package/dist/chains/bsc/four/submit.js +2 -752
- package/dist/chains/bsc/four/swap-buy-first.d.ts +2 -55
- package/dist/chains/bsc/four/swap-buy-first.js +2 -507
- package/dist/chains/bsc/four/swap-internal.d.ts +1 -3
- package/dist/chains/bsc/four/swap-internal.js +1 -18
- package/dist/chains/bsc/four/swap.d.ts +2 -144
- package/dist/chains/bsc/four/swap.js +2 -766
- package/dist/chains/bsc/four/types.d.ts +1 -476
- package/dist/chains/bsc/four/utils-disperse.d.ts +1 -0
- package/dist/chains/bsc/four/utils-disperse.js +1 -0
- package/dist/chains/bsc/four/utils-pairwise.d.ts +1 -0
- package/dist/chains/bsc/four/utils-pairwise.js +1 -0
- package/dist/chains/bsc/four/utils-sweep.d.ts +1 -0
- package/dist/chains/bsc/four/utils-sweep.js +1 -0
- package/dist/chains/bsc/four/utils.d.ts +5 -18
- package/dist/chains/bsc/four/utils.js +5 -1552
- package/dist/chains/bsc/iro.d.ts +5 -0
- package/dist/chains/bsc/iro.js +4 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +159 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +117 -0
- package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +1 -91
- package/dist/chains/bsc/pancake/bundle-buy-first.js +97 -212
- package/dist/chains/bsc/pancake/bundle-swap-helpers.d.ts +241 -0
- package/dist/chains/bsc/pancake/bundle-swap-helpers.js +565 -0
- package/dist/chains/bsc/pancake/bundle-swap.d.ts +1 -79
- package/dist/chains/bsc/pancake/bundle-swap.js +114 -726
- package/dist/chains/bsc/pancake/index.d.ts +4 -2
- package/dist/chains/bsc/pancake/index.js +1 -3
- package/dist/chains/bsc/platforms/iro/factory.d.ts +2 -2
- package/dist/chains/bsc/platforms/iro/factory.js +3 -1
- package/dist/chains/bsc/platforms/iro/index.d.ts +5 -5
- package/dist/chains/bsc/platforms/iro/index.js +3 -3
- package/dist/chains/bsc/platforms/iro/pool.js +31 -10
- package/dist/chains/bsc/platforms/iro/token.js +4 -1
- package/dist/chains/eni/batch-router/bundle-approve.js +4 -3
- package/dist/chains/eni/batch-router/transfer.js +55 -25
- package/dist/chains/eni/batch-router/utils.js +32 -6
- package/dist/chains/eni/bundler/sign.js +5 -6
- package/dist/chains/eni/bundler/submit.js +1 -4
- package/dist/chains/eni/constants.js +1 -1
- package/dist/chains/eni/flat-aliases.d.ts +10 -0
- package/dist/chains/eni/flat-aliases.js +8 -0
- package/dist/chains/eni/index.d.ts +2 -1
- package/dist/chains/eni/index.js +1 -0
- package/dist/chains/eni/platforms/daoaas/create.js +2 -2
- package/dist/chains/eni/platforms/daoaas/index.d.ts +3 -3
- package/dist/chains/eni/platforms/daoaas/index.js +3 -3
- package/dist/chains/eni/platforms/daoaas/meta.js +9 -6
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +28 -44
- package/dist/chains/eni/platforms/daoaas/portal.js +10 -6
- package/dist/chains/eni/platforms/dswap/liquidity.js +58 -26
- package/dist/chains/eni/platforms/fair-launch/index.d.ts +2 -2
- package/dist/chains/eni/platforms/fair-launch/index.js +1 -1
- package/dist/chains/eni/platforms/fair-launch/launcher.js +87 -46
- package/dist/chains/eni/platforms/fair-launch/pool.js +4 -1
- package/dist/chains/eni/platforms/fair-launch/presets.js +2 -2
- package/dist/chains/eni/platforms/iro/factory.d.ts +2 -2
- package/dist/chains/eni/platforms/iro/factory.js +3 -1
- package/dist/chains/eni/platforms/iro/index.d.ts +6 -6
- package/dist/chains/eni/platforms/iro/index.js +4 -4
- package/dist/chains/eni/platforms/iro/pool.js +90 -26
- package/dist/chains/eni/platforms/iro/token.js +107 -31
- package/dist/chains/eni/platforms/iro/whitelist.js +6 -18
- package/dist/chains/eni/submit.d.ts +43 -0
- package/dist/chains/eni/submit.js +286 -0
- package/dist/chains/index.d.ts +13 -0
- package/dist/chains/index.js +13 -0
- package/dist/chains/xlayer/eip7702/bundle-approve.d.ts +2 -26
- package/dist/chains/xlayer/eip7702/bundle-approve.js +11 -21
- package/dist/chains/xlayer/eip7702/bundle-buy.d.ts +2 -6
- package/dist/chains/xlayer/eip7702/bundle-buy.js +13 -51
- package/dist/chains/xlayer/eip7702/bundle-create.js +93 -59
- package/dist/chains/xlayer/eip7702/bundle-sell.d.ts +2 -6
- package/dist/chains/xlayer/eip7702/bundle-sell.js +29 -111
- package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +3 -65
- package/dist/chains/xlayer/eip7702/bundle-swap.js +51 -245
- package/dist/chains/xlayer/eip7702/constants.d.ts +1 -16
- package/dist/chains/xlayer/eip7702/constants.js +3 -21
- package/dist/chains/xlayer/eip7702/flat-aliases.d.ts +13 -0
- package/dist/chains/xlayer/eip7702/flat-aliases.js +10 -0
- package/dist/chains/xlayer/eip7702/index.d.ts +28 -46
- package/dist/chains/xlayer/eip7702/index.js +28 -81
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.d.ts +79 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.js +1 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.d.ts +2 -203
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.js +63 -307
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.d.ts +26 -0
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.js +57 -0
- package/dist/chains/xlayer/eip7702/types.d.ts +88 -0
- package/dist/chains/xlayer/eip7702/utils.d.ts +0 -3
- package/dist/chains/xlayer/eip7702/utils.js +23 -28
- package/dist/chains/xlayer/eip7702/volume-helpers.d.ts +148 -0
- package/dist/chains/xlayer/eip7702/volume-helpers.js +48 -0
- package/dist/chains/xlayer/eip7702/volume.d.ts +6 -184
- package/dist/chains/xlayer/eip7702/volume.js +89 -164
- package/dist/chains/xlayer/eoa/constants.js +1 -1
- package/dist/chains/xlayer/eoa/dex-helpers.js +5 -5
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts +126 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +228 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.d.ts +1 -95
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.js +66 -299
- package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +1 -1
- package/dist/chains/xlayer/eoa/eoa-wash-volume.js +18 -23
- package/dist/chains/xlayer/eoa/index.d.ts +10 -6
- package/dist/chains/xlayer/eoa/index.js +8 -23
- package/dist/chains/xlayer/eoa/portal-ops.js +7 -2
- package/dist/chains/xlayer/eoa/router-manager.js +3 -3
- package/dist/chains/xlayer/eoa/types.d.ts +2 -2
- package/dist/chains/xlayer/eoa/types.js +1 -3
- package/dist/chains/xlayer/index.d.ts +3 -2
- package/dist/chains/xlayer/index.js +4 -7
- package/dist/contracts/helper3.d.ts +20 -5
- package/dist/contracts/helper3.js +56 -20
- package/dist/contracts/tm-bundle-helpers.d.ts +88 -0
- package/dist/contracts/tm-bundle-helpers.js +72 -0
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.d.ts +1 -26
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.js +1 -113
- package/dist/contracts/tm-bundle-merkle/config.d.ts +5 -67
- package/dist/contracts/tm-bundle-merkle/config.js +2 -114
- package/dist/contracts/tm-bundle-merkle/core.d.ts +1 -4
- package/dist/contracts/tm-bundle-merkle/core.js +1 -591
- package/dist/contracts/tm-bundle-merkle/index.d.ts +5 -5
- package/dist/contracts/tm-bundle-merkle/index.js +5 -5
- package/dist/contracts/tm-bundle-merkle/internal.d.ts +2 -46
- package/dist/contracts/tm-bundle-merkle/internal.js +2 -238
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.d.ts +1 -28
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.js +1 -686
- package/dist/contracts/tm-bundle-merkle/private.d.ts +1 -27
- package/dist/contracts/tm-bundle-merkle/private.js +1 -476
- package/dist/contracts/tm-bundle-merkle/submit.d.ts +3 -314
- package/dist/contracts/tm-bundle-merkle/submit.js +3 -928
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.d.ts +2 -55
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.js +2 -506
- package/dist/contracts/tm-bundle-merkle/swap-internal.d.ts +1 -3
- package/dist/contracts/tm-bundle-merkle/swap-internal.js +1 -18
- package/dist/contracts/tm-bundle-merkle/swap.d.ts +2 -144
- package/dist/contracts/tm-bundle-merkle/swap.js +2 -764
- package/dist/contracts/tm-bundle-merkle/types.d.ts +1 -476
- package/dist/contracts/tm-bundle-merkle/utils-disperse.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-disperse.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-sweep.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-sweep.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils.d.ts +6 -18
- package/dist/contracts/tm-bundle-merkle/utils.js +6 -1501
- package/dist/contracts/tm-bundle.d.ts +3 -51
- package/dist/contracts/tm-bundle.js +108 -177
- package/dist/contracts/tm.d.ts +3 -2
- package/dist/contracts/tm.js +37 -32
- package/dist/contracts/tm1.js +9 -4
- package/dist/contracts/tm2.js +9 -4
- package/dist/dex/direct-router-helpers.d.ts +264 -0
- package/dist/dex/direct-router-helpers.js +539 -0
- package/dist/dex/direct-router.d.ts +3 -125
- package/dist/dex/direct-router.js +237 -666
- package/dist/dex/types.d.ts +81 -0
- package/dist/dex/types.js +1 -0
- package/dist/exports/root-bundle-and-tooling.d.ts +27 -0
- package/dist/exports/root-bundle-and-tooling.js +30 -0
- package/dist/exports/root-eni-and-bsc-iro.d.ts +26 -0
- package/dist/exports/root-eni-and-bsc-iro.js +66 -0
- package/dist/exports/root-foundations.d.ts +35 -0
- package/dist/exports/root-foundations.js +70 -0
- package/dist/exports/root-swap-dex-and-xlayer.d.ts +30 -0
- package/dist/exports/root-swap-dex-and-xlayer.js +78 -0
- package/dist/flap/index.d.ts +10 -0
- package/dist/flap/index.js +8 -0
- package/dist/flows/create.d.ts +2 -1
- package/dist/flows/create.js +6 -6
- package/dist/flows/index.d.ts +1 -0
- package/dist/flows/index.js +1 -0
- package/dist/index.d.ts +20 -85
- package/dist/index.js +20 -215
- package/dist/merkle/index.d.ts +12 -0
- package/dist/merkle/index.js +11 -0
- package/dist/shared/abis/common.d.ts +2 -83
- package/dist/shared/abis/common.js +2 -252
- package/dist/shared/abis/index.d.ts +5 -6
- package/dist/shared/abis/index.js +5 -7
- package/dist/shared/clients/blockrazor.js +39 -25
- package/dist/shared/clients/club48.d.ts +2 -2
- package/dist/shared/clients/club48.js +34 -29
- package/dist/shared/clients/emitservice.js +2 -0
- package/dist/shared/clients/four.d.ts +21 -6
- package/dist/shared/clients/four.js +29 -24
- package/dist/shared/clients/index.d.ts +8 -0
- package/dist/shared/clients/index.js +8 -0
- package/dist/shared/clients/merkle.js +27 -34
- package/dist/shared/constants/addresses.d.ts +1 -1
- package/dist/shared/constants/addresses.js +11 -2
- package/dist/shared/constants/chains.d.ts +1 -1
- package/dist/shared/constants/chains.js +1 -1
- package/dist/shared/constants/gas.d.ts +1 -1
- package/dist/shared/constants/gas.js +2 -6
- package/dist/shared/constants/index.d.ts +3 -0
- package/dist/shared/constants/index.js +1 -0
- package/dist/shared/constants/quote.d.ts +30 -0
- package/dist/shared/constants/quote.js +37 -0
- package/dist/shared/flap/abi.js +1 -1
- package/dist/shared/flap/constants.d.ts +1 -2
- package/dist/shared/flap/constants.js +2 -3
- package/dist/shared/flap/curve.js +3 -0
- package/dist/shared/flap/errors.d.ts +1 -4
- package/dist/shared/flap/errors.js +20 -1
- package/dist/shared/flap/index.d.ts +5 -4
- package/dist/shared/flap/index.js +5 -4
- package/dist/shared/flap/meta.d.ts +22 -18
- package/dist/shared/flap/meta.js +12 -17
- package/dist/shared/flap/permit.js +5 -2
- package/dist/shared/flap/pinata.d.ts +22 -6
- package/dist/shared/flap/pinata.js +21 -26
- package/dist/shared/flap/portal-bundle-merkle/config.d.ts +3 -72
- package/dist/shared/flap/portal-bundle-merkle/config.js +4 -124
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.d.ts +32 -0
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.js +83 -0
- package/dist/shared/flap/portal-bundle-merkle/core.d.ts +0 -4
- package/dist/shared/flap/portal-bundle-merkle/core.js +86 -278
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.d.ts +7 -2
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +101 -206
- package/dist/shared/flap/portal-bundle-merkle/curve-to-dex.js +100 -92
- package/dist/shared/flap/portal-bundle-merkle/index.d.ts +11 -7
- package/dist/shared/flap/portal-bundle-merkle/index.js +4 -7
- package/dist/shared/flap/portal-bundle-merkle/pancake-proxy.js +71 -68
- package/dist/shared/flap/portal-bundle-merkle/private.js +61 -114
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +125 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.js +113 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.d.ts +1 -64
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.js +66 -247
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.d.ts +149 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.js +259 -0
- package/dist/shared/flap/portal-bundle-merkle/swap.d.ts +2 -71
- package/dist/shared/flap/portal-bundle-merkle/swap.js +103 -410
- package/dist/shared/flap/portal-bundle-merkle/types.d.ts +83 -9
- package/dist/shared/flap/portal-bundle-merkle/utils.d.ts +1 -80
- package/dist/shared/flap/portal-bundle-merkle/utils.js +145 -265
- package/dist/shared/flap/portal-bundle.js +55 -56
- package/dist/shared/flap/portal-create-token.d.ts +77 -0
- package/dist/shared/flap/portal-create-token.js +214 -0
- package/dist/shared/flap/portal.d.ts +14 -3
- package/dist/shared/flap/portal.js +50 -25
- package/dist/shared/flap/vanity.d.ts +1 -5
- package/dist/shared/flap/vanity.js +6 -17
- package/dist/shared/flap/vault.d.ts +17 -124
- package/dist/shared/flap/vault.js +67 -148
- package/dist/shared/foundation/dex/v3-path.d.ts +6 -0
- package/dist/shared/foundation/dex/v3-path.js +35 -0
- package/dist/shared/foundation/gas/bundle-gas.d.ts +49 -0
- package/dist/shared/foundation/gas/bundle-gas.js +93 -0
- package/dist/shared/foundation/gas/profit-hop.d.ts +20 -0
- package/dist/shared/foundation/gas/profit-hop.js +72 -0
- package/dist/shared/foundation/index.d.ts +13 -0
- package/dist/shared/foundation/index.js +12 -0
- package/dist/shared/foundation/nonce/nonce-manager.d.ts +17 -0
- package/dist/shared/foundation/nonce/nonce-manager.js +183 -0
- package/dist/shared/foundation/normalize-unknown.d.ts +9 -0
- package/dist/shared/foundation/normalize-unknown.js +29 -0
- package/dist/shared/foundation/sdk-logger.d.ts +13 -0
- package/dist/shared/foundation/sdk-logger.js +12 -0
- package/dist/shared/foundation/tx/build-request.d.ts +17 -0
- package/dist/shared/foundation/tx/build-request.js +25 -0
- package/dist/shared/foundation/tx/sign-batch.d.ts +5 -0
- package/dist/shared/foundation/tx/sign-batch.js +26 -0
- package/dist/shared/foundation/tx/wallet-sign-patch.d.ts +1 -0
- package/dist/shared/foundation/tx/wallet-sign-patch.js +18 -0
- package/dist/shared/foundation/types/airdrop-sweep.d.ts +79 -0
- package/dist/shared/foundation/types/airdrop-sweep.js +1 -0
- package/dist/shared/foundation/types/erc20.d.ts +65 -0
- package/dist/shared/foundation/types/erc20.js +1 -0
- package/dist/shared/foundation/types/holders-maker.d.ts +64 -0
- package/dist/shared/foundation/types/holders-maker.js +1 -0
- package/dist/shared/foundation/types/index.d.ts +7 -0
- package/dist/shared/foundation/types/index.js +1 -0
- package/dist/shared/foundation/types/lp-inspect.d.ts +102 -0
- package/dist/shared/foundation/types/lp-inspect.js +1 -0
- package/dist/shared/foundation/types/multicall.d.ts +5 -0
- package/dist/shared/foundation/types/multicall.js +1 -0
- package/dist/shared/foundation/types/private-sale.d.ts +35 -0
- package/dist/shared/foundation/types/private-sale.js +1 -0
- package/dist/shared/foundation/types/quote-helpers.d.ts +17 -0
- package/dist/shared/foundation/types/quote-helpers.js +1 -0
- package/dist/shared/four/tax-token.d.ts +1 -1
- package/dist/shared/four/tax-token.js +27 -7
- package/dist/shared/index.d.ts +6 -0
- package/dist/shared/index.js +4 -0
- package/dist/types/errors.d.ts +27 -0
- package/dist/types/errors.js +34 -0
- package/dist/utils/airdrop-sweep.d.ts +4 -76
- package/dist/utils/airdrop-sweep.js +42 -55
- package/dist/utils/bundle-helpers.d.ts +9 -243
- package/dist/utils/bundle-helpers.js +10 -584
- package/dist/utils/constants.d.ts +5 -61
- package/dist/utils/constants.js +5 -80
- package/dist/utils/contract-factory.d.ts +2 -4
- package/dist/utils/contract-factory.js +25 -18
- package/dist/utils/erc20.d.ts +7 -89
- package/dist/utils/erc20.js +94 -125
- package/dist/utils/errors.d.ts +12 -1
- package/dist/utils/errors.js +60 -1
- package/dist/utils/holders-maker/addresses.d.ts +12 -0
- package/dist/utils/holders-maker/addresses.js +15 -0
- package/dist/utils/holders-maker/buy-tx.d.ts +44 -0
- package/dist/utils/holders-maker/buy-tx.js +278 -0
- package/dist/utils/holders-maker/constants.d.ts +6 -0
- package/dist/utils/holders-maker/constants.js +7 -0
- package/dist/utils/holders-maker/disperse.d.ts +18 -0
- package/dist/utils/holders-maker/disperse.js +90 -0
- package/dist/utils/holders-maker/routing.d.ts +4 -0
- package/dist/utils/holders-maker/routing.js +45 -0
- package/dist/utils/holders-maker/transfer-tx.d.ts +4 -0
- package/dist/utils/holders-maker/transfer-tx.js +67 -0
- package/dist/utils/holders-maker-helpers.d.ts +9 -0
- package/dist/utils/holders-maker-helpers.js +9 -0
- package/dist/utils/holders-maker.d.ts +2 -138
- package/dist/utils/holders-maker.js +26 -661
- package/dist/utils/hop-chains.d.ts +35 -0
- package/dist/utils/hop-chains.js +215 -0
- package/dist/utils/lp-inspect-helpers.d.ts +9 -0
- package/dist/utils/lp-inspect-helpers.js +109 -0
- package/dist/utils/lp-inspect.d.ts +2 -112
- package/dist/utils/lp-inspect.js +73 -223
- package/dist/utils/mpcExclusive.d.ts +2 -5
- package/dist/utils/mpcExclusive.js +4 -3
- package/dist/utils/private-sale.d.ts +2 -58
- package/dist/utils/private-sale.js +4 -15
- package/dist/utils/provider-factory.d.ts +4 -0
- package/dist/utils/provider-factory.js +10 -0
- package/dist/utils/quote-helpers.d.ts +4 -45
- package/dist/utils/quote-helpers.js +17 -74
- package/dist/utils/stealth-transfer.d.ts +2 -28
- package/dist/utils/stealth-transfer.js +31 -15
- package/dist/utils/swap-helpers.d.ts +2 -15
- package/dist/utils/swap-helpers.js +6 -11
- package/dist/utils/types/airdrop-sweep.d.ts +1 -0
- package/dist/utils/types/airdrop-sweep.js +1 -0
- package/dist/utils/types/contract-factory.d.ts +1 -0
- package/dist/utils/types/contract-factory.js +1 -0
- package/dist/utils/types/erc20.d.ts +1 -0
- package/dist/utils/types/erc20.js +1 -0
- package/dist/utils/types/errors.d.ts +1 -0
- package/dist/utils/types/errors.js +1 -0
- package/dist/utils/types/holders-maker.d.ts +1 -0
- package/dist/utils/types/holders-maker.js +1 -0
- package/dist/utils/types/hop-chains.d.ts +8 -0
- package/dist/utils/types/hop-chains.js +1 -0
- package/dist/utils/types/index.d.ts +13 -0
- package/dist/utils/types/index.js +1 -0
- package/dist/utils/types/lp-inspect.d.ts +1 -0
- package/dist/utils/types/lp-inspect.js +1 -0
- package/dist/utils/types/mpc-exclusive.d.ts +5 -0
- package/dist/utils/types/mpc-exclusive.js +1 -0
- package/dist/utils/types/private-sale.d.ts +1 -0
- package/dist/utils/types/private-sale.js +1 -0
- package/dist/utils/types/quote-helpers.d.ts +1 -0
- package/dist/utils/types/quote-helpers.js +1 -0
- package/dist/utils/types/stealth-transfer.d.ts +44 -0
- package/dist/utils/types/stealth-transfer.js +1 -0
- package/dist/utils/types/wallet.d.ts +25 -0
- package/dist/utils/types/wallet.js +1 -0
- package/dist/utils/wallet.d.ts +2 -25
- package/dist/utils/wallet.js +13 -10
- package/dist/vanity/index.d.ts +5 -0
- package/dist/vanity/index.js +5 -0
- package/package.json +160 -4
- package/src/abis/contracts/TaxToken.json +969 -0
- package/src/abis/contracts/TokenManager.json +836 -0
- package/src/abis/contracts/TokenManager2.json +136 -0
- package/src/abis/contracts/TokenManagerHelper3.json +993 -0
- package/dist/shared/abis/TaxToken.json +0 -105
- package/dist/shared/abis/TokenManager2.json +0 -60
- /package/dist/{shared/abis → abis/contracts}/TokenManager.json +0 -0
- /package/dist/{shared/abis → abis/contracts}/TokenManagerHelper3.json +0 -0
|
@@ -4,19 +4,16 @@
|
|
|
4
4
|
* ⚠️ 重要:基于 flap.sh/launch 实际源码分析,金库模式架构如下:
|
|
5
5
|
*
|
|
6
6
|
* 1. 金库代币通过 VaultPortal 合约创建(不是普通 Portal)
|
|
7
|
-
* 2. 调用函数:VaultPortal.
|
|
7
|
+
* 2. 调用函数:VaultPortal.newTaxTokenWithVault(params)
|
|
8
8
|
* 3. 参数中 extensionID/extensionData 始终为零值
|
|
9
9
|
* 4. 真正的金库配置通过 vaultFactory(工厂地址)和 vaultData(ABI 编码数据)传递
|
|
10
10
|
* 5. 每种金库类型对应一个具体的 VaultFactory 合约地址
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* VaultPortal.newTokenV6WithVault 参数结构:
|
|
15
|
-
* - 基础参数(与 Portal.newTokenV6 相同,无 beneficiary):name, symbol, meta, dexThresh, salt,
|
|
12
|
+
* VaultPortal.newTaxTokenWithVault 参数结构:
|
|
13
|
+
* - 基础参数(与 Portal.newTokenV5 相同):name, symbol, meta, dexThresh, salt, taxRate,
|
|
16
14
|
* migratorType, quoteToken, quoteAmt, permitData, extensionID(全零), extensionData("0x"),
|
|
17
|
-
* dexId, lpFeeProfile,
|
|
18
|
-
*
|
|
19
|
-
* commissionReceiver, tokenVersion(=TOKEN_TAXED_V3)
|
|
15
|
+
* dexId, lpFeeProfile, taxDuration, antiFarmerDuration, mktBps, deflationBps, dividendBps,
|
|
16
|
+
* lpBps, minimumShareBalance
|
|
20
17
|
* - 金库专属参数:vaultFactory(address), vaultData(bytes)
|
|
21
18
|
*
|
|
22
19
|
* 金库分类(来自 flap.sh 源码):
|
|
@@ -31,8 +28,32 @@
|
|
|
31
28
|
* @module vault
|
|
32
29
|
*/
|
|
33
30
|
import { Contract, AbiCoder, ZeroAddress } from 'ethers';
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
function mapFieldDescriptor(f) {
|
|
32
|
+
return {
|
|
33
|
+
name: f.name,
|
|
34
|
+
fieldType: f.fieldType,
|
|
35
|
+
description: f.description,
|
|
36
|
+
decimals: Number(f.decimals),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function mapApproveAction(a) {
|
|
40
|
+
return {
|
|
41
|
+
tokenType: a.tokenType,
|
|
42
|
+
amountFieldName: a.amountFieldName,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function mapVaultMethodSchema(m) {
|
|
46
|
+
return {
|
|
47
|
+
name: m.name,
|
|
48
|
+
description: m.description,
|
|
49
|
+
inputs: m.inputs.map(mapFieldDescriptor),
|
|
50
|
+
outputs: m.outputs.map(mapFieldDescriptor),
|
|
51
|
+
approvals: m.approvals.map(mapApproveAction),
|
|
52
|
+
isInputArray: m.isInputArray,
|
|
53
|
+
isOutputArray: m.isOutputArray,
|
|
54
|
+
isWriteMethod: m.isWriteMethod,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
36
57
|
/**
|
|
37
58
|
* 金库类型显示标签
|
|
38
59
|
*/
|
|
@@ -110,28 +131,28 @@ export const FLAP_GUARDIAN_ADDRESSES = {
|
|
|
110
131
|
// ============================================================================
|
|
111
132
|
// ABI 定义
|
|
112
133
|
// ============================================================================
|
|
113
|
-
/** VaultPortal 金库发射必须使用 TOKEN_TAXED_V3(enum = 6) */
|
|
114
|
-
export const TOKEN_TAXED_V3_VERSION = TokenVersion.TOKEN_TAXED_V3;
|
|
115
134
|
/**
|
|
116
|
-
* VaultPortal ABI —
|
|
135
|
+
* VaultPortal ABI — newTaxTokenWithVault
|
|
117
136
|
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
137
|
+
* ⚠️ 从 flap.sh 前端 JS 源码提取的真实 ABI
|
|
138
|
+
* 来源:flap.sh/_next/static/chunks/6288-*.js(VaultPortal 合约 ABI)
|
|
120
139
|
*/
|
|
121
140
|
export const VAULT_PORTAL_ABI = [
|
|
122
141
|
{
|
|
123
142
|
type: 'function',
|
|
124
|
-
name: '
|
|
125
|
-
inputs: [
|
|
143
|
+
name: 'newTaxTokenWithVault',
|
|
144
|
+
inputs: [
|
|
145
|
+
{
|
|
126
146
|
name: 'params',
|
|
127
147
|
type: 'tuple',
|
|
128
|
-
internalType: 'struct IVaultPortalTypes.
|
|
148
|
+
internalType: 'struct IVaultPortalTypes.NewTaxTokenWithVaultParams',
|
|
129
149
|
components: [
|
|
130
150
|
{ name: 'name', type: 'string', internalType: 'string' },
|
|
131
151
|
{ name: 'symbol', type: 'string', internalType: 'string' },
|
|
132
152
|
{ name: 'meta', type: 'string', internalType: 'string' },
|
|
133
|
-
{ name: 'dexThresh', type: 'uint8', internalType: 'enum
|
|
153
|
+
{ name: 'dexThresh', type: 'uint8', internalType: 'enum IPortalCommonTypes.DexThreshType' },
|
|
134
154
|
{ name: 'salt', type: 'bytes32', internalType: 'bytes32' },
|
|
155
|
+
{ name: 'taxRate', type: 'uint16', internalType: 'uint16' },
|
|
135
156
|
{ name: 'migratorType', type: 'uint8', internalType: 'enum IPortalTypes.MigratorType' },
|
|
136
157
|
{ name: 'quoteToken', type: 'address', internalType: 'address' },
|
|
137
158
|
{ name: 'quoteAmt', type: 'uint256', internalType: 'uint256' },
|
|
@@ -140,8 +161,6 @@ export const VAULT_PORTAL_ABI = [
|
|
|
140
161
|
{ name: 'extensionData', type: 'bytes', internalType: 'bytes' },
|
|
141
162
|
{ name: 'dexId', type: 'uint8', internalType: 'enum IPortalTypes.DEXId' },
|
|
142
163
|
{ name: 'lpFeeProfile', type: 'uint8', internalType: 'enum IPortalTypes.V3LPFeeProfile' },
|
|
143
|
-
{ name: 'buyTaxRate', type: 'uint16', internalType: 'uint16' },
|
|
144
|
-
{ name: 'sellTaxRate', type: 'uint16', internalType: 'uint16' },
|
|
145
164
|
{ name: 'taxDuration', type: 'uint64', internalType: 'uint64' },
|
|
146
165
|
{ name: 'antiFarmerDuration', type: 'uint64', internalType: 'uint64' },
|
|
147
166
|
{ name: 'mktBps', type: 'uint16', internalType: 'uint16' },
|
|
@@ -149,13 +168,11 @@ export const VAULT_PORTAL_ABI = [
|
|
|
149
168
|
{ name: 'dividendBps', type: 'uint16', internalType: 'uint16' },
|
|
150
169
|
{ name: 'lpBps', type: 'uint16', internalType: 'uint16' },
|
|
151
170
|
{ name: 'minimumShareBalance', type: 'uint256', internalType: 'uint256' },
|
|
152
|
-
{ name: 'dividendToken', type: 'address', internalType: 'address' },
|
|
153
|
-
{ name: 'commissionReceiver', type: 'address', internalType: 'address' },
|
|
154
|
-
{ name: 'tokenVersion', type: 'uint8', internalType: 'enum IPortalTypes.TokenVersion' },
|
|
155
171
|
{ name: 'vaultFactory', type: 'address', internalType: 'address' },
|
|
156
172
|
{ name: 'vaultData', type: 'bytes', internalType: 'bytes' },
|
|
157
|
-
]
|
|
158
|
-
}
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
],
|
|
159
176
|
outputs: [{ name: 'token', type: 'address', internalType: 'address' }],
|
|
160
177
|
stateMutability: 'payable',
|
|
161
178
|
},
|
|
@@ -163,7 +180,8 @@ export const VAULT_PORTAL_ABI = [
|
|
|
163
180
|
type: 'function',
|
|
164
181
|
name: 'getVault',
|
|
165
182
|
inputs: [{ name: 'taxToken', type: 'address', internalType: 'address' }],
|
|
166
|
-
outputs: [
|
|
183
|
+
outputs: [
|
|
184
|
+
{
|
|
167
185
|
name: 'info',
|
|
168
186
|
type: 'tuple',
|
|
169
187
|
internalType: 'struct IVaultPortalTypes.VaultInfo',
|
|
@@ -173,8 +191,9 @@ export const VAULT_PORTAL_ABI = [
|
|
|
173
191
|
{ name: 'description', type: 'string', internalType: 'string' },
|
|
174
192
|
{ name: 'isOfficial', type: 'bool', internalType: 'bool' },
|
|
175
193
|
{ name: 'riskLevel', type: 'uint8', internalType: 'enum IVaultPortalTypes.RiskLevel' },
|
|
176
|
-
]
|
|
177
|
-
}
|
|
194
|
+
],
|
|
195
|
+
},
|
|
196
|
+
],
|
|
178
197
|
stateMutability: 'view',
|
|
179
198
|
},
|
|
180
199
|
{
|
|
@@ -201,9 +220,7 @@ export const VAULT_FACTORY_V2_ABI = [
|
|
|
201
220
|
/**
|
|
202
221
|
* VaultBase ABI(V1)
|
|
203
222
|
*/
|
|
204
|
-
export const VAULT_BASE_ABI = [
|
|
205
|
-
'function description() public view returns (string)',
|
|
206
|
-
];
|
|
223
|
+
export const VAULT_BASE_ABI = ['function description() public view returns (string)'];
|
|
207
224
|
/**
|
|
208
225
|
* VaultBaseV2 ABI
|
|
209
226
|
*/
|
|
@@ -252,16 +269,21 @@ function mapFieldTypeToAbiType(fieldType) {
|
|
|
252
269
|
function processFieldValue(field, rawValue) {
|
|
253
270
|
if (rawValue === undefined || rawValue === null) {
|
|
254
271
|
switch (field.fieldType) {
|
|
255
|
-
case 'address':
|
|
256
|
-
|
|
257
|
-
case '
|
|
272
|
+
case 'address':
|
|
273
|
+
return ZeroAddress;
|
|
274
|
+
case 'bool':
|
|
275
|
+
return false;
|
|
276
|
+
case 'string':
|
|
277
|
+
return '';
|
|
258
278
|
case 'bytes':
|
|
259
|
-
case 'bytes32':
|
|
260
|
-
|
|
279
|
+
case 'bytes32':
|
|
280
|
+
return '0x' + '00'.repeat(32);
|
|
281
|
+
default:
|
|
282
|
+
return 0;
|
|
261
283
|
}
|
|
262
284
|
}
|
|
263
285
|
if (field.decimals > 0 && typeof rawValue === 'number') {
|
|
264
|
-
return BigInt(Math.round(rawValue *
|
|
286
|
+
return BigInt(Math.round(rawValue * 10 ** field.decimals));
|
|
265
287
|
}
|
|
266
288
|
if (field.fieldType === 'bool') {
|
|
267
289
|
return Boolean(rawValue);
|
|
@@ -286,7 +308,7 @@ export function getVaultPortalAddress(chain) {
|
|
|
286
308
|
return VAULT_PORTAL_ADDRESSES[chainKey] || null;
|
|
287
309
|
}
|
|
288
310
|
/**
|
|
289
|
-
* 构建金库参数(用于 VaultPortal.
|
|
311
|
+
* 构建金库参数(用于 VaultPortal.newTaxTokenWithVault)
|
|
290
312
|
*
|
|
291
313
|
* ⚠️ 重要:返回的是 vaultFactory 和 vaultData,不是 extensionID/extensionData
|
|
292
314
|
* extensionID/extensionData 在金库模式下始终为零值
|
|
@@ -332,82 +354,6 @@ export function buildVaultParams(config, chain) {
|
|
|
332
354
|
}
|
|
333
355
|
return { vaultFactory, vaultData };
|
|
334
356
|
}
|
|
335
|
-
function normalizeTaxV2Fields(taxV2) {
|
|
336
|
-
if ('distribution' in taxV2) {
|
|
337
|
-
return {
|
|
338
|
-
taxDuration: taxV2.taxDuration,
|
|
339
|
-
antiFarmerDuration: taxV2.antiFarmerDuration,
|
|
340
|
-
mktBps: taxV2.distribution.mktBps,
|
|
341
|
-
deflationBps: taxV2.distribution.deflationBps,
|
|
342
|
-
dividendBps: taxV2.distribution.dividendBps,
|
|
343
|
-
lpBps: taxV2.distribution.lpBps,
|
|
344
|
-
minimumShareBalance: taxV2.distribution.minimumShareBalance,
|
|
345
|
-
vaultConfig: taxV2.vaultConfig,
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
return taxV2;
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* 构建 VaultPortal.newTokenV6WithVault 参数
|
|
352
|
-
*
|
|
353
|
-
* ⚠️ tokenVersion 固定为 TOKEN_TAXED_V3;buyTaxRate/sellTaxRate 必须 > 0
|
|
354
|
-
*/
|
|
355
|
-
export function buildNewTokenV6WithVaultParams(input) {
|
|
356
|
-
const tv2 = normalizeTaxV2Fields(input.taxV2);
|
|
357
|
-
const total = tv2.mktBps + tv2.deflationBps + tv2.dividendBps + tv2.lpBps;
|
|
358
|
-
if (total !== 10000) {
|
|
359
|
-
throw new Error(`Tax distribution must sum to 10000 (100%), got ${total}`);
|
|
360
|
-
}
|
|
361
|
-
if (tv2.mktBps <= 0) {
|
|
362
|
-
throw new Error('Vault launch requires mktBps > 0');
|
|
363
|
-
}
|
|
364
|
-
const buyTaxRate = (input.buyTaxRate ?? input.taxRate) & 0xffff;
|
|
365
|
-
const sellTaxRate = (input.sellTaxRate ?? input.taxRate) & 0xffff;
|
|
366
|
-
if (buyTaxRate <= 0 || sellTaxRate <= 0) {
|
|
367
|
-
throw new Error('Vault launch requires buyTaxRate and sellTaxRate > 0');
|
|
368
|
-
}
|
|
369
|
-
const { vaultFactory, vaultData } = buildVaultParams(tv2.vaultConfig, input.chain);
|
|
370
|
-
return {
|
|
371
|
-
name: input.tokenInfo.name,
|
|
372
|
-
symbol: input.tokenInfo.symbol,
|
|
373
|
-
meta: input.tokenInfo.meta,
|
|
374
|
-
dexThresh: (input.dexThresh ?? 1) & 0xff,
|
|
375
|
-
salt: input.salt ?? ('0x' + '00'.repeat(32)),
|
|
376
|
-
migratorType: (input.migratorType ?? 0) & 0xff,
|
|
377
|
-
quoteToken: input.quoteToken || ZeroAddress,
|
|
378
|
-
quoteAmt: input.quoteAmt ?? 0n,
|
|
379
|
-
permitData: '0x',
|
|
380
|
-
extensionID: NONE_EXTENSION_ID,
|
|
381
|
-
extensionData: '0x',
|
|
382
|
-
dexId: (input.dexId ?? 0) & 0xff,
|
|
383
|
-
lpFeeProfile: (input.lpFeeProfile ?? 0) & 0xff,
|
|
384
|
-
buyTaxRate,
|
|
385
|
-
sellTaxRate,
|
|
386
|
-
taxDuration: BigInt(tv2.taxDuration),
|
|
387
|
-
antiFarmerDuration: BigInt(tv2.antiFarmerDuration),
|
|
388
|
-
mktBps: tv2.mktBps & 0xffff,
|
|
389
|
-
deflationBps: tv2.deflationBps & 0xffff,
|
|
390
|
-
dividendBps: tv2.dividendBps & 0xffff,
|
|
391
|
-
lpBps: tv2.lpBps & 0xffff,
|
|
392
|
-
minimumShareBalance: BigInt(tv2.minimumShareBalance ?? 10000) * (10n ** 18n),
|
|
393
|
-
dividendToken: ZeroAddress,
|
|
394
|
-
commissionReceiver: ZeroAddress,
|
|
395
|
-
tokenVersion: TOKEN_TAXED_V3_VERSION,
|
|
396
|
-
vaultFactory,
|
|
397
|
-
vaultData,
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* 金库发射 Vanity 地址搜索参数
|
|
402
|
-
* TOKEN_TAXED_V3 使用 tokenImplTaxedV3 + 后缀 7777
|
|
403
|
-
*/
|
|
404
|
-
export function getVaultLaunchVanityOptions(chain) {
|
|
405
|
-
return {
|
|
406
|
-
taxed: true,
|
|
407
|
-
taxedV3: true,
|
|
408
|
-
suffix: getVanitySuffix(chain, true),
|
|
409
|
-
};
|
|
410
|
-
}
|
|
411
357
|
/**
|
|
412
358
|
* 旧版兼容:将 TaxVaultConfig 转换为 extensionID 和 extensionData
|
|
413
359
|
*
|
|
@@ -415,7 +361,7 @@ export function getVaultLaunchVanityOptions(chain) {
|
|
|
415
361
|
* 金库参数通过 VaultPortal 的 vaultFactory/vaultData 传递
|
|
416
362
|
* 此函数仅用于向后兼容
|
|
417
363
|
*/
|
|
418
|
-
export function buildVaultExtensionParams(
|
|
364
|
+
export function buildVaultExtensionParams() {
|
|
419
365
|
// 金库模式下 extensionID/extensionData 始终为零值
|
|
420
366
|
return {
|
|
421
367
|
extensionID: NONE_EXTENSION_ID,
|
|
@@ -431,15 +377,10 @@ export function buildVaultExtensionParams(config) {
|
|
|
431
377
|
export async function queryVaultDataSchema(provider, factoryAddress) {
|
|
432
378
|
try {
|
|
433
379
|
const factory = new Contract(factoryAddress, VAULT_FACTORY_V2_ABI, provider);
|
|
434
|
-
const raw = await factory.vaultDataSchema();
|
|
380
|
+
const raw = (await factory.vaultDataSchema());
|
|
435
381
|
return {
|
|
436
382
|
description: raw.description,
|
|
437
|
-
fields: raw.fields.map(
|
|
438
|
-
name: f.name,
|
|
439
|
-
fieldType: f.fieldType,
|
|
440
|
-
description: f.description,
|
|
441
|
-
decimals: Number(f.decimals),
|
|
442
|
-
})),
|
|
383
|
+
fields: raw.fields.map(mapFieldDescriptor),
|
|
443
384
|
isArray: raw.isArray,
|
|
444
385
|
};
|
|
445
386
|
}
|
|
@@ -453,33 +394,11 @@ export async function queryVaultDataSchema(provider, factoryAddress) {
|
|
|
453
394
|
export async function queryVaultUISchema(provider, vaultAddress) {
|
|
454
395
|
try {
|
|
455
396
|
const vault = new Contract(vaultAddress, VAULT_BASE_V2_ABI, provider);
|
|
456
|
-
const raw = await vault.vaultUISchema();
|
|
397
|
+
const raw = (await vault.vaultUISchema());
|
|
457
398
|
return {
|
|
458
399
|
vaultType: raw.vaultType,
|
|
459
400
|
description: raw.description,
|
|
460
|
-
methods: raw.methods.map(
|
|
461
|
-
name: m.name,
|
|
462
|
-
description: m.description,
|
|
463
|
-
inputs: m.inputs.map((f) => ({
|
|
464
|
-
name: f.name,
|
|
465
|
-
fieldType: f.fieldType,
|
|
466
|
-
description: f.description,
|
|
467
|
-
decimals: Number(f.decimals),
|
|
468
|
-
})),
|
|
469
|
-
outputs: m.outputs.map((f) => ({
|
|
470
|
-
name: f.name,
|
|
471
|
-
fieldType: f.fieldType,
|
|
472
|
-
description: f.description,
|
|
473
|
-
decimals: Number(f.decimals),
|
|
474
|
-
})),
|
|
475
|
-
approvals: m.approvals.map((a) => ({
|
|
476
|
-
tokenType: a.tokenType,
|
|
477
|
-
amountFieldName: a.amountFieldName,
|
|
478
|
-
})),
|
|
479
|
-
isInputArray: m.isInputArray,
|
|
480
|
-
isOutputArray: m.isOutputArray,
|
|
481
|
-
isWriteMethod: m.isWriteMethod,
|
|
482
|
-
})),
|
|
401
|
+
methods: raw.methods.map(mapVaultMethodSchema),
|
|
483
402
|
};
|
|
484
403
|
}
|
|
485
404
|
catch {
|
|
@@ -524,7 +443,7 @@ export async function validateVaultFactory(provider, factoryAddress) {
|
|
|
524
443
|
export async function getVaultInfo(provider, vaultPortalAddress, taxTokenAddress) {
|
|
525
444
|
try {
|
|
526
445
|
const portal = new Contract(vaultPortalAddress, VAULT_PORTAL_ABI, provider);
|
|
527
|
-
const info = await portal.getVault(taxTokenAddress);
|
|
446
|
+
const info = (await portal.getVault(taxTokenAddress));
|
|
528
447
|
return {
|
|
529
448
|
vault: info.vault,
|
|
530
449
|
vaultFactory: info.vaultFactory,
|
|
@@ -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,49 @@
|
|
|
1
|
+
import { JsonRpcProvider, type TransactionRequest } from 'ethers';
|
|
2
|
+
export interface GasPriceConfig {
|
|
3
|
+
baseGasPrice?: bigint;
|
|
4
|
+
multiplierPercent?: number;
|
|
5
|
+
minGasPrice?: bigint;
|
|
6
|
+
maxGasPrice?: bigint;
|
|
7
|
+
}
|
|
8
|
+
export declare function getOptimizedGasPrice(provider: JsonRpcProvider, config?: GasPriceConfig): Promise<bigint>;
|
|
9
|
+
export interface GasEstimateConfig {
|
|
10
|
+
multiplier?: number;
|
|
11
|
+
fallbackGasLimit?: bigint;
|
|
12
|
+
allowFailure?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function estimateGasWithSafety(provider: JsonRpcProvider, txRequest: TransactionRequest, config?: GasEstimateConfig): Promise<bigint>;
|
|
15
|
+
export declare function estimateGasBatch(provider: JsonRpcProvider, txRequests: TransactionRequest[], config?: GasEstimateConfig): Promise<bigint[]>;
|
|
16
|
+
export interface BuildTransactionOptions {
|
|
17
|
+
from: string;
|
|
18
|
+
to?: string;
|
|
19
|
+
data?: string;
|
|
20
|
+
value?: bigint;
|
|
21
|
+
nonce: number;
|
|
22
|
+
gasPrice: bigint;
|
|
23
|
+
gasLimit: bigint;
|
|
24
|
+
chainId: number;
|
|
25
|
+
type?: 0 | 2;
|
|
26
|
+
}
|
|
27
|
+
export declare function buildTransaction(options: BuildTransactionOptions): TransactionRequest;
|
|
28
|
+
export interface CommonBundleConfig {
|
|
29
|
+
gasLimit?: number;
|
|
30
|
+
gasLimitMultiplier?: number;
|
|
31
|
+
minGasPriceGwei?: number;
|
|
32
|
+
maxGasPriceGwei?: number;
|
|
33
|
+
txType?: 0 | 2;
|
|
34
|
+
chainId?: number;
|
|
35
|
+
}
|
|
36
|
+
export declare function getGasLimit(config: CommonBundleConfig, defaultGas?: number): bigint;
|
|
37
|
+
export declare function getGasPriceConfig(config: CommonBundleConfig): GasPriceConfig;
|
|
38
|
+
export declare function getTxType(config: CommonBundleConfig): 0 | 2;
|
|
39
|
+
export type LegacyGasFields = {
|
|
40
|
+
type: 0;
|
|
41
|
+
gasPrice: bigint;
|
|
42
|
+
};
|
|
43
|
+
export type Eip1559GasFields = {
|
|
44
|
+
type: 2;
|
|
45
|
+
maxFeePerGas: bigint;
|
|
46
|
+
maxPriorityFeePerGas: bigint;
|
|
47
|
+
};
|
|
48
|
+
export type TxGasFields = LegacyGasFields | Eip1559GasFields;
|
|
49
|
+
export declare function buildGasFields(txType: number, gasPrice: bigint): TxGasFields;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
export async function getOptimizedGasPrice(provider, config) {
|
|
3
|
+
const feeData = await provider.getFeeData();
|
|
4
|
+
const chainGasPrice = feeData.gasPrice || ethers.parseUnits('3', 'gwei');
|
|
5
|
+
let gasPrice;
|
|
6
|
+
if (config?.baseGasPrice) {
|
|
7
|
+
gasPrice = config.baseGasPrice;
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
gasPrice = chainGasPrice;
|
|
11
|
+
}
|
|
12
|
+
const multiplier = config?.multiplierPercent ?? 50;
|
|
13
|
+
gasPrice = (gasPrice * BigInt(100 + multiplier)) / 100n;
|
|
14
|
+
if (gasPrice < chainGasPrice) {
|
|
15
|
+
gasPrice = chainGasPrice;
|
|
16
|
+
}
|
|
17
|
+
if (config?.minGasPrice && gasPrice < config.minGasPrice) {
|
|
18
|
+
gasPrice = config.minGasPrice;
|
|
19
|
+
}
|
|
20
|
+
if (config?.maxGasPrice && gasPrice > config.maxGasPrice) {
|
|
21
|
+
gasPrice = config.maxGasPrice;
|
|
22
|
+
}
|
|
23
|
+
return gasPrice;
|
|
24
|
+
}
|
|
25
|
+
export async function estimateGasWithSafety(provider, txRequest, config) {
|
|
26
|
+
const multiplier = config?.multiplier ?? 1.2;
|
|
27
|
+
const fallback = config?.fallbackGasLimit ?? 600000n;
|
|
28
|
+
const allowFailure = config?.allowFailure ?? true;
|
|
29
|
+
try {
|
|
30
|
+
const estimated = await provider.estimateGas(txRequest);
|
|
31
|
+
return BigInt(Math.ceil(Number(estimated) * multiplier));
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
if (!allowFailure) {
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
return fallback;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export async function estimateGasBatch(provider, txRequests, config) {
|
|
41
|
+
return Promise.all(txRequests.map((req) => estimateGasWithSafety(provider, req, config)));
|
|
42
|
+
}
|
|
43
|
+
export function buildTransaction(options) {
|
|
44
|
+
const tx = {
|
|
45
|
+
from: options.from,
|
|
46
|
+
nonce: options.nonce,
|
|
47
|
+
gasLimit: options.gasLimit,
|
|
48
|
+
chainId: options.chainId,
|
|
49
|
+
};
|
|
50
|
+
if (options.to)
|
|
51
|
+
tx.to = options.to;
|
|
52
|
+
if (options.data)
|
|
53
|
+
tx.data = options.data;
|
|
54
|
+
if (options.value)
|
|
55
|
+
tx.value = options.value;
|
|
56
|
+
if (options.type === 2) {
|
|
57
|
+
tx.type = 2;
|
|
58
|
+
tx.maxFeePerGas = options.gasPrice;
|
|
59
|
+
tx.maxPriorityFeePerGas = options.gasPrice / 10n;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
tx.type = 0;
|
|
63
|
+
tx.gasPrice = options.gasPrice;
|
|
64
|
+
}
|
|
65
|
+
return tx;
|
|
66
|
+
}
|
|
67
|
+
export function getGasLimit(config, defaultGas = 500000) {
|
|
68
|
+
if (config.gasLimit !== undefined) {
|
|
69
|
+
return typeof config.gasLimit === 'bigint' ? config.gasLimit : BigInt(config.gasLimit);
|
|
70
|
+
}
|
|
71
|
+
const multiplier = config.gasLimitMultiplier ?? 1.0;
|
|
72
|
+
return BigInt(Math.ceil(defaultGas * multiplier));
|
|
73
|
+
}
|
|
74
|
+
export function getGasPriceConfig(config) {
|
|
75
|
+
const gasPriceConfig = {};
|
|
76
|
+
if (config.minGasPriceGwei !== undefined) {
|
|
77
|
+
gasPriceConfig.baseGasPrice = ethers.parseUnits(String(config.minGasPriceGwei), 'gwei');
|
|
78
|
+
gasPriceConfig.multiplierPercent = 0;
|
|
79
|
+
}
|
|
80
|
+
if (config.maxGasPriceGwei !== undefined) {
|
|
81
|
+
gasPriceConfig.maxGasPrice = ethers.parseUnits(String(config.maxGasPriceGwei), 'gwei');
|
|
82
|
+
}
|
|
83
|
+
return gasPriceConfig;
|
|
84
|
+
}
|
|
85
|
+
export function getTxType(config) {
|
|
86
|
+
return config.txType ?? 0;
|
|
87
|
+
}
|
|
88
|
+
export function buildGasFields(txType, gasPrice) {
|
|
89
|
+
if (txType === 2) {
|
|
90
|
+
return { type: 2, maxFeePerGas: gasPrice, maxPriorityFeePerGas: gasPrice / 10n || 1n };
|
|
91
|
+
}
|
|
92
|
+
return { type: 0, gasPrice };
|
|
93
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { JsonRpcProvider, Wallet } from 'ethers';
|
|
2
|
+
import { type GeneratedWallet } from '../../../utils/wallet.js';
|
|
3
|
+
export interface ProfitHopConfig {
|
|
4
|
+
provider: JsonRpcProvider;
|
|
5
|
+
payerWallet: Wallet;
|
|
6
|
+
profitAmount: bigint;
|
|
7
|
+
profitRecipient: string;
|
|
8
|
+
hopCount?: number;
|
|
9
|
+
gasPrice: bigint;
|
|
10
|
+
chainId: number;
|
|
11
|
+
txType: number;
|
|
12
|
+
startNonce?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ProfitHopResult {
|
|
15
|
+
signedTransactions: string[];
|
|
16
|
+
hopWallets: GeneratedWallet[];
|
|
17
|
+
totalNonceUsed: number;
|
|
18
|
+
}
|
|
19
|
+
export declare const PROFIT_HOP_COUNT = 2;
|
|
20
|
+
export declare function buildProfitHopTransactions(config: ProfitHopConfig): Promise<ProfitHopResult>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Wallet } from 'ethers';
|
|
2
|
+
import { generateWallets } from '../../../utils/wallet.js';
|
|
3
|
+
import { GAS_LIMITS, CHAINS } from '../../constants/index.js';
|
|
4
|
+
import { NonceManager } from '../nonce/nonce-manager.js';
|
|
5
|
+
import { buildGasFields } from './bundle-gas.js';
|
|
6
|
+
export const PROFIT_HOP_COUNT = 2;
|
|
7
|
+
const CHAINS_REQUIRE_HOP = [CHAINS.BSC.chainId];
|
|
8
|
+
export async function buildProfitHopTransactions(config) {
|
|
9
|
+
const { provider, payerWallet, profitAmount, profitRecipient, hopCount = PROFIT_HOP_COUNT, gasPrice, chainId, txType, startNonce, } = config;
|
|
10
|
+
if (profitAmount <= 0n) {
|
|
11
|
+
return { signedTransactions: [], hopWallets: [], totalNonceUsed: 0 };
|
|
12
|
+
}
|
|
13
|
+
const nativeTransferGasLimit = GAS_LIMITS.NATIVE_TRANSFER;
|
|
14
|
+
const signedTxs = [];
|
|
15
|
+
const nonceManager = new NonceManager(provider);
|
|
16
|
+
const payerNonce = startNonce ?? (await nonceManager.getNextNonce(payerWallet));
|
|
17
|
+
const needHop = CHAINS_REQUIRE_HOP.includes(chainId);
|
|
18
|
+
const gasFields = buildGasFields(txType, gasPrice);
|
|
19
|
+
if (!needHop) {
|
|
20
|
+
const directTx = await payerWallet.signTransaction({
|
|
21
|
+
to: profitRecipient,
|
|
22
|
+
value: profitAmount,
|
|
23
|
+
nonce: payerNonce,
|
|
24
|
+
gasLimit: nativeTransferGasLimit,
|
|
25
|
+
chainId,
|
|
26
|
+
...gasFields,
|
|
27
|
+
});
|
|
28
|
+
signedTxs.push(directTx);
|
|
29
|
+
return { signedTransactions: signedTxs, hopWallets: [], totalNonceUsed: 1 };
|
|
30
|
+
}
|
|
31
|
+
const gasFeePerHop = nativeTransferGasLimit * gasPrice;
|
|
32
|
+
const hopWalletsInfo = generateWallets(hopCount);
|
|
33
|
+
const hopWallets = hopWalletsInfo.map((w) => new Wallet(w.privateKey, provider));
|
|
34
|
+
const hopAmounts = [];
|
|
35
|
+
for (let i = hopCount - 1; i >= 0; i--) {
|
|
36
|
+
if (i === hopCount - 1) {
|
|
37
|
+
hopAmounts.unshift(profitAmount + gasFeePerHop);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
hopAmounts.unshift(hopAmounts[0] + gasFeePerHop);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const payerTx = await payerWallet.signTransaction({
|
|
44
|
+
to: hopWallets[0].address,
|
|
45
|
+
value: hopAmounts[0],
|
|
46
|
+
nonce: payerNonce,
|
|
47
|
+
gasLimit: nativeTransferGasLimit,
|
|
48
|
+
chainId,
|
|
49
|
+
...gasFields,
|
|
50
|
+
});
|
|
51
|
+
signedTxs.push(payerTx);
|
|
52
|
+
for (let i = 0; i < hopCount; i++) {
|
|
53
|
+
const fromWallet = hopWallets[i];
|
|
54
|
+
const isLastHop = i === hopCount - 1;
|
|
55
|
+
const toAddress = isLastHop ? profitRecipient : hopWallets[i + 1].address;
|
|
56
|
+
const value = isLastHop ? profitAmount : hopAmounts[i + 1];
|
|
57
|
+
const hopTx = await fromWallet.signTransaction({
|
|
58
|
+
to: toAddress,
|
|
59
|
+
value,
|
|
60
|
+
nonce: 0,
|
|
61
|
+
gasLimit: nativeTransferGasLimit,
|
|
62
|
+
chainId,
|
|
63
|
+
...gasFields,
|
|
64
|
+
});
|
|
65
|
+
signedTxs.push(hopTx);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
signedTransactions: signedTxs,
|
|
69
|
+
hopWallets: hopWalletsInfo,
|
|
70
|
+
totalNonceUsed: 1,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK 横向基础(错误规范化、可选日志、共享类型与 Tx 构建)。
|
|
3
|
+
* 新代码优先从这里收口 unknown / Logger / 复用类型;存量代码可渐进迁移。
|
|
4
|
+
*/
|
|
5
|
+
export { getErrorMessageFromUnknown, normalizeUnknownError, type NormalizedErrorShape } from './normalize-unknown.js';
|
|
6
|
+
export { noopSdkLogger, consoleSdkLogger, type SdkLogger } from './sdk-logger.js';
|
|
7
|
+
export type { Aggregate3CallResult, EnsureAllowanceResult, EnsureAllowanceBatchItemResult, ApproveTokenBatchParams, ApproveTokenBatchRawParams, ApproveTokenBatchResult, ApproveTokenBatchSignResult, HoldersMakerChain, HoldersMakerTradeType, BaseTokenType, HoldersMakerConfig, HoldersMakerParams, TransactionLayer, BatchResult, HoldersMakerResult, DexConfig, ChainDexConfig, PoolPairInfo, V3PoolInfo, DexPoolInfo, BestPoolInfo, LPPlatform, LPInfo, InspectOptions, BundleSubmitResult, SignedTransactionsResult, AirdropDisperseParams, AirdropDisperseSignParams, AirdropSweepParams, AirdropSweepSignParams, DisperseParams, DisperseSignParams, SweepParams, SweepSignParams, PrivateSaleSignConfig, PrivateSaleTransferParams, BatchPrivateSaleParams, PrivateSaleResult, SupportedChain, QuoteParams, QuoteResult, } from './types/index.js';
|
|
8
|
+
export { buildTransactionRequest, type BuildTxRequestParams } from './tx/build-request.js';
|
|
9
|
+
export { NonceManager } from './nonce/nonce-manager.js';
|
|
10
|
+
export { type GasPriceConfig, type GasEstimateConfig, type BuildTransactionOptions, type CommonBundleConfig, getOptimizedGasPrice, estimateGasWithSafety, estimateGasBatch, buildTransaction, getGasLimit, getGasPriceConfig, getTxType, buildGasFields, } from './gas/bundle-gas.js';
|
|
11
|
+
export { type ProfitHopConfig, type ProfitHopResult, PROFIT_HOP_COUNT, buildProfitHopTransactions, } from './gas/profit-hop.js';
|
|
12
|
+
export { getChainId, signTransactionsBatch, signTransactionsBatchMultiWallet, validateSignedTransactions, } from './tx/sign-batch.js';
|
|
13
|
+
export { getDeadline, encodeV3Path, decodeV3Path } from './dex/v3-path.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK 横向基础(错误规范化、可选日志、共享类型与 Tx 构建)。
|
|
3
|
+
* 新代码优先从这里收口 unknown / Logger / 复用类型;存量代码可渐进迁移。
|
|
4
|
+
*/
|
|
5
|
+
export { getErrorMessageFromUnknown, normalizeUnknownError } from './normalize-unknown.js';
|
|
6
|
+
export { noopSdkLogger, consoleSdkLogger } from './sdk-logger.js';
|
|
7
|
+
export { buildTransactionRequest } from './tx/build-request.js';
|
|
8
|
+
export { NonceManager } from './nonce/nonce-manager.js';
|
|
9
|
+
export { getOptimizedGasPrice, estimateGasWithSafety, estimateGasBatch, buildTransaction, getGasLimit, getGasPriceConfig, getTxType, buildGasFields, } from './gas/bundle-gas.js';
|
|
10
|
+
export { PROFIT_HOP_COUNT, buildProfitHopTransactions, } from './gas/profit-hop.js';
|
|
11
|
+
export { getChainId, signTransactionsBatch, signTransactionsBatchMultiWallet, validateSignedTransactions, } from './tx/sign-batch.js';
|
|
12
|
+
export { getDeadline, encodeV3Path, decodeV3Path } from './dex/v3-path.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import '../tx/wallet-sign-patch.js';
|
|
2
|
+
import { JsonRpcProvider, Wallet } from 'ethers';
|
|
3
|
+
/**
|
|
4
|
+
* Nonce 管理器 — bundle 交易中管理多钱包 nonce
|
|
5
|
+
*/
|
|
6
|
+
export declare class NonceManager {
|
|
7
|
+
private provider;
|
|
8
|
+
private tempNonceCache;
|
|
9
|
+
private chainIdPromise?;
|
|
10
|
+
constructor(provider: JsonRpcProvider);
|
|
11
|
+
private getChainId;
|
|
12
|
+
getNextNonce(wallet: Wallet | string): Promise<number>;
|
|
13
|
+
getNextNonceBatch(wallet: Wallet | string, count: number): Promise<number[]>;
|
|
14
|
+
clearTemp(): void;
|
|
15
|
+
getTempCachedNonce(address: string): number | undefined;
|
|
16
|
+
getNextNoncesForWallets(wallets: (Wallet | string)[]): Promise<number[]>;
|
|
17
|
+
}
|