#[macro_export]
macro_rules! impl_client_v17__add_node {
() => {
impl Client {
pub fn add_node(&self, node: &str, command: AddNodeCommand) -> Result<()> {
match self.call("addnode", &[into_json(node)?, into_json(command)?]) {
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__clear_banned {
() => {
impl Client {
pub fn clear_banned(&self) -> Result<()> {
match self.call("clearbanned", &[]) {
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__disconnect_node {
() => {
impl Client {
pub fn disconnect_node(&self, address: &str) -> Result<()> {
match self.call("disconnectnode", &[into_json(address)?]) {
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__get_added_node_info {
() => {
impl Client {
pub fn get_added_node_info(&self) -> Result<GetAddedNodeInfo> {
self.call("getaddednodeinfo", &[])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_connection_count {
() => {
impl Client {
pub fn get_connection_count(&self) -> Result<GetConnectionCount> {
self.call("getconnectioncount", &[])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_net_totals {
() => {
impl Client {
pub fn get_net_totals(&self) -> Result<GetNetTotals> { self.call("getnettotals", &[]) }
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_network_info {
() => {
impl Client {
pub fn server_version(&self) -> Result<usize> {
let info = self.get_network_info()?;
Ok(info.version)
}
pub fn get_network_info(&self) -> Result<GetNetworkInfo> {
self.call("getnetworkinfo", &[])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v17__get_peer_info {
() => {
impl Client {
pub fn get_peer_info(&self) -> Result<GetPeerInfo> { self.call("getpeerinfo", &[]) }
}
};
}
#[macro_export]
macro_rules! impl_client_v17__list_banned {
() => {
impl Client {
pub fn list_banned(&self) -> Result<ListBanned> { self.call("listbanned", &[]) }
}
};
}
#[macro_export]
macro_rules! impl_client_v17__ping {
() => {
impl Client {
pub fn ping(&self) -> Result<()> {
match self.call("ping", &[]) {
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__set_ban {
() => {
impl Client {
pub fn set_ban(&self, subnet: &str, command: SetBanCommand) -> Result<()> {
match self.call("setban", &[into_json(subnet)?, into_json(command)?]) {
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__set_network_active {
() => {
impl Client {
pub fn set_network_active(&self, state: bool) -> Result<SetNetworkActive> {
self.call("setnetworkactive", &[into_json(state)?])
}
}
};
}