four-flap-meme-sdk
Version:
SDK for Flap bonding curve and four.meme TokenManager
94 lines (93 loc) • 8.4 kB
JavaScript
// ============================================================================
// 公共 ABI(统一管理)
// ============================================================================
export * as Abis from './abis/index.js';
export { ERC20_ABI, ERC20_BALANCE_ABI, ERC20_ALLOWANCE_ABI, MULTICALL3_ABI, V2_ROUTER_ABI, V2_ROUTER_QUOTE_ABI, V3_ROUTER02_ABI, V3_ROUTER_LEGACY_ABI, V3_QUOTER_ABI, V2_FACTORY_ABI, V2_PAIR_ABI, V3_FACTORY_ABI, V3_POOL_ABI, FLAP_PORTAL_ABI, TM2_ABI, HELPER3_ABI, } from './abis/common.js';
// ============================================================================
// 公共常量(统一管理)
// ============================================================================
export { ADDRESSES, CHAIN, BLOCKRAZOR_BUILDER_EOA as BUILDER_EOA, ZERO_ADDRESS as COMMON_ZERO_ADDRESS, DEFAULT_DEADLINE_MINUTES, V3_FEE_TIERS as COMMON_V3_FEE_TIERS, } from './utils/constants.js';
export { isExclusiveOnChain, isExclusiveOffChain } from './utils/mpcExclusive.js';
export {
// Four.meme V1 授权
ensureSellApprovalV1, checkSellApprovalV1,
// Four.meme V2 授权
ensureSellApprovalV2, checkSellApprovalV2,
// Four.meme 通用授权(默认 V2)
ensureSellApproval, checkSellApproval,
// Flap Protocol 授权
ensureFlapSellApproval, checkFlapSellApproval, ensureFlapSellApprovalBatch, checkFlapSellApprovalBatch,
// ✅ 智能路由授权方法(自动选择 spender,适用于 Flap、Four、V2、V3)
checkAllowance, approveToken, checkAllowanceBatch, approveTokenBatch,
// ✅ 底层授权方法(手动指定 spender,适用于任意合约)
checkAllowanceRaw, approveTokenRaw, checkAllowanceBatchRaw, approveTokenBatchRaw } from './utils/erc20.js';
export { parseFourError } from './utils/errors.js';
export { getTokenManagerV1, getTokenManagerV2, getTokenManagerHelper3, getTokenManagerV1Writer, getTokenManagerV2Writer, getTokenManagerHelper3Writer, getTokenManagerAddress } from './utils/contract-factory.js';
export { FourClient, buildLoginMessage } from './clients/four.js';
export { createTokenOnChain, tryBuy, trySell, buyTokenWithFunds, sellToken, tradeBuy, tradeSell } from './contracts/tm.js';
export { TM1 } from './contracts/tm1.js';
export { TM2 } from './contracts/tm2.js';
export { Helper3, Helper3Writer } from './contracts/helper3.js';
export { CDPV2 } from './flap/curve.js';
export { FlapPortal, FlapPortalWriter, TokenStatus, TokenVersion, DexThreshType, MigratorType } from './flap/portal.js';
export { uploadTokenMeta } from './flap/ipfs.js';
export { buildPermitPiggybackAuto } from './flap/permit.js';
export { predictVanityTokenAddressByChain, findSaltEndingByChain } from './flap/vanity.js';
export { FLAP_DEFAULT_FEE_RATES, FLAP_IPFS_API_URL, FLAP_VANITY_SUFFIX, FLAP_DEX_THRESHOLDS, FLAP_TOTAL_SUPPLY, ZERO_ADDRESS, CHAIN_TAX_SUPPORT, getVanitySuffix, isChainSupportTax } from './flap/constants.js';
export { parseFlapError, getFlapErrorMessage, getFlapErrorMessageEn } from './flap/errors.js';
export { getFlapMetaByAddress, getFlapMetasByAddresses } from './flap/meta.js';
export { createTokenFlow } from './flows/create.js';
export { Club48Client, sendBatchPrivateTransactions, sendBackrunBundle } from './clients/club48.js';
export { MerkleClient, createMerkleClient } from './clients/merkle.js';
export { BlockRazorClient, createBlockRazorClient, BLOCKRAZOR_BUILDER_EOA } from './clients/blockrazor.js';
export { NonceManager, getOptimizedGasPrice, estimateGasWithSafety, estimateGasBatch, buildTransaction, signTransactionsBatch, signTransactionsBatchMultiWallet, validateSignedTransactions, getDeadline, encodeV3Path, decodeV3Path, getGasLimit, getGasPriceConfig, getTxType, getChainId, } from './utils/bundle-helpers.js';
export { createTokenWithBundleBuy as fourCreateTokenWithBundleBuy, batchBuyWithBundle as fourBatchBuyWithBundle, batchSellWithBundle as fourBatchSellWithBundle } from './contracts/tm-bundle.js';
export { createTokenWithBundleBuy as flapCreateTokenWithBundleBuy, batchBuyWithBundle as flapBatchBuyWithBundle, batchSellWithBundle as flapBatchSellWithBundle } from './flap/portal-bundle.js';
export { fourPrivateBuy, fourPrivateSell, fourBatchPrivateBuy, fourBatchPrivateSell } from './contracts/tm-bundle.js';
export { flapPrivateBuy, flapPrivateSell, flapBatchPrivateBuy, flapBatchPrivateSell } from './flap/portal-bundle.js';
export { createTokenWithBundleBuyMerkle as flapCreateTokenWithBundleBuyMerkle, batchBuyWithBundleMerkle as flapBatchBuyWithBundleMerkle, batchSellWithBundleMerkle as flapBatchSellWithBundleMerkle, flapPrivateBuyMerkle, flapPrivateSellMerkle, flapBatchPrivateBuyMerkle, flapBatchPrivateSellMerkle, pancakeProxyBatchBuyMerkle, pancakeProxyBatchSellMerkle, approvePancakeProxy, approvePancakeProxyBatch, flapDisperseWithBundleMerkle, flapSweepWithBundleMerkle } from './flap/portal-bundle-merkle/index.js';
export { createTokenWithBundleBuyMerkle as fourCreateTokenWithBundleBuyMerkle, batchBuyWithBundleMerkle as fourBatchBuyWithBundleMerkle, batchSellWithBundleMerkle as fourBatchSellWithBundleMerkle, fourPrivateBuyMerkle, fourPrivateSellMerkle, fourBatchPrivateBuyMerkle, fourBatchPrivateSellMerkle, disperseWithBundleMerkle, sweepWithBundleMerkle, fourPancakeProxyBatchBuyMerkle, fourPancakeProxyBatchSellMerkle, approveFourPancakeProxy, approveFourPancakeProxyBatch, approveFourTokenManagerBatch, submitBundleToMerkle, submitMultipleBundles, submitMultipleBundlesParallel, submitBundleToBlockRazor, submitMultipleBundlesToBlockRazor, submitMultipleBundlesToBlockRazorParallel } from './contracts/tm-bundle-merkle/index.js';
export { PinataClient } from './flap/pinata.js';
export { pinFileToIPFSWithJWT, pinImageByPath, pinFileToIPFSWithJWTWeb, pinDataURLWithJWTWeb, dataURLToBlob } from './flap/pinata.js';
export { generateWallets } from './utils/wallet.js';
export { getTokenBalancesWithMulticall } from './utils/wallet.js';
export { validatePrivateKeys } from './utils/wallet.js';
export { stealthTransfer } from './utils/stealth-transfer.js';
// ✅ 刷持有人(一键完成:生成钱包 → 分发资金 → 批量买入)
export { holdersMaker, estimateHoldersMakerCost, } from './utils/holders-maker.js';
// ✅ 私募转账签名(带贿赂和利润提取)
export { privateSaleMerkle, batchPrivateSaleMerkle, } from './utils/private-sale.js';
export { inspectTokenLP, getFactoryFromRouter, registerDYORSwap, registerDex, getChainConfig, } from './utils/lp-inspect.js';
export { disperseWithBundle, sweepWithBundle } from './utils/airdrop-sweep.js';
// ============================================================
// 捆绑换手功能(Bundle Swap)
// ============================================================
// Four内盘换手
export { fourBundleSwapMerkle, fourBatchSwapMerkle, fourQuickBatchSwapMerkle } from './contracts/tm-bundle-merkle/swap.js';
// Flap内盘换手
export { flapBundleSwapMerkle, flapBatchSwapMerkle, flapQuickBatchSwapMerkle } from './flap/portal-bundle-merkle/swap.js';
// PancakeSwap V2/V3通用换手
export { pancakeBundleSwapMerkle, pancakeBatchSwapMerkle, pancakeQuickBatchSwapMerkle } from './pancake/bundle-swap.js';
// 先买后卖(Buy-First)入口
export { fourBundleBuyFirstMerkle } from './contracts/tm-bundle-merkle/swap-buy-first.js';
export { flapBundleBuyFirstMerkle } from './flap/portal-bundle-merkle/swap-buy-first.js';
export { pancakeBundleBuyFirstMerkle } from './pancake/bundle-buy-first.js';
// ✅ 硬编码利润配置(统一管理)
export { PROFIT_CONFIG } from './utils/constants.js';
// ✅ V2/V3 报价工具(统一管理)
export { quoteV2, quoteV3, quote, getTokenToNativeQuote, getNativeToTokenQuote, getWrappedNativeAddress, getStableCoins, V3_FEE_TIERS, QUOTE_CONFIG, } from './utils/quote-helpers.js';
// ✅ Monad 等不支持 Bundle 的链:逐笔 RPC 广播方法(服务器端使用)
export { submitDirectToRpc, submitDirectToRpcSequential, // ✅ 新增:顺序广播并等待确认(用于多跳)
submitDirectToRpcParallel } from './contracts/tm-bundle-merkle/submit.js';
// ============================================================
// ✅ DEX 直接交易(不走代理合约)
// ============================================================
export {
// V2 直接交易
directV2BatchBuy, directV2BatchSell,
// V3 直接交易
directV3BatchBuy, directV3BatchSell,
// 辅助函数
getRouterAddress,
// 常量
DIRECT_ROUTERS, } from './dex/index.js';