UNPKG

four-flap-meme-sdk

Version:

SDK for Flap bonding curve and four.meme TokenManager

137 lines (136 loc) 3.83 kB
/** * Four.meme 内盘捆绑换手(Merkle Bundle) * * 功能:钱包A卖出代币 → 钱包B买入相同数量 → 原子执行 */ import { CommonBundleConfig } from '../../utils/bundle-helpers.js'; export interface FourSwapSignConfig { rpcUrl: string; gasLimit?: number | bigint; gasLimitMultiplier?: number; minGasPriceGwei?: number; maxGasPriceGwei?: number; txType?: 0 | 2; chainId?: number; reserveGasBNB?: number; bribeAmount?: number; } export interface FourSwapConfig extends CommonBundleConfig { apiKey: string; customRpcUrl?: string; bundleBlockOffset?: number; reserveGasBNB?: number; waitForConfirmation?: boolean; waitTimeoutMs?: number; skipApprovalCheck?: boolean; } export interface FourBundleSwapSignParams { sellerPrivateKey: string; sellAmount?: string; sellPercentage?: number; buyerPrivateKey: string; tokenAddress: string; config: FourSwapSignConfig; startNonces?: number[]; } export interface FourBundleSwapParams { sellerPrivateKey: string; sellAmount?: string; sellPercentage?: number; buyerPrivateKey: string; tokenAddress: string; config: FourSwapConfig; } /** * ✅ Swap 结果(简化版) */ export type FourSwapResult = { signedTransactions: string[]; metadata?: { sellerAddress: string; buyerAddress: string; sellAmount: string; buyAmount: string; hasApproval?: boolean; profitAmount?: string; }; }; /** * Four内盘捆绑换手 */ export declare function fourBundleSwapMerkle(params: FourBundleSwapSignParams): Promise<FourSwapResult>; /** * Four 批量换手参数(一卖多买) */ export interface FourBatchSwapSignParams { sellerPrivateKey: string; sellAmount?: string; sellPercentage?: number; buyerPrivateKeys: string[]; buyerRatios?: number[]; tokenAddress: string; config: FourSwapSignConfig; startNonces?: number[]; } /** * Four 批量换手结果 */ export interface FourBatchSwapResult { signedTransactions: string[]; metadata?: { sellerAddress: string; buyerAddresses: string[]; sellAmount: string; buyAmounts: string[]; hasApproval?: boolean; profitAmount?: string; }; } /** * Four 内盘批量换手(一卖多买) * * 功能:主钱包一次卖出 → 多个子钱包同时买入 → 在同一个区块中完成 * 限制:最多 24 个买方(服务器限制 25 笔交易,包含 1 笔利润交易) */ export declare function fourBatchSwapMerkle(params: FourBatchSwapSignParams): Promise<FourBatchSwapResult>; /** * Four 快捷批量换手参数 */ export interface FourQuickBatchSwapSignParams { sellerPrivateKey: string; sellAmount?: string; sellPercentage?: number; buyerPrivateKeys: string[]; buyerRatios?: number[]; buyerAmounts?: string[]; tokenAddress: string; config: FourSwapSignConfig; startNonces?: number[]; } /** * Four 快捷批量换手结果 */ export interface FourQuickBatchSwapResult { signedTransactions: string[]; metadata?: { sellerAddress: string; buyerAddresses: string[]; sellAmount: string; estimatedBNBOut: string; transferAmounts: string[]; profitAmount?: string; }; } /** * Four 内盘快捷批量换手(资金利用率模式) * * 流程:[贿赂] → [卖出] → [转账1, 转账2, ...] → [买入1, 买入2, ...] → [利润] * * 特点: * - 子钱包不需要预先有 BNB * - 资金来自主钱包卖出代币所得 * - 提升资金利用率 * * 限制:最多 23 个买方(2N + 3 ≤ 50) */ export declare function fourQuickBatchSwapMerkle(params: FourQuickBatchSwapSignParams): Promise<FourQuickBatchSwapResult>;