logo
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>,
}
Available on crate feature 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

The type returned when building a blockchain from this factory

Build a new blockchain for the given descriptor wallet_name Read more

Build a new blockchain for a given wallet Read more

Available on neither WebAssembly nor crate feature async-interface.

Use BlockchainFactory::build_for_wallet to get a blockchain, then sync the wallet Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.