Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ reqwest = { version = "0.11", default-features = false, features = ["json", "rus
bitbox-api = { version = "0.9.0", default-features = false, features = ["usb", "tokio", "multithreaded"], optional = true }

# coldcard
coldcard = { version = "0.12.2", optional = true }
# coldcard = { version = "0.12.2", optional = true }
coldcard = { git = "https://github.com/pythcoiner/rust-coldcard.git", rev = "5f6a6a6",optional = true }

# ledger
ledger_bitcoin_client = { version = "0.5.0", optional = true }
Expand Down
12 changes: 11 additions & 1 deletion src/coldcard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use bitcoin::{
bip32::{DerivationPath, Fingerprint, Xpub},
psbt::Psbt,
};
use coldcard::protocol::DescriptorName;

use crate::{parse_version, AddressScript, DeviceKind, Error as HWIError, Version, HWI};
pub use coldcard as api;
Expand Down Expand Up @@ -120,7 +121,16 @@ impl HWI for Coldcard {
async fn sign_tx(&self, psbt: &mut Psbt) -> Result<(), HWIError> {
let mut cc = self.device()?;

let _ = cc.sign_psbt(&psbt.serialize(), api::SignMode::Signed)?;
let wallet_name = if let Some(name) = self.wallet_name.clone() {
Some(
DescriptorName::new(name)
.map_err(|_| HWIError::Unexpected("Coldcard: Invalid wallet name"))?,
)
} else {
None
};

let _ = cc.sign_psbt_miniscript(&psbt.serialize(), api::SignMode::Signed, wallet_name)?;

let tx = loop {
if let Some(tx) = cc.get_signed_tx()? {
Expand Down
Loading