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
|
@@ -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';
|
|
@@ -30,7 +30,8 @@ export const FLAP_ORIGINAL_PORTAL_ADDRESSES = {
|
|
|
30
30
|
export const FLAP_TOKEN_IMPL_ADDRESSES = {
|
|
31
31
|
BSC_NORMAL: '0x8b4329947e34b6d56d71a3385cac122bade7d78d',
|
|
32
32
|
BSC_TAXED: '0x29e6383F0ce68507b5A72a53c2B118a118332aA8', // V2: 只有运营钱包的税代币
|
|
33
|
-
BSC_TAXED_V5: '0xae562c6A05b798499507c6276C6Ed796027807BA', // V5
|
|
33
|
+
BSC_TAXED_V5: '0xae562c6A05b798499507c6276C6Ed796027807BA', // Legacy V5 impl(已由 V3 取代)
|
|
34
|
+
BSC_TAXED_V3: '0x024f18294970B5c76c0691b87f138A0317156422', // V3: VaultPortal.newTokenV6WithVault / Portal.newTokenV6 税币
|
|
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
|
*
|
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
* 使用时请从具体文件导入
|
|
8
8
|
*/
|
|
9
9
|
export { FlapPortal, FlapPortalWriter, type FlapChain, // 主要的 FlapChain 定义
|
|
10
|
-
type PortalConfig, type TokenStateV2, type TokenStateV3, type TokenStateV4, type TokenStateV5, type TokenStateV7, type QuoteExactInputParams, type ExactInputParams, type ExactInputV3Params, type NewTokenV3Params, type NewTokenV4Params, type NewTokenV5Params, type TaxDistributionConfig, validateTaxDistribution, TokenStatus, TokenVersion,
|
|
10
|
+
type PortalConfig, type TokenStateV2, type TokenStateV3, type TokenStateV4, type TokenStateV5, type TokenStateV7, type QuoteExactInputParams, type ExactInputParams, type ExactInputV3Params, type NewTokenV3Params, type NewTokenV4Params, type NewTokenV5Params, type TaxDistributionConfig, validateTaxDistribution, TokenStatus, TokenVersion, DexThreshType, MigratorType, V3LPFeeProfile, lpFeeProfileToV3Fee, DEXId, } from './portal.js';
|
|
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
|
-
export {
|
|
16
|
+
export { buildNewTokenV6Params, normalizeTaxV2Fields, NEW_TOKEN_V6_ABI, getTaxV3LaunchVanityOptions, } from './launch-v6.js';
|
|
17
17
|
export { getFlapMetaByAddress, getFlapMetasByAddresses } from './meta.js';
|
|
18
18
|
export { parseFlapError, getFlapErrorMessage, getFlapErrorMessageEn, type FlapErrorCode } from './errors.js';
|
|
19
|
-
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
|
|
19
|
+
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';
|
|
20
20
|
export * from './abi.js';
|
|
21
21
|
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';
|
|
22
22
|
export * from './portal-bundle-merkle/index.js';
|
|
23
|
-
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';
|
|
23
|
+
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, buildNewTokenV6WithVaultParams, getVaultLaunchVanityOptions, TOKEN_TAXED_V3_VERSION, getVaultFactoryAddress, getVaultPortalAddress, queryVaultDataSchema, queryVaultUISchema, queryVaultDescription, validateVaultFactory, getVaultInfo, isValidContract, } from './vault.js';
|
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
* 使用时请从具体文件导入
|
|
8
8
|
*/
|
|
9
9
|
// 核心模块 - 显式导出避免冲突
|
|
10
|
-
export { FlapPortal, FlapPortalWriter, validateTaxDistribution, TokenStatus, TokenVersion,
|
|
10
|
+
export { FlapPortal, FlapPortalWriter, validateTaxDistribution, TokenStatus, TokenVersion, DexThreshType, MigratorType, V3LPFeeProfile, lpFeeProfileToV3Fee, DEXId, } from './portal.js';
|
|
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
|
-
export {
|
|
16
|
+
export { buildNewTokenV6Params, normalizeTaxV2Fields, NEW_TOKEN_V6_ABI, getTaxV3LaunchVanityOptions, } from './launch-v6.js';
|
|
17
17
|
export { getFlapMetaByAddress, getFlapMetasByAddresses } from './meta.js';
|
|
18
18
|
export { parseFlapError, getFlapErrorMessage, getFlapErrorMessageEn } from './errors.js';
|
|
19
|
-
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
|
|
19
|
+
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';
|
|
20
20
|
export * from './abi.js';
|
|
21
21
|
// Bundle 功能
|
|
22
22
|
export { createTokenWithBundleBuy, batchBuyWithBundle, batchSellWithBundle, flapPrivateBuy, flapPrivateSell, flapBatchPrivateBuy, flapBatchPrivateSell, } from './portal-bundle.js';
|
|
@@ -29,6 +29,6 @@ NONE_EXTENSION_ID, VAULT_TYPE_LABELS, VAULT_TYPE_CATEGORIES, VAULT_FACTORY_ADDRE
|
|
|
29
29
|
// ABI
|
|
30
30
|
VAULT_FACTORY_ABI, VAULT_FACTORY_V2_ABI, VAULT_BASE_ABI, VAULT_BASE_V2_ABI,
|
|
31
31
|
// 工具函数
|
|
32
|
-
encodeVaultData, buildVaultParams, buildVaultExtensionParams, getVaultFactoryAddress, getVaultPortalAddress,
|
|
32
|
+
encodeVaultData, buildVaultParams, buildVaultExtensionParams, buildNewTokenV6WithVaultParams, getVaultLaunchVanityOptions, TOKEN_TAXED_V3_VERSION, getVaultFactoryAddress, getVaultPortalAddress,
|
|
33
33
|
// 链上查询
|
|
34
34
|
queryVaultDataSchema, queryVaultUISchema, queryVaultDescription, validateVaultFactory, getVaultInfo, isValidContract, } from './vault.js';
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flap Portal newTokenV6 参数构建(对齐官方文档)
|
|
3
|
+
* @see https://docs.flap.sh/flap/developers/token-launcher-developers/launch-token-through-portal
|
|
4
|
+
*/
|
|
5
|
+
import { TokenVersion } from './portal.js';
|
|
6
|
+
import type { TaxV2Config } from './portal-bundle-merkle/types.js';
|
|
7
|
+
export type NewTokenV6LaunchFields = {
|
|
8
|
+
name: string;
|
|
9
|
+
symbol: string;
|
|
10
|
+
meta: string;
|
|
11
|
+
dexThresh?: number;
|
|
12
|
+
salt?: string;
|
|
13
|
+
migratorType?: number;
|
|
14
|
+
quoteToken?: string;
|
|
15
|
+
quoteAmt?: bigint;
|
|
16
|
+
beneficiary: string;
|
|
17
|
+
permitData?: string;
|
|
18
|
+
extensionID?: string;
|
|
19
|
+
extensionData?: string;
|
|
20
|
+
dexId?: number;
|
|
21
|
+
lpFeeProfile?: number;
|
|
22
|
+
buyTaxRate?: number;
|
|
23
|
+
sellTaxRate?: number;
|
|
24
|
+
taxRate?: number;
|
|
25
|
+
taxDuration?: bigint | number;
|
|
26
|
+
antiFarmerDuration?: bigint | number;
|
|
27
|
+
mktBps?: number;
|
|
28
|
+
deflationBps?: number;
|
|
29
|
+
dividendBps?: number;
|
|
30
|
+
lpBps?: number;
|
|
31
|
+
minimumShareBalance?: bigint;
|
|
32
|
+
dividendToken?: string;
|
|
33
|
+
commissionReceiver?: string;
|
|
34
|
+
tokenVersion?: TokenVersion;
|
|
35
|
+
};
|
|
36
|
+
export type BuildNewTokenV6FromTaxV2Input = {
|
|
37
|
+
tokenInfo: {
|
|
38
|
+
name: string;
|
|
39
|
+
symbol: string;
|
|
40
|
+
meta: string;
|
|
41
|
+
};
|
|
42
|
+
taxV2: TaxV2Config;
|
|
43
|
+
beneficiary: string;
|
|
44
|
+
salt?: string;
|
|
45
|
+
taxRate?: number;
|
|
46
|
+
buyTaxRate?: number;
|
|
47
|
+
sellTaxRate?: number;
|
|
48
|
+
dexThresh?: number;
|
|
49
|
+
migratorType?: number;
|
|
50
|
+
quoteToken?: string;
|
|
51
|
+
quoteAmt?: bigint;
|
|
52
|
+
dexId?: number;
|
|
53
|
+
lpFeeProfile?: number;
|
|
54
|
+
extensionID?: string;
|
|
55
|
+
extensionData?: string;
|
|
56
|
+
commissionReceiver?: string;
|
|
57
|
+
dividendToken?: string;
|
|
58
|
+
};
|
|
59
|
+
/** Portal.newTokenV6 ABI(ethers 简写格式,供 Contract 使用) */
|
|
60
|
+
export declare const NEW_TOKEN_V6_ABI = "function newTokenV6((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint8 migratorType,address quoteToken,uint256 quoteAmt,address beneficiary,bytes permitData,bytes32 extensionID,bytes extensionData,uint8 dexId,uint8 lpFeeProfile,uint16 buyTaxRate,uint16 sellTaxRate,uint64 taxDuration,uint64 antiFarmerDuration,uint16 mktBps,uint16 deflationBps,uint16 dividendBps,uint16 lpBps,uint256 minimumShareBalance,address dividendToken,address commissionReceiver,uint8 tokenVersion)) external payable returns (address)";
|
|
61
|
+
export declare function normalizeTaxV2Fields(taxV2: TaxV2Config): (TaxV2Config & {
|
|
62
|
+
mktBps: number;
|
|
63
|
+
deflationBps: number;
|
|
64
|
+
dividendBps: number;
|
|
65
|
+
lpBps: number;
|
|
66
|
+
minimumShareBalance?: number;
|
|
67
|
+
}) | {
|
|
68
|
+
taxDuration: number;
|
|
69
|
+
antiFarmerDuration: number;
|
|
70
|
+
mktBps: number;
|
|
71
|
+
deflationBps: number;
|
|
72
|
+
dividendBps: number;
|
|
73
|
+
lpBps: number;
|
|
74
|
+
minimumShareBalance: number | undefined;
|
|
75
|
+
vaultConfig: import("./vault.js").TaxVaultConfig | undefined;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* 构建 Portal.newTokenV6 参数
|
|
79
|
+
* - 无税:tokenVersion = TOKEN_V2_PERMIT,税字段为 0
|
|
80
|
+
* - 高级税(无金库):tokenVersion = TOKEN_TAXED_V3
|
|
81
|
+
*/
|
|
82
|
+
export declare function buildNewTokenV6Params(input: BuildNewTokenV6FromTaxV2Input | NewTokenV6LaunchFields): {
|
|
83
|
+
name: string;
|
|
84
|
+
symbol: string;
|
|
85
|
+
meta: string;
|
|
86
|
+
dexThresh: number;
|
|
87
|
+
salt: string;
|
|
88
|
+
migratorType: number;
|
|
89
|
+
quoteToken: string;
|
|
90
|
+
quoteAmt: bigint;
|
|
91
|
+
beneficiary: string;
|
|
92
|
+
permitData: string;
|
|
93
|
+
extensionID: string;
|
|
94
|
+
extensionData: string;
|
|
95
|
+
dexId: number;
|
|
96
|
+
lpFeeProfile: number;
|
|
97
|
+
buyTaxRate: number;
|
|
98
|
+
sellTaxRate: number;
|
|
99
|
+
taxDuration: bigint;
|
|
100
|
+
antiFarmerDuration: bigint;
|
|
101
|
+
mktBps: number;
|
|
102
|
+
deflationBps: number;
|
|
103
|
+
dividendBps: number;
|
|
104
|
+
lpBps: number;
|
|
105
|
+
minimumShareBalance: bigint;
|
|
106
|
+
dividendToken: string;
|
|
107
|
+
commissionReceiver: string;
|
|
108
|
+
tokenVersion: TokenVersion;
|
|
109
|
+
};
|
|
110
|
+
/** 高级税(无金库)Vanity:TOKEN_TAXED_V3 + 后缀 7777 */
|
|
111
|
+
export declare function getTaxV3LaunchVanityOptions(chain: string): {
|
|
112
|
+
taxed: boolean;
|
|
113
|
+
taxedV3: boolean;
|
|
114
|
+
taxedV5: boolean;
|
|
115
|
+
suffix: string | undefined;
|
|
116
|
+
chain: "BSC" | "BASE" | "XLAYER" | "MORPH" | "MONAD";
|
|
117
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flap Portal newTokenV6 参数构建(对齐官方文档)
|
|
3
|
+
* @see https://docs.flap.sh/flap/developers/token-launcher-developers/launch-token-through-portal
|
|
4
|
+
*/
|
|
5
|
+
import { ZeroAddress } from 'ethers';
|
|
6
|
+
import { TokenVersion } from './portal.js';
|
|
7
|
+
const NONE_EXTENSION_ID = '0x' + '00'.repeat(32);
|
|
8
|
+
/** Portal.newTokenV6 ABI(ethers 简写格式,供 Contract 使用) */
|
|
9
|
+
export const NEW_TOKEN_V6_ABI = 'function newTokenV6((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint8 migratorType,address quoteToken,uint256 quoteAmt,address beneficiary,bytes permitData,bytes32 extensionID,bytes extensionData,uint8 dexId,uint8 lpFeeProfile,uint16 buyTaxRate,uint16 sellTaxRate,uint64 taxDuration,uint64 antiFarmerDuration,uint16 mktBps,uint16 deflationBps,uint16 dividendBps,uint16 lpBps,uint256 minimumShareBalance,address dividendToken,address commissionReceiver,uint8 tokenVersion)) external payable returns (address)';
|
|
10
|
+
export function normalizeTaxV2Fields(taxV2) {
|
|
11
|
+
if ('distribution' in taxV2) {
|
|
12
|
+
return {
|
|
13
|
+
taxDuration: taxV2.taxDuration,
|
|
14
|
+
antiFarmerDuration: taxV2.antiFarmerDuration,
|
|
15
|
+
mktBps: taxV2.distribution.mktBps,
|
|
16
|
+
deflationBps: taxV2.distribution.deflationBps,
|
|
17
|
+
dividendBps: taxV2.distribution.dividendBps,
|
|
18
|
+
lpBps: taxV2.distribution.lpBps,
|
|
19
|
+
minimumShareBalance: taxV2.distribution.minimumShareBalance,
|
|
20
|
+
vaultConfig: taxV2.vaultConfig,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return taxV2;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 构建 Portal.newTokenV6 参数
|
|
27
|
+
* - 无税:tokenVersion = TOKEN_V2_PERMIT,税字段为 0
|
|
28
|
+
* - 高级税(无金库):tokenVersion = TOKEN_TAXED_V3
|
|
29
|
+
*/
|
|
30
|
+
export function buildNewTokenV6Params(input) {
|
|
31
|
+
if ('taxV2' in input && input.taxV2) {
|
|
32
|
+
const tv2 = normalizeTaxV2Fields(input.taxV2);
|
|
33
|
+
const total = tv2.mktBps + tv2.deflationBps + tv2.dividendBps + tv2.lpBps;
|
|
34
|
+
if (total !== 10000) {
|
|
35
|
+
throw new Error(`Tax distribution must sum to 10000 (100%), got ${total}`);
|
|
36
|
+
}
|
|
37
|
+
const buyTaxRate = (input.buyTaxRate ?? input.taxRate ?? 0) & 0xffff;
|
|
38
|
+
const sellTaxRate = (input.sellTaxRate ?? input.taxRate ?? 0) & 0xffff;
|
|
39
|
+
if (buyTaxRate <= 0 || sellTaxRate <= 0) {
|
|
40
|
+
throw new Error('Tax launch requires buyTaxRate and sellTaxRate > 0');
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
name: input.tokenInfo.name,
|
|
44
|
+
symbol: input.tokenInfo.symbol,
|
|
45
|
+
meta: input.tokenInfo.meta,
|
|
46
|
+
dexThresh: (input.dexThresh ?? 1) & 0xff,
|
|
47
|
+
salt: input.salt ?? ('0x' + '00'.repeat(32)),
|
|
48
|
+
migratorType: (input.migratorType ?? 0) & 0xff,
|
|
49
|
+
quoteToken: input.quoteToken || ZeroAddress,
|
|
50
|
+
quoteAmt: input.quoteAmt ?? 0n,
|
|
51
|
+
beneficiary: input.beneficiary,
|
|
52
|
+
permitData: '0x',
|
|
53
|
+
extensionID: input.extensionID ?? NONE_EXTENSION_ID,
|
|
54
|
+
extensionData: input.extensionData ?? '0x',
|
|
55
|
+
dexId: (input.dexId ?? 0) & 0xff,
|
|
56
|
+
lpFeeProfile: (input.lpFeeProfile ?? 0) & 0xff,
|
|
57
|
+
buyTaxRate,
|
|
58
|
+
sellTaxRate,
|
|
59
|
+
taxDuration: BigInt(tv2.taxDuration),
|
|
60
|
+
antiFarmerDuration: BigInt(tv2.antiFarmerDuration),
|
|
61
|
+
mktBps: tv2.mktBps & 0xffff,
|
|
62
|
+
deflationBps: tv2.deflationBps & 0xffff,
|
|
63
|
+
dividendBps: tv2.dividendBps & 0xffff,
|
|
64
|
+
lpBps: tv2.lpBps & 0xffff,
|
|
65
|
+
minimumShareBalance: BigInt(tv2.minimumShareBalance ?? 10000) * (10n ** 18n),
|
|
66
|
+
dividendToken: input.dividendToken ?? ZeroAddress,
|
|
67
|
+
commissionReceiver: input.commissionReceiver ?? ZeroAddress,
|
|
68
|
+
tokenVersion: TokenVersion.TOKEN_TAXED_V3,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const p = input;
|
|
72
|
+
const isStandard = (p.tokenVersion ?? TokenVersion.TOKEN_V2_PERMIT) === TokenVersion.TOKEN_V2_PERMIT;
|
|
73
|
+
return {
|
|
74
|
+
name: p.name,
|
|
75
|
+
symbol: p.symbol,
|
|
76
|
+
meta: p.meta,
|
|
77
|
+
dexThresh: (p.dexThresh ?? 1) & 0xff,
|
|
78
|
+
salt: p.salt ?? ('0x' + '00'.repeat(32)),
|
|
79
|
+
migratorType: (p.migratorType ?? 0) & 0xff,
|
|
80
|
+
quoteToken: p.quoteToken || ZeroAddress,
|
|
81
|
+
quoteAmt: p.quoteAmt ?? 0n,
|
|
82
|
+
beneficiary: p.beneficiary,
|
|
83
|
+
permitData: p.permitData ?? '0x',
|
|
84
|
+
extensionID: p.extensionID ?? NONE_EXTENSION_ID,
|
|
85
|
+
extensionData: p.extensionData ?? '0x',
|
|
86
|
+
dexId: (p.dexId ?? 0) & 0xff,
|
|
87
|
+
lpFeeProfile: (p.lpFeeProfile ?? 0) & 0xff,
|
|
88
|
+
buyTaxRate: isStandard ? 0 : ((p.buyTaxRate ?? p.taxRate ?? 0) & 0xffff),
|
|
89
|
+
sellTaxRate: isStandard ? 0 : ((p.sellTaxRate ?? p.taxRate ?? 0) & 0xffff),
|
|
90
|
+
taxDuration: BigInt(p.taxDuration ?? 0),
|
|
91
|
+
antiFarmerDuration: BigInt(p.antiFarmerDuration ?? 0),
|
|
92
|
+
mktBps: (p.mktBps ?? 0) & 0xffff,
|
|
93
|
+
deflationBps: (p.deflationBps ?? 0) & 0xffff,
|
|
94
|
+
dividendBps: (p.dividendBps ?? 0) & 0xffff,
|
|
95
|
+
lpBps: (p.lpBps ?? 0) & 0xffff,
|
|
96
|
+
minimumShareBalance: p.minimumShareBalance ?? 0n,
|
|
97
|
+
dividendToken: p.dividendToken ?? ZeroAddress,
|
|
98
|
+
commissionReceiver: isStandard ? ZeroAddress : (p.commissionReceiver ?? ZeroAddress),
|
|
99
|
+
tokenVersion: p.tokenVersion ?? TokenVersion.TOKEN_V2_PERMIT,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** 高级税(无金库)Vanity:TOKEN_TAXED_V3 + 后缀 7777 */
|
|
103
|
+
export function getTaxV3LaunchVanityOptions(chain) {
|
|
104
|
+
return {
|
|
105
|
+
taxed: true,
|
|
106
|
+
taxedV3: true,
|
|
107
|
+
taxedV5: false,
|
|
108
|
+
suffix: undefined,
|
|
109
|
+
chain: chain.toUpperCase(),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
@@ -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 {};
|