four-flap-meme-sdk 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/four-meme/approve-tokenmanager.d.ts +2 -2
- package/dist/bundle/four-meme/approve-tokenmanager.js +3 -3
- package/dist/bundle/four-meme/core/buy-flow.d.ts +5 -0
- package/dist/bundle/four-meme/core/buy-flow.js +147 -0
- package/dist/bundle/four-meme/core/constants.d.ts +6 -0
- package/dist/bundle/four-meme/core/constants.js +15 -0
- package/dist/bundle/four-meme/core/create-token.d.ts +5 -0
- package/dist/bundle/four-meme/core/create-token.js +137 -0
- package/dist/bundle/four-meme/core/index.d.ts +14 -0
- package/dist/bundle/four-meme/core/index.js +14 -0
- package/dist/bundle/four-meme/core/sell-flow.d.ts +5 -0
- package/dist/bundle/four-meme/core/sell-flow.js +240 -0
- package/dist/bundle/four-meme/core-helpers.js +1 -1
- package/dist/bundle/four-meme/core.d.ts +7 -4
- package/dist/bundle/four-meme/core.js +5 -513
- package/dist/bundle/four-meme/pancake-proxy/approve.d.ts +15 -0
- package/dist/bundle/four-meme/pancake-proxy/approve.js +113 -0
- package/dist/bundle/four-meme/pancake-proxy/buy.d.ts +8 -0
- package/dist/bundle/four-meme/pancake-proxy/buy.js +143 -0
- package/dist/bundle/four-meme/pancake-proxy/constants.d.ts +25 -0
- package/dist/bundle/four-meme/pancake-proxy/constants.js +14 -0
- package/dist/bundle/four-meme/pancake-proxy/helpers.d.ts +45 -0
- package/dist/bundle/four-meme/pancake-proxy/helpers.js +232 -0
- package/dist/bundle/four-meme/pancake-proxy/index.d.ts +15 -0
- package/dist/bundle/four-meme/pancake-proxy/index.js +15 -0
- package/dist/bundle/four-meme/pancake-proxy/sell.d.ts +8 -0
- package/dist/bundle/four-meme/pancake-proxy/sell.js +194 -0
- package/dist/bundle/four-meme/pancake-proxy.d.ts +4 -20
- package/dist/bundle/four-meme/pancake-proxy.js +3 -670
- package/dist/bundle/four-meme/private/buy.d.ts +16 -0
- package/dist/bundle/four-meme/private/buy.js +225 -0
- package/dist/bundle/four-meme/private/index.d.ts +11 -0
- package/dist/bundle/four-meme/private/index.js +11 -0
- package/dist/bundle/four-meme/private/sell.d.ts +18 -0
- package/dist/bundle/four-meme/private/sell.js +245 -0
- package/dist/bundle/four-meme/private.d.ts +5 -25
- package/dist/bundle/four-meme/private.js +5 -463
- package/dist/bundle/four-meme/swap/batch.d.ts +8 -0
- package/dist/bundle/four-meme/swap/batch.js +170 -0
- package/dist/bundle/four-meme/swap/bundle.d.ts +8 -0
- package/dist/bundle/four-meme/swap/bundle.js +147 -0
- package/dist/bundle/four-meme/swap/index.d.ts +14 -0
- package/dist/bundle/four-meme/swap/index.js +13 -0
- package/dist/bundle/four-meme/swap/quick-batch.d.ts +8 -0
- package/dist/bundle/four-meme/swap/quick-batch.js +206 -0
- package/dist/bundle/four-meme/swap-buy-first/helpers.d.ts +20 -0
- package/dist/bundle/four-meme/swap-buy-first/helpers.js +39 -0
- package/dist/bundle/four-meme/swap-buy-first/index.d.ts +12 -0
- package/dist/bundle/four-meme/swap-buy-first/index.js +11 -0
- package/dist/bundle/four-meme/swap-buy-first/multi-wallet.d.ts +20 -0
- package/dist/bundle/four-meme/swap-buy-first/multi-wallet.js +198 -0
- package/dist/bundle/four-meme/swap-buy-first/single.d.ts +7 -0
- package/dist/bundle/four-meme/swap-buy-first/single.js +232 -0
- package/dist/bundle/four-meme/swap-buy-first.d.ts +4 -3
- package/dist/bundle/four-meme/swap-buy-first.js +4 -451
- package/dist/bundle/four-meme/swap-hop-helpers.d.ts +2 -2
- package/dist/bundle/four-meme/swap-sign-helpers.d.ts +2 -2
- package/dist/bundle/four-meme/swap-sign-helpers.js +1 -1
- package/dist/bundle/four-meme/swap.d.ts +4 -14
- package/dist/bundle/four-meme/swap.js +4 -502
- package/dist/bundle/four-meme/types/index.d.ts +1 -1
- package/dist/bundle/four-meme/utils-disperse.d.ts +1 -1
- package/dist/bundle/four-meme/utils-disperse.js +1 -1
- package/dist/bundle/four-meme/utils-pairwise.d.ts +1 -1
- package/dist/bundle/four-meme/utils-pairwise.js +1 -1
- package/dist/bundle/four-meme/utils-sweep/context.d.ts +39 -0
- package/dist/bundle/four-meme/utils-sweep/context.js +7 -0
- package/dist/bundle/four-meme/utils-sweep/erc20-no-hop.d.ts +5 -0
- package/dist/bundle/four-meme/utils-sweep/erc20-no-hop.js +162 -0
- package/dist/bundle/four-meme/utils-sweep/index.d.ts +13 -0
- package/dist/bundle/four-meme/utils-sweep/index.js +13 -0
- package/dist/bundle/four-meme/utils-sweep/main.d.ts +8 -0
- package/dist/bundle/four-meme/utils-sweep/main.js +114 -0
- package/dist/bundle/four-meme/utils-sweep/native-no-hop.d.ts +5 -0
- package/dist/bundle/four-meme/utils-sweep/native-no-hop.js +156 -0
- package/dist/bundle/four-meme/utils-sweep/with-hops.d.ts +6 -0
- package/dist/bundle/four-meme/utils-sweep/with-hops.js +382 -0
- package/dist/bundle/four-meme/utils-sweep.d.ts +3 -4
- package/dist/bundle/four-meme/utils-sweep.js +3 -740
- package/dist/bundle/internal.d.ts +2 -2
- package/dist/bundle/sign-context-helpers.d.ts +1 -26
- package/dist/bundle/sign-context-helpers.js +1 -63
- package/dist/bundle/submit/blockrazor.d.ts +94 -0
- package/dist/bundle/submit/blockrazor.js +122 -0
- package/dist/bundle/submit/direct.d.ts +118 -0
- package/dist/bundle/submit/direct.js +484 -0
- package/dist/bundle/submit/helpers.d.ts +7 -0
- package/dist/bundle/submit/helpers.js +15 -0
- package/dist/bundle/submit/index.d.ts +14 -0
- package/dist/bundle/submit/index.js +14 -0
- package/dist/bundle/submit/merkle.d.ts +84 -0
- package/dist/bundle/submit/merkle.js +121 -0
- package/dist/bundle/submit.d.ts +3 -286
- package/dist/bundle/submit.js +3 -724
- package/dist/chains/bsc/four/types.d.ts +1 -1
- package/dist/chains/bsc/index.d.ts +1 -1
- package/dist/chains/bsc/index.js +2 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-build.d.ts +25 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-build.js +177 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-constants.d.ts +30 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-constants.js +24 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +11 -149
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +12 -74
- package/dist/chains/bsc/pancake/bundle-buy-first-multi-wallet.d.ts +9 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-multi-wallet.js +225 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-plan.d.ts +14 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-plan.js +64 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-profit.d.ts +12 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-profit.js +22 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-quote.d.ts +15 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-quote.js +122 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-types.d.ts +179 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-types.js +1 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-validate.d.ts +2 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-validate.js +41 -0
- package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +1 -1
- package/dist/chains/bsc/pancake/bundle-buy-first.js +8 -578
- package/dist/chains/bsc/pancake/bundle-swap-helpers.d.ts +11 -239
- package/dist/chains/bsc/pancake/bundle-swap-helpers.js +12 -564
- package/dist/chains/bsc/pancake/bundle-swap-types.d.ts +183 -0
- package/dist/chains/bsc/pancake/bundle-swap-types.js +17 -0
- package/dist/chains/bsc/pancake/bundle-swap.d.ts +10 -132
- package/dist/chains/bsc/pancake/bundle-swap.js +12 -1003
- package/dist/chains/bsc/pancake/hop-chain.d.ts +18 -0
- package/dist/chains/bsc/pancake/hop-chain.js +227 -0
- package/dist/chains/bsc/pancake/quote.d.ts +14 -0
- package/dist/chains/bsc/pancake/quote.js +84 -0
- package/dist/chains/bsc/pancake/swap-batch.d.ts +42 -0
- package/dist/chains/bsc/pancake/swap-batch.js +283 -0
- package/dist/chains/bsc/pancake/swap-build.d.ts +19 -0
- package/dist/chains/bsc/pancake/swap-build.js +226 -0
- package/dist/chains/bsc/pancake/swap-cross.d.ts +42 -0
- package/dist/chains/bsc/pancake/swap-cross.js +140 -0
- package/dist/chains/bsc/pancake/swap-quick.d.ts +54 -0
- package/dist/chains/bsc/pancake/swap-quick.js +424 -0
- package/dist/chains/bsc/pancake/swap-single.d.ts +2 -0
- package/dist/chains/bsc/pancake/swap-single.js +182 -0
- package/dist/chains/bsc/platforms/four/index.d.ts +21 -3
- package/dist/chains/bsc/platforms/four/index.js +28 -3
- package/dist/chains/eni/batch-router/transfer-disperse.d.ts +37 -0
- package/dist/chains/eni/batch-router/transfer-disperse.js +302 -0
- package/dist/chains/eni/batch-router/transfer-shared.d.ts +9 -0
- package/dist/chains/eni/batch-router/transfer-shared.js +10 -0
- package/dist/chains/eni/batch-router/transfer-sweep.d.ts +51 -0
- package/dist/chains/eni/batch-router/transfer-sweep.js +364 -0
- package/dist/chains/eni/batch-router/transfer.d.ts +4 -74
- package/dist/chains/eni/batch-router/transfer.js +2 -647
- package/dist/chains/eni/index.d.ts +2 -0
- package/dist/chains/eni/index.js +4 -0
- package/dist/chains/eni/platforms/daoaas/portal-direct-profit.d.ts +17 -0
- package/dist/chains/eni/platforms/daoaas/portal-direct-profit.js +30 -0
- package/dist/chains/eni/platforms/daoaas/portal-direct-submit.d.ts +12 -0
- package/dist/chains/eni/platforms/daoaas/portal-direct-submit.js +396 -0
- package/dist/chains/eni/platforms/daoaas/portal-direct-tx.d.ts +20 -0
- package/dist/chains/eni/platforms/daoaas/portal-direct-tx.js +165 -0
- package/dist/chains/eni/platforms/daoaas/portal-direct.d.ts +3 -32
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +3 -571
- package/dist/chains/eni/submit.js +1 -1
- package/dist/chains/xlayer/constants.d.ts +0 -2
- package/dist/chains/xlayer/constants.js +0 -2
- package/dist/chains/xlayer/eip7702/auth.d.ts +16 -0
- package/dist/chains/xlayer/eip7702/auth.js +81 -0
- package/dist/chains/xlayer/eip7702/bundle-create-buy.d.ts +22 -0
- package/dist/chains/xlayer/eip7702/bundle-create-buy.js +201 -0
- package/dist/chains/xlayer/eip7702/bundle-create-helpers.d.ts +114 -0
- package/dist/chains/xlayer/eip7702/bundle-create-helpers.js +139 -0
- package/dist/chains/xlayer/eip7702/bundle-create-to-dex.d.ts +24 -0
- package/dist/chains/xlayer/eip7702/bundle-create-to-dex.js +233 -0
- package/dist/chains/xlayer/eip7702/bundle-create.d.ts +3 -35
- package/dist/chains/xlayer/eip7702/bundle-create.js +3 -746
- package/dist/chains/xlayer/eip7702/bundle-graduate-buy.d.ts +22 -0
- package/dist/chains/xlayer/eip7702/bundle-graduate-buy.js +214 -0
- package/dist/chains/xlayer/eip7702/bundle-sell.js +1 -1
- package/dist/chains/xlayer/eip7702/bundle-swap-batch.d.ts +31 -0
- package/dist/chains/xlayer/eip7702/bundle-swap-batch.js +216 -0
- package/dist/chains/xlayer/eip7702/bundle-swap-helpers.d.ts +21 -0
- package/dist/chains/xlayer/eip7702/bundle-swap-helpers.js +206 -0
- package/dist/chains/xlayer/eip7702/bundle-swap-multi.d.ts +33 -0
- package/dist/chains/xlayer/eip7702/bundle-swap-multi.js +146 -0
- package/dist/chains/xlayer/eip7702/bundle-swap-single.d.ts +31 -0
- package/dist/chains/xlayer/eip7702/bundle-swap-single.js +177 -0
- package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +6 -61
- package/dist/chains/xlayer/eip7702/bundle-swap.js +3 -712
- package/dist/chains/xlayer/eip7702/bytes.d.ts +4 -0
- package/dist/chains/xlayer/eip7702/bytes.js +31 -0
- package/dist/chains/xlayer/eip7702/gas.d.ts +19 -0
- package/dist/chains/xlayer/eip7702/gas.js +152 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-disperse.d.ts +5 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-disperse.js +196 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-pairwise.d.ts +5 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-pairwise.js +188 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-sweep.d.ts +5 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-sweep.js +220 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.d.ts +8 -4
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.js +5 -591
- package/dist/chains/xlayer/eip7702/profit.d.ts +32 -0
- package/dist/chains/xlayer/eip7702/profit.js +59 -0
- package/dist/chains/xlayer/eip7702/provider.d.ts +3 -0
- package/dist/chains/xlayer/eip7702/provider.js +17 -0
- package/dist/chains/xlayer/eip7702/time.d.ts +2 -0
- package/dist/chains/xlayer/eip7702/time.js +10 -0
- package/dist/chains/xlayer/eip7702/tx-build.d.ts +10 -0
- package/dist/chains/xlayer/eip7702/tx-build.js +128 -0
- package/dist/chains/xlayer/eip7702/utils.d.ts +19 -85
- package/dist/chains/xlayer/eip7702/utils.js +19 -484
- package/dist/chains/xlayer/eip7702/volume-bundle.d.ts +13 -0
- package/dist/chains/xlayer/eip7702/volume-bundle.js +250 -0
- package/dist/chains/xlayer/eip7702/volume-internal.d.ts +13 -0
- package/dist/chains/xlayer/eip7702/volume-internal.js +169 -0
- package/dist/chains/xlayer/eip7702/volume-make.d.ts +8 -0
- package/dist/chains/xlayer/eip7702/volume-make.js +38 -0
- package/dist/chains/xlayer/eip7702/volume-single-round.d.ts +17 -0
- package/dist/chains/xlayer/eip7702/volume-single-round.js +44 -0
- package/dist/chains/xlayer/eip7702/volume-swap.d.ts +18 -0
- package/dist/chains/xlayer/eip7702/volume-swap.js +30 -0
- package/dist/chains/xlayer/eip7702/volume-wash.d.ts +8 -0
- package/dist/chains/xlayer/eip7702/volume-wash.js +191 -0
- package/dist/chains/xlayer/eip7702/volume.d.ts +7 -35
- package/dist/chains/xlayer/eip7702/volume.js +5 -697
- package/dist/chains/xlayer/eip7702/wallet.d.ts +6 -0
- package/dist/chains/xlayer/eip7702/wallet.js +17 -0
- package/dist/chains/xlayer/eoa/aa-types.d.ts +176 -0
- package/dist/chains/xlayer/eoa/aa-types.js +6 -0
- package/dist/chains/xlayer/eoa/constants.d.ts +0 -2
- package/dist/chains/xlayer/eoa/constants.js +0 -2
- package/dist/chains/xlayer/eoa/context.d.ts +8 -0
- package/dist/chains/xlayer/eoa/context.js +23 -0
- package/dist/chains/xlayer/eoa/encoders.d.ts +147 -0
- package/dist/chains/xlayer/eoa/encoders.js +147 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-cross.d.ts +5 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-cross.js +113 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts +10 -123
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +10 -225
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-pure.d.ts +50 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-pure.js +170 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-quick.d.ts +5 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-quick.js +257 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-types.d.ts +99 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-types.js +11 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.d.ts +5 -47
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.js +3 -522
- package/dist/chains/xlayer/eoa/eoa-types.d.ts +776 -0
- package/dist/chains/xlayer/eoa/eoa-types.js +6 -0
- package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +8 -0
- package/dist/chains/xlayer/eoa/eoa-wash-volume.js +8 -0
- package/dist/chains/xlayer/eoa/format.d.ts +34 -0
- package/dist/chains/xlayer/eoa/format.js +56 -0
- package/dist/chains/xlayer/eoa/hop-chain.d.ts +4 -0
- package/dist/chains/xlayer/eoa/hop-chain.js +87 -0
- package/dist/chains/xlayer/eoa/nonce-map.d.ts +20 -0
- package/dist/chains/xlayer/eoa/nonce-map.js +51 -0
- package/dist/chains/xlayer/eoa/portal-ops.d.ts +9 -292
- package/dist/chains/xlayer/eoa/portal-ops.js +9 -486
- package/dist/chains/xlayer/eoa/query.d.ts +117 -0
- package/dist/chains/xlayer/eoa/query.js +285 -0
- package/dist/chains/xlayer/eoa/quote.d.ts +6 -0
- package/dist/chains/xlayer/eoa/quote.js +90 -0
- package/dist/chains/xlayer/eoa/types.d.ts +9 -959
- package/dist/chains/xlayer/eoa/types.js +9 -49
- package/dist/core/clients/blockrazor.js +1 -1
- package/dist/core/clients/merkle.js +1 -1
- package/dist/core/erc20/allowances.d.ts +104 -0
- package/dist/core/erc20/allowances.js +205 -0
- package/dist/core/erc20/approve.d.ts +141 -0
- package/dist/core/erc20/approve.js +325 -0
- package/dist/core/erc20/helpers.d.ts +20 -0
- package/dist/core/erc20/helpers.js +109 -0
- package/dist/core/erc20/index.d.ts +13 -0
- package/dist/core/erc20/index.js +12 -0
- package/dist/core/gas/bundle-gas.d.ts +6 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/quote/index.d.ts +1 -0
- package/dist/core/quote/index.js +1 -0
- package/dist/core/quote/quote-helpers.d.ts +78 -0
- package/dist/core/quote/quote-helpers.js +289 -0
- package/dist/core/quote/types.d.ts +1 -0
- package/dist/core/quote/types.js +1 -0
- package/dist/core/sign-context-helpers.d.ts +29 -0
- package/dist/core/sign-context-helpers.js +63 -0
- package/dist/domains/dex/direct-router-helpers.d.ts +16 -268
- package/dist/domains/dex/direct-router-helpers.js +16 -535
- package/dist/domains/dex/direct-router-types.d.ts +104 -0
- package/dist/domains/dex/direct-router-types.js +81 -0
- package/dist/domains/dex/direct-router-v2-buy.d.ts +2 -0
- package/dist/domains/dex/direct-router-v2-buy.js +249 -0
- package/dist/domains/dex/direct-router-v2-sell.d.ts +5 -0
- package/dist/domains/dex/direct-router-v2-sell.js +270 -0
- package/dist/domains/dex/direct-router-v2.d.ts +9 -0
- package/dist/domains/dex/direct-router-v2.js +9 -0
- package/dist/domains/dex/direct-router-v3.d.ts +17 -0
- package/dist/domains/dex/direct-router-v3.js +432 -0
- package/dist/domains/dex/direct-router.d.ts +11 -26
- package/dist/domains/dex/direct-router.js +10 -977
- package/dist/domains/dex/dyo-encode.d.ts +62 -0
- package/dist/domains/dex/dyo-encode.js +124 -0
- package/dist/domains/dex/profit.d.ts +24 -0
- package/dist/domains/dex/profit.js +86 -0
- package/dist/domains/dex/provider.d.ts +10 -0
- package/dist/domains/dex/provider.js +27 -0
- package/dist/domains/dex/quote.d.ts +7 -0
- package/dist/domains/dex/quote.js +52 -0
- package/dist/domains/dex/router.d.ts +56 -0
- package/dist/domains/dex/router.js +193 -0
- package/dist/domains/flap/portal-bundle/batch.d.ts +9 -0
- package/dist/domains/flap/portal-bundle/batch.js +193 -0
- package/dist/domains/flap/portal-bundle/create.d.ts +5 -0
- package/dist/domains/flap/portal-bundle/create.js +153 -0
- package/dist/domains/flap/portal-bundle/helpers.d.ts +32 -0
- package/dist/domains/flap/portal-bundle/helpers.js +50 -0
- package/dist/domains/flap/portal-bundle/index.d.ts +16 -0
- package/dist/domains/flap/portal-bundle/index.js +15 -0
- package/dist/domains/flap/portal-bundle/private.d.ts +5 -0
- package/dist/domains/flap/portal-bundle/private.js +198 -0
- package/dist/domains/flap/portal-bundle/types.d.ts +102 -0
- package/dist/domains/flap/portal-bundle/types.js +1 -0
- package/dist/domains/flap/portal-bundle-merkle/core-batch.d.ts +13 -0
- package/dist/domains/flap/portal-bundle-merkle/core-batch.js +376 -0
- package/dist/domains/flap/portal-bundle-merkle/core-helpers.d.ts +75 -7
- package/dist/domains/flap/portal-bundle-merkle/core-helpers.js +259 -20
- package/dist/domains/flap/portal-bundle-merkle/core.d.ts +2 -13
- package/dist/domains/flap/portal-bundle-merkle/core.js +12 -629
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/constants.d.ts +70 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/constants.js +90 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/index.d.ts +12 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/index.js +11 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/main.d.ts +15 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/main.js +432 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/types.d.ts +113 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex/types.js +4 -0
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex.d.ts +4 -127
- package/dist/domains/flap/portal-bundle-merkle/create-to-dex.js +4 -527
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/constants.d.ts +42 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/constants.js +81 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/index.d.ts +12 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/index.js +11 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/main.d.ts +15 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/main.js +339 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/types.d.ts +72 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex/types.js +4 -0
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex.d.ts +4 -85
- package/dist/domains/flap/portal-bundle-merkle/curve-to-dex.js +4 -425
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/approve.d.ts +12 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/approve.js +102 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/buy.d.ts +5 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/buy.js +135 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/helpers.d.ts +52 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/helpers.js +267 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/index.d.ts +14 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/index.js +14 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/sell.d.ts +5 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/sell.js +195 -0
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy.d.ts +3 -24
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy.js +3 -700
- package/dist/domains/flap/portal-bundle-merkle/private/buy.d.ts +9 -0
- package/dist/domains/flap/portal-bundle-merkle/private/buy.js +188 -0
- package/dist/domains/flap/portal-bundle-merkle/private/helpers.d.ts +36 -0
- package/dist/domains/flap/portal-bundle-merkle/private/helpers.js +127 -0
- package/dist/domains/flap/portal-bundle-merkle/private/index.d.ts +12 -0
- package/dist/domains/flap/portal-bundle-merkle/private/index.js +12 -0
- package/dist/domains/flap/portal-bundle-merkle/private/sell.d.ts +9 -0
- package/dist/domains/flap/portal-bundle-merkle/private/sell.js +191 -0
- package/dist/domains/flap/portal-bundle-merkle/private.d.ts +5 -15
- package/dist/domains/flap/portal-bundle-merkle/private.js +5 -494
- package/dist/domains/flap/portal-bundle-merkle/swap-batch.js +3 -2
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-chain.d.ts +4 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-chain.js +43 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-constants.d.ts +13 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-constants.js +21 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +11 -121
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-helpers.js +11 -109
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-multi-wallet.d.ts +20 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-multi-wallet.js +223 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-plan.d.ts +32 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-plan.js +66 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-profit.d.ts +22 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-profit.js +22 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-quote.d.ts +51 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-quote.js +149 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-types.d.ts +87 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-types.js +1 -0
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first.js +5 -404
- package/dist/domains/flap/portal-bundle-merkle/swap-helpers.d.ts +0 -1
- package/dist/domains/flap/portal-bundle-merkle/swap-helpers.js +0 -7
- package/dist/domains/flap/portal-bundle-merkle/swap-planning.js +1 -1
- package/dist/domains/flap/portal-bundle-merkle/swap-quick-batch.js +3 -2
- package/dist/domains/flap/portal-bundle-merkle/swap-single.js +3 -2
- package/dist/domains/flap/portal-bundle-merkle/utils/disperse.d.ts +2 -0
- package/dist/domains/flap/portal-bundle-merkle/utils/disperse.js +275 -0
- package/dist/domains/flap/portal-bundle-merkle/utils/index.d.ts +11 -0
- package/dist/domains/flap/portal-bundle-merkle/utils/index.js +11 -0
- package/dist/domains/flap/portal-bundle-merkle/utils/sweep.d.ts +9 -0
- package/dist/domains/flap/portal-bundle-merkle/utils/sweep.js +570 -0
- package/dist/domains/flap/portal-bundle-merkle/utils.d.ts +5 -8
- package/dist/domains/flap/portal-bundle-merkle/utils.js +5 -841
- package/dist/domains/flap/portal-bundle.d.ts +5 -117
- package/dist/domains/flap/portal-bundle.js +5 -587
- package/dist/domains/flap/portal.d.ts +13 -404
- package/dist/domains/flap/portal.js +12 -619
- package/dist/domains/flap/reader.d.ts +51 -0
- package/dist/domains/flap/reader.js +275 -0
- package/dist/domains/flap/types.d.ts +246 -0
- package/dist/domains/flap/types.js +104 -0
- package/dist/domains/flap/vault/constants.d.ts +220 -0
- package/dist/domains/flap/vault/constants.js +173 -0
- package/dist/domains/flap/vault/encode.d.ts +39 -0
- package/dist/domains/flap/vault/encode.js +135 -0
- package/dist/domains/flap/vault/index.d.ts +15 -0
- package/dist/domains/flap/vault/index.js +14 -0
- package/dist/domains/flap/vault/query.d.ts +40 -0
- package/dist/domains/flap/vault/query.js +104 -0
- package/dist/domains/flap/vault/types.d.ts +147 -0
- package/dist/domains/flap/vault/types.js +29 -0
- package/dist/domains/flap/vault.d.ts +3 -413
- package/dist/domains/flap/vault.js +3 -467
- package/dist/domains/flap/writer.d.ts +124 -0
- package/dist/domains/flap/writer.js +255 -0
- package/dist/domains/four/contracts/tm-bundle-batch.d.ts +35 -0
- package/dist/domains/four/contracts/tm-bundle-batch.js +286 -0
- package/dist/domains/four/contracts/tm-bundle-create.d.ts +2 -0
- package/dist/domains/four/contracts/tm-bundle-create.js +304 -0
- package/dist/domains/four/contracts/tm-bundle-helpers.d.ts +2 -1
- package/dist/domains/four/contracts/tm-bundle-helpers.js +3 -0
- package/dist/domains/four/contracts/tm-bundle-private.d.ts +36 -0
- package/dist/domains/four/contracts/tm-bundle-private.js +164 -0
- package/dist/domains/four/contracts/tm-bundle.d.ts +10 -71
- package/dist/domains/four/contracts/tm-bundle.js +9 -738
- package/dist/domains/lp-inspect/inspect-helpers.d.ts +25 -0
- package/dist/domains/lp-inspect/inspect-helpers.js +343 -0
- package/dist/domains/lp-inspect/inspect.d.ts +8 -0
- package/dist/domains/lp-inspect/inspect.js +332 -0
- package/dist/domains/lp-inspect/lp-inspect.d.ts +9 -37
- package/dist/domains/lp-inspect/lp-inspect.js +9 -775
- package/dist/domains/lp-inspect/registry.d.ts +43 -0
- package/dist/domains/lp-inspect/registry.js +127 -0
- package/dist/domains/merkle/index.d.ts +1 -1
- package/dist/exports/root-bundle-and-tooling.d.ts +9 -1
- package/dist/exports/root-bundle-and-tooling.js +8 -1
- package/dist/exports/root-foundations.d.ts +1 -1
- package/dist/exports/root-foundations.js +1 -1
- package/dist/exports/root-swap-dex-and-xlayer.d.ts +4 -4
- package/dist/exports/root-swap-dex-and-xlayer.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/swap-helpers.js +1 -1
- package/package.json +1 -81
|
@@ -1,471 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Flap Tax Vaults(税收金库)
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 1. 金库代币通过 VaultPortal 合约创建(不是普通 Portal)
|
|
7
|
-
* 2. 调用函数:VaultPortal.newTaxTokenWithVault(params)
|
|
8
|
-
* 3. 参数中 extensionID/extensionData 始终为零值
|
|
9
|
-
* 4. 真正的金库配置通过 vaultFactory(工厂地址)和 vaultData(ABI 编码数据)传递
|
|
10
|
-
* 5. 每种金库类型对应一个具体的 VaultFactory 合约地址
|
|
11
|
-
*
|
|
12
|
-
* VaultPortal.newTaxTokenWithVault 参数结构:
|
|
13
|
-
* - 基础参数(与 Portal.newTokenV5 相同):name, symbol, meta, dexThresh, salt, taxRate,
|
|
14
|
-
* migratorType, quoteToken, quoteAmt, permitData, extensionID(全零), extensionData("0x"),
|
|
15
|
-
* dexId, lpFeeProfile, taxDuration, antiFarmerDuration, mktBps, deflationBps, dividendBps,
|
|
16
|
-
* lpBps, minimumShareBalance
|
|
17
|
-
* - 金库专属参数:vaultFactory(address), vaultData(bytes)
|
|
18
|
-
*
|
|
19
|
-
* 金库分类(来自 flap.sh 源码):
|
|
20
|
-
* 官方金库 (official):
|
|
21
|
-
* - gift (FlapXVault):禮物金庫,指定一个地址接收税费
|
|
22
|
-
* - split (SplitVault):分配金庫,按比例将税费分配给多个接收者
|
|
23
|
-
* - buyback & burn (SnowBallVault):自动回购并销毁代币
|
|
24
|
-
* 社区金库 (community):
|
|
25
|
-
* - burnToEarn (BlackHoleVault):燃燒分紅,燃烧代币以赚取分红奖励
|
|
26
|
-
* - buildYourVault:構建您的金庫,用户输入自定义 VaultFactory 地址
|
|
27
|
-
*
|
|
28
|
-
* @module vault
|
|
29
|
-
*/
|
|
30
|
-
import { Contract, AbiCoder, ZeroAddress } from 'ethers';
|
|
31
|
-
import { getErrorMessageFromUnknown } from '../../core/index.js';
|
|
32
|
-
function mapFieldDescriptor(f) {
|
|
33
|
-
return {
|
|
34
|
-
name: f.name,
|
|
35
|
-
fieldType: f.fieldType,
|
|
36
|
-
description: f.description,
|
|
37
|
-
decimals: Number(f.decimals),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
function mapApproveAction(a) {
|
|
41
|
-
return {
|
|
42
|
-
tokenType: a.tokenType,
|
|
43
|
-
amountFieldName: a.amountFieldName,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function mapVaultMethodSchema(m) {
|
|
47
|
-
return {
|
|
48
|
-
name: m.name,
|
|
49
|
-
description: m.description,
|
|
50
|
-
inputs: m.inputs.map(mapFieldDescriptor),
|
|
51
|
-
outputs: m.outputs.map(mapFieldDescriptor),
|
|
52
|
-
approvals: m.approvals.map(mapApproveAction),
|
|
53
|
-
isInputArray: m.isInputArray,
|
|
54
|
-
isOutputArray: m.isOutputArray,
|
|
55
|
-
isWriteMethod: m.isWriteMethod,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* 金库类型显示标签
|
|
60
|
-
*/
|
|
61
|
-
export const VAULT_TYPE_LABELS = {
|
|
62
|
-
none: '无金库(标准税收)',
|
|
63
|
-
gift: 'FlapXVault — 禮物金庫',
|
|
64
|
-
split: 'SplitVault — 分配金庫',
|
|
65
|
-
buyback_burn: 'SnowBallVault — Buyback & Burn',
|
|
66
|
-
burnToEarn: 'BlackHoleVault — 燃燒分紅',
|
|
67
|
-
buildYourVault: 'Build Your Vault — 構建您的金庫',
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* 金库类型分类(对齐 flap.sh 的 category 字段)
|
|
71
|
-
*/
|
|
72
|
-
export const VAULT_TYPE_CATEGORIES = {
|
|
73
|
-
official: ['gift', 'split', 'buyback_burn'],
|
|
74
|
-
community: ['burnToEarn', 'buildYourVault'],
|
|
75
|
-
};
|
|
76
|
-
// ============================================================================
|
|
77
|
-
// VaultPortal 合约地址(从 flap.sh 源码提取)
|
|
78
|
-
// ============================================================================
|
|
79
|
-
/**
|
|
80
|
-
* VaultPortal 合约地址
|
|
81
|
-
*
|
|
82
|
-
* ⚠️ 金库代币通过 VaultPortal 创建,不是普通 Portal
|
|
83
|
-
* 来源:flap.sh/_next/static/chunks/2601-*.js
|
|
84
|
-
*/
|
|
85
|
-
export const VAULT_PORTAL_ADDRESSES = {
|
|
86
|
-
BSC: '0x90497450f2a706f1951b5bdda52B4E5d16f34C06',
|
|
87
|
-
BASE: '0x027e3704fC5C16522e9393d04C60A3ac5c0d775f',
|
|
88
|
-
};
|
|
89
|
-
// ============================================================================
|
|
90
|
-
// VaultFactory 合约地址(从 flap.sh 源码提取)
|
|
91
|
-
// ============================================================================
|
|
92
|
-
/**
|
|
93
|
-
* VaultFactory 合约地址(每种金库类型 + 每条链)
|
|
94
|
-
*
|
|
95
|
-
* ⚠️ 直接从 flap.sh 前端 JS 源码中提取的真实地址
|
|
96
|
-
* 来源:flap.sh/_next/static/chunks/2601-*.js 中 taxVaults.vaultTypes[]
|
|
97
|
-
*/
|
|
98
|
-
export const VAULT_FACTORY_ADDRESSES = {
|
|
99
|
-
BSC: {
|
|
100
|
-
gift: '0x025549F52B03cF36f9e1a337c02d3AA7Af66ab32',
|
|
101
|
-
split: '0xfab75Dc774cB9B38b91749B8833360B46a52345F',
|
|
102
|
-
// bnbshare: '0x53AD93F2454cFA532656f80E30571159d7E726A7', // 已禁用 (enabled: false)
|
|
103
|
-
buyback_burn: '0xB64655dab7156c29B63C70fb3ED7f071e2658D19',
|
|
104
|
-
burnToEarn: '0x47A216040Dc9e0AfE2e6fc5dcC44f7bBD1B60d25',
|
|
105
|
-
buildYourVault: ZeroAddress, // 用户自定义地址
|
|
106
|
-
},
|
|
107
|
-
BASE: {
|
|
108
|
-
gift: '0xa02DA44D67DB6D692efa7f751b5952bd670d5326',
|
|
109
|
-
split: '0x1ae091F75D593eb7dC6539600a185C8A6076A424',
|
|
110
|
-
buyback_burn: '0x6F97fA674a6FE5EC37e309B63aB54E33c9e64d2E',
|
|
111
|
-
burnToEarn: '0x47A216040Dc9e0AfE2e6fc5dcC44f7bBD1B60d25',
|
|
112
|
-
buildYourVault: ZeroAddress,
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* 金库额外配置(如 XVault 的 relayer 端点)
|
|
117
|
-
*/
|
|
118
|
-
export const VAULT_EXTRA_CONFIG = {
|
|
119
|
-
BSC: {
|
|
120
|
-
gift: { XVaultRelayerEndpoint: 'https://xoracle.taxed.fun/' },
|
|
121
|
-
},
|
|
122
|
-
BASE: {
|
|
123
|
-
gift: { XVaultRelayerEndpoint: 'https://xrelayer.taxed.fun/' },
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* Flap Guardian 合约地址
|
|
128
|
-
*/
|
|
129
|
-
export const FLAP_GUARDIAN_ADDRESSES = {
|
|
130
|
-
BSC: '0x9e27098dcD8844bcc6287a557E0b4D09C86B8a4b',
|
|
131
|
-
};
|
|
132
|
-
// ============================================================================
|
|
133
|
-
// ABI 定义
|
|
134
|
-
// ============================================================================
|
|
135
|
-
/**
|
|
136
|
-
* VaultPortal ABI — newTaxTokenWithVault
|
|
137
|
-
*
|
|
138
|
-
* ⚠️ 从 flap.sh 前端 JS 源码提取的真实 ABI
|
|
139
|
-
* 来源:flap.sh/_next/static/chunks/6288-*.js(VaultPortal 合约 ABI)
|
|
140
|
-
*/
|
|
141
|
-
export const VAULT_PORTAL_ABI = [
|
|
142
|
-
{
|
|
143
|
-
type: 'function',
|
|
144
|
-
name: 'newTaxTokenWithVault',
|
|
145
|
-
inputs: [
|
|
146
|
-
{
|
|
147
|
-
name: 'params',
|
|
148
|
-
type: 'tuple',
|
|
149
|
-
internalType: 'struct IVaultPortalTypes.NewTaxTokenWithVaultParams',
|
|
150
|
-
components: [
|
|
151
|
-
{ name: 'name', type: 'string', internalType: 'string' },
|
|
152
|
-
{ name: 'symbol', type: 'string', internalType: 'string' },
|
|
153
|
-
{ name: 'meta', type: 'string', internalType: 'string' },
|
|
154
|
-
{ name: 'dexThresh', type: 'uint8', internalType: 'enum IPortalCommonTypes.DexThreshType' },
|
|
155
|
-
{ name: 'salt', type: 'bytes32', internalType: 'bytes32' },
|
|
156
|
-
{ name: 'taxRate', type: 'uint16', internalType: 'uint16' },
|
|
157
|
-
{ name: 'migratorType', type: 'uint8', internalType: 'enum IPortalTypes.MigratorType' },
|
|
158
|
-
{ name: 'quoteToken', type: 'address', internalType: 'address' },
|
|
159
|
-
{ name: 'quoteAmt', type: 'uint256', internalType: 'uint256' },
|
|
160
|
-
{ name: 'permitData', type: 'bytes', internalType: 'bytes' },
|
|
161
|
-
{ name: 'extensionID', type: 'bytes32', internalType: 'bytes32' },
|
|
162
|
-
{ name: 'extensionData', type: 'bytes', internalType: 'bytes' },
|
|
163
|
-
{ name: 'dexId', type: 'uint8', internalType: 'enum IPortalTypes.DEXId' },
|
|
164
|
-
{ name: 'lpFeeProfile', type: 'uint8', internalType: 'enum IPortalTypes.V3LPFeeProfile' },
|
|
165
|
-
{ name: 'taxDuration', type: 'uint64', internalType: 'uint64' },
|
|
166
|
-
{ name: 'antiFarmerDuration', type: 'uint64', internalType: 'uint64' },
|
|
167
|
-
{ name: 'mktBps', type: 'uint16', internalType: 'uint16' },
|
|
168
|
-
{ name: 'deflationBps', type: 'uint16', internalType: 'uint16' },
|
|
169
|
-
{ name: 'dividendBps', type: 'uint16', internalType: 'uint16' },
|
|
170
|
-
{ name: 'lpBps', type: 'uint16', internalType: 'uint16' },
|
|
171
|
-
{ name: 'minimumShareBalance', type: 'uint256', internalType: 'uint256' },
|
|
172
|
-
{ name: 'vaultFactory', type: 'address', internalType: 'address' },
|
|
173
|
-
{ name: 'vaultData', type: 'bytes', internalType: 'bytes' },
|
|
174
|
-
],
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
outputs: [{ name: 'token', type: 'address', internalType: 'address' }],
|
|
178
|
-
stateMutability: 'payable',
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
type: 'function',
|
|
182
|
-
name: 'getVault',
|
|
183
|
-
inputs: [{ name: 'taxToken', type: 'address', internalType: 'address' }],
|
|
184
|
-
outputs: [
|
|
185
|
-
{
|
|
186
|
-
name: 'info',
|
|
187
|
-
type: 'tuple',
|
|
188
|
-
internalType: 'struct IVaultPortalTypes.VaultInfo',
|
|
189
|
-
components: [
|
|
190
|
-
{ name: 'vault', type: 'address', internalType: 'address' },
|
|
191
|
-
{ name: 'vaultFactory', type: 'address', internalType: 'address' },
|
|
192
|
-
{ name: 'description', type: 'string', internalType: 'string' },
|
|
193
|
-
{ name: 'isOfficial', type: 'bool', internalType: 'bool' },
|
|
194
|
-
{ name: 'riskLevel', type: 'uint8', internalType: 'enum IVaultPortalTypes.RiskLevel' },
|
|
195
|
-
],
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
stateMutability: 'view',
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
type: 'function',
|
|
202
|
-
name: 'predictTaxTokenV1Address',
|
|
203
|
-
inputs: [{ name: 'salt', type: 'bytes32', internalType: 'bytes32' }],
|
|
204
|
-
outputs: [{ name: 'predictedAddress', type: 'address', internalType: 'address' }],
|
|
205
|
-
stateMutability: 'view',
|
|
206
|
-
},
|
|
207
|
-
];
|
|
208
|
-
/**
|
|
209
|
-
* IVaultFactory ABI(V1)
|
|
210
|
-
*/
|
|
211
|
-
export const VAULT_FACTORY_ABI = [
|
|
212
|
-
'function newVault(address token, address beneficiary, bytes vaultData) external returns (address)',
|
|
213
|
-
];
|
|
214
|
-
/**
|
|
215
|
-
* VaultFactoryBaseV2 ABI
|
|
216
|
-
*/
|
|
217
|
-
export const VAULT_FACTORY_V2_ABI = [
|
|
218
|
-
...VAULT_FACTORY_ABI,
|
|
219
|
-
'function vaultDataSchema() public pure returns (tuple(string description, tuple(string name, string fieldType, string description, uint8 decimals)[] fields, bool isArray))',
|
|
220
|
-
];
|
|
221
|
-
/**
|
|
222
|
-
* VaultBase ABI(V1)
|
|
223
|
-
*/
|
|
224
|
-
export const VAULT_BASE_ABI = ['function description() public view returns (string)'];
|
|
225
|
-
/**
|
|
226
|
-
* VaultBaseV2 ABI
|
|
227
|
-
*/
|
|
228
|
-
export const VAULT_BASE_V2_ABI = [
|
|
229
|
-
...VAULT_BASE_ABI,
|
|
230
|
-
'function vaultUISchema() public pure returns (tuple(string vaultType, string description, tuple(string name, string description, tuple(string name, string fieldType, string description, uint8 decimals)[] inputs, tuple(string name, string fieldType, string description, uint8 decimals)[] outputs, tuple(string tokenType, string amountFieldName)[] approvals, bool isInputArray, bool isOutputArray, bool isWriteMethod)[] methods))',
|
|
231
|
-
'function taxToken() public view returns (address)',
|
|
232
|
-
'function lpToken() public view returns (address)',
|
|
233
|
-
];
|
|
234
|
-
// ============================================================================
|
|
235
|
-
// 核心常量
|
|
236
|
-
// ============================================================================
|
|
237
|
-
/** extensionID/extensionData 在金库模式下始终为零值 */
|
|
238
|
-
export const NONE_EXTENSION_ID = '0x' + '00'.repeat(32);
|
|
239
|
-
const abiCoder = AbiCoder.defaultAbiCoder();
|
|
240
|
-
// ============================================================================
|
|
241
|
-
// 金库参数构建
|
|
242
|
-
// ============================================================================
|
|
243
|
-
/**
|
|
244
|
-
* 根据 VaultDataSchema 和用户输入编码 vaultData
|
|
245
|
-
*/
|
|
246
|
-
export function encodeVaultData(schema, fieldValues) {
|
|
247
|
-
if (schema.fields.length === 0 && !schema.isArray) {
|
|
248
|
-
return '0x';
|
|
249
|
-
}
|
|
250
|
-
const types = [];
|
|
251
|
-
const values = [];
|
|
252
|
-
for (const field of schema.fields) {
|
|
253
|
-
const rawValue = fieldValues[field.name];
|
|
254
|
-
types.push(mapFieldTypeToAbiType(field.fieldType));
|
|
255
|
-
values.push(processFieldValue(field, rawValue));
|
|
256
|
-
}
|
|
257
|
-
if (schema.isArray) {
|
|
258
|
-
const tupleType = `tuple(${types.join(',')})`;
|
|
259
|
-
return abiCoder.encode([`${tupleType}[]`], [[values]]);
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
return abiCoder.encode(types, values);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
function mapFieldTypeToAbiType(fieldType) {
|
|
266
|
-
if (fieldType === 'time')
|
|
267
|
-
return 'uint256';
|
|
268
|
-
return fieldType;
|
|
269
|
-
}
|
|
270
|
-
function processFieldValue(field, rawValue) {
|
|
271
|
-
if (rawValue === undefined || rawValue === null) {
|
|
272
|
-
switch (field.fieldType) {
|
|
273
|
-
case 'address':
|
|
274
|
-
return ZeroAddress;
|
|
275
|
-
case 'bool':
|
|
276
|
-
return false;
|
|
277
|
-
case 'string':
|
|
278
|
-
return '';
|
|
279
|
-
case 'bytes':
|
|
280
|
-
case 'bytes32':
|
|
281
|
-
return '0x' + '00'.repeat(32);
|
|
282
|
-
default:
|
|
283
|
-
return 0;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
if (field.decimals > 0 && typeof rawValue === 'number') {
|
|
287
|
-
return BigInt(Math.round(rawValue * 10 ** field.decimals));
|
|
288
|
-
}
|
|
289
|
-
if (field.fieldType === 'bool') {
|
|
290
|
-
return Boolean(rawValue);
|
|
291
|
-
}
|
|
292
|
-
return rawValue;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* 获取指定链和金库类型的 VaultFactory 合约地址
|
|
296
|
-
*/
|
|
297
|
-
export function getVaultFactoryAddress(chain, vaultType) {
|
|
298
|
-
const chainKey = chain.toUpperCase();
|
|
299
|
-
const factories = VAULT_FACTORY_ADDRESSES[chainKey];
|
|
300
|
-
if (!factories)
|
|
301
|
-
return null;
|
|
302
|
-
return factories[vaultType] || null;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* 获取指定链的 VaultPortal 合约地址
|
|
306
|
-
*/
|
|
307
|
-
export function getVaultPortalAddress(chain) {
|
|
308
|
-
const chainKey = chain.toUpperCase();
|
|
309
|
-
return VAULT_PORTAL_ADDRESSES[chainKey] || null;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* 构建金库参数(用于 VaultPortal.newTaxTokenWithVault)
|
|
313
|
-
*
|
|
314
|
-
* ⚠️ 重要:返回的是 vaultFactory 和 vaultData,不是 extensionID/extensionData
|
|
315
|
-
* extensionID/extensionData 在金库模式下始终为零值
|
|
316
|
-
*
|
|
317
|
-
* @returns { vaultFactory, vaultData } 直接传给 VaultPortal
|
|
318
|
-
*/
|
|
319
|
-
export function buildVaultParams(config, chain) {
|
|
320
|
-
if (!config || config.vaultType === 'none') {
|
|
321
|
-
return {
|
|
322
|
-
vaultFactory: ZeroAddress,
|
|
323
|
-
vaultData: '0x',
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
// 1. 确定 vaultFactory 地址
|
|
327
|
-
let vaultFactory;
|
|
328
|
-
if (config.factoryAddress && config.factoryAddress !== ZeroAddress) {
|
|
329
|
-
vaultFactory = config.factoryAddress;
|
|
330
|
-
}
|
|
331
|
-
else if (chain) {
|
|
332
|
-
const addr = getVaultFactoryAddress(chain, config.vaultType);
|
|
333
|
-
if (!addr || addr === ZeroAddress) {
|
|
334
|
-
throw new Error(`链 "${chain}" 上没有 "${config.vaultType}" 类型的官方金库工厂`);
|
|
335
|
-
}
|
|
336
|
-
vaultFactory = addr;
|
|
337
|
-
}
|
|
338
|
-
else {
|
|
339
|
-
throw new Error(`金库类型 "${config.vaultType}" 必须提供 factoryAddress 或 chain`);
|
|
340
|
-
}
|
|
341
|
-
// 2. 确定 vaultData
|
|
342
|
-
let vaultData;
|
|
343
|
-
if (config.rawVaultData) {
|
|
344
|
-
vaultData = config.rawVaultData;
|
|
345
|
-
}
|
|
346
|
-
else if (config.vaultDataSchema && config.vaultDataFields) {
|
|
347
|
-
vaultData = encodeVaultData(config.vaultDataSchema, config.vaultDataFields);
|
|
348
|
-
}
|
|
349
|
-
else if (config.vaultDataSchema && config.vaultDataSchema.fields.length === 0 && !config.vaultDataSchema.isArray) {
|
|
350
|
-
vaultData = '0x';
|
|
351
|
-
}
|
|
352
|
-
else {
|
|
353
|
-
// 默认空数据(部分工厂不需要 vaultData)
|
|
354
|
-
vaultData = '0x';
|
|
355
|
-
}
|
|
356
|
-
return { vaultFactory, vaultData };
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* 旧版兼容:将 TaxVaultConfig 转换为 extensionID 和 extensionData
|
|
360
|
-
*
|
|
361
|
-
* ⚠️ 注意:真实的 Flap 平台在金库模式下 extensionID/extensionData 始终为零值
|
|
362
|
-
* 金库参数通过 VaultPortal 的 vaultFactory/vaultData 传递
|
|
363
|
-
* 此函数仅用于向后兼容
|
|
364
|
-
*/
|
|
365
|
-
export function buildVaultExtensionParams() {
|
|
366
|
-
// 金库模式下 extensionID/extensionData 始终为零值
|
|
367
|
-
return {
|
|
368
|
-
extensionID: NONE_EXTENSION_ID,
|
|
369
|
-
extensionData: '0x',
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
// ============================================================================
|
|
373
|
-
// 链上查询
|
|
374
|
-
// ============================================================================
|
|
375
|
-
/**
|
|
376
|
-
* 从 VaultFactory 合约读取 vaultDataSchema
|
|
377
|
-
*/
|
|
378
|
-
export async function queryVaultDataSchema(provider, factoryAddress) {
|
|
379
|
-
try {
|
|
380
|
-
const factory = new Contract(factoryAddress, VAULT_FACTORY_V2_ABI, provider);
|
|
381
|
-
const raw = (await factory.vaultDataSchema());
|
|
382
|
-
return {
|
|
383
|
-
description: raw.description,
|
|
384
|
-
fields: raw.fields.map(mapFieldDescriptor),
|
|
385
|
-
isArray: raw.isArray,
|
|
386
|
-
};
|
|
387
|
-
}
|
|
388
|
-
catch {
|
|
389
|
-
return null;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* 从金库合约读取 vaultUISchema
|
|
394
|
-
*/
|
|
395
|
-
export async function queryVaultUISchema(provider, vaultAddress) {
|
|
396
|
-
try {
|
|
397
|
-
const vault = new Contract(vaultAddress, VAULT_BASE_V2_ABI, provider);
|
|
398
|
-
const raw = (await vault.vaultUISchema());
|
|
399
|
-
return {
|
|
400
|
-
vaultType: raw.vaultType,
|
|
401
|
-
description: raw.description,
|
|
402
|
-
methods: raw.methods.map(mapVaultMethodSchema),
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
catch {
|
|
406
|
-
return null;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* 读取金库合约的动态描述
|
|
411
|
-
*/
|
|
412
|
-
export async function queryVaultDescription(provider, vaultAddress) {
|
|
413
|
-
try {
|
|
414
|
-
const vault = new Contract(vaultAddress, VAULT_BASE_ABI, provider);
|
|
415
|
-
return await vault.description();
|
|
416
|
-
}
|
|
417
|
-
catch {
|
|
418
|
-
return null;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* 验证合约是否是有效的 VaultFactory
|
|
423
|
-
*/
|
|
424
|
-
export async function validateVaultFactory(provider, factoryAddress) {
|
|
425
|
-
try {
|
|
426
|
-
const code = await provider.getCode(factoryAddress);
|
|
427
|
-
if (code === '0x' || code === '0x0') {
|
|
428
|
-
return { isValid: false, isV2: false, schema: null, error: '地址没有部署合约' };
|
|
429
|
-
}
|
|
430
|
-
const schema = await queryVaultDataSchema(provider, factoryAddress);
|
|
431
|
-
return {
|
|
432
|
-
isValid: true,
|
|
433
|
-
isV2: schema !== null,
|
|
434
|
-
schema,
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
catch (e) {
|
|
438
|
-
return { isValid: false, isV2: false, schema: null, error: getErrorMessageFromUnknown(e) };
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
|
-
* 从 VaultPortal 查询代币的金库信息
|
|
443
|
-
*/
|
|
444
|
-
export async function getVaultInfo(provider, vaultPortalAddress, taxTokenAddress) {
|
|
445
|
-
try {
|
|
446
|
-
const portal = new Contract(vaultPortalAddress, VAULT_PORTAL_ABI, provider);
|
|
447
|
-
const info = (await portal.getVault(taxTokenAddress));
|
|
448
|
-
return {
|
|
449
|
-
vault: info.vault,
|
|
450
|
-
vaultFactory: info.vaultFactory,
|
|
451
|
-
description: info.description,
|
|
452
|
-
isOfficial: info.isOfficial,
|
|
453
|
-
riskLevel: Number(info.riskLevel),
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
catch {
|
|
457
|
-
return null;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* 验证合约是否有效(是否部署了代码)
|
|
4
|
+
* 原超长文件按职责拆分为 vault/ 目录下的多个子文件,
|
|
5
|
+
* 对外 export 符号与路径保持不变(见 vault/index.ts)。
|
|
462
6
|
*/
|
|
463
|
-
export
|
|
464
|
-
try {
|
|
465
|
-
const code = await provider.getCode(address);
|
|
466
|
-
return code !== '0x' && code !== '0x0';
|
|
467
|
-
}
|
|
468
|
-
catch {
|
|
469
|
-
return false;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
7
|
+
export * from './vault/index.js';
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flap Portal — 写操作(writer)
|
|
3
|
+
*/
|
|
4
|
+
import { FlapPortal } from './reader.js';
|
|
5
|
+
import type { PortalConfig, ExactInputParams, ExactInputV3Params, NewTokenV3Params, NewTokenV4Params, NewTokenV5Params } from './types.js';
|
|
6
|
+
export declare class FlapPortalWriter extends FlapPortal {
|
|
7
|
+
private wallet;
|
|
8
|
+
constructor(cfg: PortalConfig, privateKey: string);
|
|
9
|
+
buy(token: string, to: string, minAmount: bigint, msgValue: bigint): Promise<any>;
|
|
10
|
+
sell(token: string, amount: bigint, minEth: bigint): Promise<any>;
|
|
11
|
+
swapExactInput(params: ExactInputParams, msgValue?: bigint): Promise<any>;
|
|
12
|
+
swapExactInputBuy(params: ExactInputParams, msgValue?: bigint): Promise<any>;
|
|
13
|
+
swapExactInputSell(params: ExactInputParams): Promise<any>;
|
|
14
|
+
swapExactInputV3(params: ExactInputV3Params, msgValue?: bigint): Promise<any>;
|
|
15
|
+
newTokenV2(args: {
|
|
16
|
+
name: string;
|
|
17
|
+
symbol: string;
|
|
18
|
+
meta: string;
|
|
19
|
+
dexThresh: number;
|
|
20
|
+
salt: string;
|
|
21
|
+
taxRate: number;
|
|
22
|
+
migratorType: number;
|
|
23
|
+
quoteToken: string;
|
|
24
|
+
quoteAmt: bigint;
|
|
25
|
+
beneficiary: string;
|
|
26
|
+
permitData?: string;
|
|
27
|
+
msgValue?: bigint;
|
|
28
|
+
}): Promise<any>;
|
|
29
|
+
newTokenV3(args: NewTokenV3Params & {
|
|
30
|
+
msgValue?: bigint;
|
|
31
|
+
}): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* 创建代币 V4 版本
|
|
34
|
+
* 相比 V3 新增了 DEX 选择和 LP 费率配置
|
|
35
|
+
*
|
|
36
|
+
* @param args 创建代币参数
|
|
37
|
+
* @param args.dexId DEX ID,选择迁移到哪个 DEX(使用 DEXId 枚举)
|
|
38
|
+
* @param args.lpFeeProfile LP 费率档位(使用 V3LPFeeProfile 枚举)
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* await portal.newTokenV4({
|
|
43
|
+
* name: 'My Token',
|
|
44
|
+
* symbol: 'MTK',
|
|
45
|
+
* meta: 'bafkreicwlkpvrcqg4bbhyp2fnhdwbqos5ghka6gdjra3tdkgxxs74hqsze',
|
|
46
|
+
* dexThresh: DexThreshType.FOUR_FIFTHS,
|
|
47
|
+
* salt: '0x...',
|
|
48
|
+
* taxRate: 0,
|
|
49
|
+
* migratorType: MigratorType.V3_MIGRATOR,
|
|
50
|
+
* quoteToken: '0x0000000000000000000000000000000000000000',
|
|
51
|
+
* quoteAmt: 0n,
|
|
52
|
+
* beneficiary: '0x...',
|
|
53
|
+
* extensionID: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
54
|
+
* dexId: DEXId.DEX0,
|
|
55
|
+
* lpFeeProfile: V3LPFeeProfile.LP_FEE_PROFILE_STANDARD,
|
|
56
|
+
* msgValue: parseEther('0.01'),
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @note BNB 链上使用 LP_FEE_PROFILE_LOW (0.01%) 需要白名单地址
|
|
61
|
+
*/
|
|
62
|
+
newTokenV4(args: NewTokenV4Params & {
|
|
63
|
+
msgValue?: bigint;
|
|
64
|
+
}): Promise<any>;
|
|
65
|
+
/**
|
|
66
|
+
* 创建 Token V5(支持 Tax Token V2 高级税收分配)
|
|
67
|
+
*
|
|
68
|
+
* 当 taxRate > 0 时,支持以下税收分配:
|
|
69
|
+
* - mktBps: 营销分配(发送到 beneficiary 地址)
|
|
70
|
+
* - deflationBps: 通缩销毁(直接销毁)
|
|
71
|
+
* - dividendBps: 持有者分红(发送到分红合约)
|
|
72
|
+
* - lpBps: 流动性提供(LP 发送到 dead address)
|
|
73
|
+
*
|
|
74
|
+
* 注意:mktBps + deflationBps + dividendBps + lpBps 必须等于 10000 (100%)
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* // 创建一个 3% 税率的代币,税收分配:40% 营销,30% 销毁,20% 分红,10% 流动性
|
|
79
|
+
* await portal.newTokenV5({
|
|
80
|
+
* name: 'My Tax Token',
|
|
81
|
+
* symbol: 'MTT',
|
|
82
|
+
* meta: 'bafkrei...',
|
|
83
|
+
* dexThresh: DexThreshType.FOUR_FIFTHS,
|
|
84
|
+
* salt: '0x...',
|
|
85
|
+
* taxRate: 300, // 3%
|
|
86
|
+
* migratorType: MigratorType.V2_MIGRATOR, // 税代币必须使用 V2 迁移器
|
|
87
|
+
* quoteToken: '0x0000000000000000000000000000000000000000',
|
|
88
|
+
* quoteAmt: 0n,
|
|
89
|
+
* beneficiary: '0x...',
|
|
90
|
+
* extensionID: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
91
|
+
* dexId: DEXId.DEX0,
|
|
92
|
+
* lpFeeProfile: V3LPFeeProfile.LP_FEE_PROFILE_STANDARD,
|
|
93
|
+
* taxDuration: 365n * 24n * 60n * 60n, // 1 年
|
|
94
|
+
* antiFarmerDuration: 60n * 60n, // 1 小时
|
|
95
|
+
* mktBps: 4000, // 40%
|
|
96
|
+
* deflationBps: 3000, // 30%
|
|
97
|
+
* dividendBps: 2000, // 20%
|
|
98
|
+
* lpBps: 1000, // 10%
|
|
99
|
+
* minimumShareBalance: 10000n * 10n ** 18n, // 10K 代币
|
|
100
|
+
* msgValue: parseEther('0.01'),
|
|
101
|
+
* });
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @note 税代币(taxRate > 0)必须使用 V2_MIGRATOR
|
|
105
|
+
*/
|
|
106
|
+
newTokenV5(args: NewTokenV5Params & {
|
|
107
|
+
msgValue?: bigint;
|
|
108
|
+
}): Promise<any>;
|
|
109
|
+
claim(token: string): Promise<{
|
|
110
|
+
txHash: string;
|
|
111
|
+
tokenAmount: bigint;
|
|
112
|
+
ethAmount: bigint;
|
|
113
|
+
}>;
|
|
114
|
+
delegateClaim(token: string): Promise<{
|
|
115
|
+
txHash: string;
|
|
116
|
+
tokenAmount: bigint;
|
|
117
|
+
ethAmount: bigint;
|
|
118
|
+
}>;
|
|
119
|
+
/**
|
|
120
|
+
* 获取当前使用的 Portal 合约地址
|
|
121
|
+
* 用于事件监听等场景
|
|
122
|
+
*/
|
|
123
|
+
getContractAddress(): string;
|
|
124
|
+
}
|