UNPKG

@efe136/legacychain-sdk

Version:

Official SDK for interacting with LegacyChain smart contracts and APIs

1,091 lines (1,072 loc) 31.4 kB
import { EventEmitter } from 'eventemitter3'; import { ethers } from 'ethers'; declare enum PlanType { FREE = "FREE", STARTER = "STARTER", PRO = "PRO", ENTERPRISE = "ENTERPRISE" } interface RateLimits { requests: { perMinute: number; perHour: number; perDay: number; }; capsules: { maxPerMonth: number; maxStorage: number; }; features: { encryption: boolean; multiSignature: boolean; advancedAnalytics: boolean; customBranding: boolean; prioritySupport: boolean; webhooks: boolean; }; } declare const PLAN_LIMITS: Record<PlanType, RateLimits>; interface SDKConfig { apiKey: string; network?: 'mainnet' | 'testnet' | 'devnet'; rpcUrl?: string; ipfsGateway?: string; pinataJwt?: string; debug?: boolean; cache?: { enabled: boolean; ttl?: number; }; retry?: { attempts: number; delay: number; }; } interface TimeCapsule { id: string; ipfsHash: string; unlockTime: Date; authorizedAddresses: string[]; isUnlocked: boolean; metadata?: CapsuleMetadata; createdAt: Date; updatedAt: Date; } interface CapsuleMetadata { title: string; description: string; type: 'text' | 'file' | 'mixed'; encrypted: boolean; fileCount?: number; totalSize?: number; tags?: string[]; } interface CreateCapsuleInput { title: string; description: string; content: string | File | File[]; unlockTime: Date; authorizedAddresses?: string[]; encrypt?: boolean; password?: string; metadata?: Record<string, any>; } interface PaymentCapsule { id: string; sender: string; recipient: string; amount: string; token: 'ETH' | 'USDC' | 'USDT' | 'DAI'; unlockTime: Date; status: 'pending' | 'claimable' | 'claimed' | 'refunded'; message?: string; encrypted?: boolean; createdAt: Date; claimedAt?: Date; } interface CreatePaymentInput { recipient: string; amount: string; token: 'ETH' | 'USDC' | 'USDT' | 'DAI'; unlockTime: Date; message?: string; encrypt?: boolean; password?: string; } interface LegalDocument { id: string; documentHash: string; documentType: 'NDA' | 'CONTRACT' | 'WILL' | 'AGREEMENT' | 'CERTIFICATE'; creator: string; signers: SignerInfo[]; requiredSignatures: number; status: 'draft' | 'pending' | 'active' | 'expired' | 'destroyed'; effectiveDate: Date; expiryDate?: Date; selfDestruct?: SelfDestructConfig; metadata?: LegalMetadata; createdAt: Date; updatedAt: Date; } interface SignerInfo { address: string; signed: boolean; signature?: string; signedAt?: Date; name?: string; email?: string; } interface SelfDestructConfig { type: 'time' | 'views' | 'manual'; value?: number | Date; currentViews?: number; } interface LegalMetadata { title: string; parties: string[]; jurisdiction?: string; encrypted: boolean; fileType: string; fileSize: number; checksum: string; } interface CreateLegalDocumentInput { file: File; documentType: LegalDocument['documentType']; signers: string[]; requiredSignatures?: number; effectiveDate?: Date; expiryDate?: Date; selfDestruct?: SelfDestructConfig; encrypt?: boolean; password?: string; metadata?: Record<string, any>; } interface ApiResponse<T> { success: boolean; data?: T; error?: ApiError; metadata?: { timestamp: number; requestId: string; rateLimit?: { limit: number; remaining: number; reset: number; }; }; } interface ApiError { code: string; message: string; details?: any; } interface SDKEvents { 'capsule:created': (capsule: TimeCapsule) => void; 'capsule:unlocked': (capsuleId: string) => void; 'payment:created': (payment: PaymentCapsule) => void; 'payment:claimed': (paymentId: string) => void; 'document:created': (document: LegalDocument) => void; 'document:signed': (documentId: string, signer: string) => void; 'rateLimit:exceeded': (limit: RateLimits) => void; 'error': (error: ApiError) => void; } interface PaginationParams { page?: number; limit?: number; sortBy?: string; sortOrder?: 'asc' | 'desc'; } interface PaginatedResponse<T> { items: T[]; total: number; page: number; limit: number; hasNext: boolean; hasPrev: boolean; } interface CapsuleFilters { status?: 'locked' | 'unlocked'; type?: 'time' | 'payment' | 'legal'; createdAfter?: Date; createdBefore?: Date; creator?: string; search?: string; } interface AnalyticsData { totalCapsules: number; totalPayments: number; totalDocuments: number; storageUsed: number; activeUsers: number; monthlyGrowth: number; topCategories: Array<{ type: string; count: number; percentage: number; }>; } interface WebhookConfig { url: string; events: string[]; secret?: string; active: boolean; } interface WebhookPayload { event: string; data: any; timestamp: number; signature?: string; } declare enum SpecializedCapsuleType { FILM = "FILM", CREATOR_MESSAGE = "CREATOR_MESSAGE", MYSTERY_TRAIT = "MYSTERY_TRAIT", VIP_ACCESS = "VIP_ACCESS", ART_PROVENANCE = "ART_PROVENANCE", VOTING = "VOTING", MUSIC = "MUSIC", ACHIEVEMENT = "ACHIEVEMENT", EDUCATIONAL = "EDUCATIONAL", MEMORY = "MEMORY" } interface SpecializedCapsule { id: string; type: SpecializedCapsuleType; owner: string; metadata: Record<string, any>; createdAt: Date; updatedAt: Date; } interface CreateFilmCapsuleInput { recipient: string; title: string; director: string; premiereDate: Date; trailerURI: string; encryptedFilmURI: string; posterURI?: string; } interface CreateCreatorMessageInput { recipient: string; creator: string; message?: string; encryptedMessage?: string; publicTeaser: string; revealTime: Date; encrypt?: boolean; password?: string; } interface CreateMysteryTraitInput { recipient: string; name: string; hiddenTraits: string[]; unlockTimes: Date[]; } interface CreateVIPAccessInput { recipient: string; eventId: string; description: string; encryptedAccessData: string; expiryTime: Date; usageLimit: number; } interface CreateArtProvenanceInput { recipient: string; artist: string; baseArtworkURI: string; layerURIs: string[]; layerDescriptions: string[]; revealTimes: Date[]; } interface CreateVotingCapsuleInput { voter: string; proposalTitle: string; options: string[]; endTime: Date; voteWeight: number; } interface CreateMusicCapsuleInput { recipient: string; trackTitle: string; artist: string; encryptedTrackURI: string; previewURI: string; releaseDate: Date; } interface CreateAchievementCapsuleInput { player: string; achievementName: string; tiers: string[]; requirements: number[]; rewards: string[]; } interface CreateEducationalCapsuleInput { student: string; courseName: string; modules: string[]; unlockDays: number[]; contentURIs: string[]; } interface CreateMemoryCapsuleInput { recipient: string; title: string; encryptedMemoryURI: string; unlockTime: Date; inheritors: string[]; } declare class TimeCapsuleService { private client; private contractAddress; constructor(client: LegacyChainClient$2); create(input: CreateCapsuleInput): Promise<TimeCapsule>; get(capsuleId: string): Promise<TimeCapsule>; list(params?: PaginationParams & { filters?: CapsuleFilters; }): Promise<PaginatedResponse<TimeCapsule>>; unlock(capsuleId: string, password?: string): Promise<any>; addAuthorizedAddress(capsuleId: string, address: string): Promise<void>; removeAuthorizedAddress(capsuleId: string, address: string): Promise<void>; isAuthorized(capsuleId: string, address: string): Promise<boolean>; private fileToBase64; } declare class PaymentService { private client; private contractAddress; constructor(client: LegacyChainClient$2); create(input: CreatePaymentInput): Promise<PaymentCapsule>; claim(paymentId: string): Promise<void>; refund(paymentId: string): Promise<void>; get(paymentId: string): Promise<PaymentCapsule>; list(params?: PaginationParams): Promise<PaginatedResponse<PaymentCapsule>>; getBalance(token: 'ETH' | 'USDC' | 'USDT' | 'DAI'): Promise<string>; private getTokenAddress; private approveToken; decryptMessage(payment: PaymentCapsule, password: string): Promise<string>; } declare class LegalDocumentService { private client; private contractAddress; constructor(client: LegacyChainClient$2); create(input: CreateLegalDocumentInput): Promise<LegalDocument>; sign(documentId: string, signature: string): Promise<void>; generateSignature(documentId: string): Promise<string>; get(documentId: string): Promise<LegalDocument>; list(params?: PaginationParams): Promise<PaginatedResponse<LegalDocument>>; recordView(documentId: string): Promise<void>; destroy(documentId: string): Promise<void>; downloadDocument(document: LegalDocument, password?: string): Promise<Blob>; verifyDocument(documentId: string): Promise<boolean>; private configureSelfDestruct; private fileToBase64; private calculateChecksum; } declare class AnalyticsService { private client; constructor(client: LegacyChainClient$2); /** * Get analytics overview * Basic: Only totals and current month data * Advanced: Historical data, trends, and detailed breakdowns */ getOverview(): Promise<AnalyticsData>; /** * Get capsule analytics * Basic: Count and basic stats * Advanced: Detailed metrics, user behavior, time patterns */ getCapsuleAnalytics(options?: { startDate?: Date; endDate?: Date; groupBy?: 'day' | 'week' | 'month'; }): Promise<any>; /** * Get payment analytics (Advanced only) */ getPaymentAnalytics(options?: { startDate?: Date; endDate?: Date; groupBy?: 'day' | 'week' | 'month'; currency?: string; }): Promise<any>; /** * Get user behavior analytics (Advanced only) */ getUserBehaviorAnalytics(): Promise<any>; /** * Get retention analytics (Advanced only) */ getRetentionAnalytics(options?: { cohortPeriod?: 'day' | 'week' | 'month'; lookbackDays?: number; }): Promise<any>; /** * Get funnel analytics (Advanced only) */ getFunnelAnalytics(funnelId: string): Promise<any>; /** * Get real-time analytics (Advanced only) */ getRealTimeAnalytics(): Promise<any>; /** * Basic analytics: Track simple events */ trackEvent(eventName: string, properties?: Record<string, any>): Promise<void>; /** * Advanced analytics: Create custom dashboards */ createCustomDashboard(config: { name: string; widgets: Array<{ type: 'chart' | 'metric' | 'table' | 'heatmap'; dataSource: string; configuration: Record<string, any>; }>; }): Promise<any>; /** * Export analytics data (Advanced only) */ exportData(options: { format: 'csv' | 'json' | 'excel'; startDate: Date; endDate: Date; metrics: string[]; }): Promise<string>; /** * Get AI-powered insights (Advanced only) */ getInsights(options?: { focus?: 'growth' | 'retention' | 'engagement' | 'revenue'; timeframe?: 'week' | 'month' | 'quarter'; }): Promise<any>; /** * Check if user has access to advanced analytics */ private checkAdvancedAnalyticsAccess; /** * Filter analytics data based on plan */ private filterAnalyticsByPlan; } declare class IPFSService { private gateway; private pinataJwt?; private pinataUrl; constructor(gateway?: string, pinataJwt?: string); uploadFile(file: File, metadata?: Record<string, any>): Promise<string>; uploadJSON(data: any, name: string, metadata?: Record<string, any>): Promise<string>; retrieveFile(ipfsHash: string): Promise<Blob>; retrieveJSON<T = any>(ipfsHash: string): Promise<T>; unpin(ipfsHash: string): Promise<boolean>; getGatewayUrl(ipfsHash: string): string; setGateway(gateway: string): void; } declare class WebhookService { private client; constructor(client: LegacyChainClient$2); /** * Register a new webhook */ create(config: Omit<WebhookConfig, 'active'>): Promise<WebhookConfig>; /** * List all webhooks */ list(): Promise<WebhookConfig[]>; /** * Get a specific webhook */ get(webhookId: string): Promise<WebhookConfig>; /** * Update webhook configuration */ update(webhookId: string, updates: Partial<WebhookConfig>): Promise<WebhookConfig>; /** * Delete a webhook */ delete(webhookId: string): Promise<boolean>; /** * Test a webhook by sending a test payload */ test(webhookId: string): Promise<boolean>; /** * Verify webhook signature (for receiving webhooks) */ verifySignature(payload: string, signature: string, secret: string): boolean; /** * Get webhook delivery logs */ getDeliveryLogs(webhookId: string, options?: { limit?: number; offset?: number; status?: 'success' | 'failed'; }): Promise<{ logs: Array<{ id: string; timestamp: number; status: 'success' | 'failed'; statusCode?: number; duration: number; error?: string; }>; total: number; }>; /** * Retry a failed webhook delivery */ retryDelivery(webhookId: string, deliveryId: string): Promise<boolean>; /** * Available webhook events */ static readonly EVENTS: { readonly CAPSULE_CREATED: "capsule.created"; readonly CAPSULE_UNLOCKED: "capsule.unlocked"; readonly CAPSULE_UPDATED: "capsule.updated"; readonly CAPSULE_DELETED: "capsule.deleted"; readonly PAYMENT_CREATED: "payment.created"; readonly PAYMENT_CLAIMED: "payment.claimed"; readonly PAYMENT_REFUNDED: "payment.refunded"; readonly PAYMENT_EXPIRED: "payment.expired"; readonly DOCUMENT_CREATED: "document.created"; readonly DOCUMENT_SIGNED: "document.signed"; readonly DOCUMENT_COMPLETED: "document.completed"; readonly DOCUMENT_EXPIRED: "document.expired"; readonly DOCUMENT_DESTROYED: "document.destroyed"; readonly ACCOUNT_UPGRADED: "account.upgraded"; readonly ACCOUNT_DOWNGRADED: "account.downgraded"; readonly API_KEY_CREATED: "api_key.created"; readonly API_KEY_REVOKED: "api_key.revoked"; readonly RATE_LIMIT_EXCEEDED: "rate_limit.exceeded"; readonly STORAGE_LIMIT_REACHED: "storage_limit.reached"; }; } interface MultiSigProposal { id: string; capsuleId: string; requiredSignatures: number; signers: string[]; signatureCount: number; executed: boolean; expiryTime: Date; data: any; signatures: Array<{ signer: string; signedAt: Date; }>; } interface CreateMultiSigInput { capsuleId: string; signers: string[]; requiredSignatures: number; action: 'unlock' | 'transfer' | 'update' | 'custom'; data?: any; duration?: number; } declare class MultiSigService { private client; constructor(client: LegacyChainClient$2); /** * Check if multi-signature is available for the current plan */ private checkMultiSigAccess; /** * Create a multi-signature proposal */ createProposal(input: CreateMultiSigInput): Promise<MultiSigProposal>; /** * Sign a multi-signature proposal */ signProposal(proposalId: string): Promise<MultiSigProposal>; /** * Get a specific proposal */ getProposal(proposalId: string): Promise<MultiSigProposal>; /** * List proposals for a capsule */ listProposals(capsuleId: string, options?: { status?: 'pending' | 'executed' | 'expired'; limit?: number; offset?: number; }): Promise<{ proposals: MultiSigProposal[]; total: number; }>; /** * Execute a proposal (if threshold is met) */ executeProposal(proposalId: string): Promise<{ success: boolean; transactionHash?: string; }>; /** * Cancel a proposal (only by capsule owner) */ cancelProposal(proposalId: string): Promise<boolean>; /** * Add signers to a capsule */ addSigners(capsuleId: string, signers: string[]): Promise<boolean>; /** * Remove signers from a capsule */ removeSigners(capsuleId: string, signers: string[]): Promise<boolean>; /** * Update signature threshold */ updateThreshold(capsuleId: string, requiredSignatures: number): Promise<boolean>; /** * Get multi-sig configuration for a capsule */ getConfiguration(capsuleId: string): Promise<{ signers: string[]; requiredSignatures: number; activeProposals: number; }>; /** * Batch sign multiple proposals */ batchSign(proposalIds: string[]): Promise<{ signed: string[]; failed: Array<{ proposalId: string; error: string; }>; }>; } interface SupportTicket { id: string; subject: string; description: string; priority: 'low' | 'medium' | 'high' | 'urgent'; status: 'open' | 'in_progress' | 'resolved' | 'closed'; category: 'technical' | 'billing' | 'feature_request' | 'bug' | 'other'; createdAt: Date; updatedAt: Date; resolvedAt?: Date; assignee?: string; messages: SupportMessage[]; } interface SupportMessage { id: string; ticketId: string; sender: 'user' | 'support'; message: string; attachments?: string[]; createdAt: Date; } interface SLAMetrics { responseTime: { target: number; current: number; withinSLA: boolean; }; resolutionTime: { target: number; average: number; withinSLA: boolean; }; satisfaction: { score: number; responses: number; }; } declare class SupportService { private client; constructor(client: LegacyChainClient$2); /** * Get support priority based on plan */ private getSupportPriority; /** * Create a support ticket */ createTicket(input: { subject: string; description: string; category: SupportTicket['category']; attachments?: File[]; }): Promise<SupportTicket>; /** * Get support tickets */ getTickets(options?: { status?: SupportTicket['status']; limit?: number; offset?: number; }): Promise<{ tickets: SupportTicket[]; total: number; }>; /** * Get a specific ticket */ getTicket(ticketId: string): Promise<SupportTicket>; /** * Reply to a ticket */ replyToTicket(ticketId: string, message: string, attachments?: File[]): Promise<SupportMessage>; /** * Close a ticket */ closeTicket(ticketId: string): Promise<boolean>; /** * Rate support experience */ rateSupport(ticketId: string, rating: 1 | 2 | 3 | 4 | 5, feedback?: string): Promise<boolean>; /** * Get SLA metrics (Enterprise only) */ getSLAMetrics(): Promise<SLAMetrics>; /** * Request dedicated support session (Enterprise only) */ requestDedicatedSession(input: { topic: string; preferredTime: Date; duration: 30 | 60; type: 'call' | 'screen_share' | 'in_person'; }): Promise<{ sessionId: string; scheduledTime: Date; meetingLink?: string; }>; /** * Get support availability */ getAvailability(): Promise<{ isAvailable: boolean; nextAvailable?: Date; averageResponseTime: number; }>; /** * Access knowledge base */ searchKnowledgeBase(query: string): Promise<Array<{ id: string; title: string; excerpt: string; category: string; url: string; helpful: number; notHelpful: number; }>>; } interface BrandingConfig { companyName: string; logo: { light: string; dark: string; favicon?: string; }; colors: { primary: string; secondary: string; accent: string; background: string; text: string; }; fonts: { heading: string; body: string; }; customCSS?: string; emailTemplates?: { header?: string; footer?: string; styles?: string; }; whiteLabel: { hideLegacyChainBranding: boolean; customDomain?: string; customEmailDomain?: string; }; } interface BrandedWidget { id: string; type: 'capsule_form' | 'payment_widget' | 'document_viewer' | 'analytics_dashboard'; config: Record<string, any>; embedCode: string; } declare class BrandingService { private client; constructor(client: LegacyChainClient$2); /** * Check if custom branding is available */ private checkBrandingAccess; /** * Get current branding configuration */ getBranding(): Promise<BrandingConfig | null>; /** * Update branding configuration */ updateBranding(config: Partial<BrandingConfig>): Promise<BrandingConfig>; /** * Upload logo */ uploadLogo(file: File, type: 'light' | 'dark' | 'favicon'): Promise<string>; /** * Create branded widget */ createWidget(input: { type: BrandedWidget['type']; config: Record<string, any>; }): Promise<BrandedWidget>; /** * Get widget embed code */ getWidgetEmbedCode(widgetId: string): Promise<string>; /** * Preview branding changes */ previewBranding(config: Partial<BrandingConfig>): Promise<{ previewUrl: string; expiresAt: Date; }>; /** * Set up custom domain (Enterprise only) */ setupCustomDomain(domain: string): Promise<{ success: boolean; dnsRecords: Array<{ type: 'A' | 'CNAME' | 'TXT'; name: string; value: string; }>; verificationStatus: 'pending' | 'verified' | 'failed'; }>; /** * Verify custom domain */ verifyCustomDomain(domain: string): Promise<{ verified: boolean; issues?: string[]; }>; /** * Generate branded mobile app (Enterprise only) */ generateMobileApp(config: { platforms: Array<'ios' | 'android'>; appName: string; bundleId: string; version: string; }): Promise<{ buildId: string; status: 'queued' | 'building' | 'completed' | 'failed'; downloadUrls?: { ios?: string; android?: string; }; }>; /** * Get brand guidelines */ getBrandGuidelines(): Promise<{ documentUrl: string; assets: Array<{ name: string; type: string; url: string; }>; }>; } declare class SpecializedCapsuleService { private client; private contractAddress; constructor(client: LegacyChainClient$2); createFilmCapsule(input: CreateFilmCapsuleInput): Promise<SpecializedCapsule>; createCreatorMessageCapsule(input: CreateCreatorMessageInput): Promise<SpecializedCapsule>; createMysteryTraitCapsule(input: CreateMysteryTraitInput): Promise<SpecializedCapsule>; createVIPAccessCapsule(input: CreateVIPAccessInput): Promise<SpecializedCapsule>; createArtProvenanceCapsule(input: CreateArtProvenanceInput): Promise<SpecializedCapsule>; createVotingCapsule(input: CreateVotingCapsuleInput): Promise<SpecializedCapsule>; createMusicCapsule(input: CreateMusicCapsuleInput): Promise<SpecializedCapsule>; createAchievementCapsule(input: CreateAchievementCapsuleInput): Promise<SpecializedCapsule>; createEducationalCapsule(input: CreateEducationalCapsuleInput): Promise<SpecializedCapsule>; createMemoryCapsule(input: CreateMemoryCapsuleInput): Promise<SpecializedCapsule>; getCapsule(capsuleId: string): Promise<SpecializedCapsule>; listCapsules(params?: PaginationParams & { type?: SpecializedCapsuleType; }): Promise<PaginatedResponse<SpecializedCapsule>>; unlockTrait(capsuleId: string, traitIndex: number): Promise<void>; useVIPAccess(capsuleId: string): Promise<string>; castVote(capsuleId: string, optionIndex: number): Promise<void>; } declare class CryptoService { private encoder; private decoder; encrypt(text: string, password: string): Promise<{ encrypted: string; salt: string; iv: string; }>; decrypt(encryptedData: string, password: string, salt: string, iv: string): Promise<string>; hashPassword(password: string): Promise<string>; generatePassword(length?: number): string; generateKeyPair(): Promise<{ publicKey: string; privateKey: string; }>; private deriveKey; private arrayBufferToBase64; private base64ToArrayBuffer; } declare class LegacyChainClient$2 extends EventEmitter<SDKEvents> { private config; private httpClient; private rateLimiter; private queue; private logger; timeCapsules: TimeCapsuleService; payments: PaymentService; legalDocuments: LegalDocumentService; analytics: AnalyticsService; ipfs: IPFSService; crypto: CryptoService; webhooks: WebhookService; multiSig: MultiSigService; support: SupportService; branding: BrandingService; specializedCapsules: SpecializedCapsuleService; private publicClient; private walletClient; private provider?; private signer?; constructor(config: SDKConfig); private initializeWeb3Clients; connectWallet(ethereum: any): Promise<void>; private getPlanTypeFromApiKey; private getApiBaseUrl; makeRequest<T>(method: 'GET' | 'POST' | 'PUT' | 'DELETE', endpoint: string, data?: any, options?: any): Promise<ApiResponse<T>>; getPublicClient(): any; getWalletClient(): any; getProvider(): ethers.Provider | undefined; getSigner(): ethers.Signer; getRateLimits(): RateLimits; getPlanType(): PlanType; getConfig(): { apiKey: string; network?: "mainnet" | "testnet" | "devnet"; rpcUrl?: string; ipfsGateway?: string; pinataJwt?: string; debug?: boolean; cache?: { enabled: boolean; ttl?: number; }; retry?: { attempts: number; delay: number; }; }; updateConfig(newConfig: Partial<SDKConfig>): void; destroy(): void; } declare class Logger { private debug; constructor(debug?: boolean); log(message: string, ...args: any[]): void; error(message: string, error?: any): void; warn(message: string, ...args: any[]): void; info(message: string, ...args: any[]): void; } interface PaymentRecord { txHash: string; payer: string; amount: string; token: string; plan: PlanType; duration: number; timestamp: number; expiresAt: number; verified: boolean; } interface PlanPricing { monthly: string; yearly: string; token: 'ETH' | 'USDC'; } declare class PaymentVerificationService { private provider; private paymentRecords; private apiKeyToAddress; private addressToPlan; private static PLAN_PRICING; private static PAYMENT_ADDRESS; constructor(provider?: ethers.Provider); /** * Verify a payment transaction and activate the plan */ verifyPayment(txHash: string, expectedPlan: PlanType, duration?: number): Promise<boolean>; /** * Get the current plan for an API key */ getPlanForApiKey(apiKey: string): PlanType; /** * Link an API key to a wallet address */ linkApiKeyToAddress(apiKey: string, address: string): void; /** * Get payment history for an address */ getPaymentHistory(address: string): PaymentRecord[]; /** * Get pricing information */ static getPricing(): Record<PlanType, PlanPricing>; /** * Generate a payment request */ generatePaymentRequest(plan: PlanType, duration?: number): { to: string; amount: string; token: string; data: string; }; /** * Check if a plan is active */ isPlanActive(address: string): boolean; /** * Get days until plan expires */ getDaysUntilExpiry(address: string): number; private initializeMockData; } declare class RateLimiter { private cache; private planType; private paymentService; constructor(planType?: PlanType, paymentService?: PaymentVerificationService); checkLimit(userId: string): Promise<{ allowed: boolean; retryAfter?: number; }>; checkCapsuleLimit(userId: string): Promise<{ allowed: boolean; remaining: number; }>; incrementCapsuleCount(userId: string): Promise<void>; checkStorageLimit(userId: string, sizeInMB: number): Promise<{ allowed: boolean; remaining: number; }>; incrementStorage(userId: string, sizeInMB: number): Promise<void>; getRemainingLimits(userId: string): RateLimits; changePlan(newPlan: PlanType): void; reset(userId: string): void; getPlanInfo(userId: string): { plan: PlanType; daysRemaining: number; isActive: boolean; }; private getAddressForApiKey; private getOrCreateState; middleware(): (req: any, res: any, next: any) => Promise<void>; } declare const VERSION = "1.0.0"; var LegacyChainClient$1 = LegacyChainClient; export { AnalyticsService, BrandingService, CryptoService, IPFSService, LegacyChainClient$2 as LegacyChainClient, LegalDocumentService, Logger, MultiSigService, PLAN_LIMITS, PaymentService, PlanType, RateLimiter, SpecializedCapsuleService, SpecializedCapsuleType, SupportService, TimeCapsuleService, VERSION, WebhookService, LegacyChainClient$1 as default }; export type { AnalyticsData, ApiError, ApiResponse, CapsuleFilters, CapsuleMetadata, CreateAchievementCapsuleInput, CreateArtProvenanceInput, CreateCapsuleInput, CreateCreatorMessageInput, CreateEducationalCapsuleInput, CreateFilmCapsuleInput, CreateLegalDocumentInput, CreateMemoryCapsuleInput, CreateMusicCapsuleInput, CreateMysteryTraitInput, CreatePaymentInput, CreateVIPAccessInput, CreateVotingCapsuleInput, LegalDocument, LegalMetadata, PaginatedResponse, PaginationParams, PaymentCapsule, RateLimits, SDKConfig, SDKEvents, SelfDestructConfig, SignerInfo, SpecializedCapsule, TimeCapsule, WebhookConfig, WebhookPayload };