four-flap-meme-sdk 2.2.19 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{shared/abis → abis}/common.d.ts +1 -1
- package/dist/{shared/abis → abis}/common.js +75 -91
- package/dist/abis/contracts/TaxToken.json +969 -0
- package/dist/abis/contracts/TokenManager2.json +136 -0
- package/dist/{shared/abis → abis/contracts}/index.d.ts +0 -1
- package/dist/{shared/abis → abis/contracts}/index.js +0 -2
- 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 +6 -0
- package/dist/abis/index.js +9 -0
- package/dist/bundle/config-helpers.d.ts +37 -0
- package/dist/bundle/config-helpers.js +58 -0
- package/dist/bundle/errors.d.ts +50 -0
- package/dist/bundle/errors.js +38 -0
- package/dist/bundle/four-meme/approve-tokenmanager.d.ts +7 -0
- package/dist/bundle/four-meme/approve-tokenmanager.js +99 -0
- package/dist/bundle/four-meme/core-helpers.d.ts +8 -0
- package/dist/bundle/four-meme/core-helpers.js +41 -0
- package/dist/{contracts/tm-bundle-merkle → bundle/four-meme}/core.d.ts +1 -1
- package/dist/{contracts/tm-bundle-merkle → bundle/four-meme}/core.js +74 -150
- package/dist/{contracts/tm-bundle-merkle → bundle/four-meme}/pancake-proxy.d.ts +1 -1
- package/dist/{contracts/tm-bundle-merkle → bundle/four-meme}/pancake-proxy.js +85 -92
- package/dist/{contracts/tm-bundle-merkle → bundle/four-meme}/private.d.ts +1 -1
- package/dist/{contracts/tm-bundle-merkle → bundle/four-meme}/private.js +48 -59
- package/dist/bundle/four-meme/sign-context-helpers.d.ts +2 -0
- package/dist/bundle/four-meme/sign-context-helpers.js +2 -0
- package/dist/bundle/four-meme/swap-buy-first.d.ts +8 -0
- package/dist/{contracts/tm-bundle-merkle → bundle/four-meme}/swap-buy-first.js +56 -108
- package/dist/bundle/four-meme/swap-hop-helpers.d.ts +6 -0
- package/dist/bundle/four-meme/swap-hop-helpers.js +63 -0
- package/dist/{contracts/tm-bundle-merkle → bundle/four-meme}/swap-internal.js +4 -4
- package/dist/bundle/four-meme/swap-sign-helpers.d.ts +28 -0
- package/dist/bundle/four-meme/swap-sign-helpers.js +105 -0
- package/dist/bundle/four-meme/swap.d.ts +17 -0
- package/dist/{contracts/tm-bundle-merkle → bundle/four-meme}/swap.js +84 -345
- package/dist/{contracts/tm-bundle-merkle/swap-buy-first.d.ts → bundle/four-meme/types/buy-first.d.ts} +11 -18
- package/dist/bundle/four-meme/types/core-flow.d.ts +63 -0
- package/dist/bundle/four-meme/types/core-flow.js +1 -0
- package/dist/{contracts/tm-bundle-merkle/types.d.ts → bundle/four-meme/types/index.d.ts} +130 -6
- package/dist/bundle/four-meme/types/index.js +1 -0
- package/dist/bundle/four-meme/types/swap-internal.d.ts +19 -0
- package/dist/bundle/four-meme/types/swap-internal.js +1 -0
- package/dist/bundle/four-meme/types.d.ts +1 -0
- package/dist/bundle/four-meme/utils-disperse.d.ts +7 -0
- package/dist/bundle/four-meme/utils-disperse.js +396 -0
- package/dist/bundle/four-meme/utils-pairwise.d.ts +8 -0
- package/dist/bundle/four-meme/utils-pairwise.js +328 -0
- package/dist/bundle/four-meme/utils-sweep.d.ts +8 -0
- package/dist/bundle/four-meme/utils-sweep.js +744 -0
- package/dist/bundle/index.d.ts +8 -0
- package/dist/bundle/index.js +8 -0
- package/dist/bundle/internal.d.ts +16 -0
- package/dist/bundle/internal.js +160 -0
- package/dist/bundle/sign-context-helpers.d.ts +26 -0
- package/dist/bundle/sign-context-helpers.js +63 -0
- package/dist/{contracts/tm-bundle-merkle → bundle}/submit.d.ts +6 -27
- package/dist/{contracts/tm-bundle-merkle → bundle}/submit.js +116 -313
- package/dist/bundle/types/index.d.ts +8 -0
- package/dist/bundle/types/index.js +1 -0
- package/dist/bundle/types.d.ts +1 -0
- package/dist/bundle/types.js +1 -0
- package/dist/chains/bsc/constants.js +1 -1
- 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 +99 -214
- 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/constants.js +1 -1
- 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 +5 -2
- package/dist/chains/eni/batch-router/bundle-approve.js +4 -3
- package/dist/chains/eni/batch-router/transfer.js +57 -27
- 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 +2 -2
- 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 +3 -3
- 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 +29 -45
- package/dist/chains/eni/platforms/daoaas/portal.js +10 -6
- package/dist/chains/eni/platforms/dswap/liquidity.js +59 -27
- package/dist/chains/eni/platforms/fair-launch/constants.js +1 -1
- 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 +88 -47
- package/dist/chains/eni/platforms/fair-launch/pool.js +5 -2
- package/dist/chains/eni/platforms/fair-launch/presets.js +2 -2
- package/dist/chains/eni/platforms/iro/constants.d.ts +1 -1
- package/dist/chains/eni/platforms/iro/constants.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 +108 -32
- 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/monad/constants.js +1 -1
- package/dist/chains/xlayer/constants.d.ts +5 -0
- package/dist/chains/xlayer/constants.js +1 -1
- 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 +30 -112
- package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +3 -65
- package/dist/chains/xlayer/eip7702/bundle-swap.js +52 -246
- 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 +64 -308
- 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/core/amount/split-by-weight.d.ts +5 -0
- package/dist/core/amount/split-by-weight.js +35 -0
- package/dist/{shared → core}/clients/blockrazor.d.ts +4 -8
- package/dist/{shared → core}/clients/blockrazor.js +43 -35
- package/dist/{shared → core}/clients/club48.d.ts +2 -2
- package/dist/{shared → core}/clients/club48.js +36 -30
- package/dist/{shared → core}/clients/emitservice.js +2 -0
- package/dist/{shared → core}/clients/four.d.ts +21 -6
- package/dist/{shared → core}/clients/four.js +29 -24
- package/dist/core/clients/index.d.ts +8 -0
- package/dist/core/clients/index.js +8 -0
- package/dist/{shared → core}/clients/merkle.d.ts +4 -3
- package/dist/{shared → core}/clients/merkle.js +30 -47
- package/dist/{shared → core}/constants/addresses.d.ts +27 -1
- package/dist/{shared → core}/constants/addresses.js +39 -2
- package/dist/{shared → core}/constants/chains.d.ts +1 -1
- package/dist/{shared → core}/constants/chains.js +1 -1
- package/dist/{shared → core}/constants/gas.d.ts +1 -1
- package/dist/{shared → core}/constants/gas.js +2 -6
- package/dist/{shared → core}/constants/index.d.ts +5 -2
- package/dist/{shared → core}/constants/index.js +3 -2
- package/dist/core/constants/quote.d.ts +30 -0
- package/dist/core/constants/quote.js +37 -0
- package/dist/core/dex/v3-path.d.ts +6 -0
- package/dist/core/dex/v3-path.js +35 -0
- package/dist/core/erc20/decimals.d.ts +7 -0
- package/dist/core/erc20/decimals.js +24 -0
- package/dist/{utils → core}/erc20.d.ts +7 -89
- package/dist/{utils → core}/erc20.js +99 -130
- package/dist/core/foundation.d.ts +15 -0
- package/dist/core/foundation.js +14 -0
- package/dist/core/gas/bundle-gas.d.ts +49 -0
- package/dist/core/gas/bundle-gas.js +93 -0
- package/dist/core/gas/profit-hop.d.ts +20 -0
- package/dist/core/gas/profit-hop.js +72 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.js +5 -0
- package/dist/core/legacy-types/errors.d.ts +27 -0
- package/dist/core/legacy-types/errors.js +34 -0
- package/dist/core/nonce/nonce-manager.d.ts +19 -0
- package/dist/core/nonce/nonce-manager.js +217 -0
- package/dist/core/normalize-unknown.d.ts +9 -0
- package/dist/core/normalize-unknown.js +29 -0
- package/dist/core/sdk-logger.d.ts +13 -0
- package/dist/core/sdk-logger.js +12 -0
- package/dist/core/shared-abis/common.d.ts +4 -0
- package/dist/core/shared-abis/common.js +4 -0
- package/dist/core/shared-abis/index.d.ts +5 -0
- package/dist/core/shared-abis/index.js +5 -0
- package/dist/core/tx/build-request.d.ts +17 -0
- package/dist/core/tx/build-request.js +25 -0
- package/dist/core/tx/sign-batch.d.ts +5 -0
- package/dist/core/tx/sign-batch.js +26 -0
- package/dist/core/tx/wallet-sign-patch.d.ts +1 -0
- package/dist/core/tx/wallet-sign-patch.js +18 -0
- package/dist/core/types/airdrop-sweep.d.ts +79 -0
- package/dist/core/types/airdrop-sweep.js +1 -0
- package/dist/core/types/erc20.d.ts +65 -0
- package/dist/core/types/erc20.js +1 -0
- package/dist/core/types/holders-maker.d.ts +64 -0
- package/dist/core/types/holders-maker.js +1 -0
- package/dist/core/types/index.d.ts +7 -0
- package/dist/core/types/index.js +1 -0
- package/dist/{utils → core/types}/lp-inspect.d.ts +4 -52
- package/dist/core/types/lp-inspect.js +1 -0
- package/dist/core/types/multicall.d.ts +5 -0
- package/dist/core/types/multicall.js +1 -0
- package/dist/core/types/private-sale.d.ts +35 -0
- package/dist/core/types/private-sale.js +1 -0
- package/dist/core/types/quote-helpers.d.ts +17 -0
- package/dist/core/types/quote-helpers.js +1 -0
- package/dist/core/types-erc20.d.ts +1 -0
- package/dist/core/types-erc20.js +1 -0
- package/dist/core/wallet/generate.d.ts +5 -0
- package/dist/core/wallet/generate.js +8 -0
- package/dist/domains/dex/direct-router-helpers.d.ts +269 -0
- package/dist/domains/dex/direct-router-helpers.js +536 -0
- package/dist/domains/dex/direct-router.d.ts +28 -0
- package/dist/{dex → domains/dex}/direct-router.js +246 -674
- package/dist/domains/dex/types.d.ts +81 -0
- package/dist/domains/dex/types.js +1 -0
- package/dist/{shared → domains}/flap/abi.js +1 -1
- package/dist/{shared → domains}/flap/constants.d.ts +1 -2
- package/dist/{shared → domains}/flap/constants.js +3 -4
- package/dist/{shared → domains}/flap/curve.js +3 -0
- package/dist/{shared → domains}/flap/errors.d.ts +1 -4
- package/dist/{shared → domains}/flap/errors.js +20 -1
- package/dist/domains/flap/index.d.ts +7 -0
- package/dist/domains/flap/index.js +5 -0
- package/dist/{shared → domains}/flap/meta.d.ts +22 -18
- package/dist/{shared → domains}/flap/meta.js +32 -24
- package/dist/{shared/flap/index.d.ts → domains/flap/module.d.ts} +4 -5
- package/dist/{shared/flap/index.js → domains/flap/module.js} +4 -5
- package/dist/{shared → domains}/flap/permit.js +10 -3
- package/dist/{shared → domains}/flap/pinata.d.ts +22 -6
- package/dist/{shared → domains}/flap/pinata.js +21 -26
- package/dist/domains/flap/portal-bundle-merkle/config.d.ts +10 -0
- package/dist/domains/flap/portal-bundle-merkle/config.js +13 -0
- package/dist/domains/flap/portal-bundle-merkle/core-helpers.d.ts +32 -0
- package/dist/domains/flap/portal-bundle-merkle/core-helpers.js +83 -0
- package/dist/{shared → domains}/flap/portal-bundle-merkle/core.d.ts +0 -4
- package/dist/{shared → domains}/flap/portal-bundle-merkle/core.js +168 -175
- package/dist/{shared → domains}/flap/portal-bundle-merkle/create-to-dex.d.ts +17 -4
- package/dist/{shared → domains}/flap/portal-bundle-merkle/create-to-dex.js +97 -118
- package/dist/{shared → domains}/flap/portal-bundle-merkle/curve-to-dex.js +105 -123
- package/dist/domains/flap/portal-bundle-merkle/index.d.ts +18 -0
- package/dist/{shared → domains}/flap/portal-bundle-merkle/index.js +4 -7
- package/dist/{shared → domains}/flap/portal-bundle-merkle/pancake-proxy.js +73 -70
- package/dist/{shared → domains}/flap/portal-bundle-merkle/private.js +63 -116
- package/dist/domains/flap/portal-bundle-merkle/swap-batch.d.ts +8 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-batch.js +227 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +125 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-helpers.js +113 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first.d.ts +2 -0
- package/dist/{shared → domains}/flap/portal-bundle-merkle/swap-buy-first.js +69 -288
- package/dist/domains/flap/portal-bundle-merkle/swap-cross.d.ts +9 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-cross.js +139 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-helpers.d.ts +149 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-helpers.js +259 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-planning.d.ts +70 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-planning.js +182 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-quick-batch.d.ts +16 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-quick-batch.js +327 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-single.d.ts +2 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-single.js +184 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-types.d.ts +101 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-types.js +1 -0
- package/dist/domains/flap/portal-bundle-merkle/swap.d.ts +8 -0
- package/dist/domains/flap/portal-bundle-merkle/swap.js +7 -0
- package/dist/{shared → domains}/flap/portal-bundle-merkle/types.d.ts +88 -12
- package/dist/domains/flap/portal-bundle-merkle/types.js +1 -0
- package/dist/domains/flap/portal-bundle-merkle/utils.d.ts +10 -0
- package/dist/{shared → domains}/flap/portal-bundle-merkle/utils.js +145 -265
- package/dist/{shared → domains}/flap/portal-bundle.d.ts +2 -2
- package/dist/{shared → domains}/flap/portal-bundle.js +84 -79
- package/dist/domains/flap/portal-create-token.d.ts +81 -0
- package/dist/domains/flap/portal-create-token.js +255 -0
- package/dist/{shared → domains}/flap/portal.d.ts +1 -2
- package/dist/{shared → domains}/flap/portal.js +36 -28
- package/dist/{shared → domains}/flap/vanity.d.ts +6 -6
- package/dist/{shared → domains}/flap/vanity.js +15 -21
- package/dist/{shared → domains}/flap/vault.d.ts +25 -93
- package/dist/{shared → domains}/flap/vault.js +77 -127
- package/dist/{flows → domains/flows}/create.d.ts +2 -1
- package/dist/{flows → domains/flows}/create.js +8 -8
- package/dist/domains/flows/index.d.ts +9 -0
- package/dist/domains/flows/index.js +9 -0
- package/dist/{contracts → domains/four/contracts}/helper3.d.ts +20 -5
- package/dist/{contracts → domains/four/contracts}/helper3.js +56 -20
- package/dist/domains/four/contracts/tm-bundle-helpers.d.ts +88 -0
- package/dist/domains/four/contracts/tm-bundle-helpers.js +73 -0
- package/dist/{contracts → domains/four/contracts}/tm-bundle.d.ts +4 -52
- package/dist/{contracts → domains/four/contracts}/tm-bundle.js +122 -189
- package/dist/{contracts → domains/four/contracts}/tm.d.ts +10 -8
- package/dist/{contracts → domains/four/contracts}/tm.js +39 -35
- package/dist/{contracts → domains/four/contracts}/tm1.js +9 -4
- package/dist/{contracts → domains/four/contracts}/tm2.js +10 -5
- package/dist/domains/four/index.d.ts +7 -0
- package/dist/domains/four/index.js +7 -0
- package/dist/{shared → domains}/four/tax-token.d.ts +1 -1
- package/dist/{shared → domains}/four/tax-token.js +31 -10
- package/dist/domains/holders/holders-maker-helpers.d.ts +9 -0
- package/dist/domains/holders/holders-maker-helpers.js +9 -0
- package/dist/domains/holders/holders-maker.d.ts +18 -0
- package/dist/domains/holders/holders-maker.js +324 -0
- package/dist/domains/holders/index.d.ts +1 -0
- package/dist/domains/holders/index.js +1 -0
- package/dist/domains/holders/internal/addresses.d.ts +12 -0
- package/dist/domains/holders/internal/addresses.js +15 -0
- package/dist/domains/holders/internal/buy-tx.d.ts +44 -0
- package/dist/domains/holders/internal/buy-tx.js +278 -0
- package/dist/domains/holders/internal/constants.d.ts +6 -0
- package/dist/domains/holders/internal/constants.js +7 -0
- package/dist/domains/holders/internal/disperse.d.ts +18 -0
- package/dist/domains/holders/internal/disperse.js +90 -0
- package/dist/domains/holders/internal/routing.d.ts +4 -0
- package/dist/domains/holders/internal/routing.js +45 -0
- package/dist/domains/holders/internal/transfer-tx.d.ts +4 -0
- package/dist/domains/holders/internal/transfer-tx.js +67 -0
- package/dist/domains/holders/types.d.ts +1 -0
- package/dist/domains/holders/types.js +1 -0
- package/dist/domains/lp-inspect/index.d.ts +1 -0
- package/dist/domains/lp-inspect/index.js +1 -0
- package/dist/domains/lp-inspect/lp-inspect-helpers.d.ts +9 -0
- package/dist/domains/lp-inspect/lp-inspect-helpers.js +109 -0
- package/dist/domains/lp-inspect/lp-inspect.d.ts +40 -0
- package/dist/{utils → domains/lp-inspect}/lp-inspect.js +78 -293
- package/dist/domains/lp-inspect/types.d.ts +1 -0
- package/dist/domains/lp-inspect/types.js +1 -0
- package/dist/domains/merkle/index.d.ts +12 -0
- package/dist/domains/merkle/index.js +11 -0
- package/dist/domains/private-sale/index.d.ts +1 -0
- package/dist/domains/private-sale/index.js +1 -0
- package/dist/domains/private-sale/private-sale.d.ts +34 -0
- package/dist/{utils → domains/private-sale}/private-sale.js +5 -16
- package/dist/domains/private-sale/types.d.ts +1 -0
- package/dist/domains/private-sale/types.js +1 -0
- package/dist/domains/quote/index.d.ts +1 -0
- package/dist/domains/quote/index.js +1 -0
- package/dist/{utils → domains/quote}/quote-helpers.d.ts +4 -45
- package/dist/{utils → domains/quote}/quote-helpers.js +17 -74
- package/dist/domains/quote/types.d.ts +1 -0
- package/dist/domains/quote/types.js +1 -0
- package/dist/domains/vanity/index.d.ts +5 -0
- package/dist/domains/vanity/index.js +5 -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/index.d.ts +17 -88
- package/dist/index.js +17 -218
- 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/errors.d.ts +12 -1
- package/dist/utils/errors.js +60 -1
- package/dist/utils/hop-chains.d.ts +35 -0
- package/dist/utils/hop-chains.js +215 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/mpcExclusive.d.ts +2 -5
- package/dist/utils/mpcExclusive.js +4 -3
- package/dist/utils/provider-factory.d.ts +4 -0
- package/dist/utils/provider-factory.js +10 -0
- package/dist/utils/stealth-transfer.d.ts +2 -28
- package/dist/utils/stealth-transfer.js +41 -21
- package/dist/utils/swap-helpers.d.ts +2 -15
- package/dist/utils/swap-helpers.js +7 -12
- 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/errors.d.ts +1 -0
- package/dist/utils/types/errors.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/mpc-exclusive.d.ts +5 -0
- package/dist/utils/types/mpc-exclusive.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/package.json +96 -2
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.d.ts +0 -26
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.js +0 -113
- package/dist/contracts/tm-bundle-merkle/config.d.ts +0 -70
- package/dist/contracts/tm-bundle-merkle/config.js +0 -114
- package/dist/contracts/tm-bundle-merkle/index.d.ts +0 -15
- package/dist/contracts/tm-bundle-merkle/index.js +0 -29
- package/dist/contracts/tm-bundle-merkle/internal.d.ts +0 -48
- package/dist/contracts/tm-bundle-merkle/internal.js +0 -240
- package/dist/contracts/tm-bundle-merkle/swap.d.ts +0 -146
- package/dist/contracts/tm-bundle-merkle/utils.d.ts +0 -20
- package/dist/contracts/tm-bundle-merkle/utils.js +0 -1503
- package/dist/dex/direct-router.d.ts +0 -150
- package/dist/shared/abis/TaxToken.json +0 -105
- package/dist/shared/abis/TokenManager2.json +0 -60
- package/dist/shared/flap/graduated-dex.d.ts +0 -1
- package/dist/shared/flap/graduated-dex.js +0 -1
- package/dist/shared/flap/launch-v6.d.ts +0 -132
- package/dist/shared/flap/launch-v6.js +0 -137
- package/dist/shared/flap/portal-bundle-merkle/config.d.ts +0 -79
- package/dist/shared/flap/portal-bundle-merkle/config.js +0 -133
- package/dist/shared/flap/portal-bundle-merkle/index.d.ts +0 -14
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.d.ts +0 -65
- package/dist/shared/flap/portal-bundle-merkle/swap.d.ts +0 -201
- package/dist/shared/flap/portal-bundle-merkle/swap.js +0 -1359
- package/dist/shared/flap/portal-bundle-merkle/utils.d.ts +0 -89
- package/dist/shared/flap/portal-create-token.d.ts +0 -63
- package/dist/shared/flap/portal-create-token.js +0 -258
- package/dist/shared/four/index.d.ts +0 -7
- package/dist/shared/four/index.js +0 -22
- package/dist/shared/index.d.ts +0 -10
- package/dist/shared/index.js +0 -10
- package/dist/utils/holders-maker.d.ts +0 -154
- package/dist/utils/holders-maker.js +0 -945
- package/dist/utils/pcs-infinity-cl.d.ts +0 -65
- package/dist/utils/pcs-infinity-cl.js +0 -426
- package/dist/utils/private-sale.d.ts +0 -90
- /package/dist/{shared/abis → abis/contracts}/TokenManager.json +0 -0
- /package/dist/{shared/abis → abis/contracts}/TokenManagerHelper3.json +0 -0
- /package/dist/{contracts/tm-bundle-merkle → bundle/four-meme}/swap-internal.d.ts +0 -0
- /package/dist/{shared/flap/portal-bundle-merkle/types.js → bundle/four-meme/types/buy-first.js} +0 -0
- /package/dist/{contracts/tm-bundle-merkle → bundle/four-meme}/types.js +0 -0
- /package/dist/{shared → core}/clients/emitservice.d.ts +0 -0
- /package/dist/{shared → core}/constants/profit.d.ts +0 -0
- /package/dist/{shared → core}/constants/profit.js +0 -0
- /package/dist/{dex → domains/dex}/index.d.ts +0 -0
- /package/dist/{dex → domains/dex}/index.js +0 -0
- /package/dist/{shared → domains}/flap/abi.d.ts +0 -0
- /package/dist/{shared → domains}/flap/curve.d.ts +0 -0
- /package/dist/{shared → domains}/flap/ipfs.d.ts +0 -0
- /package/dist/{shared → domains}/flap/ipfs.js +0 -0
- /package/dist/{shared → domains}/flap/permit.d.ts +0 -0
- /package/dist/{shared → domains}/flap/portal-bundle-merkle/curve-to-dex.d.ts +0 -0
- /package/dist/{shared → domains}/flap/portal-bundle-merkle/pancake-proxy.d.ts +0 -0
- /package/dist/{shared → domains}/flap/portal-bundle-merkle/private.d.ts +0 -0
- /package/dist/{contracts → domains/four/contracts}/tm1.d.ts +0 -0
- /package/dist/{contracts → domains/four/contracts}/tm2.d.ts +0 -0
package/dist/utils/constants.js
CHANGED
|
@@ -1,84 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 公共常量 -
|
|
2
|
+
* 公共常量 - 向后兼容 re-export 层
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* 新代码请直接使用 `shared/constants`:
|
|
5
|
+
* `import { CHAINS, ADDRESSES, getProfitRateBps } from '../core/constants/index.js'`
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
* import { CHAINS, GAS_LIMITS, ADDRESSES } from '../shared/constants';
|
|
7
|
+
* v2:不再导出 `CHAIN` / `DEFAULT_DEADLINE_MINUTES` / `PROFIT_CONFIG` / 报价 `V3_FEE_TIERS`。
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
// 从 shared/constants 重新导出(新的标准入口)
|
|
11
|
-
// ============================================================================
|
|
12
|
-
export {
|
|
13
|
-
// 链配置
|
|
14
|
-
CHAINS, CHAIN_ID_MAP, getChainById, getChainName, getDefaultRpcUrl, isKnownChain, isBscChain, isXLayerChain, isMonadChain, getConfirmationTimeout,
|
|
15
|
-
// Gas 常量
|
|
16
|
-
GAS_LIMITS, GAS_CONFIG, V3_FEE_TIERS, calculateGasLimit, getTransferGasLimit,
|
|
17
|
-
// 合约地址
|
|
18
|
-
ZERO_ADDRESS, BLOCKRAZOR_BUILDER_EOA, ADDRESSES, getAddress, getWrappedNativeAddress, getMulticall3Address, getFlapPortalAddress, isZeroAddress, isNativeToken,
|
|
19
|
-
// 利润配置
|
|
20
|
-
PROFIT_CONFIG as PROFIT_CONFIG_NEW, getProfitRecipient, getAllProfitRecipients, getProfitRateBps, calculateProfitAmount, calculateProfitHopGasCost,
|
|
21
|
-
// ✅ 钱包转账按地址收费
|
|
22
|
-
TRANSFER_FEE_PER_ADDRESS, getTransferFeePerAddress, calculateTransferFee, } from '../shared/constants/index.js';
|
|
23
|
-
import { CHAINS, PROFIT_CONFIG as PROFIT_CONFIG_NEW } from '../shared/constants/index.js';
|
|
24
|
-
// ============================================================================
|
|
25
|
-
// 向后兼容:旧格式常量(标记为 @deprecated)
|
|
26
|
-
// ============================================================================
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated 使用 GAS_CONFIG.DEFAULT_DEADLINE_MINUTES 替代
|
|
29
|
-
*/
|
|
30
|
-
export const DEFAULT_DEADLINE_MINUTES = 20;
|
|
31
|
-
/**
|
|
32
|
-
* @deprecated 使用 CHAINS 替代
|
|
33
|
-
*
|
|
34
|
-
* 旧格式的链配置,仅包含 chainId 和 name
|
|
35
|
-
*/
|
|
36
|
-
export const CHAIN = {
|
|
37
|
-
BSC: {
|
|
38
|
-
chainId: CHAINS.BSC.chainId,
|
|
39
|
-
name: CHAINS.BSC.name,
|
|
40
|
-
},
|
|
41
|
-
BASE: {
|
|
42
|
-
chainId: CHAINS.BASE.chainId,
|
|
43
|
-
name: CHAINS.BASE.name
|
|
44
|
-
},
|
|
45
|
-
XLAYER: {
|
|
46
|
-
chainId: CHAINS.XLAYER.chainId,
|
|
47
|
-
name: CHAINS.XLAYER.name
|
|
48
|
-
},
|
|
49
|
-
MORPH: {
|
|
50
|
-
chainId: CHAINS.MORPH.chainId,
|
|
51
|
-
name: CHAINS.MORPH.name
|
|
52
|
-
},
|
|
53
|
-
ARBITRUM_ONE: {
|
|
54
|
-
chainId: CHAINS.ARBITRUM_ONE.chainId,
|
|
55
|
-
name: CHAINS.ARBITRUM_ONE.name
|
|
56
|
-
},
|
|
57
|
-
MONAD: {
|
|
58
|
-
chainId: CHAINS.MONAD.chainId,
|
|
59
|
-
name: CHAINS.MONAD.name
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated 使用 PROFIT_CONFIG_NEW 替代
|
|
64
|
-
*
|
|
65
|
-
* 旧格式的利润配置(扁平结构)
|
|
66
|
-
*/
|
|
67
|
-
export const PROFIT_CONFIG = {
|
|
68
|
-
/** @deprecated 使用 getProfitRecipient() 随机获取 */
|
|
69
|
-
get RECIPIENT() {
|
|
70
|
-
return PROFIT_CONFIG_NEW.RECIPIENTS[Math.floor(Math.random() * PROFIT_CONFIG_NEW.RECIPIENTS.length)];
|
|
71
|
-
},
|
|
72
|
-
/** 利润比例(基点):40 bps = 0.4%(普通模式) */
|
|
73
|
-
RATE_BPS: PROFIT_CONFIG_NEW.RATES.NORMAL,
|
|
74
|
-
/** 利润比例(基点):6 bps = 0.06%(捆绑换手模式) */
|
|
75
|
-
RATE_BPS_SWAP: PROFIT_CONFIG_NEW.RATES.BUNDLE_SWAP,
|
|
76
|
-
/** 利润比例(单边基点):8 bps = 0.08%(用户类型 v0) */
|
|
77
|
-
RATE_BPS_V0: PROFIT_CONFIG_NEW.RATES.V0_SINGLE,
|
|
78
|
-
/** 利润比例(双边基点):4 bps = 0.04%(用户类型 v0) */
|
|
79
|
-
RATE_BPS_V0_DOUBLE: PROFIT_CONFIG_NEW.RATES.V0_DOUBLE,
|
|
80
|
-
/** 利润比例(单边基点):10 bps = 0.10%(用户类型 v1) */
|
|
81
|
-
RATE_BPS_V1: PROFIT_CONFIG_NEW.RATES.V1_SINGLE,
|
|
82
|
-
/** 利润比例(双边基点):5 bps = 0.05%(用户类型 v1) */
|
|
83
|
-
RATE_BPS_V1_DOUBLE: PROFIT_CONFIG_NEW.RATES.V1_DOUBLE,
|
|
84
|
-
};
|
|
9
|
+
export { CHAINS, CHAIN_ID_MAP, getChainById, getChainName, getDefaultRpcUrl, isKnownChain, isBscChain, isXLayerChain, isMonadChain, isEniChain, getConfirmationTimeout, GAS_LIMITS, GAS_CONFIG, calculateGasLimit, getTransferGasLimit, ZERO_ADDRESS, BLOCKRAZOR_BUILDER_EOA, ADDRESSES, getAddress, getWrappedNativeAddress, getMulticall3Address, getFlapPortalAddress, isZeroAddress, isNativeToken, getProfitRecipient, getAllProfitRecipients, getProfitRateBps, calculateProfitAmount, calculateProfitHopGasCost, TRANSFER_FEE_PER_ADDRESS, getTransferFeePerAddress, calculateTransferFee, QUOTE_CONFIG, QUOTE_V3_FEE_TIERS, } from '../core/constants/index.js';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Contract } from 'ethers';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
export type ChainName = 'BSC' | 'BASE' | 'ARBITRUM_ONE';
|
|
2
|
+
import type { ChainName } from './types/contract-factory.js';
|
|
3
|
+
export type { ChainName } from './types/contract-factory.js';
|
|
6
4
|
/**
|
|
7
5
|
* 创建 TokenManager V1 合约实例(只读)
|
|
8
6
|
* 自动使用正确的代理合约地址
|
|
@@ -1,84 +1,91 @@
|
|
|
1
|
-
import { Contract,
|
|
2
|
-
import { TokenManager, TokenManager2, TokenManagerHelper3 } from '../
|
|
3
|
-
import { ADDRESSES } from '
|
|
1
|
+
import { Contract, Wallet } from 'ethers';
|
|
2
|
+
import { TokenManager, TokenManager2, TokenManagerHelper3 } from '../abis/index.js';
|
|
3
|
+
import { ADDRESSES } from '../core/constants/index.js';
|
|
4
|
+
import { createProvider } from './provider-factory.js';
|
|
5
|
+
const TOKEN_MANAGER_ABI = TokenManager;
|
|
6
|
+
const TOKEN_MANAGER2_ABI = TokenManager2;
|
|
7
|
+
const TOKEN_MANAGER_HELPER3_ABI = TokenManagerHelper3;
|
|
8
|
+
function readOnlyProvider(rpcUrl) {
|
|
9
|
+
return createProvider(rpcUrl);
|
|
10
|
+
}
|
|
11
|
+
function writableProvider(rpcUrl, privateKey) {
|
|
12
|
+
return new Wallet(privateKey, createProvider(rpcUrl));
|
|
13
|
+
}
|
|
4
14
|
/**
|
|
5
15
|
* 创建 TokenManager V1 合约实例(只读)
|
|
6
16
|
* 自动使用正确的代理合约地址
|
|
7
17
|
*/
|
|
8
18
|
export function getTokenManagerV1(chain, rpcUrl) {
|
|
9
|
-
const provider =
|
|
19
|
+
const provider = readOnlyProvider(rpcUrl);
|
|
10
20
|
const chainAddresses = ADDRESSES[chain];
|
|
11
21
|
const address = 'TokenManagerV1' in chainAddresses ? chainAddresses.TokenManagerV1 : undefined;
|
|
12
22
|
if (!address) {
|
|
13
23
|
throw new Error(`TokenManager V1 not deployed on ${chain}`);
|
|
14
24
|
}
|
|
15
|
-
return new Contract(address,
|
|
25
|
+
return new Contract(address, TOKEN_MANAGER_ABI, provider);
|
|
16
26
|
}
|
|
17
27
|
/**
|
|
18
28
|
* 创建 TokenManager V2 合约实例(只读)
|
|
19
29
|
* 自动使用正确的代理合约地址
|
|
20
30
|
*/
|
|
21
31
|
export function getTokenManagerV2(chain, rpcUrl) {
|
|
22
|
-
const provider =
|
|
32
|
+
const provider = readOnlyProvider(rpcUrl);
|
|
23
33
|
const chainAddresses = ADDRESSES[chain];
|
|
24
34
|
const address = 'TokenManagerV2' in chainAddresses ? chainAddresses.TokenManagerV2 : undefined;
|
|
25
35
|
if (!address) {
|
|
26
36
|
throw new Error(`TokenManager V2 not deployed on ${chain}`);
|
|
27
37
|
}
|
|
28
|
-
return new Contract(address,
|
|
38
|
+
return new Contract(address, TOKEN_MANAGER2_ABI, provider);
|
|
29
39
|
}
|
|
30
40
|
/**
|
|
31
41
|
* 创建 TokenManagerHelper3 合约实例(只读)
|
|
32
42
|
* 自动使用正确的代理合约地址
|
|
33
43
|
*/
|
|
34
44
|
export function getTokenManagerHelper3(chain, rpcUrl) {
|
|
35
|
-
const provider =
|
|
45
|
+
const provider = readOnlyProvider(rpcUrl);
|
|
36
46
|
const address = ADDRESSES[chain].TokenManagerHelper3;
|
|
37
47
|
if (!address) {
|
|
38
48
|
throw new Error(`TokenManagerHelper3 not deployed on ${chain}`);
|
|
39
49
|
}
|
|
40
|
-
return new Contract(address,
|
|
50
|
+
return new Contract(address, TOKEN_MANAGER_HELPER3_ABI, provider);
|
|
41
51
|
}
|
|
42
52
|
/**
|
|
43
53
|
* 创建 TokenManager V1 合约实例(可写)
|
|
44
54
|
* 自动使用正确的代理合约地址
|
|
45
55
|
*/
|
|
46
56
|
export function getTokenManagerV1Writer(chain, rpcUrl, privateKey) {
|
|
47
|
-
const
|
|
48
|
-
const signer = new Wallet(privateKey, provider);
|
|
57
|
+
const signer = writableProvider(rpcUrl, privateKey);
|
|
49
58
|
const chainAddresses = ADDRESSES[chain];
|
|
50
59
|
const address = 'TokenManagerV1' in chainAddresses ? chainAddresses.TokenManagerV1 : undefined;
|
|
51
60
|
if (!address) {
|
|
52
61
|
throw new Error(`TokenManager V1 not deployed on ${chain}`);
|
|
53
62
|
}
|
|
54
|
-
return new Contract(address,
|
|
63
|
+
return new Contract(address, TOKEN_MANAGER_ABI, signer);
|
|
55
64
|
}
|
|
56
65
|
/**
|
|
57
66
|
* 创建 TokenManager V2 合约实例(可写)
|
|
58
67
|
* 自动使用正确的代理合约地址
|
|
59
68
|
*/
|
|
60
69
|
export function getTokenManagerV2Writer(chain, rpcUrl, privateKey) {
|
|
61
|
-
const
|
|
62
|
-
const signer = new Wallet(privateKey, provider);
|
|
70
|
+
const signer = writableProvider(rpcUrl, privateKey);
|
|
63
71
|
const chainAddresses = ADDRESSES[chain];
|
|
64
72
|
const address = 'TokenManagerV2' in chainAddresses ? chainAddresses.TokenManagerV2 : undefined;
|
|
65
73
|
if (!address) {
|
|
66
74
|
throw new Error(`TokenManager V2 not deployed on ${chain}`);
|
|
67
75
|
}
|
|
68
|
-
return new Contract(address,
|
|
76
|
+
return new Contract(address, TOKEN_MANAGER2_ABI, signer);
|
|
69
77
|
}
|
|
70
78
|
/**
|
|
71
79
|
* 创建 TokenManagerHelper3 合约实例(可写)
|
|
72
80
|
* 自动使用正确的代理合约地址
|
|
73
81
|
*/
|
|
74
82
|
export function getTokenManagerHelper3Writer(chain, rpcUrl, privateKey) {
|
|
75
|
-
const
|
|
76
|
-
const signer = new Wallet(privateKey, provider);
|
|
83
|
+
const signer = writableProvider(rpcUrl, privateKey);
|
|
77
84
|
const address = ADDRESSES[chain].TokenManagerHelper3;
|
|
78
85
|
if (!address) {
|
|
79
86
|
throw new Error(`TokenManagerHelper3 not deployed on ${chain}`);
|
|
80
87
|
}
|
|
81
|
-
return new Contract(address,
|
|
88
|
+
return new Contract(address, TOKEN_MANAGER_HELPER3_ABI, signer);
|
|
82
89
|
}
|
|
83
90
|
/**
|
|
84
91
|
* 获取链上 TokenManager 的代理合约地址
|
package/dist/utils/errors.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { SdkErrorCode } from '../core/legacy-types/errors.js';
|
|
2
|
+
import type { FourErrorCode } from './types/errors.js';
|
|
3
|
+
export { SdkErrorCode } from '../core/legacy-types/errors.js';
|
|
4
|
+
export type { FourErrorCode } from './types/errors.js';
|
|
2
5
|
export declare function parseFourError(err: unknown): {
|
|
3
6
|
code?: FourErrorCode;
|
|
4
7
|
message: string;
|
|
5
8
|
};
|
|
9
|
+
/** 统一结构化错误(含错误码,便于上层分支处理) */
|
|
10
|
+
export declare class SdkError extends Error {
|
|
11
|
+
readonly code: SdkErrorCode;
|
|
12
|
+
cause?: unknown;
|
|
13
|
+
constructor(code: SdkErrorCode, message: string, cause?: unknown);
|
|
14
|
+
}
|
|
15
|
+
/** 将任意异常归一为 SdkError */
|
|
16
|
+
export declare function parseSdkError(err: unknown): SdkError;
|
package/dist/utils/errors.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { getErrorMessageFromUnknown } from '../core/normalize-unknown.js';
|
|
2
|
+
import { SdkErrorCode } from '../core/legacy-types/errors.js';
|
|
3
|
+
export { SdkErrorCode } from '../core/legacy-types/errors.js';
|
|
1
4
|
const MESSAGES = {
|
|
2
5
|
GW: 'Amount precision is not aligned to GWEI',
|
|
3
6
|
ZA: "The 'to' address should not be address(0)",
|
|
@@ -8,9 +11,65 @@ const MESSAGES = {
|
|
|
8
11
|
SO: 'Order amount is too small',
|
|
9
12
|
};
|
|
10
13
|
export function parseFourError(err) {
|
|
11
|
-
const raw =
|
|
14
|
+
const raw = getErrorMessageFromUnknown(err);
|
|
12
15
|
const found = Object.keys(MESSAGES).find((k) => raw.includes(k));
|
|
13
16
|
if (found)
|
|
14
17
|
return { code: found, message: MESSAGES[found] };
|
|
15
18
|
return { message: raw };
|
|
16
19
|
}
|
|
20
|
+
function mapFourCodeToSdk(code) {
|
|
21
|
+
switch (code) {
|
|
22
|
+
case 'GW':
|
|
23
|
+
return SdkErrorCode.FOUR_GWEI_PRECISION;
|
|
24
|
+
case 'ZA':
|
|
25
|
+
return SdkErrorCode.FOUR_ZERO_ADDRESS;
|
|
26
|
+
case 'TO':
|
|
27
|
+
return SdkErrorCode.FOUR_ZERO_ADDRESS;
|
|
28
|
+
case 'Slippage':
|
|
29
|
+
return SdkErrorCode.FOUR_SLIPPAGE;
|
|
30
|
+
case 'More BNB':
|
|
31
|
+
return SdkErrorCode.FOUR_INSUFFICIENT_FUNDS;
|
|
32
|
+
case 'FR':
|
|
33
|
+
return SdkErrorCode.FOUR_FEE_TOO_HIGH;
|
|
34
|
+
case 'SO':
|
|
35
|
+
return SdkErrorCode.FOUR_ORDER_TOO_SMALL;
|
|
36
|
+
default:
|
|
37
|
+
return SdkErrorCode.UNKNOWN_ERROR;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** 统一结构化错误(含错误码,便于上层分支处理) */
|
|
41
|
+
export class SdkError extends Error {
|
|
42
|
+
code;
|
|
43
|
+
constructor(code, message, cause) {
|
|
44
|
+
super(message, cause !== undefined ? { cause } : undefined);
|
|
45
|
+
this.name = 'SdkError';
|
|
46
|
+
this.code = code;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** 将任意异常归一为 SdkError */
|
|
50
|
+
export function parseSdkError(err) {
|
|
51
|
+
if (err instanceof SdkError)
|
|
52
|
+
return err;
|
|
53
|
+
if (err === null || err === undefined) {
|
|
54
|
+
return new SdkError(SdkErrorCode.UNKNOWN_ERROR, 'Unknown error');
|
|
55
|
+
}
|
|
56
|
+
const raw = getErrorMessageFromUnknown(err);
|
|
57
|
+
const rawLower = raw.toLowerCase();
|
|
58
|
+
const four = parseFourError(err);
|
|
59
|
+
if (four.code) {
|
|
60
|
+
return new SdkError(mapFourCodeToSdk(four.code), four.message);
|
|
61
|
+
}
|
|
62
|
+
if (rawLower.includes('token already exists')) {
|
|
63
|
+
return new SdkError(SdkErrorCode.TOKEN_ALREADY_EXISTS, raw);
|
|
64
|
+
}
|
|
65
|
+
if (rawLower.includes('slippage')) {
|
|
66
|
+
return new SdkError(SdkErrorCode.SLIPPAGE_EXCEEDED, raw);
|
|
67
|
+
}
|
|
68
|
+
if (rawLower.includes('insufficient funds') || rawLower.includes('insufficient balance')) {
|
|
69
|
+
return new SdkError(SdkErrorCode.INSUFFICIENT_BALANCE, raw);
|
|
70
|
+
}
|
|
71
|
+
if (rawLower.includes('permit expired')) {
|
|
72
|
+
return new SdkError(SdkErrorCode.PERMIT_EXPIRED, raw);
|
|
73
|
+
}
|
|
74
|
+
return new SdkError(SdkErrorCode.UNKNOWN_ERROR, raw);
|
|
75
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 多跳(Hop Chain)转账链生成工具
|
|
3
|
+
*
|
|
4
|
+
* 提取自 chains/bsc/four/swap.ts、chains/bsc/pancake/bundle-swap.ts、domains/flap/portal-bundle-merkle/swap.ts
|
|
5
|
+
* 消除三个文件之间的复制代码
|
|
6
|
+
*/
|
|
7
|
+
import { ethers, Wallet, JsonRpcProvider } from 'ethers';
|
|
8
|
+
import type { DisperseHopPath } from './types/hop-chains.js';
|
|
9
|
+
export type { DisperseHopPath } from './types/hop-chains.js';
|
|
10
|
+
export declare const NATIVE_TRANSFER_GAS_LIMIT: 21055n;
|
|
11
|
+
export declare const ERC20_TRANSFER_GAS_LIMIT_HOP: 65000n;
|
|
12
|
+
export declare const BRIBE_GAS_LIMIT: 21000n;
|
|
13
|
+
/**
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 给交易对象附加 gasPrice/maxFeePerGas(根据 txType)
|
|
17
|
+
* 消除 `if (txType === 2) { ... } else { ... }` 手写重复
|
|
18
|
+
*/
|
|
19
|
+
export declare function applyTxTypeGas(tx: ethers.TransactionLike, gasPrice: bigint, txType: 0 | 2): void;
|
|
20
|
+
/**
|
|
21
|
+
* 生成分发多跳路径
|
|
22
|
+
*/
|
|
23
|
+
export declare function generateDisperseHopPaths(targetAddresses: string[], hopCount: number, provider: JsonRpcProvider): DisperseHopPath[];
|
|
24
|
+
/**
|
|
25
|
+
* 构建原生代币多跳转账链
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildNativeHopChain(payer: Wallet, path: DisperseHopPath, finalAmount: bigint, gasPrice: bigint, chainId: number, txType: 0 | 2, payerNonce: number): Promise<string[]>;
|
|
28
|
+
/**
|
|
29
|
+
* 构建 ERC20 多跳转账链(需要配合 BNB 多跳使用)
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildERC20HopChain(payer: Wallet, path: DisperseHopPath, erc20Address: string, erc20Amount: bigint, gasPrice: bigint, chainId: number, txType: 0 | 2, payerNonce: number): Promise<string[]>;
|
|
32
|
+
/**
|
|
33
|
+
* 构建 BNB 多跳转账链(为 ERC20 中间钱包预留 gas)
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildBNBHopChainForERC20(payer: Wallet, path: DisperseHopPath, finalGasAmount: bigint, gasPrice: bigint, chainId: number, txType: 0 | 2, payerNonce: number): Promise<string[]>;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 多跳(Hop Chain)转账链生成工具
|
|
3
|
+
*
|
|
4
|
+
* 提取自 chains/bsc/four/swap.ts、chains/bsc/pancake/bundle-swap.ts、domains/flap/portal-bundle-merkle/swap.ts
|
|
5
|
+
* 消除三个文件之间的复制代码
|
|
6
|
+
*/
|
|
7
|
+
import { ethers, Wallet } from 'ethers';
|
|
8
|
+
import { GAS_LIMITS } from '../core/constants/index.js';
|
|
9
|
+
import { ERC20_ABI } from '../abis/common.js';
|
|
10
|
+
import { generateWallets } from './wallet.js';
|
|
11
|
+
export const NATIVE_TRANSFER_GAS_LIMIT = GAS_LIMITS.NATIVE_TRANSFER;
|
|
12
|
+
export const ERC20_TRANSFER_GAS_LIMIT_HOP = GAS_LIMITS.ERC20_TRANSFER;
|
|
13
|
+
export const BRIBE_GAS_LIMIT = GAS_LIMITS.BRIBE;
|
|
14
|
+
/**
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 给交易对象附加 gasPrice/maxFeePerGas(根据 txType)
|
|
18
|
+
* 消除 `if (txType === 2) { ... } else { ... }` 手写重复
|
|
19
|
+
*/
|
|
20
|
+
export function applyTxTypeGas(tx, gasPrice, txType) {
|
|
21
|
+
if (txType === 2) {
|
|
22
|
+
tx.maxFeePerGas = gasPrice;
|
|
23
|
+
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
tx.gasPrice = gasPrice;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// ============================================================================
|
|
30
|
+
// 生成多跳路径
|
|
31
|
+
// ============================================================================
|
|
32
|
+
/**
|
|
33
|
+
* 生成分发多跳路径
|
|
34
|
+
*/
|
|
35
|
+
export function generateDisperseHopPaths(targetAddresses, hopCount, provider) {
|
|
36
|
+
if (hopCount <= 0) {
|
|
37
|
+
return targetAddresses.map((addr) => ({
|
|
38
|
+
targetAddress: addr,
|
|
39
|
+
hopWallets: [],
|
|
40
|
+
hopWalletsInfo: [],
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
return targetAddresses.map((targetAddress) => {
|
|
44
|
+
const hopWalletsInfo = generateWallets(hopCount);
|
|
45
|
+
const hopWallets = hopWalletsInfo.map((w) => new Wallet(w.privateKey, provider));
|
|
46
|
+
return { targetAddress, hopWallets, hopWalletsInfo };
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
// ============================================================================
|
|
50
|
+
// 原生代币多跳
|
|
51
|
+
// ============================================================================
|
|
52
|
+
/**
|
|
53
|
+
* 构建原生代币多跳转账链
|
|
54
|
+
*/
|
|
55
|
+
export async function buildNativeHopChain(payer, path, finalAmount, gasPrice, chainId, txType, payerNonce) {
|
|
56
|
+
const signedTxs = [];
|
|
57
|
+
const hopCount = path.hopWallets.length;
|
|
58
|
+
if (hopCount === 0) {
|
|
59
|
+
const tx = {
|
|
60
|
+
to: path.targetAddress,
|
|
61
|
+
value: finalAmount,
|
|
62
|
+
nonce: payerNonce,
|
|
63
|
+
gasLimit: NATIVE_TRANSFER_GAS_LIMIT,
|
|
64
|
+
chainId,
|
|
65
|
+
type: txType,
|
|
66
|
+
};
|
|
67
|
+
applyTxTypeGas(tx, gasPrice, txType);
|
|
68
|
+
signedTxs.push(await payer.signTransaction(tx));
|
|
69
|
+
return signedTxs;
|
|
70
|
+
}
|
|
71
|
+
const hopGasCost = NATIVE_TRANSFER_GAS_LIMIT * gasPrice;
|
|
72
|
+
// 计算每跳需要的金额
|
|
73
|
+
const amountsPerHop = [];
|
|
74
|
+
for (let i = 0; i < hopCount; i++) {
|
|
75
|
+
const remainingHops = hopCount - i;
|
|
76
|
+
amountsPerHop.push(finalAmount + hopGasCost * BigInt(remainingHops));
|
|
77
|
+
}
|
|
78
|
+
// payer → hop1
|
|
79
|
+
const firstTx = {
|
|
80
|
+
to: path.hopWallets[0].address,
|
|
81
|
+
value: amountsPerHop[0],
|
|
82
|
+
nonce: payerNonce,
|
|
83
|
+
gasLimit: NATIVE_TRANSFER_GAS_LIMIT,
|
|
84
|
+
chainId,
|
|
85
|
+
type: txType,
|
|
86
|
+
};
|
|
87
|
+
applyTxTypeGas(firstTx, gasPrice, txType);
|
|
88
|
+
signedTxs.push(await payer.signTransaction(firstTx));
|
|
89
|
+
// hop1 → hop2 → ... → target
|
|
90
|
+
for (let i = 0; i < hopCount; i++) {
|
|
91
|
+
const fromWallet = path.hopWallets[i];
|
|
92
|
+
const toAddress = i === hopCount - 1 ? path.targetAddress : path.hopWallets[i + 1].address;
|
|
93
|
+
const amount = i === hopCount - 1 ? finalAmount : amountsPerHop[i + 1];
|
|
94
|
+
const tx = {
|
|
95
|
+
to: toAddress,
|
|
96
|
+
value: amount,
|
|
97
|
+
nonce: 0,
|
|
98
|
+
gasLimit: NATIVE_TRANSFER_GAS_LIMIT,
|
|
99
|
+
chainId,
|
|
100
|
+
type: txType,
|
|
101
|
+
};
|
|
102
|
+
applyTxTypeGas(tx, gasPrice, txType);
|
|
103
|
+
signedTxs.push(await fromWallet.signTransaction(tx));
|
|
104
|
+
}
|
|
105
|
+
return signedTxs;
|
|
106
|
+
}
|
|
107
|
+
// ============================================================================
|
|
108
|
+
// ERC20 多跳
|
|
109
|
+
// ============================================================================
|
|
110
|
+
/**
|
|
111
|
+
* 构建 ERC20 多跳转账链(需要配合 BNB 多跳使用)
|
|
112
|
+
*/
|
|
113
|
+
export async function buildERC20HopChain(payer, path, erc20Address, erc20Amount, gasPrice, chainId, txType, payerNonce) {
|
|
114
|
+
const signedTxs = [];
|
|
115
|
+
const hopCount = path.hopWallets.length;
|
|
116
|
+
const erc20Interface = new ethers.Interface(ERC20_ABI);
|
|
117
|
+
if (hopCount === 0) {
|
|
118
|
+
const data = erc20Interface.encodeFunctionData('transfer', [path.targetAddress, erc20Amount]);
|
|
119
|
+
const tx = {
|
|
120
|
+
to: erc20Address,
|
|
121
|
+
data,
|
|
122
|
+
value: 0n,
|
|
123
|
+
nonce: payerNonce,
|
|
124
|
+
gasLimit: ERC20_TRANSFER_GAS_LIMIT_HOP,
|
|
125
|
+
chainId,
|
|
126
|
+
type: txType,
|
|
127
|
+
};
|
|
128
|
+
applyTxTypeGas(tx, gasPrice, txType);
|
|
129
|
+
signedTxs.push(await payer.signTransaction(tx));
|
|
130
|
+
return signedTxs;
|
|
131
|
+
}
|
|
132
|
+
// payer → hop1
|
|
133
|
+
const firstData = erc20Interface.encodeFunctionData('transfer', [path.hopWallets[0].address, erc20Amount]);
|
|
134
|
+
const firstTx = {
|
|
135
|
+
to: erc20Address,
|
|
136
|
+
data: firstData,
|
|
137
|
+
value: 0n,
|
|
138
|
+
nonce: payerNonce,
|
|
139
|
+
gasLimit: ERC20_TRANSFER_GAS_LIMIT_HOP,
|
|
140
|
+
chainId,
|
|
141
|
+
type: txType,
|
|
142
|
+
};
|
|
143
|
+
applyTxTypeGas(firstTx, gasPrice, txType);
|
|
144
|
+
signedTxs.push(await payer.signTransaction(firstTx));
|
|
145
|
+
// hop1 → hop2 → ... → target (nonce=1,nonce=0 用于 BNB 转发)
|
|
146
|
+
for (let i = 0; i < hopCount; i++) {
|
|
147
|
+
const fromWallet = path.hopWallets[i];
|
|
148
|
+
const toAddress = i === hopCount - 1 ? path.targetAddress : path.hopWallets[i + 1].address;
|
|
149
|
+
const data = erc20Interface.encodeFunctionData('transfer', [toAddress, erc20Amount]);
|
|
150
|
+
const tx = {
|
|
151
|
+
to: erc20Address,
|
|
152
|
+
data,
|
|
153
|
+
value: 0n,
|
|
154
|
+
nonce: 1, // nonce=0 已用于 BNB 转发
|
|
155
|
+
gasLimit: ERC20_TRANSFER_GAS_LIMIT_HOP,
|
|
156
|
+
chainId,
|
|
157
|
+
type: txType,
|
|
158
|
+
};
|
|
159
|
+
applyTxTypeGas(tx, gasPrice, txType);
|
|
160
|
+
signedTxs.push(await fromWallet.signTransaction(tx));
|
|
161
|
+
}
|
|
162
|
+
return signedTxs;
|
|
163
|
+
}
|
|
164
|
+
// ============================================================================
|
|
165
|
+
// BNB 多跳(为 ERC20 中间钱包预留 Gas)
|
|
166
|
+
// ============================================================================
|
|
167
|
+
/**
|
|
168
|
+
* 构建 BNB 多跳转账链(为 ERC20 中间钱包预留 gas)
|
|
169
|
+
*/
|
|
170
|
+
export async function buildBNBHopChainForERC20(payer, path, finalGasAmount, gasPrice, chainId, txType, payerNonce) {
|
|
171
|
+
const signedTxs = [];
|
|
172
|
+
const hopCount = path.hopWallets.length;
|
|
173
|
+
if (hopCount === 0) {
|
|
174
|
+
// 无多跳时不需要转 gas
|
|
175
|
+
return signedTxs;
|
|
176
|
+
}
|
|
177
|
+
const hopGasCost = NATIVE_TRANSFER_GAS_LIMIT * gasPrice;
|
|
178
|
+
const erc20GasCost = ERC20_TRANSFER_GAS_LIMIT_HOP * gasPrice;
|
|
179
|
+
// 每个中间钱包需要: BNB 转发 gas + ERC20 转发 gas
|
|
180
|
+
const gasPerHop = hopGasCost + erc20GasCost * 2n; // 2倍安全系数
|
|
181
|
+
// 计算每跳需要的金额
|
|
182
|
+
const amountsPerHop = [];
|
|
183
|
+
for (let i = 0; i < hopCount; i++) {
|
|
184
|
+
const remainingHops = hopCount - i;
|
|
185
|
+
amountsPerHop.push(finalGasAmount + gasPerHop * BigInt(remainingHops));
|
|
186
|
+
}
|
|
187
|
+
// payer → hop1
|
|
188
|
+
const firstTx = {
|
|
189
|
+
to: path.hopWallets[0].address,
|
|
190
|
+
value: amountsPerHop[0],
|
|
191
|
+
nonce: payerNonce,
|
|
192
|
+
gasLimit: NATIVE_TRANSFER_GAS_LIMIT,
|
|
193
|
+
chainId,
|
|
194
|
+
type: txType,
|
|
195
|
+
};
|
|
196
|
+
applyTxTypeGas(firstTx, gasPrice, txType);
|
|
197
|
+
signedTxs.push(await payer.signTransaction(firstTx));
|
|
198
|
+
// hop1 → hop2 → ... → target
|
|
199
|
+
for (let i = 0; i < hopCount; i++) {
|
|
200
|
+
const fromWallet = path.hopWallets[i];
|
|
201
|
+
const toAddress = i === hopCount - 1 ? path.targetAddress : path.hopWallets[i + 1].address;
|
|
202
|
+
const amount = i === hopCount - 1 ? finalGasAmount : amountsPerHop[i + 1];
|
|
203
|
+
const tx = {
|
|
204
|
+
to: toAddress,
|
|
205
|
+
value: amount,
|
|
206
|
+
nonce: 1, // nonce=0 已用于 ERC20 转发
|
|
207
|
+
gasLimit: NATIVE_TRANSFER_GAS_LIMIT,
|
|
208
|
+
chainId,
|
|
209
|
+
type: txType,
|
|
210
|
+
};
|
|
211
|
+
applyTxTypeGas(tx, gasPrice, txType);
|
|
212
|
+
signedTxs.push(await fromWallet.signTransaction(tx));
|
|
213
|
+
}
|
|
214
|
+
return signedTxs;
|
|
215
|
+
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
tokenAddress: string;
|
|
4
|
-
rpcUrl: string;
|
|
5
|
-
};
|
|
1
|
+
import type { ExclusiveCheckOnChainParams } from './types/mpc-exclusive.js';
|
|
2
|
+
export type { ExclusiveCheckOnChainParams } from './types/mpc-exclusive.js';
|
|
6
3
|
export declare function isExclusiveOnChain(params: ExclusiveCheckOnChainParams): Promise<boolean>;
|
|
7
4
|
export declare function isExclusiveOffChain(getTokenInfo: (token: string) => Promise<{
|
|
8
5
|
version?: string;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Contract, JsonRpcProvider } from 'ethers';
|
|
2
|
-
import TokenManager2Abi from '../
|
|
3
|
-
import { ADDRESSES } from '
|
|
2
|
+
import TokenManager2Abi from '../abis/contracts/TokenManager2.json' with { type: 'json' };
|
|
3
|
+
import { ADDRESSES } from '../core/constants/index.js';
|
|
4
|
+
const TOKEN_MANAGER2_ABI = TokenManager2Abi;
|
|
4
5
|
// 链上识别:template & 0x10000 > 0
|
|
5
6
|
export async function isExclusiveOnChain(params) {
|
|
6
7
|
const { chain, tokenAddress, rpcUrl } = params;
|
|
7
8
|
const tokenManager2Address = ADDRESSES[chain].TokenManagerV2;
|
|
8
9
|
const provider = new JsonRpcProvider(rpcUrl);
|
|
9
|
-
const tm2 = new Contract(tokenManager2Address,
|
|
10
|
+
const tm2 = new Contract(tokenManager2Address, TOKEN_MANAGER2_ABI, provider);
|
|
10
11
|
const info = await tm2._tokenInfos(tokenAddress);
|
|
11
12
|
const template = info.template;
|
|
12
13
|
return (template & 0x10000n) > 0n;
|
|
@@ -25,6 +25,10 @@ export declare function createCachedProvider(rpcUrl: string, chainId: number, ch
|
|
|
25
25
|
* 清除 Provider 缓存
|
|
26
26
|
*/
|
|
27
27
|
export declare function clearProviderCache(): void;
|
|
28
|
+
/**
|
|
29
|
+
* ENI 专用 Provider(staticNetwork,适合批量 RPC)
|
|
30
|
+
*/
|
|
31
|
+
export declare function createEniProvider(rpcUrl: string, chainId?: number): JsonRpcProvider;
|
|
28
32
|
/**
|
|
29
33
|
* XLayer 专用 Provider 创建函数
|
|
30
34
|
*/
|
|
@@ -72,6 +72,16 @@ export function createCachedProvider(rpcUrl, chainId, chainName) {
|
|
|
72
72
|
export function clearProviderCache() {
|
|
73
73
|
providerCache.clear();
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* ENI 专用 Provider(staticNetwork,适合批量 RPC)
|
|
77
|
+
*/
|
|
78
|
+
export function createEniProvider(rpcUrl, chainId = 173) {
|
|
79
|
+
return new JsonRpcProvider(rpcUrl, chainId, {
|
|
80
|
+
staticNetwork: true,
|
|
81
|
+
batchMaxCount: 20,
|
|
82
|
+
batchStallTime: 30,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
75
85
|
/**
|
|
76
86
|
* XLayer 专用 Provider 创建函数
|
|
77
87
|
*/
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type StealthTransferResult
|
|
3
|
-
bundleUuid: string;
|
|
4
|
-
txs: string[];
|
|
5
|
-
hopAddresses: string[];
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* 简化版隐秘转账参数
|
|
9
|
-
* - 仅需人类可读金额与(可选)代币地址,其余自动处理
|
|
10
|
-
* - 未提供 tokenAddress → 原生币模式;提供 tokenAddress → 自动读取 decimals 转换为 wei 的代币模式
|
|
11
|
-
*/
|
|
12
|
-
export type StealthTransferSimpleParams = {
|
|
13
|
-
rpcUrl: string;
|
|
14
|
-
chainId: number;
|
|
15
|
-
rootPrivateKey: string;
|
|
16
|
-
finalTo: string;
|
|
17
|
-
hopCount: number;
|
|
18
|
-
amount: string;
|
|
19
|
-
tokenAddress?: string;
|
|
20
|
-
tokenHolderPrivateKey?: string;
|
|
21
|
-
bundleEndpoint?: string;
|
|
22
|
-
gasPriceGwei?: string;
|
|
23
|
-
gasLimit?: bigint;
|
|
24
|
-
blockOffset?: number;
|
|
25
|
-
spMode?: SoulPointSignatureMode;
|
|
26
|
-
spPrivateKey?: string;
|
|
27
|
-
spVMode?: VNormalizationMode;
|
|
28
|
-
};
|
|
1
|
+
import type { StealthTransferResult, StealthTransferSimpleParams } from './types/stealth-transfer.js';
|
|
2
|
+
export type { StealthTransferResult, StealthTransferSimpleParams } from './types/stealth-transfer.js';
|
|
29
3
|
/**
|
|
30
4
|
* 隐秘转账(简化版)
|
|
31
5
|
* - 原生模式:amount 按 parseEther 转 wei
|