Bitcoin Interactions
Send a raw transaction
In this example, we are going to send a raw transaction as a hex value to the bitcoin network.
For information on how to construct the transactionHexString, please refer to this example.
import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
import { isBitcoinConnector } from '@dynamic-labs/wallet-connector-core';
const SendRawTransaction = () => {
const { primaryWallet } = useDynamicContext();
const signMessage = async () => {
if (!primaryWallet) return;
if (!isBitcoinConnector(primaryWallet.connector)) {
return;
}
const transactionId = await primaryWallet.connector.sendRawTransaction('transactionHexString');
console.log('transactionId', transactionId);
};
return <button onClick={SendRawTransaction}>Send Raw Transaction</button>;
};
Was this page helpful?