From 0353f19e5cac98eadd738e6769f60e88822b6f9f Mon Sep 17 00:00:00 2001 From: cygnet Date: Wed, 18 Sep 2024 14:42:10 +0200 Subject: [PATCH] Use sp_client bitcoin dependency instead of direct import --- rust/Cargo.lock | 1 - rust/Cargo.toml | 1 - rust/src/api/psbt.rs | 3 ++- rust/src/api/structs.rs | 2 +- rust/src/api/wallet.rs | 4 ++-- rust/src/blindbit/client.rs | 2 +- rust/src/blindbit/logic.rs | 8 ++++---- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index a254a53..d2ff052 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1284,7 +1284,6 @@ version = "0.1.0" dependencies = [ "anyhow", "bip39", - "bitcoin", "flutter_rust_bridge", "futures", "hex", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 4863b3c..44a7aef 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -19,7 +19,6 @@ hex = { version = "0.4.3", features = ["serde"] } serde_with = "3.6.0" log = "0.4.20" simplelog = "0.12.1" -bitcoin = { version = "0.31.1", features = ["serde", "rand", "base64"] } reqwest = { version = "0.12.4", features = ["rustls-tls"], default-features = false } tokio = { version = "1", features = ["macros", "rt-multi-thread"] } pushtx = { git = "https://github.com/cygnet3/pushtx", branch = "master" } diff --git a/rust/src/api/psbt.rs b/rust/src/api/psbt.rs index 499c86d..8f87b26 100644 --- a/rust/src/api/psbt.rs +++ b/rust/src/api/psbt.rs @@ -1,9 +1,10 @@ use std::{collections::HashMap, str::FromStr}; use bip39::rand::RngCore; -use bitcoin::{consensus::encode::serialize_hex, OutPoint, Psbt}; use log::info; use pushtx::Network; +use sp_client::bitcoin; +use sp_client::bitcoin::{consensus::encode::serialize_hex, OutPoint, Psbt}; use sp_client::spclient::{SpClient, SpWallet}; use super::structs::{Amount, OwnedOutput, Recipient}; diff --git a/rust/src/api/structs.rs b/rust/src/api/structs.rs index 009b143..7d46d42 100644 --- a/rust/src/api/structs.rs +++ b/rust/src/api/structs.rs @@ -1,7 +1,7 @@ use std::{collections::HashMap, str::FromStr}; -use bitcoin::{absolute::Height, OutPoint, Txid}; use serde::{Deserialize, Serialize}; +use sp_client::bitcoin::{self, absolute::Height, OutPoint, Txid}; type SpendingTxId = String; type MinedInBlock = String; diff --git a/rust/src/api/wallet.rs b/rust/src/api/wallet.rs index a05bb22..33dbf35 100644 --- a/rust/src/api/wallet.rs +++ b/rust/src/api/wallet.rs @@ -1,12 +1,12 @@ use std::str::FromStr; use anyhow::{Error, Result}; -use bitcoin::{ +use reqwest::Url; +use sp_client::bitcoin::{ absolute::Height, secp256k1::{PublicKey, SecretKey}, Network, OutPoint, Txid, }; -use reqwest::Url; use sp_client::spclient::{derive_keys_from_seed, SpClient, SpWallet, SpendKey}; use crate::blindbit; diff --git a/rust/src/blindbit/client.rs b/rust/src/blindbit/client.rs index 77dd72b..561ae8b 100644 --- a/rust/src/blindbit/client.rs +++ b/rust/src/blindbit/client.rs @@ -1,9 +1,9 @@ #![allow(dead_code)] use std::time::Duration; -use bitcoin::{secp256k1::PublicKey, BlockHash, ScriptBuf, Txid}; use reqwest::{Client, Url}; use serde::Deserialize; +use sp_client::bitcoin::{secp256k1::PublicKey, BlockHash, ScriptBuf, Txid}; use anyhow::Result; diff --git a/rust/src/blindbit/logic.rs b/rust/src/blindbit/logic.rs index b5cc01f..ff09826 100644 --- a/rust/src/blindbit/logic.rs +++ b/rust/src/blindbit/logic.rs @@ -4,16 +4,16 @@ use std::{ }; use anyhow::{Error, Result}; -use bitcoin::{ +use futures::{stream, StreamExt}; +use log::info; +use reqwest::Url; +use sp_client::bitcoin::{ absolute::Height, bip158::BlockFilter, hashes::{sha256, Hash}, secp256k1::{PublicKey, Scalar}, Amount, BlockHash, OutPoint, Txid, XOnlyPublicKey, }; -use futures::{stream, StreamExt}; -use log::info; -use reqwest::Url; use sp_client::spclient::{OutputSpendStatus, OwnedOutput, SpClient}; use sp_client::{ silentpayments::receiving::Label,