/** * Storefront client for Space Data Network * * Provides methods for interacting with the SDN marketplace: * - Browse and search listings * - Purchase data access * - Manage subscriptions * - Post reviews */ import type { Listing, AccessGrant, PurchaseRequest, Review, ReviewStats, SearchQuery, SearchResult, CreditsBalance, CreateListingRequest, CreatePurchaseRequest, CreateReviewRequest, PurchaseStatus, PaymentMethod, FiatGatewayRequest, FiatGatewayResult, CreditsTransaction, SellerDashboard, BuyerDashboard, TrustScore } from './types'; /** Storefront client configuration */ export interface StorefrontClientConfig { /** API base URL for server-side operations */ apiBaseUrl?: string; /** PubSub instance for real-time updates */ pubsub?: unknown; /** Peer ID for this client */ peerId: string; /** Signing function for requests */ sign?: (data: Uint8Array) => Promise; /** Encryption public key for receiving data */ encryptionPubkey?: Uint8Array; /** Key algorithm (x25519, secp256k1, p256) */ keyAlgorithm?: string; } /** Storefront events */ export interface StorefrontEvents { 'listing:new': Listing; 'listing:updated': Listing; 'purchase:status': { requestId: string; status: PurchaseStatus; }; 'grant:issued': AccessGrant; 'data:received': { grantId: string; data: Uint8Array; }; } /** Event handler type */ type EventHandler = (event: T) => void; /** * Storefront client for interacting with SDN marketplace */ export declare class StorefrontClient { private config; private eventHandlers; constructor(config: StorefrontClientConfig); /** * Search for listings */ searchListings(query: SearchQuery): Promise; /** * Get a listing by ID */ getListing(listingId: string): Promise; /** * Create a new listing (for providers) */ createListing(request: CreateListingRequest): Promise; /** * Update a listing */ updateListing(listingId: string, updates: Partial): Promise; /** * Deactivate a listing */ deactivateListing(listingId: string): Promise; /** * Create a purchase request */ createPurchase(request: CreatePurchaseRequest): Promise; /** * Confirm a crypto payment */ confirmCryptoPayment(requestId: string, txHash: string, chain: string): Promise; /** * Pay with SDN credits */ payWithCredits(requestId: string): Promise; /** * Get purchase status */ getPurchaseStatus(requestId: string): Promise; /** * Get access grants for the current buyer */ getMyGrants(): Promise; /** * Get a specific grant */ getGrant(grantId: string): Promise; /** * Create a review */ createReview(request: CreateReviewRequest): Promise; /** * Get reviews for a listing */ getListingReviews(listingId: string, limit?: number, offset?: number): Promise<{ reviews: Review[]; stats: ReviewStats; }>; /** * Vote on a review's helpfulness */ voteReview(reviewId: string, helpful: boolean): Promise; /** * Get credits balance */ getCreditsBalance(): Promise; /** * Purchase credits (returns payment intent or address) */ purchaseCredits(amount: number, paymentMethod: PaymentMethod): Promise<{ paymentTarget: string; }>; /** * Subscribe to real-time events */ on(event: K, handler: EventHandler): void; /** * Unsubscribe from events */ off(event: K, handler: EventHandler): void; /** * Initiate a fiat payment via Stripe gateway */ createFiatPayment(requestId: string, req: FiatGatewayRequest): Promise; /** * Get credits transaction history */ getCreditsTransactions(limit?: number, offset?: number): Promise; /** * Subscribe to a data delivery stream for a grant */ subscribeToDelivery(grantId: string): Promise; /** * Get the seller dashboard data */ getSellerDashboard(): Promise; /** * Get the buyer dashboard data */ getBuyerDashboard(): Promise; /** * Respond to a review (as a provider) */ respondToReview(reviewId: string, response: string): Promise; /** * Get provider trust score */ getProviderTrust(peerId: string): Promise; /** * Start listening for PubSub messages */ startListening(): Promise; /** * Stop listening */ stopListening(): Promise; /** * Emit an event to registered handlers */ private emit; } /** * Create a storefront client */ export declare function createStorefrontClient(config: StorefrontClientConfig): StorefrontClient; export {}; //# sourceMappingURL=client.d.ts.map