/** * XMTP client wrapper for Clawtomaton. * * Manages the XMTP Agent SDK lifecycle: creation, message streaming, * conversation management, and graceful shutdown. * * The agent's existing Ethereum wallet key is used as the XMTP identity — * no new keypair needed. * * IMPORTANT: XMTP creates local SQLite database files that MUST persist * across restarts. Each restart without the DB creates a new installation, * and you're limited to 10 installations per inbox. */ import type { XmtpConfig, XmtpMessage, XmtpConversationInfo } from './types.js'; import type { StateStore } from '../state/index.js'; export declare class XmtpClient { private agent; private config; private state; private walletKey; private started; private messageQueue; private maxQueueSize; private lastProcessedTime; constructor(config: XmtpConfig, walletKey: `0x${string}`, state: StateStore); /** * Initialize and start the XMTP agent. * Begins streaming messages into the internal queue. */ start(): Promise; /** * Stop the XMTP agent gracefully. */ stop(): Promise; /** * Check if there are unprocessed messages in the queue. * Used by the heartbeat to decide whether to wake the agent. */ hasUnreadMessages(): boolean; /** * Drain all queued messages (marks them as processed). * Returns messages ordered by sentAt. */ drainMessages(): XmtpMessage[]; /** * Peek at queued messages without draining. */ peekMessages(): XmtpMessage[]; /** * Send a text message to a conversation by ID. */ sendMessage(conversationId: string, text: string): Promise; /** * Send a text message to an address (creates DM if needed). * Uses agent.createDmWithAddress() which handles identity resolution. */ sendToAddress(address: string, text: string): Promise; /** * List recent conversations with metadata. */ listConversations(limit?: number): Promise; /** * Get recent messages from a specific conversation. */ getConversationHistory(conversationId: string, limit?: number): Promise; /** * Request an ETH payment from a user via wallet_sendCalls. * The user's wallet app prompts them to approve the transfer. * * @param conversationId - The conversation to send the request in * @param amount - Amount in wei (bigint) * @param description - Human-readable description shown in the wallet prompt * @param chainId - Chain ID (default: 8453 for Base) */ requestEthPayment(conversationId: string, amount: bigint, description: string, chainId?: number): Promise; /** * Request an ERC-20 token payment from a user via wallet_sendCalls. * * @param conversationId - The conversation to send the request in * @param tokenAddress - ERC-20 contract address * @param amount - Raw token amount (bigint, accounting for decimals) * @param description - Human-readable description * @param chainId - Chain ID (default: 8453 for Base) */ requestTokenPayment(conversationId: string, tokenAddress: string, amount: bigint, description: string, chainId?: number): Promise; /** * Send a transaction reference (share a confirmed tx hash in a conversation). * * @param conversationId - The conversation to share in * @param txHash - The transaction hash * @param chainId - Chain ID (default: 8453 for Base) * @param metadata - Optional metadata (currency, amount, addresses) */ sendTransactionReference(conversationId: string, txHash: string, chainId?: number, metadata?: { transactionType?: string; currency?: string; amount?: number; decimals?: number; fromAddress?: string; toAddress?: string; }): Promise; /** * Check an ERC-20 token balance for an address. * * @param tokenAddress - ERC-20 contract address * @param walletAddress - The address to check * @param chainId - Chain ID (default: 8453 for Base) * @returns Raw balance (bigint) and decimals */ getTokenBalance(tokenAddress: string, walletAddress: string, chainId?: number): Promise<{ balance: bigint; decimals: number; }>; /** * Get the XMTP address (same as wallet address). */ getAddress(): string | null; /** * Check if the client is running. */ isStarted(): boolean; /** * Get the number of queued messages. */ getQueueSize(): number; } //# sourceMappingURL=client.d.ts.map