1#![crate_name = "bitcoincore_rpc"]
17#![crate_type = "rlib"]
18
19#[macro_use]
20extern crate log;
21#[allow(unused)]
22#[macro_use] extern crate serde;
24
25pub extern crate jsonrpc;
26
27pub extern crate bitcoincore_rpc_json;
28pub use crate::json::bitcoint4;
29pub use bitcoincore_rpc_json as json;
30use json::bitcoint4::consensus::{Decodable, ReadExt};
31use json::bitcoint4::hashes::hex::HexIterator;
32
33mod client;
34mod error;
35mod queryable;
36
37pub use crate::client::*;
38pub use crate::error::Error;
39pub use crate::queryable::*;
40
41fn deserialize_hex<T: Decodable>(hex: &str) -> Result<T> {
42 let mut reader = HexIterator::new(&hex)?;
43 let object = Decodable::consensus_decode(&mut reader)?;
44 if reader.read_u8().is_ok() {
45 Err(Error::BitcoinSerialization(bitcoint4::consensus::encode::Error::ParseFailed(
46 "data not consumed entirely when explicitly deserializing",
47 )))
48 } else {
49 Ok(object)
50 }
51}