/** * PayGate Client Types * Type definitions for the PayGate x402 payment client */ import { Keypair } from '@solana/web3.js'; /** * Supported payment currencies */ export type PaymentCurrency = 'USDC' | 'ATHR'; /** * Product types available on PayGate */ export type ProductType = 'content_link' | 'api_proxy' | 'feature_unlock' | 'iot_endpoint'; /** * PayGate client configuration */ export interface PayGateClientConfig { /** Base URL of the PayGate server */ baseUrl: string; /** Optional wallet keypair for signing payments */ wallet?: Keypair; /** Default currency for purchases (defaults to USDC) */ defaultCurrency?: PaymentCurrency; /** Request timeout in milliseconds (defaults to 30000) */ timeout?: number; } /** * Product information returned from PayGate */ export interface Product { id: string; title: string; description: string; type: ProductType; price: string; currency: string; network: string; status: string; } /** * Payment requirements from x402 402 response */ export interface PaymentRequirements { scheme: string; network: string; recipient: string; amount: string; currency: string; tokenMint: string; productId: string; maxTimeoutSeconds?: number; resource?: string; description?: string; } /** * Full x402 payment response (402 status) */ export interface X402Response { status: 402; accepts: PaymentRequirements[]; error?: string; } /** * Pricing option for a product */ export interface PricingOption { currency: PaymentCurrency; amount: string; tokenMint: string; discount?: number; } /** * Pricing response from PayGate */ export interface PricingResponse { productId: string; options: PricingOption[]; } /** * Verification request payload */ export interface VerifyRequest { productId: string; amount: string; currency: PaymentCurrency; payerWallet: string; } /** * Verification response from PayGate */ export interface VerifyResponse { isValid: boolean; invalidReason?: string; requirements?: PaymentRequirements; } /** * Settlement request payload */ export interface SettleRequest { paymentHeader: string; productId: string; } /** * Settlement response from PayGate */ export interface SettleResponse { success: boolean; txHash?: string; deliveryUrl?: string; error?: string; } /** * Purchase options */ export interface PurchaseOptions { /** Currency to use for payment */ currency?: PaymentCurrency; /** Custom amount (overrides product price) */ amount?: number; } /** * Result of a successful purchase */ export interface PurchaseResult { transactionHash: string; productId: string; amount: string; currency: string; deliveryUrl: string; } /** * Content delivery result */ export interface ContentResult { product: { id: string; title: string; type: ProductType; }; downloadUrl: string | null; accessToken: string | undefined; purchaseDate: string; } /** * Delivery response from PayGate */ export interface DeliveryResponse { productId: string; product: { id: string; title: string; type: ProductType; }; downloadUrl: string | null; accessToken?: string; purchaseDate: string; expiresAt?: string; } /** * Purchase history entry */ export interface PurchaseHistoryEntry { productId: string; title: string; type: ProductType; amount: string; currency: string; transactionHash: string; purchaseDate: string; status: 'completed' | 'pending' | 'failed'; } /** * Purchase history response */ export interface PurchaseHistoryResponse { wallet: string; purchases: PurchaseHistoryEntry[]; total: number; } //# sourceMappingURL=types.d.ts.map