- React
- JavaScript
Copy
Ask AI
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>;
};
Copy
Ask AI
import {
type BitcoinSignPsbtRequest,
isBitcoinWalletAccount,
signPsbt,
} from '@dynamic-labs-sdk/bitcoin';
// the walletAccount is the wallet account you want to send from
// you can access the available wallet accounts via the `getWalletAccounts` function
const SignPsbtsButton = ({ walletAccount }) => {
const onSignPsbt = async () => {
if (!isBitcoinWalletAccount(walletAccount)) {
return;
}
const request: BitcoinSignPsbtRequest = {
// The PSBT request to sign
};
const { signedPsbt } = await signPsbt({
walletAccount,
request,
});
console.log('signedPsbt', signedPsbt);
};
return <button onClick={onSignPsbt}>Sign PSBT</button>;
};
- React
- JavaScript
Copy
Ask AI
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>;
};
Copy
Ask AI
import {
type BitcoinSignPsbtRequest,
isBitcoinWalletAccount,
signPsbts,
} from '@dynamic-labs-sdk/bitcoin';
// the walletAccount is the wallet account you want to send from
// you can access the available wallet accounts via the `getWalletAccounts` function
const SignPsbtsButton = ({ walletAccount }) => {
const onSignPsbts = async () => {
if (!isBitcoinWalletAccount(walletAccount)) {
return;
}
const requests: BitcoinSignPsbtRequest[] = [
// The list ofPSBT requests to sign
];
const { signedPsbts } = await signPsbts({
walletAccount,
requests,
});
console.log('signedPsbts', signedPsbts);
};
return <button onClick={onSignPsbts}>Sign PSBTs</button>;
};