pub struct EsploraSyncClient<L: Deref>{ /* private fields */ }
esplora-blocking
or esplora-async
only.Expand description
Synchronizes LDK with a given Esplora
server.
Needs to be registered with a ChainMonitor
via the Filter
interface to be informed of
transactions and outputs to monitor for on-chain confirmation, unconfirmation, and
reconfirmation.
Note that registration via Filter
needs to happen before any calls to
Watch::watch_channel
to ensure we get notified of the items to monitor.
This uses and exposes either a blocking or async client variant dependent on whether the
esplora-blocking
or the esplora-async
feature is enabled.
Implementations§
source§impl<L: Deref> EsploraSyncClient<L>
impl<L: Deref> EsploraSyncClient<L>
sourcepub fn new(server_url: String, logger: L) -> Self
pub fn new(server_url: String, logger: L) -> Self
Returns a new EsploraSyncClient
object.
sourcepub fn from_client(client: AsyncClient, logger: L) -> Self
pub fn from_client(client: AsyncClient, logger: L) -> Self
Returns a new EsploraSyncClient
object using the given Esplora client.
sourcepub async fn sync(
&self,
confirmables: Vec<&(dyn Confirm + Sync + Send)>
) -> Result<(), TxSyncError>
Available on WebAssembly or crate feature async-interface
only.
pub async fn sync( &self, confirmables: Vec<&(dyn Confirm + Sync + Send)> ) -> Result<(), TxSyncError>
async-interface
only.Synchronizes the given confirmables
via their Confirm
interface implementations. This
method should be called regularly to keep LDK up-to-date with current chain data.
For example, instances of ChannelManager
and ChainMonitor
can be informed about the
newest on-chain activity related to the items previously registered via the Filter
interface.
sourcepub fn client(&self) -> &AsyncClient
pub fn client(&self) -> &AsyncClient
Returns a reference to the underlying esplora client.
Trait Implementations§
source§impl<L: Deref> Filter for EsploraSyncClient<L>
impl<L: Deref> Filter for EsploraSyncClient<L>
source§fn register_tx(&self, txid: &Txid, _script_pubkey: &Script)
fn register_tx(&self, txid: &Txid, _script_pubkey: &Script)
txid
and having an output with script_pubkey
as
a spending condition.source§fn register_output(&self, output: WatchedOutput)
fn register_output(&self, output: WatchedOutput)
Auto Trait Implementations§
impl<L> !Freeze for EsploraSyncClient<L>
impl<L> !RefUnwindSafe for EsploraSyncClient<L>
impl<L> Send for EsploraSyncClient<L>where
L: Send,
impl<L> Sync for EsploraSyncClient<L>where
L: Sync,
impl<L> Unpin for EsploraSyncClient<L>where
L: Unpin,
impl<L> !UnwindSafe for EsploraSyncClient<L>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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