-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from tnull/2025-03-expose-get-block-count
Expose remaining `v17` `blockchain` APIs for `v19`+
- Loading branch information
Showing
29 changed files
with
1,016 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// SPDX-License-Identifier: CC0-1.0 | ||
|
||
//! Macros for implementing JSON-RPC methods on a client. | ||
//! | ||
//! Specifically this is methods found under the `== Blockchain ==` section of the | ||
//! API docs of Bitcoin Core `v0.19`. | ||
//! | ||
//! All macros require `Client` to be in scope. | ||
//! | ||
//! See or use the `define_jsonrpc_minreq_client!` macro to define a `Client`. | ||
/// Implements Bitcoin Core JSON-RPC API method `getmempoolancestors` | ||
#[macro_export] | ||
macro_rules! impl_client_v19__getmempoolancestors { | ||
() => { | ||
impl Client { | ||
pub fn get_mempool_ancestors(&self, txid: Txid) -> Result<GetMempoolAncestors> { | ||
// Equivalent to self.call("getmempoolancestors", &[into_json(txid)?, into_json(false)?]) | ||
self.call("getmempoolancestors", &[into_json(txid)?]) | ||
} | ||
|
||
pub fn get_mempool_ancestors_verbose( | ||
&self, | ||
txid: Txid, | ||
) -> Result<GetMempoolAncestorsVerbose> { | ||
self.call("getmempoolancestors", &[into_json(txid)?, into_json(true)?]) | ||
} | ||
} | ||
}; | ||
} | ||
|
||
/// Implements Bitcoin Core JSON-RPC API method `getmempooldescendants` | ||
#[macro_export] | ||
macro_rules! impl_client_v19__getmempooldescendants { | ||
() => { | ||
impl Client { | ||
pub fn get_mempool_descendants(&self, txid: Txid) -> Result<GetMempoolDescendants> { | ||
// Equivalent to self.call("getmempooldescendants", &[into_json(txid)?, into_json(false)?]) | ||
self.call("getmempooldescendants", &[into_json(txid)?]) | ||
} | ||
|
||
pub fn get_mempool_descendants_verbose( | ||
&self, | ||
txid: Txid, | ||
) -> Result<GetMempoolDescendantsVerbose> { | ||
self.call("getmempooldescendants", &[into_json(txid)?, into_json(true)?]) | ||
} | ||
} | ||
}; | ||
} | ||
|
||
/// Implements Bitcoin Core JSON-RPC API method `getmempoolentry` | ||
#[macro_export] | ||
macro_rules! impl_client_v19__getmempoolentry { | ||
() => { | ||
impl Client { | ||
pub fn get_mempool_entry(&self, txid: Txid) -> Result<GetMempoolEntry> { | ||
self.call("getmempoolentry", &[into_json(txid)?]) | ||
} | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: CC0-1.0 | ||
|
||
//! Macros for implementing JSON-RPC methods on a client. | ||
//! | ||
//! Specifically this is methods found under the `== Blockchain ==` section of the | ||
//! API docs of Bitcoin Core `v22`. | ||
//! | ||
//! All macros require `Client` to be in scope. | ||
//! | ||
//! See or use the `define_jsonrpc_minreq_client!` macro to define a `Client`. | ||
/// Implements Bitcoin Core JSON-RPC API method `gettxout` | ||
#[macro_export] | ||
macro_rules! impl_client_v22__gettxout { | ||
() => { | ||
impl Client { | ||
pub fn get_tx_out(&self, txid: Txid, vout: u64) -> Result<GetTxOut> { | ||
self.call("gettxout", &[into_json(txid)?, into_json(vout)?]) | ||
} | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: CC0-1.0 | ||
|
||
//! Macros for implementing JSON-RPC methods on a client. | ||
//! | ||
//! Specifically this is methods found under the `== Blockchain ==` section of the | ||
//! API docs of Bitcoin Core `v0.26`. | ||
//! | ||
//! All macros require `Client` to be in scope. | ||
//! | ||
//! See or use the `define_jsonrpc_minreq_client!` macro to define a `Client`. | ||
/// Implements Bitcoin Core JSON-RPC API method `gettxoutsetinfo` | ||
#[macro_export] | ||
macro_rules! impl_client_v26__gettxoutsetinfo { | ||
() => { | ||
impl Client { | ||
pub fn get_tx_out_set_info(&self) -> Result<GetTxOutSetInfo> { | ||
self.call("gettxoutsetinfo", &[]) | ||
} | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.