four-flap-meme-sdk 2.2.8 → 2.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +6 -41
- package/README.md +0 -31
- package/README.zh-CN.md +6 -41
- package/dist/chains/bsc/four/approve-tokenmanager.d.ts +26 -1
- package/dist/chains/bsc/four/approve-tokenmanager.js +113 -1
- package/dist/chains/bsc/four/config.d.ts +67 -5
- package/dist/chains/bsc/four/config.js +114 -2
- package/dist/chains/bsc/four/core.d.ts +4 -1
- package/dist/chains/bsc/four/core.js +592 -1
- package/dist/chains/bsc/four/index.d.ts +6 -6
- package/dist/chains/bsc/four/index.js +6 -6
- package/dist/chains/bsc/four/internal.d.ts +46 -2
- package/dist/chains/bsc/four/internal.js +239 -2
- package/dist/chains/bsc/four/pancake-proxy.d.ts +28 -1
- package/dist/chains/bsc/four/pancake-proxy.js +687 -1
- package/dist/chains/bsc/four/private.d.ts +27 -1
- package/dist/chains/bsc/four/private.js +477 -1
- package/dist/chains/bsc/four/submit.d.ts +315 -2
- package/dist/chains/bsc/four/submit.js +752 -2
- package/dist/chains/bsc/four/swap-buy-first.d.ts +55 -2
- package/dist/chains/bsc/four/swap-buy-first.js +507 -2
- package/dist/chains/bsc/four/swap-internal.d.ts +3 -1
- package/dist/chains/bsc/four/swap-internal.js +18 -1
- package/dist/chains/bsc/four/swap.d.ts +144 -2
- package/dist/chains/bsc/four/swap.js +766 -2
- package/dist/chains/bsc/four/types.d.ts +476 -1
- package/dist/chains/bsc/four/utils.d.ts +18 -5
- package/dist/chains/bsc/four/utils.js +1552 -5
- package/dist/chains/bsc/pancake/bundle-buy-first.d.ts +91 -1
- package/dist/chains/bsc/pancake/bundle-buy-first.js +212 -97
- package/dist/chains/bsc/pancake/bundle-swap.d.ts +79 -1
- package/dist/chains/bsc/pancake/bundle-swap.js +726 -114
- package/dist/chains/bsc/pancake/index.d.ts +2 -4
- package/dist/chains/bsc/pancake/index.js +3 -1
- package/dist/chains/bsc/platforms/iro/factory.d.ts +2 -2
- package/dist/chains/bsc/platforms/iro/factory.js +1 -3
- package/dist/chains/bsc/platforms/iro/index.d.ts +5 -5
- package/dist/chains/bsc/platforms/iro/index.js +3 -3
- package/dist/chains/bsc/platforms/iro/pool.js +10 -31
- package/dist/chains/bsc/platforms/iro/token.js +1 -4
- package/dist/chains/eni/batch-router/bundle-approve.js +3 -4
- package/dist/chains/eni/batch-router/transfer.js +25 -55
- package/dist/chains/eni/batch-router/utils.js +6 -32
- package/dist/chains/eni/bundler/sign.js +6 -5
- package/dist/chains/eni/bundler/submit.js +4 -1
- package/dist/chains/eni/constants.js +1 -1
- package/dist/chains/eni/index.d.ts +1 -2
- package/dist/chains/eni/index.js +0 -1
- package/dist/chains/eni/platforms/daoaas/create.js +2 -2
- package/dist/chains/eni/platforms/daoaas/index.d.ts +3 -3
- package/dist/chains/eni/platforms/daoaas/index.js +3 -3
- package/dist/chains/eni/platforms/daoaas/meta.js +6 -9
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +44 -28
- package/dist/chains/eni/platforms/daoaas/portal.js +6 -10
- package/dist/chains/eni/platforms/dswap/liquidity.js +26 -58
- package/dist/chains/eni/platforms/fair-launch/index.d.ts +2 -2
- package/dist/chains/eni/platforms/fair-launch/index.js +1 -1
- package/dist/chains/eni/platforms/fair-launch/launcher.js +46 -87
- package/dist/chains/eni/platforms/fair-launch/pool.js +1 -4
- package/dist/chains/eni/platforms/fair-launch/presets.js +2 -2
- package/dist/chains/eni/platforms/iro/factory.d.ts +2 -2
- package/dist/chains/eni/platforms/iro/factory.js +1 -3
- package/dist/chains/eni/platforms/iro/index.d.ts +6 -6
- package/dist/chains/eni/platforms/iro/index.js +4 -4
- package/dist/chains/eni/platforms/iro/pool.js +26 -90
- package/dist/chains/eni/platforms/iro/token.js +31 -107
- package/dist/chains/eni/platforms/iro/whitelist.js +18 -6
- package/dist/chains/index.d.ts +0 -13
- package/dist/chains/index.js +0 -13
- package/dist/chains/xlayer/eip7702/bundle-approve.d.ts +26 -2
- package/dist/chains/xlayer/eip7702/bundle-approve.js +21 -11
- package/dist/chains/xlayer/eip7702/bundle-buy.d.ts +6 -2
- package/dist/chains/xlayer/eip7702/bundle-buy.js +51 -13
- package/dist/chains/xlayer/eip7702/bundle-create.js +59 -93
- package/dist/chains/xlayer/eip7702/bundle-sell.d.ts +6 -2
- package/dist/chains/xlayer/eip7702/bundle-sell.js +111 -29
- package/dist/chains/xlayer/eip7702/bundle-swap.d.ts +65 -3
- package/dist/chains/xlayer/eip7702/bundle-swap.js +245 -51
- package/dist/chains/xlayer/eip7702/constants.d.ts +16 -1
- package/dist/chains/xlayer/eip7702/constants.js +21 -3
- package/dist/chains/xlayer/eip7702/index.d.ts +46 -28
- package/dist/chains/xlayer/eip7702/index.js +81 -28
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.d.ts +203 -2
- package/dist/chains/xlayer/eip7702/multi-hop-transfer.js +307 -63
- package/dist/chains/xlayer/eip7702/types.d.ts +0 -88
- package/dist/chains/xlayer/eip7702/utils.d.ts +3 -0
- package/dist/chains/xlayer/eip7702/utils.js +28 -23
- package/dist/chains/xlayer/eip7702/volume.d.ts +184 -6
- package/dist/chains/xlayer/eip7702/volume.js +164 -89
- package/dist/chains/xlayer/eoa/constants.js +1 -1
- package/dist/chains/xlayer/eoa/dex-helpers.js +5 -5
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.d.ts +95 -1
- package/dist/chains/xlayer/eoa/eoa-bundle-swap.js +299 -66
- package/dist/chains/xlayer/eoa/eoa-wash-volume.d.ts +1 -1
- package/dist/chains/xlayer/eoa/eoa-wash-volume.js +23 -18
- package/dist/chains/xlayer/eoa/index.d.ts +6 -10
- package/dist/chains/xlayer/eoa/index.js +23 -8
- package/dist/chains/xlayer/eoa/portal-ops.js +2 -7
- package/dist/chains/xlayer/eoa/router-manager.js +3 -3
- package/dist/chains/xlayer/eoa/types.d.ts +2 -2
- package/dist/chains/xlayer/eoa/types.js +3 -1
- package/dist/chains/xlayer/index.d.ts +2 -3
- package/dist/chains/xlayer/index.js +7 -4
- package/dist/contracts/helper3.d.ts +5 -20
- package/dist/contracts/helper3.js +20 -56
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.d.ts +26 -1
- package/dist/contracts/tm-bundle-merkle/approve-tokenmanager.js +113 -1
- package/dist/contracts/tm-bundle-merkle/config.d.ts +67 -5
- package/dist/contracts/tm-bundle-merkle/config.js +114 -2
- package/dist/contracts/tm-bundle-merkle/core.d.ts +4 -1
- package/dist/contracts/tm-bundle-merkle/core.js +591 -1
- package/dist/contracts/tm-bundle-merkle/index.d.ts +5 -5
- package/dist/contracts/tm-bundle-merkle/index.js +5 -5
- package/dist/contracts/tm-bundle-merkle/internal.d.ts +46 -2
- package/dist/contracts/tm-bundle-merkle/internal.js +238 -2
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.d.ts +28 -1
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.js +686 -1
- package/dist/contracts/tm-bundle-merkle/private.d.ts +27 -1
- package/dist/contracts/tm-bundle-merkle/private.js +476 -1
- package/dist/contracts/tm-bundle-merkle/submit.d.ts +314 -3
- package/dist/contracts/tm-bundle-merkle/submit.js +928 -3
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.d.ts +55 -2
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.js +506 -2
- package/dist/contracts/tm-bundle-merkle/swap-internal.d.ts +3 -1
- package/dist/contracts/tm-bundle-merkle/swap-internal.js +18 -1
- package/dist/contracts/tm-bundle-merkle/swap.d.ts +144 -2
- package/dist/contracts/tm-bundle-merkle/swap.js +764 -2
- package/dist/contracts/tm-bundle-merkle/types.d.ts +476 -1
- package/dist/contracts/tm-bundle-merkle/utils.d.ts +18 -6
- package/dist/contracts/tm-bundle-merkle/utils.js +1501 -6
- package/dist/contracts/tm-bundle.d.ts +51 -3
- package/dist/contracts/tm-bundle.js +177 -108
- package/dist/contracts/tm.d.ts +2 -3
- package/dist/contracts/tm.js +32 -37
- package/dist/contracts/tm1.js +4 -9
- package/dist/contracts/tm2.js +4 -9
- package/dist/dex/direct-router.d.ts +125 -3
- package/dist/dex/direct-router.js +666 -237
- package/dist/flows/create.d.ts +1 -2
- package/dist/flows/create.js +6 -6
- package/dist/index.d.ts +87 -20
- package/dist/index.js +217 -20
- package/dist/shared/abis/TaxToken.json +105 -0
- package/dist/shared/abis/TokenManager2.json +60 -0
- package/dist/shared/abis/common.d.ts +83 -2
- package/dist/shared/abis/common.js +254 -2
- package/dist/shared/abis/index.d.ts +6 -5
- package/dist/shared/abis/index.js +7 -5
- package/dist/shared/clients/blockrazor.js +25 -39
- package/dist/shared/clients/club48.d.ts +2 -2
- package/dist/shared/clients/club48.js +29 -34
- package/dist/shared/clients/emitservice.js +0 -2
- package/dist/shared/clients/four.d.ts +6 -21
- package/dist/shared/clients/four.js +24 -29
- package/dist/shared/clients/merkle.js +34 -27
- package/dist/shared/constants/addresses.d.ts +1 -1
- package/dist/shared/constants/addresses.js +2 -11
- package/dist/shared/constants/chains.d.ts +1 -1
- package/dist/shared/constants/chains.js +1 -1
- package/dist/shared/constants/gas.d.ts +1 -1
- package/dist/shared/constants/gas.js +6 -2
- package/dist/shared/constants/index.d.ts +0 -3
- package/dist/shared/constants/index.js +0 -1
- package/dist/shared/flap/abi.js +1 -1
- package/dist/shared/flap/constants.d.ts +2 -1
- package/dist/shared/flap/constants.js +4 -3
- package/dist/shared/flap/curve.js +0 -3
- package/dist/shared/flap/errors.d.ts +4 -1
- package/dist/shared/flap/errors.js +1 -20
- package/dist/shared/flap/index.d.ts +5 -4
- package/dist/shared/flap/index.js +5 -4
- package/dist/shared/flap/launch-v6.d.ts +127 -0
- package/dist/shared/flap/launch-v6.js +123 -0
- package/dist/shared/flap/meta.d.ts +18 -22
- package/dist/shared/flap/meta.js +17 -12
- package/dist/shared/flap/permit.js +2 -5
- package/dist/shared/flap/pinata.d.ts +6 -22
- package/dist/shared/flap/pinata.js +26 -21
- package/dist/shared/flap/portal-bundle-merkle/config.d.ts +72 -3
- package/dist/shared/flap/portal-bundle-merkle/config.js +124 -4
- package/dist/shared/flap/portal-bundle-merkle/core.d.ts +4 -0
- package/dist/shared/flap/portal-bundle-merkle/core.js +151 -142
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.d.ts +4 -17
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +86 -86
- package/dist/shared/flap/portal-bundle-merkle/curve-to-dex.js +92 -100
- package/dist/shared/flap/portal-bundle-merkle/index.d.ts +7 -11
- package/dist/shared/flap/portal-bundle-merkle/index.js +7 -4
- package/dist/shared/flap/portal-bundle-merkle/pancake-proxy.js +68 -71
- package/dist/shared/flap/portal-bundle-merkle/private.js +114 -61
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.d.ts +64 -1
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first.js +247 -66
- package/dist/shared/flap/portal-bundle-merkle/swap.d.ts +71 -2
- package/dist/shared/flap/portal-bundle-merkle/swap.js +410 -103
- package/dist/shared/flap/portal-bundle-merkle/types.d.ts +12 -88
- package/dist/shared/flap/portal-bundle-merkle/utils.d.ts +80 -1
- package/dist/shared/flap/portal-bundle-merkle/utils.js +265 -145
- package/dist/shared/flap/portal-bundle.js +56 -55
- package/dist/shared/flap/portal-create-token.d.ts +19 -37
- package/dist/shared/flap/portal-create-token.js +124 -121
- package/dist/shared/flap/portal.d.ts +2 -1
- package/dist/shared/flap/portal.js +28 -36
- package/dist/shared/flap/vanity.d.ts +6 -6
- package/dist/shared/flap/vanity.js +21 -15
- package/dist/shared/flap/vault.d.ts +93 -25
- package/dist/shared/flap/vault.js +126 -75
- package/dist/shared/four/tax-token.d.ts +1 -1
- package/dist/shared/four/tax-token.js +7 -27
- package/dist/shared/index.d.ts +0 -6
- package/dist/shared/index.js +0 -4
- package/dist/utils/airdrop-sweep.d.ts +76 -4
- package/dist/utils/airdrop-sweep.js +55 -42
- package/dist/utils/bundle-helpers.d.ts +243 -9
- package/dist/utils/bundle-helpers.js +584 -10
- package/dist/utils/constants.d.ts +61 -5
- package/dist/utils/constants.js +80 -5
- package/dist/utils/contract-factory.d.ts +4 -2
- package/dist/utils/contract-factory.js +18 -25
- package/dist/utils/erc20.d.ts +89 -7
- package/dist/utils/erc20.js +125 -94
- package/dist/utils/errors.d.ts +1 -12
- package/dist/utils/errors.js +1 -60
- package/dist/utils/holders-maker.d.ts +138 -2
- package/dist/utils/holders-maker.js +661 -26
- package/dist/utils/lp-inspect.d.ts +112 -2
- package/dist/utils/lp-inspect.js +223 -73
- package/dist/utils/mpcExclusive.d.ts +5 -2
- package/dist/utils/mpcExclusive.js +3 -4
- package/dist/utils/private-sale.d.ts +58 -2
- package/dist/utils/private-sale.js +15 -4
- package/dist/utils/provider-factory.d.ts +0 -4
- package/dist/utils/provider-factory.js +0 -10
- package/dist/utils/quote-helpers.d.ts +45 -4
- package/dist/utils/quote-helpers.js +74 -17
- package/dist/utils/stealth-transfer.d.ts +28 -2
- package/dist/utils/stealth-transfer.js +15 -31
- package/dist/utils/swap-helpers.d.ts +15 -2
- package/dist/utils/swap-helpers.js +11 -6
- package/dist/utils/wallet.d.ts +25 -2
- package/dist/utils/wallet.js +10 -13
- package/package.json +4 -160
- package/dist/__tests__/subpath-exports.test.d.ts +0 -1
- package/dist/__tests__/subpath-exports.test.js +0 -64
- package/dist/abis/common.d.ts +0 -85
- package/dist/abis/common.js +0 -264
- package/dist/abis/contracts/TaxToken.json +0 -969
- package/dist/abis/contracts/TokenManager2.json +0 -136
- package/dist/abis/contracts/index.d.ts +0 -5
- package/dist/abis/contracts/index.js +0 -5
- package/dist/abis/flap/index.d.ts +0 -3
- package/dist/abis/flap/index.js +0 -3
- package/dist/abis/flap/portal-events.d.ts +0 -6
- package/dist/abis/flap/portal-events.js +0 -17
- package/dist/abis/flap/portal.d.ts +0 -6
- package/dist/abis/flap/portal.js +0 -37
- package/dist/abis/flap/vault.d.ts +0 -171
- package/dist/abis/flap/vault.js +0 -91
- package/dist/abis/index.d.ts +0 -8
- package/dist/abis/index.js +0 -11
- package/dist/bundle-core/__tests__/config-helpers.test.d.ts +0 -1
- package/dist/bundle-core/__tests__/config-helpers.test.js +0 -28
- package/dist/bundle-core/__tests__/facade-parity.test.d.ts +0 -1
- package/dist/bundle-core/__tests__/facade-parity.test.js +0 -33
- package/dist/bundle-core/__tests__/sign-context-helpers.test.d.ts +0 -1
- package/dist/bundle-core/__tests__/sign-context-helpers.test.js +0 -60
- package/dist/bundle-core/__tests__/sign-fixture.test.d.ts +0 -1
- package/dist/bundle-core/__tests__/sign-fixture.test.js +0 -220
- package/dist/bundle-core/__tests__/sign-fixtures.d.ts +0 -10
- package/dist/bundle-core/__tests__/sign-fixtures.js +0 -16
- package/dist/bundle-core/config-helpers.d.ts +0 -36
- package/dist/bundle-core/config-helpers.js +0 -57
- package/dist/bundle-core/errors.d.ts +0 -50
- package/dist/bundle-core/errors.js +0 -35
- package/dist/bundle-core/four-meme/approve-tokenmanager.d.ts +0 -7
- package/dist/bundle-core/four-meme/approve-tokenmanager.js +0 -99
- package/dist/bundle-core/four-meme/core-helpers.d.ts +0 -8
- package/dist/bundle-core/four-meme/core-helpers.js +0 -40
- package/dist/bundle-core/four-meme/core.d.ts +0 -4
- package/dist/bundle-core/four-meme/core.js +0 -515
- package/dist/bundle-core/four-meme/pancake-proxy.d.ts +0 -28
- package/dist/bundle-core/four-meme/pancake-proxy.js +0 -679
- package/dist/bundle-core/four-meme/private.d.ts +0 -27
- package/dist/bundle-core/four-meme/private.js +0 -465
- package/dist/bundle-core/four-meme/sign-context-helpers.d.ts +0 -2
- package/dist/bundle-core/four-meme/sign-context-helpers.js +0 -2
- package/dist/bundle-core/four-meme/swap-buy-first.d.ts +0 -8
- package/dist/bundle-core/four-meme/swap-buy-first.js +0 -493
- package/dist/bundle-core/four-meme/swap-hop-helpers.d.ts +0 -6
- package/dist/bundle-core/four-meme/swap-hop-helpers.js +0 -63
- package/dist/bundle-core/four-meme/swap-internal.d.ts +0 -3
- package/dist/bundle-core/four-meme/swap-internal.js +0 -18
- package/dist/bundle-core/four-meme/swap-sign-helpers.d.ts +0 -27
- package/dist/bundle-core/four-meme/swap-sign-helpers.js +0 -105
- package/dist/bundle-core/four-meme/swap.d.ts +0 -17
- package/dist/bundle-core/four-meme/swap.js +0 -505
- package/dist/bundle-core/four-meme/types/buy-first.d.ts +0 -50
- package/dist/bundle-core/four-meme/types/buy-first.js +0 -1
- package/dist/bundle-core/four-meme/types/core-flow.d.ts +0 -63
- package/dist/bundle-core/four-meme/types/core-flow.js +0 -1
- package/dist/bundle-core/four-meme/types/index.d.ts +0 -600
- package/dist/bundle-core/four-meme/types/index.js +0 -1
- package/dist/bundle-core/four-meme/types/swap-internal.d.ts +0 -19
- package/dist/bundle-core/four-meme/types/swap-internal.js +0 -1
- package/dist/bundle-core/four-meme/types.d.ts +0 -1
- package/dist/bundle-core/four-meme/types.js +0 -1
- package/dist/bundle-core/four-meme/utils-disperse.d.ts +0 -7
- package/dist/bundle-core/four-meme/utils-disperse.js +0 -396
- package/dist/bundle-core/four-meme/utils-pairwise.d.ts +0 -8
- package/dist/bundle-core/four-meme/utils-pairwise.js +0 -328
- package/dist/bundle-core/four-meme/utils-sweep.d.ts +0 -8
- package/dist/bundle-core/four-meme/utils-sweep.js +0 -744
- package/dist/bundle-core/index.d.ts +0 -8
- package/dist/bundle-core/index.js +0 -8
- package/dist/bundle-core/internal.d.ts +0 -21
- package/dist/bundle-core/internal.js +0 -182
- package/dist/bundle-core/sign-context-helpers.d.ts +0 -25
- package/dist/bundle-core/sign-context-helpers.js +0 -67
- package/dist/bundle-core/submit.d.ts +0 -293
- package/dist/bundle-core/submit.js +0 -727
- package/dist/bundle-core/types/index.d.ts +0 -8
- package/dist/bundle-core/types/index.js +0 -1
- package/dist/bundle-core/types.d.ts +0 -1
- package/dist/bundle-core/types.js +0 -1
- package/dist/chains/bsc/four/utils-disperse.d.ts +0 -1
- package/dist/chains/bsc/four/utils-disperse.js +0 -1
- package/dist/chains/bsc/four/utils-pairwise.d.ts +0 -1
- package/dist/chains/bsc/four/utils-pairwise.js +0 -1
- package/dist/chains/bsc/four/utils-sweep.d.ts +0 -1
- package/dist/chains/bsc/four/utils-sweep.js +0 -1
- package/dist/chains/bsc/iro.d.ts +0 -5
- package/dist/chains/bsc/iro.js +0 -4
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.d.ts +0 -159
- package/dist/chains/bsc/pancake/bundle-buy-first-helpers.js +0 -117
- package/dist/chains/bsc/pancake/bundle-swap-helpers.d.ts +0 -241
- package/dist/chains/bsc/pancake/bundle-swap-helpers.js +0 -565
- package/dist/chains/eni/flat-aliases.d.ts +0 -10
- package/dist/chains/eni/flat-aliases.js +0 -8
- package/dist/chains/eni/submit.d.ts +0 -43
- package/dist/chains/eni/submit.js +0 -286
- package/dist/chains/xlayer/eip7702/flat-aliases.d.ts +0 -13
- package/dist/chains/xlayer/eip7702/flat-aliases.js +0 -10
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.d.ts +0 -79
- package/dist/chains/xlayer/eip7702/multi-hop-transfer-helpers.js +0 -1
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.d.ts +0 -26
- package/dist/chains/xlayer/eip7702/transfer-context-helpers.js +0 -57
- package/dist/chains/xlayer/eip7702/volume-helpers.d.ts +0 -148
- package/dist/chains/xlayer/eip7702/volume-helpers.js +0 -48
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.d.ts +0 -126
- package/dist/chains/xlayer/eoa/eoa-bundle-swap-helpers.js +0 -228
- package/dist/contracts/tm-bundle-helpers.d.ts +0 -88
- package/dist/contracts/tm-bundle-helpers.js +0 -72
- package/dist/contracts/tm-bundle-merkle/utils-disperse.d.ts +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-disperse.js +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.d.ts +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-pairwise.js +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-sweep.d.ts +0 -1
- package/dist/contracts/tm-bundle-merkle/utils-sweep.js +0 -1
- package/dist/dex/direct-router-helpers.d.ts +0 -264
- package/dist/dex/direct-router-helpers.js +0 -539
- package/dist/dex/types.d.ts +0 -81
- package/dist/dex/types.js +0 -1
- package/dist/exports/root-bundle-and-tooling.d.ts +0 -27
- package/dist/exports/root-bundle-and-tooling.js +0 -30
- package/dist/exports/root-eni-and-bsc-iro.d.ts +0 -26
- package/dist/exports/root-eni-and-bsc-iro.js +0 -66
- package/dist/exports/root-foundations.d.ts +0 -35
- package/dist/exports/root-foundations.js +0 -70
- package/dist/exports/root-swap-dex-and-xlayer.d.ts +0 -30
- package/dist/exports/root-swap-dex-and-xlayer.js +0 -78
- package/dist/flap/index.d.ts +0 -10
- package/dist/flap/index.js +0 -8
- package/dist/flows/index.d.ts +0 -1
- package/dist/flows/index.js +0 -1
- package/dist/merkle/index.d.ts +0 -12
- package/dist/merkle/index.js +0 -11
- package/dist/shared/clients/index.d.ts +0 -8
- package/dist/shared/clients/index.js +0 -8
- package/dist/shared/constants/quote.d.ts +0 -30
- package/dist/shared/constants/quote.js +0 -37
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.d.ts +0 -32
- package/dist/shared/flap/portal-bundle-merkle/core-helpers.js +0 -83
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.d.ts +0 -125
- package/dist/shared/flap/portal-bundle-merkle/swap-buy-first-helpers.js +0 -113
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.d.ts +0 -149
- package/dist/shared/flap/portal-bundle-merkle/swap-helpers.js +0 -259
- package/dist/shared/foundation/dex/v3-path.d.ts +0 -6
- package/dist/shared/foundation/dex/v3-path.js +0 -35
- package/dist/shared/foundation/gas/bundle-gas.d.ts +0 -49
- package/dist/shared/foundation/gas/bundle-gas.js +0 -93
- package/dist/shared/foundation/gas/profit-hop.d.ts +0 -20
- package/dist/shared/foundation/gas/profit-hop.js +0 -72
- package/dist/shared/foundation/index.d.ts +0 -13
- package/dist/shared/foundation/index.js +0 -12
- package/dist/shared/foundation/nonce/nonce-manager.d.ts +0 -17
- package/dist/shared/foundation/nonce/nonce-manager.js +0 -183
- package/dist/shared/foundation/normalize-unknown.d.ts +0 -9
- package/dist/shared/foundation/normalize-unknown.js +0 -29
- package/dist/shared/foundation/sdk-logger.d.ts +0 -13
- package/dist/shared/foundation/sdk-logger.js +0 -12
- package/dist/shared/foundation/tx/build-request.d.ts +0 -17
- package/dist/shared/foundation/tx/build-request.js +0 -25
- package/dist/shared/foundation/tx/sign-batch.d.ts +0 -5
- package/dist/shared/foundation/tx/sign-batch.js +0 -26
- package/dist/shared/foundation/tx/wallet-sign-patch.d.ts +0 -1
- package/dist/shared/foundation/tx/wallet-sign-patch.js +0 -18
- package/dist/shared/foundation/types/airdrop-sweep.d.ts +0 -79
- package/dist/shared/foundation/types/airdrop-sweep.js +0 -1
- package/dist/shared/foundation/types/erc20.d.ts +0 -65
- package/dist/shared/foundation/types/erc20.js +0 -1
- package/dist/shared/foundation/types/holders-maker.d.ts +0 -64
- package/dist/shared/foundation/types/holders-maker.js +0 -1
- package/dist/shared/foundation/types/index.d.ts +0 -7
- package/dist/shared/foundation/types/index.js +0 -1
- package/dist/shared/foundation/types/lp-inspect.d.ts +0 -102
- package/dist/shared/foundation/types/lp-inspect.js +0 -1
- package/dist/shared/foundation/types/multicall.d.ts +0 -5
- package/dist/shared/foundation/types/multicall.js +0 -1
- package/dist/shared/foundation/types/private-sale.d.ts +0 -35
- package/dist/shared/foundation/types/private-sale.js +0 -1
- package/dist/shared/foundation/types/quote-helpers.d.ts +0 -17
- package/dist/shared/foundation/types/quote-helpers.js +0 -1
- package/dist/types/errors.d.ts +0 -27
- package/dist/types/errors.js +0 -34
- package/dist/utils/holders-maker/addresses.d.ts +0 -12
- package/dist/utils/holders-maker/addresses.js +0 -15
- package/dist/utils/holders-maker/buy-tx.d.ts +0 -44
- package/dist/utils/holders-maker/buy-tx.js +0 -278
- package/dist/utils/holders-maker/constants.d.ts +0 -6
- package/dist/utils/holders-maker/constants.js +0 -7
- package/dist/utils/holders-maker/disperse.d.ts +0 -18
- package/dist/utils/holders-maker/disperse.js +0 -90
- package/dist/utils/holders-maker/routing.d.ts +0 -4
- package/dist/utils/holders-maker/routing.js +0 -45
- package/dist/utils/holders-maker/transfer-tx.d.ts +0 -4
- package/dist/utils/holders-maker/transfer-tx.js +0 -67
- package/dist/utils/holders-maker-helpers.d.ts +0 -9
- package/dist/utils/holders-maker-helpers.js +0 -9
- package/dist/utils/hop-chains.d.ts +0 -35
- package/dist/utils/hop-chains.js +0 -215
- package/dist/utils/lp-inspect-helpers.d.ts +0 -9
- package/dist/utils/lp-inspect-helpers.js +0 -109
- package/dist/utils/types/airdrop-sweep.d.ts +0 -1
- package/dist/utils/types/airdrop-sweep.js +0 -1
- package/dist/utils/types/contract-factory.d.ts +0 -1
- package/dist/utils/types/contract-factory.js +0 -1
- package/dist/utils/types/erc20.d.ts +0 -1
- package/dist/utils/types/erc20.js +0 -1
- package/dist/utils/types/errors.d.ts +0 -1
- package/dist/utils/types/errors.js +0 -1
- package/dist/utils/types/holders-maker.d.ts +0 -1
- package/dist/utils/types/holders-maker.js +0 -1
- package/dist/utils/types/hop-chains.d.ts +0 -8
- package/dist/utils/types/hop-chains.js +0 -1
- package/dist/utils/types/index.d.ts +0 -13
- package/dist/utils/types/index.js +0 -1
- package/dist/utils/types/lp-inspect.d.ts +0 -1
- package/dist/utils/types/lp-inspect.js +0 -1
- package/dist/utils/types/mpc-exclusive.d.ts +0 -5
- package/dist/utils/types/mpc-exclusive.js +0 -1
- package/dist/utils/types/private-sale.d.ts +0 -1
- package/dist/utils/types/private-sale.js +0 -1
- package/dist/utils/types/quote-helpers.d.ts +0 -1
- package/dist/utils/types/quote-helpers.js +0 -1
- package/dist/utils/types/stealth-transfer.d.ts +0 -44
- package/dist/utils/types/stealth-transfer.js +0 -1
- package/dist/utils/types/wallet.d.ts +0 -25
- package/dist/utils/types/wallet.js +0 -1
- package/dist/vanity/index.d.ts +0 -5
- package/dist/vanity/index.js +0 -5
- package/src/abis/contracts/TaxToken.json +0 -969
- package/src/abis/contracts/TokenManager.json +0 -836
- package/src/abis/contracts/TokenManager2.json +0 -136
- package/src/abis/contracts/TokenManagerHelper3.json +0 -993
- /package/dist/{abis/contracts → shared/abis}/TokenManager.json +0 -0
- /package/dist/{abis/contracts → shared/abis}/TokenManagerHelper3.json +0 -0
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
* 提供代币 Logo、社交链接、描述等元信息查询
|
|
6
6
|
*/
|
|
7
7
|
import { Contract, JsonRpcProvider } from 'ethers';
|
|
8
|
-
import { ENI_CHAIN_ID, ENI_RPC_URL,
|
|
9
|
-
import {
|
|
10
|
-
import { ERC20_ABI } from '../../../../abis/common.js';
|
|
8
|
+
import { ENI_CHAIN_ID, ENI_RPC_URL, } from '../../constants.js';
|
|
9
|
+
import { ERC20_ABI } from '../../../../shared/abis/common.js';
|
|
11
10
|
/**
|
|
12
11
|
* 从 ERC20 合约获取 DAOaaS Portal 代币基本元数据
|
|
13
12
|
* Portal 的 getTokenState 仅返回状态码,name/symbol 从 ERC20 接口获取
|
|
@@ -22,9 +21,7 @@ export async function getTokenMeta(token, rpcUrl = ENI_RPC_URL) {
|
|
|
22
21
|
tokenContract.symbol(),
|
|
23
22
|
]);
|
|
24
23
|
}
|
|
25
|
-
catch {
|
|
26
|
-
/* ignore */
|
|
27
|
-
}
|
|
24
|
+
catch { /* ignore */ }
|
|
28
25
|
return {
|
|
29
26
|
token,
|
|
30
27
|
name,
|
|
@@ -42,6 +39,8 @@ export async function getTokenMeta(token, rpcUrl = ENI_RPC_URL) {
|
|
|
42
39
|
* FairLaunch 代币的 logo 和 metadata 存储在 LaunchParams 中
|
|
43
40
|
*/
|
|
44
41
|
export async function getFairLaunchTokenMeta(token, rpcUrl = ENI_RPC_URL) {
|
|
42
|
+
const { LP_FAIR_LAUNCHER_ABI } = await import('../../constants.js');
|
|
43
|
+
const { LP_FAIR_LAUNCHER_ADDRESS } = await import('../fair-launch/constants.js');
|
|
45
44
|
const provider = new JsonRpcProvider(rpcUrl, ENI_CHAIN_ID, { staticNetwork: true });
|
|
46
45
|
const launcher = new Contract(LP_FAIR_LAUNCHER_ADDRESS, LP_FAIR_LAUNCHER_ABI, provider);
|
|
47
46
|
const info = await launcher.getTokenInfoByToken(token);
|
|
@@ -51,9 +50,7 @@ export async function getFairLaunchTokenMeta(token, rpcUrl = ENI_RPC_URL) {
|
|
|
51
50
|
meta = JSON.parse(info.metadata);
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
|
-
catch {
|
|
55
|
-
/* metadata may not be valid JSON */
|
|
56
|
-
}
|
|
53
|
+
catch { /* metadata may not be valid JSON */ }
|
|
57
54
|
return {
|
|
58
55
|
token: info.token ?? token,
|
|
59
56
|
name: info.name ?? '',
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* 等同于 BSC EOA 普通模式 / Monad direct 模式
|
|
6
6
|
*/
|
|
7
7
|
import { Wallet, JsonRpcProvider } from 'ethers';
|
|
8
|
-
import { ENI_CHAIN_ID, ENI_RPC_URL, DAOAAS_PORTAL, NATIVE_TRANSFER_GAS_LIMIT } from '../../constants.js';
|
|
8
|
+
import { ENI_CHAIN_ID, ENI_RPC_URL, DAOAAS_PORTAL, NATIVE_TRANSFER_GAS_LIMIT, } from '../../constants.js';
|
|
9
9
|
import { encodeBuyCall, encodeSellCall, applySlippage, DaoaasPortalQuery } from './portal.js';
|
|
10
10
|
import { getProfitRecipient, getProfitRateBps, calculateProfitAmount } from '../../../../shared/constants/profit.js';
|
|
11
11
|
const NORMAL_PROFIT_BPS = getProfitRateBps('normal');
|
|
@@ -45,7 +45,7 @@ export async function directBuy(params) {
|
|
|
45
45
|
const provider = new JsonRpcProvider(params.rpcUrl ?? ENI_RPC_URL, ENI_CHAIN_ID, { staticNetwork: true });
|
|
46
46
|
const wallet = new Wallet(params.privateKey, provider);
|
|
47
47
|
const calldata = encodeBuyCall(params.token, params.amountOutMin ?? 0n);
|
|
48
|
-
const nonce = params.nonce ??
|
|
48
|
+
const nonce = params.nonce ?? await wallet.getNonce('pending');
|
|
49
49
|
const feeData = await provider.getFeeData();
|
|
50
50
|
const tx = await wallet.signTransaction({
|
|
51
51
|
to: DAOAAS_PORTAL,
|
|
@@ -70,7 +70,7 @@ export async function directSell(params) {
|
|
|
70
70
|
const provider = new JsonRpcProvider(params.rpcUrl ?? ENI_RPC_URL, ENI_CHAIN_ID, { staticNetwork: true });
|
|
71
71
|
const wallet = new Wallet(params.privateKey, provider);
|
|
72
72
|
const calldata = encodeSellCall(params.token, params.tokenAmount, params.amountOutMin ?? 0n);
|
|
73
|
-
const nonce = params.nonce ??
|
|
73
|
+
const nonce = params.nonce ?? await wallet.getNonce('pending');
|
|
74
74
|
const feeData = await provider.getFeeData();
|
|
75
75
|
const tx = await wallet.signTransaction({
|
|
76
76
|
to: DAOAAS_PORTAL,
|
|
@@ -260,7 +260,7 @@ export async function directSellForSubmit(params) {
|
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
export async function directBatchBuyForSubmit(params) {
|
|
263
|
-
const { rpcUrl = ENI_RPC_URL, token, privateKeys: rawKeys, amounts: rawAmounts, slippageBps = 100, gasPrice
|
|
263
|
+
const { rpcUrl = ENI_RPC_URL, token, privateKeys: rawKeys, amounts: rawAmounts, slippageBps = 100, gasPrice } = params;
|
|
264
264
|
if (rawKeys.length !== rawAmounts.length) {
|
|
265
265
|
throw new Error(`privateKeys.length (${rawKeys.length}) !== amounts.length (${rawAmounts.length})`);
|
|
266
266
|
}
|
|
@@ -277,8 +277,8 @@ export async function directBatchBuyForSubmit(params) {
|
|
|
277
277
|
const totalFlowRaw = rawAmounts.reduce((sum, amount) => sum + amount, 0n);
|
|
278
278
|
const profitAmountFull = calculateProfitAmount(totalFlowRaw, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
279
279
|
const maxPayerIdx = pickMaxAmountIndex(rawAmounts);
|
|
280
|
-
const wallets = rawKeys.map(
|
|
281
|
-
const balances = await Promise.all(wallets.map(
|
|
280
|
+
const wallets = rawKeys.map(pk => new Wallet(pk, provider));
|
|
281
|
+
const balances = await Promise.all(wallets.map(w => provider.getBalance(w.address)));
|
|
282
282
|
let privateKeys = rawKeys;
|
|
283
283
|
let amounts = rawAmounts;
|
|
284
284
|
const validIndices = [];
|
|
@@ -287,6 +287,7 @@ export async function directBatchBuyForSubmit(params) {
|
|
|
287
287
|
if (i === maxPayerIdx)
|
|
288
288
|
required += profitAmountFull + NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
289
289
|
if (balances[i] < required) {
|
|
290
|
+
console.warn(`[DAOAAS BatchBuy] 钱包 ${wallets[i].address.slice(0, 10)} 余额不足: 余额=${balances[i]}, 需要=${required},跳过`);
|
|
290
291
|
continue;
|
|
291
292
|
}
|
|
292
293
|
validIndices.push(i);
|
|
@@ -295,8 +296,9 @@ export async function directBatchBuyForSubmit(params) {
|
|
|
295
296
|
throw new Error('所有钱包余额不足(含 swap + gas),无法执行 DAOAAS 买入');
|
|
296
297
|
}
|
|
297
298
|
if (validIndices.length < rawKeys.length) {
|
|
298
|
-
privateKeys = validIndices.map(
|
|
299
|
-
amounts = validIndices.map(
|
|
299
|
+
privateKeys = validIndices.map(i => rawKeys[i]);
|
|
300
|
+
amounts = validIndices.map(i => rawAmounts[i]);
|
|
301
|
+
console.log(`[DAOAAS BatchBuy] 余额预检: ${rawKeys.length - validIndices.length} 个钱包被跳过, 剩余 ${validIndices.length} 个`);
|
|
300
302
|
}
|
|
301
303
|
const transactions = [];
|
|
302
304
|
const totalFlow = amounts.reduce((sum, amount) => sum + amount, 0n);
|
|
@@ -304,7 +306,9 @@ export async function directBatchBuyForSubmit(params) {
|
|
|
304
306
|
for (let i = 0; i < privateKeys.length; i++) {
|
|
305
307
|
const wallet = new Wallet(privateKeys[i], provider);
|
|
306
308
|
const preview = await query.previewBuy(token, amounts[i]);
|
|
307
|
-
const effectiveSlippage = isBatch
|
|
309
|
+
const effectiveSlippage = isBatch
|
|
310
|
+
? Math.min(9500, slippageBps + i * 2000)
|
|
311
|
+
: slippageBps;
|
|
308
312
|
const minOut = applySlippage(preview, effectiveSlippage);
|
|
309
313
|
const calldata = encodeBuyCall(token, minOut);
|
|
310
314
|
const nonce = await wallet.getNonce('pending');
|
|
@@ -333,7 +337,7 @@ export async function directBatchBuyForSubmit(params) {
|
|
|
333
337
|
});
|
|
334
338
|
return {
|
|
335
339
|
transactions,
|
|
336
|
-
signedTransactions: [...transactions.map(
|
|
340
|
+
signedTransactions: [...transactions.map(tx => tx.signedTx), profitTx.signedTx],
|
|
337
341
|
totalGasCost: swapGasLimit * maxFeePerGas * BigInt(transactions.length) + NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas,
|
|
338
342
|
metadata: formatSubmitMetadata(totalFlow, profitAmount),
|
|
339
343
|
};
|
|
@@ -352,7 +356,19 @@ export async function directBatchSellForSubmit(params) {
|
|
|
352
356
|
const maxFeePerGas = gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
353
357
|
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
354
358
|
const swapGasLimit = 300000n;
|
|
355
|
-
const
|
|
359
|
+
const swapGasCost = swapGasLimit * maxFeePerGas;
|
|
360
|
+
const profitGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
361
|
+
const wallets = privateKeys.map(pk => new Wallet(pk, provider));
|
|
362
|
+
const balances = await Promise.all(wallets.map(w => provider.getBalance(w.address)));
|
|
363
|
+
const maxPayerIdx = pickMaxAmountIndex(tokenAmounts);
|
|
364
|
+
for (let i = 0; i < wallets.length; i++) {
|
|
365
|
+
let required = swapGasCost;
|
|
366
|
+
if (i === maxPayerIdx)
|
|
367
|
+
required += profitGasCost;
|
|
368
|
+
if (balances[i] < required) {
|
|
369
|
+
console.warn(`[DAOAAS BatchSell] 钱包 ${wallets[i].address.slice(0, 10)} 原生余额不足 gas: 余额=${balances[i]}, 需要=${required},可能导致交易失败`);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
356
372
|
const transactions = [];
|
|
357
373
|
const estimatedOuts = [];
|
|
358
374
|
const isBatch = privateKeys.length > 1;
|
|
@@ -360,7 +376,9 @@ export async function directBatchSellForSubmit(params) {
|
|
|
360
376
|
const wallet = wallets[i];
|
|
361
377
|
const preview = await query.previewSell(token, tokenAmounts[i]);
|
|
362
378
|
estimatedOuts.push(preview);
|
|
363
|
-
const effectiveSlippage = isBatch
|
|
379
|
+
const effectiveSlippage = isBatch
|
|
380
|
+
? Math.min(9500, slippageBps + i * 2000)
|
|
381
|
+
: slippageBps;
|
|
364
382
|
const minOut = applySlippage(preview, effectiveSlippage);
|
|
365
383
|
const calldata = encodeSellCall(token, tokenAmounts[i], minOut);
|
|
366
384
|
const nonce = await wallet.getNonce('pending');
|
|
@@ -390,7 +408,7 @@ export async function directBatchSellForSubmit(params) {
|
|
|
390
408
|
});
|
|
391
409
|
return {
|
|
392
410
|
transactions,
|
|
393
|
-
signedTransactions: [...transactions.map(
|
|
411
|
+
signedTransactions: [...transactions.map(tx => tx.signedTx), profitTx.signedTx],
|
|
394
412
|
totalGasCost: 300000n * maxFeePerGas * BigInt(transactions.length) + NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas,
|
|
395
413
|
metadata: formatSubmitMetadata(totalFlow, profitAmount),
|
|
396
414
|
};
|
|
@@ -421,9 +439,9 @@ export async function directQuickSwapForSubmit(params) {
|
|
|
421
439
|
if (params.sellerKeys.length > 1) {
|
|
422
440
|
for (let i = 1; i < params.sellerKeys.length; i++) {
|
|
423
441
|
const otherWallet = new Wallet(params.sellerKeys[i], provider);
|
|
424
|
-
const otherSellTxs = sellResult.transactions.filter(
|
|
442
|
+
const otherSellTxs = sellResult.transactions.filter(tx => tx.from.toLowerCase() === otherWallet.address.toLowerCase());
|
|
425
443
|
const otherNextNonce = otherSellTxs.length > 0
|
|
426
|
-
? Math.max(...otherSellTxs.map(
|
|
444
|
+
? Math.max(...otherSellTxs.map(tx => tx.nonce)) + 1
|
|
427
445
|
: await otherWallet.getNonce('pending');
|
|
428
446
|
const otherBalance = await provider.getBalance(otherWallet.address);
|
|
429
447
|
const reserveGas = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
@@ -447,23 +465,23 @@ export async function directQuickSwapForSubmit(params) {
|
|
|
447
465
|
const hopCount = params.hopCount ?? 0;
|
|
448
466
|
const distributeHopWallets = [];
|
|
449
467
|
if (params.buyerKeys.length > 0) {
|
|
450
|
-
const primarySellTxs = sellResult.transactions.filter(
|
|
468
|
+
const primarySellTxs = sellResult.transactions.filter(tx => tx.from.toLowerCase() === primarySellerAddress);
|
|
451
469
|
let primaryNextNonce = primarySellTxs.length > 0
|
|
452
|
-
? Math.max(...primarySellTxs.map(
|
|
470
|
+
? Math.max(...primarySellTxs.map(tx => tx.nonce)) + 1
|
|
453
471
|
: await primarySellerWallet.getNonce('pending');
|
|
454
472
|
const gasForBuy = 300000n * maxFeePerGas;
|
|
455
473
|
const hopGasFee = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
456
474
|
const totalFlow = params.buyAmounts.reduce((sum, a) => sum + a, 0n);
|
|
457
475
|
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
458
476
|
const profitAmount = calculateProfitAmount(totalFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
459
|
-
const profitGasPerBuyer = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
477
|
+
const profitGasPerBuyer = (NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas);
|
|
460
478
|
for (let i = 0; i < params.buyerKeys.length; i++) {
|
|
461
479
|
const buyerAddress = new Wallet(params.buyerKeys[i]).address;
|
|
462
480
|
const transferAmount = params.buyAmounts[i];
|
|
463
481
|
if (transferAmount <= 0n)
|
|
464
482
|
continue;
|
|
465
483
|
const isMaxBuyer = i === pickMaxAmountIndex(params.buyAmounts);
|
|
466
|
-
const extraForProfit = isMaxBuyer ? profitAmount + profitGasPerBuyer : 0n;
|
|
484
|
+
const extraForProfit = isMaxBuyer ? (profitAmount + profitGasPerBuyer) : 0n;
|
|
467
485
|
const baseTransfer = transferAmount + gasForBuy + extraForProfit;
|
|
468
486
|
if (hopCount <= 0) {
|
|
469
487
|
const signedTx = await primarySellerWallet.signTransaction({
|
|
@@ -486,8 +504,8 @@ export async function directQuickSwapForSubmit(params) {
|
|
|
486
504
|
hops.push({ address: w.address, privateKey: w.privateKey });
|
|
487
505
|
}
|
|
488
506
|
distributeHopWallets.push(hops);
|
|
489
|
-
const fullChain = [primarySellerWallet, ...hops.map(
|
|
490
|
-
const addresses = [...fullChain.map(
|
|
507
|
+
const fullChain = [primarySellerWallet, ...hops.map(h => new Wallet(h.privateKey))];
|
|
508
|
+
const addresses = [...fullChain.map(w => w.address), buyerAddress];
|
|
491
509
|
for (let j = 0; j < addresses.length - 1; j++) {
|
|
492
510
|
const fromWallet = fullChain[j];
|
|
493
511
|
const toAddress = addresses[j + 1];
|
|
@@ -527,10 +545,8 @@ export async function directQuickSwapForSubmit(params) {
|
|
|
527
545
|
const payerIndex = pickMaxAmountIndex(params.buyAmounts);
|
|
528
546
|
const payerKey = params.buyerKeys[payerIndex] || primarySellerKey;
|
|
529
547
|
const payerAddress = new Wallet(payerKey).address.toLowerCase();
|
|
530
|
-
const payerTxs = allTxs.filter(
|
|
531
|
-
const payerNonce = payerTxs.length > 0
|
|
532
|
-
? Math.max(...payerTxs.map((tx) => tx.nonce)) + 1
|
|
533
|
-
: await new Wallet(payerKey, provider).getNonce('pending');
|
|
548
|
+
const payerTxs = allTxs.filter(tx => tx.from.toLowerCase() === payerAddress);
|
|
549
|
+
const payerNonce = payerTxs.length > 0 ? Math.max(...payerTxs.map(tx => tx.nonce)) + 1 : await new Wallet(payerKey, provider).getNonce('pending');
|
|
534
550
|
const profitTx = await buildRevenueTail({
|
|
535
551
|
rpcUrl,
|
|
536
552
|
payerKey,
|
|
@@ -542,7 +558,7 @@ export async function directQuickSwapForSubmit(params) {
|
|
|
542
558
|
const distributeGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas * BigInt(distributeTxs.length);
|
|
543
559
|
return {
|
|
544
560
|
transactions: allTxs,
|
|
545
|
-
signedTransactions: [...allTxs.map(
|
|
561
|
+
signedTransactions: [...allTxs.map(tx => tx.signedTx), profitTx.signedTx],
|
|
546
562
|
totalGasCost: sellResult.totalGasCost + distributeGasCost + buyResult.totalGasCost + NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas,
|
|
547
563
|
metadata: formatSubmitMetadata(totalFlow, profitAmount),
|
|
548
564
|
...(distributeHopWallets.length > 0 ? { hopWallets: distributeHopWallets } : {}),
|
|
@@ -556,11 +572,11 @@ export async function directQuickSwapForSubmit(params) {
|
|
|
556
572
|
* ENI 不需要多跳,直接转到收益地址
|
|
557
573
|
*/
|
|
558
574
|
export async function buildProfitTransfer(params) {
|
|
559
|
-
const { rpcUrl = ENI_RPC_URL, payerKey, profitAmount, gasPrice, nonce: explicitNonce, maxFeePerGas, maxPriorityFeePerGas
|
|
575
|
+
const { rpcUrl = ENI_RPC_URL, payerKey, profitAmount, gasPrice, nonce: explicitNonce, maxFeePerGas, maxPriorityFeePerGas } = params;
|
|
560
576
|
const provider = new JsonRpcProvider(rpcUrl, ENI_CHAIN_ID, { staticNetwork: true });
|
|
561
577
|
const wallet = new Wallet(payerKey, provider);
|
|
562
578
|
const feeData = await provider.getFeeData();
|
|
563
|
-
const nonce = explicitNonce ??
|
|
579
|
+
const nonce = explicitNonce ?? await wallet.getNonce('pending');
|
|
564
580
|
const resolvedMaxFeePerGas = maxFeePerGas ?? gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
565
581
|
const resolvedMaxPriorityFeePerGas = maxPriorityFeePerGas ?? feeData.maxPriorityFeePerGas ?? 0n;
|
|
566
582
|
const signedTx = await wallet.signTransaction({
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* 接口与 Flap Portal 不兼容,独立实现
|
|
6
6
|
*/
|
|
7
7
|
import { Contract, Interface, JsonRpcProvider, formatEther, parseEther } from 'ethers';
|
|
8
|
-
import { DAOAAS_PORTAL, DAOAAS_PORTAL_ABI, ENI_CHAIN_ID, ENI_MULTICALL3, ENI_RPC_URL } from '../../constants.js';
|
|
9
|
-
import { ERC20_ABI, MULTICALL3_ABI } from '../../../../abis/common.js';
|
|
8
|
+
import { DAOAAS_PORTAL, DAOAAS_PORTAL_ABI, ENI_CHAIN_ID, ENI_MULTICALL3, ENI_RPC_URL, } from '../../constants.js';
|
|
9
|
+
import { ERC20_ABI, MULTICALL3_ABI } from '../../../../shared/abis/common.js';
|
|
10
10
|
const portalIface = new Interface(DAOAAS_PORTAL_ABI);
|
|
11
11
|
const erc20Iface = new Interface(ERC20_ABI);
|
|
12
12
|
const multicallIface = new Interface(MULTICALL3_ABI);
|
|
@@ -34,10 +34,6 @@ export function encodeTransferCall(to, amount) {
|
|
|
34
34
|
return erc20Iface.encodeFunctionData('transfer', [to, amount]);
|
|
35
35
|
}
|
|
36
36
|
export class DaoaasPortalQuery {
|
|
37
|
-
provider;
|
|
38
|
-
portal;
|
|
39
|
-
portalAddress;
|
|
40
|
-
multicall3Address;
|
|
41
37
|
constructor(config = {}) {
|
|
42
38
|
const rpcUrl = config.rpcUrl ?? ENI_RPC_URL;
|
|
43
39
|
this.provider = new JsonRpcProvider(rpcUrl, ENI_CHAIN_ID, { staticNetwork: true });
|
|
@@ -60,7 +56,7 @@ export class DaoaasPortalQuery {
|
|
|
60
56
|
/** 获取代币完整状态(链上 getTokenState 仅返回 uint256 状态码,其余数据分别查询) */
|
|
61
57
|
async getTokenState(token) {
|
|
62
58
|
const status = Number(await this.portal.getTokenState(token));
|
|
63
|
-
const price =
|
|
59
|
+
const price = await this.portal.getPrice(token);
|
|
64
60
|
const tokenContract = new Contract(token, ERC20_ABI, this.provider);
|
|
65
61
|
const [totalSupply, portalBalance, name, symbol] = await Promise.all([
|
|
66
62
|
tokenContract.totalSupply(),
|
|
@@ -73,7 +69,7 @@ export class DaoaasPortalQuery {
|
|
|
73
69
|
}
|
|
74
70
|
/** 批量获取钱包 EGAS 余额 */
|
|
75
71
|
async getMultipleEgasBalances(addresses) {
|
|
76
|
-
const calls = addresses.map(
|
|
72
|
+
const calls = addresses.map(addr => ({
|
|
77
73
|
target: this.multicall3Address,
|
|
78
74
|
allowFailure: true,
|
|
79
75
|
callData: multicallIface.encodeFunctionData('getEthBalance', [addr]),
|
|
@@ -89,7 +85,7 @@ export class DaoaasPortalQuery {
|
|
|
89
85
|
}
|
|
90
86
|
/** 批量获取 ERC20 余额 */
|
|
91
87
|
async getMultipleTokenBalances(token, addresses) {
|
|
92
|
-
const calls = addresses.map(
|
|
88
|
+
const calls = addresses.map(addr => ({
|
|
93
89
|
target: token,
|
|
94
90
|
allowFailure: true,
|
|
95
91
|
callData: erc20Iface.encodeFunctionData('balanceOf', [addr]),
|
|
@@ -105,7 +101,7 @@ export class DaoaasPortalQuery {
|
|
|
105
101
|
}
|
|
106
102
|
/** 批量获取 ERC20 allowance */
|
|
107
103
|
async getMultipleAllowances(token, owners, spender) {
|
|
108
|
-
const calls = owners.map(
|
|
104
|
+
const calls = owners.map(owner => ({
|
|
109
105
|
target: token,
|
|
110
106
|
allowFailure: true,
|
|
111
107
|
callData: erc20Iface.encodeFunctionData('allowance', [owner, spender]),
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { Wallet, JsonRpcProvider, Contract, ethers, Interface } from 'ethers';
|
|
11
11
|
import { ENI_CHAIN_ID, ENI_RPC_URL, WEGAS, NATIVE_TRANSFER_GAS_LIMIT, DSWAP_V2_ROUTER, DSWAP_V2_FACTORY, DSWAP_V2_ROUTER_ABI, DSWAP_V2_FACTORY_ABI, DSWAP_V2_PAIR_ABI, } from '../../constants.js';
|
|
12
|
-
import { ERC20_ABI } from '../../../../abis/common.js';
|
|
12
|
+
import { ERC20_ABI } from '../../../../shared/abis/common.js';
|
|
13
13
|
import { getProfitRecipient, getProfitRateBps, calculateProfitAmount } from '../../../../shared/constants/profit.js';
|
|
14
14
|
const DEFAULT_DEADLINE_MINUTES = 20;
|
|
15
15
|
const DEFAULT_SLIPPAGE_PCT = 5;
|
|
@@ -25,7 +25,7 @@ function getDeadline(minutes) {
|
|
|
25
25
|
}
|
|
26
26
|
function applySlippage(amount, slippagePct) {
|
|
27
27
|
const pct = Math.max(0, Math.min(100, slippagePct));
|
|
28
|
-
return
|
|
28
|
+
return amount * BigInt(100 - Math.floor(pct)) / 100n;
|
|
29
29
|
}
|
|
30
30
|
async function signProfitTx(params) {
|
|
31
31
|
return params.wallet.signTransaction({
|
|
@@ -64,11 +64,17 @@ export async function getLPPairInfo(params) {
|
|
|
64
64
|
]);
|
|
65
65
|
let userLPBalance = 0n;
|
|
66
66
|
if (params.userAddress) {
|
|
67
|
-
userLPBalance =
|
|
67
|
+
userLPBalance = await pair.balanceOf(params.userAddress);
|
|
68
68
|
}
|
|
69
|
-
const userShare = totalSupply > 0n
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
const userShare = totalSupply > 0n
|
|
70
|
+
? Number(userLPBalance * 10000n / totalSupply) / 10000
|
|
71
|
+
: 0;
|
|
72
|
+
const userToken0Amount = totalSupply > 0n
|
|
73
|
+
? reserves[0] * userLPBalance / totalSupply
|
|
74
|
+
: 0n;
|
|
75
|
+
const userToken1Amount = totalSupply > 0n
|
|
76
|
+
? reserves[1] * userLPBalance / totalSupply
|
|
77
|
+
: 0n;
|
|
72
78
|
return {
|
|
73
79
|
pairAddress: pairAddr,
|
|
74
80
|
token0,
|
|
@@ -83,7 +89,7 @@ export async function getLPPairInfo(params) {
|
|
|
83
89
|
};
|
|
84
90
|
}
|
|
85
91
|
export async function batchGetLPPairInfo(params) {
|
|
86
|
-
return Promise.all(params.tokens.map(
|
|
92
|
+
return Promise.all(params.tokens.map(token => getLPPairInfo({ rpcUrl: params.rpcUrl, token, userAddress: params.userAddress })));
|
|
87
93
|
}
|
|
88
94
|
// ============================================================================
|
|
89
95
|
// 创建/添加 流动性 — EGAS + Token
|
|
@@ -117,12 +123,7 @@ export async function addLiquidityETHForSubmit(params) {
|
|
|
117
123
|
const amountTokenMin = applySlippage(amountTokenDesired, slippage);
|
|
118
124
|
const amountETHMin = applySlippage(amountETHDesired, slippage);
|
|
119
125
|
const addLiqData = routerIface.encodeFunctionData('addLiquidityETH', [
|
|
120
|
-
token,
|
|
121
|
-
amountTokenDesired,
|
|
122
|
-
amountTokenMin,
|
|
123
|
-
amountETHMin,
|
|
124
|
-
wallet.address,
|
|
125
|
-
deadline,
|
|
126
|
+
token, amountTokenDesired, amountTokenMin, amountETHMin, wallet.address, deadline,
|
|
126
127
|
]);
|
|
127
128
|
const addLiqTx = await wallet.signTransaction({
|
|
128
129
|
to: DSWAP_V2_ROUTER,
|
|
@@ -139,13 +140,7 @@ export async function addLiquidityETHForSubmit(params) {
|
|
|
139
140
|
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
140
141
|
const profitAmount = calculateProfitAmount(amountETHDesired, PROFIT_BPS) + profitTxGasCost;
|
|
141
142
|
if (profitAmount > 0n) {
|
|
142
|
-
const profitTx = await signProfitTx({
|
|
143
|
-
wallet,
|
|
144
|
-
nonce: currentNonce,
|
|
145
|
-
profitAmount,
|
|
146
|
-
maxFeePerGas,
|
|
147
|
-
maxPriorityFeePerGas,
|
|
148
|
-
});
|
|
143
|
+
const profitTx = await signProfitTx({ wallet, nonce: currentNonce, profitAmount, maxFeePerGas, maxPriorityFeePerGas });
|
|
149
144
|
signedTxs.push(profitTx);
|
|
150
145
|
}
|
|
151
146
|
return { signedTransactions: signedTxs };
|
|
@@ -170,7 +165,7 @@ export async function removeLiquidityETHForSubmit(params) {
|
|
|
170
165
|
const pair = new Contract(pairAddr, DSWAP_V2_PAIR_ABI, provider);
|
|
171
166
|
let liquidity = params.liquidity;
|
|
172
167
|
if (liquidity === 0n) {
|
|
173
|
-
liquidity =
|
|
168
|
+
liquidity = await pair.balanceOf(wallet.address);
|
|
174
169
|
if (liquidity === 0n)
|
|
175
170
|
throw new Error('No LP tokens to remove');
|
|
176
171
|
}
|
|
@@ -182,8 +177,8 @@ export async function removeLiquidityETHForSubmit(params) {
|
|
|
182
177
|
const isToken0 = token.toLowerCase() === token0.toLowerCase();
|
|
183
178
|
const reserveToken = isToken0 ? reserves[0] : reserves[1];
|
|
184
179
|
const reserveETH = isToken0 ? reserves[1] : reserves[0];
|
|
185
|
-
const amountTokenExpected =
|
|
186
|
-
const amountETHExpected =
|
|
180
|
+
const amountTokenExpected = reserveToken * liquidity / totalSupply;
|
|
181
|
+
const amountETHExpected = reserveETH * liquidity / totalSupply;
|
|
187
182
|
const amountTokenMin = applySlippage(amountTokenExpected, slippage);
|
|
188
183
|
const amountETHMin = applySlippage(amountETHExpected, slippage);
|
|
189
184
|
let currentNonce = await wallet.getNonce();
|
|
@@ -203,12 +198,7 @@ export async function removeLiquidityETHForSubmit(params) {
|
|
|
203
198
|
signedTxs.push(approveTx);
|
|
204
199
|
}
|
|
205
200
|
const removeLiqData = routerIface.encodeFunctionData('removeLiquidityETHSupportingFeeOnTransferTokens', [
|
|
206
|
-
token,
|
|
207
|
-
liquidity,
|
|
208
|
-
amountTokenMin,
|
|
209
|
-
amountETHMin,
|
|
210
|
-
wallet.address,
|
|
211
|
-
deadline,
|
|
201
|
+
token, liquidity, amountTokenMin, amountETHMin, wallet.address, deadline,
|
|
212
202
|
]);
|
|
213
203
|
const removeLiqTx = await wallet.signTransaction({
|
|
214
204
|
to: DSWAP_V2_ROUTER,
|
|
@@ -225,13 +215,7 @@ export async function removeLiquidityETHForSubmit(params) {
|
|
|
225
215
|
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
226
216
|
const profitAmount = calculateProfitAmount(amountETHExpected, PROFIT_BPS) + profitTxGasCost;
|
|
227
217
|
if (profitAmount > 0n) {
|
|
228
|
-
const profitTx = await signProfitTx({
|
|
229
|
-
wallet,
|
|
230
|
-
nonce: currentNonce,
|
|
231
|
-
profitAmount,
|
|
232
|
-
maxFeePerGas,
|
|
233
|
-
maxPriorityFeePerGas,
|
|
234
|
-
});
|
|
218
|
+
const profitTx = await signProfitTx({ wallet, nonce: currentNonce, profitAmount, maxFeePerGas, maxPriorityFeePerGas });
|
|
235
219
|
signedTxs.push(profitTx);
|
|
236
220
|
}
|
|
237
221
|
return { signedTransactions: signedTxs };
|
|
@@ -250,10 +234,7 @@ export async function addLiquidityForSubmit(params) {
|
|
|
250
234
|
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
251
235
|
let currentNonce = await wallet.getNonce();
|
|
252
236
|
const signedTxs = [];
|
|
253
|
-
for (const [token, amount] of [
|
|
254
|
-
[tokenA, amountADesired],
|
|
255
|
-
[tokenB, amountBDesired],
|
|
256
|
-
]) {
|
|
237
|
+
for (const [token, amount] of [[tokenA, amountADesired], [tokenB, amountBDesired]]) {
|
|
257
238
|
const erc20 = new Contract(token, ERC20_ABI, provider);
|
|
258
239
|
const allowance = await erc20.allowance(wallet.address, DSWAP_V2_ROUTER);
|
|
259
240
|
if (allowance < amount) {
|
|
@@ -273,14 +254,7 @@ export async function addLiquidityForSubmit(params) {
|
|
|
273
254
|
const amountAMin = applySlippage(amountADesired, slippage);
|
|
274
255
|
const amountBMin = applySlippage(amountBDesired, slippage);
|
|
275
256
|
const addLiqData = routerIface.encodeFunctionData('addLiquidity', [
|
|
276
|
-
tokenA,
|
|
277
|
-
tokenB,
|
|
278
|
-
amountADesired,
|
|
279
|
-
amountBDesired,
|
|
280
|
-
amountAMin,
|
|
281
|
-
amountBMin,
|
|
282
|
-
wallet.address,
|
|
283
|
-
deadline,
|
|
257
|
+
tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin, wallet.address, deadline,
|
|
284
258
|
]);
|
|
285
259
|
const addLiqTx = await wallet.signTransaction({
|
|
286
260
|
to: DSWAP_V2_ROUTER,
|
|
@@ -316,7 +290,7 @@ export async function removeLiquidityForSubmit(params) {
|
|
|
316
290
|
const pair = new Contract(pairAddr, DSWAP_V2_PAIR_ABI, provider);
|
|
317
291
|
let liquidity = params.liquidity;
|
|
318
292
|
if (liquidity === 0n) {
|
|
319
|
-
liquidity =
|
|
293
|
+
liquidity = await pair.balanceOf(wallet.address);
|
|
320
294
|
if (liquidity === 0n)
|
|
321
295
|
throw new Error('No LP tokens to remove');
|
|
322
296
|
}
|
|
@@ -328,8 +302,8 @@ export async function removeLiquidityForSubmit(params) {
|
|
|
328
302
|
const isAToken0 = tokenA.toLowerCase() === token0.toLowerCase();
|
|
329
303
|
const reserveA = isAToken0 ? reserves[0] : reserves[1];
|
|
330
304
|
const reserveB = isAToken0 ? reserves[1] : reserves[0];
|
|
331
|
-
const amountAMin = applySlippage(
|
|
332
|
-
const amountBMin = applySlippage(
|
|
305
|
+
const amountAMin = applySlippage(reserveA * liquidity / totalSupply, slippage);
|
|
306
|
+
const amountBMin = applySlippage(reserveB * liquidity / totalSupply, slippage);
|
|
333
307
|
let currentNonce = await wallet.getNonce();
|
|
334
308
|
const signedTxs = [];
|
|
335
309
|
const lpAllowance = await pair.allowance(wallet.address, DSWAP_V2_ROUTER);
|
|
@@ -347,13 +321,7 @@ export async function removeLiquidityForSubmit(params) {
|
|
|
347
321
|
signedTxs.push(approveTx);
|
|
348
322
|
}
|
|
349
323
|
const removeLiqData = routerIface.encodeFunctionData('removeLiquidity', [
|
|
350
|
-
tokenA,
|
|
351
|
-
tokenB,
|
|
352
|
-
liquidity,
|
|
353
|
-
amountAMin,
|
|
354
|
-
amountBMin,
|
|
355
|
-
wallet.address,
|
|
356
|
-
deadline,
|
|
324
|
+
tokenA, tokenB, liquidity, amountAMin, amountBMin, wallet.address, deadline,
|
|
357
325
|
]);
|
|
358
326
|
const removeLiqTx = await wallet.signTransaction({
|
|
359
327
|
to: DSWAP_V2_ROUTER,
|
|
@@ -9,5 +9,5 @@ export type { LaunchParams, FairLaunchTokenInfo, FairLaunchQueryConfig, FairLaun
|
|
|
9
9
|
export { LP_FAIR_LAUNCHER_ADDRESS, TOKEN_FACTORY_ADDRESS, POOL_FACTORY_ADDRESS, RATE_BASE, DEAD_ADDRESS, QUOTE_TOKENS, DEFAULT_LOCK_TIME, DEFAULT_RELEASE_PERIOD, DEFAULT_INITIAL_LP, } from './constants.js';
|
|
10
10
|
export { standardPreset, liquidityProvidingPreset, dividendPreset, dividendBuybackPreset, deflationaryPreset, validateLaunchParams, detectLaunchType, } from './presets.js';
|
|
11
11
|
export { FairLauncherQuery, encodeLaunchTokenCall, launchToken, launchTokenForSubmit, setTokenTradeStartTime, setTokenTradeStartTimeForSubmit, } from './launcher.js';
|
|
12
|
-
export { FairPoolQuery, claimFromPool, claimFromPoolForSubmit, batchClaimForSubmit } from './pool.js';
|
|
13
|
-
export type { PoolOverview, PoolClaimParams, PoolClaimResult } from './pool.js';
|
|
12
|
+
export { FairPoolQuery, claimFromPool, claimFromPoolForSubmit, batchClaimForSubmit, } from './pool.js';
|
|
13
|
+
export type { PoolOverview, PoolClaimParams, PoolClaimResult, } from './pool.js';
|
|
@@ -23,4 +23,4 @@ export { FairLauncherQuery, encodeLaunchTokenCall, launchToken, launchTokenForSu
|
|
|
23
23
|
// ============================================================================
|
|
24
24
|
// 池 (Pool)
|
|
25
25
|
// ============================================================================
|
|
26
|
-
export { FairPoolQuery, claimFromPool, claimFromPoolForSubmit, batchClaimForSubmit } from './pool.js';
|
|
26
|
+
export { FairPoolQuery, claimFromPool, claimFromPoolForSubmit, batchClaimForSubmit, } from './pool.js';
|