From 965a8fe9f24660271c385e5a9f05cf45958264c3 Mon Sep 17 00:00:00 2001 From: edouard Date: Mon, 23 Oct 2023 21:53:05 +0200 Subject: [PATCH] remove base64 dependency --- Cargo.toml | 1 - src/specter.rs | 10 ++-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 161e025..d99a6a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,6 @@ specter = ["tokio", "tokio-serial", "serialport"] ledger = ["regex", "tokio", "ledger_bitcoin_client", "ledger-transport-hidapi", "ledger-apdu", "hidapi"] [dependencies] -base64 = "0.13.0" async-trait = "0.1.52" futures = "0.3" bitcoin = { version = "0.30.0", default-features = false, features = ["base64", "serde", "no-std"] } diff --git a/src/specter.rs b/src/specter.rs index ec46a82..8d2fc60 100644 --- a/src/specter.rs +++ b/src/specter.rs @@ -67,15 +67,9 @@ impl Specter { pub async fn sign(&self, psbt: &Psbt) -> Result { self.transport - .request(&format!( - "\r\n\r\nsign {}\r\n", - base64::encode(psbt.serialize()) - )) + .request(&format!("\r\n\r\nsign {}\r\n", psbt)) .await - .and_then(|resp| base64::decode(resp).map_err(|e| SpecterError::Device(e.to_string()))) - .and_then(|bytes| { - Psbt::deserialize(&bytes).map_err(|e| SpecterError::Device(e.to_string())) - }) + .and_then(|resp| Psbt::from_str(&resp).map_err(|e| SpecterError::Device(e.to_string()))) } }