/** * Bitcoin Network Configuration * * Defines approved Bitcoin RPC providers and network mappings for the protocol. * This ensures LIT actions only use vetted, reliable Bitcoin data sources. * * CRITICAL: Only approved providers should be added to this configuration. */ /** * Supported EVM chains */ export declare enum EVMChain { /** Ethereum Sepolia testnet */ SEPOLIA = "sepolia", /** Ethereum mainnet */ ETHEREUM = "ethereum", /** Hardhat local testnet */ HARDHAT = "hardhat" } /** * Bitcoin network types */ export declare enum BitcoinNetwork { /** Bitcoin testnet */ TESTNET = "testnet", /** Bitcoin mainnet */ MAINNET = "mainnet", /** Bitcoin regtest (local/testing) */ REGTEST = "regtest" } import type { ProviderAuth } from "../../modules/bitcoin-provider-auth"; /** * Bitcoin provider configuration */ export interface BitcoinProviderConfig { /** Provider API URL */ url: string; /** Bitcoin network (testnet or mainnet) */ network: BitcoinNetwork; /** * Balance-confirmation threshold stamped from * `policy.minBitcoinBalanceConfirmations` by the provider registry. NEVER use * this to gate UTXO spends — spends must use * `policy.minBitcoinSpendConfirmations` directly. */ minConfirmations: number; /** Human-readable provider name */ name: string; /** * Auth descriptor for the provider's Esplora API. Absent ⇒ no auth (public * Esplora / regtest faucet). Populated from the decrypted registry blob for * commercial providers (Maestro api-key, Blockstream Enterprise OAuth). */ auth?: ProviderAuth; } /** * Mapping from EVM chain to Bitcoin network * * - Sepolia → Bitcoin Regtest (Diamond Hands uses a private regtest faucet for Sepolia testing) * - Ethereum (mainnet) → Bitcoin Mainnet * * NOTE: Sepolia maps to REGTEST (not TESTNET) because Diamond Hands uses a private * regtest Bitcoin node (regtest.diamondhands.credit) for Sepolia E2E testing. * Vault addresses are bcrt1q… (regtest prefix). Changing to TESTNET would cause * deriveBitcoinAddress to produce tb1q… addresses instead of the vault's bcrt1q… format, * and PSBT assembly to use bitcoin.networks.testnet which can silently corrupt the * broadcast flow when the endpoint returns an empty 200 body. */ export declare const CHAIN_TO_BITCOIN_NETWORK: Record; /** * Approved EVM RPC provider domains * * Only RPC providers whose hostnames match one of these domain suffixes are * permitted inside LIT Actions for Ethereum/EVM calls. Adding a provider * here requires a security review — untrusted RPCs can return manipulated * state and compromise validator logic. * * Governance-adjustable: YES (add/remove after security review) * * `drpc.live` added 2026-10-18 after review: it is dRPC's optimized load * balancer (ownership confirmed by the Master); `drpc.org` is its legacy host. */ export declare const APPROVED_EVM_RPC_DOMAINS: string[]; /** * Mapping from EVM chain to chain ID * * - Ethereum mainnet: 1 * - Sepolia testnet: 11155111 * - Hardhat local: 1337 (matches contracts/hardhat.config.ts) */ export declare const CHAIN_TO_CHAIN_ID: Record; /** * Approved Bitcoin RPC providers per network * * Only providers in this whitelist can be used by LIT actions. * Each provider has specific min confirmation requirements. * * TESTNET: Lower confirmation requirements (1 block) * REGTEST: Lower confirmation requirements (1 block) * MAINNET: Higher confirmation requirements (6 blocks - industry standard) */ export declare const APPROVED_BITCOIN_PROVIDERS: Record; /** * Validate and normalize EVM chain input * * @param chain Chain identifier (case-insensitive) * @returns Validated EVMChain enum value * @throws Error if chain is not supported */ export declare function validateChain(chain: string): EVMChain; /** * Get Bitcoin network for EVM chain * * @param chain EVM chain * @returns Corresponding Bitcoin network */ export declare function getBitcoinNetworkForChain(chain: EVMChain): BitcoinNetwork; /** * Get chain ID for EVM chain * * @param chain EVM chain * @returns Corresponding chain ID */ export declare function getChainIdForChain(chain: EVMChain): number; /** * Validate Bitcoin provider is approved for network * * @param providerUrl Bitcoin provider URL * @param bitcoinNetwork Bitcoin network (testnet or mainnet) * @returns Provider configuration if approved * @throws Error if provider is not approved for network */ export declare function validateBitcoinProvider(providerUrl: string, bitcoinNetwork: BitcoinNetwork): BitcoinProviderConfig; /** * Validate Bitcoin provider is approved * * Searches across all networks to find the provider. * In development mode, the caller should create their own config directly * (see mint/withdraw validators for the pattern). * * @param providerUrl Bitcoin provider URL * @returns Provider configuration with network auto-detected * @throws Error if provider is not approved for any network */ export declare function getBitcoinProviderConfig(providerUrl: string): BitcoinProviderConfig; /** * Get list of approved provider URLs for a chain * * Useful for displaying options to users or validating inputs. * * @param chain EVM chain * @returns Array of approved provider URLs for that chain's Bitcoin network */ export declare function getApprovedProvidersForChain(chain: EVMChain): string[]; /** * Get human-readable provider name from URL * * @param providerUrl Provider URL * @param bitcoinNetwork Bitcoin network * @returns Provider name or URL if not found */ export declare function getProviderName(providerUrl: string, bitcoinNetwork: BitcoinNetwork): string; //# sourceMappingURL=bitcoin-network-config.d.ts.map