/** * Flap Portal — 写操作(writer) */ import { FlapPortal } from './reader.js'; import type { PortalConfig, ExactInputParams, ExactInputV3Params, NewTokenV3Params, NewTokenV4Params, NewTokenV5Params } from './types.js'; export declare class FlapPortalWriter extends FlapPortal { private wallet; constructor(cfg: PortalConfig, privateKey: string); buy(token: string, to: string, minAmount: bigint, msgValue: bigint): Promise; sell(token: string, amount: bigint, minEth: bigint): Promise; swapExactInput(params: ExactInputParams, msgValue?: bigint): Promise; swapExactInputBuy(params: ExactInputParams, msgValue?: bigint): Promise; swapExactInputSell(params: ExactInputParams): Promise; swapExactInputV3(params: ExactInputV3Params, msgValue?: bigint): Promise; newTokenV2(args: { name: string; symbol: string; meta: string; dexThresh: number; salt: string; taxRate: number; migratorType: number; quoteToken: string; quoteAmt: bigint; beneficiary: string; permitData?: string; msgValue?: bigint; }): Promise; newTokenV3(args: NewTokenV3Params & { msgValue?: bigint; }): Promise; /** * 创建代币 V4 版本 * 相比 V3 新增了 DEX 选择和 LP 费率配置 * * @param args 创建代币参数 * @param args.dexId DEX ID,选择迁移到哪个 DEX(使用 DEXId 枚举) * @param args.lpFeeProfile LP 费率档位(使用 V3LPFeeProfile 枚举) * * @example * ```typescript * await portal.newTokenV4({ * name: 'My Token', * symbol: 'MTK', * meta: 'bafkreicwlkpvrcqg4bbhyp2fnhdwbqos5ghka6gdjra3tdkgxxs74hqsze', * dexThresh: DexThreshType.FOUR_FIFTHS, * salt: '0x...', * taxRate: 0, * migratorType: MigratorType.V3_MIGRATOR, * quoteToken: '0x0000000000000000000000000000000000000000', * quoteAmt: 0n, * beneficiary: '0x...', * extensionID: '0x0000000000000000000000000000000000000000000000000000000000000000', * dexId: DEXId.DEX0, * lpFeeProfile: V3LPFeeProfile.LP_FEE_PROFILE_STANDARD, * msgValue: parseEther('0.01'), * }); * ``` * * @note BNB 链上使用 LP_FEE_PROFILE_LOW (0.01%) 需要白名单地址 */ newTokenV4(args: NewTokenV4Params & { msgValue?: bigint; }): Promise; /** * 创建 Token V5(支持 Tax Token V2 高级税收分配) * * 当 taxRate > 0 时,支持以下税收分配: * - mktBps: 营销分配(发送到 beneficiary 地址) * - deflationBps: 通缩销毁(直接销毁) * - dividendBps: 持有者分红(发送到分红合约) * - lpBps: 流动性提供(LP 发送到 dead address) * * 注意:mktBps + deflationBps + dividendBps + lpBps 必须等于 10000 (100%) * * @example * ```typescript * // 创建一个 3% 税率的代币,税收分配:40% 营销,30% 销毁,20% 分红,10% 流动性 * await portal.newTokenV5({ * name: 'My Tax Token', * symbol: 'MTT', * meta: 'bafkrei...', * dexThresh: DexThreshType.FOUR_FIFTHS, * salt: '0x...', * taxRate: 300, // 3% * migratorType: MigratorType.V2_MIGRATOR, // 税代币必须使用 V2 迁移器 * quoteToken: '0x0000000000000000000000000000000000000000', * quoteAmt: 0n, * beneficiary: '0x...', * extensionID: '0x0000000000000000000000000000000000000000000000000000000000000000', * dexId: DEXId.DEX0, * lpFeeProfile: V3LPFeeProfile.LP_FEE_PROFILE_STANDARD, * taxDuration: 365n * 24n * 60n * 60n, // 1 年 * antiFarmerDuration: 60n * 60n, // 1 小时 * mktBps: 4000, // 40% * deflationBps: 3000, // 30% * dividendBps: 2000, // 20% * lpBps: 1000, // 10% * minimumShareBalance: 10000n * 10n ** 18n, // 10K 代币 * msgValue: parseEther('0.01'), * }); * ``` * * @note 税代币(taxRate > 0)必须使用 V2_MIGRATOR */ newTokenV5(args: NewTokenV5Params & { msgValue?: bigint; }): Promise; claim(token: string): Promise<{ txHash: string; tokenAmount: bigint; ethAmount: bigint; }>; delegateClaim(token: string): Promise<{ txHash: string; tokenAmount: bigint; ethAmount: bigint; }>; /** * 获取当前使用的 Portal 合约地址 * 用于事件监听等场景 */ getContractAddress(): string; }