- React
- JavaScript
- React
- JavaScript
import {
type BitcoinSignPsbtRequest,
isBitcoinWallet,
} from '@dynamic-labs/bitcoin';
// the wallet object is the wallet you want to send from
// you can access the available wallets via the `useUserWallets` hook
// or get the primaryWallet via the `useDynamicContext` hook
const SignPsbtButton = ({ wallet }) => {
const onSignPsbt = async () => {
if (!isBitcoinWallet(wallet)) {
return;
}
const request: BitcoinSignPsbtRequest = {
// The PSBT request to sign
};
const { signedPsbt } = await wallet.signPsbt(request);
console.log('signedPsbt', signedPsbt);
};
return <button onClick={onSignPsbt}>Sign PSBT</button>;
};
import {
type BitcoinSignPsbtRequest,
isBitcoinWallet,
} from '@dynamic-labs/bitcoin';
// the wallet object is the wallet you want to send from
// you can access the available wallets via the `useUserWallets` hook
// or get the primaryWallet via the `useDynamicContext` hook
const SignPsbtsButton = ({ wallet }) => {
const onSignPsbts = async () => {
if (!isBitcoinWallet(wallet)) {
return;
}
const requests: BitcoinSignPsbtRequest[] = [
// The list of PSBT requests to sign
];
const signedPsbts = await wallet.signPsbts(requests);
console.log('signedPsbts', signedPsbts);
};
return <button onClick={onSignPsbts}>Sign PSBTs</button>;
};
Was this page helpful?