Skip to main content

Module client

Module client 

Source
Expand description

Connecting to Hyperliquid: the Client that reads, signs and sends over one network’s rate-limited /info and /exchange (http), the networks, HyperEVM (evm), and the native and browser wires and websockets.

Re-exports§

pub use http::Accepted;
pub use http::ApiError;
pub use http::ExchangeResponse;
pub use http::Http;
pub use http::Method;
pub use http::Request;
pub use http::Response;
pub use http::Spent;
pub use http::Status;
pub use http::Transport;
pub use http::TransportError;
pub use http::exchange;
pub use http::info;
pub use http::info_request;
pub use http::user_request;
pub use network::L1_CHAIN_ID;
pub use network::MAINNET_HYPE;
pub use network::MAINNET_USDC;
pub use network::Network;
pub use network::TESTNET_HYPE;
pub use network::TESTNET_USDC;
pub use network::Token;
pub use network::USDC_INDEX;
pub use network::UnknownNetwork;

Modules§

evm
HyperEVM and the Arbitrum side of the bridge: typed JSON-RPC, ABI, RLP, EIP-1559 transactions, HyperCore’s read precompiles and CoreWriter actions. Sans-IO; quantities are exact integers (U256) and amounts convert to crate::utils::Dec. Chain ids come from crate::client::Network.
http
HTTP to /info and /exchange: the Http wire, the Transport every read and action goes through, what /exchange answers, the signed body it takes, and the rate limit.
native
HTTP and websocket for native programs: Native sends requests through reqwest on rustls, clock is the system clock, and a Feed keeps the websocket open over tokio-tungstenite. Hand the first two to a crate::Client:
network
Mainnet and testnet. Everything that differs between them is a method on Network; an action signed for one is never valid on the other, so the network is never assumed.
web
HTTP and websocket for the browser and Workers: Web sends requests through the global fetch, clock is Date.now(), and a Feed keeps the websocket open over the global WebSocket. Hand the first two to a crate::Client:

Structs§

Client
Reads for any module (markets::perps::meta(&client)) and, with a Signer, actions. S is () for a client that only reads.

Enums§

SendError
Why an action was not taken. An action whose answer never came (TransportError::Unreachable) may have landed, so it is never resent.

Type Aliases§

Clock
Unix milliseconds. Injected: std has no clock in the browser or Workers, and a test pins the time.