import { Transaction, VersionedTransaction, PublicKey } from '@solana/web3.js'; import { ServerSessionManager } from '@bounded-sh/core'; import type { ClientConfig, AuthProvider, SetOptions, GetOptions, SearchOptions, GetManyResult, RunQueryOptions, RunExpressionOptions, RunExpressionResult, CountOptions, AggregateOptions, AggregateOperation, AggregateResult, AggregateSpec, AggregateRow, QueryAggregateOptions, RequestOverrides, SubscriptionOptions, InvokeOptions, LiveIntentOptions, LiveStatus, LiveStatusOptions, SetResult, FileUploadResult, FileDeleteResult, ReconcileSetResultOptions, WaitForSetResultOptions } from '@bounded-sh/core'; export declare class WalletClient { private readonly provider; private readonly sessionManager; readonly address: string; /** * Immutable snapshot of the resolved Bounded config this wallet client was * created against. It is threaded (as `_config`) into every data/file/query/ * aggregate/function/live/websocket request so the client's app + endpoint * targets can never follow a later global `init(...)` (CTA-05). Without it, * core would resolve app/endpoints from the mutable process-global config. */ private readonly config; readonly live: { intent: (roomPath: string, intent: unknown, opts?: LiveIntentOptions) => Promise<{ ok: true; }>; status: (roomPath: string, opts?: LiveStatusOptions) => Promise; subscribeView: (roomPath: string, opts: { userId?: string; onData: (view: any) => void; onError?: (error: any) => void; }) => Promise<() => Promise>; }; constructor(provider: AuthProvider, sessionManager: ServerSessionManager, address: string, config: ClientConfig); /** * Return this wallet client's current bearer token, refreshing its isolated * keypair session first when the cached token is expired or near expiry. */ getIdToken(): Promise; private buildOverrides; /** #023: strip caller Authorization (any casing) so operations run as the isolated wallet. */ private sanitizeHeaders; private mergeSetOverrides; private mergeReadOverrides; private mergeLiveIntentOptions; private mergeLiveStatusOptions; set(path: string, document: any, options?: SetOptions): Promise; setMany(many: { path: string; document: any; }[], options?: SetOptions): Promise; setFile(path: string, file: File | null, options?: { _overrides?: RequestOverrides; }): Promise; /** * Reconcile a `submitted` write receipt through THIS client's own provider * and app binding. A bare top-level `reconcileSetResult` cannot serve a wallet * client: the provider and config are private to the instance, and a later * global `init()` would otherwise reconcile against the wrong app. */ reconcileSetResult(receipt: SetResult, options?: ReconcileSetResultOptions): Promise; /** Bounded repeat of {@link reconcileSetResult}; see `waitForSetResult`. */ waitForSetResult(receipt: SetResult, options?: WaitForSetResultOptions): Promise; private mergeReconcileOptions; get(path: string, opts?: GetOptions): Promise; getMany(paths: string[], opts?: { bypassCache?: boolean; }): Promise; getFiles(path: string, options?: { _overrides?: RequestOverrides; }): Promise; search(path: string, query: string, opts?: SearchOptions): Promise; runQuery(absolutePath: string, queryName: string, queryArgs: any, opts?: RunQueryOptions): Promise; runQueryMany(many: { absolutePath: string; queryName: string; queryArgs: any; }[], opts?: RunQueryOptions): Promise; runExpression(expression: string, queryArgs: any, options?: RunExpressionOptions): Promise; runExpressionMany(many: { expression: string; queryArgs: any; returnType?: 'Bool' | 'String' | 'Int' | 'UInt'; _overrides?: RequestOverrides; }[]): Promise; count(path: string, opts?: CountOptions): Promise; aggregate(path: string, operation: AggregateOperation, opts?: AggregateOptions): Promise; queryAggregate(path: string, spec: AggregateSpec, opts?: QueryAggregateOptions): Promise; /** * Subscribe to real-time updates as THIS wallet's identity. The WS connection * authenticates with the wallet's own session (so read rules see the right * principal), and is scoped to its own connection so it never crosses another * identity. Accepts a bare callback or `{ onData, onError, filter, ... }`. * Returns an async unsubscribe. */ subscribe(path: string, options: SubscriptionOptions | ((data: any) => void)): Promise<() => Promise>; /** * Invoke a deployed Bounded Function AS this wallet's identity. The dispatcher * sees the wallet's verified session, so the function's `auth` rule + * `ctx.user` reflect this client. Returns the function's JSON; throws * `FunctionInvokeError` on 401/403/404/503. */ invoke(name: string, args?: Record, opts?: InvokeOptions): Promise; signMessage(message: string): Promise; signTransaction(transaction: Transaction | VersionedTransaction): Promise; signAndSubmitTransaction(transaction: Transaction | VersionedTransaction, feePayer?: PublicKey): Promise; } export type CreateWalletClientOptions = { /** Base58 or JSON-array Solana secret key. */ keypair: string; }; /** * Create a self-contained wallet client bound to one Solana keypair. * Each client has its own auth session — no global state is mutated. * * @example * ```ts * const vault = await createWalletClient({ keypair: process.env.VAULT_KEY }); * await vault.set('markets/123', data); * ``` */ export declare function createWalletClient(opts: CreateWalletClientOptions): Promise;