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,59 @@
|
|
|
1
|
+
import { getProfitRateBps as getSharedProfitRateBps, getProfitRecipient as pickRandomProfitRecipient, } from '../../../core/constants/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* 根据用户类型获取利润率(单边模式)
|
|
4
|
+
* - v0: 8 bps = 0.08%
|
|
5
|
+
* - v1: 10 bps = 0.10%
|
|
6
|
+
* - default: 8 bps = 0.08%
|
|
7
|
+
*/
|
|
8
|
+
export function getProfitRateBps(userType) {
|
|
9
|
+
if (userType === 'v0')
|
|
10
|
+
return getSharedProfitRateBps('v0Single');
|
|
11
|
+
if (userType === 'v1')
|
|
12
|
+
return getSharedProfitRateBps('v1Single');
|
|
13
|
+
return getSharedProfitRateBps('v0Single');
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 根据用户类型获取利润率(双边/换手模式)
|
|
17
|
+
*/
|
|
18
|
+
export function getProfitRateBpsDouble(userType) {
|
|
19
|
+
if (userType === 'v0')
|
|
20
|
+
return getSharedProfitRateBps('v0Double');
|
|
21
|
+
if (userType === 'v1')
|
|
22
|
+
return getSharedProfitRateBps('v1Double');
|
|
23
|
+
return getSharedProfitRateBps('v0Double');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 计算利润金额(旧版兼容)
|
|
27
|
+
*/
|
|
28
|
+
export function calculateProfitAmount(totalFlowWei, isSwapMode = false) {
|
|
29
|
+
const rateBps = getSharedProfitRateBps(isSwapMode ? 'bundleSwap' : 'normal');
|
|
30
|
+
return (totalFlowWei * BigInt(rateBps)) / 10000n;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 计算利润金额(基于用户类型)
|
|
34
|
+
* @param totalFlowWei 总资金流水
|
|
35
|
+
* @param userType 用户类型
|
|
36
|
+
* @param isDoubleMode 是否双边模式(换手模式)
|
|
37
|
+
*/
|
|
38
|
+
export function calculateProfitAmountByUserType(totalFlowWei, userType, isDoubleMode = false) {
|
|
39
|
+
if (totalFlowWei <= 0n)
|
|
40
|
+
return 0n;
|
|
41
|
+
const rateBps = isDoubleMode ? getProfitRateBpsDouble(userType) : getProfitRateBps(userType);
|
|
42
|
+
return (totalFlowWei * BigInt(rateBps)) / 10000n;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 根据交易数量计算利润金额
|
|
46
|
+
* @param totalFlowWei 总资金流水
|
|
47
|
+
* @param txCount 交易数量
|
|
48
|
+
* @param userType 用户类型
|
|
49
|
+
*/
|
|
50
|
+
export function calculateProfitAmountByTxCount(totalFlowWei, txCount, userType) {
|
|
51
|
+
if (totalFlowWei <= 0n || txCount <= 0)
|
|
52
|
+
return 0n;
|
|
53
|
+
const rateBpsPerTx = getProfitRateBps(userType);
|
|
54
|
+
const totalRateBps = rateBpsPerTx * txCount;
|
|
55
|
+
return (totalFlowWei * BigInt(totalRateBps)) / 10000n;
|
|
56
|
+
}
|
|
57
|
+
export function getProfitRecipient(config) {
|
|
58
|
+
return config?.profitRecipient ?? pickRandomProfitRecipient();
|
|
59
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createXLayerProvider } from '../../../utils/provider-factory.js';
|
|
2
|
+
import { XLAYER_RPC_URL } from './constants.js';
|
|
3
|
+
// ========================================
|
|
4
|
+
// Provider 缓存
|
|
5
|
+
// ========================================
|
|
6
|
+
const providerCache = new Map();
|
|
7
|
+
export function getCachedProvider(rpcUrl = XLAYER_RPC_URL) {
|
|
8
|
+
let provider = providerCache.get(rpcUrl);
|
|
9
|
+
if (!provider) {
|
|
10
|
+
provider = createXLayerProvider(rpcUrl);
|
|
11
|
+
providerCache.set(rpcUrl, provider);
|
|
12
|
+
}
|
|
13
|
+
return provider;
|
|
14
|
+
}
|
|
15
|
+
export function clearProviderCache() {
|
|
16
|
+
providerCache.clear();
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DEFAULT_DEADLINE_MINUTES } from './constants.js';
|
|
2
|
+
// ========================================
|
|
3
|
+
// 时间工具
|
|
4
|
+
// ========================================
|
|
5
|
+
export function getDeadline(minutes = DEFAULT_DEADLINE_MINUTES) {
|
|
6
|
+
return Math.floor(Date.now() / 1000) + minutes * 60;
|
|
7
|
+
}
|
|
8
|
+
export function delay(ms) {
|
|
9
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Wallet } from 'ethers';
|
|
2
|
+
import type { Authorization, Call3Value, EIP7702Config } from './types.js';
|
|
3
|
+
export declare function buildEIP7702Transaction(mainWallet: Wallet, authorizations: Authorization[], calls: Call3Value[], totalValue: bigint, config?: EIP7702Config): Promise<string>;
|
|
4
|
+
/**
|
|
5
|
+
* 构建 EIP-7702 交易(带预取数据)- 用于已并行获取 nonce/feeData 的场景
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildEIP7702TransactionSync(mainWallet: Wallet, authorizations: Authorization[], calls: Call3Value[], totalValue: bigint, nonce: number, feeData: {
|
|
8
|
+
maxPriorityFeePerGas: bigint | null;
|
|
9
|
+
maxFeePerGas: bigint | null;
|
|
10
|
+
}, config?: EIP7702Config): string;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
import * as rlp from '@ethereumjs/rlp';
|
|
3
|
+
import { EIP7702_TX_TYPE, MULTICALL3_ABI, MULTICALL3_ADDRESS, XLAYER_CHAIN_ID } from './constants.js';
|
|
4
|
+
import { addressToBytes, bigintToBytes, hexToBytes, trimLeadingZeros } from './bytes.js';
|
|
5
|
+
import { getCachedProvider } from './provider.js';
|
|
6
|
+
import { estimateGasLimit } from './gas.js';
|
|
7
|
+
// ========================================
|
|
8
|
+
// EIP-7702 交易构建
|
|
9
|
+
// ========================================
|
|
10
|
+
export async function buildEIP7702Transaction(mainWallet, authorizations, calls, totalValue, config) {
|
|
11
|
+
const provider = getCachedProvider(config?.rpcUrl);
|
|
12
|
+
const chainId = config?.chainId ?? XLAYER_CHAIN_ID;
|
|
13
|
+
// ✅ 动态 Gas 估算:根据授权数量和调用复杂度自动计算
|
|
14
|
+
const gasLimit = estimateGasLimit(authorizations.length, calls, config?.gasLimit);
|
|
15
|
+
// ✅ 并行获取 nonce 和 fee data
|
|
16
|
+
const [nonce, feeData] = await Promise.all([
|
|
17
|
+
provider.getTransactionCount(mainWallet.address, 'pending'),
|
|
18
|
+
provider.getFeeData(),
|
|
19
|
+
]);
|
|
20
|
+
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas || ethers.parseUnits('1', 'gwei');
|
|
21
|
+
const maxFeePerGas = feeData.maxFeePerGas || ethers.parseUnits('50', 'gwei');
|
|
22
|
+
const multicall3 = new ethers.Interface(MULTICALL3_ABI);
|
|
23
|
+
const callData = multicall3.encodeFunctionData('aggregate3Value', [
|
|
24
|
+
calls.map((c) => ({
|
|
25
|
+
target: c.target,
|
|
26
|
+
allowFailure: c.allowFailure,
|
|
27
|
+
value: c.value,
|
|
28
|
+
callData: c.callData,
|
|
29
|
+
})),
|
|
30
|
+
]);
|
|
31
|
+
const authList = authorizations.map((auth) => [
|
|
32
|
+
bigintToBytes(auth.chainId),
|
|
33
|
+
addressToBytes(auth.address),
|
|
34
|
+
bigintToBytes(auth.nonce),
|
|
35
|
+
bigintToBytes(BigInt(auth.yParity)),
|
|
36
|
+
trimLeadingZeros(auth.r),
|
|
37
|
+
trimLeadingZeros(auth.s),
|
|
38
|
+
]);
|
|
39
|
+
const txData = [
|
|
40
|
+
bigintToBytes(BigInt(chainId)),
|
|
41
|
+
bigintToBytes(BigInt(nonce)),
|
|
42
|
+
bigintToBytes(maxPriorityFeePerGas),
|
|
43
|
+
bigintToBytes(maxFeePerGas),
|
|
44
|
+
bigintToBytes(gasLimit),
|
|
45
|
+
addressToBytes(MULTICALL3_ADDRESS),
|
|
46
|
+
bigintToBytes(totalValue),
|
|
47
|
+
hexToBytes(callData),
|
|
48
|
+
[],
|
|
49
|
+
authList,
|
|
50
|
+
];
|
|
51
|
+
const rlpEncoded = rlp.encode(txData);
|
|
52
|
+
const toSign = new Uint8Array(1 + rlpEncoded.length);
|
|
53
|
+
toSign[0] = EIP7702_TX_TYPE;
|
|
54
|
+
toSign.set(rlpEncoded, 1);
|
|
55
|
+
const txHash = ethers.keccak256(toSign);
|
|
56
|
+
const signingKey = new ethers.SigningKey(mainWallet.privateKey);
|
|
57
|
+
const sig = signingKey.sign(txHash);
|
|
58
|
+
// ✅ 交易签名的 r/s 也需要去除前导零,符合 RLP 规范
|
|
59
|
+
const signedTxData = [
|
|
60
|
+
...txData,
|
|
61
|
+
bigintToBytes(BigInt(sig.yParity)),
|
|
62
|
+
trimLeadingZeros(ethers.getBytes(sig.r)),
|
|
63
|
+
trimLeadingZeros(ethers.getBytes(sig.s)),
|
|
64
|
+
];
|
|
65
|
+
const signedRlp = rlp.encode(signedTxData);
|
|
66
|
+
const signedTx = new Uint8Array(1 + signedRlp.length);
|
|
67
|
+
signedTx[0] = EIP7702_TX_TYPE;
|
|
68
|
+
signedTx.set(signedRlp, 1);
|
|
69
|
+
return ethers.hexlify(signedTx);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 构建 EIP-7702 交易(带预取数据)- 用于已并行获取 nonce/feeData 的场景
|
|
73
|
+
*/
|
|
74
|
+
export function buildEIP7702TransactionSync(mainWallet, authorizations, calls, totalValue, nonce, feeData, config) {
|
|
75
|
+
const chainId = config?.chainId ?? XLAYER_CHAIN_ID;
|
|
76
|
+
// ✅ 动态 Gas 估算:根据授权数量和调用复杂度自动计算
|
|
77
|
+
const gasLimit = estimateGasLimit(authorizations.length, calls, config?.gasLimit);
|
|
78
|
+
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas || ethers.parseUnits('1', 'gwei');
|
|
79
|
+
const maxFeePerGas = feeData.maxFeePerGas || ethers.parseUnits('50', 'gwei');
|
|
80
|
+
const multicall3 = new ethers.Interface(MULTICALL3_ABI);
|
|
81
|
+
const callData = multicall3.encodeFunctionData('aggregate3Value', [
|
|
82
|
+
calls.map((c) => ({
|
|
83
|
+
target: c.target,
|
|
84
|
+
allowFailure: c.allowFailure,
|
|
85
|
+
value: c.value,
|
|
86
|
+
callData: c.callData,
|
|
87
|
+
})),
|
|
88
|
+
]);
|
|
89
|
+
const authList = authorizations.map((auth) => [
|
|
90
|
+
bigintToBytes(auth.chainId),
|
|
91
|
+
addressToBytes(auth.address),
|
|
92
|
+
bigintToBytes(auth.nonce),
|
|
93
|
+
bigintToBytes(BigInt(auth.yParity)),
|
|
94
|
+
trimLeadingZeros(auth.r),
|
|
95
|
+
trimLeadingZeros(auth.s),
|
|
96
|
+
]);
|
|
97
|
+
const txData = [
|
|
98
|
+
bigintToBytes(BigInt(chainId)),
|
|
99
|
+
bigintToBytes(BigInt(nonce)),
|
|
100
|
+
bigintToBytes(maxPriorityFeePerGas),
|
|
101
|
+
bigintToBytes(maxFeePerGas),
|
|
102
|
+
bigintToBytes(gasLimit),
|
|
103
|
+
addressToBytes(MULTICALL3_ADDRESS),
|
|
104
|
+
bigintToBytes(totalValue),
|
|
105
|
+
hexToBytes(callData),
|
|
106
|
+
[],
|
|
107
|
+
authList,
|
|
108
|
+
];
|
|
109
|
+
const rlpEncoded = rlp.encode(txData);
|
|
110
|
+
const toSign = new Uint8Array(1 + rlpEncoded.length);
|
|
111
|
+
toSign[0] = EIP7702_TX_TYPE;
|
|
112
|
+
toSign.set(rlpEncoded, 1);
|
|
113
|
+
const txHash = ethers.keccak256(toSign);
|
|
114
|
+
const signingKey = new ethers.SigningKey(mainWallet.privateKey);
|
|
115
|
+
const sig = signingKey.sign(txHash);
|
|
116
|
+
// ✅ 交易签名的 r/s 也需要去除前导零,符合 RLP 规范
|
|
117
|
+
const signedTxData = [
|
|
118
|
+
...txData,
|
|
119
|
+
bigintToBytes(BigInt(sig.yParity)),
|
|
120
|
+
trimLeadingZeros(ethers.getBytes(sig.r)),
|
|
121
|
+
trimLeadingZeros(ethers.getBytes(sig.s)),
|
|
122
|
+
];
|
|
123
|
+
const signedRlp = rlp.encode(signedTxData);
|
|
124
|
+
const signedTx = new Uint8Array(1 + signedRlp.length);
|
|
125
|
+
signedTx[0] = EIP7702_TX_TYPE;
|
|
126
|
+
signedTx.set(signedRlp, 1);
|
|
127
|
+
return ethers.hexlify(signedTx);
|
|
128
|
+
}
|
|
@@ -1,87 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* EIP-7702 XLayer
|
|
3
|
-
*/
|
|
4
|
-
import { Wallet, JsonRpcProvider } from 'ethers';
|
|
5
|
-
import type { Authorization, Call3Value, WalletType, GeneratedWallet, EIP7702Config } from './types.js';
|
|
6
|
-
export declare function bigintToBytes(value: bigint): Uint8Array;
|
|
7
|
-
export declare function addressToBytes(address: string): Uint8Array;
|
|
8
|
-
export declare function hexToBytes(hex: string): Uint8Array;
|
|
9
|
-
export declare function trimLeadingZeros(bytes: Uint8Array): Uint8Array;
|
|
10
|
-
export declare function getCachedProvider(rpcUrl?: string): JsonRpcProvider;
|
|
11
|
-
export declare function clearProviderCache(): void;
|
|
12
|
-
/**
|
|
13
|
-
* 操作类型(用于 gas 估算)
|
|
14
|
-
*/
|
|
15
|
-
export type OperationType = 'transfer' | 'buy' | 'sell' | 'swap' | 'create' | 'approve' | 'graduate' | 'unknown';
|
|
16
|
-
/**
|
|
17
|
-
* 动态估算 Gas Limit
|
|
2
|
+
* EIP-7702 XLayer 工具函数(barrel re-export)
|
|
18
3
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
export
|
|
30
|
-
export
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
export
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
*/
|
|
38
|
-
export declare function signAuthorizationsBatch(wallets: WalletType[], delegateAddress: string, provider: JsonRpcProvider, mainWalletIndex?: number): Promise<Authorization[]>;
|
|
39
|
-
/**
|
|
40
|
-
* 批量签署授权(带预取 nonce)- 用于与其他操作并行
|
|
41
|
-
*/
|
|
42
|
-
export declare function signAuthorizationsWithNonces(wallets: WalletType[], nonces: number[], delegateAddress: string, mainWalletIndex?: number): Authorization[];
|
|
43
|
-
/**
|
|
44
|
-
* 批量获取多个地址的 nonce - 并行
|
|
45
|
-
*/
|
|
46
|
-
export declare function batchGetNonces(addresses: string[], provider: JsonRpcProvider): Promise<number[]>;
|
|
47
|
-
export declare function buildEIP7702Transaction(mainWallet: Wallet, authorizations: Authorization[], calls: Call3Value[], totalValue: bigint, config?: EIP7702Config): Promise<string>;
|
|
48
|
-
/**
|
|
49
|
-
* 构建 EIP-7702 交易(带预取数据)- 用于已并行获取 nonce/feeData 的场景
|
|
50
|
-
*/
|
|
51
|
-
export declare function buildEIP7702TransactionSync(mainWallet: Wallet, authorizations: Authorization[], calls: Call3Value[], totalValue: bigint, nonce: number, feeData: {
|
|
52
|
-
maxPriorityFeePerGas: bigint | null;
|
|
53
|
-
maxFeePerGas: bigint | null;
|
|
54
|
-
}, config?: EIP7702Config): string;
|
|
55
|
-
export type UserType = 'v0' | 'v1' | 'default';
|
|
56
|
-
/**
|
|
57
|
-
* 根据用户类型获取利润率(单边模式)
|
|
58
|
-
* - v0: 8 bps = 0.08%
|
|
59
|
-
* - v1: 10 bps = 0.10%
|
|
60
|
-
* - default: 8 bps = 0.08%
|
|
61
|
-
*/
|
|
62
|
-
export declare function getProfitRateBps(userType?: UserType): number;
|
|
63
|
-
/**
|
|
64
|
-
* 根据用户类型获取利润率(双边/换手模式)
|
|
65
|
-
*/
|
|
66
|
-
export declare function getProfitRateBpsDouble(userType?: UserType): number;
|
|
67
|
-
/**
|
|
68
|
-
* 计算利润金额(旧版兼容)
|
|
69
|
-
*/
|
|
70
|
-
export declare function calculateProfitAmount(totalFlowWei: bigint, isSwapMode?: boolean): bigint;
|
|
71
|
-
/**
|
|
72
|
-
* 计算利润金额(基于用户类型)
|
|
73
|
-
* @param totalFlowWei 总资金流水
|
|
74
|
-
* @param userType 用户类型
|
|
75
|
-
* @param isDoubleMode 是否双边模式(换手模式)
|
|
76
|
-
*/
|
|
77
|
-
export declare function calculateProfitAmountByUserType(totalFlowWei: bigint, userType?: UserType, isDoubleMode?: boolean): bigint;
|
|
78
|
-
/**
|
|
79
|
-
* 根据交易数量计算利润金额
|
|
80
|
-
* @param totalFlowWei 总资金流水
|
|
81
|
-
* @param txCount 交易数量
|
|
82
|
-
* @param userType 用户类型
|
|
83
|
-
*/
|
|
84
|
-
export declare function calculateProfitAmountByTxCount(totalFlowWei: bigint, txCount: number, userType?: UserType): bigint;
|
|
85
|
-
export declare function getProfitRecipient(config?: EIP7702Config): string;
|
|
86
|
-
export declare function getDeadline(minutes?: number): number;
|
|
87
|
-
export declare function delay(ms: number): Promise<void>;
|
|
4
|
+
* 本文件为兼容性入口,实现已按职责拆分到子文件:
|
|
5
|
+
* - bytes.ts: 字节转换工具
|
|
6
|
+
* - provider.ts: Provider 缓存
|
|
7
|
+
* - gas.ts: Gas 动态估算
|
|
8
|
+
* - wallet.ts: 钱包工具
|
|
9
|
+
* - auth.ts: EIP-7702 授权签名
|
|
10
|
+
* - tx-build.ts: EIP-7702 交易构建
|
|
11
|
+
* - profit.ts: 利润计算
|
|
12
|
+
* - time.ts: 时间工具
|
|
13
|
+
*/
|
|
14
|
+
export * from './bytes.js';
|
|
15
|
+
export * from './provider.js';
|
|
16
|
+
export * from './gas.js';
|
|
17
|
+
export * from './wallet.js';
|
|
18
|
+
export * from './auth.js';
|
|
19
|
+
export * from './tx-build.js';
|
|
20
|
+
export * from './profit.js';
|
|
21
|
+
export * from './time.js';
|