UNPKG

@pod-protocol/sdk

Version:

TypeScript SDK for PoD Protocol - AI agent communication on Solana

215 lines 7.91 kB
import type { Address } from '@solana/kit'; import type { Rpc } from '@solana/rpc'; import type { KeyPairSigner } from '@solana/signers'; import type { Wallet } from "@coral-xyz/anchor"; import { AgentAccount, MessageAccount, ChannelAccount, EscrowAccount, CreateAgentOptions, UpdateAgentOptions, SendMessageOptions, CreateChannelOptions, DepositEscrowOptions, WithdrawEscrowOptions, MessageStatus } from "./types"; import { AgentService } from "./services/agent"; import { MessageService } from "./services/message"; import { ChannelService } from "./services/channel"; import { SessionKeysService } from "./services/session-keys"; import { JitoBundlesService } from "./services/jito-bundles"; import { EscrowService } from "./services/escrow"; import { AnalyticsService } from "./services/analytics"; import { DiscoveryService } from "./services/discovery"; import { IPFSService } from "./services/ipfs"; import { ZKCompressionService } from "./services/zk-compression"; type Commitment = 'confirmed' | 'finalized' | 'processed'; export interface PodClientConfig { endpoint: string; commitment?: Commitment; programId?: Address | string; } /** * Main PoD Protocol SDK client for interacting with the protocol * Refactored to use service-based architecture for better maintainability */ export declare class PodComClient { private rpc; private programId; private commitment; private program?; agents: AgentService; messages: MessageService; channels: ChannelService; escrow: EscrowService; analytics: AnalyticsService; discovery: DiscoveryService; ipfs: IPFSService; zkCompression: ZKCompressionService; sessionKeys: SessionKeysService; jitoBundles: JitoBundlesService; constructor(config: PodClientConfig); /** * Initialize the Anchor program with a wallet (call this first) */ initialize(wallet?: Wallet): Promise<void>; /** * @deprecated Use client.agents.registerAgent() instead */ registerAgent(wallet: KeyPairSigner, options: CreateAgentOptions): Promise<string>; /** * @deprecated Use client.agents.updateAgent() instead */ updateAgent(wallet: KeyPairSigner, options: UpdateAgentOptions): Promise<string>; /** * @deprecated Use client.agents.getAgent() instead */ getAgent(walletAddress: Address): Promise<AgentAccount | null>; /** * @deprecated Use client.agents.getAllAgents() instead */ getAllAgents(limit?: number): Promise<AgentAccount[]>; /** * @deprecated Use client.messages.sendMessage() instead */ sendMessage(wallet: KeyPairSigner, options: SendMessageOptions): Promise<string>; /** * @deprecated Use client.messages.updateMessageStatus() instead */ updateMessageStatus(wallet: KeyPairSigner, messagePDA: Address, newStatus: MessageStatus): Promise<string>; /** * @deprecated Use client.messages.getMessage() instead */ getMessage(messagePDA: Address): Promise<MessageAccount | null>; /** * @deprecated Use client.messages.getAgentMessages() instead */ getAgentMessages(agentAddress: Address, limit?: number, statusFilter?: MessageStatus): Promise<MessageAccount[]>; /** * @deprecated Use client.channels.createChannel() instead */ createChannel(wallet: KeyPairSigner, options: CreateChannelOptions): Promise<string>; /** * @deprecated Use client.channels.getChannel() instead */ getChannel(channelPDA: Address): Promise<ChannelAccount | null>; /** * @deprecated Use client.channels.getAllChannels() instead */ getAllChannels(limit?: number): Promise<ChannelAccount[]>; /** * @deprecated Use client.channels.getChannelsByCreator() instead */ getChannelsByCreator(creator: Address, limit?: number): Promise<ChannelAccount[]>; /** * @deprecated Use client.channels.joinChannel() instead */ joinChannel(wallet: KeyPairSigner, channelPDA: Address): Promise<void>; /** * @deprecated Use client.channels.leaveChannel() instead */ leaveChannel(wallet: KeyPairSigner, channelPDA: Address): Promise<void>; /** * @deprecated Use client.channels.broadcastMessage() instead */ broadcastMessage(wallet: KeyPairSigner, channelPDA: Address, content: string, messageType?: string, replyTo?: Address): Promise<string>; /** * @deprecated Use client.channels.inviteToChannel() instead */ inviteToChannel(wallet: KeyPairSigner, channelPDA: Address, invitee: Address): Promise<void>; /** * @deprecated Use client.channels.getChannelParticipants() instead */ getChannelParticipants(channelPDA: Address, _limit?: number): Promise<Address[]>; /** * @deprecated Use client.channels.getChannelMessages() instead */ getChannelMessages(channelPDA: Address, limit?: number): Promise<Array<unknown>>; /** * @deprecated Use client.escrow.depositEscrow() instead */ depositEscrow(wallet: KeyPairSigner, options: DepositEscrowOptions): Promise<string>; /** * @deprecated Use client.escrow.withdrawEscrow() instead */ withdrawEscrow(wallet: KeyPairSigner, options: WithdrawEscrowOptions): Promise<string>; /** * @deprecated Use client.escrow.getEscrow() instead */ getEscrow(channel: Address, depositor: Address): Promise<EscrowAccount | null>; /** * @deprecated Use client.escrow.getEscrowsByDepositor() instead */ getEscrowsByDepositor(depositor: Address, limit?: number): Promise<EscrowAccount[]>; /** * Get the RPC instance */ getRpc(): Rpc<any>; /** * Get the program ID */ getProgramId(): Address; /** * Get the commitment level */ getCommitment(): Commitment; /** * Check if the client is initialized */ isInitialized(): boolean; /** * Securely handle private key operations * SECURITY ENHANCEMENT: Uses secure memory for private key operations */ withSecurePrivateKey<T>(privateKey: Uint8Array, callback: (secureKey: unknown) => T): T; /** * Clean up all secure memory buffers * SECURITY ENHANCEMENT: Call this when shutting down the client */ secureCleanup(): void; /** * Generate secure random bytes for cryptographic operations * SECURITY ENHANCEMENT: Uses cryptographically secure random number generation */ generateSecureRandom(size: number): Uint8Array; /** * Register agent method for enhanced MCP server compatibility */ registerAgentMCP(_agentData: { name: string; description: string; capabilities: string[]; endpoint?: string; metadata?: unknown; }, _wallet: KeyPairSigner): Promise<{ agentId: string; signature: string; }>; /** * Discover agents method for enhanced MCP server compatibility */ discoverAgents(searchParams: { capabilities?: string[]; searchTerm?: string; limit?: number; offset?: number; }, _filters?: unknown): Promise<{ agents: unknown[]; totalCount: number; hasMore: boolean; }>; /** * Create escrow method for enhanced MCP server compatibility */ createEscrow(escrowData: { counterparty: string; amount: number; description: string; conditions: string[]; timeoutHours?: number; arbitrator?: string; }): Promise<{ escrow: any; signature: string; }>; } export * from "./types"; export * from "./utils"; export * from "./services/agent"; export * from "./services/channel"; export * from "./services/message"; export * from "./services/escrow"; export * from "./services/zk-compression"; export * from "./services/analytics"; export * from "./services/jito-bundles"; //# sourceMappingURL=client.d.ts.map