pub struct FeeResponse {
pub feerate: Option<u32>,
- // pub errors: Array<String>,
pub errored: bool,
}
let errored = !self.0["errors"].is_null();
Ok(FeeResponse {
errored,
- feerate: match self.0["feerate"].as_f64() {
- Some(fee) => Some((fee * 100_000_000.0).round() as u32),
- None => None
- }
- // true => None,
- // // The feerate from bitcoind is in BTC/kb, and we want satoshis/kb.
- // false => Some((self.0["feerate"].as_f64().unwrap() * 100_000_000.0).round() as u32),
+ feerate: match self.0["feerate"].as_f64() {
+ Some(fee) => Some((fee * 100_000_000.0).round() as u32),
+ None => None,
+ },
})
}
}
pub struct BlockchainInfo {
pub latest_height: usize,
pub latest_blockhash: BlockHash,
+ pub chain: String,
}
impl TryInto<BlockchainInfo> for JsonResponse {
latest_height: self.0["blocks"].as_u64().unwrap() as usize,
latest_blockhash: BlockHash::from_hex(self.0["bestblockhash"].as_str().unwrap())
.unwrap(),
+ chain: self.0["chain"].as_str().unwrap().to_string(),
})
}
}