import { Connection, PublicKey } from "@solana/web3.js"; import type { DepositTarget, ShieldCachePort, TreeSource } from "./types.js"; /** * Injection points for the shield path. * * The three production deposit implementations (extension, wallet-app, * veilo-dapp) are ~85% identical and diverge on exactly these axes: where * proofs come from, where the tree comes from, which lookup table to use, and * what to cache into. Making each an explicit port is what lets one * implementation serve all of them — and lets a third-party integrator supply * their own without forking anything. * * Proof generation is deliberately NOT redefined here: `TransactionProofBuilder` * from `proof.ts` already has the right shape, and a second prover abstraction * would be exactly the kind of duplication this module exists to avoid. */ /** * Read the target tree and root directly from chain. * * Note the account decoding: `MerkleTreeAccount::EXPECTED_SIZE` (9107) does not * match the size its declared fields sum to (8987), a 120-byte discrepancy that * is unexplained. Until it is, hand-slicing this account at fixed byte offsets * is unsafe. Anchor's coder reads declared fields from the front and ignores the * tail, so `.fetch()` stays correct regardless. */ export declare function onChainTreeSource(connection: Connection, programId?: PublicKey): TreeSource; /** * Fixed values, for tests and offline builds. * * Also the escape hatch for an integrator who already tracks the tree state and * does not want the SDK making RPC calls on their behalf. */ export declare function staticTreeSource(target: DepositTarget): TreeSource; /** * In-memory cache with TTL. The default. * * Persistent storage is deliberately the caller's problem — `localStorage`, * `chrome.storage`, and `AsyncStorage` are three different answers in three * different apps, and none of them belongs in a published SDK. */ export declare function memoryCache(): ShieldCachePort; /** A cache that never stores anything. Useful for tests that assert fetch counts. */ export declare function noCache(): ShieldCachePort;