four-flap-meme-sdk 1.9.48 → 2.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/README.en.md +41 -6
- package/README.md +31 -0
- package/README.zh-CN.md +41 -6
- package/dist/abis/common.js +76 -68
- package/dist/abis/contracts/TaxToken.json +969 -0
- package/dist/abis/contracts/TokenManager2.json +136 -0
- package/dist/abis/contracts/index.d.ts +5 -0
- package/dist/abis/contracts/index.js +5 -0
- package/dist/abis/flap/index.d.ts +3 -0
- package/dist/abis/flap/index.js +3 -0
- package/dist/abis/flap/portal-events.d.ts +6 -0
- package/dist/{flap/abi.js → abis/flap/portal-events.js} +6 -2
- package/dist/abis/flap/portal.d.ts +6 -0
- package/dist/abis/flap/portal.js +37 -0
- package/dist/abis/flap/vault.d.ts +171 -0
- package/dist/abis/flap/vault.js +91 -0
- package/dist/abis/index.d.ts +7 -4
- package/dist/abis/index.js +10 -5
- package/dist/bundle-core/__tests__/config-helpers.test.js +28 -0
- package/dist/bundle-core/__tests__/facade-parity.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/facade-parity.test.js +33 -0
- package/dist/bundle-core/__tests__/sign-context-helpers.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/sign-context-helpers.test.js +60 -0
- package/dist/bundle-core/__tests__/sign-fixture.test.d.ts +1 -0
- package/dist/bundle-core/__tests__/sign-fixture.test.js +220 -0
- package/dist/bundle-core/__tests__/sign-fixtures.d.ts +10 -0
- package/dist/bundle-core/__tests__/sign-fixtures.js +16 -0
- package/dist/bundle-core/config-helpers.d.ts +36 -0
- package/dist/bundle-core/config-helpers.js +57 -0
- package/dist/bundle-core/errors.d.ts +50 -0
- package/dist/bundle-core/errors.js +34 -0
- package/dist/bundle-core/four-meme/approve-tokenmanager.d.ts +7 -0
- package/dist/bundle-core/four-meme/approve-tokenmanager.js +99 -0
- package/dist/bundle-core/four-meme/core-helpers.d.ts +8 -0
- package/dist/bundle-core/four-meme/core-helpers.js +40 -0
- package/dist/bundle-core/four-meme/core.d.ts +4 -0
- package/dist/bundle-core/four-meme/core.js +515 -0
- package/dist/bundle-core/four-meme/pancake-proxy.d.ts +28 -0
- package/dist/bundle-core/four-meme/pancake-proxy.js +679 -0
- package/dist/bundle-core/four-meme/private.d.ts +27 -0
- package/dist/bundle-core/four-meme/private.js +465 -0
- package/dist/bundle-core/four-meme/sign-context-helpers.d.ts +2 -0
- package/dist/bundle-core/four-meme/sign-context-helpers.js +2 -0
- package/dist/bundle-core/four-meme/swap-buy-first.d.ts +8 -0
- package/dist/bundle-core/four-meme/swap-buy-first.js +493 -0
- package/dist/bundle-core/four-meme/swap-hop-helpers.d.ts +6 -0
- package/dist/bundle-core/four-meme/swap-hop-helpers.js +63 -0
- package/dist/bundle-core/four-meme/swap-internal.d.ts +3 -0
- package/dist/bundle-core/four-meme/swap-internal.js +18 -0
- package/dist/bundle-core/four-meme/swap-sign-helpers.d.ts +27 -0
- package/dist/bundle-core/four-meme/swap-sign-helpers.js +105 -0
- package/dist/bundle-core/four-meme/swap.d.ts +17 -0
- package/dist/bundle-core/four-meme/swap.js +505 -0
- package/dist/bundle-core/four-meme/types/buy-first.d.ts +50 -0
- package/dist/bundle-core/four-meme/types/buy-first.js +1 -0
- package/dist/bundle-core/four-meme/types/core-flow.d.ts +63 -0
- package/dist/bundle-core/four-meme/types/core-flow.js +1 -0
- package/dist/bundle-core/four-meme/types/index.d.ts +600 -0
- package/dist/bundle-core/four-meme/types/index.js +1 -0
- package/dist/bundle-core/four-meme/types/swap-internal.d.ts +19 -0
- package/dist/bundle-core/four-meme/types/swap-internal.js +1 -0
- package/dist/bundle-core/four-meme/types.d.ts +1 -0
- package/dist/bundle-core/four-meme/types.js +1 -0
- package/dist/bundle-core/four-meme/utils-disperse.d.ts +7 -0
- package/dist/bundle-core/four-meme/utils-disperse.js +396 -0
- package/dist/bundle-core/four-meme/utils-pairwise.d.ts +8 -0
- package/dist/bundle-core/four-meme/utils-pairwise.js +328 -0
- package/dist/bundle-core/four-meme/utils-sweep.d.ts +8 -0
- package/dist/bundle-core/four-meme/utils-sweep.js +744 -0
- package/dist/bundle-core/index.d.ts +8 -0
- package/dist/bundle-core/index.js +8 -0
- package/dist/bundle-core/internal.d.ts +21 -0
- package/dist/bundle-core/internal.js +182 -0
- package/dist/bundle-core/sign-context-helpers.d.ts +25 -0
- package/dist/bundle-core/sign-context-helpers.js +67 -0
- package/dist/bundle-core/submit.d.ts +293 -0
- package/dist/bundle-core/submit.js +727 -0
- package/dist/bundle-core/types/index.d.ts +8 -0
- package/dist/bundle-core/types/index.js +1 -0
- package/dist/bundle-core/types.d.ts +1 -0
- package/dist/bundle-core/types.js +1 -0
- package/dist/chains/bsc/four/approve-tokenmanager.d.ts +1 -26
- package/dist/chains/bsc/four/approve-tokenmanager.js +1 -113
- package/dist/chains/bsc/four/config.d.ts +5 -67
- package/dist/chains/bsc/four/config.js +2 -114
- package/dist/chains/bsc/four/core.d.ts +1 -4
- package/dist/chains/bsc/four/core.js +1 -592
- package/dist/chains/bsc/four/disperse.d.ts +12 -0
- package/dist/chains/bsc/four/disperse.js +470 -0
- package/dist/chains/bsc/four/index.d.ts +6 -6
- package/dist/chains/bsc/four/index.js +6 -6
- package/dist/chains/bsc/four/internal.d.ts +2 -46
- package/dist/chains/bsc/four/internal.js +2 -239
- package/dist/chains/bsc/four/pairwise.d.ts +7 -0
- package/dist/chains/bsc/four/pairwise.js +308 -0
- package/dist/chains/bsc/four/pancake-proxy.d.ts +1 -28
- package/dist/chains/bsc/four/pancake-proxy.js +1 -687
- package/dist/chains/bsc/four/private.d.ts +1 -27
- package/dist/chains/bsc/four/private.js +1 -477
- package/dist/chains/bsc/four/submit/blockrazor.d.ts +18 -0
- package/dist/chains/bsc/four/submit/blockrazor.js +86 -0
- package/dist/chains/bsc/four/submit/direct.d.ts +66 -0
- package/dist/chains/bsc/four/submit/direct.js +452 -0
- package/dist/chains/bsc/four/submit/helpers.d.ts +18 -0
- package/dist/chains/bsc/four/submit/helpers.js +57 -0
- package/dist/chains/bsc/four/submit/index.d.ts +12 -0
- package/dist/chains/bsc/four/submit/index.js +11 -0
- package/dist/chains/bsc/four/submit/merkle.d.ts +18 -0
- package/dist/chains/bsc/four/submit/merkle.js +74 -0
- package/dist/chains/bsc/four/submit/types.d.ts +143 -0
- package/dist/chains/bsc/four/submit/types.js +1 -0
- package/dist/chains/bsc/four/submit.d.ts +2 -315
- package/dist/chains/bsc/four/submit.js +2 -752
- package/dist/chains/bsc/four/swap/index.d.ts +32 -0
- package/dist/chains/bsc/four/swap/index.js +829 -0
- package/dist/chains/bsc/four/swap/types.d.ts +70 -0
- package/dist/chains/bsc/four/swap/types.js +1 -0
- package/dist/chains/bsc/four/swap-buy-first.d.ts +2 -55
- package/dist/chains/bsc/four/swap-buy-first.js +2 -507
- package/dist/chains/bsc/four/swap-internal.d.ts +1 -3
- package/dist/chains/bsc/four/swap-internal.js +1 -18
- package/dist/chains/bsc/four/swap.d.ts +2 -144
- package/dist/chains/bsc/four/swap.js +2 -766
- package/dist/chains/bsc/four/sweep.d.ts +13 -0
- package/dist/chains/bsc/four/sweep.js +788 -0
- package/dist/chains/bsc/four/types.d.ts +1 -476
- package/dist/chains/bsc/four/utils/index.d.ts +20 -0
- package/dist/chains/bsc/four/utils/index.js +1558 -0
- package/dist/chains/bsc/four/utils/types.d.ts +1 -0
- package/dist/chains/bsc/four/utils/types.js +1 -0
- package/dist/chains/bsc/four/utils-disperse.d.ts +1 -0
- package/dist/chains/bsc/four/utils-disperse.js +1 -0
- package/dist/chains/bsc/four/utils-pairwise.d.ts +1 -0
- package/dist/chains/bsc/four/utils-pairwise.js +1 -0
- package/dist/chains/bsc/four/utils-sweep.d.ts +1 -0
- package/dist/chains/bsc/four/utils-sweep.js +1 -0
- package/dist/chains/bsc/four/utils.d.ts +5 -18
- package/dist/chains/bsc/four/utils.js +5 -1552
- package/dist/chains/bsc/pancake/bundle-buy-first/index.d.ts +8 -0
- package/dist/{pancake/bundle-buy-first.js → chains/bsc/pancake/bundle-buy-first/index.js} +74 -25
- package/dist/{pancake/bundle-buy-first.d.ts → chains/bsc/pancake/bundle-buy-first/types.d.ts} +3 -20
- package/dist/chains/bsc/pancake/bundle-buy-first/types.js +1 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +159 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +117 -0
- package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +1 -91
- package/dist/chains/bsc/pancake/bundle-buy-first.js +97 -212
- package/dist/chains/bsc/pancake/bundle-swap/helpers.d.ts +102 -0
- package/dist/chains/bsc/pancake/bundle-swap/helpers.js +572 -0
- package/dist/chains/bsc/pancake/bundle-swap/index.d.ts +50 -0
- package/dist/{pancake/bundle-swap.js → chains/bsc/pancake/bundle-swap/index.js} +68 -619
- package/dist/{pancake/bundle-swap.d.ts → chains/bsc/pancake/bundle-swap/types.d.ts} +46 -56
- package/dist/chains/bsc/pancake/bundle-swap/types.js +3 -0
- package/dist/chains/bsc/pancake/bundle-swap-helpers.d.ts +241 -0
- package/dist/chains/bsc/pancake/bundle-swap-helpers.js +565 -0
- package/dist/chains/bsc/pancake/bundle-swap.d.ts +1 -79
- package/dist/chains/bsc/pancake/bundle-swap.js +114 -726
- package/dist/chains/bsc/pancake/index.d.ts +4 -2
- package/dist/chains/bsc/pancake/index.js +1 -3
- package/dist/chains/bsc/platforms/iro/factory.js +3 -1
- package/dist/chains/bsc/platforms/iro/index.d.ts +5 -5
- package/dist/chains/bsc/platforms/iro/index.js +3 -3
- package/dist/chains/bsc/platforms/iro/pool.js +31 -10
- package/dist/chains/bsc/platforms/iro/token.js +4 -1
- package/dist/chains/eni/batch-router/bundle-approve.js +4 -3
- package/dist/chains/eni/batch-router/transfer.js +55 -25
- package/dist/chains/eni/batch-router/utils.js +32 -6
- package/dist/chains/eni/bundler/sign.js +4 -4
- package/dist/chains/eni/bundler/submit.js +1 -4
- package/dist/chains/eni/constants.js +1 -1
- package/dist/chains/eni/index.d.ts +1 -1
- package/dist/chains/eni/platforms/daoaas/create.js +2 -2
- package/dist/chains/eni/platforms/daoaas/index.d.ts +3 -3
- package/dist/chains/eni/platforms/daoaas/index.js +3 -3
- package/dist/chains/eni/platforms/daoaas/meta.js +8 -4
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +28 -44
- package/dist/chains/eni/platforms/daoaas/portal.js +10 -6
- package/dist/chains/eni/platforms/dswap/liquidity.js +58 -26
- package/dist/chains/eni/platforms/fair-launch/index.d.ts +2 -2
- package/dist/chains/eni/platforms/fair-launch/index.js +1 -1
- package/dist/chains/eni/platforms/fair-launch/launcher.js +87 -46
- package/dist/chains/eni/platforms/fair-launch/pool.js +4 -1
- package/dist/chains/eni/platforms/fair-launch/presets.js +2 -2
- package/dist/chains/eni/platforms/iro/factory.js +3 -1
- package/dist/chains/eni/platforms/iro/index.d.ts +6 -6
- package/dist/chains/eni/platforms/iro/index.js +4 -4
- package/dist/chains/eni/platforms/iro/pool.js +90 -26
- package/dist/chains/eni/platforms/iro/token.js +107 -31
- package/dist/chains/eni/platforms/iro/whitelist.js +6 -18
- package/dist/chains/eni/submit.d.ts +43 -0
- package/dist/chains/eni/submit.js +286 -0
- package/dist/chains/xlayer/eip7702/bundle-approve.d.ts +2 -26
- package/dist/chains/xlayer/eip7702/bundle-approve.js +11 -21
- package/dist/chains/xlayer/eip7702/bundle-buy.d.ts +2 -6
- package/dist/chains/xlayer/eip7702/bundle-buy.js +13 -51
- package/dist/chains/xlayer/eip7702/bundle-create.js +93 -59
- package/dist/chains/xlayer/eip7702/bundle-sell.d.ts +2 -6
- package/dist/chains/xlayer/eip7702/bundle-sell.js +26 -97
- package/dist/chains/xlayer/eip7702/bundle-swap/index.d.ts +72 -0
- package/dist/chains/xlayer/eip7702/bundle-swap/index.js +921 -0
- package/dist/chains/xlayer/eip7702/bundle-swap/types.d.ts +65 -0
- package/dist/chains/xlayer/eip7702/bundle-swap/types.js +1 -0
- package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +3 -65
- package/dist/chains/xlayer/eip7702/bundle-swap.js +51 -245
- package/dist/chains/xlayer/eip7702/constants.d.ts +1 -16
- package/dist/chains/xlayer/eip7702/constants.js +3 -21
- package/dist/chains/xlayer/eip7702/index.d.ts +27 -46
- package/dist/chains/xlayer/eip7702/index.js +27 -81
- package/dist/chains/xlayer/eip7702/multi-hop-transfer/index.d.ts +128 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer/index.js +857 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer/types.d.ts +85 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer/types.js +1 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.d.ts +79 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.js +1 -0
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.d.ts +2 -203
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.js +58 -301
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.d.ts +26 -0
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.js +57 -0
- package/dist/chains/xlayer/eip7702/types.d.ts +88 -0
- package/dist/chains/xlayer/eip7702/utils.d.ts +0 -3
- package/dist/chains/xlayer/eip7702/utils.js +23 -28
- package/dist/chains/xlayer/eip7702/volume/index.d.ts +96 -0
- package/dist/chains/xlayer/eip7702/volume/index.js +793 -0
- package/dist/chains/xlayer/eip7702/volume/types.d.ts +124 -0
- package/dist/chains/xlayer/eip7702/volume/types.js +1 -0
- package/dist/chains/xlayer/eip7702/volume-helpers.d.ts +148 -0
- package/dist/chains/xlayer/eip7702/volume-helpers.js +48 -0
- package/dist/chains/xlayer/eip7702/volume.d.ts +6 -184
- package/dist/chains/xlayer/eip7702/volume.js +83 -158
- package/dist/chains/xlayer/eoa/constants.js +1 -1
- package/dist/chains/xlayer/eoa/dex-helpers.js +5 -5
- package/dist/{xlayer/eoa-bundle-swap.d.ts → chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts} +32 -49
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +228 -0
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.d.ts +1 -95
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.js +66 -299
- package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +1 -1
- package/dist/chains/xlayer/eoa/eoa-wash-volume.js +18 -23
- package/dist/chains/xlayer/eoa/index.d.ts +10 -6
- package/dist/chains/xlayer/eoa/index.js +8 -23
- package/dist/chains/xlayer/eoa/portal-ops.js +7 -2
- package/dist/chains/xlayer/eoa/router-manager.js +3 -3
- package/dist/chains/xlayer/eoa/types-core.d.ts +363 -0
- package/dist/{xlayer/types.js → chains/xlayer/eoa/types-core.js} +1 -3
- package/dist/chains/xlayer/eoa/types-create.d.ts +413 -0
- package/dist/chains/xlayer/eoa/types-create.js +9 -0
- package/dist/chains/xlayer/eoa/types-volume.d.ts +209 -0
- package/dist/chains/xlayer/eoa/types-volume.js +13 -0
- package/dist/chains/xlayer/eoa/types.d.ts +2 -2
- package/dist/chains/xlayer/eoa/types.js +1 -3
- package/dist/contracts/helper3.d.ts +20 -5
- package/dist/contracts/helper3.js +56 -20
- package/dist/contracts/tm-bundle-helpers.d.ts +88 -0
- package/dist/contracts/tm-bundle-helpers.js +72 -0
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.d.ts +1 -26
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.js +1 -113
- package/dist/contracts/tm-bundle-merkle/config.d.ts +5 -67
- package/dist/contracts/tm-bundle-merkle/config.js +2 -114
- package/dist/contracts/tm-bundle-merkle/core.d.ts +1 -4
- package/dist/contracts/tm-bundle-merkle/core.js +1 -591
- package/dist/contracts/tm-bundle-merkle/index.d.ts +5 -5
- package/dist/contracts/tm-bundle-merkle/index.js +5 -5
- package/dist/contracts/tm-bundle-merkle/internal.d.ts +2 -46
- package/dist/contracts/tm-bundle-merkle/internal.js +2 -238
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.d.ts +1 -28
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.js +1 -686
- package/dist/contracts/tm-bundle-merkle/private.d.ts +1 -27
- package/dist/contracts/tm-bundle-merkle/private.js +1 -476
- package/dist/contracts/tm-bundle-merkle/submit.d.ts +3 -314
- package/dist/contracts/tm-bundle-merkle/submit.js +3 -928
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.d.ts +2 -55
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.js +2 -506
- package/dist/contracts/tm-bundle-merkle/swap-internal.d.ts +1 -3
- package/dist/contracts/tm-bundle-merkle/swap-internal.js +1 -18
- package/dist/contracts/tm-bundle-merkle/swap.d.ts +2 -144
- package/dist/contracts/tm-bundle-merkle/swap.js +2 -764
- package/dist/contracts/tm-bundle-merkle/types.d.ts +1 -476
- package/dist/contracts/tm-bundle-merkle/utils-disperse.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-disperse.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-sweep.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/utils-sweep.js +1 -0
- package/dist/contracts/tm-bundle-merkle/utils.d.ts +6 -18
- package/dist/contracts/tm-bundle-merkle/utils.js +6 -1501
- package/dist/contracts/tm-bundle.d.ts +3 -51
- package/dist/contracts/tm-bundle.js +108 -177
- package/dist/contracts/tm.d.ts +3 -2
- package/dist/contracts/tm.js +37 -32
- package/dist/contracts/tm1.js +9 -4
- package/dist/contracts/tm2.js +9 -4
- package/dist/dex/direct-router/index.d.ts +70 -0
- package/dist/dex/direct-router/index.js +1410 -0
- package/dist/dex/direct-router/types.d.ts +81 -0
- package/dist/dex/direct-router/types.js +1 -0
- package/dist/dex/direct-router-helpers.d.ts +264 -0
- package/dist/dex/direct-router-helpers.js +539 -0
- package/dist/dex/direct-router.d.ts +3 -125
- package/dist/dex/direct-router.js +237 -666
- package/dist/dex/types.d.ts +81 -0
- package/dist/dex/types.js +1 -0
- package/dist/exports/root-bundle-and-tooling.d.ts +27 -0
- package/dist/exports/root-bundle-and-tooling.js +30 -0
- package/dist/exports/root-eni-and-bsc-iro.d.ts +26 -0
- package/dist/exports/root-eni-and-bsc-iro.js +66 -0
- package/dist/exports/root-foundations.d.ts +35 -0
- package/dist/exports/root-foundations.js +70 -0
- package/dist/exports/root-swap-dex-and-xlayer.d.ts +30 -0
- package/dist/exports/root-swap-dex-and-xlayer.js +78 -0
- package/dist/flows/create.d.ts +2 -1
- package/dist/flows/create.js +6 -6
- package/dist/flows/index.d.ts +1 -0
- package/dist/flows/index.js +1 -0
- package/dist/index.d.ts +20 -85
- package/dist/index.js +20 -215
- package/dist/shared/abis/TaxToken.json +932 -68
- package/dist/shared/abis/TokenManager2.json +91 -15
- package/dist/shared/abis/common.d.ts +2 -83
- package/dist/shared/abis/common.js +2 -252
- package/dist/shared/abis/index.d.ts +5 -6
- package/dist/shared/abis/index.js +5 -7
- package/dist/shared/abis 2/TaxToken.json +105 -0
- package/dist/shared/abis 2/TokenManager.json +836 -0
- package/dist/shared/abis 2/TokenManagerHelper3.json +993 -0
- package/dist/shared/abis 2/common.d.ts +85 -0
- package/dist/shared/abis 2/common.js +254 -0
- package/dist/shared/abis 2/index.d.ts +8 -0
- package/dist/shared/abis 2/index.js +8 -0
- package/dist/shared/clients/blockrazor.js +39 -25
- package/dist/shared/clients/club48.d.ts +2 -2
- package/dist/shared/clients/club48.js +34 -29
- package/dist/shared/clients/emitservice.js +2 -0
- package/dist/shared/clients/four.d.ts +5 -5
- package/dist/shared/clients/four.js +21 -17
- package/dist/shared/clients/index.d.ts +8 -0
- package/dist/shared/clients/index.js +8 -0
- package/dist/shared/clients/merkle.js +27 -34
- package/dist/{clients/blockrazor.d.ts → shared/clients 2/blockrazor.d.ts } +77 -0
- package/dist/{clients/blockrazor.js → shared/clients 2/blockrazor.js } +170 -1
- package/dist/shared/clients 2/emitservice.d.ts +47 -0
- package/dist/shared/clients 2/emitservice.js +44 -0
- package/dist/shared/clients 2/four.d.ts +132 -0
- package/dist/shared/clients 2/four.js +281 -0
- package/dist/{clients/merkle.js → shared/clients 2/merkle.js } +14 -6
- package/dist/shared/constants/addresses.d.ts +1 -1
- package/dist/shared/constants/addresses.js +11 -2
- package/dist/shared/constants/chains.d.ts +1 -1
- package/dist/shared/constants/chains.js +1 -1
- package/dist/shared/constants/gas.d.ts +1 -1
- package/dist/shared/constants/gas.js +2 -6
- package/dist/shared/constants/index.d.ts +1 -0
- package/dist/shared/constants/index.js +1 -0
- package/dist/shared/constants/quote.d.ts +30 -0
- package/dist/shared/constants/quote.js +37 -0
- package/dist/shared/flap/__tests__/curve.test.d.ts +1 -0
- package/dist/shared/flap/__tests__/curve.test.js +85 -0
- package/dist/shared/flap/abi.js +1 -1
- package/dist/shared/flap/constants.d.ts +1 -1
- package/dist/shared/flap/constants.js +2 -2
- package/dist/shared/flap/curve.js +3 -0
- package/dist/shared/flap/errors.d.ts +1 -4
- package/dist/shared/flap/errors.js +20 -1
- package/dist/shared/flap/index.d.ts +2 -2
- package/dist/shared/flap/index.js +2 -2
- package/dist/shared/flap/meta.d.ts +16 -18
- package/dist/shared/flap/meta.js +12 -17
- package/dist/shared/flap/permit.js +5 -2
- package/dist/shared/flap/pinata.d.ts +11 -4
- package/dist/shared/flap/pinata.js +21 -16
- package/dist/shared/flap/portal/index.d.ts +12 -0
- package/dist/shared/flap/portal/index.js +11 -0
- package/dist/shared/flap/portal/portal.d.ts +47 -0
- package/dist/shared/flap/portal/portal.js +218 -0
- package/dist/shared/flap/portal/types.d.ts +227 -0
- package/dist/shared/flap/portal/types.js +80 -0
- package/dist/shared/flap/portal/writer.d.ts +121 -0
- package/dist/shared/flap/portal/writer.js +265 -0
- package/dist/shared/flap/portal-bundle-merkle/config.d.ts +3 -72
- package/dist/shared/flap/portal-bundle-merkle/config.js +4 -124
- package/dist/shared/flap/portal-bundle-merkle/core/index.d.ts +18 -0
- package/dist/shared/flap/portal-bundle-merkle/core/index.js +938 -0
- package/dist/shared/flap/portal-bundle-merkle/core/types.d.ts +1 -0
- package/dist/shared/flap/portal-bundle-merkle/core/types.js +1 -0
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.d.ts +32 -0
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.js +83 -0
- package/dist/shared/flap/portal-bundle-merkle/core.d.ts +0 -4
- package/dist/shared/flap/portal-bundle-merkle/core.js +66 -156
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +81 -86
- package/dist/shared/flap/portal-bundle-merkle/curve-to-dex.js +100 -92
- package/dist/shared/flap/portal-bundle-merkle/index.d.ts +11 -7
- package/dist/shared/flap/portal-bundle-merkle/index.js +4 -7
- package/dist/shared/flap/portal-bundle-merkle/pancake-proxy.js +71 -68
- package/dist/shared/flap/portal-bundle-merkle/private.js +61 -114
- package/dist/shared/flap/portal-bundle-merkle/swap/index.d.ts +42 -0
- package/dist/shared/flap/portal-bundle-merkle/swap/index.js +1448 -0
- package/dist/shared/flap/portal-bundle-merkle/swap/types.d.ts +84 -0
- package/dist/shared/flap/portal-bundle-merkle/swap/types.js +1 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +125 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.js +113 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.d.ts +1 -64
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.js +66 -247
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.d.ts +149 -0
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.js +259 -0
- package/dist/shared/flap/portal-bundle-merkle/swap.d.ts +2 -71
- package/dist/shared/flap/portal-bundle-merkle/swap.js +103 -410
- package/dist/shared/flap/portal-bundle-merkle/types.d.ts +73 -3
- package/dist/shared/flap/portal-bundle-merkle/utils/index.d.ts +17 -0
- package/dist/{flap/portal-bundle-merkle/utils.js → shared/flap/portal-bundle-merkle/utils/index.js} +154 -198
- package/dist/shared/flap/portal-bundle-merkle/utils/types.d.ts +16 -0
- package/dist/shared/flap/portal-bundle-merkle/utils/types.js +1 -0
- package/dist/shared/flap/portal-bundle-merkle/utils-helpers.d.ts +100 -0
- package/dist/shared/flap/portal-bundle-merkle/utils-helpers.js +133 -0
- package/dist/shared/flap/portal-bundle-merkle/utils.d.ts +1 -80
- package/dist/shared/flap/portal-bundle-merkle/utils.js +145 -265
- package/dist/shared/flap/portal-bundle.js +55 -56
- package/dist/shared/flap/portal.js +32 -23
- package/dist/shared/flap/vanity.js +4 -7
- package/dist/shared/flap/vault.d.ts +1 -1
- package/dist/shared/flap/vault.js +54 -48
- package/dist/shared/flap 2/__tests__/curve.test.d.ts +1 -0
- package/dist/shared/flap 2/__tests__/curve.test.js +85 -0
- package/dist/shared/flap 2/abi.d.ts +4 -0
- package/dist/shared/flap 2/abi.js +4 -0
- package/dist/{flap/constants.d.ts → shared/flap 2/constants.d.ts } +2 -1
- package/dist/{flap/constants.js → shared/flap 2/constants.js } +3 -2
- package/dist/shared/flap 2/index.d.ts +22 -0
- package/dist/shared/flap 2/index.js +33 -0
- package/dist/{flap/meta.js → shared/flap 2/meta.js } +1 -1
- package/dist/{flap/permit.js → shared/flap 2/permit.js } +1 -1
- package/dist/{flap/portal-bundle-merkle/config.d.ts → shared/flap 2/portal-bundle-merkle/config.d.ts } +1 -1
- package/dist/{flap/portal-bundle-merkle/config.js → shared/flap 2/portal-bundle-merkle/config.js } +4 -3
- package/dist/{flap/portal-bundle-merkle/core.js → shared/flap 2/portal-bundle-merkle/core.js } +232 -47
- package/dist/{flap/portal-bundle-merkle/create-to-dex.d.ts → shared/flap 2/portal-bundle-merkle/create-to-dex.d.ts } +17 -6
- package/dist/{flap/portal-bundle-merkle/create-to-dex.js → shared/flap 2/portal-bundle-merkle/create-to-dex.js } +164 -54
- package/dist/{flap/portal-bundle-merkle/curve-to-dex.d.ts → shared/flap 2/portal-bundle-merkle/curve-to-dex.d.ts } +1 -1
- package/dist/{flap/portal-bundle-merkle/curve-to-dex.js → shared/flap 2/portal-bundle-merkle/curve-to-dex.js } +36 -14
- package/dist/{flap/portal-bundle-merkle/index.js → shared/flap 2/portal-bundle-merkle/index.js } +3 -0
- package/dist/{flap/portal-bundle-merkle/pancake-proxy.js → shared/flap 2/portal-bundle-merkle/pancake-proxy.js } +5 -4
- package/dist/{flap/portal-bundle-merkle/private.js → shared/flap 2/portal-bundle-merkle/private.js } +10 -9
- package/dist/{flap/portal-bundle-merkle/swap-buy-first.d.ts → shared/flap 2/portal-bundle-merkle/swap-buy-first.d.ts } +2 -2
- package/dist/{flap/portal-bundle-merkle/swap-buy-first.js → shared/flap 2/portal-bundle-merkle/swap-buy-first.js } +8 -7
- package/dist/{flap/portal-bundle-merkle/swap.d.ts → shared/flap 2/portal-bundle-merkle/swap.d.ts } +2 -2
- package/dist/{flap/portal-bundle-merkle/swap.js → shared/flap 2/portal-bundle-merkle/swap.js } +18 -16
- package/dist/{flap/portal-bundle-merkle/types.d.ts → shared/flap 2/portal-bundle-merkle/types.d.ts } +42 -2
- package/dist/shared/flap 2/portal-bundle-merkle/types.js +1 -0
- package/dist/{flap/portal-bundle-merkle/utils.d.ts → shared/flap 2/portal-bundle-merkle/utils.d.ts } +3 -5
- package/dist/shared/flap 2/portal-bundle-merkle/utils.js +963 -0
- package/dist/{flap/portal-bundle.js → shared/flap 2/portal-bundle.js } +4 -3
- package/dist/{flap/portal.d.ts → shared/flap 2/portal.d.ts } +91 -0
- package/dist/{flap/portal.js → shared/flap 2/portal.js } +92 -33
- package/dist/{flap/vanity.d.ts → shared/flap 2/vanity.d.ts } +4 -1
- package/dist/{flap/vanity.js → shared/flap 2/vanity.js } +18 -3
- package/dist/shared/flap 2/vault.d.ts +240 -0
- package/dist/shared/flap 2/vault.js +366 -0
- package/dist/shared/foundation/dex/v3-path.d.ts +6 -0
- package/dist/shared/foundation/dex/v3-path.js +35 -0
- package/dist/shared/foundation/gas/bundle-gas.d.ts +39 -0
- package/dist/shared/foundation/gas/bundle-gas.js +93 -0
- package/dist/shared/foundation/gas/profit-hop.d.ts +20 -0
- package/dist/shared/foundation/gas/profit-hop.js +72 -0
- package/dist/shared/foundation/index.d.ts +13 -0
- package/dist/shared/foundation/index.js +12 -0
- package/dist/shared/foundation/nonce/nonce-manager.d.ts +17 -0
- package/dist/shared/foundation/nonce/nonce-manager.js +180 -0
- package/dist/shared/foundation/normalize-unknown.d.ts +9 -0
- package/dist/shared/foundation/normalize-unknown.js +29 -0
- package/dist/shared/foundation/sdk-logger.d.ts +13 -0
- package/dist/shared/foundation/sdk-logger.js +12 -0
- package/dist/shared/foundation/tx/build-request.d.ts +17 -0
- package/dist/shared/foundation/tx/build-request.js +25 -0
- package/dist/shared/foundation/tx/sign-batch.d.ts +5 -0
- package/dist/shared/foundation/tx/sign-batch.js +26 -0
- package/dist/shared/foundation/tx/wallet-sign-patch.d.ts +1 -0
- package/dist/shared/foundation/tx/wallet-sign-patch.js +18 -0
- package/dist/shared/foundation/types/airdrop-sweep.d.ts +79 -0
- package/dist/shared/foundation/types/airdrop-sweep.js +1 -0
- package/dist/shared/foundation/types/erc20.d.ts +65 -0
- package/dist/shared/foundation/types/erc20.js +1 -0
- package/dist/shared/foundation/types/holders-maker.d.ts +64 -0
- package/dist/shared/foundation/types/holders-maker.js +1 -0
- package/dist/shared/foundation/types/index.d.ts +7 -0
- package/dist/shared/foundation/types/index.js +1 -0
- package/dist/shared/foundation/types/lp-inspect.d.ts +102 -0
- package/dist/shared/foundation/types/lp-inspect.js +1 -0
- package/dist/shared/foundation/types/multicall.d.ts +5 -0
- package/dist/shared/foundation/types/multicall.js +1 -0
- package/dist/shared/foundation/types/private-sale.d.ts +35 -0
- package/dist/shared/foundation/types/private-sale.js +1 -0
- package/dist/shared/foundation/types/quote-helpers.d.ts +17 -0
- package/dist/shared/foundation/types/quote-helpers.js +1 -0
- package/dist/shared/four/tax-token.d.ts +1 -1
- package/dist/shared/four/tax-token.js +27 -7
- package/dist/shared/four 2/index.d.ts +7 -0
- package/dist/shared/four 2/index.js +22 -0
- package/dist/shared/four 2/tax-token.d.ts +176 -0
- package/dist/shared/four 2/tax-token.js +302 -0
- package/dist/shared/index 2.js +10 -0
- package/dist/shared/index.d 2.ts +10 -0
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/index.js +4 -0
- package/dist/types/distribute.d.ts +72 -0
- package/dist/types/distribute.js +1 -0
- package/dist/types/errors.d.ts +27 -0
- package/dist/types/errors.js +34 -0
- package/dist/types 2/errors.d.ts +27 -0
- package/dist/types 2/errors.js +34 -0
- package/dist/utils/__tests__/errors.test.d.ts +1 -0
- package/dist/utils/__tests__/errors.test.js +76 -0
- package/dist/utils/airdrop-sweep-types.d.ts +1 -0
- package/dist/utils/airdrop-sweep-types.js +1 -0
- package/dist/utils/airdrop-sweep.d.ts +4 -76
- package/dist/utils/airdrop-sweep.js +40 -54
- package/dist/utils/bundle-helpers.d.ts +9 -243
- package/dist/utils/bundle-helpers.js +10 -584
- package/dist/utils/constants.d.ts +5 -61
- package/dist/utils/constants.js +5 -80
- package/dist/utils/contract-factory.d.ts +2 -4
- package/dist/utils/contract-factory.js +25 -18
- package/dist/utils/erc20/index.d.ts +242 -0
- package/dist/utils/erc20/index.js +645 -0
- package/dist/utils/erc20/types.d.ts +77 -0
- package/dist/utils/erc20/types.js +1 -0
- package/dist/utils/erc20-types.d.ts +1 -0
- package/dist/utils/erc20-types.js +1 -0
- package/dist/utils/erc20.d.ts +7 -89
- package/dist/utils/erc20.js +94 -125
- package/dist/utils/errors.d.ts +12 -1
- package/dist/utils/errors.js +60 -1
- package/dist/utils/holders-maker/addresses.d.ts +12 -0
- package/dist/utils/holders-maker/addresses.js +15 -0
- package/dist/utils/holders-maker/buy-tx.d.ts +44 -0
- package/dist/utils/holders-maker/buy-tx.js +278 -0
- package/dist/utils/holders-maker/constants.d.ts +6 -0
- package/dist/utils/holders-maker/constants.js +7 -0
- package/dist/utils/holders-maker/disperse.d.ts +18 -0
- package/dist/utils/holders-maker/disperse.js +90 -0
- package/dist/utils/holders-maker/helpers.d.ts +43 -0
- package/dist/utils/holders-maker/helpers.js +371 -0
- package/dist/utils/holders-maker/index.d.ts +26 -0
- package/dist/utils/holders-maker/index.js +218 -0
- package/dist/utils/holders-maker/routing.d.ts +4 -0
- package/dist/utils/holders-maker/routing.js +45 -0
- package/dist/utils/holders-maker/transfer-tx.d.ts +4 -0
- package/dist/utils/holders-maker/transfer-tx.js +67 -0
- package/dist/utils/holders-maker/types.d.ts +72 -0
- package/dist/utils/holders-maker/types.js +4 -0
- package/dist/utils/holders-maker-helpers.d.ts +9 -0
- package/dist/utils/holders-maker-helpers.js +9 -0
- package/dist/utils/holders-maker-types.d.ts +1 -0
- package/dist/utils/holders-maker-types.js +1 -0
- package/dist/utils/holders-maker.d.ts +2 -138
- package/dist/utils/holders-maker.js +26 -661
- package/dist/utils/hop-chains.d.ts +35 -0
- package/dist/utils/hop-chains.js +215 -0
- package/dist/utils/lp-inspect/index.d.ts +44 -0
- package/dist/utils/lp-inspect/index.js +937 -0
- package/dist/utils/lp-inspect/types.d.ts +100 -0
- package/dist/utils/lp-inspect/types.js +1 -0
- package/dist/utils/lp-inspect-helpers.d.ts +9 -0
- package/dist/utils/lp-inspect-helpers.js +109 -0
- package/dist/utils/lp-inspect-types.d.ts +1 -0
- package/dist/utils/lp-inspect-types.js +1 -0
- package/dist/utils/lp-inspect.d.ts +2 -112
- package/dist/utils/lp-inspect.js +73 -223
- package/dist/utils/mpcExclusive.d.ts +2 -5
- package/dist/utils/mpcExclusive.js +4 -3
- package/dist/utils/private-sale-types.d.ts +1 -0
- package/dist/utils/private-sale-types.js +1 -0
- package/dist/utils/private-sale.d.ts +2 -58
- package/dist/utils/private-sale.js +4 -15
- package/dist/utils/provider-factory.d.ts +4 -0
- package/dist/utils/provider-factory.js +10 -0
- package/dist/utils/quote-helpers/index.d.ts +107 -0
- package/dist/utils/quote-helpers/index.js +346 -0
- package/dist/utils/quote-helpers/types.d.ts +16 -0
- package/dist/utils/quote-helpers/types.js +1 -0
- package/dist/utils/quote-helpers-types.d.ts +1 -0
- package/dist/utils/quote-helpers-types.js +1 -0
- package/dist/utils/quote-helpers.d.ts +4 -45
- package/dist/utils/quote-helpers.js +17 -74
- package/dist/utils/stealth-transfer.d.ts +2 -28
- package/dist/utils/stealth-transfer.js +31 -15
- package/dist/utils/swap-helpers.d.ts +2 -15
- package/dist/utils/swap-helpers.js +5 -10
- package/dist/utils/types/airdrop-sweep.d.ts +1 -0
- package/dist/utils/types/airdrop-sweep.js +1 -0
- package/dist/utils/types/contract-factory.d.ts +1 -0
- package/dist/utils/types/contract-factory.js +1 -0
- package/dist/utils/types/erc20.d.ts +1 -0
- package/dist/utils/types/erc20.js +1 -0
- package/dist/utils/types/errors.d.ts +1 -0
- package/dist/utils/types/errors.js +1 -0
- package/dist/utils/types/holders-maker.d.ts +1 -0
- package/dist/utils/types/holders-maker.js +1 -0
- package/dist/utils/types/hop-chains.d.ts +8 -0
- package/dist/utils/types/hop-chains.js +1 -0
- package/dist/utils/types/index.d.ts +13 -0
- package/dist/utils/types/index.js +1 -0
- package/dist/utils/types/lp-inspect.d.ts +1 -0
- package/dist/utils/types/lp-inspect.js +1 -0
- package/dist/utils/types/mpc-exclusive.d.ts +5 -0
- package/dist/utils/types/mpc-exclusive.js +1 -0
- package/dist/utils/types/private-sale.d.ts +1 -0
- package/dist/utils/types/private-sale.js +1 -0
- package/dist/utils/types/quote-helpers.d.ts +1 -0
- package/dist/utils/types/quote-helpers.js +1 -0
- package/dist/utils/types/stealth-transfer.d.ts +44 -0
- package/dist/utils/types/stealth-transfer.js +1 -0
- package/dist/utils/types/wallet.d.ts +25 -0
- package/dist/utils/types/wallet.js +1 -0
- package/dist/utils/wallet.d.ts +2 -25
- package/dist/utils/wallet.js +9 -8
- package/package.json +68 -4
- package/src/abis/contracts/TaxToken.json +969 -0
- package/src/abis/contracts/TokenManager.json +836 -0
- package/src/abis/contracts/TokenManager2.json +136 -0
- package/src/abis/contracts/TokenManagerHelper3.json +993 -0
- package/dist/chains/eni/batch-router/bundle-launch.d.ts +0 -50
- package/dist/chains/eni/batch-router/bundle-launch.js +0 -72
- package/dist/clients/four.d.ts +0 -71
- package/dist/clients/four.js +0 -104
- package/dist/eip7702/xlayer/approve.d.ts +0 -141
- package/dist/eip7702/xlayer/approve.js +0 -168
- package/dist/eip7702/xlayer/broadcast.d.ts +0 -63
- package/dist/eip7702/xlayer/broadcast.js +0 -112
- package/dist/eip7702/xlayer/builders.d.ts +0 -34
- package/dist/eip7702/xlayer/builders.js +0 -100
- package/dist/eip7702/xlayer/bundle.d.ts +0 -70
- package/dist/eip7702/xlayer/bundle.js +0 -233
- package/dist/eip7702/xlayer/check.d.ts +0 -150
- package/dist/eip7702/xlayer/check.js +0 -346
- package/dist/eip7702/xlayer/constants.d.ts +0 -75
- package/dist/eip7702/xlayer/constants.js +0 -93
- package/dist/eip7702/xlayer/create-to-dex.d.ts +0 -103
- package/dist/eip7702/xlayer/create-to-dex.js +0 -369
- package/dist/eip7702/xlayer/curve-to-dex.d.ts +0 -87
- package/dist/eip7702/xlayer/curve-to-dex.js +0 -334
- package/dist/eip7702/xlayer/disperse.d.ts +0 -103
- package/dist/eip7702/xlayer/disperse.js +0 -325
- package/dist/eip7702/xlayer/index.d.ts +0 -64
- package/dist/eip7702/xlayer/index.js +0 -78
- package/dist/eip7702/xlayer/profit.d.ts +0 -105
- package/dist/eip7702/xlayer/profit.js +0 -136
- package/dist/eip7702/xlayer/sign.d.ts +0 -184
- package/dist/eip7702/xlayer/sign.js +0 -440
- package/dist/eip7702/xlayer/sweep.d.ts +0 -106
- package/dist/eip7702/xlayer/sweep.js +0 -375
- package/dist/eip7702/xlayer/trade.d.ts +0 -115
- package/dist/eip7702/xlayer/trade.js +0 -176
- package/dist/eip7702/xlayer/types.d.ts +0 -76
- package/dist/eip7702/xlayer/types.js +0 -4
- package/dist/flap/abi.d.ts +0 -1
- package/dist/xlayer/aa-account.d.ts +0 -354
- package/dist/xlayer/aa-account.js +0 -1107
- package/dist/xlayer/aa-transfer-profit.d.ts +0 -48
- package/dist/xlayer/aa-transfer-profit.js +0 -665
- package/dist/xlayer/account-fetcher.d.ts +0 -27
- package/dist/xlayer/account-fetcher.js +0 -27
- package/dist/xlayer/bundle-buy-first.d.ts +0 -112
- package/dist/xlayer/bundle-buy-first.js +0 -438
- package/dist/xlayer/bundle.d.ts +0 -232
- package/dist/xlayer/bundle.js +0 -2384
- package/dist/xlayer/bundler.d.ts +0 -123
- package/dist/xlayer/bundler.js +0 -260
- package/dist/xlayer/buy-first-volume.d.ts +0 -23
- package/dist/xlayer/buy-first-volume.js +0 -72
- package/dist/xlayer/constants.d.ts +0 -79
- package/dist/xlayer/constants.js +0 -166
- package/dist/xlayer/dex-aa-buy.d.ts +0 -63
- package/dist/xlayer/dex-aa-buy.js +0 -318
- package/dist/xlayer/dex-aa-sell.d.ts +0 -70
- package/dist/xlayer/dex-aa-sell.js +0 -475
- package/dist/xlayer/dex-bundle-swap.d.ts +0 -44
- package/dist/xlayer/dex-bundle-swap.js +0 -1160
- package/dist/xlayer/dex-bundle.d.ts +0 -42
- package/dist/xlayer/dex-bundle.js +0 -418
- package/dist/xlayer/dex-buy-first.d.ts +0 -20
- package/dist/xlayer/dex-buy-first.js +0 -359
- package/dist/xlayer/dex-helpers.d.ts +0 -20
- package/dist/xlayer/dex-helpers.js +0 -67
- package/dist/xlayer/dex-volume.d.ts +0 -30
- package/dist/xlayer/dex-volume.js +0 -80
- package/dist/xlayer/dex.d.ts +0 -254
- package/dist/xlayer/dex.js +0 -658
- package/dist/xlayer/eoa-bundle-swap.js +0 -757
- package/dist/xlayer/examples/bundle-buy-sell.d.ts +0 -11
- package/dist/xlayer/examples/bundle-buy-sell.js +0 -191
- package/dist/xlayer/hop-wallet-manager.d.ts +0 -164
- package/dist/xlayer/hop-wallet-manager.js +0 -780
- package/dist/xlayer/index.d.ts +0 -119
- package/dist/xlayer/index.js +0 -240
- package/dist/xlayer/paymaster.d.ts +0 -207
- package/dist/xlayer/paymaster.js +0 -326
- package/dist/xlayer/portal-bundle-swap.d.ts +0 -27
- package/dist/xlayer/portal-bundle-swap.js +0 -882
- package/dist/xlayer/portal-buy-first.d.ts +0 -30
- package/dist/xlayer/portal-buy-first.js +0 -420
- package/dist/xlayer/portal-ops.d.ts +0 -269
- package/dist/xlayer/portal-ops.js +0 -479
- package/dist/xlayer/router-manager.d.ts +0 -38
- package/dist/xlayer/router-manager.js +0 -69
- package/dist/xlayer/types.d.ts +0 -963
- package/dist/xlayer/userOp-builder.d.ts +0 -51
- package/dist/xlayer/userOp-builder.js +0 -97
- package/dist/xlayer/volume-buy-first.d.ts +0 -102
- package/dist/xlayer/volume-buy-first.js +0 -258
- package/dist/xlayer/volume.d.ts +0 -65
- package/dist/xlayer/volume.js +0 -235
- package/dist/xlayer/wash-ops.d.ts +0 -61
- package/dist/xlayer/wash-ops.js +0 -565
- /package/dist/abis/{TokenManager.json → contracts/TokenManager.json} +0 -0
- /package/dist/abis/{TokenManagerHelper3.json → contracts/TokenManagerHelper3.json} +0 -0
- /package/dist/{flap/portal-bundle-merkle/types.js → bundle-core/__tests__/config-helpers.test.d.ts} +0 -0
- /package/dist/{abis → shared/abis 2}/TokenManager2.json +0 -0
- /package/dist/{clients → shared/clients 2}/club48.d.ts +0 -0
- /package/dist/{clients → shared/clients 2}/club48.js +0 -0
- /package/dist/{clients → shared/clients 2}/merkle.d.ts +0 -0
- /package/dist/{flap → shared/flap 2}/curve.d.ts +0 -0
- /package/dist/{flap → shared/flap 2}/curve.js +0 -0
- /package/dist/{flap → shared/flap 2}/errors.d.ts +0 -0
- /package/dist/{flap → shared/flap 2}/errors.js +0 -0
- /package/dist/{flap → shared/flap 2}/ipfs.d.ts +0 -0
- /package/dist/{flap → shared/flap 2}/ipfs.js +0 -0
- /package/dist/{flap → shared/flap 2}/meta.d.ts +0 -0
- /package/dist/{flap → shared/flap 2}/permit.d.ts +0 -0
- /package/dist/{flap → shared/flap 2}/pinata.d.ts +0 -0
- /package/dist/{flap → shared/flap 2}/pinata.js +0 -0
- /package/dist/{flap → shared/flap 2}/portal-bundle-merkle/core.d.ts +0 -0
- /package/dist/{flap → shared/flap 2}/portal-bundle-merkle/index.d.ts +0 -0
- /package/dist/{flap → shared/flap 2}/portal-bundle-merkle/pancake-proxy.d.ts +0 -0
- /package/dist/{flap → shared/flap 2}/portal-bundle-merkle/private.d.ts +0 -0
- /package/dist/{flap → shared/flap 2}/portal-bundle.d.ts +0 -0
|
@@ -1,479 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* XLayer Portal 操作核心
|
|
3
|
-
*
|
|
4
|
-
* Flap Portal 内盘交易的核心逻辑:
|
|
5
|
-
* - 买入(swapExactInput: native -> token)
|
|
6
|
-
* - 卖出(swapExactInput: token -> native)
|
|
7
|
-
* - 授权(approve)
|
|
8
|
-
* - 代币转账
|
|
9
|
-
*/
|
|
10
|
-
import { ethers, Interface, Contract, JsonRpcProvider } from 'ethers';
|
|
11
|
-
import { FLAP_PORTAL, ZERO_ADDRESS, PORTAL_ABI, ERC20_ABI, MULTICALL3, DEFAULT_RPC_URL, XLAYER_CHAIN_ID, } from './constants.js';
|
|
12
|
-
import { mapWithConcurrency } from '../utils/concurrency.js';
|
|
13
|
-
// ============================================================================
|
|
14
|
-
// Portal 操作编码器
|
|
15
|
-
// ============================================================================
|
|
16
|
-
const portalIface = new Interface(PORTAL_ABI);
|
|
17
|
-
const erc20Iface = new Interface(ERC20_ABI);
|
|
18
|
-
/**
|
|
19
|
-
* 编码买入调用(swapExactInput: native -> token)
|
|
20
|
-
*
|
|
21
|
-
* @param tokenAddress 目标代币地址
|
|
22
|
-
* @param inputAmount 输入 OKB 数量(wei)
|
|
23
|
-
* @param minOutputAmount 最小输出代币数量(默认 0)
|
|
24
|
-
*/
|
|
25
|
-
export function encodeBuyCall(tokenAddress, inputAmount, minOutputAmount = 0n) {
|
|
26
|
-
return portalIface.encodeFunctionData('swapExactInput', [
|
|
27
|
-
{
|
|
28
|
-
inputToken: ZERO_ADDRESS,
|
|
29
|
-
outputToken: tokenAddress,
|
|
30
|
-
inputAmount,
|
|
31
|
-
minOutputAmount,
|
|
32
|
-
permitData: '0x',
|
|
33
|
-
},
|
|
34
|
-
]);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* 编码买入调用 V3(swapExactInputV3: native -> token,支持 extensionData)
|
|
38
|
-
*
|
|
39
|
-
* 与 BSC 版本的 create-to-dex.ts 保持一致:
|
|
40
|
-
* - 统一优先使用 swapExactInputV3(支持 extensionData;无扩展时传 0x 即可)
|
|
41
|
-
* - 这里的 V3 指"交易接口版本(扩展支持)",不是"外盘 V3 池子"
|
|
42
|
-
*
|
|
43
|
-
* @param tokenAddress 目标代币地址
|
|
44
|
-
* @param inputAmount 输入 OKB 数量(wei)
|
|
45
|
-
* @param minOutputAmount 最小输出代币数量(默认 0)
|
|
46
|
-
* @param extensionData 扩展数据(默认 0x)
|
|
47
|
-
*/
|
|
48
|
-
export function encodeBuyCallV3(tokenAddress, inputAmount, minOutputAmount = 0n, extensionData = '0x') {
|
|
49
|
-
return portalIface.encodeFunctionData('swapExactInputV3', [
|
|
50
|
-
{
|
|
51
|
-
inputToken: ZERO_ADDRESS,
|
|
52
|
-
outputToken: tokenAddress,
|
|
53
|
-
inputAmount,
|
|
54
|
-
minOutputAmount,
|
|
55
|
-
permitData: '0x',
|
|
56
|
-
extensionData,
|
|
57
|
-
},
|
|
58
|
-
]);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* 编码卖出调用(swapExactInput: token -> native)
|
|
62
|
-
*
|
|
63
|
-
* @param tokenAddress 目标代币地址
|
|
64
|
-
* @param inputAmount 输入代币数量
|
|
65
|
-
* @param minOutputAmount 最小输出 OKB 数量(默认 0)
|
|
66
|
-
*/
|
|
67
|
-
export function encodeSellCall(tokenAddress, inputAmount, minOutputAmount = 0n) {
|
|
68
|
-
return portalIface.encodeFunctionData('swapExactInput', [
|
|
69
|
-
{
|
|
70
|
-
inputToken: tokenAddress,
|
|
71
|
-
outputToken: ZERO_ADDRESS,
|
|
72
|
-
inputAmount,
|
|
73
|
-
minOutputAmount,
|
|
74
|
-
permitData: '0x',
|
|
75
|
-
},
|
|
76
|
-
]);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* ✅ 编码卖出调用(支持 ERC20 输出):swapExactInput: token -> quoteToken
|
|
80
|
-
*
|
|
81
|
-
* @param tokenAddress 输入代币地址
|
|
82
|
-
* @param quoteToken 输出代币地址(如 USDT/USDC)
|
|
83
|
-
* @param inputAmount 输入代币数量
|
|
84
|
-
* @param minOutputAmount 最小输出数量(默认 0)
|
|
85
|
-
*/
|
|
86
|
-
export function encodeSellCallWithQuote(tokenAddress, quoteToken, inputAmount, minOutputAmount = 0n) {
|
|
87
|
-
return portalIface.encodeFunctionData('swapExactInput', [
|
|
88
|
-
{
|
|
89
|
-
inputToken: tokenAddress,
|
|
90
|
-
outputToken: quoteToken,
|
|
91
|
-
inputAmount,
|
|
92
|
-
minOutputAmount,
|
|
93
|
-
permitData: '0x',
|
|
94
|
-
},
|
|
95
|
-
]);
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* ✅ 编码买入调用(支持 ERC20 输入):swapExactInput: quoteToken -> token
|
|
99
|
-
*
|
|
100
|
-
* @param tokenAddress 输出代币地址
|
|
101
|
-
* @param quoteToken 输入代币地址(如 USDT/USDC)
|
|
102
|
-
* @param inputAmount 输入数量
|
|
103
|
-
* @param minOutputAmount 最小输出代币数量(默认 0)
|
|
104
|
-
*/
|
|
105
|
-
export function encodeBuyCallWithQuote(tokenAddress, quoteToken, inputAmount, minOutputAmount = 0n) {
|
|
106
|
-
return portalIface.encodeFunctionData('swapExactInput', [
|
|
107
|
-
{
|
|
108
|
-
inputToken: quoteToken,
|
|
109
|
-
outputToken: tokenAddress,
|
|
110
|
-
inputAmount,
|
|
111
|
-
minOutputAmount,
|
|
112
|
-
permitData: '0x',
|
|
113
|
-
},
|
|
114
|
-
]);
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* 编码授权调用
|
|
118
|
-
*
|
|
119
|
-
* @param spender 授权对象地址
|
|
120
|
-
* @param amount 授权数量(默认无限)
|
|
121
|
-
*/
|
|
122
|
-
export function encodeApproveCall(spender, amount = ethers.MaxUint256) {
|
|
123
|
-
return erc20Iface.encodeFunctionData('approve', [spender, amount]);
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* 编码代币转账调用
|
|
127
|
-
*
|
|
128
|
-
* @param to 接收地址
|
|
129
|
-
* @param amount 转账数量
|
|
130
|
-
*/
|
|
131
|
-
export function encodeTransferCall(to, amount) {
|
|
132
|
-
return erc20Iface.encodeFunctionData('transfer', [to, amount]);
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* 编码创建代币调用 V2
|
|
136
|
-
*/
|
|
137
|
-
export function encodeCreateCallV2(params) {
|
|
138
|
-
return portalIface.encodeFunctionData('newTokenV2', [params]);
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* 编码创建代币调用 V3
|
|
142
|
-
*/
|
|
143
|
-
export function encodeCreateCallV3(params) {
|
|
144
|
-
return portalIface.encodeFunctionData('newTokenV3', [params]);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* 编码创建代币调用 V4
|
|
148
|
-
*/
|
|
149
|
-
export function encodeCreateCallV4(params) {
|
|
150
|
-
return portalIface.encodeFunctionData('newTokenV4', [params]);
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Portal 查询器
|
|
154
|
-
*
|
|
155
|
-
* 提供只读查询方法:
|
|
156
|
-
* - 代币余额
|
|
157
|
-
* - 授权额度
|
|
158
|
-
* - 预览买入/卖出
|
|
159
|
-
* - 代币状态
|
|
160
|
-
*/
|
|
161
|
-
export class PortalQuery {
|
|
162
|
-
constructor(config = {}) {
|
|
163
|
-
const rpcUrl = config.rpcUrl ?? DEFAULT_RPC_URL;
|
|
164
|
-
const chainId = config.chainId ?? XLAYER_CHAIN_ID;
|
|
165
|
-
// ✅ 禁用 ENS: XLayer 不支持 ENS,显式设置 ensAddress: undefined 避免解析错误
|
|
166
|
-
this.provider = new JsonRpcProvider(rpcUrl, { chainId, name: 'xlayer', ensAddress: undefined }, {
|
|
167
|
-
batchMaxCount: 20,
|
|
168
|
-
batchStallTime: 30,
|
|
169
|
-
});
|
|
170
|
-
this.portalAddress = config.portalAddress ?? FLAP_PORTAL;
|
|
171
|
-
this.portal = new Contract(this.portalAddress, PORTAL_ABI, this.provider);
|
|
172
|
-
}
|
|
173
|
-
async multicallAggregate3(params) {
|
|
174
|
-
const mcIface = new Interface([
|
|
175
|
-
'function aggregate3((address target,bool allowFailure,bytes callData)[] calls) view returns ((bool success,bytes returnData)[] returnData)',
|
|
176
|
-
]);
|
|
177
|
-
const data = mcIface.encodeFunctionData('aggregate3', [params.calls]);
|
|
178
|
-
const raw = await this.provider.call({ to: MULTICALL3, data });
|
|
179
|
-
const decoded = mcIface.decodeFunctionResult('aggregate3', raw)?.[0];
|
|
180
|
-
return decoded || [];
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* 获取 Provider
|
|
184
|
-
*/
|
|
185
|
-
getProvider() {
|
|
186
|
-
return this.provider;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* 获取 Portal 地址
|
|
190
|
-
*/
|
|
191
|
-
getPortalAddress() {
|
|
192
|
-
return this.portalAddress;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* 获取代币余额
|
|
196
|
-
*/
|
|
197
|
-
async getTokenBalance(tokenAddress, account) {
|
|
198
|
-
const token = new Contract(tokenAddress, ERC20_ABI, this.provider);
|
|
199
|
-
return await token.balanceOf(account);
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* 获取 OKB 余额
|
|
203
|
-
*/
|
|
204
|
-
async getOkbBalance(account) {
|
|
205
|
-
return await this.provider.getBalance(account);
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* 获取授权额度
|
|
209
|
-
*/
|
|
210
|
-
async getAllowance(tokenAddress, owner, spender) {
|
|
211
|
-
const token = new Contract(tokenAddress, ERC20_ABI, this.provider);
|
|
212
|
-
return await token.allowance(owner, spender ?? this.portalAddress);
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* 检查是否需要授权
|
|
216
|
-
*/
|
|
217
|
-
async needsApproval(tokenAddress, owner, amount, spender) {
|
|
218
|
-
const allowance = await this.getAllowance(tokenAddress, owner, spender);
|
|
219
|
-
return allowance < amount;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* 预览买入输出
|
|
223
|
-
*/
|
|
224
|
-
async previewBuy(tokenAddress, okbAmount) {
|
|
225
|
-
return await this.portal.previewBuy(tokenAddress, okbAmount);
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* 预览卖出输出
|
|
229
|
-
*/
|
|
230
|
-
async previewSell(tokenAddress, tokenAmount) {
|
|
231
|
-
return await this.portal.previewSell(tokenAddress, tokenAmount);
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* 使用 quoteExactInput 查询报价
|
|
235
|
-
*/
|
|
236
|
-
async quoteExactInput(inputToken, outputToken, inputAmount) {
|
|
237
|
-
return await this.portal.quoteExactInput.staticCall({
|
|
238
|
-
inputToken,
|
|
239
|
-
outputToken,
|
|
240
|
-
inputAmount,
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* 获取代币状态 V5
|
|
245
|
-
*/
|
|
246
|
-
async getTokenV5(tokenAddress) {
|
|
247
|
-
const raw = await this.portal.getTokenV5(tokenAddress);
|
|
248
|
-
return {
|
|
249
|
-
status: raw[0],
|
|
250
|
-
reserve: raw[1],
|
|
251
|
-
circulatingSupply: raw[2],
|
|
252
|
-
price: raw[3],
|
|
253
|
-
tokenVersion: raw[4],
|
|
254
|
-
r: raw[5],
|
|
255
|
-
h: raw[6],
|
|
256
|
-
k: raw[7],
|
|
257
|
-
dexSupplyThresh: raw[8],
|
|
258
|
-
quoteTokenAddress: raw[9],
|
|
259
|
-
nativeToQuoteSwapEnabled: raw[10],
|
|
260
|
-
extensionID: raw[11],
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* 获取代币状态 V7 (包含 lpFeeProfile)
|
|
265
|
-
*
|
|
266
|
-
* ✅ 修复:与 BSC portal.ts 对齐,使用 16 字段结构
|
|
267
|
-
*/
|
|
268
|
-
async getTokenV7(tokenAddress) {
|
|
269
|
-
const raw = await this.portal.getTokenV7(tokenAddress);
|
|
270
|
-
return {
|
|
271
|
-
status: Number(raw[0]),
|
|
272
|
-
reserve: raw[1],
|
|
273
|
-
circulatingSupply: raw[2],
|
|
274
|
-
price: raw[3],
|
|
275
|
-
tokenVersion: Number(raw[4]),
|
|
276
|
-
r: raw[5],
|
|
277
|
-
h: raw[6],
|
|
278
|
-
k: raw[7],
|
|
279
|
-
dexSupplyThresh: raw[8],
|
|
280
|
-
quoteTokenAddress: raw[9],
|
|
281
|
-
nativeToQuoteSwapEnabled: raw[10],
|
|
282
|
-
extensionID: raw[11],
|
|
283
|
-
taxRate: Number(raw[12]),
|
|
284
|
-
pool: raw[13],
|
|
285
|
-
progress: raw[14],
|
|
286
|
-
lpFeeProfile: Number(raw[15]),
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* 批量获取多个账户的代币余额
|
|
291
|
-
*/
|
|
292
|
-
async getMultipleTokenBalances(tokenAddress, accounts) {
|
|
293
|
-
const balances = new Map();
|
|
294
|
-
const list = accounts.map((a) => String(a || '').trim()).filter(Boolean);
|
|
295
|
-
if (list.length === 0)
|
|
296
|
-
return balances;
|
|
297
|
-
const calls = list.map((acc) => ({
|
|
298
|
-
target: tokenAddress,
|
|
299
|
-
allowFailure: true,
|
|
300
|
-
callData: erc20Iface.encodeFunctionData('balanceOf', [acc]),
|
|
301
|
-
}));
|
|
302
|
-
const BATCH = 350;
|
|
303
|
-
try {
|
|
304
|
-
for (let cursor = 0; cursor < calls.length; cursor += BATCH) {
|
|
305
|
-
const sliceCalls = calls.slice(cursor, cursor + BATCH);
|
|
306
|
-
const res = await this.multicallAggregate3({ calls: sliceCalls });
|
|
307
|
-
for (let i = 0; i < res.length; i++) {
|
|
308
|
-
const r = res[i];
|
|
309
|
-
const idx = cursor + i;
|
|
310
|
-
const acc = list[idx];
|
|
311
|
-
if (!r?.success || !r.returnData || r.returnData === '0x') {
|
|
312
|
-
balances.set(acc, 0n);
|
|
313
|
-
continue;
|
|
314
|
-
}
|
|
315
|
-
try {
|
|
316
|
-
const decoded = erc20Iface.decodeFunctionResult('balanceOf', r.returnData);
|
|
317
|
-
balances.set(acc, BigInt(decoded?.[0] ?? 0n));
|
|
318
|
-
}
|
|
319
|
-
catch {
|
|
320
|
-
balances.set(acc, 0n);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
return balances;
|
|
325
|
-
}
|
|
326
|
-
catch {
|
|
327
|
-
const results = await mapWithConcurrency(list, 8, async (acc) => this.getTokenBalance(tokenAddress, acc));
|
|
328
|
-
list.forEach((acc, i) => balances.set(acc, results[i] ?? 0n));
|
|
329
|
-
}
|
|
330
|
-
return balances;
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* 批量获取多个账户的 OKB 余额
|
|
334
|
-
*/
|
|
335
|
-
async getMultipleOkbBalances(accounts) {
|
|
336
|
-
const balances = new Map();
|
|
337
|
-
const list = accounts.map((a) => String(a || '').trim()).filter(Boolean);
|
|
338
|
-
if (list.length === 0)
|
|
339
|
-
return balances;
|
|
340
|
-
const ethBalIface = new Interface(['function getEthBalance(address addr) view returns (uint256)']);
|
|
341
|
-
const calls = list.map((acc) => ({
|
|
342
|
-
target: MULTICALL3,
|
|
343
|
-
allowFailure: true,
|
|
344
|
-
callData: ethBalIface.encodeFunctionData('getEthBalance', [acc]),
|
|
345
|
-
}));
|
|
346
|
-
const BATCH = 350;
|
|
347
|
-
try {
|
|
348
|
-
for (let cursor = 0; cursor < calls.length; cursor += BATCH) {
|
|
349
|
-
const sliceCalls = calls.slice(cursor, cursor + BATCH);
|
|
350
|
-
const res = await this.multicallAggregate3({ calls: sliceCalls });
|
|
351
|
-
for (let i = 0; i < res.length; i++) {
|
|
352
|
-
const r = res[i];
|
|
353
|
-
const idx = cursor + i;
|
|
354
|
-
const acc = list[idx];
|
|
355
|
-
if (!r?.success || !r.returnData || r.returnData === '0x') {
|
|
356
|
-
balances.set(acc, 0n);
|
|
357
|
-
continue;
|
|
358
|
-
}
|
|
359
|
-
try {
|
|
360
|
-
const decoded = ethBalIface.decodeFunctionResult('getEthBalance', r.returnData);
|
|
361
|
-
balances.set(acc, BigInt(decoded?.[0] ?? 0n));
|
|
362
|
-
}
|
|
363
|
-
catch {
|
|
364
|
-
balances.set(acc, 0n);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
return balances;
|
|
369
|
-
}
|
|
370
|
-
catch {
|
|
371
|
-
const results = await mapWithConcurrency(list, 8, async (acc) => this.getOkbBalance(acc));
|
|
372
|
-
list.forEach((acc, i) => balances.set(acc, results[i] ?? 0n));
|
|
373
|
-
}
|
|
374
|
-
return balances;
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* 批量获取授权额度
|
|
378
|
-
*/
|
|
379
|
-
async getMultipleAllowances(tokenAddress, owners, spender) {
|
|
380
|
-
const allowances = new Map();
|
|
381
|
-
const list = owners.map((a) => String(a || '').trim()).filter(Boolean);
|
|
382
|
-
if (list.length === 0)
|
|
383
|
-
return allowances;
|
|
384
|
-
const useSpender = spender ?? this.portalAddress;
|
|
385
|
-
const calls = list.map((owner) => ({
|
|
386
|
-
target: tokenAddress,
|
|
387
|
-
allowFailure: true,
|
|
388
|
-
callData: erc20Iface.encodeFunctionData('allowance', [owner, useSpender]),
|
|
389
|
-
}));
|
|
390
|
-
const BATCH = 350;
|
|
391
|
-
try {
|
|
392
|
-
for (let cursor = 0; cursor < calls.length; cursor += BATCH) {
|
|
393
|
-
const sliceCalls = calls.slice(cursor, cursor + BATCH);
|
|
394
|
-
const res = await this.multicallAggregate3({ calls: sliceCalls });
|
|
395
|
-
for (let i = 0; i < res.length; i++) {
|
|
396
|
-
const r = res[i];
|
|
397
|
-
const idx = cursor + i;
|
|
398
|
-
const owner = list[idx];
|
|
399
|
-
if (!r?.success || !r.returnData || r.returnData === '0x') {
|
|
400
|
-
allowances.set(owner, 0n);
|
|
401
|
-
continue;
|
|
402
|
-
}
|
|
403
|
-
try {
|
|
404
|
-
const decoded = erc20Iface.decodeFunctionResult('allowance', r.returnData);
|
|
405
|
-
allowances.set(owner, BigInt(decoded?.[0] ?? 0n));
|
|
406
|
-
}
|
|
407
|
-
catch {
|
|
408
|
-
allowances.set(owner, 0n);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
return allowances;
|
|
413
|
-
}
|
|
414
|
-
catch {
|
|
415
|
-
const results = await mapWithConcurrency(list, 8, async (owner) => this.getAllowance(tokenAddress, owner, useSpender));
|
|
416
|
-
list.forEach((owner, i) => allowances.set(owner, results[i] ?? 0n));
|
|
417
|
-
}
|
|
418
|
-
return allowances;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
// ============================================================================
|
|
422
|
-
// 辅助函数
|
|
423
|
-
// ============================================================================
|
|
424
|
-
/**
|
|
425
|
-
* 计算带滑点的最小输出
|
|
426
|
-
*
|
|
427
|
-
* @param expectedOutput 预期输出
|
|
428
|
-
* @param slippageBps 滑点基点(如 100 = 1%)
|
|
429
|
-
*/
|
|
430
|
-
export function applySlippage(expectedOutput, slippageBps) {
|
|
431
|
-
const keep = BigInt(10000 - Math.max(0, Math.min(5000, slippageBps)));
|
|
432
|
-
return (expectedOutput * keep) / 10000n;
|
|
433
|
-
}
|
|
434
|
-
/**
|
|
435
|
-
* 将 Portal 的 lpFeeProfile 转换为 V3 Router 所需的 fee (100万分比)
|
|
436
|
-
*
|
|
437
|
-
* STANDARD = 0.25% (2500)
|
|
438
|
-
* LOW = 0.01% (100)
|
|
439
|
-
* HIGH = 1% (10000)
|
|
440
|
-
*/
|
|
441
|
-
export function lpFeeProfileToV3Fee(profile) {
|
|
442
|
-
switch (profile) {
|
|
443
|
-
case 1: return 100; // 0.01%
|
|
444
|
-
case 2: return 10000; // 1%
|
|
445
|
-
case 0:
|
|
446
|
-
default:
|
|
447
|
-
return 2500; // 0.25%
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* 创建 Portal 查询器
|
|
452
|
-
*/
|
|
453
|
-
export function createPortalQuery(config) {
|
|
454
|
-
return new PortalQuery(config);
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* 格式化 OKB 金额(wei -> OKB 字符串)
|
|
458
|
-
*/
|
|
459
|
-
export function formatOkb(wei) {
|
|
460
|
-
return ethers.formatEther(wei);
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* 解析 OKB 金额(OKB 字符串 -> wei)
|
|
464
|
-
*/
|
|
465
|
-
export function parseOkb(okb) {
|
|
466
|
-
return ethers.parseEther(okb);
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* 格式化代币金额(考虑精度)
|
|
470
|
-
*/
|
|
471
|
-
export function formatTokenAmount(amount, decimals = 18) {
|
|
472
|
-
return ethers.formatUnits(amount, decimals);
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* 解析代币金额(考虑精度)
|
|
476
|
-
*/
|
|
477
|
-
export function parseTokenAmount(amount, decimals = 18) {
|
|
478
|
-
return ethers.parseUnits(amount, decimals);
|
|
479
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* XLayer Router 管理器
|
|
3
|
-
* 统一管理 V2/V3 Router 地址和授权目标选择逻辑
|
|
4
|
-
*/
|
|
5
|
-
import type { RouterVersion, ApprovalTarget } from './types.js';
|
|
6
|
-
/**
|
|
7
|
-
* ✅ 获取 Router 地址
|
|
8
|
-
* @param params.routerVersion - Router 版本(V2 或 V3)
|
|
9
|
-
* @param params.dexKey - DEX 标识(如 DYORSWAP)
|
|
10
|
-
* @param params.routerAddress - 显式指定的 Router 地址(优先级最高)
|
|
11
|
-
* @returns Router 地址
|
|
12
|
-
*/
|
|
13
|
-
export declare function getRouterAddress(params: {
|
|
14
|
-
routerVersion?: RouterVersion;
|
|
15
|
-
dexKey?: string;
|
|
16
|
-
routerAddress?: string;
|
|
17
|
-
}): string;
|
|
18
|
-
/**
|
|
19
|
-
* ✅ 获取授权目标地址
|
|
20
|
-
* @param target - 授权目标类型
|
|
21
|
-
* @returns 目标合约地址
|
|
22
|
-
*/
|
|
23
|
-
export declare function getApprovalTargetAddress(target: ApprovalTarget): string;
|
|
24
|
-
/**
|
|
25
|
-
* ✅ 获取所有授权目标地址
|
|
26
|
-
* @param targets - 授权目标类型数组
|
|
27
|
-
* @returns 目标信息数组
|
|
28
|
-
*/
|
|
29
|
-
export declare function getAllApprovalTargets(targets: ApprovalTarget[]): Array<{
|
|
30
|
-
target: ApprovalTarget;
|
|
31
|
-
address: string;
|
|
32
|
-
}>;
|
|
33
|
-
/**
|
|
34
|
-
* ✅ 根据交易类型推断授权目标
|
|
35
|
-
* @param tradeType - 交易类型(FLAP/V2/V3)
|
|
36
|
-
* @returns 授权目标类型
|
|
37
|
-
*/
|
|
38
|
-
export declare function inferApprovalTarget(tradeType: string): ApprovalTarget;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* XLayer Router 管理器
|
|
3
|
-
* 统一管理 V2/V3 Router 地址和授权目标选择逻辑
|
|
4
|
-
*/
|
|
5
|
-
import { POTATOSWAP_V2_ROUTER, POTATOSWAP_V3_ROUTER, FLAP_PORTAL, } from './constants.js';
|
|
6
|
-
/**
|
|
7
|
-
* ✅ 获取 Router 地址
|
|
8
|
-
* @param params.routerVersion - Router 版本(V2 或 V3)
|
|
9
|
-
* @param params.dexKey - DEX 标识(如 DYORSWAP)
|
|
10
|
-
* @param params.routerAddress - 显式指定的 Router 地址(优先级最高)
|
|
11
|
-
* @returns Router 地址
|
|
12
|
-
*/
|
|
13
|
-
export function getRouterAddress(params) {
|
|
14
|
-
// 1. 优先使用显式指定的地址
|
|
15
|
-
if (params.routerAddress)
|
|
16
|
-
return params.routerAddress;
|
|
17
|
-
// 2. 根据 dexKey 选择
|
|
18
|
-
if (params.dexKey === 'DYORSWAP') {
|
|
19
|
-
return '0xfb001fbbace32f09cb6d3c449b935183de53ee96';
|
|
20
|
-
}
|
|
21
|
-
// 3. 根据 routerVersion 选择
|
|
22
|
-
const version = params.routerVersion ?? 'V2';
|
|
23
|
-
if (version === 'V3') {
|
|
24
|
-
return POTATOSWAP_V3_ROUTER;
|
|
25
|
-
}
|
|
26
|
-
// 4. 默认 V2
|
|
27
|
-
return POTATOSWAP_V2_ROUTER;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* ✅ 获取授权目标地址
|
|
31
|
-
* @param target - 授权目标类型
|
|
32
|
-
* @returns 目标合约地址
|
|
33
|
-
*/
|
|
34
|
-
export function getApprovalTargetAddress(target) {
|
|
35
|
-
switch (target) {
|
|
36
|
-
case 'FLAP_PORTAL':
|
|
37
|
-
return FLAP_PORTAL;
|
|
38
|
-
case 'V2_ROUTER':
|
|
39
|
-
return POTATOSWAP_V2_ROUTER;
|
|
40
|
-
case 'V3_ROUTER':
|
|
41
|
-
return POTATOSWAP_V3_ROUTER;
|
|
42
|
-
default:
|
|
43
|
-
throw new Error(`Unknown approval target: ${target}`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* ✅ 获取所有授权目标地址
|
|
48
|
-
* @param targets - 授权目标类型数组
|
|
49
|
-
* @returns 目标信息数组
|
|
50
|
-
*/
|
|
51
|
-
export function getAllApprovalTargets(targets) {
|
|
52
|
-
return targets.map(target => ({
|
|
53
|
-
target,
|
|
54
|
-
address: getApprovalTargetAddress(target)
|
|
55
|
-
}));
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* ✅ 根据交易类型推断授权目标
|
|
59
|
-
* @param tradeType - 交易类型(FLAP/V2/V3)
|
|
60
|
-
* @returns 授权目标类型
|
|
61
|
-
*/
|
|
62
|
-
export function inferApprovalTarget(tradeType) {
|
|
63
|
-
const type = String(tradeType || '').toUpperCase();
|
|
64
|
-
if (type === 'V2')
|
|
65
|
-
return 'V2_ROUTER';
|
|
66
|
-
if (type === 'V3')
|
|
67
|
-
return 'V3_ROUTER';
|
|
68
|
-
return 'FLAP_PORTAL'; // 默认内盘
|
|
69
|
-
}
|