Expand description
§Hypercall Client
Rust SDK for trading on Hypercall public HTTP and websocket APIs.
§Quick Start: Place an Options Order
use hypercall_client::{HypercallClient, HypercallWallet};
use hypercall_sdk_types::{Side, TimeInForce};
use rust_decimal::Decimal;
let api = HypercallClient::new("https://api.hypercall.xyz");
let wallet = HypercallWallet::from_private_key("0xYOUR_PRIVATE_KEY", 999)?;
// Place a BTC call buy (options use typed args)
let resp = api.place_order(&wallet, "BTC-20260501-76000-C", Side::Buy, Decimal::new(2000, 0), Decimal::new(5, 0), TimeInForce::IOC).await?;
println!("Order ID: {:?}", resp);§Crate Features
Re-exports§
pub use account::CreateAccountParams;pub use account::CreateAccountResult;pub use api::BulkOrderParams;pub use api::BulkReplaceOrderParams;pub use api::HypercallClient;pub use api::OrderDecimalInput;pub use api::OrderOptions;pub use api::PlaceOrderParams;pub use api::PublicLiquidationsQuery;pub use api::ReplaceOrderParams;pub use api::StandardMarginLiquidationParams;pub use error::ClientError;pub use error::Result;pub use funding::DepositUsdcParams;pub use funding::DepositUsdcResult;pub use funding::WithdrawUsdcParams;pub use perp::PerpCancelByCloidParams;pub use perp::PerpCancelByOidParams;pub use perp::PerpLimitOrderParams;pub use perp::SetAccountAbstractionParams;pub use perp::UpdateApiWalletParams;pub use pm_financing::PmFinancingItem;pub use pm_financing::PmFinancingItemKind;pub use pm_financing::PmFinancingItemStatus;pub use pm_financing::PmFinancingMargin;pub use pm_financing::PmFinancingRepayment;pub use pm_financing::PmFinancingResponse;pub use pm_financing::PmFinancingTotals;pub use pm_financing::PmLoanRepayResponse;pub use pm_financing::PmLoanRepaymentRequest;pub use pm_financing::PmRepayRejection;pub use pm_financing::PmRepaymentBlockedReason;pub use pm_financing::PmRepaymentStatus;pub use pm_financing::RepayAmount;pub use pm_financing::RepayPmLoanParams;pub use qp_client::NoopCallbacks;pub use qp_client::QpClientCallbacks;pub use qp_client::QpClientConfig;pub use qp_client::QpDisconnectReason;pub use qp_client::QpWriteFailure;pub use qp_client::QpWriteOperation;pub use qp_client::RfqDropReason;pub use tee_perp::build_perp_scale_order_legs;pub use tee_perp::build_tee_perp_batch_modify;pub use tee_perp::build_tee_perp_bracket_batch;pub use tee_perp::build_tee_perp_position_tpsl_batch;pub use tee_perp::build_tee_perp_scale_batch;pub use tee_perp::perp_market_limit_price;pub use tee_perp::perp_preview_batch_action;pub use tee_perp::perp_preview_order;pub use tee_perp::resolve_hypercall_builder_address;pub use tee_perp::round_perp_price_to_tick;pub use tee_perp::tee_api_wallet_approval_progress;pub use tee_perp::tee_perp_batch_cloid;pub use tee_perp::tee_perp_batch_modify_signing_hash;pub use tee_perp::tee_perp_limit_order_wire;pub use tee_perp::tee_perp_modify_signing_hash;pub use tee_perp::tee_perp_nonce_in_window;pub use tee_perp::tee_perp_trigger_order_wire;pub use tee_perp::tee_perp_twap_cancel_signing_hash;pub use tee_perp::tee_perp_twap_signing_hash;pub use tee_perp::tee_perp_venue_expires_after_ms;pub use tee_perp::ApproveHypercallBuilderParams;pub use tee_perp::HyperliquidInfoClient;pub use tee_perp::HyperliquidLeverage;pub use tee_perp::HyperliquidUserRole;pub use tee_perp::PerpScaleLeg;pub use tee_perp::PerpScaleOrderSpec;pub use tee_perp::TeeApiWalletApprovalChallenge;pub use tee_perp::TeeApiWalletApprovalProgress;pub use tee_perp::TeeApiWalletApprovalSignature;pub use tee_perp::TeeApiWalletEnrollment;pub use tee_perp::TeeApiWalletEnrollmentPolling;pub use tee_perp::TeeApiWalletManagerSigner;pub use tee_perp::TeePerpBatchModifyParams;pub use tee_perp::TeePerpBatchModifySignature;pub use tee_perp::TeePerpBracketEntry;pub use tee_perp::TeePerpBracketOrderParams;pub use tee_perp::TeePerpExit;pub use tee_perp::TeePerpLeverageParams;pub use tee_perp::TeePerpLeverageSignature;pub use tee_perp::TeePerpMarketOrderParams;pub use tee_perp::TeePerpModifyParams;pub use tee_perp::TeePerpModifySignature;pub use tee_perp::TeePerpOrderBatchParams;pub use tee_perp::TeePerpOrderBatchSignature;pub use tee_perp::TeePerpOrderReplacement;pub use tee_perp::TeePerpPositionTpslParams;pub use tee_perp::TeePerpScaleOrderParams;pub use tee_perp::TeePerpSigner;pub use tee_perp::TeePerpTriggerExecution;pub use tee_perp::TeePerpTriggerOrderParams;pub use tee_perp::TeePerpTriggerOrderSignature;pub use tee_perp::TeePerpTwapCancelParams;pub use tee_perp::TeePerpTwapCancelSignature;pub use tee_perp::TeePerpTwapParams;pub use tee_perp::TeePerpTwapSignature;pub use tee_perp::PERP_MARKET_SLIPPAGE_BPS;pub use tee_spot::tee_spot_cancel_signing_hash;pub use tee_spot::tee_spot_order_signing_hash;pub use tee_spot::TeeSpotCancelParams;pub use tee_spot::TeeSpotCancelSignature;pub use tee_spot::TeeSpotOrderParams;pub use tee_spot::TeeSpotOrderSignature;pub use tee_spot::TeeSpotSigner;pub use vaults::CreateVaultResponse;pub use vaults::Vault;pub use vaults::VaultConfigParams;pub use vaults::VaultFill;pub use vaults::VaultHistoryPage;pub use vaults::VaultHolder;pub use vaults::VaultMetadata;pub use vaults::VaultPage;pub use vaults::VaultQueuedRequest;pub use vaults::VaultRequestResponse;pub use vaults::VaultSettlement;pub use vaults::VaultSettlementsPage;pub use vaults::VaultStatusChange;pub use vaults::VaultStatusChangesPage;pub use wallet::AccountAddress;pub use wallet::ApiWalletDirectiveSigner;pub use wallet::AtomicNonceProvider;pub use wallet::CancelOrderSignature;pub use wallet::HypercallSigner;pub use wallet::HypercallWallet;pub use wallet::ManagerDirectiveSigner;pub use wallet::NonceProvider;pub use wallet::PerpCancelByCloidSignature;pub use wallet::PerpCancelByOidSignature;pub use wallet::PerpDirectiveSigner;pub use wallet::PerpLimitOrderSignature;pub use wallet::PlaceOrderSignature;pub use wallet::PortfolioUsdcWithdrawalSignature;pub use wallet::ReplaceOrderSignature;pub use wallet::SetAccountAbstractionSignature;pub use wallet::StandardMarginLiquidationSignature;pub use wallet::StandardUsdcWithdrawalSignature;pub use wallet::UpdateApiWalletSignature;pub use wallet::UsdcWithdrawalSigner;pub use websocket::WsClient;pub use websocket::WsClientConfig;pub use websocket::WsConnectionState;pub use websocket::WsDisconnectReason;pub use websocket::WsRecoveryPlan;
Modules§
- account
- Managed Account.sol creation through the Hypercall Factory contract.
- api
- HTTP client for the Hypercall REST API.
- error
- Error types for the Hypercall client SDK.
- funding
- Direct HyperEVM USDC funding for Standard and Portfolio Margin accounts.
- indicative
- Decoding
indicative_market_dataframes, batched or not. - perp
- Managed-account perp directive helpers.
- pm_
financing - Portfolio Margin financing: read an account’s PM loans and unpaid settlement obligations, and repay them from its HyperCore USDC.
- qp_
client - Quote Provider (QP) WebSocket client for the
/ws/quotesendpoint. - qp_
scoped - Scoped Quote Provider client runtime.
- rfq
- High-level RFQ quote builder for Quote Providers.
- rfq_v2
- Typed low-level client for the RFQ V2 HTTP contract (
/private/rfqs*). - rfq_
v2_ recovery - Client-side recovery for RFQ v2: everything a client needs after a timeout, a lost WebSocket frame, a reconnect, or a process restart.
- rfq_
v2_ signing - EIP-712 signing for every RFQ V2 action.
- tee_
perp - TEE perp trading: Hyperliquid perp orders signed by the account’s app key (API wallet) and executed through Hypercall’s TEE-held Hyperliquid API wallet.
- tee_
spot - TEE user spot orders: HyperCore spot orders signed by the account’s app key (an active Account API wallet) and placed through Hypercall’s TEE-held Hyperliquid API wallet, on a portfolio-margin account.
- vaults
- Managed vaults: read vaults, their settlement history and a holder’s position, create a vault, and queue deposits and withdrawals. Every write is EIP-712 signed in the Hypercall domain by the owner or holder it names.
- wallet
- EIP-712 wallet for signing Hypercall operations.
- websocket
- WebSocket client for real-time market data and account-scoped updates.
Structs§
- Accept
RfqRequest - Request to accept an RFQ quote.
- ApiResponse
- Generic API response wrapper.
- Bulk
Cancel Order Response - Response from bulk cancel operation.
- Bulk
Place Order Response - Response from bulk order placement.
- Cancel
Order Request - Request to cancel an order.
- Canonical
Orders Response - Canonical paginated
/ordersresponse. - Cursor
Page - Cursor metadata for public liquidation history.
- Directive
Status Response - Delivery status returned from
/v1/directives/{directive_id}. - Directive
Submit Request - Signed request accepted by one
/v1/actions/{action_key}endpoint. - Directive
Submit Response - Honest result returned from a directive submission.
- Exchange
Info Response - Public exchange configuration for frontend deposit/withdraw integration.
- Fill
- Fill (trade execution) information.
- Fill
ApiResponse - A single fill (one side of a trade) for a specific wallet.
- Fills
Response - Paginated list of fills.
- HcUpdate
ApiWallet Action - Manager-authorized action that adds, replaces, or removes an API wallet.
- Historical
PnlPoint - A single historical equity point.
- Historical
PnlResponse - Historical equity response for a wallet and interval.
- Historical
Theo Point - A single historical theoretical-price point.
- Historical
Theo Response - Historical theo response for an instrument and interval.
- HlSet
Abstraction Action - Manager-authorized action that changes a managed Account’s HyperCore mode.
- Instrument
Spec Response - Canonical instrument specification for discovery, quoting, and lifecycle clients.
- Liquidation
History Entry - Liquidation history transition entry.
- Margin
Summary - Unified margin summary that works for both Standard and Portfolio modes.
- Market
- Market information.
- Order
- A resting or historical order on the matching engine.
- Order
Info - Order information.
- Order
Message - Order message (response from order placement).
- Perp
Preview Leverage Setting - Leverage the preview should assume instead of the account’s current one.
- Perp
Preview Limit - Previewed limit order type.
- Perp
Preview Margin - Portfolio margin before and after the action, as admission charges it.
- Perp
Preview MaxSize - Largest same-side size that still passes the real admission check.
- Perp
Preview Order - One previewed order. Prices are USDC and sizes are coins, as decimals (not the 1e8-scaled integers of the signed submit wire).
- Perp
Preview Request - Request body of
TEE_PERP_PREVIEW_ROUTE. Read-only; no signature. - Perp
Preview Response - Response of
TEE_PERP_PREVIEW_ROUTE(thedataof its envelope). - Perp
Preview Trigger - Previewed trigger order type. Prices are USDC decimals.
- Place
Order Request - Request body for placing an order.
- Portfolio
- Full portfolio snapshot for a single account.
- Portfolio
Position - Position information in portfolio response.
- Portfolio
Response - Portfolio response from the API.
- Portfolio
Usdc Withdrawal Response - Accepted Portfolio Margin USDC withdrawal.
- Public
Liquidations Response - Public global liquidation history response.
- RfqLeg
Request - A single leg in an RFQ request.
- Span
Margin Summary - SPAN-based portfolio margin breakdown for an account.
- Standard
Margin Liquidation Order Response - Standard
Margin Liquidation Position Request - Standard
Usdc Withdrawal Response - Accepted Standard Margin USDC withdrawal.
- Submit
RfqRequest - Request to submit an RFQ.
- TeeApi
Wallet Approval Package - Response of
TEE_API_WALLET_APPROVAL_REQUEST_ROUTE. - TeePerp
Batch Modify Action - Batch modify action for
TEE_PERP_ORDER_BATCH_MODIFY_ROUTE. - TeePerp
Batch Modify Child Response - One child of a
TeePerpBatchModifyResponse, in request order. - TeePerp
Batch Modify Response - Response of
TEE_PERP_ORDER_BATCH_MODIFY_ROUTE. - TeePerp
Cancel Response - Response of
TEE_PERP_CANCEL_SUBMIT_ROUTE. - TeePerp
Leverage Action - Leverage and margin-mode change for
TEE_PERP_LEVERAGE_SUBMIT_ROUTE. - TeePerp
Leverage Response - Response of
TEE_PERP_LEVERAGE_SUBMIT_ROUTE. - TeePerp
Market Entry - One configured perp market and whether the TEE routes accept it.
- TeePerp
Markets Response - Response of
TEE_PERP_MARKETS_ROUTE. - TeePerp
Modify Action - Replacement terms for one resting limit order, for
TEE_PERP_ORDER_MODIFY_ROUTEand as one child ofTeePerpBatchModifyAction. - TeePerp
Modify Response - Response of
TEE_PERP_ORDER_MODIFY_ROUTE. - TeePerp
Order Batch Action - Order batch action for
TEE_PERP_ORDER_BATCH_SUBMIT_ROUTE. - TeePerp
Order Batch Response - Response of
TEE_PERP_TRIGGER_ORDER_SUBMIT_ROUTEandTEE_PERP_ORDER_BATCH_SUBMIT_ROUTE. - TeePerp
Order Response - Response of
TEE_PERP_ORDER_SUBMIT_ROUTE. - TeePerp
Order Wire - One native order on the trigger and batch routes. Prices and sizes are
1e8-scaled integers;
cloidis a non-zero u128. - TeePerp
Twap Action - Native TWAP for
TEE_PERP_TWAP_SUBMIT_ROUTE. Hyperliquid runs it as slices overminutes, each capped at 3% slippage;randomizevaries the slice timing. - TeePerp
Twap Cancel Action - TWAP cancel for
TEE_PERP_TWAP_CANCEL_ROUTE. - TeePerp
Twap Response - Response of
TEE_PERP_TWAP_SUBMIT_ROUTE. - TeePerp
Venue Action Response - Response of
TEE_PERP_CANCEL_BY_OID_SUBMIT_ROUTEandTEE_PERP_TWAP_CANCEL_ROUTE. - WsSlow
Consumer Close Reason - Structured JSON reason carried by a slow-consumer close frame.
Enums§
- Directive
Delivery Status - Directive
Domain Status - Directive
Stage - Historical
PnlInterval - Historical equity interval identifier.
- Historical
Theo Interval - Historical theo interval identifier.
- Hypercore
Account Abstraction - HyperCore account abstraction modes supported by managed Account directives.
- Instrument
Kind - Instrument family represented by a portfolio, order, fill, or WebSocket row.
- Margin
Mode - Margin regime selected for an account.
- Option
Type - Option type (call or put).
- Order
Status - Order status in the order lifecycle.
- Perp
Liquidation Binding - The liquidation reached first as the market’s price moves.
- Perp
Preview Action - The action to preview, tagged by
kind. - Perp
Preview Decision - Whether the previewed action would be admitted.
- Perp
Preview Order Type - Exactly one of
limitortrigger. - Perp
Preview Tif - Native time in force of a previewed limit order.
- Perp
Rejection Reason Code - Stable machine code for why a perp action is (or would be) rejected. The preview and the real submit responses carry the same code for the same rejection.
- Perp
Time InForce - HyperCore time-in-force encoding used by managed perp directives.
- Side
- Order side (buy or sell).
- TeePerp
Error Code - Stable, non-sensitive failure classification of a TEE perp response.
- TeePerp
Modify Venue Order - What rests at the venue under a modified order’s cloid after the call,
read from the Hyperliquid response the server verified against
venueResponseHash. The modify response is returned only after Hyperliquid answered, so trust it over an immediateorderStatusread, which can lag the venue by seconds. - TeePerp
Order Grouping - Native grouping of an order batch.
- TeePerp
Order Stage - Outcome stage of a same-call TEE perp submission.
- TeePerp
Order Type - Exactly one of
limitortrigger. - TeePerp
Tpsl - Trigger direction, as Hyperliquid names it.
- Time
InForce - Time in force for orders.
- Usdc
Withdrawal Domain Status - Domain processing state returned by the USDC withdrawal acceptance routes.
- WsDelivery
Class - Delivery semantics for a WebSocket message.
- WsMessage
- WsPressure
Cause - Safety boundary that caused the server to disconnect a slow consumer.
- WsRecovery
Action - Recovery action required after a WebSocket delivery gap.
Constants§
- DEFAULT_
TEE_ PERP_ BATCH_ MODIFY_ MAX_ CHILDREN - Default per-instance batch-modify cap (
api.tee_perp_batch_modify_max_children). An instance may configure anything from 1 toMAX_TEE_PERP_BATCH_MODIFY_CHILDREN; a larger batch is refused with400 invalid_fieldbefore it is charged against the rate limit. - MAX_
TEE_ PERP_ BATCH_ MODIFY_ CHILDREN - Children a batch modify may carry on the wire (the enclave’s structural bound). No server instance accepts more.
- TEE_
PERP_ TWAP_ MAX_ MINUTES - Longest native TWAP Hyperliquid runs, in minutes (24 hours).
- TEE_
PERP_ TWAP_ MIN_ MINUTES - Shortest native TWAP Hyperliquid runs, in minutes.
Type Aliases§
- Orders
ApiResponse - Unambiguous root-level alias for the canonical orders response.
- Perp
Cancel ByCloid Request - Signed managed-perp cancellation request body for a client order ID.
- Perp
Cancel ByOid Request - Signed managed-perp cancellation request body for an exchange order ID.
- Perp
Limit Order Request - Signed managed-perp limit order request body.
- SetAccount
Abstraction Request - Signed managed-account abstraction request body.