four-flap-meme-sdk 3.0.1 → 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/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/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 -85
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flap Portal — 写操作(writer)
|
|
3
|
+
*/
|
|
4
|
+
import { Contract, Wallet, JsonRpcProvider } from 'ethers';
|
|
5
|
+
import { FlapPortal, PORTAL_ABI } from './reader.js';
|
|
6
|
+
export class FlapPortalWriter extends FlapPortal {
|
|
7
|
+
wallet;
|
|
8
|
+
constructor(cfg, privateKey) {
|
|
9
|
+
super(cfg);
|
|
10
|
+
// 使用 ethers v6 创建钱包
|
|
11
|
+
const provider = new JsonRpcProvider(cfg.rpcUrl);
|
|
12
|
+
this.wallet = new Wallet(privateKey, provider);
|
|
13
|
+
// 重新创建可写合约实例
|
|
14
|
+
this.contract = new Contract(this.portal, PORTAL_ABI, this.wallet);
|
|
15
|
+
}
|
|
16
|
+
// 买入代币
|
|
17
|
+
async buy(token, to, minAmount, msgValue) {
|
|
18
|
+
const tx = await this.contract.buy(token, to, minAmount, { value: msgValue });
|
|
19
|
+
return await tx.wait();
|
|
20
|
+
}
|
|
21
|
+
// 创建代币时同时买入
|
|
22
|
+
// buyOnCreation 已从合约端移除,SDK 同步移除
|
|
23
|
+
// 卖出代币
|
|
24
|
+
async sell(token, amount, minEth) {
|
|
25
|
+
const tx = await this.contract.sell(token, amount, minEth);
|
|
26
|
+
return await tx.wait();
|
|
27
|
+
}
|
|
28
|
+
// 发送 swap 交易
|
|
29
|
+
async swapExactInput(params, msgValue) {
|
|
30
|
+
const tx = await this.contract.swapExactInput({
|
|
31
|
+
inputToken: params.inputToken,
|
|
32
|
+
outputToken: params.outputToken,
|
|
33
|
+
inputAmount: params.inputAmount,
|
|
34
|
+
minOutputAmount: params.minOutputAmount,
|
|
35
|
+
permitData: params.permitData ?? '0x',
|
|
36
|
+
}, { value: msgValue });
|
|
37
|
+
return await tx.wait();
|
|
38
|
+
}
|
|
39
|
+
// 发送显式买入交易
|
|
40
|
+
async swapExactInputBuy(params, msgValue) {
|
|
41
|
+
const tx = await this.contract.swapExactInputBuy({
|
|
42
|
+
inputToken: params.inputToken,
|
|
43
|
+
outputToken: params.outputToken,
|
|
44
|
+
inputAmount: params.inputAmount,
|
|
45
|
+
minOutputAmount: params.minOutputAmount,
|
|
46
|
+
permitData: params.permitData ?? '0x',
|
|
47
|
+
}, { value: msgValue });
|
|
48
|
+
return await tx.wait();
|
|
49
|
+
}
|
|
50
|
+
// 发送显式卖出交易
|
|
51
|
+
async swapExactInputSell(params) {
|
|
52
|
+
const tx = await this.contract.swapExactInputSell({
|
|
53
|
+
inputToken: params.inputToken,
|
|
54
|
+
outputToken: params.outputToken,
|
|
55
|
+
inputAmount: params.inputAmount,
|
|
56
|
+
minOutputAmount: params.minOutputAmount,
|
|
57
|
+
permitData: params.permitData ?? '0x',
|
|
58
|
+
});
|
|
59
|
+
return await tx.wait();
|
|
60
|
+
}
|
|
61
|
+
// 发送 swap 交易(V3,支持扩展数据)
|
|
62
|
+
async swapExactInputV3(params, msgValue) {
|
|
63
|
+
const tx = await this.contract.swapExactInputV3({
|
|
64
|
+
inputToken: params.inputToken,
|
|
65
|
+
outputToken: params.outputToken,
|
|
66
|
+
inputAmount: params.inputAmount,
|
|
67
|
+
minOutputAmount: params.minOutputAmount,
|
|
68
|
+
permitData: params.permitData ?? '0x',
|
|
69
|
+
extensionData: params.extensionData ?? '0x',
|
|
70
|
+
}, { value: msgValue });
|
|
71
|
+
return await tx.wait();
|
|
72
|
+
}
|
|
73
|
+
async newTokenV2(args) {
|
|
74
|
+
const tx = await this.contract.newTokenV2({
|
|
75
|
+
name: args.name,
|
|
76
|
+
symbol: args.symbol,
|
|
77
|
+
meta: args.meta,
|
|
78
|
+
dexThresh: args.dexThresh,
|
|
79
|
+
salt: args.salt,
|
|
80
|
+
taxRate: args.taxRate,
|
|
81
|
+
migratorType: args.migratorType,
|
|
82
|
+
quoteToken: args.quoteToken,
|
|
83
|
+
quoteAmt: args.quoteAmt,
|
|
84
|
+
beneficiary: args.beneficiary,
|
|
85
|
+
permitData: args.permitData ?? '0x',
|
|
86
|
+
}, { value: args.msgValue });
|
|
87
|
+
return await tx.wait();
|
|
88
|
+
}
|
|
89
|
+
async newTokenV3(args) {
|
|
90
|
+
const tx = await this.contract.newTokenV3({
|
|
91
|
+
name: args.name,
|
|
92
|
+
symbol: args.symbol,
|
|
93
|
+
meta: args.meta,
|
|
94
|
+
dexThresh: args.dexThresh,
|
|
95
|
+
salt: args.salt,
|
|
96
|
+
taxRate: args.taxRate,
|
|
97
|
+
migratorType: args.migratorType,
|
|
98
|
+
quoteToken: args.quoteToken,
|
|
99
|
+
quoteAmt: args.quoteAmt,
|
|
100
|
+
beneficiary: args.beneficiary,
|
|
101
|
+
permitData: args.permitData ?? '0x',
|
|
102
|
+
extensionID: args.extensionID,
|
|
103
|
+
extensionData: args.extensionData ?? '0x',
|
|
104
|
+
}, { value: args.msgValue });
|
|
105
|
+
return await tx.wait();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 创建代币 V4 版本
|
|
109
|
+
* 相比 V3 新增了 DEX 选择和 LP 费率配置
|
|
110
|
+
*
|
|
111
|
+
* @param args 创建代币参数
|
|
112
|
+
* @param args.dexId DEX ID,选择迁移到哪个 DEX(使用 DEXId 枚举)
|
|
113
|
+
* @param args.lpFeeProfile LP 费率档位(使用 V3LPFeeProfile 枚举)
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* await portal.newTokenV4({
|
|
118
|
+
* name: 'My Token',
|
|
119
|
+
* symbol: 'MTK',
|
|
120
|
+
* meta: 'bafkreicwlkpvrcqg4bbhyp2fnhdwbqos5ghka6gdjra3tdkgxxs74hqsze',
|
|
121
|
+
* dexThresh: DexThreshType.FOUR_FIFTHS,
|
|
122
|
+
* salt: '0x...',
|
|
123
|
+
* taxRate: 0,
|
|
124
|
+
* migratorType: MigratorType.V3_MIGRATOR,
|
|
125
|
+
* quoteToken: '0x0000000000000000000000000000000000000000',
|
|
126
|
+
* quoteAmt: 0n,
|
|
127
|
+
* beneficiary: '0x...',
|
|
128
|
+
* extensionID: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
129
|
+
* dexId: DEXId.DEX0,
|
|
130
|
+
* lpFeeProfile: V3LPFeeProfile.LP_FEE_PROFILE_STANDARD,
|
|
131
|
+
* msgValue: parseEther('0.01'),
|
|
132
|
+
* });
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @note BNB 链上使用 LP_FEE_PROFILE_LOW (0.01%) 需要白名单地址
|
|
136
|
+
*/
|
|
137
|
+
async newTokenV4(args) {
|
|
138
|
+
const tx = await this.contract.newTokenV4({
|
|
139
|
+
name: args.name,
|
|
140
|
+
symbol: args.symbol,
|
|
141
|
+
meta: args.meta,
|
|
142
|
+
dexThresh: args.dexThresh,
|
|
143
|
+
salt: args.salt,
|
|
144
|
+
taxRate: args.taxRate,
|
|
145
|
+
migratorType: args.migratorType,
|
|
146
|
+
quoteToken: args.quoteToken,
|
|
147
|
+
quoteAmt: args.quoteAmt,
|
|
148
|
+
beneficiary: args.beneficiary,
|
|
149
|
+
permitData: args.permitData ?? '0x',
|
|
150
|
+
extensionID: args.extensionID,
|
|
151
|
+
extensionData: args.extensionData ?? '0x',
|
|
152
|
+
dexId: args.dexId,
|
|
153
|
+
lpFeeProfile: args.lpFeeProfile,
|
|
154
|
+
}, { value: args.msgValue });
|
|
155
|
+
return await tx.wait();
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* 创建 Token V5(支持 Tax Token V2 高级税收分配)
|
|
159
|
+
*
|
|
160
|
+
* 当 taxRate > 0 时,支持以下税收分配:
|
|
161
|
+
* - mktBps: 营销分配(发送到 beneficiary 地址)
|
|
162
|
+
* - deflationBps: 通缩销毁(直接销毁)
|
|
163
|
+
* - dividendBps: 持有者分红(发送到分红合约)
|
|
164
|
+
* - lpBps: 流动性提供(LP 发送到 dead address)
|
|
165
|
+
*
|
|
166
|
+
* 注意:mktBps + deflationBps + dividendBps + lpBps 必须等于 10000 (100%)
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* // 创建一个 3% 税率的代币,税收分配:40% 营销,30% 销毁,20% 分红,10% 流动性
|
|
171
|
+
* await portal.newTokenV5({
|
|
172
|
+
* name: 'My Tax Token',
|
|
173
|
+
* symbol: 'MTT',
|
|
174
|
+
* meta: 'bafkrei...',
|
|
175
|
+
* dexThresh: DexThreshType.FOUR_FIFTHS,
|
|
176
|
+
* salt: '0x...',
|
|
177
|
+
* taxRate: 300, // 3%
|
|
178
|
+
* migratorType: MigratorType.V2_MIGRATOR, // 税代币必须使用 V2 迁移器
|
|
179
|
+
* quoteToken: '0x0000000000000000000000000000000000000000',
|
|
180
|
+
* quoteAmt: 0n,
|
|
181
|
+
* beneficiary: '0x...',
|
|
182
|
+
* extensionID: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
183
|
+
* dexId: DEXId.DEX0,
|
|
184
|
+
* lpFeeProfile: V3LPFeeProfile.LP_FEE_PROFILE_STANDARD,
|
|
185
|
+
* taxDuration: 365n * 24n * 60n * 60n, // 1 年
|
|
186
|
+
* antiFarmerDuration: 60n * 60n, // 1 小时
|
|
187
|
+
* mktBps: 4000, // 40%
|
|
188
|
+
* deflationBps: 3000, // 30%
|
|
189
|
+
* dividendBps: 2000, // 20%
|
|
190
|
+
* lpBps: 1000, // 10%
|
|
191
|
+
* minimumShareBalance: 10000n * 10n ** 18n, // 10K 代币
|
|
192
|
+
* msgValue: parseEther('0.01'),
|
|
193
|
+
* });
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* @note 税代币(taxRate > 0)必须使用 V2_MIGRATOR
|
|
197
|
+
*/
|
|
198
|
+
async newTokenV5(args) {
|
|
199
|
+
// 验证税收分配
|
|
200
|
+
if (args.taxRate > 0) {
|
|
201
|
+
const total = args.mktBps + args.deflationBps + args.dividendBps + args.lpBps;
|
|
202
|
+
if (total !== 10000) {
|
|
203
|
+
throw new Error(`税收分配总计必须为 10000 (100%),当前为 ${total}`);
|
|
204
|
+
}
|
|
205
|
+
if (args.dividendBps > 0 && args.minimumShareBalance < 10000n * 10n ** 18n) {
|
|
206
|
+
throw new Error('启用分红时,最低持仓门槛必须至少为 10,000 个代币');
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const tx = await this.contract.newTokenV5({
|
|
210
|
+
name: args.name,
|
|
211
|
+
symbol: args.symbol,
|
|
212
|
+
meta: args.meta,
|
|
213
|
+
dexThresh: args.dexThresh,
|
|
214
|
+
salt: args.salt,
|
|
215
|
+
taxRate: args.taxRate,
|
|
216
|
+
migratorType: args.migratorType,
|
|
217
|
+
quoteToken: args.quoteToken,
|
|
218
|
+
quoteAmt: args.quoteAmt,
|
|
219
|
+
beneficiary: args.beneficiary,
|
|
220
|
+
permitData: args.permitData ?? '0x',
|
|
221
|
+
extensionID: args.extensionID,
|
|
222
|
+
extensionData: args.extensionData ?? '0x',
|
|
223
|
+
dexId: args.dexId,
|
|
224
|
+
lpFeeProfile: args.lpFeeProfile,
|
|
225
|
+
taxDuration: args.taxDuration,
|
|
226
|
+
antiFarmerDuration: args.antiFarmerDuration,
|
|
227
|
+
mktBps: args.mktBps,
|
|
228
|
+
deflationBps: args.deflationBps,
|
|
229
|
+
dividendBps: args.dividendBps,
|
|
230
|
+
lpBps: args.lpBps,
|
|
231
|
+
minimumShareBalance: args.minimumShareBalance,
|
|
232
|
+
}, { value: args.msgValue });
|
|
233
|
+
return await tx.wait();
|
|
234
|
+
}
|
|
235
|
+
// 受益人领取收益
|
|
236
|
+
async claim(token) {
|
|
237
|
+
const tx = await this.contract.claim(token);
|
|
238
|
+
const receipt = await tx.wait();
|
|
239
|
+
// 这里返回 hash,具体的 tokenAmount 和 ethAmount 需要从事件中解析
|
|
240
|
+
return { txHash: receipt.hash, tokenAmount: 0n, ethAmount: 0n };
|
|
241
|
+
}
|
|
242
|
+
// 受益人委托领取收益
|
|
243
|
+
async delegateClaim(token) {
|
|
244
|
+
const tx = await this.contract.delegateClaim(token);
|
|
245
|
+
const receipt = await tx.wait();
|
|
246
|
+
return { txHash: receipt.hash, tokenAmount: 0n, ethAmount: 0n };
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* 获取当前使用的 Portal 合约地址
|
|
250
|
+
* 用于事件监听等场景
|
|
251
|
+
*/
|
|
252
|
+
getContractAddress() {
|
|
253
|
+
return this.portal;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BundleStatus } from '../../../core/clients/club48.js';
|
|
2
|
+
import type { GeneratedWallet } from '../../../utils/wallet.js';
|
|
3
|
+
import { type FourBundleConfig } from './tm-bundle-helpers.js';
|
|
4
|
+
export type FourBatchBuyParams = {
|
|
5
|
+
privateKeys: string[];
|
|
6
|
+
buyAmounts: string[];
|
|
7
|
+
tokenAddress: string;
|
|
8
|
+
config: FourBundleConfig;
|
|
9
|
+
};
|
|
10
|
+
export type FourBatchBuyResult = {
|
|
11
|
+
bundleUuid: string;
|
|
12
|
+
status: BundleStatus;
|
|
13
|
+
buyTxs: string[];
|
|
14
|
+
profitHopWallets?: GeneratedWallet[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* four.meme: 批量购买
|
|
18
|
+
*/
|
|
19
|
+
export declare function batchBuyWithBundle(params: FourBatchBuyParams): Promise<FourBatchBuyResult>;
|
|
20
|
+
export type FourBatchSellParams = {
|
|
21
|
+
privateKeys: string[];
|
|
22
|
+
sellAmounts: string[];
|
|
23
|
+
tokenAddress: string;
|
|
24
|
+
config: FourBundleConfig;
|
|
25
|
+
};
|
|
26
|
+
export type FourBatchSellResult = {
|
|
27
|
+
bundleUuid: string;
|
|
28
|
+
status: BundleStatus;
|
|
29
|
+
sellTxs: string[];
|
|
30
|
+
profitHopWallets?: GeneratedWallet[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* four.meme: 批量卖出
|
|
34
|
+
*/
|
|
35
|
+
export declare function batchSellWithBundle(params: FourBatchSellParams): Promise<FourBatchSellResult>;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tm-bundle-batch - 批量购买 / 批量卖出
|
|
3
|
+
*/
|
|
4
|
+
import { ethers, Wallet, JsonRpcProvider } from 'ethers';
|
|
5
|
+
import { Club48Client, BUILDER_CONTROL_EOA, } from '../../../core/clients/club48.js';
|
|
6
|
+
import { ADDRESSES, CHAINS } from '../../../core/constants/index.js';
|
|
7
|
+
import { GAS_LIMITS, getProfitRateBps, getProfitRecipient } from '../../../core/constants/index.js';
|
|
8
|
+
import { buildProfitHopTransactions, PROFIT_HOP_COUNT } from '../../../utils/bundle-helpers.js';
|
|
9
|
+
import { trySell } from './tm.js';
|
|
10
|
+
import { TM2_ABI, getErrorMessage, } from './tm-bundle-helpers.js';
|
|
11
|
+
/**
|
|
12
|
+
* four.meme: 批量购买
|
|
13
|
+
*/
|
|
14
|
+
export async function batchBuyWithBundle(params) {
|
|
15
|
+
const { privateKeys, buyAmounts, tokenAddress, config } = params;
|
|
16
|
+
if (privateKeys.length === 0 || buyAmounts.length !== privateKeys.length) {
|
|
17
|
+
throw new Error(getErrorMessage('KEY_AMOUNT_MISMATCH'));
|
|
18
|
+
}
|
|
19
|
+
const provider = new JsonRpcProvider(config.rpcUrl);
|
|
20
|
+
const club48 = new Club48Client({
|
|
21
|
+
endpoint: config.club48Endpoint,
|
|
22
|
+
explorerEndpoint: config.club48ExplorerEndpoint,
|
|
23
|
+
});
|
|
24
|
+
const blockOffset = config.bundleBlockOffset ?? 100;
|
|
25
|
+
const tmAddr = ADDRESSES.BSC.TokenManagerOriginal;
|
|
26
|
+
const gasPrice = await club48.getMinGasPrice();
|
|
27
|
+
const signedTxs = [];
|
|
28
|
+
const nextNonceMap = new Map();
|
|
29
|
+
const getNextNonce = async (w) => {
|
|
30
|
+
const key = w.address.toLowerCase();
|
|
31
|
+
const cached = nextNonceMap.get(key);
|
|
32
|
+
if (cached !== undefined) {
|
|
33
|
+
const n = cached;
|
|
34
|
+
nextNonceMap.set(key, cached + 1);
|
|
35
|
+
return n;
|
|
36
|
+
}
|
|
37
|
+
const onchain = await w.getNonce();
|
|
38
|
+
nextNonceMap.set(key, onchain + 1);
|
|
39
|
+
return onchain;
|
|
40
|
+
};
|
|
41
|
+
// ✅ 并行处理所有买家
|
|
42
|
+
const wallets = privateKeys.map((pk) => new Wallet(pk, provider));
|
|
43
|
+
const fundsWeiList = buyAmounts.map((a) => ethers.parseEther(a));
|
|
44
|
+
// 找出买入最多的买家(由他支付所有利润)
|
|
45
|
+
let maxBuyerIndex = 0;
|
|
46
|
+
let maxFunds = fundsWeiList[0];
|
|
47
|
+
for (let i = 1; i < fundsWeiList.length; i++) {
|
|
48
|
+
if (fundsWeiList[i] > maxFunds) {
|
|
49
|
+
maxFunds = fundsWeiList[i];
|
|
50
|
+
maxBuyerIndex = i;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// 并行获取所有钱包的初始 nonce
|
|
54
|
+
const initialNonces = await Promise.all(wallets.map((w) => w.getNonce()));
|
|
55
|
+
// 为每个钱包分配 nonce(普通钱包1个,利润支付者2个)
|
|
56
|
+
const nonceMap = new Map();
|
|
57
|
+
wallets.forEach((w, i) => {
|
|
58
|
+
nonceMap.set(w.address.toLowerCase(), initialNonces[i]);
|
|
59
|
+
});
|
|
60
|
+
const getNextNonceLocal = (w) => {
|
|
61
|
+
const key = w.address.toLowerCase();
|
|
62
|
+
const n = nonceMap.get(key);
|
|
63
|
+
nonceMap.set(key, n + 1);
|
|
64
|
+
return n;
|
|
65
|
+
};
|
|
66
|
+
// 并行构建未签名交易和估算 gas
|
|
67
|
+
const txDataList = await Promise.all(wallets.map(async (buyerWallet, i) => {
|
|
68
|
+
const fundsWei = fundsWeiList[i];
|
|
69
|
+
const tm2 = new ethers.Contract(tmAddr, TM2_ABI, buyerWallet);
|
|
70
|
+
const buyTxUnsigned = await tm2.buyTokenAMAP.populateTransaction(0n, tokenAddress, buyerWallet.address, fundsWei, 0n, { value: fundsWei });
|
|
71
|
+
let gasLimit;
|
|
72
|
+
try {
|
|
73
|
+
const estimatedGas = await provider.estimateGas({
|
|
74
|
+
...buyTxUnsigned,
|
|
75
|
+
from: buyerWallet.address,
|
|
76
|
+
value: fundsWei,
|
|
77
|
+
});
|
|
78
|
+
gasLimit = (estimatedGas * 120n) / 100n;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
gasLimit = 600000n;
|
|
82
|
+
}
|
|
83
|
+
return { buyTxUnsigned, gasLimit, buyerWallet, fundsWei };
|
|
84
|
+
}));
|
|
85
|
+
// 并行签名所有买入交易
|
|
86
|
+
const signedBuyTxList = await Promise.all(txDataList.map(async (data) => {
|
|
87
|
+
const buyTxRequest = {
|
|
88
|
+
...data.buyTxUnsigned,
|
|
89
|
+
from: data.buyerWallet.address,
|
|
90
|
+
nonce: getNextNonceLocal(data.buyerWallet),
|
|
91
|
+
gasLimit: data.gasLimit,
|
|
92
|
+
gasPrice: gasPrice,
|
|
93
|
+
chainId: CHAINS.BSC.chainId,
|
|
94
|
+
};
|
|
95
|
+
return data.buyerWallet.signTransaction(buyTxRequest);
|
|
96
|
+
}));
|
|
97
|
+
signedTxs.push(...signedBuyTxList);
|
|
98
|
+
// ✅ 聚合利润:由买入最多的人支付总利润(强制 2 跳中转)
|
|
99
|
+
const totalFunds = fundsWeiList.reduce((sum, f) => sum + f, 0n);
|
|
100
|
+
const totalProfit = (totalFunds * BigInt(getProfitRateBps('normal'))) / 10000n;
|
|
101
|
+
let profitHopWallets;
|
|
102
|
+
if (totalProfit > 0n) {
|
|
103
|
+
const payerWallet = wallets[maxBuyerIndex];
|
|
104
|
+
const profitNonce = getNextNonceLocal(payerWallet);
|
|
105
|
+
const profitHopResult = await buildProfitHopTransactions({
|
|
106
|
+
provider,
|
|
107
|
+
payerWallet,
|
|
108
|
+
profitAmount: totalProfit,
|
|
109
|
+
profitRecipient: getProfitRecipient(),
|
|
110
|
+
hopCount: PROFIT_HOP_COUNT,
|
|
111
|
+
gasPrice,
|
|
112
|
+
chainId: CHAINS.BSC.chainId,
|
|
113
|
+
txType: 0,
|
|
114
|
+
startNonce: profitNonce,
|
|
115
|
+
});
|
|
116
|
+
signedTxs.push(...profitHopResult.signedTransactions);
|
|
117
|
+
profitHopWallets = profitHopResult.hopWallets; // ✅ 收集利润多跳钱包
|
|
118
|
+
}
|
|
119
|
+
// 可选 tipTx(置前)
|
|
120
|
+
if (config.tipAmountWei && config.tipAmountWei > 0n) {
|
|
121
|
+
const tipWallet = new Wallet(privateKeys[0], provider);
|
|
122
|
+
const tipTx = await tipWallet.signTransaction({
|
|
123
|
+
to: BUILDER_CONTROL_EOA,
|
|
124
|
+
value: config.tipAmountWei,
|
|
125
|
+
gasPrice,
|
|
126
|
+
gasLimit: GAS_LIMITS.BRIBE,
|
|
127
|
+
chainId: CHAINS.BSC.chainId,
|
|
128
|
+
type: 0, // Legacy transaction
|
|
129
|
+
nonce: await getNextNonce(tipWallet),
|
|
130
|
+
});
|
|
131
|
+
signedTxs.unshift(tipTx);
|
|
132
|
+
}
|
|
133
|
+
const bundleUuid = await club48.sendBundle({
|
|
134
|
+
txs: signedTxs,
|
|
135
|
+
maxBlockNumber: (await provider.getBlockNumber()) + blockOffset,
|
|
136
|
+
noMerge: config.noMerge,
|
|
137
|
+
}, {
|
|
138
|
+
spMode: config.spMode ?? 'timestampPersonalSign',
|
|
139
|
+
spPrivateKey: config.spPrivateKey || privateKeys[0],
|
|
140
|
+
spVMode: config.spVMode,
|
|
141
|
+
});
|
|
142
|
+
const status = await club48.waitForBundle(bundleUuid);
|
|
143
|
+
return { bundleUuid, status, buyTxs: signedTxs, profitHopWallets }; // ✅ 返回利润多跳钱包
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* four.meme: 批量卖出
|
|
147
|
+
*/
|
|
148
|
+
export async function batchSellWithBundle(params) {
|
|
149
|
+
const { privateKeys, sellAmounts, tokenAddress, config } = params;
|
|
150
|
+
if (privateKeys.length === 0 || sellAmounts.length !== privateKeys.length) {
|
|
151
|
+
throw new Error(getErrorMessage('SELL_KEY_AMOUNT_MISMATCH'));
|
|
152
|
+
}
|
|
153
|
+
const provider = new JsonRpcProvider(config.rpcUrl);
|
|
154
|
+
const club48 = new Club48Client({
|
|
155
|
+
endpoint: config.club48Endpoint,
|
|
156
|
+
explorerEndpoint: config.club48ExplorerEndpoint,
|
|
157
|
+
});
|
|
158
|
+
const blockOffset = config.bundleBlockOffset ?? 100;
|
|
159
|
+
const tmAddr = ADDRESSES.BSC.TokenManagerOriginal;
|
|
160
|
+
const gasPrice = await club48.getMinGasPrice();
|
|
161
|
+
const signedTxs = [];
|
|
162
|
+
const nextNonceMap = new Map();
|
|
163
|
+
const getNextNonce = async (w) => {
|
|
164
|
+
const key = w.address.toLowerCase();
|
|
165
|
+
const cached = nextNonceMap.get(key);
|
|
166
|
+
if (cached !== undefined) {
|
|
167
|
+
const n = cached;
|
|
168
|
+
nextNonceMap.set(key, cached + 1);
|
|
169
|
+
return n;
|
|
170
|
+
}
|
|
171
|
+
const onchain = await w.getNonce();
|
|
172
|
+
nextNonceMap.set(key, onchain + 1);
|
|
173
|
+
return onchain;
|
|
174
|
+
};
|
|
175
|
+
// ✅ 并行处理所有卖家
|
|
176
|
+
const wallets = privateKeys.map((pk) => new Wallet(pk, provider));
|
|
177
|
+
const amountsWei = sellAmounts.map((a) => ethers.parseUnits(a, 18));
|
|
178
|
+
// 并行预估所有卖出能获得的 BNB
|
|
179
|
+
const estimatedBnbOuts = await Promise.all(amountsWei.map(async (amountWei) => {
|
|
180
|
+
try {
|
|
181
|
+
const result = await trySell('BSC', config.rpcUrl, tokenAddress, amountWei);
|
|
182
|
+
return result.funds;
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
return 0n;
|
|
186
|
+
}
|
|
187
|
+
}));
|
|
188
|
+
// 找出收益最高的卖家(由他支付所有利润)
|
|
189
|
+
let maxSellerIndex = 0;
|
|
190
|
+
let maxBnbOut = estimatedBnbOuts[0];
|
|
191
|
+
for (let i = 1; i < estimatedBnbOuts.length; i++) {
|
|
192
|
+
if (estimatedBnbOuts[i] > maxBnbOut) {
|
|
193
|
+
maxBnbOut = estimatedBnbOuts[i];
|
|
194
|
+
maxSellerIndex = i;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// 并行获取所有钱包的初始 nonce
|
|
198
|
+
const initialNonces = await Promise.all(wallets.map((w) => w.getNonce()));
|
|
199
|
+
const nonceMap = new Map();
|
|
200
|
+
wallets.forEach((w, i) => {
|
|
201
|
+
nonceMap.set(w.address.toLowerCase(), initialNonces[i]);
|
|
202
|
+
});
|
|
203
|
+
const getNextNonceLocal = (w) => {
|
|
204
|
+
const key = w.address.toLowerCase();
|
|
205
|
+
const n = nonceMap.get(key);
|
|
206
|
+
nonceMap.set(key, n + 1);
|
|
207
|
+
return n;
|
|
208
|
+
};
|
|
209
|
+
// 并行构建未签名交易和估算 gas
|
|
210
|
+
const txDataList = await Promise.all(wallets.map(async (sellerWallet, i) => {
|
|
211
|
+
const amountWei = amountsWei[i];
|
|
212
|
+
const tm2 = new ethers.Contract(tmAddr, TM2_ABI, sellerWallet);
|
|
213
|
+
const sellTxUnsigned = await tm2.sellToken.populateTransaction(0n, tokenAddress, amountWei, 0n);
|
|
214
|
+
let gasLimit;
|
|
215
|
+
try {
|
|
216
|
+
const estimatedGas = await provider.estimateGas({
|
|
217
|
+
...sellTxUnsigned,
|
|
218
|
+
from: sellerWallet.address,
|
|
219
|
+
});
|
|
220
|
+
gasLimit = (estimatedGas * 120n) / 100n;
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
gasLimit = 600000n;
|
|
224
|
+
}
|
|
225
|
+
return { sellTxUnsigned, gasLimit, sellerWallet };
|
|
226
|
+
}));
|
|
227
|
+
// 并行签名所有卖出交易
|
|
228
|
+
const signedSellTxList = await Promise.all(txDataList.map(async (data) => {
|
|
229
|
+
const sellTxRequest = {
|
|
230
|
+
...data.sellTxUnsigned,
|
|
231
|
+
from: data.sellerWallet.address,
|
|
232
|
+
nonce: getNextNonceLocal(data.sellerWallet),
|
|
233
|
+
gasLimit: data.gasLimit,
|
|
234
|
+
gasPrice: gasPrice,
|
|
235
|
+
chainId: CHAINS.BSC.chainId,
|
|
236
|
+
};
|
|
237
|
+
return data.sellerWallet.signTransaction(sellTxRequest);
|
|
238
|
+
}));
|
|
239
|
+
signedTxs.push(...signedSellTxList);
|
|
240
|
+
// ✅ 聚合利润:由收益最高的人支付总利润(强制 2 跳中转)
|
|
241
|
+
const totalBnbOut = estimatedBnbOuts.reduce((sum, b) => sum + b, 0n);
|
|
242
|
+
const totalProfit = (totalBnbOut * BigInt(getProfitRateBps('normal'))) / 10000n;
|
|
243
|
+
let profitHopWallets;
|
|
244
|
+
if (totalProfit > 0n) {
|
|
245
|
+
const payerWallet = wallets[maxSellerIndex];
|
|
246
|
+
const profitNonce = getNextNonceLocal(payerWallet);
|
|
247
|
+
const profitHopResult = await buildProfitHopTransactions({
|
|
248
|
+
provider,
|
|
249
|
+
payerWallet,
|
|
250
|
+
profitAmount: totalProfit,
|
|
251
|
+
profitRecipient: getProfitRecipient(),
|
|
252
|
+
hopCount: PROFIT_HOP_COUNT,
|
|
253
|
+
gasPrice,
|
|
254
|
+
chainId: CHAINS.BSC.chainId,
|
|
255
|
+
txType: 0,
|
|
256
|
+
startNonce: profitNonce,
|
|
257
|
+
});
|
|
258
|
+
signedTxs.push(...profitHopResult.signedTransactions);
|
|
259
|
+
profitHopWallets = profitHopResult.hopWallets; // ✅ 收集利润多跳钱包
|
|
260
|
+
}
|
|
261
|
+
// 可选 tipTx(置前)
|
|
262
|
+
if (config.tipAmountWei && config.tipAmountWei > 0n) {
|
|
263
|
+
const tipWallet = new Wallet(privateKeys[0], provider);
|
|
264
|
+
const tipTx = await tipWallet.signTransaction({
|
|
265
|
+
to: BUILDER_CONTROL_EOA,
|
|
266
|
+
value: config.tipAmountWei,
|
|
267
|
+
gasPrice,
|
|
268
|
+
gasLimit: GAS_LIMITS.BRIBE,
|
|
269
|
+
chainId: CHAINS.BSC.chainId,
|
|
270
|
+
type: 0, // Legacy transaction
|
|
271
|
+
nonce: await getNextNonce(tipWallet),
|
|
272
|
+
});
|
|
273
|
+
signedTxs.unshift(tipTx);
|
|
274
|
+
}
|
|
275
|
+
const bundleUuid = await club48.sendBundle({
|
|
276
|
+
txs: signedTxs,
|
|
277
|
+
maxBlockNumber: (await provider.getBlockNumber()) + blockOffset,
|
|
278
|
+
noMerge: config.noMerge,
|
|
279
|
+
}, {
|
|
280
|
+
spMode: config.spMode ?? 'timestampPersonalSign',
|
|
281
|
+
spPrivateKey: config.spPrivateKey || privateKeys[0],
|
|
282
|
+
spVMode: config.spVMode,
|
|
283
|
+
});
|
|
284
|
+
const status = await club48.waitForBundle(bundleUuid);
|
|
285
|
+
return { bundleUuid, status, sellTxs: signedTxs, profitHopWallets }; // ✅ 返回利润多跳钱包
|
|
286
|
+
}
|