Skip to content

Commit 10ec038

Browse files
committed
feat(wallet): add Wallet::sign_psbt<K> wrapper for Psbt::sign
Add a thin wrapper method `sign_psbt` that delegates to `bitcoin::Psbt::sign`, passing the wallet's internal secp256k1 context. This allows users to sign PSBTs with their own `GetKey` implementor (e.g., `Xpriv` or hardware wallet adapters) without managing a separate secp256k1 context.
1 parent fb7681a commit 10ec038

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/wallet/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,6 +1802,17 @@ impl Wallet {
18021802
}
18031803
}
18041804

1805+
pub fn sign_psbt<K>(
1806+
&self,
1807+
psbt: &mut Psbt,
1808+
key: &K,
1809+
) -> Result<psbt::SigningKeysMap, (psbt::SigningKeysMap, psbt::SigningErrors)>
1810+
where
1811+
K: psbt::GetKey,
1812+
{
1813+
psbt.sign(key, &self.secp)
1814+
}
1815+
18051816
/// Return the spending policies for the wallet's descriptor.
18061817
pub fn policies(&self, keychain: KeychainKind) -> Result<Option<Policy>, DescriptorError> {
18071818
let signers = match keychain {

0 commit comments

Comments
 (0)