export { Tool } from '@mastra/core/tools'; /** * @agentwallet/mastra-plugin — Shared Types * * All types used across tools. Zod schemas are defined inline in each tool file; * these are the TypeScript interfaces for config and internal state. */ /** Spend limits enforced at the SDK layer (before any on-chain tx) */ interface SpendLimits { /** Max USDC per single transaction (in whole USDC, not wei) */ perTxLimitUsdc: number; /** Max USDC total spend per day (rolling 24h window) */ dailyLimitUsdc: number; } /** Plugin configuration passed to createAgentWalletTools */ interface AgentWalletConfig { /** Agent's private key — never logged, never sent over network */ privateKey: string; /** Custom RPC URL (defaults to Base Mainnet public RPC) */ rpcUrl?: string; /** Spend limits — enforced before any on-chain operation */ spendLimits?: SpendLimits; /** Network (defaults to mainnet = Base Mainnet) */ network?: 'mainnet' | 'testnet'; } /** Standard error shape returned by all tools — never throws */ interface ToolError { success: false; error: string; code: ToolErrorCode; } /** Standard success shape — tools return either success or ToolError */ interface ToolSuccess { success: true; data: T; } type ToolResult = ToolSuccess | ToolError; type ToolErrorCode = 'INVALID_CONFIG' | 'INVALID_INPUT' | 'SPEND_LIMIT_EXCEEDED' | 'INSUFFICIENT_BALANCE' | 'NETWORK_ERROR' | 'SDK_ERROR' | 'NOT_SUPPORTED' | 'UNKNOWN'; /** Daily spend tracker — ephemeral, resets on plugin restart */ declare class DailySpendTracker { private spentToday; private windowStart; private readonly windowMs; /** Record a spend. Returns false if it would exceed the daily limit. */ checkAndRecord(amountUsdc: number, limitUsdc: number): boolean; getSpentToday(): number; getWindowResetMs(): number; } /** * agentwallet-mastra-plugin * * Non-custodial wallet + x402 payments + spend limits for Mastra AI agents. * Add complete payment capability to any Mastra agent in one line. * * @example * ```typescript * import { createAgentWalletTools } from 'agentwallet-mastra-plugin'; * import { Agent } from '@mastra/core'; * * const agent = new Agent({ * name: 'PayingAgent', * instructions: 'You can make payments using your wallet.', * model: openai('gpt-4o'), * tools: createAgentWalletTools({ privateKey: process.env.AGENT_PRIVATE_KEY }), * }); * ``` */ /** * Creates all 10 AgentWallet tools configured for use with a Mastra agent. * * @param config - Wallet configuration including private key, optional RPC URL, and spend limits. * @returns A Record of tool instances ready to pass to `new Agent({ tools: ... })`. * * @example * ```typescript * const tools = createAgentWalletTools({ * privateKey: process.env.AGENT_PRIVATE_KEY!, * spendLimits: { perTxLimitUsdc: 10, dailyLimitUsdc: 100 }, * network: 'mainnet', * }); * ``` */ declare function createAgentWalletTools(config: AgentWalletConfig): Record; export { type AgentWalletConfig, DailySpendTracker, type SpendLimits, type ToolError, type ToolResult, type ToolSuccess, createAgentWalletTools };