pub struct LighterRawHttpClient { /* private fields */ }Expand description
Raw HTTP client for Lighter REST API operations.
This client owns the transport, base URL, default headers, and rate limit. Methods map directly to venue endpoints and return venue response models without converting to Nautilus domain types.
Implementations§
Source§impl LighterRawHttpClient
impl LighterRawHttpClient
Sourcepub fn new(
environment: LighterEnvironment,
base_url: Option<String>,
timeout_secs: u64,
proxy_url: Option<String>,
) -> LighterHttpResult<Self>
pub fn new( environment: LighterEnvironment, base_url: Option<String>, timeout_secs: u64, proxy_url: Option<String>, ) -> LighterHttpResult<Self>
Creates a new LighterRawHttpClient.
§Errors
Returns an error if the underlying HTTP client cannot be created.
Sourcepub fn new_with_quotas(
environment: LighterEnvironment,
base_url: Option<String>,
timeout_secs: u64,
proxy_url: Option<String>,
default_quota: Quota,
tx_rate_limiter: Option<Arc<LighterTxRateLimiter>>,
) -> LighterHttpResult<Self>
pub fn new_with_quotas( environment: LighterEnvironment, base_url: Option<String>, timeout_secs: u64, proxy_url: Option<String>, default_quota: Quota, tx_rate_limiter: Option<Arc<LighterTxRateLimiter>>, ) -> LighterHttpResult<Self>
Creates a new LighterRawHttpClient with an explicit read quota and an
optional shared transaction limiter.
default_quota governs the REST read bucket (LIGHTER_REST_BUCKET),
resolved from the client’s configured rest_quota_per_min (detected tier
only logs hints). tx_rate_limiter paces sendTx / sendTxBatch; the
execution client shares one limiter across this and the WebSocket
sendTx path so their combined rate honours the single venue tx bucket.
The data client passes None (it sends no transactions).
§Errors
Returns an error if the underlying HTTP client cannot be created.
Sourcepub const fn environment(&self) -> LighterEnvironment
pub const fn environment(&self) -> LighterEnvironment
Returns the configured Lighter environment.
Sourcepub fn set_base_url(&mut self, base_url: &str)
pub fn set_base_url(&mut self, base_url: &str)
Overrides the REST base URL. Intended for mock-server tests.
Sourcepub fn set_retry_manager(
&mut self,
retry_manager: RetryManager<LighterHttpError>,
)
pub fn set_retry_manager( &mut self, retry_manager: RetryManager<LighterHttpError>, )
Overrides the retry manager. Intended for mock-server tests that need
shorter backoff than [create_http_retry_manager] produces.
Sourcepub async fn get_order_books(
&self,
query: &LighterOrderBooksQuery,
) -> LighterHttpResult<LighterOrderBooks>
pub async fn get_order_books( &self, query: &LighterOrderBooksQuery, ) -> LighterHttpResult<LighterOrderBooks>
Calls GET /api/v1/orderBooks.
§Errors
Returns an error if the request fails or the response is invalid.
Sourcepub async fn get_order_book_details(
&self,
query: &LighterOrderBookDetailsQuery,
) -> LighterHttpResult<LighterOrderBookDetails>
pub async fn get_order_book_details( &self, query: &LighterOrderBookDetailsQuery, ) -> LighterHttpResult<LighterOrderBookDetails>
Calls GET /api/v1/orderBookDetails.
§Errors
Returns an error if the request fails or the response is invalid.
Sourcepub async fn get_order_book_orders(
&self,
query: &LighterOrderBookOrdersQuery,
) -> LighterHttpResult<LighterOrderBookOrders>
pub async fn get_order_book_orders( &self, query: &LighterOrderBookOrdersQuery, ) -> LighterHttpResult<LighterOrderBookOrders>
Calls GET /api/v1/orderBookOrders.
§Errors
Returns an error if the request fails or the response is invalid.
Sourcepub async fn get_recent_trades(
&self,
query: &LighterRecentTradesQuery,
) -> LighterHttpResult<LighterTrades>
pub async fn get_recent_trades( &self, query: &LighterRecentTradesQuery, ) -> LighterHttpResult<LighterTrades>
Calls GET /api/v1/recentTrades.
§Errors
Returns an error if the request fails or the response is invalid.
Sourcepub async fn get_trades(
&self,
query: &LighterTradesQuery,
) -> LighterHttpResult<LighterTrades>
pub async fn get_trades( &self, query: &LighterTradesQuery, ) -> LighterHttpResult<LighterTrades>
Sourcepub async fn get_candles(
&self,
query: &LighterCandlesQuery,
) -> LighterHttpResult<LighterCandles>
pub async fn get_candles( &self, query: &LighterCandlesQuery, ) -> LighterHttpResult<LighterCandles>
Calls GET /api/v1/candles.
§Errors
Returns an error if the request fails or the response is invalid.
Sourcepub async fn get_fundings(
&self,
query: &LighterFundingsQuery,
) -> LighterHttpResult<LighterFundings>
pub async fn get_fundings( &self, query: &LighterFundingsQuery, ) -> LighterHttpResult<LighterFundings>
Calls GET /api/v1/fundings.
§Errors
Returns an error if the request fails or the response is invalid.
Sourcepub async fn get_account(
&self,
query: &LighterAccountQuery,
) -> LighterHttpResult<LighterAccountsResponse>
pub async fn get_account( &self, query: &LighterAccountQuery, ) -> LighterHttpResult<LighterAccountsResponse>
Calls GET /api/v1/account.
§Errors
Returns an error if the request fails or the response is invalid.
Sourcepub async fn get_account_active_orders(
&self,
query: &LighterAccountActiveOrdersQuery,
) -> LighterHttpResult<LighterOrders>
pub async fn get_account_active_orders( &self, query: &LighterAccountActiveOrdersQuery, ) -> LighterHttpResult<LighterOrders>
Calls GET /api/v1/accountActiveOrders.
§Errors
Returns an error if the request fails or the response is invalid.
Sourcepub async fn get_account_inactive_orders(
&self,
query: &LighterAccountInactiveOrdersQuery,
) -> LighterHttpResult<LighterOrders>
pub async fn get_account_inactive_orders( &self, query: &LighterAccountInactiveOrdersQuery, ) -> LighterHttpResult<LighterOrders>
Calls GET /api/v1/accountInactiveOrders.
§Errors
Returns an error if the request fails or the response is invalid.
Sourcepub async fn get_next_nonce(
&self,
query: &LighterNextNonceQuery,
) -> LighterHttpResult<LighterNextNonce>
pub async fn get_next_nonce( &self, query: &LighterNextNonceQuery, ) -> LighterHttpResult<LighterNextNonce>
Calls GET /api/v1/nextNonce.
§Errors
Returns an error if the request fails or the response is invalid.
Sourcepub async fn get_maker_only_api_keys(
&self,
query: &LighterMakerOnlyApiKeysQuery,
) -> LighterHttpResult<LighterMakerOnlyApiKeys>
pub async fn get_maker_only_api_keys( &self, query: &LighterMakerOnlyApiKeysQuery, ) -> LighterHttpResult<LighterMakerOnlyApiKeys>
Calls GET /api/v1/getMakerOnlyApiKeys.
§Errors
Returns an error if the request fails or the response is invalid.
Sourcepub async fn send_tx(
&self,
request: &LighterSendTxRequest,
) -> LighterHttpResult<LighterSendTxResponse>
pub async fn send_tx( &self, request: &LighterSendTxRequest, ) -> LighterHttpResult<LighterSendTxResponse>
Calls POST /api/v1/sendTx.
§Errors
Returns an error if the request fails or the response is invalid.
Sourcepub async fn send_tx_batch(
&self,
request: &LighterSendTxBatchRequest,
) -> LighterHttpResult<LighterSendTxBatchResponse>
pub async fn send_tx_batch( &self, request: &LighterSendTxBatchRequest, ) -> LighterHttpResult<LighterSendTxBatchResponse>
Calls POST /api/v1/sendTxBatch.
§Errors
Returns an error if the request fails or the response is invalid.
Trait Implementations§
Source§impl Clone for LighterRawHttpClient
impl Clone for LighterRawHttpClient
Source§fn clone(&self) -> LighterRawHttpClient
fn clone(&self) -> LighterRawHttpClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LighterRawHttpClient
impl Debug for LighterRawHttpClient
Auto Trait Implementations§
impl !RefUnwindSafe for LighterRawHttpClient
impl !UnwindSafe for LighterRawHttpClient
impl Freeze for LighterRawHttpClient
impl Send for LighterRawHttpClient
impl Sync for LighterRawHttpClient
impl Unpin for LighterRawHttpClient
impl UnsafeUnpin for LighterRawHttpClient
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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