UNPKG

@pod-protocol/sdk

Version:

TypeScript SDK for PoD Protocol - AI agent communication on Solana

61 lines 1.99 kB
import type { Address } from "@solana/addresses"; import type { KeyPairSigner } from "@solana/signers"; import { BaseService } from './base.js'; export interface TransactionInstruction { programAddress: Address; accounts: Array<{ address: Address; role: any; }>; data: Uint8Array; } export interface SessionKeyConfig { /** Target programs this session key can interact with */ targetPrograms: Address[]; /** Session expiry timestamp */ expiryTime: number; /** Maximum number of uses for this session */ maxUses?: number; /** Allowed instruction types */ allowedInstructions?: string[]; } export interface SessionToken { /** Ephemeral keypair for this session */ sessionKeyPairSigner: KeyPairSigner; /** Session configuration */ config: SessionKeyConfig; /** Session token account address */ sessionTokenAccount: Address; /** Number of uses remaining */ usesRemaining?: number; } export declare class SessionKeysService extends BaseService { private sessions; private wallet; constructor(rpcUrl: string, programId: string, commitment: any); setWallet(wallet: any): void; private ensureWallet; private sendTransactionWithAnchor; /** * Create a new session key for AI agent interactions */ createSessionKey(config: SessionKeyConfig): Promise<SessionToken>; /** * Use a session key to sign a transaction */ useSessionKey(sessionId: string, instructions: TransactionInstruction[]): Promise<string>; /** * Revoke a session key */ revokeSessionKey(sessionId: string): Promise<string>; /** * Get all active sessions for current wallet */ getActiveSessions(): SessionToken[]; /** * Create session for AI agent messaging (convenience method) */ createMessagingSession(durationHours?: number): Promise<SessionToken>; private isInstructionAllowed; } //# sourceMappingURL=session-keys.d.ts.map