Struct HermesClient

Source
pub struct HermesClient { /* private fields */ }
Expand description

HermesClient 是对外的主要交互入口

Implementations§

Source§

impl HermesClient

Source

pub fn new<S: Into<String>>(base_url: S) -> Self

创建一个新的 HermesClient

Source

pub async fn get_price_feeds( &self, query: Option<&str>, asset_type: Option<&str>, ) -> Result<Vec<PriceFeed>, HermesError>

获取所有 price feeds GET /v2/price_feeds

Source

pub async fn get_latest_price_updates( &self, ids: &[&str], encoding: Option<&str>, parsed: Option<bool>, ignore_invalid_price_ids: Option<bool>, ) -> Result<PriceUpdatesResponse, HermesError>

获取指定 price feed id(s) 的最新价格更新 GET /v2/updates/price/latest

Source

pub async fn get_price_updates_by_time( &self, publish_time: i64, ids: &[&str], encoding: Option<&str>, parsed: Option<bool>, ignore_invalid_price_ids: Option<bool>, ) -> Result<PriceUpdatesResponse, HermesError>

SSE 接口(GET /v2/updates/price/stream)可根据需要额外封装 此处仅给出函数签名参考 如果需要使用 SSE,可以考虑 reqwest_eventsource 或者 eventsource-client 库 根据时间戳查询价格更新 GET /v2/updates/price/{publish_time}

Source

pub async fn get_publisher_stake_caps( &self, encoding: Option<&str>, parsed: Option<bool>, ) -> Result<PublisherStakeCapsResponse, HermesError>

获取最新的 Publisher Stake Caps GET /v2/updates/publisher_stake_caps/latest

Source

pub async fn get_twap_latest( &self, window_seconds: u64, ids: &[&str], encoding: Option<&str>, parsed: Option<bool>, ignore_invalid_price_ids: Option<bool>, ) -> Result<TwapResponse, HermesError>

获取最新自定义窗口TWAP GET /v2/updates/twap/{window_seconds}/latest

Trait Implementations§

Source§

impl Clone for HermesClient

Source§

fn clone(&self) -> HermesClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HermesClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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

Source§

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

impl<T> ErasedDestructor for T
where T: 'static,