Struct Builder

Source
pub struct Builder { /* private fields */ }
Available on non-crate feature uniffi only.
Expand description

A builder for an Node instance, allowing to set some configuration and module choices from the getgo.

§Defaults

  • Wallet entropy is sourced from a keys_seed file located under Config::storage_dir_path
  • Chain data is sourced from the Esplora endpoint https://blockstream.info/api
  • Gossip data is sourced via the peer-to-peer network

Implementations§

Source§

impl NodeBuilder

Source

pub fn new() -> Self

Creates a new builder instance with the default configuration.

Source

pub fn from_config(config: Config) -> Self

Creates a new builder instance from an Config.

Source

pub fn set_entropy_seed_path(&mut self, seed_path: String) -> &mut Self

Configures the Node instance to source its wallet entropy from a seed file on disk.

If the given file does not exist a new random seed file will be generated and stored at the given location.

Source

pub fn set_entropy_seed_bytes(&mut self, seed_bytes: [u8; 64]) -> &mut Self

Configures the Node instance to source its wallet entropy from the given WALLET_KEYS_SEED_LEN seed bytes.

Source

pub fn set_entropy_bip39_mnemonic( &mut self, mnemonic: Mnemonic, passphrase: Option<String>, ) -> &mut Self

Configures the Node instance to source its wallet entropy from a BIP 39 mnemonic.

Source

pub fn set_chain_source_esplora( &mut self, server_url: String, sync_config: Option<EsploraSyncConfig>, ) -> &mut Self

Configures the Node instance to source its chain data from the given Esplora server.

If no sync_config is given, default values are used. See EsploraSyncConfig for more information.

Source

pub fn set_chain_source_electrum( &mut self, server_url: String, sync_config: Option<ElectrumSyncConfig>, ) -> &mut Self

Configures the Node instance to source its chain data from the given Electrum server.

If no sync_config is given, default values are used. See ElectrumSyncConfig for more information.

Source

pub fn set_chain_source_bitcoind_rpc( &mut self, rpc_host: String, rpc_port: u16, rpc_user: String, rpc_password: String, ) -> &mut Self

Configures the Node instance to source its chain data from the given Bitcoin Core RPC endpoint.

Source

pub fn set_gossip_source_p2p(&mut self) -> &mut Self

Configures the Node instance to source its gossip data from the Lightning peer-to-peer network.

Source

pub fn set_gossip_source_rgs(&mut self, rgs_server_url: String) -> &mut Self

Configures the Node instance to source its gossip data from the given RapidGossipSync server.

Source

pub fn set_liquidity_source_lsps1( &mut self, node_id: PublicKey, address: SocketAddress, token: Option<String>, ) -> &mut Self

Configures the Node instance to source inbound liquidity from the given bLIP-51 / LSPS1 service.

Will mark the LSP as trusted for 0-confirmation channels, see Config::trusted_peers_0conf.

The given token will be used by the LSP to authenticate the user.

Source

pub fn set_liquidity_source_lsps2( &mut self, node_id: PublicKey, address: SocketAddress, token: Option<String>, ) -> &mut Self

Configures the Node instance to source just-in-time inbound liquidity from the given bLIP-52 / LSPS2 service.

Will mark the LSP as trusted for 0-confirmation channels, see Config::trusted_peers_0conf.

The given token will be used by the LSP to authenticate the user.

Source

pub fn set_liquidity_provider_lsps2( &mut self, service_config: LSPS2ServiceConfig, ) -> &mut Self

Configures the Node instance to provide an LSPS2 service, issuing just-in-time channels to clients.

Caution: LSP service support is in alpha and is considered an experimental feature.

Source

pub fn set_storage_dir_path(&mut self, storage_dir_path: String) -> &mut Self

Sets the used storage directory path.

Source

pub fn set_filesystem_logger( &mut self, log_file_path: Option<String>, max_log_level: Option<LogLevel>, ) -> &mut Self

Configures the Node instance to write logs to the filesystem.

