Struct hyperfuel_client::Client

source ·
pub struct Client { /* private fields */ }

Implementations§

source§

impl Client

source

pub fn new(cfg: Config) -> Result<Self>

Create a new client with given config

source

pub async fn create_parquet_folder( &self, query: Query, path: String ) -> Result<()>

Create a parquet file by executing a query.

If the query can’t be finished in a single request, this function will keep on making requests using the pagination mechanism (next_block) until it reaches the end. It will stream data into the parquet file as it comes from the server.

Path should point to a folder that will contain the parquet files in the end.

source

pub async fn get_height(&self) -> Result<u64>

Get the height of the source hypersync instance

source

pub async fn get_height_with_retry(&self) -> Result<u64>

Get the height of the source hypersync instance Internally calls get_height. On an error from the source hypersync instance, sleeps for 1 second (increasing by 1 each failure up to max of 5 seconds) and retries query until success.

source

pub async fn get_data(&self, query: &Query) -> Result<QueryResponseTyped>

Send a query request to the source hypersync instance.

Returns a query response which contains typed data.

NOTE: this query returns loads all transactions that your match your receipt, input, or output selections and applies the field selection to all these loaded transactions. So your query will return the data you want plus additional data from the loaded transactions. This functionality is in case you want to associate receipts, inputs, or outputs with eachother.

source

pub async fn get_selected_data( &self, query: &Query ) -> Result<QueryResponseTyped>

Send a query request to the source hypersync instance.

Returns a query response that which contains structured data that doesn’t include any inputs, outputs, and receipts that don’t exactly match the query’s input, outout, or receipt selection.

source

pub async fn preset_query_get_logs<H: Into<Hash>>( &self, emitting_contracts: Vec<H>, from_block: u64, to_block: Option<u64> ) -> Result<LogResponse>

Send a query request to the source hypersync instance.

Returns all log and logdata receipts of logs emitted by any of the specified contracts within the block range. If no ‘to_block’ is specified, query will run to the head of the chain. Returned data contains all the data needed to decode Fuel Log or LogData receipts as well as some extra data for context. This query doesn’t return any logs that were a part of a failed transaction.

NOTE: this function is experimental and might be removed in future versions.

source

pub async fn get_arrow_data(&self, query: &Query) -> Result<QueryResponse>

Send a query request to the source hypersync instance.

Returns a query response which contains arrow data.

NOTE: this query returns loads all transactions that your match your receipt, input, or output selections and applies the field selection to all these loaded transactions. So your query will return the data you want plus additional data from the loaded transactions. This functionality is in case you want to associate receipts, inputs, or outputs with eachother.

source

pub async fn get_arrow_data_with_retry( &self, query: &Query ) -> Result<QueryResponse>

Send a query request to the source hypersync instance. Internally calls send. On an error from the source hypersync instance, sleeps for 1 second (increasing by 1 each failure up to max of 5 seconds) and retries query until success.

Returns a query response which contains arrow data.

NOTE: this query returns loads all transactions that your match your receipt, input, or output selections and applies the field selection to all these loaded transactions. So your query will return the data you want plus additional data from the loaded transactions. This functionality is in case you want to associate receipts, inputs, or outputs with eachother. Format can be ArrowIpc.

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

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> 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> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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