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>,
}
This is supported 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

This is supported 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

Performs the conversion.

Performs the conversion.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.