From 68651a76624d04aa8bbb9be3e6be1162509a73c8 Mon Sep 17 00:00:00 2001 From: Mr Big Date: Mon, 22 Jul 2024 17:26:39 +0800 Subject: [PATCH 1/3] change bitcoin crate to bitvm branch --- Cargo.toml | 5 +++++ integration_test/Cargo.toml | 2 +- json/Cargo.toml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index df0a30c2..6ead078e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,3 +5,8 @@ members = [ "client", "integration_test", ] + +[patch.crates-io] +base58check = { git = "https://github.com/rust-bitcoin/rust-bitcoin", branch = "bitvm"} +bitcoin_hashes = { git = "https://github.com/rust-bitcoin/rust-bitcoin", branch = "bitvm"} +bitcoin-internals = { git = "https://github.com/rust-bitcoin/rust-bitcoin", branch = "bitvm"} \ No newline at end of file diff --git a/integration_test/Cargo.toml b/integration_test/Cargo.toml index 9103310a..c21b6120 100644 --- a/integration_test/Cargo.toml +++ b/integration_test/Cargo.toml @@ -6,6 +6,6 @@ edition = "2018" [dependencies] bitcoincore-rpc = { path = "../client", features = ["rand"] } -bitcoin = { version = "0.32.0", features = ["serde", "rand"] } +bitcoin = { git = "https://github.com/rust-bitcoin/rust-bitcoin", branch = "bitvm", features = ["rand", "serde"] } lazy_static = "1.4.0" log = "0.4" diff --git a/json/Cargo.toml b/json/Cargo.toml index b7be19e1..dc2ceb13 100644 --- a/json/Cargo.toml +++ b/json/Cargo.toml @@ -27,4 +27,4 @@ rand = ["bitcoin/rand-std"] serde = { version = "1", features = [ "derive" ] } serde_json = "1" -bitcoin = { version = "0.32.0", features = ["serde"] } +bitcoin = { git = "https://github.com/rust-bitcoin/rust-bitcoin", branch = "bitvm", features = ["serde"] } From b7176c82883a51be4d262e9aa221ded2fe132b35 Mon Sep 17 00:00:00 2001 From: aiden-bitcoin Date: Sun, 9 Feb 2025 17:52:45 +0800 Subject: [PATCH 2/3] Revert "change bitcoin crate to bitvm branch" This reverts commit 68651a76624d04aa8bbb9be3e6be1162509a73c8. --- Cargo.toml | 5 ----- integration_test/Cargo.toml | 2 +- json/Cargo.toml | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6ead078e..df0a30c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,3 @@ members = [ "client", "integration_test", ] - -[patch.crates-io] -base58check = { git = "https://github.com/rust-bitcoin/rust-bitcoin", branch = "bitvm"} -bitcoin_hashes = { git = "https://github.com/rust-bitcoin/rust-bitcoin", branch = "bitvm"} -bitcoin-internals = { git = "https://github.com/rust-bitcoin/rust-bitcoin", branch = "bitvm"} \ No newline at end of file diff --git a/integration_test/Cargo.toml b/integration_test/Cargo.toml index c21b6120..9103310a 100644 --- a/integration_test/Cargo.toml +++ b/integration_test/Cargo.toml @@ -6,6 +6,6 @@ edition = "2018" [dependencies] bitcoincore-rpc = { path = "../client", features = ["rand"] } -bitcoin = { git = "https://github.com/rust-bitcoin/rust-bitcoin", branch = "bitvm", features = ["rand", "serde"] } +bitcoin = { version = "0.32.0", features = ["serde", "rand"] } lazy_static = "1.4.0" log = "0.4" diff --git a/json/Cargo.toml b/json/Cargo.toml index dc2ceb13..b7be19e1 100644 --- a/json/Cargo.toml +++ b/json/Cargo.toml @@ -27,4 +27,4 @@ rand = ["bitcoin/rand-std"] serde = { version = "1", features = [ "derive" ] } serde_json = "1" -bitcoin = { git = "https://github.com/rust-bitcoin/rust-bitcoin", branch = "bitvm", features = ["serde"] } +bitcoin = { version = "0.32.0", features = ["serde"] } From 912240599c63fc0328ec1f49628ca3855446d55c Mon Sep 17 00:00:00 2001 From: aiden-bitcoin Date: Tue, 6 May 2025 22:22:41 +0800 Subject: [PATCH 3/3] add client with minreq --- client/Cargo.toml | 1 + client/src/client.rs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/client/Cargo.toml b/client/Cargo.toml index 90b92fdc..a0f56f11 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -27,6 +27,7 @@ bitcoincore-rpc-json = { version = "0.19.0", path = "../json" } log = "0.4.5" jsonrpc = { version = "0.18.0", features = ["minreq_http"] } +minreq = { version = "2.7.0", features = ["json-using-serde", "https"] } # Used for deserialization of JSON. serde = "1" diff --git a/client/src/client.rs b/client/src/client.rs index 2f809a79..89f9a53b 100644 --- a/client/src/client.rs +++ b/client/src/client.rs @@ -19,6 +19,7 @@ use crate::bitcoin; use crate::bitcoin::consensus::encode; use bitcoin::hex::DisplayHex; use jsonrpc; +use jsonrpc::minreq_http::MinreqHttpTransport; use serde; use serde_json; @@ -1293,6 +1294,21 @@ impl Client { .map_err(|e| super::error::Error::JsonRpc(e.into())) } + pub fn new_with_minreq(url: &str, auth: Auth) -> Result { + let (user, pass) = auth.get_user_pass()?; + if user.is_none() { + return Err(Error::ReturnedError("User is None".to_string())); + } + let transport = MinreqHttpTransport::builder() + .url(url) + .map_err(|e| super::error::Error::JsonRpc(e.into()))? + .basic_auth(user.unwrap(), pass) + .build(); + Ok(Client { + client: jsonrpc::client::Client::with_transport(transport), + }) + } + /// Create a new Client using the given [jsonrpc::Client]. pub fn from_jsonrpc(client: jsonrpc::client::Client) -> Client { Client {