/** * 48.club Bundle 交易服务客户端 * 官方文档: https://docs.48.club/ */ export type BundleParams = { txs: string[]; maxTimestamp?: number; maxBlockNumber?: number; acceptReverting?: string[]; revertingTxHashes?: string[]; soulPointSignature?: string; backrunTarget?: string; noMerge?: boolean; }; export type SoulPointSignatureMode = 'none' | 'timestampPersonalSign' | 'concatTxHash' | 'rawTimestamp'; export type VNormalizationMode = '27_28' | '0_1'; export type BundleStatus = { status: 'INCLUDED' | 'PENDING' | 'FAILED'; includedBlock?: number; hash: string; maxTimestamp: number; transaction: { from: string; gasPrice: string; nonce: number; }; }; export type Club48Config = { endpoint?: string; explorerEndpoint?: string; }; /** * 48.club Bundle 客户端 */ export declare class Club48Client { private endpoint; private explorerEndpoint; constructor(config?: Club48Config); /** * 生成 48 Soul Point 签名 * 用于提升会员等级(Signed Guest 及以上) * * @param privateKey 私钥 * @param txs 已签名的交易数组 * @returns 签名字符串 */ static sign48SoulPoint(privateKey: string, txs: string[]): string; /** * 生成 48SP 签名(timestamp personal_sign 模式) * 常见规则:对当前 Unix 秒级时间戳的字符串做 personal_sign */ static sign48SoulPointTimestamp(privateKey: string, timestamp?: number): Promise; /** * 生成 48SP 签名(rawTimestamp 裸签 keccak(timestampString)) */ static sign48SoulPointRawTimestamp(privateKey: string, timestamp?: number): string; /** * 规范化签名 v 值 * mode = '27_28':将 0/1 规范为 27/28 * mode = '0_1':将 27/28 规范为 0/1 */ static normalizeSignatureV(signature: string, mode?: VNormalizationMode): string; /** * 发送 Bundle(Puissant) * * @param params Bundle 参数 * @returns Bundle UUID */ sendBundle(params: BundleParams, opts?: { spMode?: SoulPointSignatureMode; spPrivateKey?: string; spVMode?: VNormalizationMode; timestamp?: number; }): Promise; /** * 发送私有交易(单笔) * * @param signedTx 已签名的原始交易 * @returns 交易哈希 */ sendPrivateTransaction(signedTx: string): Promise; /** * 发送单笔私有交易(含 48SP) * 文档参考:eth_sendPrivateTransactionWith48SP * 规则:使用私钥对当前 Unix 时间戳字符串 personal_sign,作为 48SoulPointMemberSignature * * @param signedTx 已签名原始交易 * @param spPrivateKey 具有 SoulPoint 会员资格的钱包私钥 * @returns 交易哈希 */ sendPrivateTransactionWith48SP(signedTx: string, spPrivateKey: string, opts?: { spMode?: SoulPointSignatureMode; spVMode?: VNormalizationMode; timestamp?: number; }): Promise; /** * 获取最低 gas price * * @returns 最低 gas price (wei) */ getMinGasPrice(): Promise; /** * 查询 Bundle 状态 * 文档参考:https://docs.48.club/puissant-builder/bundle-submission-and-on-chain-status-query * * @param bundleHash Bundle Hash (从 eth_sendBundle 返回的结果) * @returns Bundle 状态 */ getBundleStatus(bundleHash: string): Promise; /** * 等待 Bundle 完成 * * @param bundleHash Bundle Hash (从 eth_sendBundle 返回的结果) * @param timeout 超时时间(毫秒),默认 60 秒 * @returns Bundle 状态 */ waitForBundle(bundleHash: string, timeout?: number): Promise; } /** * Builder Control EOA(用于提升排序权重的“小费”收款地址) * 文档: https://docs.48.club/puissant-builder/send-bundle */ export declare const BUILDER_CONTROL_EOA = "0x4848489f0b2BEdd788c696e2D79b6b69D7484848"; /** * Auction Feed 订阅(雏形占位) * 说明:48 官方为 WebSocket-RPC 订阅;此处仅预留接口签名,实际网络订阅由上层应用实现 */ export type AuctionFeedCallbacks = { onOpen?: () => void; onMessage?: (data: any) => void; onError?: (err: any) => void; onClose?: () => void; }; export declare function createAuctionFeedClient(wsUrl: string, callbacks: AuctionFeedCallbacks): { connect: () => void; close: () => void; }; /** * 批量私有交易辅助函数 */ export declare function sendBatchPrivateTransactions(signedTxs: string[], spPrivateKey: string, endpoint?: string, opts?: { spMode?: SoulPointSignatureMode; spVMode?: VNormalizationMode; timestamp?: number; }): Promise; /** * 发送 backrun bundle(便捷方法) * - 自动填充 backrunTarget 参数 * - 其他参数透传 * 文档参考: Auction Transaction Feed / SendBundle with backrunTarget */ export declare function sendBackrunBundle(client: Club48Client, params: Omit & { backrunTarget: string; }): Promise;