Skip to content

Commit

Permalink
indexers: make esplora client accessible via deref
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jul 17, 2024
1 parent 54568a3 commit 0b72485
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/indexers/esplora.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

use std::collections::BTreeMap;
use std::num::NonZeroU32;
use std::ops::{Deref, DerefMut};

use bpstd::{Address, DerivedAddr, LockTime, Outpoint, SeqNo, Tx, Witness};
use descriptors::Descriptor;
Expand All @@ -42,9 +43,20 @@ pub struct Client {
pub(crate) kind: ClientKind,
}

impl Deref for Client {
type Target = BlockingClient;

fn deref(&self) -> &Self::Target { &self.inner }
}

impl DerefMut for Client {
fn deref_mut(&mut self) -> &mut Self::Target { &mut self.inner }
}

/// Represents the kind of client used for interacting with the Esplora indexer.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum ClientKind {
#[default]
Esplora,
#[cfg(feature = "mempool")]
Mempool,
Expand Down

0 comments on commit 0b72485

Please sign in to comment.