pub struct StreamApi { /* private fields */ }Expand description
Stream API client for real-time data subscriptions
Implementations§
Source§impl StreamApi
impl StreamApi
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if connected
Sourcepub async fn connect(&self) -> Result<(), ChainStreamError>
pub async fn connect(&self) -> Result<(), ChainStreamError>
Connect to the WebSocket server
Sourcepub async fn disconnect(&self)
pub async fn disconnect(&self)
Disconnect from the WebSocket server
Sourcepub async fn subscribe<F>(
&self,
channel: &str,
callback: F,
filter: Option<&str>,
method_name: Option<&str>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe<F>( &self, channel: &str, callback: F, filter: Option<&str>, method_name: Option<&str>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to a channel with a raw callback
Sourcepub async fn subscribe_token_candles<F>(
&self,
chain: &str,
token_address: &str,
resolution: Resolution,
callback: F,
filter: Option<&str>,
price_type: Option<PriceType>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_token_candles<F>( &self, chain: &str, token_address: &str, resolution: Resolution, callback: F, filter: Option<&str>, price_type: Option<PriceType>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to token candle data price_type: PriceType::Usd (default) or PriceType::Native
Sourcepub async fn subscribe_pool_candles<F>(
&self,
chain: &str,
pool_address: &str,
resolution: Resolution,
callback: F,
filter: Option<&str>,
price_type: Option<PriceType>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_pool_candles<F>( &self, chain: &str, pool_address: &str, resolution: Resolution, callback: F, filter: Option<&str>, price_type: Option<PriceType>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to pool candle data price_type: PriceType::Usd (default) or PriceType::Native
Sourcepub async fn subscribe_pair_candles<F>(
&self,
chain: &str,
pair_address: &str,
resolution: Resolution,
callback: F,
filter: Option<&str>,
price_type: Option<PriceType>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_pair_candles<F>( &self, chain: &str, pair_address: &str, resolution: Resolution, callback: F, filter: Option<&str>, price_type: Option<PriceType>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to pair candle data pair_address format: {tokenA}-{tokenB} price_type: PriceType::Usd (default) or PriceType::Native
Sourcepub async fn subscribe_token_stats<F>(
&self,
chain: &str,
token_address: &str,
callback: F,
filter: Option<&str>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_token_stats<F>( &self, chain: &str, token_address: &str, callback: F, filter: Option<&str>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to token statistics
Sourcepub async fn subscribe_new_token<F>(
&self,
chain: &str,
callback: F,
filter: Option<&str>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_new_token<F>( &self, chain: &str, callback: F, filter: Option<&str>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to new tokens
Sourcepub async fn subscribe_token_trade<F>(
&self,
chain: &str,
token_address: &str,
callback: F,
filter: Option<&str>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_token_trade<F>( &self, chain: &str, token_address: &str, callback: F, filter: Option<&str>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to token trades
Sourcepub async fn subscribe_wallet_balance<F>(
&self,
chain: &str,
wallet_address: &str,
callback: F,
filter: Option<&str>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_wallet_balance<F>( &self, chain: &str, wallet_address: &str, callback: F, filter: Option<&str>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to wallet balance
Sourcepub async fn subscribe_token_holders<F>(
&self,
chain: &str,
token_address: &str,
callback: F,
filter: Option<&str>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_token_holders<F>( &self, chain: &str, token_address: &str, callback: F, filter: Option<&str>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to token holders
Sourcepub async fn subscribe_token_supply<F>(
&self,
chain: &str,
token_address: &str,
callback: F,
filter: Option<&str>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_token_supply<F>( &self, chain: &str, token_address: &str, callback: F, filter: Option<&str>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to token supply
Sourcepub async fn subscribe_dex_pool_balance<F>(
&self,
chain: &str,
pool_address: &str,
callback: F,
filter: Option<&str>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_dex_pool_balance<F>( &self, chain: &str, pool_address: &str, callback: F, filter: Option<&str>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to DEX pool balance
Sourcepub async fn subscribe_token_max_liquidity<F>(
&self,
chain: &str,
token_address: &str,
callback: F,
filter: Option<&str>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_token_max_liquidity<F>( &self, chain: &str, token_address: &str, callback: F, filter: Option<&str>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to token max liquidity
Sourcepub async fn subscribe_token_total_liquidity<F>(
&self,
chain: &str,
token_address: &str,
callback: F,
filter: Option<&str>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_token_total_liquidity<F>( &self, chain: &str, token_address: &str, callback: F, filter: Option<&str>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to token total liquidity
Sourcepub async fn subscribe_wallet_pnl<F>(
&self,
chain: &str,
wallet_address: &str,
callback: F,
filter: Option<&str>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_wallet_pnl<F>( &self, chain: &str, wallet_address: &str, callback: F, filter: Option<&str>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to wallet PnL
Sourcepub async fn subscribe_new_tokens_metadata<F>(
&self,
chain: &str,
callback: F,
filter: Option<&str>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_new_tokens_metadata<F>( &self, chain: &str, callback: F, filter: Option<&str>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to new tokens metadata
Sourcepub async fn subscribe_ranking_tokens_list<F>(
&self,
chain: &str,
ranking_type: RankingType,
callback: F,
filter: Option<&str>,
) -> Result<Unsubscribe, ChainStreamError>
pub async fn subscribe_ranking_tokens_list<F>( &self, chain: &str, ranking_type: RankingType, callback: F, filter: Option<&str>, ) -> Result<Unsubscribe, ChainStreamError>
Subscribe to ranking tokens list