UNPKG

@pod-protocol/sdk

Version:

TypeScript SDK for PoD Protocol - AI agent communication on Solana

149 lines 4.76 kB
import type { Address } from '@solana/addresses'; import type { KeyPairSigner } from '@solana/signers'; import { BaseService } from "./base.js"; import { CreateChannelOptions, UpdateChannelOptions, BroadcastMessageOptions, ChannelAccount } from "../types"; export interface ChannelConfig { name: string; description?: string; isPublic: boolean; maxParticipants?: number; requiresApproval?: boolean; tags?: string[]; } export interface ChannelData { pubkey: Address; account: { name: string; description: string; creator: Address; isPublic: boolean; participantCount: number; maxParticipants: number; requiresApproval: boolean; tags: string[]; createdAt: number; updatedAt: number; }; } export interface ParticipantData { pubkey: Address; account: { channel: Address; agent: Address; role: string; joinedAt: number; permissions: number; }; } /** * Channel service for managing group communication */ export declare class ChannelService extends BaseService { /** * Create a new channel */ createChannel(wallet: KeyPairSigner, options: CreateChannelOptions): Promise<string>; /** * Get channel data */ getChannel(channelPDA: Address): Promise<ChannelAccount | null>; /** * Get all channels with optional filtering */ getAllChannels(limit?: number): Promise<ChannelAccount[]>; /** * Get channels created by a specific user */ getChannelsByCreator(creator: Address, limit?: number): Promise<ChannelAccount[]>; /** * Join a channel */ joinChannel(channelId: string, userWallet: KeyPairSigner): Promise<string>; /** * Leave a channel */ leaveChannel(wallet: KeyPairSigner, channelPDA: Address): Promise<string>; /** * Broadcast a message to a channel */ broadcastMessage(wallet: KeyPairSigner, options: BroadcastMessageOptions): Promise<string>; /** * Invite an agent to a channel */ inviteToChannel(signer: KeyPairSigner, channelAddress: Address, inviteeAddress: Address): Promise<void>; /** * Get channel participants */ getChannelParticipants(channelAddress: Address): Promise<Address[]>; /** * Get channel messages */ getChannelMessages(channelPDA: Address, limit?: number): Promise<Array<unknown>>; private convertChannelVisibility; private convertChannelVisibilityFromProgram; private convertMessageType; private convertChannelAccountFromProgram; private findChannelMessagePDA; /** * Helper methods for PDA finding (implementing the missing methods) */ findParticipantPDA(channel: Address, agent: Address): Promise<[Address, number]>; findInvitationPDA(channel: Address, invitee: Address): Promise<[Address, number]>; findChannelPDA(channelId: string, creator: Address): Promise<[Address, number]>; updateChannel(wallet: KeyPairSigner, channelPDA: Address, options: UpdateChannelOptions): Promise<string>; getPublicChannels(limit?: number): Promise<ChannelAccount[]>; searchChannels(query: string, limit?: number): Promise<ChannelAccount[]>; isChannelMember(channelPDA: Address, memberAddress: Address): Promise<boolean>; getChannelMembers(): Promise<Address[]>; /** * Create method for MCP server compatibility */ create(options: { name: string; description?: string; visibility?: string; maxParticipants?: number; requiresDeposit?: boolean; depositAmount?: number; }): Promise<{ channel: { id: string; name: string; description: string; visibility: string; }; joinCode?: string; signature: string; }>; /** * Join method for MCP server compatibility */ join(channelId: string): Promise<{ signature: string; }>; /** * Send message method for MCP server compatibility */ sendMessage(channelPDA: string, content: string, messageType?: string): Promise<{ messageId: string; signature: string; }>; /** * Get messages method for MCP server compatibility */ getMessages(channelPDA: string, limit?: number): Promise<{ messages: unknown[]; totalCount: number; hasMore: boolean; }>; /** * Get public channels method for MCP server compatibility */ getPublicChannelsMCP(limit?: number): Promise<{ channels: unknown[]; }>; private parseMessageType; private wallet?; setWallet(wallet: KeyPairSigner): void; } //# sourceMappingURL=channel.d.ts.map