/** * MoltBunker API client — production-hardened HTTP client with wallet session auth. * * Auth: EIP-191 signed challenge → session token (wt_*). Auto-refreshes on 401. * Rate limits: Exponential backoff on 429 with Retry-After header. * Errors: Typed error hierarchy for structured handling. * Timeouts: 30s default per request. * * This client is stateless except for the cached session token. * All methods are safe to call concurrently (token refresh is serialized). */ import type { WalletClient } from 'viem'; import type { Bot, BotCreateRequest, BotUpdateRequest, BotStatus, BunkerBalance, BunkerErrorResponse, CatalogResponse, Clone, CloneCreateRequest, CloneListParams, CloningConfig, Container, ContainerListParams, Deployment, DeploymentCreateRequest, Migration, MigrateRequest, Runtime, RuntimeExtendRequest, RuntimeReserveRequest, RuntimeStatus, Snapshot, SnapshotCreateRequest, SnapshotRestoreRequest, ThreatAssessment } from './types.js'; export declare class BunkerError extends Error { readonly status: number; readonly body?: BunkerErrorResponse | undefined; constructor(message: string, status: number, body?: BunkerErrorResponse | undefined); } export declare class BunkerAuthError extends BunkerError { constructor(message: string, body?: BunkerErrorResponse); } export declare class BunkerInsufficientFundsError extends BunkerError { readonly required: number | undefined; readonly available: number | undefined; constructor(message: string, body?: BunkerErrorResponse); } export declare class BunkerNotFoundError extends BunkerError { constructor(message: string, body?: BunkerErrorResponse); } export declare class BunkerRateLimitError extends BunkerError { readonly retryAfterMs: number; constructor(message: string, retryAfterMs: number, body?: BunkerErrorResponse); } export interface BunkerClientOptions { apiUrl?: string; walletClient: WalletClient; /** Timeout per request in ms (default: 30_000) */ timeoutMs?: number; } export declare class BunkerClient { private readonly apiUrl; private readonly walletClient; private readonly timeoutMs; private sessionToken; private sessionExpiresAt; private refreshPromise; constructor(opts: BunkerClientOptions); /** * Get a valid session token. Uses cached token if still valid, * otherwise authenticates via challenge-response. * * Concurrent calls are serialized — only one auth request at a time. */ private getSessionToken; /** * Full challenge-response auth flow. Signs with EIP-191 via viem wallet. */ private authenticate; /** * Invalidate the current session and force re-authentication on next request. */ invalidateSession(): void; /** * Low-level request without auth retry logic. Used for auth endpoints. */ private rawRequest; /** * Authenticated request with auto-refresh on 401 and rate limit retry. * * For mutating operations that can't be safely retried (deploy, clone), * set `idempotent: false` to skip rate-limit retry. */ private request; createBot(req: BotCreateRequest): Promise; listBots(): Promise; getBot(id: string): Promise; updateBot(id: string, req: BotUpdateRequest): Promise; deleteBot(id: string): Promise; getBotStatus(id: string): Promise; enableCloning(botId: string, config: CloningConfig): Promise; syncClones(botId: string): Promise; reserveRuntime(req: RuntimeReserveRequest): Promise; getRuntime(id: string): Promise; getRuntimeStatus(id: string): Promise; extendRuntime(id: string, req: RuntimeExtendRequest): Promise; releaseRuntime(id: string): Promise; createDeployment(req: DeploymentCreateRequest): Promise; listDeployments(botId?: string): Promise; getDeployment(id: string): Promise; stopDeployment(id: string): Promise; listContainers(params?: ContainerListParams): Promise; getContainer(id: string): Promise; startContainer(id: string): Promise; stopContainer(id: string): Promise; deleteContainer(id: string): Promise; getContainerLogs(id: string, tail?: number): Promise; enableCheckpoints(id: string): Promise; enableContainerCloning(id: string, config: CloningConfig): Promise; createSnapshot(req: SnapshotCreateRequest): Promise; listSnapshots(containerId?: string): Promise; getSnapshot(id: string): Promise; deleteSnapshot(id: string): Promise; restoreSnapshot(id: string, req: SnapshotRestoreRequest): Promise; createClone(req: CloneCreateRequest): Promise; listClones(params?: CloneListParams): Promise; getClone(id: string): Promise; cancelClone(id: string): Promise; getThreat(): Promise; migrate(req: MigrateRequest): Promise; getCatalog(): Promise; getBalance(address?: string): Promise; } //# sourceMappingURL=client.d.ts.map