Timestamp, WalletTxInfo,
},
jsonrpc_core::{IoHandler, Value},
jsonrpc_http_server::{CloseHandle, ServerBuilder},
serde::{Deserialize, Serialize},
server::Server,
state::State,
std::{
collections::{BTreeMap, BTreeSet, HashMap},
sync::{Arc, Mutex, MutexGuard},
thread,
time::Duration,
},
};
mod api;
mod server;
mod state;
pub fn builder() -> Builder {
Builder {
fail_lock_unspent: false,
network: Network::Bitcoin,
version: 240000,
}
}
pub struct Builder {
fail_lock_unspent: bool,
network: Network,
version: usize,
}
impl Builder {
pub fn fail_lock_unspent(self, fail_lock_unspent: bool) -> Self {
Self {
fail_lock_unspent,
..self
}
}
pub fn network(self, network: Network) -> Self {
Self { network, ..self }
}
pub fn version(self, version: usize) -> Self {
Self { version, ..self }
}
pub fn build(self) -> Handle {
let state = Arc::new(Mutex::new(State::new(
self.network,
self.version,
self.fail_lock_unspent,