pub struct Client { /* private fields */ }Expand description
Solana HyperSync client.
Thread-safe and cheap to clone (wraps an Arc).
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(config: ClientConfig) -> Result<Self>
pub fn new(config: ClientConfig) -> Result<Self>
Create a new client with the given configuration.
Sourcepub fn new_with_agent(
config: ClientConfig,
user_agent: impl Into<String>,
) -> Result<Self>
pub fn new_with_agent( config: ClientConfig, user_agent: impl Into<String>, ) -> Result<Self>
Create a new client with the given configuration and a custom user agent.
This mirrors the EVM and Fuel HyperSync clients and is intended for use by language bindings (Node.js) and downstream tools that want to identify themselves to the server.
Sourcepub async fn get_height(&self) -> Result<u64>
pub async fn get_height(&self) -> Result<u64>
Get the current chain height (latest slot).
Sourcepub async fn get_arrow(&self, query: &SolanaQuery) -> Result<QueryResponse>
pub async fn get_arrow(&self, query: &SolanaQuery) -> Result<QueryResponse>
Execute a single query and return Arrow data.
Sourcepub async fn get_arrow_with_rate_limit(
&self,
query: &SolanaQuery,
) -> Result<QueryResponseWithRateLimit<QueryResponse>>
pub async fn get_arrow_with_rate_limit( &self, query: &SolanaQuery, ) -> Result<QueryResponseWithRateLimit<QueryResponse>>
Executes query with retries and returns the response in Arrow format along with rate limit information from the server.
This is useful for consumers that want to inspect rate limit headers and
implement their own rate limiting logic in external systems. Retry and
back-off behaviour is identical to get_arrow:
a 429 is slept out against x-ratelimit-reset and retried.
Sourcepub async fn get_with_rate_limit(
&self,
query: &SolanaQuery,
) -> Result<QueryResponseWithRateLimit<SolanaResponse>>
pub async fn get_with_rate_limit( &self, query: &SolanaQuery, ) -> Result<QueryResponseWithRateLimit<SolanaResponse>>
Executes query with retries and returns typed Rust structs along with rate limit information from the server.
This is useful for consumers that want to inspect rate limit headers and
implement their own rate limiting logic in external systems. Retry and
back-off behaviour is identical to get.
Sourcepub async fn collect_arrow(
self: &Arc<Self>,
query: SolanaQuery,
config: StreamConfig,
) -> Result<QueryResponse>
pub async fn collect_arrow( self: &Arc<Self>, query: SolanaQuery, config: StreamConfig, ) -> Result<QueryResponse>
Execute a query that may span many server responses, paginating automatically. Returns a single merged response.
Sourcepub fn stream_arrow(
self: &Arc<Self>,
query: SolanaQuery,
config: StreamConfig,
) -> Receiver<Result<QueryResponse>>
pub fn stream_arrow( self: &Arc<Self>, query: SolanaQuery, config: StreamConfig, ) -> Receiver<Result<QueryResponse>>
Stream query results with concurrent fetching and adaptive batch sizing.
Returns an mpsc receiver that yields QueryResponse items in slot order.
Sourcepub async fn get(&self, query: &SolanaQuery) -> Result<SolanaResponse>
pub async fn get(&self, query: &SolanaQuery) -> Result<SolanaResponse>
Execute a single query and return typed Rust structs.
Like Client::get_arrow, but decodes the Arrow tables into the
Vec<T> shapes in crate::simple_types.
Sourcepub async fn collect(
self: &Arc<Self>,
query: SolanaQuery,
config: StreamConfig,
) -> Result<SolanaResponse>
pub async fn collect( self: &Arc<Self>, query: SolanaQuery, config: StreamConfig, ) -> Result<SolanaResponse>
Execute a query that may span many server responses, paginating automatically, and return typed Rust structs.
This is the typed counterpart of Client::collect_arrow.
Sourcepub fn rate_limit_info(&self) -> Option<RateLimitInfo>
pub fn rate_limit_info(&self) -> Option<RateLimitInfo>
Returns the most recently observed rate limit information, if any.
Updated after successful and 429 query responses that contain rate limit headers.
Sourcepub async fn wait_for_rate_limit(&self)
pub async fn wait_for_rate_limit(&self)
Waits until the current rate limit window resets, if the client is rate limited.
Returns immediately if:
- No rate limit information has been observed yet
- There is remaining quota in the current window
This method is useful for consumers who want to explicitly wait before making requests, for example when coordinating rate limits across multiple systems.