Bitcoin Interactions
Send Bitcoin
In this example, we are going to send bitcoin using the wallet connector.
import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
import { isBitcoinConnector } from '@dynamic-labs/wallet-connector-core';
const SendBitcoinButton = () => {
const { primaryWallet } = useDynamicContext();
const sendBitcoin = async () => {
if (!primaryWallet) return;
if (!isBitcoinConnector(primaryWallet.connector)) {
return;
}
// The first argument is the address you are sending to, the second argument is the amount of BTC in satoshis
const transactionId = await primaryWallet.connector.sendBitcoin('<bitcoin payment address>', 1);
console.log('transactionId', transactionId);
};
return <button onClick={sendBitcoin}>Send Bitcoin</button>;
};
Was this page helpful?