four-flap-meme-sdk 2.2.1 → 2.2.2
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 +85 -20
- package/dist/index.js +215 -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 +252 -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 +3 -2
- 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 +3 -3
- package/dist/shared/flap/index.js +3 -3
- 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 +172 -92
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.d.ts +1 -2
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +99 -106
- 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 +7 -73
- 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 -1
- package/dist/shared/flap/portal.js +25 -32
- package/dist/shared/flap/vanity.d.ts +5 -1
- package/dist/shared/flap/vanity.js +17 -6
- package/dist/shared/flap/vault.d.ts +124 -17
- package/dist/shared/flap/vault.js +148 -67
- 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 -260
- 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/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
|
@@ -29,6 +29,7 @@ export declare const FLAP_TOKEN_IMPL_ADDRESSES: {
|
|
|
29
29
|
readonly BSC_NORMAL: "0x8b4329947e34b6d56d71a3385cac122bade7d78d";
|
|
30
30
|
readonly BSC_TAXED: "0x29e6383F0ce68507b5A72a53c2B118a118332aA8";
|
|
31
31
|
readonly BSC_TAXED_V5: "0xae562c6A05b798499507c6276C6Ed796027807BA";
|
|
32
|
+
readonly BSC_TAXED_V3: "0x024f18294970B5c76c0691b87f138A0317156422";
|
|
32
33
|
readonly BASE: "0xF3c514E04f83166E80718f29f0d34F206be40A0A";
|
|
33
34
|
readonly XLAYER: "0x12Dc83157Bf1cfCB8Db5952b3ba5bb56Cc38f8C9";
|
|
34
35
|
readonly MORPH: "0x8b4329947e34b6d56d71a3385cac122bade7d78d";
|
|
@@ -125,4 +126,4 @@ export declare const FLAP_TOTAL_SUPPLY: bigint;
|
|
|
125
126
|
* 零地址(用于表示原生代币)
|
|
126
127
|
* ✅ 从公共模块重新导出
|
|
127
128
|
*/
|
|
128
|
-
export { ZERO_ADDRESS } from '
|
|
129
|
+
export { ZERO_ADDRESS } from '../../utils/constants.js';
|
|
@@ -31,6 +31,7 @@ export const FLAP_TOKEN_IMPL_ADDRESSES = {
|
|
|
31
31
|
BSC_NORMAL: '0x8b4329947e34b6d56d71a3385cac122bade7d78d',
|
|
32
32
|
BSC_TAXED: '0x29e6383F0ce68507b5A72a53c2B118a118332aA8', // V2: 只有运营钱包的税代币
|
|
33
33
|
BSC_TAXED_V5: '0xae562c6A05b798499507c6276C6Ed796027807BA', // V5: 高级税代币 (mkt/deflation/dividend/lp)
|
|
34
|
+
BSC_TAXED_V3: '0x024f18294970B5c76c0691b87f138A0317156422', // V3: VaultPortal.newTokenV6WithVault (TOKEN_TAXED_V3)
|
|
34
35
|
BASE: '0xF3c514E04f83166E80718f29f0d34F206be40A0A',
|
|
35
36
|
XLAYER: '0x12Dc83157Bf1cfCB8Db5952b3ba5bb56Cc38f8C9',
|
|
36
37
|
MORPH: '0x8b4329947e34b6d56d71a3385cac122bade7d78d', // 暂时使用 BSC NORMAL 地址
|
|
@@ -135,9 +136,9 @@ export const FLAP_DEX_THRESHOLDS = {
|
|
|
135
136
|
/**
|
|
136
137
|
* 代币总供应量(固定为 10 亿)
|
|
137
138
|
*/
|
|
138
|
-
export const FLAP_TOTAL_SUPPLY = BigInt(
|
|
139
|
+
export const FLAP_TOTAL_SUPPLY = BigInt(1000000000) * BigInt(10 ** 18);
|
|
139
140
|
/**
|
|
140
141
|
* 零地址(用于表示原生代币)
|
|
141
142
|
* ✅ 从公共模块重新导出
|
|
142
143
|
*/
|
|
143
|
-
export { ZERO_ADDRESS } from '
|
|
144
|
+
export { ZERO_ADDRESS } from '../../utils/constants.js';
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flap Protocol 错误代码
|
|
3
|
+
*/
|
|
1
4
|
export type FlapErrorCode = 'TOKEN_ALREADY_EXISTS' | 'TOKEN_NOT_FOUND' | 'TOKEN_NOT_TRADABLE' | 'ALREADY_ON_DEX' | 'INSUFFICIENT_BALANCE' | 'SLIPPAGE_EXCEEDED' | 'INVALID_TOKEN' | 'INVALID_QUOTE_TOKEN' | 'INVALID_AMOUNT' | 'TAX_RATE_TOO_HIGH' | 'PERMIT_EXPIRED' | 'PERMIT_INVALID' | 'UNKNOWN_ERROR';
|
|
2
5
|
/**
|
|
3
6
|
* 解析 Flap Protocol 错误信息
|
|
@@ -17,7 +20,7 @@ export type FlapErrorCode = 'TOKEN_ALREADY_EXISTS' | 'TOKEN_NOT_FOUND' | 'TOKEN_
|
|
|
17
20
|
* }
|
|
18
21
|
* ```
|
|
19
22
|
*/
|
|
20
|
-
export declare function parseFlapError(error:
|
|
23
|
+
export declare function parseFlapError(error: any): FlapErrorCode | null;
|
|
21
24
|
/**
|
|
22
25
|
* 获取错误的友好提示信息(中文)
|
|
23
26
|
*
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flap Protocol 错误代码
|
|
3
|
-
*/
|
|
4
|
-
import { getErrorMessageFromUnknown } from '../foundation/normalize-unknown.js';
|
|
5
1
|
/**
|
|
6
2
|
* 解析 Flap Protocol 错误信息
|
|
7
3
|
*
|
|
@@ -21,7 +17,7 @@ import { getErrorMessageFromUnknown } from '../foundation/normalize-unknown.js';
|
|
|
21
17
|
* ```
|
|
22
18
|
*/
|
|
23
19
|
export function parseFlapError(error) {
|
|
24
|
-
const msg =
|
|
20
|
+
const msg = error?.message || error?.data?.message || String(error);
|
|
25
21
|
const msgLower = msg.toLowerCase();
|
|
26
22
|
// Token 状态相关错误
|
|
27
23
|
if (msgLower.includes('token already exists') || msgLower.includes('already created')) {
|
|
@@ -64,21 +60,6 @@ export function parseFlapError(error) {
|
|
|
64
60
|
// 无法识别的错误
|
|
65
61
|
return null;
|
|
66
62
|
}
|
|
67
|
-
function getFlapErrorText(error) {
|
|
68
|
-
if (error !== null && typeof error === 'object') {
|
|
69
|
-
const record = error;
|
|
70
|
-
const topLevel = record.message;
|
|
71
|
-
if (typeof topLevel === 'string' && topLevel)
|
|
72
|
-
return topLevel;
|
|
73
|
-
const data = record.data;
|
|
74
|
-
if (data !== null && typeof data === 'object') {
|
|
75
|
-
const nestedMessage = data.message;
|
|
76
|
-
if (typeof nestedMessage === 'string' && nestedMessage)
|
|
77
|
-
return nestedMessage;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return getErrorMessageFromUnknown(error);
|
|
81
|
-
}
|
|
82
63
|
/**
|
|
83
64
|
* 获取错误的友好提示信息(中文)
|
|
84
65
|
*
|
|
@@ -11,12 +11,12 @@ type PortalConfig, type TokenStateV2, type TokenStateV3, type TokenStateV4, type
|
|
|
11
11
|
export { CDPV2 } from './curve.js';
|
|
12
12
|
export { buildPermitPiggybackAuto } from './permit.js';
|
|
13
13
|
export { uploadTokenMeta, type TokenMetaInput } from './ipfs.js';
|
|
14
|
-
export { PinataClient, type PinataConfig, pinFileToIPFSWithJWT, pinImageByPath, pinFileToIPFSWithJWTWeb, pinDataURLWithJWTWeb, dataURLToBlob, type PinataPinResp
|
|
14
|
+
export { PinataClient, type PinataConfig, pinFileToIPFSWithJWT, pinImageByPath, pinFileToIPFSWithJWTWeb, pinDataURLWithJWTWeb, dataURLToBlob, type PinataPinResp } from './pinata.js';
|
|
15
15
|
export { predictVanityTokenAddressByChain, findSaltEndingByChain } from './vanity.js';
|
|
16
16
|
export { getFlapMetaByAddress, getFlapMetasByAddresses } from './meta.js';
|
|
17
17
|
export { parseFlapError, getFlapErrorMessage, getFlapErrorMessageEn, type FlapErrorCode } from './errors.js';
|
|
18
|
-
export { FLAP_DEFAULT_FEE_RATES, FLAP_IPFS_API_URL, FLAP_VANITY_SUFFIX, FLAP_DEX_THRESHOLDS, FLAP_TOTAL_SUPPLY, ZERO_ADDRESS, CHAIN_TAX_SUPPORT, getVanitySuffix, isChainSupportTax, FLAP_PORTAL_ADDRESSES
|
|
18
|
+
export { FLAP_DEFAULT_FEE_RATES, FLAP_IPFS_API_URL, FLAP_VANITY_SUFFIX, FLAP_DEX_THRESHOLDS, FLAP_TOTAL_SUPPLY, ZERO_ADDRESS, CHAIN_TAX_SUPPORT, getVanitySuffix, isChainSupportTax, FLAP_PORTAL_ADDRESSES } from './constants.js';
|
|
19
19
|
export * from './abi.js';
|
|
20
20
|
export { createTokenWithBundleBuy, batchBuyWithBundle, batchSellWithBundle, type FlapBundleConfig, type FlapChainForBundle, type FlapCreateWithBundleBuyParams, type FlapCreateWithBundleBuyResult, type FlapBatchBuyParams, type FlapBatchBuyResult, type FlapBatchSellParams, type FlapBatchSellResult, flapPrivateBuy, flapPrivateSell, flapBatchPrivateBuy, flapBatchPrivateSell, type FlapPrivateBuyParams, type FlapPrivateSellParams, type FlapBatchPrivateBuyParams, type FlapBatchPrivateSellParams, type FlapBatchPrivateSellResult, } from './portal-bundle.js';
|
|
21
21
|
export * from './portal-bundle-merkle/index.js';
|
|
22
|
-
export { NONE_EXTENSION_ID, VAULT_TYPE_LABELS, VAULT_TYPE_CATEGORIES, VAULT_FACTORY_ADDRESSES, VAULT_PORTAL_ADDRESSES, VAULT_PORTAL_ABI, VAULT_EXTRA_CONFIG, FLAP_GUARDIAN_ADDRESSES, VAULT_FACTORY_ABI, VAULT_FACTORY_V2_ABI, VAULT_BASE_ABI, VAULT_BASE_V2_ABI, type VaultType, type TaxVaultConfig, type VaultInfo, type FieldDescriptor, type VaultDataSchema, type ApproveAction, type VaultMethodSchema, type VaultUISchema, encodeVaultData, buildVaultParams, buildVaultExtensionParams, getVaultFactoryAddress, getVaultPortalAddress, queryVaultDataSchema, queryVaultUISchema, queryVaultDescription, validateVaultFactory, getVaultInfo, isValidContract, } from './vault.js';
|
|
22
|
+
export { NONE_EXTENSION_ID, VAULT_TYPE_LABELS, VAULT_TYPE_CATEGORIES, VAULT_FACTORY_ADDRESSES, VAULT_PORTAL_ADDRESSES, VAULT_PORTAL_ABI, VAULT_EXTRA_CONFIG, FLAP_GUARDIAN_ADDRESSES, VAULT_FACTORY_ABI, VAULT_FACTORY_V2_ABI, VAULT_BASE_ABI, VAULT_BASE_V2_ABI, type VaultType, type TaxVaultConfig, type VaultInfo, type FieldDescriptor, type VaultDataSchema, type ApproveAction, type VaultMethodSchema, type VaultUISchema, encodeVaultData, buildVaultParams, buildNewTokenV6WithVaultParams, buildVaultExtensionParams, getVaultLaunchVanityOptions, TOKEN_TAXED_V3_VERSION, getVaultFactoryAddress, getVaultPortalAddress, queryVaultDataSchema, queryVaultUISchema, queryVaultDescription, validateVaultFactory, getVaultInfo, isValidContract, } from './vault.js';
|
|
@@ -11,11 +11,11 @@ export { FlapPortal, FlapPortalWriter, validateTaxDistribution, TokenStatus, Tok
|
|
|
11
11
|
export { CDPV2 } from './curve.js';
|
|
12
12
|
export { buildPermitPiggybackAuto } from './permit.js';
|
|
13
13
|
export { uploadTokenMeta } from './ipfs.js';
|
|
14
|
-
export { PinataClient, pinFileToIPFSWithJWT, pinImageByPath, pinFileToIPFSWithJWTWeb, pinDataURLWithJWTWeb, dataURLToBlob
|
|
14
|
+
export { PinataClient, pinFileToIPFSWithJWT, pinImageByPath, pinFileToIPFSWithJWTWeb, pinDataURLWithJWTWeb, dataURLToBlob } from './pinata.js';
|
|
15
15
|
export { predictVanityTokenAddressByChain, findSaltEndingByChain } from './vanity.js';
|
|
16
16
|
export { getFlapMetaByAddress, getFlapMetasByAddresses } from './meta.js';
|
|
17
17
|
export { parseFlapError, getFlapErrorMessage, getFlapErrorMessageEn } from './errors.js';
|
|
18
|
-
export { FLAP_DEFAULT_FEE_RATES, FLAP_IPFS_API_URL, FLAP_VANITY_SUFFIX, FLAP_DEX_THRESHOLDS, FLAP_TOTAL_SUPPLY, ZERO_ADDRESS, CHAIN_TAX_SUPPORT, getVanitySuffix, isChainSupportTax, FLAP_PORTAL_ADDRESSES
|
|
18
|
+
export { FLAP_DEFAULT_FEE_RATES, FLAP_IPFS_API_URL, FLAP_VANITY_SUFFIX, FLAP_DEX_THRESHOLDS, FLAP_TOTAL_SUPPLY, ZERO_ADDRESS, CHAIN_TAX_SUPPORT, getVanitySuffix, isChainSupportTax, FLAP_PORTAL_ADDRESSES } from './constants.js';
|
|
19
19
|
export * from './abi.js';
|
|
20
20
|
// Bundle 功能
|
|
21
21
|
export { createTokenWithBundleBuy, batchBuyWithBundle, batchSellWithBundle, flapPrivateBuy, flapPrivateSell, flapBatchPrivateBuy, flapBatchPrivateSell, } from './portal-bundle.js';
|
|
@@ -28,6 +28,6 @@ NONE_EXTENSION_ID, VAULT_TYPE_LABELS, VAULT_TYPE_CATEGORIES, VAULT_FACTORY_ADDRE
|
|
|
28
28
|
// ABI
|
|
29
29
|
VAULT_FACTORY_ABI, VAULT_FACTORY_V2_ABI, VAULT_BASE_ABI, VAULT_BASE_V2_ABI,
|
|
30
30
|
// 工具函数
|
|
31
|
-
encodeVaultData, buildVaultParams, buildVaultExtensionParams, getVaultFactoryAddress, getVaultPortalAddress,
|
|
31
|
+
encodeVaultData, buildVaultParams, buildNewTokenV6WithVaultParams, buildVaultExtensionParams, getVaultLaunchVanityOptions, TOKEN_TAXED_V3_VERSION, getVaultFactoryAddress, getVaultPortalAddress,
|
|
32
32
|
// 链上查询
|
|
33
33
|
queryVaultDataSchema, queryVaultUISchema, queryVaultDescription, validateVaultFactory, getVaultInfo, isValidContract, } from './vault.js';
|
|
@@ -1,24 +1,5 @@
|
|
|
1
1
|
import { JsonRpcProvider } from 'ethers';
|
|
2
2
|
export type FlapChain = 'BSC' | 'BASE' | 'XLAYER' | 'MORPH';
|
|
3
|
-
/** JSON 可序列化值(递归) */
|
|
4
|
-
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
5
|
-
[key: string]: JsonValue;
|
|
6
|
-
};
|
|
7
|
-
/** IPFS 元数据 JSON(字段因项目而异) */
|
|
8
|
-
export type FlapTokenMetaJson = {
|
|
9
|
-
[key: string]: JsonValue;
|
|
10
|
-
};
|
|
11
|
-
export type FlapMetaByAddressResult = {
|
|
12
|
-
cid: string;
|
|
13
|
-
data?: FlapTokenMetaJson;
|
|
14
|
-
};
|
|
15
|
-
export type FlapMetaByTokenResult = {
|
|
16
|
-
token: string;
|
|
17
|
-
cid?: string;
|
|
18
|
-
data?: FlapTokenMetaJson;
|
|
19
|
-
imageUrl?: string;
|
|
20
|
-
error?: string;
|
|
21
|
-
};
|
|
22
3
|
export type FetchMetaOptions = {
|
|
23
4
|
ipfsGateway?: string;
|
|
24
5
|
multicall3?: string;
|
|
@@ -26,9 +7,24 @@ export type FetchMetaOptions = {
|
|
|
26
7
|
/**
|
|
27
8
|
* 根据代币地址直接读取合约 metaURI()/meta()(IPFS CID),并拉取元数据 JSON。
|
|
28
9
|
*/
|
|
29
|
-
export declare function getFlapMetaByAddress(chain: FlapChain, rpcUrl: string, tokenAddress: string, opts?: FetchMetaOptions): Promise<
|
|
30
|
-
|
|
10
|
+
export declare function getFlapMetaByAddress(chain: FlapChain, rpcUrl: string, tokenAddress: string, opts?: FetchMetaOptions): Promise<{
|
|
11
|
+
cid: string;
|
|
12
|
+
data?: any;
|
|
13
|
+
} | undefined>;
|
|
14
|
+
export declare function getFlapMetasByAddresses(chain: FlapChain, rpcUrl: string, tokenAddresses: string[], opts?: FetchMetaOptions): Promise<Array<{
|
|
15
|
+
token: string;
|
|
16
|
+
cid?: string;
|
|
17
|
+
data?: any;
|
|
18
|
+
imageUrl?: string;
|
|
19
|
+
error?: string;
|
|
20
|
+
}>>;
|
|
31
21
|
/**
|
|
32
22
|
* 使用 Multicall3 批量读取 metaURI()/meta(),metaURI 优先、meta 兜底。
|
|
33
23
|
*/
|
|
34
|
-
export declare function getFlapMetaUrisWithMulticall(provider: JsonRpcProvider, chain: FlapChain, tokenAddresses: string[], multicall3?: string, ipfsGateway?: string): Promise<
|
|
24
|
+
export declare function getFlapMetaUrisWithMulticall(provider: JsonRpcProvider, chain: FlapChain, tokenAddresses: string[], multicall3?: string, ipfsGateway?: string): Promise<Array<{
|
|
25
|
+
token: string;
|
|
26
|
+
cid?: string;
|
|
27
|
+
data?: any;
|
|
28
|
+
imageUrl?: string;
|
|
29
|
+
error?: string;
|
|
30
|
+
}>>;
|
package/dist/shared/flap/meta.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { JsonRpcProvider, Contract, Interface } from 'ethers';
|
|
2
|
-
import { ADDRESSES } from '
|
|
3
|
-
import { getErrorMessageFromUnknown } from '../foundation/index.js';
|
|
2
|
+
import { ADDRESSES } from '../../utils/constants.js';
|
|
4
3
|
const DEFAULT_GATEWAYS = {
|
|
5
4
|
BSC: 'https://ipfs.io/ipfs/',
|
|
6
5
|
BASE: 'https://ipfs.io/ipfs/',
|
|
7
6
|
XLAYER: 'https://ipfs.io/ipfs/',
|
|
8
|
-
MORPH: 'https://ipfs.io/ipfs/'
|
|
7
|
+
MORPH: 'https://ipfs.io/ipfs/'
|
|
9
8
|
};
|
|
10
9
|
function normalizeCid(cidOrUrl) {
|
|
11
10
|
if (!cidOrUrl)
|
|
@@ -19,10 +18,13 @@ async function fetchIpfsJson(cid, gateway) {
|
|
|
19
18
|
const resp = await fetch(url);
|
|
20
19
|
if (!resp.ok)
|
|
21
20
|
throw new Error(`IPFS fetch failed: ${resp.status} ${await resp.text()}`);
|
|
22
|
-
return
|
|
21
|
+
return await resp.json();
|
|
23
22
|
}
|
|
24
23
|
async function readCidFromToken(provider, tokenAddress) {
|
|
25
|
-
const abi = [
|
|
24
|
+
const abi = [
|
|
25
|
+
'function metaURI() view returns (string)',
|
|
26
|
+
'function meta() view returns (string)'
|
|
27
|
+
];
|
|
26
28
|
const c = new Contract(tokenAddress, abi, provider);
|
|
27
29
|
try {
|
|
28
30
|
const v = await c.metaURI();
|
|
@@ -91,14 +93,17 @@ export async function getFlapMetaUrisWithMulticall(provider, chain, tokenAddress
|
|
|
91
93
|
BSC: ADDRESSES.BSC.Multicall3,
|
|
92
94
|
BASE: ADDRESSES.BSC.Multicall3, // 所有链使用相同地址
|
|
93
95
|
XLAYER: ADDRESSES.BSC.Multicall3,
|
|
94
|
-
MORPH: ADDRESSES.BSC.Multicall3
|
|
96
|
+
MORPH: ADDRESSES.BSC.Multicall3
|
|
95
97
|
};
|
|
96
98
|
const mcAddress = multicall3 || DEFAULT_MULTICALL3[chain];
|
|
97
99
|
const mcAbi = [
|
|
98
|
-
'function tryAggregate(bool requireSuccess, tuple(address target, bytes callData)[] calls) public returns (tuple(bool success, bytes returnData)[])'
|
|
100
|
+
'function tryAggregate(bool requireSuccess, tuple(address target, bytes callData)[] calls) public returns (tuple(bool success, bytes returnData)[])'
|
|
99
101
|
];
|
|
100
102
|
const mc = new Contract(mcAddress, mcAbi, provider);
|
|
101
|
-
const iface = new Interface([
|
|
103
|
+
const iface = new Interface([
|
|
104
|
+
'function metaURI() view returns (string)',
|
|
105
|
+
'function meta() view returns (string)'
|
|
106
|
+
]);
|
|
102
107
|
// 第一轮:metaURI()
|
|
103
108
|
const callDataMetaURI = iface.encodeFunctionData('metaURI', []);
|
|
104
109
|
const calls1 = tokenAddresses.map((t) => ({ target: t, callData: callDataMetaURI }));
|
|
@@ -106,7 +111,7 @@ export async function getFlapMetaUrisWithMulticall(provider, chain, tokenAddress
|
|
|
106
111
|
try {
|
|
107
112
|
res1 = await mc.tryAggregate(false, calls1);
|
|
108
113
|
}
|
|
109
|
-
catch {
|
|
114
|
+
catch (e) {
|
|
110
115
|
// 如果 multicall 不可用,降级为逐个查询
|
|
111
116
|
const fallbacks = await Promise.all(tokenAddresses.map(async (t) => {
|
|
112
117
|
try {
|
|
@@ -114,7 +119,7 @@ export async function getFlapMetaUrisWithMulticall(provider, chain, tokenAddress
|
|
|
114
119
|
return { token: t, cid };
|
|
115
120
|
}
|
|
116
121
|
catch (err) {
|
|
117
|
-
return { token: t, error:
|
|
122
|
+
return { token: t, error: String(err?.message || err) };
|
|
118
123
|
}
|
|
119
124
|
}));
|
|
120
125
|
return fallbacks;
|
|
@@ -127,7 +132,7 @@ export async function getFlapMetaUrisWithMulticall(provider, chain, tokenAddress
|
|
|
127
132
|
const [uri] = iface.decodeFunctionResult('metaURI', r.returnData);
|
|
128
133
|
return { token: t, cid: String(uri) };
|
|
129
134
|
}
|
|
130
|
-
catch {
|
|
135
|
+
catch (e) {
|
|
131
136
|
needMeta.push(t);
|
|
132
137
|
return { token: t };
|
|
133
138
|
}
|
|
@@ -166,7 +171,7 @@ export async function getFlapMetaUrisWithMulticall(provider, chain, tokenAddress
|
|
|
166
171
|
interim[i].cid = String(uri);
|
|
167
172
|
}
|
|
168
173
|
catch (e) {
|
|
169
|
-
interim[i].error =
|
|
174
|
+
interim[i].error = String(e?.message || e);
|
|
170
175
|
}
|
|
171
176
|
}
|
|
172
177
|
else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Wallet, AbiCoder, Contract, JsonRpcProvider } from 'ethers';
|
|
2
2
|
import { FLAP_PORTAL_ADDRESSES } from './constants.js';
|
|
3
|
-
import {
|
|
3
|
+
import { CHAIN } from '../../utils/constants.js';
|
|
4
4
|
/**
|
|
5
5
|
* 构建 Permit Piggyback 数据
|
|
6
6
|
* 自动签名并使用正确的 Portal 代理地址
|
|
@@ -22,10 +22,7 @@ export async function buildPermitPiggybackAuto(chain, privateKey, tokenAddress,
|
|
|
22
22
|
const wallet = new Wallet(privateKey);
|
|
23
23
|
const owner = wallet.address;
|
|
24
24
|
// 获取 chainId
|
|
25
|
-
const chainId =
|
|
26
|
-
if (chainId === undefined) {
|
|
27
|
-
throw new Error(`Unknown chain: ${chain}`);
|
|
28
|
-
}
|
|
25
|
+
const chainId = CHAIN[chain].chainId;
|
|
29
26
|
// 读取代币 name(优先 override,其次链上查询,不可用时回退为空字符串)
|
|
30
27
|
let tokenName = opts?.tokenNameOverride ?? '';
|
|
31
28
|
if (!tokenName && opts?.rpcUrl) {
|
|
@@ -2,41 +2,26 @@ export type PinataConfig = {
|
|
|
2
2
|
jwt: string;
|
|
3
3
|
gateway?: string;
|
|
4
4
|
};
|
|
5
|
-
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
6
|
-
[key: string]: JsonValue;
|
|
7
|
-
};
|
|
8
|
-
/** Pinata gateway JSON 响应(结构因 CID 内容而异) */
|
|
9
|
-
export type PinataGatewayJson = {
|
|
10
|
-
[key: string]: JsonValue;
|
|
11
|
-
};
|
|
12
|
-
type PinataPinApiResponse = {
|
|
13
|
-
IpfsHash?: string;
|
|
14
|
-
cid?: string;
|
|
15
|
-
PinSize?: number;
|
|
16
|
-
Timestamp?: string;
|
|
17
|
-
};
|
|
18
|
-
export type PinataJsonUpload = {
|
|
19
|
-
[key: string]: JsonValue;
|
|
20
|
-
};
|
|
21
5
|
export declare class PinataClient {
|
|
22
6
|
private client;
|
|
7
|
+
private ready;
|
|
23
8
|
constructor(cfg: PinataConfig);
|
|
24
9
|
uploadFile(file: File): Promise<{
|
|
25
10
|
cid: string;
|
|
26
11
|
id: string;
|
|
27
12
|
}>;
|
|
28
|
-
uploadJSON(obj:
|
|
13
|
+
uploadJSON(obj: unknown, name?: string): Promise<{
|
|
29
14
|
cid: string;
|
|
30
15
|
id: string;
|
|
31
16
|
}>;
|
|
32
|
-
get(cid: string): Promise<
|
|
33
|
-
url(cid: string): Promise<
|
|
17
|
+
get(cid: string): Promise<any>;
|
|
18
|
+
url(cid: string): Promise<any>;
|
|
34
19
|
}
|
|
35
20
|
export type PinataPinResp = {
|
|
36
21
|
cid: string;
|
|
37
22
|
size?: number;
|
|
38
23
|
timestamp?: string;
|
|
39
|
-
raw?:
|
|
24
|
+
raw?: any;
|
|
40
25
|
};
|
|
41
26
|
/**
|
|
42
27
|
* 使用 Pinata JWT 直接上传文件(Node 环境)
|
|
@@ -45,7 +30,7 @@ export type PinataPinResp = {
|
|
|
45
30
|
* @param data 可选:内存 Buffer(当未提供 filePath 时使用)
|
|
46
31
|
* @param fileName 可选:内存数据的文件名
|
|
47
32
|
*/
|
|
48
|
-
export declare function pinFileToIPFSWithJWT(jwt: string, filePath?: string, data?:
|
|
33
|
+
export declare function pinFileToIPFSWithJWT(jwt: string, filePath?: string, data?: any, fileName?: string): Promise<PinataPinResp>;
|
|
49
34
|
/**
|
|
50
35
|
* 便捷方法:上传本地图片路径(返回 CID)
|
|
51
36
|
*/
|
|
@@ -53,4 +38,3 @@ export declare function pinImageByPath(jwt: string, filePath: string): Promise<s
|
|
|
53
38
|
export declare function pinFileToIPFSWithJWTWeb(jwt: string, file: Blob, fileName?: string): Promise<PinataPinResp>;
|
|
54
39
|
export declare function dataURLToBlob(dataUrl: string): Blob;
|
|
55
40
|
export declare function pinDataURLWithJWTWeb(jwt: string, dataUrl: string, fileName?: string): Promise<PinataPinResp>;
|
|
56
|
-
export {};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { createReadStream } from 'node:fs';
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import NodeFormData from 'form-data';
|
|
4
|
-
import { PinataSDK } from 'pinata';
|
|
5
1
|
export class PinataClient {
|
|
6
|
-
client;
|
|
7
2
|
constructor(cfg) {
|
|
8
|
-
this.
|
|
3
|
+
this.ready = (async () => {
|
|
4
|
+
const mod = await import('pinata');
|
|
5
|
+
this.client = new mod.PinataSDK({ pinataJwt: cfg.jwt, pinataGateway: cfg.gateway });
|
|
6
|
+
})();
|
|
9
7
|
}
|
|
10
8
|
async uploadFile(file) {
|
|
9
|
+
await this.ready;
|
|
11
10
|
const r = await this.client.upload.file(file);
|
|
12
|
-
return { cid: r.cid, id: r.id
|
|
11
|
+
return { cid: r.cid, id: r.id };
|
|
13
12
|
}
|
|
14
13
|
async uploadJSON(obj, name = 'meta.json') {
|
|
15
14
|
const blob = new Blob([JSON.stringify(obj)], { type: 'application/json' });
|
|
@@ -17,9 +16,12 @@ export class PinataClient {
|
|
|
17
16
|
return await this.uploadFile(file);
|
|
18
17
|
}
|
|
19
18
|
async get(cid) {
|
|
20
|
-
|
|
19
|
+
await this.ready;
|
|
20
|
+
const data = await this.client.gateways.public.get(cid);
|
|
21
|
+
return data;
|
|
21
22
|
}
|
|
22
23
|
async url(cid) {
|
|
24
|
+
await this.ready;
|
|
23
25
|
return await this.client.gateways.convert(cid);
|
|
24
26
|
}
|
|
25
27
|
}
|
|
@@ -31,9 +33,12 @@ export class PinataClient {
|
|
|
31
33
|
* @param fileName 可选:内存数据的文件名
|
|
32
34
|
*/
|
|
33
35
|
export async function pinFileToIPFSWithJWT(jwt, filePath, data, fileName) {
|
|
34
|
-
const
|
|
36
|
+
const axiosMod = await import('axios');
|
|
37
|
+
const FormDataMod = await import('form-data');
|
|
38
|
+
const fsMod = await import('fs');
|
|
39
|
+
const form = new FormDataMod.default ? new FormDataMod.default() : new FormDataMod();
|
|
35
40
|
if (filePath && filePath.length > 0) {
|
|
36
|
-
form.append('file', createReadStream(filePath));
|
|
41
|
+
form.append('file', fsMod.createReadStream(filePath));
|
|
37
42
|
}
|
|
38
43
|
else if (data) {
|
|
39
44
|
form.append('file', data, { filename: fileName || 'upload.bin' });
|
|
@@ -41,17 +46,17 @@ export async function pinFileToIPFSWithJWT(jwt, filePath, data, fileName) {
|
|
|
41
46
|
else {
|
|
42
47
|
throw new Error('pinFileToIPFSWithJWT: either filePath or data must be provided');
|
|
43
48
|
}
|
|
44
|
-
const resp = await
|
|
45
|
-
headers: { Authorization: `Bearer ${jwt}`, ...form.getHeaders() },
|
|
49
|
+
const resp = await axiosMod.default.post('https://api.pinata.cloud/pinning/pinFileToIPFS', form, {
|
|
50
|
+
headers: { Authorization: `Bearer ${jwt}`, ...(form.getHeaders ? form.getHeaders() : {}) },
|
|
46
51
|
maxContentLength: Infinity,
|
|
47
|
-
maxBodyLength: Infinity
|
|
52
|
+
maxBodyLength: Infinity
|
|
48
53
|
});
|
|
49
|
-
const d = resp.data
|
|
54
|
+
const d = resp.data || {};
|
|
50
55
|
return {
|
|
51
|
-
cid: d.IpfsHash || d.cid
|
|
56
|
+
cid: d.IpfsHash || d.cid,
|
|
52
57
|
size: d.PinSize,
|
|
53
58
|
timestamp: d.Timestamp,
|
|
54
|
-
raw: d
|
|
59
|
+
raw: d
|
|
55
60
|
};
|
|
56
61
|
}
|
|
57
62
|
/**
|
|
@@ -65,23 +70,23 @@ export async function pinImageByPath(jwt, filePath) {
|
|
|
65
70
|
// 说明:使用浏览器自带 FormData + fetch;参数为 File/Blob 或 dataURL
|
|
66
71
|
export async function pinFileToIPFSWithJWTWeb(jwt, file, fileName) {
|
|
67
72
|
const form = new FormData();
|
|
68
|
-
const name = fileName ||
|
|
73
|
+
const name = fileName || file.name || 'upload.bin';
|
|
69
74
|
form.append('file', file, name);
|
|
70
75
|
const resp = await fetch('https://api.pinata.cloud/pinning/pinFileToIPFS', {
|
|
71
76
|
method: 'POST',
|
|
72
77
|
headers: { Authorization: `Bearer ${jwt}` },
|
|
73
|
-
body: form
|
|
78
|
+
body: form
|
|
74
79
|
});
|
|
75
80
|
if (!resp.ok) {
|
|
76
81
|
const txt = await resp.text();
|
|
77
82
|
throw new Error(`Pinata upload failed: ${resp.status} ${txt}`);
|
|
78
83
|
}
|
|
79
|
-
const d =
|
|
84
|
+
const d = await resp.json();
|
|
80
85
|
return {
|
|
81
|
-
cid: d.IpfsHash || d.cid
|
|
86
|
+
cid: d.IpfsHash || d.cid,
|
|
82
87
|
size: d.PinSize,
|
|
83
88
|
timestamp: d.Timestamp,
|
|
84
|
-
raw: d
|
|
89
|
+
raw: d
|
|
85
90
|
};
|
|
86
91
|
}
|
|
87
92
|
export function dataURLToBlob(dataUrl) {
|
|
@@ -4,7 +4,76 @@ export declare const BLOCKRAZOR_BUILDER_EOA: "0x1266C6bE60392A8Ff346E8d5ECCd3E69
|
|
|
4
4
|
export type FlapAnyConfig = FlapBundleMerkleConfig | FlapSignConfig;
|
|
5
5
|
export declare const CHAIN_ID_MAP: Record<FlapChainForMerkleBundle, number>;
|
|
6
6
|
export declare const MERKLE_SUPPORTED_CHAIN_IDS: readonly [56, 1];
|
|
7
|
-
export type MerkleSupportedChainId =
|
|
7
|
+
export type MerkleSupportedChainId = typeof MERKLE_SUPPORTED_CHAIN_IDS[number];
|
|
8
8
|
export declare const PORTAL_ABI: string[];
|
|
9
|
-
export
|
|
10
|
-
|
|
9
|
+
export declare const ERRORS: {
|
|
10
|
+
NO_PRIVATE_KEY: {
|
|
11
|
+
en: string;
|
|
12
|
+
zh: string;
|
|
13
|
+
};
|
|
14
|
+
AMOUNT_MISMATCH: {
|
|
15
|
+
en: (buyCount: number, buyerCount: number) => string;
|
|
16
|
+
zh: (buyCount: number, buyerCount: number) => string;
|
|
17
|
+
};
|
|
18
|
+
KEY_AMOUNT_MISMATCH: {
|
|
19
|
+
en: string;
|
|
20
|
+
zh: string;
|
|
21
|
+
};
|
|
22
|
+
SELL_KEY_AMOUNT_MISMATCH: {
|
|
23
|
+
en: string;
|
|
24
|
+
zh: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare function getErrorMessage(key: keyof typeof ERRORS, ...args: any[]): string;
|
|
28
|
+
export declare function getTxType(config: FlapAnyConfig): 0 | 2;
|
|
29
|
+
export declare function getGasPriceMultiplier(config: FlapAnyConfig): number;
|
|
30
|
+
export declare function getBundleOptions(config: FlapBundleMerkleConfig, blockOffset?: number): {
|
|
31
|
+
blockOffset: number;
|
|
32
|
+
minBlockOffset: number;
|
|
33
|
+
autoRetry: boolean;
|
|
34
|
+
maxRetries: number;
|
|
35
|
+
};
|
|
36
|
+
export declare function getGasPriceConfig(config: FlapAnyConfig): any;
|
|
37
|
+
/**
|
|
38
|
+
* 检查是否需要提取利润
|
|
39
|
+
* ✅ 强制开启,始终返回 true
|
|
40
|
+
*/
|
|
41
|
+
export declare function shouldExtractProfit(config?: FlapAnyConfig): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* 获取利润率(单位:基点 bps,1 bps = 0.01%)
|
|
44
|
+
* ✅ 硬编码:30 bps = 0.3% = 千分之3
|
|
45
|
+
*/
|
|
46
|
+
export declare function getProfitRateBps(config?: FlapAnyConfig): number;
|
|
47
|
+
/**
|
|
48
|
+
* 获取利润接收地址
|
|
49
|
+
*/
|
|
50
|
+
export declare function getProfitRecipient(config?: FlapAnyConfig): string;
|
|
51
|
+
/**
|
|
52
|
+
* 计算利润和剩余金额
|
|
53
|
+
* ✅ 强制提取利润:使用硬编码的利润率
|
|
54
|
+
* @param amount 原始金额
|
|
55
|
+
* @param config 配置(保留参数但不使用,保持兼容性)
|
|
56
|
+
* @returns { profit: 利润金额, remaining: 剩余金额 }
|
|
57
|
+
*/
|
|
58
|
+
export declare function calculateProfit(amount: bigint, config?: FlapAnyConfig): {
|
|
59
|
+
profit: bigint;
|
|
60
|
+
remaining: bigint;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* 批量计算利润
|
|
64
|
+
* ✅ 强制提取利润:使用硬编码的利润率
|
|
65
|
+
* @param amounts 原始金额数组
|
|
66
|
+
* @param config 配置(保留参数但不使用,保持兼容性)
|
|
67
|
+
* @returns { totalProfit: 总利润, remainingAmounts: 剩余金额数组 }
|
|
68
|
+
*/
|
|
69
|
+
export declare function calculateBatchProfit(amounts: bigint[], config?: FlapAnyConfig): {
|
|
70
|
+
totalProfit: bigint;
|
|
71
|
+
remainingAmounts: bigint[];
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* 获取 BlockRazor 贿赂金额(wei)
|
|
75
|
+
* ✅ 用于提高 bundle 打包优先级
|
|
76
|
+
* @param config 配置
|
|
77
|
+
* @returns 贿赂金额(wei),如果未配置则返回 0n
|
|
78
|
+
*/
|
|
79
|
+
export declare function getBribeAmount(config?: FlapAnyConfig): bigint;
|