import EventEmitter from 'eventemitter3'; import { BlockchainConfig } from './blockchain.service'; import { WalletSession } from './session.service'; import { PriceServiceConfig } from './price.service'; import { IPFSConfig } from './ipfs.service'; /** * PMT Gateway - Fully Decentralized Payment Gateway SDK * * 100% client-side, serverless payment processing * All interactions happen directly from browser to: * - Smart contracts (via ethers.js) * - IPFS (via Pinata) * - Price oracles (via CoinGecko) * * NO BACKEND REQUIRED! */ 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; } 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 */ 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 */ registerMerchant(businessName: string, profile: any): Promise; /** * Get merchant details */ getMerchant(merchantAddress: string): Promise; /** * Create session for wallet */ createSession(walletAddress: string, merchantId: string, chainId?: string): WalletSession; /** * Get current session */ getSession(): WalletSession | null; /** * Delete session */ logout(): void; /** * Get current crypto price */ getPrice(currency: string): number | null; /** * Convert fiat to crypto */ convertToCrypto(amount: number, fiatCurrency: string): string; /** * Convert crypto to fiat */ convertToFiat(cryptoAmount: string, fiatCurrency: string): number; /** * Update prices manually */ 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.d.ts.map