@usebutr/bitcoin
Wallet Standard discovery plus injected fallbacks, the adapter builder, and the Bitcoin feature types.
Discovery
discoverBitcoinAdapters(onAdapter): () => void
Subscribes to Wallet Standard registrations for Bitcoin wallets (Phantom,
Magic Eden, Leather, …). Lazily imports @wallet-standard/app, an optional
peer dependency. It is a WalletSource as-is.
discoverInjectedBitcoinAdapter(onAdapter, options?): () => void
The fallback for wallets that never announce through Wallet Standard. After
settleMs it emits an adapter for each provider it finds, unless
hasAnyWalletStandardAdapter() says Wallet Standard already found one:
| Provider | Adapter id | Name | Signer kind |
|---|---|---|---|
window.unisat | injected:bitcoin:unisat | Unisat | unisat |
window.okxwallet.bitcoin | injected:bitcoin:okx | OKX Wallet (Bitcoin) | unisat |
window.XverseProviders.BitcoinProvider | injected:bitcoin:xverse | Xverse | sats-connect |
window.btc | injected:bitcoin:legacy | Browser Bitcoin wallet | unisat |
InjectedBitcoinDiscoveryOptions: hasAnyWalletStandardAdapter?: () => boolean,
settleMs?: number (default 150), target? (overrides window).
bitcoinDiscoverer: PlatformDiscoverer
Wallet Standard as the primary channel, the injected adapters as the
fallback. autoDiscovery(["bitcoin"]) from @usebutr/wallets wires both.
Adapter builder
buildBitcoinAdapter(wallet, registerDisconnector?): BitcoinAdapter | null
Wraps a WalletStandardWallet, or returns null when it speaks no Bitcoin.
The id is slugify("btc", wallet.name). Each optional method exists only when
the wallet advertises its feature:
| Method | Feature | Resolves |
|---|---|---|
sendTx | bitcoin:sendTransfer | The txid. |
signMessage | bitcoin:signMessage | { signature, signedMessage }. |
signTransaction | bitcoin:signPsbt | The signed PSBT bytes. |
sendTx takes a BitcoinTransfer ({ amount, recipient }, satoshis);
signTransaction takes PSBT bytes. The
Bitcoin connector covers the injected
adapters, which switch or refuse a network instead of routing it per call.
Signers
Wallet Standard adapters resolve { kind: "wallet-standard", wallet }.
Importing the package registers the injected kinds:
unisat:{ provider }, the UniSat-style provider the adapter drives.sats-connect:{ provider }, Xverse'srequest(method, params)provider.
Constants
GENERIC_BITCOIN_ICON: the injected adapters' icon.
Types
BitcoinSignMessageFeature, BitcoinSignMessageInput,
BitcoinSignMessageOutput, BitcoinSignPsbtFeature, BitcoinSignPsbtInput,
BitcoinSignPsbtOutput, BitcoinSendTransferFeature,
BitcoinSendTransferInput, BitcoinSendTransferOutput,
InjectedBitcoinDiscoveryOptions.
The Bitcoin chain registry (BITCOIN_CHAINS, BITCOIN_CHAINS_LIST) lives in
@usebutr/core.
Source: packages/bitcoin/src/index.ts.