The log_file_path defaults to DEFAULT_LOG_FILENAME in the configured Config::storage_dir_path if set to None.

If set, the max_log_level sets the maximum log level. Otherwise, the latter defaults to DEFAULT_LOG_LEVEL.

Source

pub fn set_log_facade_logger(&mut self) -> &mut Self

Configures the Node instance to write logs to the log facade.

Source

pub fn set_custom_logger(&mut self, log_writer: Arc<dyn LogWriter>) -> &mut Self

Configures the Node instance to write logs to the provided custom LogWriter.

Source

pub fn set_network(&mut self, network: Network) -> &mut Self

Sets the Bitcoin network used.

Source

pub fn set_listening_addresses( &mut self, listening_addresses: Vec<SocketAddress>, ) -> Result<&mut Self, BuildError>

Sets the IP address and TCP port on which Node will listen for incoming network connections.

Source

pub fn set_announcement_addresses( &mut self, announcement_addresses: Vec<SocketAddress>, ) -> Result<&mut Self, BuildError>

Sets the IP address and TCP port which Node will announce to the gossip network that it accepts connections on.

Note: If unset, the listening_addresses will be used as the list of addresses to announce.

Source

pub fn set_node_alias( &mut self, node_alias: String, ) -> Result<&mut Self, BuildError>

Sets the node alias that will be used when broadcasting announcements to the gossip network.

The provided alias must be a valid UTF-8 string and no longer than 32 bytes in total.

Source

pub fn build(&self) -> Result<Node, BuildError>

Builds a Node instance with a SqliteStore backend and according to the options previously configured.

Source

pub fn build_with_fs_store(&self) -> Result<Node, BuildError>

Builds a Node instance with a FilesystemStore backend and according to the options previously configured.

Source

pub fn build_with_vss_store( &self, vss_url: String, store_id: String, lnurl_auth_server_url: String, fixed_headers: HashMap<String, String>, ) -> Result<Node, BuildError>

Builds a Node instance with a VSS backend and according to the options previously configured.

Uses LNURL-auth based authentication scheme as default method for authentication/authorization.

The LNURL challenge will be retrieved by making a request to the given lnurl_auth_server_url. The returned JWT token in response to the signed LNURL request, will be used for authentication/authorization of all the requests made to VSS.

fixed_headers are included as it is in all the requests made to VSS and LNURL auth server.

Caution: VSS support is in alpha and is considered experimental. Using VSS (or any remote persistence) may cause LDK to panic if persistence failures are unrecoverable, i.e., if they remain unresolved after internal retries are exhausted.

Source

pub fn build_with_vss_store_and_fixed_headers( &self, vss_url: String, store_id: String, fixed_headers: HashMap<String, String>, ) -> Result<Node, BuildError>

Builds a Node instance with a VSS backend and according to the options previously configured.

Uses FixedHeaders as default method for authentication/authorization.

Given fixed_headers are included as it is in all the requests made to VSS.

Caution: VSS support is in alpha and is considered experimental. Using VSS (or any remote persistence) may cause LDK to panic if persistence failures are unrecoverable, i.e., if they remain unresolved after internal retries are exhausted.

Source

pub fn build_with_vss_store_and_header_provider( &self, vss_url: String, store_id: String, header_provider: Arc<dyn VssHeaderProvider>, ) -> Result<Node, BuildError>

Builds a Node instance with a VSS backend and according to the options previously configured.

Given header_provider is used to attach headers to every request made to VSS.

Caution: VSS support is in alpha and is considered experimental. Using VSS (or any remote persistence) may cause LDK to panic if persistence failures are unrecoverable, i.e., if they remain unresolved after internal retries are exhausted.

Source

pub fn build_with_store( &self, kv_store: Arc<dyn KVStore + Sync + Send>, ) -> Result<Node, BuildError>

Builds a Node instance according to the options previously configured.

Trait Implementations§

Source§

impl Debug for NodeBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,