four-flap-meme-sdk 2.2.7 → 2.2.10
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 +6 -41
- package/README.md +0 -31
- package/README.zh-CN.md +6 -41
- package/dist/chains/bsc/four/approve-tokenmanager.d.ts +26 -1
- package/dist/chains/bsc/four/approve-tokenmanager.js +113 -1
- package/dist/chains/bsc/four/config.d.ts +67 -5
- package/dist/chains/bsc/four/config.js +114 -2
- package/dist/chains/bsc/four/core.d.ts +4 -1
- package/dist/chains/bsc/four/core.js +592 -1
- 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 +46 -2
- package/dist/chains/bsc/four/internal.js +239 -2
- package/dist/chains/bsc/four/pancake-proxy.d.ts +28 -1
- package/dist/chains/bsc/four/pancake-proxy.js +687 -1
- package/dist/chains/bsc/four/private.d.ts +27 -1
- package/dist/chains/bsc/four/private.js +477 -1
- package/dist/chains/bsc/four/submit.d.ts +315 -2
- package/dist/chains/bsc/four/submit.js +752 -2
- package/dist/chains/bsc/four/swap-buy-first.d.ts +55 -2
- package/dist/chains/bsc/four/swap-buy-first.js +507 -2
- package/dist/chains/bsc/four/swap-internal.d.ts +3 -1
- package/dist/chains/bsc/four/swap-internal.js +18 -1
- package/dist/chains/bsc/four/swap.d.ts +144 -2
- package/dist/chains/bsc/four/swap.js +766 -2
- package/dist/chains/bsc/four/types.d.ts +476 -1
- package/dist/chains/bsc/four/utils.d.ts +18 -5
- package/dist/chains/bsc/four/utils.js +1552 -5
- package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +91 -1
- package/dist/chains/bsc/pancake/bundle-buy-first.js +212 -97
- package/dist/chains/bsc/pancake/bundle-swap.d.ts +79 -1
- package/dist/chains/bsc/pancake/bundle-swap.js +726 -114
- package/dist/chains/bsc/pancake/index.d.ts +2 -4
- package/dist/chains/bsc/pancake/index.js +3 -1
- package/dist/chains/bsc/platforms/iro/factory.d.ts +2 -2
- package/dist/chains/bsc/platforms/iro/factory.js +1 -3
- 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 +10 -31
- package/dist/chains/bsc/platforms/iro/token.js +1 -4
- package/dist/chains/eni/batch-router/bundle-approve.js +3 -4
- package/dist/chains/eni/batch-router/transfer.js +25 -55
- package/dist/chains/eni/batch-router/utils.js +6 -32
- package/dist/chains/eni/bundler/sign.js +6 -5
- package/dist/chains/eni/bundler/submit.js +4 -1
- package/dist/chains/eni/constants.js +1 -1
- package/dist/chains/eni/index.d.ts +1 -2
- package/dist/chains/eni/index.js +0 -1
- package/dist/chains/eni/platforms/daoaas/create.js +2 -2
- package/dist/chains/eni/platforms/daoaas/index.d.ts +3 -3
- package/dist/chains/eni/platforms/daoaas/index.js +3 -3
- package/dist/chains/eni/platforms/daoaas/meta.js +6 -9
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +44 -28
- package/dist/chains/eni/platforms/daoaas/portal.js +6 -10
- package/dist/chains/eni/platforms/dswap/liquidity.js +26 -58
- 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 +46 -87
- package/dist/chains/eni/platforms/fair-launch/pool.js +1 -4
- 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 +1 -3
- 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 +26 -90
- package/dist/chains/eni/platforms/iro/token.js +31 -107
- package/dist/chains/eni/platforms/iro/whitelist.js +18 -6
- package/dist/chains/index.d.ts +0 -13
- package/dist/chains/index.js +0 -13
- package/dist/chains/xlayer/eip7702/bundle-approve.d.ts +26 -2
- package/dist/chains/xlayer/eip7702/bundle-approve.js +21 -11
- package/dist/chains/xlayer/eip7702/bundle-buy.d.ts +6 -2
- package/dist/chains/xlayer/eip7702/bundle-buy.js +51 -13
- package/dist/chains/xlayer/eip7702/bundle-create.js +59 -93
- package/dist/chains/xlayer/eip7702/bundle-sell.d.ts +6 -2
- package/dist/chains/xlayer/eip7702/bundle-sell.js +111 -29
- package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +65 -3
- package/dist/chains/xlayer/eip7702/bundle-swap.js +245 -51
- package/dist/chains/xlayer/eip7702/constants.d.ts +16 -1
- package/dist/chains/xlayer/eip7702/constants.js +21 -3
- package/dist/chains/xlayer/eip7702/index.d.ts +46 -28
- package/dist/chains/xlayer/eip7702/index.js +81 -28
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.d.ts +203 -2
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.js +307 -63
- package/dist/chains/xlayer/eip7702/types.d.ts +0 -88
- package/dist/chains/xlayer/eip7702/utils.d.ts +3 -0
- package/dist/chains/xlayer/eip7702/utils.js +28 -23
- package/dist/chains/xlayer/eip7702/volume.d.ts +184 -6
- package/dist/chains/xlayer/eip7702/volume.js +164 -89
- 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.d.ts +95 -1
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.js +299 -66
- package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +1 -1
- package/dist/chains/xlayer/eoa/eoa-wash-volume.js +23 -18
- package/dist/chains/xlayer/eoa/index.d.ts +6 -10
- package/dist/chains/xlayer/eoa/index.js +23 -8
- package/dist/chains/xlayer/eoa/portal-ops.js +2 -7
- 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 +3 -1
- package/dist/chains/xlayer/index.d.ts +2 -3
- package/dist/chains/xlayer/index.js +7 -4
- package/dist/contracts/helper3.d.ts +5 -20
- package/dist/contracts/helper3.js +20 -56
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.d.ts +26 -1
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.js +113 -1
- package/dist/contracts/tm-bundle-merkle/config.d.ts +67 -5
- package/dist/contracts/tm-bundle-merkle/config.js +114 -2
- package/dist/contracts/tm-bundle-merkle/core.d.ts +4 -1
- package/dist/contracts/tm-bundle-merkle/core.js +591 -1
- 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 +46 -2
- package/dist/contracts/tm-bundle-merkle/internal.js +238 -2
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.d.ts +28 -1
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.js +686 -1
- package/dist/contracts/tm-bundle-merkle/private.d.ts +27 -1
- package/dist/contracts/tm-bundle-merkle/private.js +476 -1
- package/dist/contracts/tm-bundle-merkle/submit.d.ts +314 -3
- package/dist/contracts/tm-bundle-merkle/submit.js +928 -3
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.d.ts +55 -2
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.js +506 -2
- package/dist/contracts/tm-bundle-merkle/swap-internal.d.ts +3 -1
- package/dist/contracts/tm-bundle-merkle/swap-internal.js +18 -1
- package/dist/contracts/tm-bundle-merkle/swap.d.ts +144 -2
- package/dist/contracts/tm-bundle-merkle/swap.js +764 -2
- package/dist/contracts/tm-bundle-merkle/types.d.ts +476 -1
- package/dist/contracts/tm-bundle-merkle/utils.d.ts +18 -6
- package/dist/contracts/tm-bundle-merkle/utils.js +1501 -6
- package/dist/contracts/tm-bundle.d.ts +51 -3
- package/dist/contracts/tm-bundle.js +177 -108
- package/dist/contracts/tm.d.ts +2 -3
- package/dist/contracts/tm.js +32 -37
- package/dist/contracts/tm1.js +4 -9
- package/dist/contracts/tm2.js +4 -9
- package/dist/dex/direct-router.d.ts +125 -3
- package/dist/dex/direct-router.js +666 -237
- package/dist/flows/create.d.ts +1 -2
- package/dist/flows/create.js +6 -6
- package/dist/index.d.ts +86 -20
- package/dist/index.js +216 -20
- package/dist/shared/abis/TaxToken.json +105 -0
- package/dist/shared/abis/TokenManager2.json +60 -0
- package/dist/shared/abis/common.d.ts +83 -2
- package/dist/shared/abis/common.js +253 -2
- package/dist/shared/abis/index.d.ts +6 -5
- package/dist/shared/abis/index.js +7 -5
- package/dist/shared/clients/blockrazor.js +25 -39
- package/dist/shared/clients/club48.d.ts +2 -2
- package/dist/shared/clients/club48.js +29 -34
- package/dist/shared/clients/emitservice.js +0 -2
- package/dist/shared/clients/four.d.ts +6 -21
- package/dist/shared/clients/four.js +24 -29
- package/dist/shared/clients/merkle.js +34 -27
- package/dist/shared/constants/addresses.d.ts +1 -1
- package/dist/shared/constants/addresses.js +2 -11
- 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 +6 -2
- package/dist/shared/constants/index.d.ts +0 -3
- package/dist/shared/constants/index.js +0 -1
- package/dist/shared/flap/abi.js +1 -1
- package/dist/shared/flap/constants.d.ts +2 -1
- package/dist/shared/flap/constants.js +4 -3
- package/dist/shared/flap/curve.js +0 -3
- package/dist/shared/flap/errors.d.ts +4 -1
- package/dist/shared/flap/errors.js +1 -20
- package/dist/shared/flap/index.d.ts +5 -5
- package/dist/shared/flap/index.js +5 -5
- package/dist/shared/flap/launch-v6.d.ts +117 -0
- package/dist/shared/flap/launch-v6.js +111 -0
- package/dist/shared/flap/meta.d.ts +18 -22
- package/dist/shared/flap/meta.js +17 -12
- package/dist/shared/flap/permit.js +2 -5
- package/dist/shared/flap/pinata.d.ts +6 -22
- package/dist/shared/flap/pinata.js +26 -21
- package/dist/shared/flap/portal-bundle-merkle/config.d.ts +72 -3
- package/dist/shared/flap/portal-bundle-merkle/config.js +124 -4
- package/dist/shared/flap/portal-bundle-merkle/core.d.ts +4 -0
- package/dist/shared/flap/portal-bundle-merkle/core.js +267 -164
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.d.ts +4 -17
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +195 -107
- package/dist/shared/flap/portal-bundle-merkle/curve-to-dex.js +92 -100
- package/dist/shared/flap/portal-bundle-merkle/index.d.ts +7 -11
- package/dist/shared/flap/portal-bundle-merkle/index.js +7 -4
- package/dist/shared/flap/portal-bundle-merkle/pancake-proxy.js +68 -71
- package/dist/shared/flap/portal-bundle-merkle/private.js +114 -61
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.d.ts +64 -1
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.js +247 -66
- package/dist/shared/flap/portal-bundle-merkle/swap.d.ts +71 -2
- package/dist/shared/flap/portal-bundle-merkle/swap.js +410 -103
- package/dist/shared/flap/portal-bundle-merkle/types.d.ts +12 -88
- package/dist/shared/flap/portal-bundle-merkle/utils.d.ts +80 -1
- package/dist/shared/flap/portal-bundle-merkle/utils.js +265 -145
- package/dist/shared/flap/portal-bundle.js +56 -55
- package/dist/shared/flap/portal.d.ts +3 -14
- package/dist/shared/flap/portal.js +26 -49
- package/dist/shared/flap/vanity.d.ts +5 -4
- package/dist/shared/flap/vanity.js +20 -13
- package/dist/shared/flap/vault.d.ts +93 -25
- package/dist/shared/flap/vault.js +126 -75
- package/dist/shared/four/tax-token.d.ts +1 -1
- package/dist/shared/four/tax-token.js +7 -27
- package/dist/shared/index.d.ts +0 -6
- package/dist/shared/index.js +0 -4
- package/dist/utils/airdrop-sweep.d.ts +76 -4
- package/dist/utils/airdrop-sweep.js +55 -42
- package/dist/utils/bundle-helpers.d.ts +243 -9
- package/dist/utils/bundle-helpers.js +584 -10
- package/dist/utils/constants.d.ts +61 -5
- package/dist/utils/constants.js +80 -5
- package/dist/utils/contract-factory.d.ts +4 -2
- package/dist/utils/contract-factory.js +18 -25
- package/dist/utils/erc20.d.ts +89 -7
- package/dist/utils/erc20.js +125 -94
- package/dist/utils/errors.d.ts +1 -12
- package/dist/utils/errors.js +1 -60
- package/dist/utils/holders-maker.d.ts +138 -2
- package/dist/utils/holders-maker.js +661 -26
- package/dist/utils/lp-inspect.d.ts +112 -2
- package/dist/utils/lp-inspect.js +223 -73
- package/dist/utils/mpcExclusive.d.ts +5 -2
- package/dist/utils/mpcExclusive.js +3 -4
- package/dist/utils/private-sale.d.ts +58 -2
- package/dist/utils/private-sale.js +15 -4
- package/dist/utils/provider-factory.d.ts +0 -4
- package/dist/utils/provider-factory.js +0 -10
- package/dist/utils/quote-helpers.d.ts +45 -4
- package/dist/utils/quote-helpers.js +74 -17
- package/dist/utils/stealth-transfer.d.ts +28 -2
- package/dist/utils/stealth-transfer.js +15 -31
- package/dist/utils/swap-helpers.d.ts +15 -2
- package/dist/utils/swap-helpers.js +11 -6
- package/dist/utils/wallet.d.ts +25 -2
- package/dist/utils/wallet.js +10 -13
- package/package.json +4 -160
- package/dist/__tests__/subpath-exports.test.d.ts +0 -1
- package/dist/__tests__/subpath-exports.test.js +0 -64
- package/dist/abis/common.d.ts +0 -85
- package/dist/abis/common.js +0 -264
- package/dist/abis/contracts/TaxToken.json +0 -969
- package/dist/abis/contracts/TokenManager2.json +0 -136
- package/dist/abis/contracts/index.d.ts +0 -5
- package/dist/abis/contracts/index.js +0 -5
- package/dist/abis/flap/index.d.ts +0 -3
- package/dist/abis/flap/index.js +0 -3
- package/dist/abis/flap/portal-events.d.ts +0 -6
- package/dist/abis/flap/portal-events.js +0 -17
- package/dist/abis/flap/portal.d.ts +0 -6
- package/dist/abis/flap/portal.js +0 -37
- package/dist/abis/flap/vault.d.ts +0 -171
- package/dist/abis/flap/vault.js +0 -91
- package/dist/abis/index.d.ts +0 -8
- package/dist/abis/index.js +0 -11
- package/dist/bundle-core/__tests__/config-helpers.test.d.ts +0 -1
- package/dist/bundle-core/__tests__/config-helpers.test.js +0 -28
- package/dist/bundle-core/__tests__/facade-parity.test.d.ts +0 -1
- package/dist/bundle-core/__tests__/facade-parity.test.js +0 -33
- package/dist/bundle-core/__tests__/sign-context-helpers.test.d.ts +0 -1
- package/dist/bundle-core/__tests__/sign-context-helpers.test.js +0 -60
- package/dist/bundle-core/__tests__/sign-fixture.test.d.ts +0 -1
- package/dist/bundle-core/__tests__/sign-fixture.test.js +0 -220
- package/dist/bundle-core/__tests__/sign-fixtures.d.ts +0 -10
- package/dist/bundle-core/__tests__/sign-fixtures.js +0 -16
- package/dist/bundle-core/config-helpers.d.ts +0 -36
- package/dist/bundle-core/config-helpers.js +0 -57
- package/dist/bundle-core/errors.d.ts +0 -50
- package/dist/bundle-core/errors.js +0 -35
- package/dist/bundle-core/four-meme/approve-tokenmanager.d.ts +0 -7
- package/dist/bundle-core/four-meme/approve-tokenmanager.js +0 -99
- package/dist/bundle-core/four-meme/core-helpers.d.ts +0 -8
- package/dist/bundle-core/four-meme/core-helpers.js +0 -40
- package/dist/bundle-core/four-meme/core.d.ts +0 -4
- package/dist/bundle-core/four-meme/core.js +0 -515
- package/dist/bundle-core/four-meme/pancake-proxy.d.ts +0 -28
- package/dist/bundle-core/four-meme/pancake-proxy.js +0 -679
- package/dist/bundle-core/four-meme/private.d.ts +0 -27
- package/dist/bundle-core/four-meme/private.js +0 -465
- package/dist/bundle-core/four-meme/sign-context-helpers.d.ts +0 -2
- package/dist/bundle-core/four-meme/sign-context-helpers.js +0 -2
- package/dist/bundle-core/four-meme/swap-buy-first.d.ts +0 -8
- package/dist/bundle-core/four-meme/swap-buy-first.js +0 -493
- package/dist/bundle-core/four-meme/swap-hop-helpers.d.ts +0 -6
- package/dist/bundle-core/four-meme/swap-hop-helpers.js +0 -63
- package/dist/bundle-core/four-meme/swap-internal.d.ts +0 -3
- package/dist/bundle-core/four-meme/swap-internal.js +0 -18
- package/dist/bundle-core/four-meme/swap-sign-helpers.d.ts +0 -27
- package/dist/bundle-core/four-meme/swap-sign-helpers.js +0 -105
- package/dist/bundle-core/four-meme/swap.d.ts +0 -17
- package/dist/bundle-core/four-meme/swap.js +0 -505
- package/dist/bundle-core/four-meme/types/buy-first.d.ts +0 -50
- package/dist/bundle-core/four-meme/types/buy-first.js +0 -1
- package/dist/bundle-core/four-meme/types/core-flow.d.ts +0 -63
- package/dist/bundle-core/four-meme/types/core-flow.js +0 -1
- package/dist/bundle-core/four-meme/types/index.d.ts +0 -600
- package/dist/bundle-core/four-meme/types/index.js +0 -1
- package/dist/bundle-core/four-meme/types/swap-internal.d.ts +0 -19
- package/dist/bundle-core/four-meme/types/swap-internal.js +0 -1
- package/dist/bundle-core/four-meme/types.d.ts +0 -1
- package/dist/bundle-core/four-meme/types.js +0 -1
- package/dist/bundle-core/four-meme/utils-disperse.d.ts +0 -7
- package/dist/bundle-core/four-meme/utils-disperse.js +0 -396
- package/dist/bundle-core/four-meme/utils-pairwise.d.ts +0 -8
- package/dist/bundle-core/four-meme/utils-pairwise.js +0 -328
- package/dist/bundle-core/four-meme/utils-sweep.d.ts +0 -8
- package/dist/bundle-core/four-meme/utils-sweep.js +0 -744
- package/dist/bundle-core/index.d.ts +0 -8
- package/dist/bundle-core/index.js +0 -8
- package/dist/bundle-core/internal.d.ts +0 -21
- package/dist/bundle-core/internal.js +0 -182
- package/dist/bundle-core/sign-context-helpers.d.ts +0 -25
- package/dist/bundle-core/sign-context-helpers.js +0 -67
- package/dist/bundle-core/submit.d.ts +0 -293
- package/dist/bundle-core/submit.js +0 -727
- package/dist/bundle-core/types/index.d.ts +0 -8
- package/dist/bundle-core/types/index.js +0 -1
- package/dist/bundle-core/types.d.ts +0 -1
- package/dist/bundle-core/types.js +0 -1
- package/dist/chains/bsc/four/utils-disperse.d.ts +0 -1
- package/dist/chains/bsc/four/utils-disperse.js +0 -1
- package/dist/chains/bsc/four/utils-pairwise.d.ts +0 -1
- package/dist/chains/bsc/four/utils-pairwise.js +0 -1
- package/dist/chains/bsc/four/utils-sweep.d.ts +0 -1
- package/dist/chains/bsc/four/utils-sweep.js +0 -1
- package/dist/chains/bsc/iro.d.ts +0 -5
- package/dist/chains/bsc/iro.js +0 -4
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +0 -159
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +0 -117
- package/dist/chains/bsc/pancake/bundle-swap-helpers.d.ts +0 -241
- package/dist/chains/bsc/pancake/bundle-swap-helpers.js +0 -565
- package/dist/chains/eni/flat-aliases.d.ts +0 -10
- package/dist/chains/eni/flat-aliases.js +0 -8
- package/dist/chains/eni/submit.d.ts +0 -43
- package/dist/chains/eni/submit.js +0 -286
- package/dist/chains/xlayer/eip7702/flat-aliases.d.ts +0 -13
- package/dist/chains/xlayer/eip7702/flat-aliases.js +0 -10
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.d.ts +0 -79
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.js +0 -1
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.d.ts +0 -26
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.js +0 -57
- package/dist/chains/xlayer/eip7702/volume-helpers.d.ts +0 -148
- package/dist/chains/xlayer/eip7702/volume-helpers.js +0 -48
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts +0 -126
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +0 -228
- package/dist/contracts/tm-bundle-helpers.d.ts +0 -88
- package/dist/contracts/tm-bundle-helpers.js +0 -72
- package/dist/contracts/tm-bundle-merkle/utils-disperse.d.ts +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-disperse.js +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.d.ts +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.js +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-sweep.d.ts +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-sweep.js +0 -1
- package/dist/dex/direct-router-helpers.d.ts +0 -264
- package/dist/dex/direct-router-helpers.js +0 -539
- package/dist/dex/types.d.ts +0 -81
- package/dist/dex/types.js +0 -1
- package/dist/exports/root-bundle-and-tooling.d.ts +0 -27
- package/dist/exports/root-bundle-and-tooling.js +0 -30
- package/dist/exports/root-eni-and-bsc-iro.d.ts +0 -26
- package/dist/exports/root-eni-and-bsc-iro.js +0 -66
- package/dist/exports/root-foundations.d.ts +0 -35
- package/dist/exports/root-foundations.js +0 -70
- package/dist/exports/root-swap-dex-and-xlayer.d.ts +0 -30
- package/dist/exports/root-swap-dex-and-xlayer.js +0 -78
- package/dist/flap/index.d.ts +0 -10
- package/dist/flap/index.js +0 -8
- package/dist/flows/index.d.ts +0 -1
- package/dist/flows/index.js +0 -1
- package/dist/merkle/index.d.ts +0 -12
- package/dist/merkle/index.js +0 -11
- package/dist/shared/clients/index.d.ts +0 -8
- package/dist/shared/clients/index.js +0 -8
- package/dist/shared/constants/quote.d.ts +0 -30
- package/dist/shared/constants/quote.js +0 -37
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.d.ts +0 -32
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.js +0 -83
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +0 -125
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.js +0 -113
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.d.ts +0 -149
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.js +0 -259
- package/dist/shared/flap/portal-create-token.d.ts +0 -79
- package/dist/shared/flap/portal-create-token.js +0 -261
- package/dist/shared/foundation/dex/v3-path.d.ts +0 -6
- package/dist/shared/foundation/dex/v3-path.js +0 -35
- package/dist/shared/foundation/gas/bundle-gas.d.ts +0 -49
- package/dist/shared/foundation/gas/bundle-gas.js +0 -93
- package/dist/shared/foundation/gas/profit-hop.d.ts +0 -20
- package/dist/shared/foundation/gas/profit-hop.js +0 -72
- package/dist/shared/foundation/index.d.ts +0 -13
- package/dist/shared/foundation/index.js +0 -12
- package/dist/shared/foundation/nonce/nonce-manager.d.ts +0 -17
- package/dist/shared/foundation/nonce/nonce-manager.js +0 -183
- package/dist/shared/foundation/normalize-unknown.d.ts +0 -9
- package/dist/shared/foundation/normalize-unknown.js +0 -29
- package/dist/shared/foundation/sdk-logger.d.ts +0 -13
- package/dist/shared/foundation/sdk-logger.js +0 -12
- package/dist/shared/foundation/tx/build-request.d.ts +0 -17
- package/dist/shared/foundation/tx/build-request.js +0 -25
- package/dist/shared/foundation/tx/sign-batch.d.ts +0 -5
- package/dist/shared/foundation/tx/sign-batch.js +0 -26
- package/dist/shared/foundation/tx/wallet-sign-patch.d.ts +0 -1
- package/dist/shared/foundation/tx/wallet-sign-patch.js +0 -18
- package/dist/shared/foundation/types/airdrop-sweep.d.ts +0 -79
- package/dist/shared/foundation/types/airdrop-sweep.js +0 -1
- package/dist/shared/foundation/types/erc20.d.ts +0 -65
- package/dist/shared/foundation/types/erc20.js +0 -1
- package/dist/shared/foundation/types/holders-maker.d.ts +0 -64
- package/dist/shared/foundation/types/holders-maker.js +0 -1
- package/dist/shared/foundation/types/index.d.ts +0 -7
- package/dist/shared/foundation/types/index.js +0 -1
- package/dist/shared/foundation/types/lp-inspect.d.ts +0 -102
- package/dist/shared/foundation/types/lp-inspect.js +0 -1
- package/dist/shared/foundation/types/multicall.d.ts +0 -5
- package/dist/shared/foundation/types/multicall.js +0 -1
- package/dist/shared/foundation/types/private-sale.d.ts +0 -35
- package/dist/shared/foundation/types/private-sale.js +0 -1
- package/dist/shared/foundation/types/quote-helpers.d.ts +0 -17
- package/dist/shared/foundation/types/quote-helpers.js +0 -1
- package/dist/types/errors.d.ts +0 -27
- package/dist/types/errors.js +0 -34
- package/dist/utils/holders-maker/addresses.d.ts +0 -12
- package/dist/utils/holders-maker/addresses.js +0 -15
- package/dist/utils/holders-maker/buy-tx.d.ts +0 -44
- package/dist/utils/holders-maker/buy-tx.js +0 -278
- package/dist/utils/holders-maker/constants.d.ts +0 -6
- package/dist/utils/holders-maker/constants.js +0 -7
- package/dist/utils/holders-maker/disperse.d.ts +0 -18
- package/dist/utils/holders-maker/disperse.js +0 -90
- package/dist/utils/holders-maker/routing.d.ts +0 -4
- package/dist/utils/holders-maker/routing.js +0 -45
- package/dist/utils/holders-maker/transfer-tx.d.ts +0 -4
- package/dist/utils/holders-maker/transfer-tx.js +0 -67
- package/dist/utils/holders-maker-helpers.d.ts +0 -9
- package/dist/utils/holders-maker-helpers.js +0 -9
- package/dist/utils/hop-chains.d.ts +0 -35
- package/dist/utils/hop-chains.js +0 -215
- package/dist/utils/lp-inspect-helpers.d.ts +0 -9
- package/dist/utils/lp-inspect-helpers.js +0 -109
- package/dist/utils/types/airdrop-sweep.d.ts +0 -1
- package/dist/utils/types/airdrop-sweep.js +0 -1
- package/dist/utils/types/contract-factory.d.ts +0 -1
- package/dist/utils/types/contract-factory.js +0 -1
- package/dist/utils/types/erc20.d.ts +0 -1
- package/dist/utils/types/erc20.js +0 -1
- package/dist/utils/types/errors.d.ts +0 -1
- package/dist/utils/types/errors.js +0 -1
- package/dist/utils/types/holders-maker.d.ts +0 -1
- package/dist/utils/types/holders-maker.js +0 -1
- package/dist/utils/types/hop-chains.d.ts +0 -8
- package/dist/utils/types/hop-chains.js +0 -1
- package/dist/utils/types/index.d.ts +0 -13
- package/dist/utils/types/index.js +0 -1
- package/dist/utils/types/lp-inspect.d.ts +0 -1
- package/dist/utils/types/lp-inspect.js +0 -1
- package/dist/utils/types/mpc-exclusive.d.ts +0 -5
- package/dist/utils/types/mpc-exclusive.js +0 -1
- package/dist/utils/types/private-sale.d.ts +0 -1
- package/dist/utils/types/private-sale.js +0 -1
- package/dist/utils/types/quote-helpers.d.ts +0 -1
- package/dist/utils/types/quote-helpers.js +0 -1
- package/dist/utils/types/stealth-transfer.d.ts +0 -44
- package/dist/utils/types/stealth-transfer.js +0 -1
- package/dist/utils/types/wallet.d.ts +0 -25
- package/dist/utils/types/wallet.js +0 -1
- package/dist/vanity/index.d.ts +0 -5
- package/dist/vanity/index.js +0 -5
- package/src/abis/contracts/TaxToken.json +0 -969
- package/src/abis/contracts/TokenManager.json +0 -836
- package/src/abis/contracts/TokenManager2.json +0 -136
- package/src/abis/contracts/TokenManagerHelper3.json +0 -993
- /package/dist/{abis/contracts → shared/abis}/TokenManager.json +0 -0
- /package/dist/{abis/contracts → shared/abis}/TokenManagerHelper3.json +0 -0
|
@@ -4,8 +4,6 @@ import { ethers } from 'ethers';
|
|
|
4
4
|
* 48.club Bundle 客户端
|
|
5
5
|
*/
|
|
6
6
|
export class Club48Client {
|
|
7
|
-
endpoint;
|
|
8
|
-
explorerEndpoint;
|
|
9
7
|
constructor(config) {
|
|
10
8
|
this.endpoint = config?.endpoint || 'https://puissant-bsc.48.club';
|
|
11
9
|
this.explorerEndpoint = config?.explorerEndpoint || 'https://explore.48.club';
|
|
@@ -20,7 +18,7 @@ export class Club48Client {
|
|
|
20
18
|
*/
|
|
21
19
|
static sign48SoulPoint(privateKey, txs) {
|
|
22
20
|
// 1. 计算每笔交易的哈希
|
|
23
|
-
const txHashes = txs.map(
|
|
21
|
+
const txHashes = txs.map(tx => ethers.keccak256(tx));
|
|
24
22
|
// 2. 连接所有哈希
|
|
25
23
|
const concatenated = ethers.concat(txHashes);
|
|
26
24
|
// 3. 对连接后的数据进行哈希
|
|
@@ -105,7 +103,7 @@ export class Club48Client {
|
|
|
105
103
|
}
|
|
106
104
|
// 添加 Soul Point 签名(优先:调用方直接提供;否则按 opts 生成)
|
|
107
105
|
if (params.soulPointSignature) {
|
|
108
|
-
bundleParams[
|
|
106
|
+
bundleParams["48spSign"] = params.soulPointSignature;
|
|
109
107
|
}
|
|
110
108
|
else if (opts && opts.spMode && opts.spMode !== 'none') {
|
|
111
109
|
if (!opts.spPrivateKey) {
|
|
@@ -123,17 +121,17 @@ export class Club48Client {
|
|
|
123
121
|
}
|
|
124
122
|
if (opts.spVMode)
|
|
125
123
|
sig = Club48Client.normalizeSignatureV(sig, opts.spVMode);
|
|
126
|
-
bundleParams[
|
|
124
|
+
bundleParams["48spSign"] = sig;
|
|
127
125
|
}
|
|
128
126
|
// 添加 backrun 目标(如果提供)
|
|
129
127
|
if (params.backrunTarget) {
|
|
130
128
|
bundleParams.backrunTarget = params.backrunTarget;
|
|
131
129
|
}
|
|
132
130
|
const response = await axios.post(this.endpoint, {
|
|
133
|
-
jsonrpc:
|
|
131
|
+
jsonrpc: "2.0",
|
|
134
132
|
id: 1,
|
|
135
|
-
method:
|
|
136
|
-
params: [bundleParams]
|
|
133
|
+
method: "eth_sendBundle",
|
|
134
|
+
params: [bundleParams]
|
|
137
135
|
});
|
|
138
136
|
if (response.data.error) {
|
|
139
137
|
throw new Error(`48.club bundle failed: ${response.data.error.message}`);
|
|
@@ -148,10 +146,10 @@ export class Club48Client {
|
|
|
148
146
|
*/
|
|
149
147
|
async sendPrivateTransaction(signedTx) {
|
|
150
148
|
const response = await axios.post(this.endpoint, {
|
|
151
|
-
jsonrpc:
|
|
149
|
+
jsonrpc: "2.0",
|
|
152
150
|
id: 1,
|
|
153
|
-
method:
|
|
154
|
-
params: [signedTx]
|
|
151
|
+
method: "eth_sendPrivateRawTransaction",
|
|
152
|
+
params: [signedTx]
|
|
155
153
|
});
|
|
156
154
|
if (response.data.error) {
|
|
157
155
|
throw new Error(`48.club tx failed: ${response.data.error.message}`);
|
|
@@ -170,7 +168,7 @@ export class Club48Client {
|
|
|
170
168
|
async sendPrivateTransactionWith48SP(signedTx, spPrivateKey, opts) {
|
|
171
169
|
// 1) 生成 48SP 签名(默认使用 timestamp personal_sign)
|
|
172
170
|
const mode = opts?.spMode ?? 'timestampPersonalSign';
|
|
173
|
-
let signature;
|
|
171
|
+
let signature = '';
|
|
174
172
|
if (mode === 'timestampPersonalSign') {
|
|
175
173
|
signature = await Club48Client.sign48SoulPointTimestamp(spPrivateKey, opts?.timestamp);
|
|
176
174
|
}
|
|
@@ -181,10 +179,10 @@ export class Club48Client {
|
|
|
181
179
|
signature = Club48Client.normalizeSignatureV(signature, opts.spVMode);
|
|
182
180
|
// 2) 调用 48.club RPC
|
|
183
181
|
const response = await axios.post(this.endpoint, {
|
|
184
|
-
jsonrpc:
|
|
182
|
+
jsonrpc: "2.0",
|
|
185
183
|
id: 1,
|
|
186
|
-
method:
|
|
187
|
-
params: [signedTx, signature]
|
|
184
|
+
method: "eth_sendPrivateTransactionWith48SP",
|
|
185
|
+
params: [signedTx, signature]
|
|
188
186
|
});
|
|
189
187
|
if (response.data.error) {
|
|
190
188
|
throw new Error(`48.club tx failed: ${response.data.error.message}`);
|
|
@@ -198,9 +196,9 @@ export class Club48Client {
|
|
|
198
196
|
*/
|
|
199
197
|
async getMinGasPrice() {
|
|
200
198
|
const response = await axios.post(this.endpoint, {
|
|
201
|
-
jsonrpc:
|
|
199
|
+
jsonrpc: "2.0",
|
|
202
200
|
id: 1,
|
|
203
|
-
method:
|
|
201
|
+
method: "eth_gasPrice"
|
|
204
202
|
});
|
|
205
203
|
if (response.data.error) {
|
|
206
204
|
throw new Error(`Get gas price failed: ${response.data.error.message}`);
|
|
@@ -239,15 +237,12 @@ export class Club48Client {
|
|
|
239
237
|
throw new Error(`Bundle failed to execute: ${JSON.stringify(status)}`);
|
|
240
238
|
}
|
|
241
239
|
// 等待 3 秒后重试
|
|
242
|
-
await new Promise(
|
|
240
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
243
241
|
}
|
|
244
242
|
catch (error) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
: '';
|
|
249
|
-
if (status === 404 || nodeCode === 'ECONNREFUSED' || nodeCode === 'ENOTFOUND') {
|
|
250
|
-
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
243
|
+
// 如果是 404 或网络错误,继续等待(可能是 explorer 还没索引到)
|
|
244
|
+
if (error.response?.status === 404 || error.code === 'ECONNREFUSED' || error.code === 'ENOTFOUND') {
|
|
245
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
251
246
|
continue;
|
|
252
247
|
}
|
|
253
248
|
// 其他错误,如果有最后状态且为 INCLUDED,返回成功
|
|
@@ -273,8 +268,8 @@ export class Club48Client {
|
|
|
273
268
|
transaction: {
|
|
274
269
|
from: '0x0000000000000000000000000000000000000000',
|
|
275
270
|
gasPrice: '0',
|
|
276
|
-
nonce: 0
|
|
277
|
-
}
|
|
271
|
+
nonce: 0
|
|
272
|
+
}
|
|
278
273
|
};
|
|
279
274
|
}
|
|
280
275
|
}
|
|
@@ -287,11 +282,11 @@ export function createAuctionFeedClient(wsUrl, callbacks) {
|
|
|
287
282
|
// 仅导出接口占位,避免引入 ws 依赖;用户可在应用层实现
|
|
288
283
|
return {
|
|
289
284
|
connect: () => {
|
|
290
|
-
callbacks.onOpen
|
|
285
|
+
callbacks.onOpen && callbacks.onOpen();
|
|
291
286
|
},
|
|
292
287
|
close: () => {
|
|
293
|
-
callbacks.onClose
|
|
294
|
-
}
|
|
288
|
+
callbacks.onClose && callbacks.onClose();
|
|
289
|
+
}
|
|
295
290
|
};
|
|
296
291
|
}
|
|
297
292
|
/**
|
|
@@ -300,7 +295,7 @@ export function createAuctionFeedClient(wsUrl, callbacks) {
|
|
|
300
295
|
export async function sendBatchPrivateTransactions(signedTxs, spPrivateKey, endpoint = 'https://puissant-bsc.48.club', opts) {
|
|
301
296
|
// 1. 生成 48SP 签名
|
|
302
297
|
const mode = opts?.spMode ?? 'timestampPersonalSign';
|
|
303
|
-
let signature;
|
|
298
|
+
let signature = '';
|
|
304
299
|
if (mode === 'timestampPersonalSign') {
|
|
305
300
|
signature = await Club48Client.sign48SoulPointTimestamp(spPrivateKey, opts?.timestamp);
|
|
306
301
|
}
|
|
@@ -311,13 +306,13 @@ export async function sendBatchPrivateTransactions(signedTxs, spPrivateKey, endp
|
|
|
311
306
|
signature = Club48Client.normalizeSignatureV(signature, opts.spVMode);
|
|
312
307
|
// 2. 批量提交
|
|
313
308
|
const response = await axios.post(endpoint, {
|
|
314
|
-
jsonrpc:
|
|
309
|
+
jsonrpc: "2.0",
|
|
315
310
|
id: 1,
|
|
316
|
-
method:
|
|
311
|
+
method: "eth_sendBatchPrivateTransactionsWith48SP",
|
|
317
312
|
params: [
|
|
318
313
|
signedTxs, // 已签名的交易数组
|
|
319
|
-
signature
|
|
320
|
-
]
|
|
314
|
+
signature // 48SP 签名
|
|
315
|
+
]
|
|
321
316
|
});
|
|
322
317
|
// 注意:批量方法不返回交易哈希,只确认接收
|
|
323
318
|
if (response.data.error) {
|
|
@@ -87,26 +87,14 @@ export type CreateTokenReq = {
|
|
|
87
87
|
funGroup: false;
|
|
88
88
|
clickFun: false;
|
|
89
89
|
};
|
|
90
|
-
export type FourJsonValue = string | number | boolean | null | FourJsonValue[] | {
|
|
91
|
-
[key: string]: FourJsonValue;
|
|
92
|
-
};
|
|
93
|
-
export type FourPublicConfig = {
|
|
94
|
-
[key: string]: FourJsonValue;
|
|
95
|
-
};
|
|
96
|
-
export type FourTokenDetail = {
|
|
97
|
-
[key: string]: FourJsonValue;
|
|
98
|
-
} & {
|
|
99
|
-
address?: string;
|
|
100
|
-
name?: string;
|
|
101
|
-
symbol?: string;
|
|
102
|
-
};
|
|
103
90
|
export type CreateTokenResp = {
|
|
104
91
|
createArg: string;
|
|
105
92
|
signature: string;
|
|
106
93
|
tokenAddr?: string;
|
|
107
94
|
address?: string;
|
|
108
95
|
token?: string;
|
|
109
|
-
|
|
96
|
+
[key: string]: any;
|
|
97
|
+
};
|
|
110
98
|
export declare class FourClient {
|
|
111
99
|
private baseUrl;
|
|
112
100
|
private uploadUrls;
|
|
@@ -136,12 +124,9 @@ export declare class FourClient {
|
|
|
136
124
|
private isCorsOrNetworkError;
|
|
137
125
|
private getFilenameFromBlob;
|
|
138
126
|
createToken(accessToken: string, req: CreateTokenReq): Promise<CreateTokenResp>;
|
|
139
|
-
getPublicConfig(): Promise<
|
|
140
|
-
getTokenByAddress(address: string, accessToken?: string): Promise<
|
|
141
|
-
getTokensByAddresses(addresses: string[], accessToken?: string): Promise<
|
|
142
|
-
|
|
143
|
-
error: string;
|
|
144
|
-
})[]>;
|
|
145
|
-
getTokenById(id: string | number, accessToken?: string): Promise<FourTokenDetail>;
|
|
127
|
+
getPublicConfig(): Promise<any>;
|
|
128
|
+
getTokenByAddress(address: string, accessToken?: string): Promise<any>;
|
|
129
|
+
getTokensByAddresses(addresses: string[], accessToken?: string): Promise<any[]>;
|
|
130
|
+
getTokenById(id: string | number, accessToken?: string): Promise<any>;
|
|
146
131
|
}
|
|
147
132
|
export declare function buildLoginMessage(nonce: string): string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getErrorMessageFromUnknown } from '../foundation/index.js';
|
|
2
1
|
// ============================================================================
|
|
3
2
|
// 图片上传缓存(按内容哈希去重,同一张图片只上传一次)
|
|
4
3
|
// ✅ 使用 localStorage 持久化,刷新页面 / 重启浏览器后缓存仍然有效
|
|
@@ -39,9 +38,7 @@ function saveCache() {
|
|
|
39
38
|
return;
|
|
40
39
|
const cache = loadCache();
|
|
41
40
|
const obj = {};
|
|
42
|
-
cache.forEach((v, k) => {
|
|
43
|
-
obj[k] = v;
|
|
44
|
-
});
|
|
41
|
+
cache.forEach((v, k) => { obj[k] = v; });
|
|
45
42
|
localStorage.setItem(UPLOAD_CACHE_KEY, JSON.stringify(obj));
|
|
46
43
|
}
|
|
47
44
|
catch {
|
|
@@ -75,7 +72,7 @@ async function hashBlob(blob) {
|
|
|
75
72
|
const buffer = await blob.arrayBuffer();
|
|
76
73
|
const hashBuffer = await crypto.subtle.digest('SHA-256', buffer);
|
|
77
74
|
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
78
|
-
return hashArray.map(
|
|
75
|
+
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
|
79
76
|
}
|
|
80
77
|
/** IP 限流错误码 */
|
|
81
78
|
const RATE_LIMIT_CODE = -1038;
|
|
@@ -87,8 +84,6 @@ const RATE_LIMIT_CODE = -1038;
|
|
|
87
84
|
*/
|
|
88
85
|
const FOUR_MEME_OFFICIAL_API = 'https://four.meme/meme-api';
|
|
89
86
|
export class FourClient {
|
|
90
|
-
baseUrl;
|
|
91
|
-
uploadUrls;
|
|
92
87
|
constructor(cfg) {
|
|
93
88
|
// 默认使用 Cloudflare Workers 代理,已配置 CORS,浏览器可直接使用
|
|
94
89
|
this.baseUrl = cfg?.baseUrl || 'https://bscfourapi.emit.tools';
|
|
@@ -140,6 +135,7 @@ export class FourClient {
|
|
|
140
135
|
const hash = await hashBlob(file);
|
|
141
136
|
const cached = getCachedUrl(hash);
|
|
142
137
|
if (cached) {
|
|
138
|
+
console.log(`[FourClient] 图片命中缓存,跳过上传 (hash: ${hash.slice(0, 12)}...)`);
|
|
143
139
|
return cached;
|
|
144
140
|
}
|
|
145
141
|
const finalFilename = filename || this.getFilenameFromBlob(file);
|
|
@@ -152,20 +148,22 @@ export class FourClient {
|
|
|
152
148
|
const imgUrl = await this.doUpload(baseUrl, accessToken, file, finalFilename);
|
|
153
149
|
// 上传成功,写入持久化缓存(localStorage)
|
|
154
150
|
setCachedUrl(hash, imgUrl);
|
|
151
|
+
if (i > 0) {
|
|
152
|
+
console.log(`[FourClient] 使用${isOfficial ? '官方直连' : '备用'}端点上传成功: ${baseUrl}`);
|
|
153
|
+
}
|
|
155
154
|
return imgUrl;
|
|
156
155
|
}
|
|
157
156
|
catch (e) {
|
|
158
|
-
|
|
159
|
-
lastError = err;
|
|
157
|
+
lastError = e;
|
|
160
158
|
const canRetry = i < this.uploadUrls.length - 1;
|
|
161
|
-
if (this.isRateLimitError(
|
|
159
|
+
if (this.isRateLimitError(e) && canRetry) {
|
|
162
160
|
// IP 限流 → 切下一个端点
|
|
163
161
|
const nextUrl = this.uploadUrls[i + 1];
|
|
164
162
|
const nextLabel = nextUrl === FOUR_MEME_OFFICIAL_API ? '官方直连' : `备用端点 #${i + 2}`;
|
|
165
163
|
console.warn(`[FourClient] 端点 ${baseUrl} 触发 IP 限流(100次/天),切换到${nextLabel}...`);
|
|
166
164
|
continue;
|
|
167
165
|
}
|
|
168
|
-
if (this.isCorsOrNetworkError(
|
|
166
|
+
if (this.isCorsOrNetworkError(e) && canRetry) {
|
|
169
167
|
// CORS/网络错误(常见于浏览器直连官方 API)→ 跳过,继续尝试下一个
|
|
170
168
|
console.warn(`[FourClient] 端点 ${baseUrl} 请求失败(${isOfficial ? 'CORS限制' : '网络错误'}),跳过`);
|
|
171
169
|
continue;
|
|
@@ -179,11 +177,9 @@ export class FourClient {
|
|
|
179
177
|
if (isRateLimit) {
|
|
180
178
|
throw new Error(`图片上传失败:所有端点均触发 IP 限流(每IP每天100次)。` +
|
|
181
179
|
`请等待次日重置,或在 FourConfig.uploadFallbackUrls 中添加不同 IP 的备用代理。` +
|
|
182
|
-
`\n原始错误: ${
|
|
180
|
+
`\n原始错误: ${lastError.message}`);
|
|
183
181
|
}
|
|
184
|
-
|
|
185
|
-
throw lastError;
|
|
186
|
-
throw new Error('upload failed: all endpoints exhausted');
|
|
182
|
+
throw lastError || new Error('upload failed: all endpoints exhausted');
|
|
187
183
|
}
|
|
188
184
|
/**
|
|
189
185
|
* 执行单次上传请求
|
|
@@ -198,9 +194,9 @@ export class FourClient {
|
|
|
198
194
|
});
|
|
199
195
|
const j = await r.json();
|
|
200
196
|
if (j.code !== '0' && j.code !== 0) {
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
throw
|
|
197
|
+
const err = new Error(`upload failed: ${JSON.stringify(j)}`);
|
|
198
|
+
err.apiCode = typeof j.code === 'string' ? parseInt(j.code, 10) : j.code;
|
|
199
|
+
throw err;
|
|
204
200
|
}
|
|
205
201
|
return j.data; // imgUrl
|
|
206
202
|
}
|
|
@@ -208,13 +204,12 @@ export class FourClient {
|
|
|
208
204
|
* 判断是否为 IP 限流错误(code: -1038)
|
|
209
205
|
*/
|
|
210
206
|
isRateLimitError(e) {
|
|
211
|
-
if (e
|
|
212
|
-
typeof e === 'object' &&
|
|
213
|
-
'apiCode' in e &&
|
|
214
|
-
e.apiCode === RATE_LIMIT_CODE) {
|
|
207
|
+
if (e?.apiCode === RATE_LIMIT_CODE)
|
|
215
208
|
return true;
|
|
216
|
-
|
|
217
|
-
|
|
209
|
+
// 兼容:从 message 中检测
|
|
210
|
+
if (typeof e?.message === 'string' && e.message.includes('-1038'))
|
|
211
|
+
return true;
|
|
212
|
+
return false;
|
|
218
213
|
}
|
|
219
214
|
/**
|
|
220
215
|
* 判断是否为 CORS 或网络错误
|
|
@@ -223,7 +218,7 @@ export class FourClient {
|
|
|
223
218
|
isCorsOrNetworkError(e) {
|
|
224
219
|
if (e instanceof TypeError)
|
|
225
220
|
return true; // fetch CORS / network failure
|
|
226
|
-
const msg =
|
|
221
|
+
const msg = e?.message?.toLowerCase?.() || '';
|
|
227
222
|
return msg.includes('failed to fetch') || msg.includes('network') || msg.includes('cors');
|
|
228
223
|
}
|
|
229
224
|
getFilenameFromBlob(blob) {
|
|
@@ -252,7 +247,7 @@ export class FourClient {
|
|
|
252
247
|
}
|
|
253
248
|
async getPublicConfig() {
|
|
254
249
|
const r = await fetch(`${this.baseUrl}/v1/public/config`);
|
|
255
|
-
return
|
|
250
|
+
return await r.json();
|
|
256
251
|
}
|
|
257
252
|
async getTokenByAddress(address, accessToken) {
|
|
258
253
|
const r = await fetch(`${this.baseUrl}/v1/private/token/get?address=${address}`, {
|
|
@@ -262,12 +257,12 @@ export class FourClient {
|
|
|
262
257
|
if (j.code && j.code !== '0' && j.code !== 0) {
|
|
263
258
|
throw new Error(`getTokenByAddress failed: ${JSON.stringify(j)}`);
|
|
264
259
|
}
|
|
265
|
-
return
|
|
260
|
+
return j.data ?? j;
|
|
266
261
|
}
|
|
267
262
|
async getTokensByAddresses(addresses, accessToken) {
|
|
268
263
|
if (!Array.isArray(addresses) || addresses.length === 0)
|
|
269
264
|
return [];
|
|
270
|
-
const tasks = addresses.map((addr) => this.getTokenByAddress(addr, accessToken).catch((e) => ({ address: addr, error:
|
|
265
|
+
const tasks = addresses.map((addr) => this.getTokenByAddress(addr, accessToken).catch((e) => ({ address: addr, error: String(e) })));
|
|
271
266
|
return await Promise.all(tasks);
|
|
272
267
|
}
|
|
273
268
|
async getTokenById(id, accessToken) {
|
|
@@ -278,7 +273,7 @@ export class FourClient {
|
|
|
278
273
|
if (j.code && j.code !== '0' && j.code !== 0) {
|
|
279
274
|
throw new Error(`getTokenById failed: ${JSON.stringify(j)}`);
|
|
280
275
|
}
|
|
281
|
-
return
|
|
276
|
+
return j.data ?? j;
|
|
282
277
|
}
|
|
283
278
|
}
|
|
284
279
|
export function buildLoginMessage(nonce) {
|
|
@@ -22,19 +22,14 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { JsonRpcProvider, Transaction } from 'ethers';
|
|
24
24
|
import { CHAINS } from '../constants/index.js';
|
|
25
|
-
import { getErrorMessageFromUnknown } from '../foundation/index.js';
|
|
26
25
|
/**
|
|
27
26
|
* Merkle 客户端
|
|
28
27
|
*/
|
|
29
28
|
export class MerkleClient {
|
|
30
|
-
provider;
|
|
31
|
-
chainId;
|
|
32
|
-
chainName;
|
|
33
|
-
// ✅ 区块号缓存(减少 RPC 调用)
|
|
34
|
-
// 注意:TTL 设为 1 秒,确保区块号尽可能新鲜,减少 "Missed inclusion" 风险
|
|
35
|
-
blockNumberCache = null;
|
|
36
|
-
static BLOCK_CACHE_TTL_MS = 1000; // 1秒缓存(BSC 约 3 秒出块,ETH 约 12 秒)
|
|
37
29
|
constructor(config) {
|
|
30
|
+
// ✅ 区块号缓存(减少 RPC 调用)
|
|
31
|
+
// 注意:TTL 设为 1 秒,确保区块号尽可能新鲜,减少 "Missed inclusion" 风险
|
|
32
|
+
this.blockNumberCache = null;
|
|
38
33
|
this.chainId = config.chainId;
|
|
39
34
|
this.chainName = config.chainId === CHAINS.BSC.chainId ? 'bsc' : 'ethereum';
|
|
40
35
|
// ✅ 修复:移除弃用的 mempool.merkle.io RPC,使用公共 RPC 作为默认值
|
|
@@ -83,18 +78,23 @@ export class MerkleClient {
|
|
|
83
78
|
* 获取网络状态(用于 Bundle 参数优化)
|
|
84
79
|
*/
|
|
85
80
|
async getNetworkStatus() {
|
|
86
|
-
const [currentBlock, feeData] = await Promise.all([
|
|
81
|
+
const [currentBlock, feeData] = await Promise.all([
|
|
82
|
+
this.getBlockNumber(),
|
|
83
|
+
this.getFeeData()
|
|
84
|
+
]);
|
|
87
85
|
// 动态获取 gas price,并计算建议的最小值
|
|
88
86
|
const baseGasPrice = feeData.gasPrice || feeData.maxFeePerGas || 3000000000n;
|
|
89
87
|
// 建议至少提高 80% 以确保交易被打包
|
|
90
88
|
const suggestedMinGasPrice = (baseGasPrice * 180n) / 100n;
|
|
91
89
|
// BSC 平均 3 秒,Ethereum 平均 12 秒
|
|
92
|
-
const avgBlockTime = this.chainId === CHAINS.BSC.chainId
|
|
90
|
+
const avgBlockTime = this.chainId === CHAINS.BSC.chainId
|
|
91
|
+
? CHAINS.BSC.blockTime / 1000
|
|
92
|
+
: CHAINS.ETHEREUM.blockTime / 1000;
|
|
93
93
|
return {
|
|
94
94
|
currentBlock,
|
|
95
95
|
gasPrice: baseGasPrice,
|
|
96
96
|
suggestedMinGasPrice,
|
|
97
|
-
avgBlockTime
|
|
97
|
+
avgBlockTime
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
@@ -139,7 +139,9 @@ export class MerkleClient {
|
|
|
139
139
|
throw new Error('Invalid bundle result format');
|
|
140
140
|
}
|
|
141
141
|
catch (error) {
|
|
142
|
-
|
|
142
|
+
// 增强错误信息
|
|
143
|
+
const errorMsg = error.message || String(error);
|
|
144
|
+
throw new Error(`Send bundle failed: ${errorMsg}`);
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
/**
|
|
@@ -170,7 +172,7 @@ export class MerkleClient {
|
|
|
170
172
|
if (targetBlock <= currentBlock) {
|
|
171
173
|
if (autoRetry && attempt < maxRetries) {
|
|
172
174
|
attempt++;
|
|
173
|
-
await new Promise(
|
|
175
|
+
await new Promise(resolve => setTimeout(resolve, 300)); // 短暂延迟
|
|
174
176
|
continue;
|
|
175
177
|
}
|
|
176
178
|
throw new Error(`Target block ${targetBlock} has already passed (current block: ${currentBlock})`);
|
|
@@ -192,7 +194,7 @@ export class MerkleClient {
|
|
|
192
194
|
maxTimestamp: options.maxTimestamp,
|
|
193
195
|
});
|
|
194
196
|
// ✅ 优化:并行提取交易哈希(map 比 for 循环更高效)
|
|
195
|
-
const txHashes = options.transactions.map(
|
|
197
|
+
const txHashes = options.transactions.map(rawTx => {
|
|
196
198
|
try {
|
|
197
199
|
return Transaction.from(rawTx).hash || '';
|
|
198
200
|
}
|
|
@@ -213,8 +215,10 @@ export class MerkleClient {
|
|
|
213
215
|
if (autoRetry && attempt < maxRetries) {
|
|
214
216
|
attempt++;
|
|
215
217
|
// 等待一个区块时间再重试
|
|
216
|
-
const blockTime = this.chainId === CHAINS.BSC.chainId
|
|
217
|
-
|
|
218
|
+
const blockTime = this.chainId === CHAINS.BSC.chainId
|
|
219
|
+
? CHAINS.BSC.blockTime
|
|
220
|
+
: CHAINS.ETHEREUM.blockTime;
|
|
221
|
+
await new Promise(resolve => setTimeout(resolve, blockTime));
|
|
218
222
|
continue;
|
|
219
223
|
}
|
|
220
224
|
// 没有重试或已达最大重试次数
|
|
@@ -222,10 +226,7 @@ export class MerkleClient {
|
|
|
222
226
|
}
|
|
223
227
|
}
|
|
224
228
|
// 如果执行到这里,说明所有重试都失败了
|
|
225
|
-
|
|
226
|
-
throw lastError;
|
|
227
|
-
}
|
|
228
|
-
throw new Error('Bundle submission failed after all retries');
|
|
229
|
+
throw lastError || new Error('Bundle submission failed after all retries');
|
|
229
230
|
}
|
|
230
231
|
/**
|
|
231
232
|
* 等待 Bundle 中的交易确认
|
|
@@ -256,7 +257,7 @@ export class MerkleClient {
|
|
|
256
257
|
const costEth = Number(costWei) / 1e18;
|
|
257
258
|
gasCost = costEth.toFixed(8); // 增加精度到 8 位小数
|
|
258
259
|
}
|
|
259
|
-
catch {
|
|
260
|
+
catch (error) {
|
|
260
261
|
// 如果计算溢出,使用字符串处理
|
|
261
262
|
const costWei = receipt.gasUsed * receipt.gasPrice;
|
|
262
263
|
gasCost = (Number(costWei / 1000000000n) / 1e9).toFixed(8);
|
|
@@ -277,7 +278,7 @@ export class MerkleClient {
|
|
|
277
278
|
index,
|
|
278
279
|
hash,
|
|
279
280
|
success: false,
|
|
280
|
-
error:
|
|
281
|
+
error: error.message,
|
|
281
282
|
};
|
|
282
283
|
}
|
|
283
284
|
});
|
|
@@ -350,6 +351,7 @@ export class MerkleClient {
|
|
|
350
351
|
*/
|
|
351
352
|
async waitForBlock(targetBlock, maxAttempts = 10, intervalMs = 1000) {
|
|
352
353
|
let attempts = 0;
|
|
354
|
+
let lastError = null;
|
|
353
355
|
while (attempts < maxAttempts) {
|
|
354
356
|
try {
|
|
355
357
|
const currentBlock = await this.getBlockNumber();
|
|
@@ -364,27 +366,32 @@ export class MerkleClient {
|
|
|
364
366
|
return false;
|
|
365
367
|
}
|
|
366
368
|
}
|
|
367
|
-
catch {
|
|
368
|
-
|
|
369
|
+
catch (error) {
|
|
370
|
+
lastError = error;
|
|
371
|
+
// 继续重试
|
|
369
372
|
}
|
|
370
373
|
// 等待下一次检查
|
|
371
|
-
await new Promise(
|
|
374
|
+
await new Promise(resolve => setTimeout(resolve, intervalMs));
|
|
372
375
|
attempts++;
|
|
373
376
|
}
|
|
377
|
+
// 达到最大尝试次数
|
|
378
|
+
if (lastError) {
|
|
379
|
+
}
|
|
374
380
|
return false;
|
|
375
381
|
}
|
|
376
382
|
/**
|
|
377
383
|
* 获取当前 Provider 的统计信息(用于调试)
|
|
378
384
|
*/
|
|
379
385
|
getProviderInfo() {
|
|
380
|
-
const rpcConnection = this.provider._getConnection?.();
|
|
381
386
|
return {
|
|
382
387
|
chainId: this.chainId,
|
|
383
388
|
chainName: this.chainName,
|
|
384
|
-
|
|
389
|
+
// @ts-ignore - 访问私有属性用于调试
|
|
390
|
+
rpcUrl: this.provider._getConnection?.().url || 'unknown',
|
|
385
391
|
};
|
|
386
392
|
}
|
|
387
393
|
}
|
|
394
|
+
MerkleClient.BLOCK_CACHE_TTL_MS = 1000; // 1秒缓存(BSC 约 3 秒出块,ETH 约 12 秒)
|
|
388
395
|
/**
|
|
389
396
|
* 创建 Merkle 客户端的便捷函数
|
|
390
397
|
*/
|
|
@@ -127,7 +127,7 @@ export declare const ENI_SPENDERS: {
|
|
|
127
127
|
*/
|
|
128
128
|
export declare function getEniSpenders(mode?: boolean | 'all'): string[];
|
|
129
129
|
export type ChainAddresses = keyof typeof ADDRESSES;
|
|
130
|
-
export type AddressKey<C extends ChainAddresses> = keyof
|
|
130
|
+
export type AddressKey<C extends ChainAddresses> = keyof typeof ADDRESSES[C];
|
|
131
131
|
/**
|
|
132
132
|
* 获取指定链的合约地址
|
|
133
133
|
*/
|
|
@@ -192,21 +192,12 @@ export const ENI_SPENDERS = {
|
|
|
192
192
|
*/
|
|
193
193
|
export function getEniSpenders(mode = false) {
|
|
194
194
|
if (mode === 'all' && ENI_SPENDERS.BATCH_ROUTER) {
|
|
195
|
-
return [
|
|
196
|
-
ENI_SPENDERS.DIRECT.DAOAAS_PORTAL,
|
|
197
|
-
ENI_SPENDERS.DIRECT.DSWAP_V2_ROUTER,
|
|
198
|
-
ENI_SPENDERS.DIRECT.IROSWAP_V2_ROUTER,
|
|
199
|
-
ENI_SPENDERS.BATCH_ROUTER,
|
|
200
|
-
];
|
|
195
|
+
return [ENI_SPENDERS.DIRECT.DAOAAS_PORTAL, ENI_SPENDERS.DIRECT.DSWAP_V2_ROUTER, ENI_SPENDERS.DIRECT.IROSWAP_V2_ROUTER, ENI_SPENDERS.BATCH_ROUTER];
|
|
201
196
|
}
|
|
202
197
|
if (mode === true && ENI_SPENDERS.BATCH_ROUTER) {
|
|
203
198
|
return [ENI_SPENDERS.BATCH_ROUTER];
|
|
204
199
|
}
|
|
205
|
-
return [
|
|
206
|
-
ENI_SPENDERS.DIRECT.DAOAAS_PORTAL,
|
|
207
|
-
ENI_SPENDERS.DIRECT.DSWAP_V2_ROUTER,
|
|
208
|
-
ENI_SPENDERS.DIRECT.IROSWAP_V2_ROUTER,
|
|
209
|
-
];
|
|
200
|
+
return [ENI_SPENDERS.DIRECT.DAOAAS_PORTAL, ENI_SPENDERS.DIRECT.DSWAP_V2_ROUTER, ENI_SPENDERS.DIRECT.IROSWAP_V2_ROUTER];
|
|
210
201
|
}
|
|
211
202
|
// ============================================================================
|
|
212
203
|
// 工具函数
|
|
@@ -107,7 +107,7 @@ export declare const CHAINS: {
|
|
|
107
107
|
};
|
|
108
108
|
export declare const CHAIN_ID_MAP: Record<string, number>;
|
|
109
109
|
export type ChainKey = keyof typeof CHAINS;
|
|
110
|
-
export type ChainConfig =
|
|
110
|
+
export type ChainConfig = typeof CHAINS[ChainKey];
|
|
111
111
|
/**
|
|
112
112
|
* 根据 chainId 获取链配置
|
|
113
113
|
*/
|
|
@@ -132,7 +132,7 @@ export const CHAIN_ID_MAP = {
|
|
|
132
132
|
* 根据 chainId 获取链配置
|
|
133
133
|
*/
|
|
134
134
|
export function getChainById(chainId) {
|
|
135
|
-
return Object.values(CHAINS).find(
|
|
135
|
+
return Object.values(CHAINS).find(c => c.chainId === chainId);
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
138
|
* 根据 chainId 获取链名称
|
|
@@ -63,7 +63,7 @@ export declare const V3_FEE_TIERS: {
|
|
|
63
63
|
readonly HIGH: 10000;
|
|
64
64
|
};
|
|
65
65
|
export type GasLimitKey = keyof typeof GAS_LIMITS;
|
|
66
|
-
export type V3FeeTier =
|
|
66
|
+
export type V3FeeTier = typeof V3_FEE_TIERS[keyof typeof V3_FEE_TIERS];
|
|
67
67
|
/**
|
|
68
68
|
* 根据链和交易类型计算 gas limit
|
|
69
69
|
*/
|
|
@@ -90,7 +90,9 @@ export function calculateGasLimit(chainId, isNative, hasHops = false, hopCount =
|
|
|
90
90
|
}
|
|
91
91
|
// 有多跳时,基础 gas + 每跳额外 gas
|
|
92
92
|
if (hasHops && hopCount > 0) {
|
|
93
|
-
const hopGas = isNative
|
|
93
|
+
const hopGas = isNative
|
|
94
|
+
? GAS_LIMITS.NATIVE_TRANSFER
|
|
95
|
+
: GAS_LIMITS.ERC20_TRANSFER;
|
|
94
96
|
return GAS_LIMITS.TRADE + hopGas * BigInt(hopCount);
|
|
95
97
|
}
|
|
96
98
|
// 普通转账
|
|
@@ -106,7 +108,9 @@ export function calculateGasLimit(chainId, isNative, hasHops = false, hopCount =
|
|
|
106
108
|
*/
|
|
107
109
|
export function getTransferGasLimit(chainId, isNative) {
|
|
108
110
|
if (isNative) {
|
|
109
|
-
return chainId === CHAINS.XLAYER.chainId
|
|
111
|
+
return chainId === CHAINS.XLAYER.chainId
|
|
112
|
+
? GAS_LIMITS.XLAYER_NATIVE_TRANSFER
|
|
113
|
+
: GAS_LIMITS.NATIVE_TRANSFER;
|
|
110
114
|
}
|
|
111
115
|
return GAS_LIMITS.ERC20_TRANSFER;
|
|
112
116
|
}
|
|
@@ -10,8 +10,5 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export { CHAINS, CHAIN_ID_MAP, getChainById, getChainName, getDefaultRpcUrl, isKnownChain, isBscChain, isXLayerChain, isMonadChain, isEniChain, getConfirmationTimeout, type ChainKey, type ChainConfig, } from './chains.js';
|
|
12
12
|
export { GAS_LIMITS, GAS_CONFIG, V3_FEE_TIERS, calculateGasLimit, getTransferGasLimit, type GasLimitKey, type V3FeeTier, } from './gas.js';
|
|
13
|
-
export { QUOTE_CONFIG, QUOTE_V3_FEE_TIERS, type QuoteConfigChain } from './quote.js';
|
|
14
|
-
/** Flap 链标识(与 `FlapPortal` 一致,供子路径 `./constants` 使用) */
|
|
15
|
-
export type { FlapChain } from '../flap/portal.js';
|
|
16
13
|
export { ZERO_ADDRESS, BLOCKRAZOR_BUILDER_EOA, ADDRESSES, getAddress, getWrappedNativeAddress, getMulticall3Address, getFlapPortalAddress, isZeroAddress, isNativeToken, ENI_SPENDERS, getEniSpenders, type ChainAddresses, type AddressKey, } from './addresses.js';
|
|
17
14
|
export { PROFIT_CONFIG, getProfitRecipient, getAllProfitRecipients, getProfitRateBps, calculateProfitAmount, calculateProfitHopGasCost, type ProfitRateKey, TRANSFER_FEE_PER_ADDRESS, getTransferFeePerAddress, calculateTransferFee, } from './profit.js';
|
|
@@ -16,7 +16,6 @@ export { CHAINS, CHAIN_ID_MAP, getChainById, getChainName, getDefaultRpcUrl, isK
|
|
|
16
16
|
// Gas 常量
|
|
17
17
|
// ============================================================================
|
|
18
18
|
export { GAS_LIMITS, GAS_CONFIG, V3_FEE_TIERS, calculateGasLimit, getTransferGasLimit, } from './gas.js';
|
|
19
|
-
export { QUOTE_CONFIG, QUOTE_V3_FEE_TIERS } from './quote.js';
|
|
20
19
|
// ============================================================================
|
|
21
20
|
// 合约地址
|
|
22
21
|
// ============================================================================
|
package/dist/shared/flap/abi.js
CHANGED
|
@@ -9,5 +9,5 @@ export const PORTAL_EVENTS_ABI = [
|
|
|
9
9
|
'event FlapTokenTaxSet(address token, uint256 tax)',
|
|
10
10
|
'event FlapTokenCirculatingSupplyChanged(address token, uint256 newSupply)',
|
|
11
11
|
'event LaunchedToDEX(address token, address pool, uint256 amount, uint256 eth)',
|
|
12
|
-
'event TokenExtensionEnabled(address token, bytes32 extensionID, address extensionAddress, uint8 version)'
|
|
12
|
+
'event TokenExtensionEnabled(address token, bytes32 extensionID, address extensionAddress, uint8 version)'
|
|
13
13
|
];
|