/** * Per-wallet feature-flag key for `enabledWallets`. Open `string` because the * Bitcoin namespace is metadata-driven — the wallet set comes from the passed-in * metadata, not a compiled union — so any backend-configured wallet can be gated * without a UWC release. Mirrors `TronWalletId`. */ export type BitcoinWalletId = string /** * A bip122 account as surfaced by the wallet (Wallet Standard `bitcoin:*`). * * Shapes match the Wallet Standard bitcoin account: an `address`, its * `publicKey` (needed per-input for PSBT signing), and an optional `purpose` * distinguishing payment vs. ordinals addresses on wallets that separate them. * `publicKey` is hex here (JSON/transport-safe) — adapters convert to/from the * wallet's native `Uint8Array` at the boundary. */ export interface BitcoinAccount { address: string /** Compressed public key, hex-encoded (no `0x`). */ publicKey: string /** Address purpose, when the wallet distinguishes them (e.g. Phantom-style). */ purpose?: 'payment' | 'ordinals' } /** * Params to sign a message (Wallet Standard `bitcoin:signMessage`). * `message` is the UTF-8 string; the adapter encodes it to bytes. */ export interface BitcoinSignMessageParams { account: BitcoinAccount message: string /** Signing protocol; wallets default to `ecdsa` when omitted. */ protocol?: 'ecdsa' | 'bip322' } /** * Public configuration for the Bitcoin namespace module. Lives in `uwc-types` * (like `TronConnectorConfig` / `TonConnectConfig`) so it can thread through * `UniversalWalletConnector` once the core wiring lands. * * The `enabledWallets` set is an OPTIONAL per-wallet feature-flag surface. When * omitted, every wallet whose metadata declares a `namespaceMetaData.bip122` * entry is enabled (catalog-driven). An empty set/array enables nothing. * * Broadcast configuration (mempool.space endpoints) is intentionally NOT here * yet — it arrives in Phase 3 alongside the broadcast implementation, together * with the bip122 testnet network id it needs to be keyed by. */ export interface BitcoinConfig { /** * Optional allow-list of wallets to enable, matched against each wallet's * `WalletMetadata.id` or its `namespaceMetaData.bip122.injectedId` * (case-insensitive). Omit to enable every bip122-capable wallet the metadata * declares; an empty set/array enables nothing. */ enabledWallets?: ReadonlySet | readonly BitcoinWalletId[] /** Timeout (ms) for the per-wallet injection probe during connect. Default: 3000. */ readyStateTimeoutMs?: number /** * Timeout (ms) for the injection probe during discovery. Deliberately short * (default: 300) because absent wallets always wait out the full timeout. */ discoveryTimeoutMs?: number /** Poll cadence (ms) for the injection probe. Default: 50. */ readyStatePollIntervalMs?: number }