#[macro_export]
macro_rules! impl_client_v17__get_blockchain_info {
() => {
impl Client {
pub fn get_blockchain_info(&self) -> Result<GetBlockchainInfo> {
self.call("getblockchaininfo", &[])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_best_block_hash {
() => {
impl Client {
pub fn best_block_hash(&self) -> Result<bitcoin::BlockHash> {
let json = self.get_best_block_hash()?;
Ok(json.block_hash()?)
}
pub fn get_best_block_hash(&self) -> Result<GetBestBlockHash> {
self.call("getbestblockhash", &[])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_block {
() => {
impl Client {
pub fn get_block(&self, hash: BlockHash) -> Result<Block> {
let json = self.get_block_verbose_zero(hash)?;
Ok(json.block()?)
}
pub fn get_block_verbose_zero(&self, hash: BlockHash) -> Result<GetBlockVerboseZero> {
self.call("getblock", &[into_json(hash)?, 0.into()])
}
pub fn get_block_verbose_one(&self, hash: BlockHash) -> Result<GetBlockVerboseOne> {
self.call("getblock", &[into_json(hash)?, 1.into()])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_block_count {
() => {
impl Client {
pub fn get_block_count(&self) -> Result<GetBlockCount> {
self.call("getblockcount", &[])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_block_hash {
() => {
impl Client {
pub fn get_block_hash(&self, height: u64) -> Result<GetBlockHash> {
self.call("getblockhash", &[into_json(height)?])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_block_header {
() => {
impl Client {
pub fn get_block_header(&self, hash: &BlockHash) -> Result<GetBlockHeader> {
self.call("getblockheader", &[into_json(hash)?, into_json(false)?])
}
pub fn get_block_header_verbose(
&self,
hash: &BlockHash,
) -> Result<GetBlockHeaderVerbose> {
self.call("getblockheader", &[into_json(hash)?])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_block_stats {
() => {
impl Client {
pub fn get_block_stats_by_height(
&self,
height: u32,
stats: Option<&[&str]>,
) -> Result<GetBlockStats> {
self.call("getblockstats", &[into_json(height)?, into_json(stats)?])
}
pub fn get_block_stats_by_block_hash(
&self,
hash: &BlockHash,
stats: Option<&[&str]>,
) -> Result<GetBlockStats> {
self.call("getblockstats", &[into_json(hash)?, into_json(stats)?])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_chain_tips {
() => {
impl Client {
pub fn get_chain_tips(&self) -> Result<GetChainTips> { self.call("getchaintips", &[]) }
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_chain_tx_stats {
() => {
impl Client {
pub fn get_chain_tx_stats(&self) -> Result<GetChainTxStats> {
self.call("getchaintxstats", &[])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_difficulty {
() => {
impl Client {
pub fn get_difficulty(&self) -> Result<GetDifficulty> {
self.call("getdifficulty", &[])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_mempool_ancestors {
() => {
impl Client {
pub fn get_mempool_ancestors(&self, txid: Txid) -> Result<GetMempoolAncestors> {
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)?])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_mempool_descendants {
() => {
impl Client {
pub fn get_mempool_descendants(&self, txid: Txid) -> Result<GetMempoolDescendants> {
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)?])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_mempool_entry {
() => {
impl Client {
pub fn get_mempool_entry(&self, txid: Txid) -> Result<GetMempoolEntry> {
self.call("getmempoolentry", &[into_json(txid)?])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_mempool_info {
() => {
impl Client {
pub fn get_mempool_info(&self) -> Result<GetMempoolInfo> {
self.call("getmempoolinfo", &[])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_raw_mempool {
() => {
impl Client {
pub fn get_raw_mempool(&self) -> Result<GetRawMempool> {
self.call("getrawmempool", &[])
}
pub fn get_raw_mempool_verbose(&self) -> Result<GetRawMempoolVerbose> {
self.call("getrawmempool", &[into_json(true)?])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_tx_out {
() => {
impl Client {
pub fn get_tx_out(&self, txid: Txid, vout: u64) -> Result<GetTxOut> {
self.call("gettxout", &[into_json(txid)?, into_json(vout)?])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_tx_out_proof {
() => {
impl Client {
pub fn get_tx_out_proof(&self, txids: &[Txid]) -> Result<String> {
self.call("gettxoutproof", &[into_json(txids)?])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_tx_out_set_info {
() => {
impl Client {
pub fn get_tx_out_set_info(&self) -> Result<GetTxOutSetInfo> {
self.call("gettxoutsetinfo", &[])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__precious_block {
() => {
impl Client {
pub fn precious_block(&self, hash: BlockHash) -> Result<()> {
match self.call("preciousblock", &[into_json(hash)?]) {
Ok(serde_json::Value::Null) => Ok(()),
Ok(res) => Err(Error::Returned(res.to_string())),
Err(err) => Err(err.into()),
}
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__prune_blockchain {
() => {
impl Client {
pub fn prune_blockchain(&self, target: u64) -> Result<PruneBlockchain> {
self.call("pruneblockchain", &[target.into()])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__save_mempool {
() => {
impl Client {
pub fn save_mempool(&self) -> Result<()> {
match self.call("savemempool", &[]) {
Ok(serde_json::Value::Null) => Ok(()),
Ok(res) => Err(Error::Returned(res.to_string())),
Err(err) => Err(err.into()),
}
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__scan_tx_out_set {
() => {
impl Client {
pub fn scan_tx_out_set_abort(&self) -> Result<ScanTxOutSetAbort> {
self.call("scantxoutset", &[into_json("abort")?])
}
pub fn scan_tx_out_set_start(
&self,
scan_objects: &[&str],
) -> Result<ScanTxOutSetStart> {
self.call("scantxoutset", &[into_json("start")?, into_json(scan_objects)?])
}
pub fn scan_tx_out_set_status(&self) -> Result<Option<ScanTxOutSetStatus>> {
self.call("scantxoutset", &[into_json("status")?])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__verify_chain {
() => {
impl Client {
pub fn verify_chain(&self) -> Result<VerifyChain> { self.call("verifychain", &[]) }
}
};
}
#[macro_export]
macro_rules! impl_client_v17__verify_tx_out_proof {
() => {
impl Client {
pub fn verify_tx_out_proof(&self, proof: &str) -> Result<VerifyTxOutProof> {
self.call("verifytxoutproof", &[into_json(proof)?])
}
}
};
}