import type { BitcoinCoreRpcClient, BitcoinRestClient, NetworkName } from '@did-btcr2/bitcoin'; import { BitcoinConnection, type RawTransactionRest } from '@did-btcr2/bitcoin'; import type { BitcoinApiConfig, SignalDiscoveryMode } from './types.js'; /** * Default per-network service endpoints the SDK applies when the caller supplies * no overrides. These name concrete third-party services (Esplora-compatible * REST APIs) and a local-node assumption for regtest, so they live in the SDK * facade rather than in the sans-I/O `@did-btcr2/bitcoin` transport, which holds * no service URLs. This mirrors how the CAS default gateway lives in the API * layer (`DEFAULT_CAS_GATEWAY`), and follows the convention that the transport * requires explicit endpoints while the SDK provides convenience defaults. * * **Regtest RPC:** credentials are intentionally omitted - callers must provide * `username` and `password` via overrides or explicit config, so hardcoded * credentials never reach a non-local environment. * * @public */ export declare const DEFAULT_BITCOIN_NETWORK_CONFIG: { readonly bitcoin: { readonly rpc: undefined; readonly rest: { readonly host: "https://mempool.space/api"; }; }; readonly testnet3: { readonly rpc: undefined; readonly rest: { readonly host: "https://mempool.space/testnet/api"; }; }; readonly testnet4: { readonly rpc: undefined; readonly rest: { readonly host: "https://mempool.space/testnet4/api"; }; }; readonly signet: { readonly rpc: undefined; readonly rest: { readonly host: "https://mempool.space/signet/api"; }; }; readonly mutinynet: { readonly rpc: undefined; readonly rest: { readonly host: "https://mutinynet.com/api"; }; }; readonly regtest: { readonly rpc: { readonly host: "http://localhost:18443"; }; readonly rest: { readonly host: "http://localhost:3000"; }; }; }; /** * Bitcoin network operations sub-facade. * Always backed by a {@link BitcoinConnection} so it can be passed to * resolve/update without extra configuration. * * Lazily initialized by {@link DidBtcr2Api} to avoid connection overhead * when Bitcoin features are not used. * @public */ export declare class BitcoinApi { /** The underlying BitcoinConnection used for all operations. */ readonly connection: BitcoinConnection; /** * Where beacon signals are read from during resolution. Set once at construction * because it is a property of how this connection talks to Bitcoin, not of any * individual DID being resolved. */ readonly signalDiscovery: SignalDiscoveryMode; /** * The Bitcoin network this connection targets. Exposed so callers (and the * DID method facade) can mint identifiers for the same network the * connection reads, instead of restating it at every call site. */ get network(): NetworkName; /** REST client for the active network. */ get rest(): BitcoinRestClient; /** * RPC client for the active network, or `undefined` if not configured. * Use {@link requireRpc} when RPC is expected to be available. */ get rpc(): BitcoinCoreRpcClient | undefined; /** Whether an RPC client is available for this network. */ get hasRpc(): boolean; /** * RPC client for the active network. * @throws {Error} If RPC was not configured for this network. */ requireRpc(): BitcoinCoreRpcClient; /** * Create a BitcoinApi for a specific network with optional endpoint overrides. * Applies the SDK's per-network {@link DEFAULT_BITCOIN_NETWORK_CONFIG} under any * caller overrides, then constructs the underlying transport with explicit * endpoints. No environment variables are consulted. * @param cfg The network and optional REST/RPC overrides. */ constructor(cfg: BitcoinApiConfig); /** * Fetch a transaction by txid via REST. * @param txid The transaction ID (64-character hex string). * @returns The fetched transaction. */ getTransaction(txid: string): Promise; /** * Broadcast a raw tx (hex) via REST. * @param rawTxHex The raw transaction hex string. */ send(rawTxHex: string): Promise; /** * Get UTXOs for an address via REST. * @param address The Bitcoin address. */ getUtxos(address: string): Promise; /** * Get a block by hash or height via REST. * @param params Block identifier: at least one of `hash` or `height` is required. */ getBlock(params: { hash?: string; height?: number; }): Promise; /** Convert BTC to satoshis (integer-safe string-split arithmetic). */ static btcToSats(btc: number): number; /** Convert satoshis to BTC (integer-safe string-split arithmetic). */ static satsToBtc(sats: number): number; } //# sourceMappingURL=bitcoin.d.ts.map