Struct bdk::blockchain::rpc::RpcBlockchainFactory
source · [−]pub struct RpcBlockchainFactory {
pub url: String,
pub auth: Auth,
pub network: Network,
pub wallet_name_prefix: Option<String>,
pub default_skip_blocks: u32,
pub sync_params: Option<RpcSyncParams>,
}
rpc
only.Expand description
Factory of RpcBlockchain
instances, implements BlockchainFactory
Internally caches the node url and authentication params and allows getting many different RpcBlockchain
objects for different wallet names and with different rescan heights.
Example
let factory = RpcBlockchainFactory {
url: "http://127.0.0.1:18332".to_string(),
auth: Auth::Cookie {
file: "/home/user/.bitcoin/.cookie".into(),
},
network: Network::Testnet,
wallet_name_prefix: Some("prefix-".to_string()),
default_skip_blocks: 100_000,
sync_params: None,
};
let main_wallet_blockchain = factory.build("main_wallet", Some(200_000))?;
Fields
url: String
The bitcoin node url
auth: Auth
The bitcoin node authentication mechanism
network: Network
The network we are using (it will be checked the bitcoin node network matches this)
wallet_name_prefix: Option<String>
The optional prefix used to build the full wallet name for blockchains
default_skip_blocks: u32
Default number of blocks to skip which will be inherited by blockchain unless overridden
sync_params: Option<RpcSyncParams>
Sync parameters
Trait Implementations
sourceimpl BlockchainFactory for RpcBlockchainFactory
impl BlockchainFactory for RpcBlockchainFactory
type Inner = RpcBlockchain
type Inner = RpcBlockchain
The type returned when building a blockchain from this factory
sourcefn build(
&self,
checksum: &str,
_override_skip_blocks: Option<u32>
) -> Result<Self::Inner, Error>
fn build(
&self,
checksum: &str,
_override_skip_blocks: Option<u32>
) -> Result<Self::Inner, Error>
Build a new blockchain for the given descriptor wallet_name Read more
sourcefn build_for_wallet<D: BatchDatabase>(
&self,
wallet: &Wallet<D>,
override_skip_blocks: Option<u32>
) -> Result<Self::Inner, Error>
fn build_for_wallet<D: BatchDatabase>(
&self,
wallet: &Wallet<D>,
override_skip_blocks: Option<u32>
) -> Result<Self::Inner, Error>
Build a new blockchain for a given wallet Read more
sourcefn sync_wallet<D: BatchDatabase>(
&self,
wallet: &Wallet<D>,
override_skip_blocks: Option<u32>,
sync_options: SyncOptions
) -> Result<(), Error>
fn sync_wallet<D: BatchDatabase>(
&self,
wallet: &Wallet<D>,
override_skip_blocks: Option<u32>,
sync_options: SyncOptions
) -> Result<(), Error>
async-interface
.Use BlockchainFactory::build_for_wallet
to get a blockchain, then sync the wallet Read more
sourceimpl Clone for RpcBlockchainFactory
impl Clone for RpcBlockchainFactory
sourcefn clone(&self) -> RpcBlockchainFactory
fn clone(&self) -> RpcBlockchainFactory
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for RpcBlockchainFactory
impl Send for RpcBlockchainFactory
impl Sync for RpcBlockchainFactory
impl Unpin for RpcBlockchainFactory
impl UnwindSafe for RpcBlockchainFactory
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more