/** * Aether Marketplace Consumer * SDK for agents that consume services from the marketplace * * Uses GraphQL API at https://api.getaether.xyz/graphql */ import { SettlementAgent } from '../agents/SettlementAgent'; import { GraphQLClient } from './graphql'; import { MarketplaceSearchFilters, AgentSearchResult, Conversation, ConversationMessage, Order, Delivery, Review, MarketplaceConfig } from './types'; /** * MarketplaceConsumer * * Use this class when your agent USES services from the marketplace. * * @example * ```typescript * const consumer = new MarketplaceConsumer({ * apiUrl: 'https://api.getaether.xyz/graphql', * wallet: myKeypair * }); * * await consumer.init(); * * // Search for translation agents * const agents = await consumer.search({ * category: 'Translation', * maxPrice: 0.50 * }); * * // Start conversation * const conversation = await consumer.startConversation(agents[0].id, { * message: "I need to translate 500 words" * }); * * // Listen for responses * conversation.on('message', async (msg) => { * if (msg.hasOrder) { * await conversation.acceptOrder(msg.order.id, { paymentMethod: 'usdc' }); * } * }); * * // Listen for delivery * conversation.on('delivery', async (delivery) => { * await conversation.review(delivery.orderId, { rating: 5 }); * }); * ``` */ export declare class MarketplaceConsumer { private graphql; private wallet; private settlementAgent; private marketplaceWallet?; private logger; constructor(config: Omit); /** * Initialize settlement agent and fetch marketplace info */ init(): Promise; /** * Search for agents via GraphQL */ search(filters?: MarketplaceSearchFilters): Promise; /** * Get agent details via GraphQL */ getAgent(agentId: string): Promise; /** * Start conversation with agent via GraphQL */ startConversation(agentId: string, options: { message: string; attachments?: any[]; }): Promise; /** * Get existing conversation via GraphQL */ getConversation(conversationId: string): Promise; /** * Get all conversations for this wallet via GraphQL */ getConversations(): Promise; /** * Get order details via GraphQL */ getOrder(orderId: string): Promise; /** * Get all orders for this wallet via GraphQL */ getOrders(status?: string): Promise; } /** * ConversationWrapper * Wraps a conversation with helper methods */ export declare class ConversationWrapper { private conversation; private graphql; private wallet; private settlementAgent; private marketplaceWallet; private messageHandlers; private deliveryHandlers; private pollingInterval?; private logger; constructor(conversation: Conversation, graphql: GraphQLClient, wallet: any, settlementAgent: SettlementAgent, marketplaceWallet: string); /** * Get conversation ID */ get id(): string; /** * Send message via GraphQL */ send(message: string, attachments?: any[]): Promise; /** * Get messages via GraphQL */ getMessages(limit?: number): Promise; /** * Accept order and pay via GraphQL */ acceptOrder(orderId: string, options: { paymentMethod: 'usdc' | 'athr'; }): Promise<{ transactionSignature: string; }>; /** * Decline order proposal via GraphQL */ declineOrder(orderId: string, reason?: string): Promise; /** * Counter-offer with different price/terms via GraphQL */ counterOffer(orderId: string, offer: { price?: number; priceAthr?: number; deliveryTime?: number; message: string; }): Promise; /** * Review order via GraphQL */ review(orderId: string, review: Omit): Promise; /** * Listen for new messages */ on(event: 'message', handler: (msg: ConversationMessage) => void): void; on(event: 'delivery', handler: (delivery: Delivery) => void): void; /** * Stop listening */ stop(): void; /** * Start polling for new messages and deliveries via GraphQL */ private startPolling; } //# sourceMappingURL=MarketplaceConsumer.d.ts.map