Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Use new rust-bitcoind-json-rpc crate #164

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
WIP: Use new rust-bitcoind-json-rpc crate
Use the new `rust-bitcoin-json-rpc` crate for RPC calls. WIP because
currently only works for features "0_17_1" and "22_1".

ref: https://github.com/tcharding/rust-bitcoind-json-rpc
tcharding committed Jun 1, 2024
commit 5b5c8d4ddc556dd437fd52dad3f5525f51422abb
10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -11,11 +11,12 @@ edition = "2018"
categories = ["cryptography::cryptocurrencies", "development-tools::testing"]

[dependencies]
bitcoincore-rpc = { version = "0.19", features = ["rand"] }
bitcoind-json-rpc-client = { version = "0.1", features = ["client-sync"] }
log = "0.4"
which = "4.2.5"
anyhow = "1.0.66"
tempfile = "3"
serde_json = { version = "1.0.117" }

[dev-dependencies]
env_logger = "0.9.0"
@@ -53,3 +54,10 @@ anyhow = "1.0.66"
[package.metadata.docs.rs]
features = ["download", "doc"]
rustdoc-args = ["--cfg", "docsrs"]

[patch.crates-io.bitcoind-json-rpc-client]
path = "/home/tobin/build/github.com/tcharding/rust-bitcoind-json-rpc/06-02-integration-tests/client"

[patch.crates-io.bitcoind-json-rpc-types]
path = "/home/tobin/build/github.com/tcharding/rust-bitcoind-json-rpc/06-02-integration-tests/json"

35 changes: 35 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#[cfg(feature = "26_0")] // This is all features.
compile_error!{"bitcoind-json-rpc does not support bitcoind v26_0"}

#[cfg(all(feature = "25_1", not(feature = "26_0")))]
compile_error!{"bitcoind-json-rpc does not support bitcoind v25.1"}

#[cfg(all(feature = "25_0", not(feature = "25_1")))]
compile_error!{"bitcoind-json-rpc does not support bitcoind v25.0"}

#[cfg(all(feature = "24_0_1", not(feature = "25_0")))]
compile_error!{"bitcoind-json-rpc does not support bitcoind v24.0.1"}

#[cfg(all(feature = "23_1", not(feature = "24_0_1")))]
compile_error!{"bitcoind-json-rpc does not support bitcoind v23.1"}

#[cfg(all(feature = "22_1", not(feature = "23_1")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use bitcoind_json_rpc_client::{client_sync::v22::Client, json::v22 as json};

#[cfg(all(feature = "0_21_2", not(feature = "22_1")))]
compile_error!{"bitcoind-json-rpc does not support bitcoind v22.2"}

#[cfg(all(feature = "0_20_2", not(feature = "0_21_2")))]
compile_error!{"bitcoind-json-rpc does not support bitcoind v0.20.2"}

#[cfg(all(feature = "0_19_1", not(feature = "0_20_2")))]
compile_error!{"bitcoind-json-rpc does not support bitcoind v0.19.1"}

#[cfg(all(feature = "0_18_1", not(feature = "0_19_1")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use bitcoind_json_rpc_client::{client_sync::v18::Client, json::v18 as json};

#[cfg(all(feature = "0_17_1", not(feature = "0_18_1")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use bitcoind_json_rpc_client::{client_sync::v17::Client, json::v17 as json};
Loading