pub trait HyperLiquidEndpointRouter {
// Required methods
fn rest_endpoint(&self) -> &'static str;
fn ws_endpoint(&self) -> &str;
}Expand description
HyperLiquid-specific endpoint router trait.
This trait defines methods for obtaining the correct API endpoints for HyperLiquid. HyperLiquid uses the simplest structure with a single REST and WebSocket endpoint.
§Implementation Notes
- REST API uses a single domain for all operations (
/infofor public,/exchangefor private) - WebSocket has a single endpoint for all data streams
- Authentication is handled via EIP-712 signatures, not separate endpoints
- Testnet mode switches to completely different domains
§Sandbox/Testnet Mode
When sandbox mode is enabled (via config.sandbox or options.testnet):
- REST URL changes to
api.hyperliquid-testnet.xyz - WebSocket URL changes to
api.hyperliquid-testnet.xyz/ws
Required Methods§
Sourcefn rest_endpoint(&self) -> &'static str
fn rest_endpoint(&self) -> &'static str
Returns the REST API endpoint.
HyperLiquid uses a single REST domain for all operations. The operation type is specified in the API path:
/info- Public data requests/exchange- Private/authenticated requests
§Returns
The REST API base URL string.
§Production vs Testnet
- Production:
https://api.hyperliquid.xyz - Testnet:
https://api.hyperliquid-testnet.xyz
§Example
use ccxt_exchanges::hyperliquid::{HyperLiquid, HyperLiquidEndpointRouter};
let exchange = HyperLiquid::builder().build().unwrap();
let url = exchange.rest_endpoint();
assert_eq!(url, "https://api.hyperliquid.xyz");Sourcefn ws_endpoint(&self) -> &str
fn ws_endpoint(&self) -> &str
Returns the WebSocket endpoint.
HyperLiquid uses a single WebSocket endpoint for all data streams. Unlike other exchanges, there is no separation between public and private WebSocket connections - authentication is handled at the message level.
§Returns
The complete WebSocket URL.
§Production vs Testnet
- Production:
wss://api.hyperliquid.xyz/ws - Testnet:
wss://api.hyperliquid-testnet.xyz/ws
§Example
use ccxt_exchanges::hyperliquid::{HyperLiquid, HyperLiquidEndpointRouter};
let exchange = HyperLiquid::builder().build().unwrap();
let url = exchange.ws_endpoint();
assert_eq!(url, "wss://api.hyperliquid.xyz/ws");