pub struct ClientBuilder { /* private fields */ }
Expand description

Builder to construct client instance with sensible default values

Implementations§

source§

impl ClientBuilder

source

pub fn new() -> Self

Creates an IOTA client builder.

source

pub fn with_node(self, url: &str) -> Result<Self>

Adds an IOTA node by its URL.

source

pub fn with_primary_node( self, url: &str, jwt: Option<String>, basic_auth_name_pwd: Option<(&str, &str)> ) -> Result<Self>

Adds an IOTA node by its URL to be used as primary node, with optional jwt and or basic authentication

source

pub fn with_primary_pow_node( self, url: &str, jwt: Option<String>, basic_auth_name_pwd: Option<(&str, &str)> ) -> Result<Self>

Adds an IOTA node by its URL to be used as primary PoW node (for remote PoW), with optional jwt and or basic authentication

source

pub fn with_permanode( self, url: &str, jwt: Option<String>, basic_auth_name_pwd: Option<(&str, &str)> ) -> Result<Self>

Adds a permanode by its URL, with optional jwt and or basic authentication

source

pub fn with_node_auth( self, url: &str, jwt: Option<String>, basic_auth_name_pwd: Option<(&str, &str)> ) -> Result<Self>

Adds an IOTA node by its URL with optional jwt and or basic authentication

source

pub fn with_nodes(self, urls: &[&str]) -> Result<Self>

Adds a list of IOTA nodes by their URLs.

source

pub fn with_node_sync_interval(self, node_sync_interval: Duration) -> Self

Set the node sync interval

source

pub fn with_node_sync_disabled(self) -> Self

Disables the node syncing process. Every node will be considered healthy and ready to use.

source

pub fn with_offline_mode(self) -> Self

Allows creating the client without nodes for offline address generation or signing

source

pub async fn with_node_pool_urls( self, node_pool_urls: &[String] ) -> Result<Self>

Get node list from the node_pool_urls

source

pub fn with_quorum(self, quorum: bool) -> Self

Set if quroum should be used or not

source

pub fn with_quorum_size(self, quorum_size: usize) -> Self

Set amount of nodes which should be used for quorum

source

pub fn with_quorum_threshold(self, threshold: usize) -> Self

Set quorum_threshold

source

pub fn with_network(self, network: &str) -> Self

Selects the type of network to get default nodes for it, only “testnet” is supported at the moment. Nodes that don’t belong to this network are ignored. The &str must match a part or all of the networkId returned in the nodeinfo from a node. For example, if the networkId is "private-tangle", "tangle" can be used. Default nodes are only used when no other nodes are provided.

source

pub fn with_local_pow(self, local: bool) -> Self

Sets whether the PoW should be done locally or remotely.

source

pub fn with_fallback_to_local_pow(self, fallback_to_local_pow: bool) -> Self

Sets whether the PoW should be done locally in case a node doesn’t support remote PoW.

source

pub fn with_tips_interval(self, tips_interval: u64) -> Self

Sets after how many seconds new tips will be requested during PoW

source

pub fn with_request_timeout(self, timeout: Duration) -> Self

Sets the default request timeout.

source

pub fn with_api_timeout(self, api: Api, timeout: Duration) -> Self

Sets the request timeout for a specific API usage.

source

pub async fn finish(self) -> Result<Client>

Build the Client instance.

Trait Implementations§

source§

impl Clone for ClientBuilder

source§

fn clone(&self) -> ClientBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for ClientBuilder

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · 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 Twhere U: From<T>,

const: unstable · 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
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