UNPKG

@agentauth/mcp

Version:

Universal payment-enabled MCP gateway for AI agents with native x402 protocol support.

120 lines 3.6 kB
import { ethers } from 'ethers'; /** * Core wallet service for AgentAuth MCP Gateway * Handles address derivation, balance checking, transaction signing and submission */ export declare class WalletService { private currentProvider; private wallet; private currentChainId; private baseWallet; constructor(agentAuthToken: string, rpcUrl?: string, chainId?: number); /** * Derive private key from AgentAuth token * Handles aa-, 0x, and raw hex formats */ private derivePrivateKey; /** * Get the wallet's Ethereum address */ getAddress(): string; /** * Configure wallet for specific chain * Enables zero-configuration setup based on payment requirements */ configureForChain(chainId: number): void; /** * Get ETH balance in ETH units */ getEthBalance(): Promise<string>; /** * Get ERC-20 token balance * @param tokenAddress Contract address of the token * @param decimals Token decimals (default 18) */ getTokenBalance(tokenAddress: string, decimals?: number): Promise<string>; /** * Get USDC balance (6 decimals) * Uses current chain's USDC contract address */ getUsdcBalance(): Promise<string>; /** * Get USDC contract address for current chain */ getUsdcContractAddress(): string; /** * Get current chain ID */ getCurrentChainId(): number | null; /** * Check if wallet is configured for any chain */ isConfigured(): boolean; /** * Estimate gas for a transaction */ estimateGas(txRequest: ethers.TransactionRequest): Promise<string>; /** * Get current gas price (returns in wei as bigint) */ getGasPrice(): Promise<bigint>; /** * Get current transaction count (nonce) */ getTransactionCount(): Promise<number>; /** * Get wallet balances (ETH and USDC) */ getWalletBalances(): Promise<{ address: string; eth: string; usdc: string; }>; /** * Calculate estimated transaction cost in ETH */ estimateTxCost(txRequest: ethers.TransactionRequest): Promise<string>; /** * Sign a transaction */ signTransaction(txRequest: ethers.TransactionRequest): Promise<string>; /** * Submit a signed transaction to the blockchain */ submitTransaction(signedTx: string): Promise<string>; /** * Sign and submit a transaction in one step */ signAndSubmitTransaction(txRequest: ethers.TransactionRequest): Promise<string>; /** * Sign EIP-712 typed data (for x402 exact scheme EIP-3009 authorization) */ signTypedData(domain: { name: string; version: string; chainId: number; verifyingContract: string; }, types: Record<string, Array<{ name: string; type: string; }>>, message: Record<string, any>): Promise<string>; /** * Wait for transaction confirmation */ waitForTransaction(txHash: string, confirmations?: number): Promise<ethers.TransactionReceipt | null>; /** * Get transaction receipt */ getTransactionReceipt(txHash: string): Promise<ethers.TransactionReceipt | null>; /** * Validate that the wallet has sufficient balance for a transaction */ validateSufficientBalance(txRequest: ethers.TransactionRequest): Promise<{ sufficient: boolean; currentBalance: string; required: string; error?: string; details?: any; }>; } //# sourceMappingURL=walletService.d.ts.map