Skip to content

Commit b641a7d

Browse files
Merge bitcoindevkit/rust-esplora-client#93: refactor(async): refactoring async client and minor documentation improvements
1103936477a2f502658b6240ea9be8917e8f12b0 chore(style+docs): style and docs retouch (Leonardo Lima) 442789cca2fde11a51460dd194153ac909a2ffaa chore(style): update new methods style (Leonardo Lima) 565d79e4a6b6d6c0388256d71507403d42a4b6f3 refactor(async): add common GET and POST methods (Leonardo Lima) 31dfa4b9f23f9409a2e150712b4bf78855e86ce1 chore(docs): minor improvements on docstrings (Leonardo Lima) Pull request description: <!-- You can erase any parts of this template not applicable to your Pull Request. --> ### Description It builds on top of #95. Applies minor improvements on some docstrings, and Cargo.toml standard. The main change is adding the common HTTP methods for the `AsyncClient`, it removes duplicated code from each Esplora API request, and follows the approach done for `BlockingClient`. It makes it easier to extract these methods into an `AsyncEsploraClient` trait (to be done in another PR, initially done here 9cbc3873c2a56258e13cb36e0e8c32039f0947a7), which the user can implement with any HTTP client of its choice. Also, makes it simpler to rebase and update the `AsyncAnonymizedClient` from #67. <!-- Describe the purpose of this PR, what's being adding and/or fixed --> ### Notes to the reviewers It has some commits from #95, as it builds on top of it and should be merged afterward. Please let me know what you think about the proposed changes and approach. <!-- In this section you can include notes directed to the reviewers, like explaining why some parts of the PR were done in a specific way --> ### Changelog notice - Applies minor improvements on documentation. - Add common `get_response` and `post_request` methods to `AsyncClient`, previously duplicated through the esplora API calls. It follows the approach done for `BlockinClient`. <!-- Notice the release manager should include in the release tag message changelog --> <!-- See https://keepachangelog.com/en/1.0.0/ for examples --> ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing ACKs for top commit: ValuedMammal: ACK 1103936477a2f502658b6240ea9be8917e8f12b0 notmandatory: ACK 1103936477a2f502658b6240ea9be8917e8f12b0 Tree-SHA512: 5579e0cba105f553782e419a16c26fc75b38a2ab8ee523f5ce5e2b9a4560503ef7f81faac546429851802efb66cf125cb36b49f20f088969a6ad580e644d43e5
2 parents 13747d1 + b22c7c6 commit b641a7d

File tree

5 files changed

+243
-288
lines changed

5 files changed

+243
-288
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ path = "src/lib.rs"
1919
[dependencies]
2020
serde = { version = "1.0", features = ["derive"] }
2121
bitcoin = { version = "0.32", features = ["serde", "std"], default-features = false }
22-
hex = { package = "hex-conservative", version = "0.2" }
22+
hex = { version = "0.2", package = "hex-conservative" }
2323
log = "^0.4"
2424
minreq = { version = "2.11.0", features = ["json-using-serde"], optional = true }
25-
reqwest = { version = "0.11", optional = true, default-features = false, features = ["json"] }
25+
reqwest = { version = "0.11", features = ["json"], default-features = false, optional = true }
2626

2727
[dev-dependencies]
2828
serde_json = "1.0"

src/api.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
//! structs from the esplora API
1+
//! Structs from the Esplora API
22
//!
3-
//! see: <https://github.com/Blockstream/esplora/blob/master/API.md>
3+
//! See: <https://github.com/Blockstream/esplora/blob/master/API.md>
44
55
pub use bitcoin::consensus::{deserialize, serialize};
66
pub use bitcoin::hex::FromHex;

0 commit comments

Comments
 (0)