export interface UTXO { txid: string; vout: number; satoshis: bigint; confirmations: number; } export interface UTXOSet { utxos: UTXO[]; totalBalance: bigint; totalUTXOs: number; confirmedBalance: bigint; unconfirmedBalance: bigint; } /** * @deprecated DO NOT USE. Only referenced by the dormant `fallbackProviders` * field below. Retained transiently so removing it does not rebundle * `bitcoin-data-provider.module.ts`'s importers (btc-transaction-signer + the * six vault-balance actions) out-of-ceremony. Slated for deletion together with * `fallbackProviders` in the next rotation that already rebundles those actions. */ export interface BitcoinDataSource { name: string; url: string; priority: number; } /** * Bitcoin RPC Helper Interface * Minimal interface for Bitcoin Core RPC operations */ export interface IBitcoinRPCHelper { listUnspent(wallet: string, address: string): Promise; getTransaction(wallet: string, txid: string): Promise; getBlockCount(): Promise; } export interface BitcoinDataProviderConfig { providerUrl: string; /** * Auth descriptor applied to every Esplora request against `providerUrl`. * Absent ⇒ no auth headers (public Esplora / regtest faucet). */ auth?: import("../../modules/bitcoin-provider-auth").ProviderAuth; /** * @deprecated Fail-open fallback — DO NOT SET. Populating this makes * `BitcoinDataProvider.getUTXOs` silently swap to an alternate endpoint on * primary error, which (a) violates the "do not use fallback logic" rule in * CLAUDE.md and (b) breaks the provider-independence assumption the * multi-provider consensus layer relies on (one logical provider could answer * from an unvetted URL). It is wired by NOTHING today; the CI guard * `scripts/guards/assert-no-fallback-providers.mjs` fails the build if any * construction sets it. The runtime branch in `bitcoin-data-provider.module.ts` * is deleted in the next rotation that already rebundles that module's * importers — removing it now would rotate btc-transaction-signer + the six * vault-balance CIDs out-of-ceremony for a dormant path. */ fallbackProviders?: BitcoinDataSource[]; timeout?: number; rpcHelper?: IBitcoinRPCHelper; rpcWallet?: string; } export interface AuthorizedSpend { txid: string; vout: number; satoshis: bigint; positionId: string; targetAddress: string; targetAmount: bigint; timestamp: number; } export interface VaultBalanceResult { totalUTXOs: UTXO[]; totalBalance: bigint; authorizedUTXOs: AuthorizedSpend[]; authorizedBalance: bigint; authorizedSpendsHash: string; availableUTXOs: UTXO[]; availableBalance: bigint; vaultAddress: string; positionId: string; timestamp: number; } /** * A single input of a Bitcoin transaction — the outpoint it spends, * plus prevout details when the provider includes them (Esplora `vin[].prevout`). */ export interface TransactionInput { /** Funding transaction id (the outpoint being spent) */ txid: string; /** Funding output index within that transaction */ vout: number; /** Address of the spent output, when the provider returns prevout data */ prevoutAddress?: string; } /** * Esplora access descriptor for self-change classification. * `name` is used in consensus error messages only. */ export interface SelfChangeProviderConfig { name?: string; providerUrl: string; auth?: import("../../modules/bitcoin-provider-auth").ProviderAuth; timeout?: number; } export interface VaultBalanceConfig { contractAddress: string; chain: string; chainId: number; rpcUrl?: string; drpcKey?: string; bitcoinProvider: import("./bitcoin-data-provider.i").IBitcoinDataProvider; /** * Balance-confirmation threshold — REQUIRED. Callers must pass the * policy-derived value (`policy.minBitcoinBalanceConfirmations`, stamped on * the resolved provider config); there is deliberately no default here. */ minConfirmations: number; /** * Esplora access for self-change classification — EVERY registered Bitcoin * provider, primary first. Index 0 must be the same URL/auth the * `bitcoinProvider` instance was built with. A UTXO is admitted as * self-change only when every provider independently verifies its parent * transaction; any disagreement or provider failure aborts the balance * calculation (fail-closed), so a single compromised provider cannot * promote a fabricated unconfirmed UTXO into the signed balance. When * absent, unconfirmed UTXOs are never classified as self-change and stay * excluded from the trusted balance (fail-safe). See * docs/vault-balance-confirmed-gate-plan-2026-07-14.md §3.1. */ bitcoinProviderConfigs?: SelfChangeProviderConfig[]; /** * Policy floor for provider consensus (`policy.minConsensusProviders`, * remediation P1/#1). Validators MUST pass this. When the number of * configured providers is below a floor above 1, both consensus passes * throw instead of trusting the primary / excluding unconfirmed UTXOs. * Absent ⇒ 1 (dev/test baseline: single-provider behaviour unchanged). */ minConsensusProviders?: number; } //# sourceMappingURL=vault-balance.i.d.ts.map