pub struct HermesClient { /* private fields */ }
Expand description
HermesClient 是对外的主要交互入口
Implementations§
Source§impl HermesClient
impl HermesClient
Sourcepub async fn get_price_feeds(
&self,
query: Option<&str>,
asset_type: Option<&str>,
) -> Result<Vec<PriceFeed>, HermesError>
pub async fn get_price_feeds( &self, query: Option<&str>, asset_type: Option<&str>, ) -> Result<Vec<PriceFeed>, HermesError>
获取所有 price feeds GET /v2/price_feeds
Sourcepub async fn get_latest_price_updates(
&self,
ids: &[&str],
encoding: Option<&str>,
parsed: Option<bool>,
ignore_invalid_price_ids: Option<bool>,
) -> Result<PriceUpdatesResponse, HermesError>
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
Sourcepub 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>
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}
Sourcepub async fn get_publisher_stake_caps(
&self,
encoding: Option<&str>,
parsed: Option<bool>,
) -> Result<PublisherStakeCapsResponse, HermesError>
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
Sourcepub 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>
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
impl Clone for HermesClient
Source§fn clone(&self) -> HermesClient
fn clone(&self) -> HermesClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for HermesClient
impl !RefUnwindSafe for HermesClient
impl Send for HermesClient
impl Sync for HermesClient
impl Unpin for HermesClient
impl !UnwindSafe for HermesClient
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