/** * PMT Gateway Web3 SDK - 100% Decentralized & Secure * * ✅ 100% client-side, serverless payment processing * ✅ No centralized services (Chainlink oracles, browser IPFS) * ✅ Cryptographically secure sessions (Web Crypto API) * ✅ Comprehensive input validation * ✅ Structured error handling * ✅ Type-safe throughout * * All interactions happen directly from browser to: * - Smart contracts (ethers.js) * - IPFS network (public gateways + local storage) * - On-chain price oracles (Chainlink) * * NO BACKEND, NO API KEYS, NO CENTRALIZED SERVICES! */ import EventEmitter from 'eventemitter3'; import { BlockchainConfig } from './blockchain.service'; import { WalletSession } from './session.service.secure'; import { PriceServiceConfig } from './price.service.web3'; import { IPFSConfig } from './ipfs.service.web3'; export interface PMTGatewayWeb3Config { blockchain: BlockchainConfig; ipfs?: IPFSConfig; priceOracle?: PriceServiceConfig; rateLimiting?: { enabled?: boolean; payment?: { maxRequests: number; windowMs: number; }; general?: { maxRequests: number; windowMs: number; }; }; session?: { persistent?: boolean; ttl?: number; }; events?: { autoStart?: boolean; }; } export interface CreatePaymentOptions { merchant: string; amount: number; currency: string; expirationSeconds?: number; description?: string; metadata?: Record; storeOnIPFS?: boolean; } export interface PaymentResult { paymentId: string; txHash: string; amount: string; currency: string; ipfsHash?: string; } /** * 100% Web3 Payment Gateway SDK * * Fully decentralized, secure, and type-safe */ export declare class PMTGatewayWeb3 extends EventEmitter { private blockchain; private priceService; private ipfsService; private paymentRateLimiter; private generalRateLimiter; private config; private initialized; constructor(config: PMTGatewayWeb3Config); /** * Initialize the SDK with wallet connection */ initialize(): Promise; /** * Initialize read-only mode (no wallet required) */ initializeReadOnly(): Promise; /** * Create a payment with full validation and error handling */ createPayment(options: CreatePaymentOptions): Promise; /** * Release payment (merchant receives funds) */ releasePayment(paymentId: string): Promise; /** * Refund payment (return funds to buyer) */ refundPayment(paymentId: string): Promise; /** * Dispute payment */ disputePayment(paymentId: string): Promise; /** * Get payment details */ getPayment(paymentId: string): Promise; /** * Get all payments for a merchant */ getMerchantPayments(merchantAddress: string): Promise; /** * Get all payments for a buyer */ getBuyerPayments(buyerAddress: string): Promise; /** * Register merchant on-chain with validation */ registerMerchant(businessName: string, profile: any): Promise; /** * Get merchant details with IPFS profile */ getMerchant(merchantAddress: string): Promise; /** * Create session for wallet with cryptographically secure token */ createSession(walletAddress: string, merchantId: string, chainId?: string): Promise; /** * Get current session */ getSession(): WalletSession | null; /** * Delete session */ logout(): void; /** * Get current crypto price (from Chainlink oracle) */ getPrice(currency: string): Promise; /** * Convert fiat to crypto (using Chainlink oracle) */ convertToCrypto(amount: number, fiatCurrency: string): Promise; /** * Convert crypto to fiat (using Chainlink oracle) */ convertToFiat(cryptoAmount: string, fiatCurrency: string): Promise; /** * Update prices manually (from Chainlink) */ updatePrices(): Promise; /** * Check if on correct network */ isCorrectNetwork(): Promise; /** * Get network info */ getNetworkInfo(): Promise<{ chainId: number; name: string; }>; /** * Start monitoring blockchain events */ startEventMonitoring(): Promise; /** * Stop monitoring blockchain events */ stopEventMonitoring(): void; /** * Disconnect and cleanup */ disconnect(): void; private setupBlockchainEventListeners; private ensureInitialized; private generateExternalId; /** * Static factory method */ static create(config: PMTGatewayWeb3Config, readOnly?: boolean): Promise; } //# sourceMappingURL=pmt-gateway-web3.secure.d.ts.map