pub struct HyperSyncClient { /* private fields */ }
Expand description
A client for interacting with a HyperSync API to retrieve blockchain data.
Implementations§
Source§impl HyperSyncClient
impl HyperSyncClient
Sourcepub fn new(chain: SharedChain, tx: UnboundedSender<BlockchainMessage>) -> Self
pub fn new(chain: SharedChain, tx: UnboundedSender<BlockchainMessage>) -> Self
Creates a new HyperSyncClient
instance for the given chain and message sender.
§Panics
Panics if the chain’s hypersync_url
is invalid or if the underlying client cannot be initialized.
Sourcepub async fn request_pool_created_events(
&mut self,
from_block: u32,
dex: &DexExtended,
) -> Vec<PoolCreated>
pub async fn request_pool_created_events( &mut self, from_block: u32, dex: &DexExtended, ) -> Vec<PoolCreated>
Fetches historical pool creation events for a specific DEX from the HyperSync API.
Sourcepub fn disconnect(&mut self)
pub fn disconnect(&mut self)
Disconnects from the HyperSync service and stops all background tasks.
Sourcepub fn subscribe_blocks(&mut self)
pub fn subscribe_blocks(&mut self)
Starts a background task that continuously polls for new blockchain blocks.
Sourcepub fn unsubscribe_blocks(&mut self)
pub fn unsubscribe_blocks(&mut self)
Unsubscribes to the new blocks by stopping the background watch task.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HyperSyncClient
impl !RefUnwindSafe for HyperSyncClient
impl Send for HyperSyncClient
impl Sync for HyperSyncClient
impl Unpin for HyperSyncClient
impl !UnwindSafe for HyperSyncClient
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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