/** * Spend status and private balance. * * A note is yours until its nullifier is published; nothing in the note itself * says whether it has been spent. So a balance is always two steps: ask which * nullifiers are spent, then sum what is left. This module is that pair. */ /** Server-side cap per check-batch request (notes.constants MAX_NULLIFIERS_PER_CHECK). */ export declare const MAX_NULLIFIERS_PER_CHECK = 200; /** Grouping key used for notes that carry no mint. */ export declare const UNKNOWN_MINT = "unknown"; /** * Ask the relayer which of these nullifiers are spent. * * Deduplicates, lower-cases, and splits into MAX_NULLIFIERS_PER_CHECK batches * that are issued concurrently. Returns a Set for membership testing; a * nullifier absent from it is unspent as far as the relayer knows. * * @throws if any entry is not 64-char hex — a malformed nullifier that silently * read as "unspent" would overstate a balance. */ export declare function checkNullifiersSpent(nullifiers: string[]): Promise>; /** The minimum a note must carry to be counted. */ export interface SpendableNote { /** Base units. bigint preferred; strings and safe integers are accepted. */ amount: bigint | string | number; /** 64-character hex nullifier for this note. */ nullifier: string; /** Mint this note is denominated in. Groups the result; optional. */ mint?: string; } export interface PrivateBalance { /** Sum of every unspent note, across all mints. */ total: bigint; /** Unspent totals keyed by mint (UNKNOWN_MINT when a note carries none). */ byMint: Record; /** The caller's own note objects, partitioned. */ unspent: T[]; spent: T[]; } export interface PrivateBalanceOptions { /** * Supply spend status yourself instead of asking the relayer — e.g. from a * chain scan of nullifier events, or a local cache. Receives normalized * lower-case hex. */ resolveSpent?: (nullifiers: string[]) => Promise> | Set; } /** * Sum unspent notes, per mint and in total. * * ```ts * const { total, byMint, unspent } = await getPrivateBalance(myNotes); * ``` * * Amounts are base units and stay bigint throughout — never sum note amounts as * numbers. Notes are matched to spend status by nullifier, so every note needs * one; the partitioned arrays hand back your own objects, not copies. */ export declare function getPrivateBalance(notes: T[], options?: PrivateBalanceOptions): Promise>;