Skip to main content

Documentation Index

Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt

Use this file to discover all available pages before exploring further.

dynamicClient.bitcoin.sendBitcoin builds, signs, and broadcasts a Bitcoin transfer in a single call. Use it when you don’t need to inspect or modify the PSBT before broadcast.

Parameters

ParameterTypeNotes
walletIdstringThe id of a wallet whose chain === 'BTC'.
recipientAddressstringDestination address (mainnet or signet, depending on the wallet’s network).
amountstringAmount in satoshis, encoded as a string to preserve precision. 1 BTC = 100_000_000 sat.
feePriority'high' | 'medium' | 'low' (optional)Fee tier. Defaults are connector-specific.

Example

React Native
import { dynamicClient } from '<path to client file>';

const wallet = dynamicClient.wallets.userWallets.find((w) => w.chain === 'BTC');
if (!wallet) {
  throw new Error('No Bitcoin wallet');
}

const { txId } = await dynamicClient.bitcoin.sendBitcoin({
  walletId: wallet.id,
  recipientAddress: 'bc1q...',
  amount: '50000', // 50_000 sats = 0.0005 BTC
  feePriority: 'medium',
});

console.log('Broadcasted:', txId);

Converting between BTC and satoshis

amount is always a satoshi string. Convert from a user-supplied BTC value before calling:
const btc = '0.0005';
const sats = (Number(btc) * 1e8).toString();
//=> '50000'
For arbitrary-precision math (large amounts, or values entered as strings), use BigInt:
const sats = BigInt(Math.round(parseFloat(btc) * 1e8)).toString();

Errors

sendBitcoin rejects when:
  • The wallet is not a Bitcoin wallet, or the walletId doesn’t match a wallet in the current session.
  • The user cancels the signing prompt in the WebView.
  • The connected external wallet refuses the request (insufficient funds, network mismatch, etc.).
  • The broadcast fails (the network rejects the transaction).
The error message comes from the underlying connector — surface it to the user verbatim or wrap with your own copy.