import { type WalletState } from "./wallet.js"; export type WalletScope = { kind: "user"; userId: string; } | { kind: "group"; groupId: string; }; /** @internal */ export declare function scopeKey(scope: WalletScope): string; /** @internal */ export declare function userScope(userId: string): WalletScope; /** @internal */ export declare function groupScope(groupId: string): WalletScope; export interface WalletBook { scopes: Readonly>; contributions: Readonly>>>>>; } export type BookChargeResult = { status: "ok"; book: WalletBook; } | { status: "rejected"; reason: "insufficient-funds"; }; /** * Shared or group currency pools that track each member's contribution to a common balance. * * @capability shared-wallet shared/group currency pools tracking per-member contributions * @internal */ export declare function createWalletBook(): WalletBook; /** @internal */ export declare function balanceIn(book: WalletBook, scope: WalletScope, currency: string): number; /** @internal */ export declare function grantTo(book: WalletBook, scope: WalletScope, currency: string, amount: number, by?: string): WalletBook; /** @internal */ export declare function chargeFrom(book: WalletBook, scope: WalletScope, currency: string, amount: number, by?: string): BookChargeResult; /** @internal */ export declare function contributionOf(book: WalletBook, groupId: string, userId: string): Readonly>; /** @internal */ export declare function contributorsOf(book: WalletBook, groupId: string): string[];