import EventEmitter from 'eventemitter3'; /** * Blockchain Service - Client-Side Smart Contract Interactions * * This service enables direct interaction with PMT Gateway smart contracts * from the browser, eliminating the need for a backend server. */ export interface BlockchainConfig { rpcUrl: string; escrowContractAddress: string; merchantRegistryAddress: string; subscriptionContractAddress: string; chainId?: number; } export interface PaymentEventData { paymentId: string; buyer: string; merchant: string; amount: string; externalId?: string; txHash: string; } export declare class BlockchainService extends EventEmitter { private provider; private escrowContract; private merchantRegistryContract; private subscriptionContract; private config; private isMonitoring; private static ESCROW_ABI; private static MERCHANT_REGISTRY_ABI; private static SUBSCRIPTION_ABI; constructor(config: BlockchainConfig); /** * Initialize blockchain connection with browser wallet */ initializeWithWallet(): Promise; /** * Initialize blockchain connection with RPC provider (read-only) */ initializeWithRPC(): Promise; /** * Initialize smart contract instances */ private initializeContracts; /** * Get signer for transactions */ private getSigner; /** * Create escrow payment on-chain */ createEscrowPayment(merchant: string, amount: string, expirationSeconds: number, externalId: string): Promise<{ paymentId: string; txHash: string; }>; /** * Release escrow payment */ releasePayment(paymentId: string): Promise; /** * Refund escrow payment */ refundPayment(paymentId: string): Promise; /** * Dispute escrow payment */ disputePayment(paymentId: string): Promise; /** * Get payment details from blockchain */ 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, ipfsHash: string): Promise; /** * Get merchant details from blockchain */ getMerchant(merchantAddress: string): Promise; /** * Create subscription on-chain */ createSubscription(merchant: string, amountPerPeriod: string, interval: number, trialPeriod: number, initialPayment: string): Promise<{ subscriptionId: string; txHash: string; }>; /** * Cancel subscription */ cancelSubscription(subscriptionId: string): Promise; /** * Start monitoring blockchain events */ startEventMonitoring(): Promise; /** * Stop monitoring blockchain events */ stopEventMonitoring(): void; /** * Get current network info */ getNetworkInfo(): Promise<{ chainId: number; name: string; }>; /** * Check if connected to correct network */ isCorrectNetwork(): Promise; /** * Disconnect and cleanup */ disconnect(): void; } //# sourceMappingURL=blockchain.service.d.ts.map