# @usebutr/bitcoin (/api/bitcoin)



## Discovery [#discovery]

### `discoverBitcoinAdapters(onAdapter): () => void` [#discoverbitcoinadaptersonadapter---void]

Subscribe to Wallet Standard registrations for Bitcoin wallets (Phantom,
Magic Eden, Leather, OKX, …). Returns an unsubscribe function. Lazily
imports `@wallet-standard/app` (optional peer dependency).

### `discoverInjectedBitcoinAdapter(onAdapter, options): () => void` [#discoverinjectedbitcoinadapteronadapter-options---void]

Fallback for wallets that inject `window.unisat` (Unisat, OKX legacy, generic
`window.btc`) or expose `sats-connect` (Xverse). Use when no Wallet Standard
wallet announces — `autoDiscovery()` composes both routes for you.

### `bitcoinDiscoverer: PlatformDiscoverer` [#bitcoindiscoverer-platformdiscoverer]

Descriptor used by `@usebutr/wallets`'s `autoDiscovery()` to compose Bitcoin
discovery (Wallet Standard primary, injected fallback) into a multi-platform
source.

## Adapter builder [#adapter-builder]

### `buildBitcoinAdapter(wallet: WalletStandardWallet): WalletAdapter` [#buildbitcoinadapterwallet-walletstandardwallet-walletadapter]

Wrap a Wallet Standard wallet into a butr `WalletAdapter` with
`chainPlatform: "bitcoin"`.

### `slugify(name: string): string` [#slugifyname-string-string]

Stable id derivation from a wallet name (adapter authoring).

## Capabilities [#capabilities]

### `resolveBitcoinCapabilities(wallet): WalletCapabilities` [#resolvebitcoincapabilitieswallet-walletcapabilities]

Derive `WalletCapabilities` from advertised Bitcoin Wallet Standard features
(`bitcoin:signMessage`, `bitcoin:signPsbt`, `bitcoin:sendTransfer`, events, …).

Type: `BitcoinCapabilityInput`.

## Chains [#chains]

* `BITCOIN_CHAINS` — record keyed by chain id (CAIP-2 `bip122:<genesis hash>`).
* `BITCOIN_CHAINS_LIST` — array (mainnet / testnet / regtest).

## Constants [#constants]

* `GENERIC_BITCOIN_ICON: string` — fallback SVG data URI for injected
  wallets that don't supply their own icon.

## Types [#types]

Bitcoin-specific feature shapes: `BitcoinSignMessageFeature`,
`BitcoinSignMessageInput`, `BitcoinSignMessageOutput`, `BitcoinSignPsbtFeature`,
`BitcoinSignPsbtInput`, `BitcoinSignPsbtOutput`, `BitcoinSendTransferFeature`,
`BitcoinSendTransferInput`, `BitcoinSendTransferOutput`,
`InjectedBitcoinDiscoveryOptions`.

The shared Wallet Standard protocol types (`WalletStandardWallet`,
`WalletStandardWalletAccount`, `WalletStandardAppModule`, `WalletsApp`,
`StandardConnectFeature`, `StandardDisconnectFeature`,
`StandardEventsFeature`, `StandardEventsListener`) live in
[`@usebutr/wallet-standard-shared`](/api/index) — import them from
there directly when casting `getSigner()`.

These feature types are what you cast `getSigner()` to when signing/sending —
see the [Bitcoin Wallet Standard connector](/connectors/bitcoin-wallet-standard).

**Source:** `packages/bitcoin/src/index.ts`.
