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.