Skip to main content

Builder

Struct Builder 

Source
pub struct Builder<T, S, O> { /* private fields */ }
Expand description

Builder pattern for creating a crate::ddk::DlcDevKit process.

Implementationsยง

Sourceยง

impl<T: Transport, S: Storage, O: Oracle> Builder<T, S, O>

Source

pub fn new() -> Self

Create a new, default DDK builder.

Source

pub fn set_name(&mut self, name: &str) -> &mut Self

Set the name of the DDK process. Used as an identifier for the process created. Creates a directory for the process with the name specifed. All file-based components will be stored in a directory under the storage path set in the DdkConfig and the name. If no name is set, defaults to a generated uuid.

Source

pub fn set_transport(&mut self, transport: Arc<T>) -> &mut Self

The communication layer of DDK. Type MUST implement crate::Transport. Transport sets up listeners, communicates with counterparties, and passes DLC messages to the Manager.

Source

pub fn set_storage(&mut self, storage: Arc<S>) -> &mut Self

DLC contract storage. Storage is used by the ddk_manager::manager::Manager to create, update, retrieve, and delete contracts. MUST implement crate::Storage.

Source

pub fn set_oracle(&mut self, oracle: Arc<O>) -> &mut Self

Oracle implementation for the ddk_manager::manager::Manager to retrieve oracle attestations and announcements. MUST implement crate::Oracle.

Source

pub fn set_contract_address_generator( &mut self, contract_address_generator: Arc<dyn AddressGenerator + Send + Sync + 'static>, ) -> &mut Self

Wallet implementation for the ddk_manager::manager::Manager to retrieve wallet keys and sign transactions. For now, just uses the DlcDevKitWallet implementation. Optionally can use a custom address generation.

Source

pub fn set_esplora_host(&mut self, host: String) -> &mut Self

Set the esplora server to connect to.

Source

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

Set the network DDK connects to.

Source

pub fn set_seed_bytes( &mut self, seed_config: SeedConfig, ) -> Result<&mut Self, BuilderError>

Set the seed bytes for the wallet.

Source

pub fn set_logger(&mut self, logger: Arc<Logger>) -> &mut Self

Set the logger for the DDK instance.

Source

pub async fn finish(&self) -> Result<DlcDevKit<T, S, O>, Error>

Builds the DlcDevKit instance. Fails if any components are missing.

Trait Implementationsยง

Sourceยง

impl<T: Clone, S: Clone, O: Clone> Clone for Builder<T, S, O>

Sourceยง

fn clone(&self) -> Builder<T, S, O>

Returns a duplicate 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<T: Transport, S: Storage, O: Oracle> Default for Builder<T, S, O>

Defaults when creating a DDK application Transport, storage, and oracle is set to none.

esplora_host: https://mutinynet.com/api network: Network::Signet

Sourceยง

fn default() -> Self

Returns the โ€œdefault valueโ€ for a type. Read more

Auto Trait Implementationsยง

ยง

impl<T, S, O> Freeze for Builder<T, S, O>

ยง

impl<T, S, O> !RefUnwindSafe for Builder<T, S, O>

ยง

impl<T, S, O> Send for Builder<T, S, O>
where T: Sync + Send, S: Sync + Send, O: Sync + Send,

ยง

impl<T, S, O> Sync for Builder<T, S, O>
where T: Sync + Send, S: Sync + Send, O: Sync + Send,

ยง

impl<T, S, O> Unpin for Builder<T, S, O>

ยง

impl<T, S, O> UnsafeUnpin for Builder<T, S, O>

ยง

impl<T, S, O> !UnwindSafe for Builder<T, S, O>

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> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> 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> ToOwned for T
where T: Clone,

Sourceยง

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 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,