-
Notifications
You must be signed in to change notification settings - Fork 68
feat: implement missing methods #143
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
base: master
Are you sure you want to change the base?
feat: implement missing methods #143
Conversation
cd95f3f to
a391f24
Compare
Pull Request Test Coverage Report for Build 19713332546Details
💛 - Coveralls |
a391f24 to
30e3b95
Compare
30e3b95 to
f010183
Compare
|
As it has a couple of commits, I'd check first if it is in the final state, ready for review ? |
|
FWIW, supersedes the methods from #127. |
8379e8a to
6dc0ba7
Compare
Yes, it's ready. |
ValuedMammal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm about half way done reviewing this, will follow up soon with the rest.
9812292 to
ecfdece
Compare
ValuedMammal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I verified that the endpoints exist and the types match the responses from esplora. Verified the code is the same for both async and blocking.
- I tested the new APIs on a fork of
esplora-cli. - I ran the tests locally
Additional thoughts:
- There's some
cargo docwarnings due to unresolved rustdoc links - We could eventually change or deprecate
get_blockswhich currently returnsVec<BlockSummary>to return a list ofBlockInformationwhich is the more complete block summary. - The tests feel a bit heavy. As a client library we should only care that the request succeeds and we can parse the response - not necessarily the values returned from the server. Also, since all of the tests share the same BITCOIND instance, some tests seem to rely on the output of other tests making it hard to run a single test in isolation (e.g.
test_get_block_txs). This can make ongoing maintenance harder in the future. - You could consider combining the mempool-related tests into one test and avoid having the "sleep 5 seconds" logic in multiple places.
I'll open a follow up PR that fixes these, adds all the missing documentation, adds #![warn(missing_docs)] to lib.rs and add cargo doc to CI.
Indeed, this is a better approach
Yes, but we have to do it after the next release cc @oleonardolima
I was trying to check if the |
ecfdece to
7e142a7
Compare
|
@ValuedMammal rebased with your suggestions: tests now only focus on verifying that the returned value parses to the correct type, and condensed tests for the mempool methods into a single one. |
|
Thanks I'll give it another review. |
|
warning: unresolved link to `Block`
--> src/api.rs:91:27
|
91 | /// Information about a [`Block`].
| ^^^^^ no item named `Block` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
warning: unresolved link to `Script`
--> src/api.rs:181:37
|
181 | /// Statistics about a particular [`Script`] hash's confirmed and mempool transactions.
| ^^^^^^ no item named `Script` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
warning: unresolved link to `Script`
--> src/api.rs:184:58
|
184 | /// The summary of confirmed transactions for this [`Script`] hash.
| ^^^^^^ no item named `Script` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
warning: unresolved link to `Script`
--> src/api.rs:186:56
|
186 | /// The summary of mempool transactions for this [`Script`] hash.
| ^^^^^^ no item named `Script` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
warning: unresolved link to `Script`
--> src/api.rs:190:63
|
190 | /// Contains a summary of the transactions for a particular [`Script`] hash.
| ^^^^^^ no item named `Script` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
warning: unresolved link to `TxOut`
--> src/async.rs:535:19
|
535 | /// Get all [`TxOut`]s locked to a [`Script`] hash.
| ^^^^^ no item named `TxOut` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
warning: unresolved link to `TxOut`
--> src/blocking.rs:463:19
|
463 | /// Get all [`TxOut`]s locked to a [`Script`] hash.
| ^^^^^ no item named `TxOut` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
warning: `esplora-client` (lib doc) generated 7 warnings |
ValuedMammal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting together a well organized patch set. I'm requesting that we fixup the test_get_block_txids test as well as the cargo doc warnings.
I proposed fixing these on a follow-up PR that also documents the rest of the crate, a few comments above. I'll address these reviews in a few minutes. |
7e142a7 to
6868e62
Compare
6868e62 to
ed0b4a8
Compare
This PR implements the missing methods needed to be feature complete with the Esplora API specification, except for
POST /txs/package.Also adds
Bitcoin Dev Kit DeveloperstoauthorsonCargo.toml.Changelog
OutputSpendStatusstructScriptHashTxsSummaryandScriptHashStatsstructsBlockInformationstructMempoolStatsstructMempoolRecentTxsstructInvalidStartIndexValueerror variantget_tx_outspendsmethod (GET /tx/:txid/outspends)get_scripthash_statsmethod (GET /scripthash/:hash)get_mempool_address_txsmethod (GET /address/:address/txs/mempool)get_mempool_scripthash_txsmethod (GET /scripthash/:hash/txs/mempool)get_scripthash_utxosmethod (GET /scripthash/:hash/utxo)get_blockmethod (GET /block/:hash)get_block_txidsmethod (GET /block/:hash/txids)get_block_txsmethod (GET /block/:hash/txs[/:start_index])get_mempool_statsmethod (GET /mempool)get_mempool_txidsmethod (GET /mempool/txids)get_mempool_recent_txidsmethod (GET /mempool/recent)