import type { PlatformClient } from "./client"; import type { UsdcTopupConfig, UsdcTopupResult, UsdcVerifyRequest, UsdcVerifyResponse } from "./types"; /** * API for Web3 operations including USDC top-up for credits. * * @example * ```typescript * const client = new PlatformClient(); * * // Simple one-liner to top up with USDC - auto-authenticates with wallet * const result = await client.web3.topUp({ * privateKey: process.env.WALLET_PRIVATE_KEY, * amountUsd: 10 // $10 worth of USDC * }); * console.log(`Added ${result.creditsAdded} credits`); * * // Or use the lower-level methods for more control * const config = await client.web3.getUsdcTopupConfig(); * // ... send USDC manually ... * const verifyResult = await client.web3.verifyUsdcTransaction({ txHash: '0x...' }); * ``` */ export declare class Web3API { private client; constructor(client: PlatformClient); /** * Get the configuration for USDC top-up payments. * * Returns the receiver address, USDC contract address, chain ID, and conversion rate * needed to send a USDC payment for credit top-up. * * @returns USDC top-up configuration * * @example * ```typescript * const config = await client.web3.getUsdcTopupConfig(); * // config.receiverAddress - Address to send USDC to * // config.usdcContractAddress - USDC token contract * // config.chainId - Target chain (e.g., 8453 for Base) * // config.network - Network name (e.g., "base") * // config.rateUsdcToCredits - 1 USDC = 100_000_000 credits * ``` */ getUsdcTopupConfig(): Promise; /** * Verify a USDC transaction and add credits to the user's wallet. * * After sending USDC to the receiver address, call this method with the * transaction hash to verify the payment and receive credits. * * For wallet-authenticated users, the sender address is verified automatically. * For email/Google-authenticated users, you must provide a signature proving * ownership of the sending wallet. * * @param params - Verification parameters * @param params.txHash - The transaction hash of the USDC transfer * @param params.payerAddress - (Optional) For non-wallet users: the address that sent the USDC * @param params.signature - (Optional) For non-wallet users: signature over "Verify USDC top-up: {txHash}" * @returns Verification result with credits added * * @example * ```typescript * // For wallet-authenticated users * const result = await client.web3.verifyUsdcTransaction({ * txHash: '0xabc123...' * }); * * // For email/Google-authenticated users * const message = `Verify USDC top-up: ${txHash}`; * const signature = await wallet.signMessage(message); * const result = await client.web3.verifyUsdcTransaction({ * txHash: '0xabc123...', * payerAddress: '0xYourWallet...', * signature * }); * * console.log(`Added ${result.creditsAdded} credits (${result.usdcAmount} USDC)`); * ``` */ verifyUsdcTransaction(params: UsdcVerifyRequest): Promise; /** * Top up credits by sending USDC from your wallet. * * This is a high-level method that handles the entire flow: * 1. Auto-authenticates with wallet if no API key is set * 2. Fetches the USDC top-up configuration * 3. Sends USDC from your wallet to the receiver * 4. Waits for transaction confirmation * 5. Signs a verification message * 6. Verifies the transaction and adds credits * * @param params - Top-up parameters * @param params.privateKey - Wallet private key (or uses WALLET_PRIVATE_KEY env var) * @param params.amountUsd - Amount in USD to top up (e.g., 10 for $10) * @param params.rpcUrl - (Optional) Custom RPC URL for the chain * @returns Top-up result with credits added and transaction details * * @example * ```typescript * // Top up $10 worth of credits - only wallet key needed! * const result = await client.web3.topUp({ * privateKey: process.env.WALLET_PRIVATE_KEY, * amountUsd: 10 * }); * * console.log(`Transaction: ${result.txHash}`); * console.log(`Added ${result.creditsAdded} credits`); * console.log(`USDC spent: ${result.usdcAmount}`); * ``` */ topUp(params: { privateKey?: string; amountUsd: number; rpcUrl?: string; }): Promise; } //# sourceMappingURL=web3-api.d.ts.map