Skip to main content

HypercallClient

Struct HypercallClient 

Source
pub struct HypercallClient { /* private fields */ }
Expand description

HTTP API client for Hypercall.

Implementations§

Source§

impl HypercallClient

Source

pub async fn create_account( &self, manager: &HypercallWallet, params: CreateAccountParams, ) -> Result<CreateAccountResult>

Deploy and register a managed Account.sol through Factory.

This call is not idempotent. Reusing a manager and salt after the corresponding account exists causes the Factory transaction to revert.

Source§

impl HypercallClient

Source

pub const MAX_BULK_CHUNK_SIZE: usize = 50

Maximum orders per bulk request.

Source

pub fn new(base_url: impl Into<String>) -> Self

Create a new API client. Requests time out after 30 seconds.

Source

pub fn with_timeout(base_url: impl Into<String>, timeout: Duration) -> Self

Create an API client whose requests time out after timeout. A mutation that times out has an unknown outcome; with the rfq-v2 feature, RFQ V2 reports it as ClientError::RfqV2SubmissionAmbiguous for reconciliation.

Source

pub fn base_url(&self) -> &str

Base URL used by this client.

Source

pub async fn raw_post(&self, path: &str, body: &Value) -> Result<Response>

Send a raw POST request to a path with a JSON body.

Source

pub async fn health_check(&self) -> Result<()>

Check API health.

Source

pub async fn health_check_with_timeout(&self, timeout: Duration) -> Result<()>

Check API health using a custom request timeout.

Source

pub async fn ready_check(&self) -> Result<()>

Check API readiness.

Source

pub async fn ready_check_with_timeout(&self, timeout: Duration) -> Result<()>

Check API readiness using a custom request timeout.

Source

pub async fn get_exchange_info(&self) -> Result<ExchangeInfoResponse>

Get the public exchange configuration used for funding and signing.

Source

pub async fn get_instrument_specs( &self, currency: &str, ) -> Result<Vec<InstrumentSpecResponse>>

Get canonical instrument specifications for a currency.

Source

pub async fn get_markets(&self) -> Result<Vec<Market>>

Get all markets.

Source

pub async fn place_order<P, Q>( &self, wallet: &HypercallWallet, symbol: &str, side: Side, price: P, size: Q, tif: TimeInForce, ) -> Result<OrderMessage>

Place an order.

Source

pub async fn place_order_with_nonce( &self, wallet: &HypercallWallet, nonce: u64, order: BulkOrderParams<'_>, ) -> Result<OrderMessage>

Place an order with an explicit nonce. Use this when you need to control the nonce directly (e.g., retrying with a known nonce, or testing replay protection). For normal usage, prefer place_order() which auto-increments.

Source

pub async fn place_order_for_wallet( &self, signer: &HypercallWallet, account: AccountAddress, order: BulkOrderParams<'_>, ) -> Result<OrderMessage>

Place an order for a managed wallet/account with an explicit signer.

Source

pub async fn place_order_for_wallet_with_nonce( &self, signer: &HypercallWallet, account: AccountAddress, nonce: u64, order: BulkOrderParams<'_>, ) -> Result<OrderMessage>

Place an order for a managed wallet/account with an explicit nonce.

Source

pub async fn place_order_with_params<S>( &self, signer: &S, params: PlaceOrderParams<'_>, ) -> Result<OrderMessage>
where S: HypercallSigner + ?Sized,

Source

pub async fn cancel_order<S>(&self, wallet: &S, order_id: u64) -> Result<Value>
where S: HypercallSigner + ?Sized,

Cancel an order.

Source

pub async fn cancel_order_for_wallet<S>( &self, signer: &S, account: AccountAddress, order_id: u64, ) -> Result<Value>
where S: HypercallSigner + ?Sized,

Cancel an order for a managed wallet/account with an explicit signer.

Source

pub async fn cancel_order_for_wallet_with_nonce<S>( &self, signer: &S, account: AccountAddress, order_id: u64, nonce: u64, ) -> Result<Value>
where S: HypercallSigner + ?Sized,

Cancel an order for a managed wallet/account with an explicit nonce.

Source

pub async fn replace_order_with_params<S>( &self, signer: &S, params: ReplaceOrderParams<'_>, ) -> Result<OrderMessage>
where S: HypercallSigner + ?Sized,

Atomically cancel an order and place a new one.

Source

pub async fn bulk_place_orders<S, P, Q>( &self, wallet: &S, orders: Vec<(&str, Side, P, Q, TimeInForce)>, ) -> Result<BulkPlaceOrderResponse>

Place multiple orders in bulk, automatically chunking to stay within API limits.

Source

pub async fn bulk_place_orders_with_params<S>( &self, wallet: &S, orders: Vec<BulkOrderParams<'_>>, ) -> Result<BulkPlaceOrderResponse>
where S: HypercallSigner + ?Sized,

Source

pub async fn bulk_cancel_orders<S>( &self, wallet: &S, order_ids: Vec<u64>, ) -> Result<BulkCancelOrderResponse>
where S: HypercallSigner + ?Sized,

Cancel multiple orders in bulk, automatically chunking to stay within API limits.

Source

pub async fn bulk_cancel_orders_for_wallet<S>( &self, signer: &S, account: AccountAddress, order_ids: Vec<u64>, ) -> Result<BulkCancelOrderResponse>
where S: HypercallSigner + ?Sized,

Cancel multiple orders for a managed wallet/account, automatically chunking.

Source

pub async fn bulk_replace_orders<S, P, Q>( &self, wallet: &S, replacements: Vec<(u64, &str, Side, P, Q, TimeInForce)>, ) -> Result<BulkPlaceOrderResponse>

Replace multiple orders in bulk, automatically chunking to stay within API limits.

Each tuple is (cancel_order_id, symbol, side, price, size, tif).

Source

pub async fn bulk_replace_orders_with_params<S>( &self, wallet: &S, replacements: Vec<BulkReplaceOrderParams<'_>>, ) -> Result<BulkPlaceOrderResponse>
where S: HypercallSigner + ?Sized,

Source

pub async fn get_orders( &self, wallet: impl Into<AccountAddress>, status: Option<&str>, ) -> Result<Value>

Get orders for a wallet (single page).

Source

pub async fn get_orders_typed( &self, wallet: impl Into<AccountAddress>, status: Option<&str>, limit: Option<usize>, offset: Option<usize>, ) -> Result<OrdersApiResponse>

Get one typed page of option and perp orders.

Source

pub async fn get_username( &self, wallet: impl Into<AccountAddress>, ) -> Result<Option<String>>

Get the display username for a wallet.

Source

pub async fn get_all_orders( &self, wallet: impl Into<AccountAddress>, status: Option<&str>, ) -> Result<Vec<Value>>

Get ALL orders for a wallet, paginating through all pages.

Source

pub async fn get_all_orders_typed( &self, wallet: impl Into<AccountAddress>, status: Option<&str>, ) -> Result<Vec<Order>>

Get all option and perp orders as canonical typed rows.

Source

pub async fn get_fills( &self, wallet: impl Into<AccountAddress>, limit: Option<usize>, offset: Option<usize>, ) -> Result<Value>

Get fills for a wallet.

Source

pub async fn get_fills_typed( &self, wallet: impl Into<AccountAddress>, limit: Option<usize>, offset: Option<usize>, ) -> Result<FillsResponse>

Get a typed page of option and perp fills.

Source

pub async fn get_portfolio( &self, wallet: impl Into<AccountAddress>, ) -> Result<PortfolioResponse>

Get portfolio for a wallet.

Source

pub async fn get_portfolio_snapshot( &self, wallet: impl Into<AccountAddress>, ) -> Result<Portfolio>

Get the canonical portfolio-margin-compatible snapshot.

Source

pub async fn get_public_liquidations( &self, query: &PublicLiquidationsQuery, ) -> Result<PublicLiquidationsResponse>

Get global public liquidation history.

Source

pub async fn get_liquidation_status( &self, wallet: impl Into<AccountAddress>, ) -> Result<Option<LiquidationStatusData>>

Get liquidation status for a wallet.

Source

pub async fn get_historical_pnl( &self, wallet: impl Into<AccountAddress>, interval: HistoricalPnlInterval, limit: Option<usize>, include_attribution: Option<bool>, ) -> Result<HistoricalPnlResponse>

Get historical equity snapshots for a wallet.

include_attribution: pass Some(true) only when rendering the per-symbol breakdown. The default response omits attribution because it is substantially larger than the equity-only time series.

Source

pub async fn get_historical_theos( &self, instrument_name: &str, interval: HistoricalTheoInterval, limit: Option<usize>, ) -> Result<HistoricalTheoResponse>

Get historical theoretical-price snapshots for an option instrument.

Source

pub async fn set_margin_mode( &self, wallet: &HypercallWallet, margin_mode: &str, ) -> Result<Value>

Set margin mode for a wallet.

Source

pub async fn set_margin_mode_typed( &self, wallet: &HypercallWallet, margin_mode: MarginMode, ) -> Result<Value>

Set an account’s margin mode using the typed SDK enum.

Source

pub async fn submit_standard_margin_liquidation_with_params<S>( &self, liquidator: &S, params: StandardMarginLiquidationParams, ) -> Result<StandardMarginLiquidationOrderResponse>
where S: HypercallSigner + ?Sized,

Source

pub async fn fetch_underlying_price( &self, currency: &str, ) -> Result<Option<f64>>

Fetch underlying price from options-summary endpoint.

Source

pub async fn submit_rfq( &self, wallet: &HypercallWallet, rfq_id: &str, legs: Vec<RfqLegRequest>, ) -> Result<Value>

Submit an RFQ (taker-side).

Source

pub async fn submit_auto_execute_rfq( &self, wallet: &HypercallWallet, rfq_id: &str, legs: Vec<RfqLegRequest>, limit_price: Decimal, ) -> Result<Value>

Submit an auto-execute RFQ (taker-side).

Similar to submit_rfq but the taker pre-authorizes execution with limit_price. Buy RFQs use it as a max debit. Sell RFQs use it as a min credit. The first QP quote satisfying that directional limit triggers immediate execution without a separate accept RTT. Uses the SubmitAutoExecuteRfq EIP-712 type for signing.

Source

pub async fn accept_rfq_quote( &self, wallet: &HypercallWallet, rfq_id: &str, quote_id: &str, net_premium: I256, ) -> Result<Value>

Accept an RFQ quote (taker-side).

Source

pub async fn get_rfq(&self, rfq_id: &str) -> Result<Value>

Get RFQ status and quotes.

Source§

impl HypercallClient

Source

pub async fn deposit_standard_usdc( &self, funder: &HypercallWallet, params: DepositUsdcParams, ) -> Result<DepositUsdcResult>

Deposit HyperEVM USDC into a Standard Margin account.

Source

pub async fn deposit_portfolio_usdc( &self, manager: &HypercallWallet, params: DepositUsdcParams, ) -> Result<DepositUsdcResult>

Deposit HyperEVM USDC into a Portfolio Margin Account.sol through Router.

Source

pub async fn withdraw_standard_usdc<S>( &self, signer: &S, params: WithdrawUsdcParams, ) -> Result<StandardUsdcWithdrawalResponse>

Submit a Standard Margin USDC withdrawal.

The returned response is an acceptance receipt. Poll HypercallClient::get_directive_status for final delivery.

Source

pub async fn withdraw_portfolio_usdc<S>( &self, signer: &S, params: WithdrawUsdcParams, ) -> Result<PortfolioUsdcWithdrawalResponse>

Submit a Portfolio Margin USDC withdrawal.

The returned response is an acceptance receipt. Poll HypercallClient::get_directive_status for final delivery.

Source

pub async fn prepare_usdc_withdrawal_route( &self, destination: AccountAddress, ) -> Result<WithdrawUsdcRoute>

Resolve and validate the current HyperCore route for a recipient.

Source

pub async fn withdraw_portfolio_usdc_with_route<S>( &self, signer: &S, params: WithdrawUsdcParams, route: WithdrawUsdcRoute, ) -> Result<PortfolioUsdcWithdrawalResponse>

Submit a Portfolio Margin withdrawal using a previously prepared route.

Retain this route with the nonce after an ambiguous outcome so an exact retry does not depend on the recipient’s current abstraction mode.

Source§

impl HypercallClient

Source

pub async fn update_api_wallet<S>( &self, manager: &S, params: UpdateApiWalletParams, ) -> Result<DirectiveSubmitResponse>

Add, replace, or remove an API wallet on a managed Account.sol.

Source

pub async fn set_account_abstraction<S>( &self, signer: &S, params: SetAccountAbstractionParams, ) -> Result<DirectiveSubmitResponse>

Change a managed Account’s HyperCore abstraction mode.

This manager-authorized directive currently supports only the forward transition to unified-account mode.

Source

pub async fn place_perp_limit_order<S>( &self, signer: &S, params: PerpLimitOrderParams, ) -> Result<DirectiveSubmitResponse>

Source

pub async fn cancel_perp_order_by_oid<S>( &self, signer: &S, params: PerpCancelByOidParams, ) -> Result<DirectiveSubmitResponse>

Source

pub async fn cancel_perp_order_by_cloid<S>( &self, signer: &S, params: PerpCancelByCloidParams, ) -> Result<DirectiveSubmitResponse>

Source

pub async fn get_directive_status( &self, directive_id: &str, ) -> Result<DirectiveStatusResponse>

Source§

impl HypercallClient

Source

pub fn watch_rfq_v2_changes( &self, grant: &RfqV2ReadGrant, after_sequence: u64, poll_interval: Duration, ) -> Result<Receiver<Result<ListRfqV2ChangesResponse>>>

Poll the signed recipient change feed even while its WebSocket remains connected. A WebSocket hint is only a wake-up signal; it cannot prove that no earlier hint was lost. The caller must refresh each returned RFQ and persist next_after_sequence only after applying the page. If applying a page fails, drop the receiver and restart from the last persisted cursor. Dropping the receiver stops polling. Recreate it with a fresh grant before the current one expires.

Source§

impl HypercallClient

Source

pub async fn schedule_rfq_v2_quote_cancel( &self, request: &RfqV2ScheduledQuoteCancelRequest, ) -> Result<RfqV2ScheduledQuoteCancelResponse>

Set, renew, or remove a maker-wide V2 firm-quote cancel deadline.

Source

pub async fn create_rfq_v2( &self, request: &CreateRfqV2Request, ) -> Result<CreateRfqV2Response>

Relay a signed RFQ parent into the V2 delivery plane.

Source

pub async fn publish_rfq_v2_indicative_quote( &self, rfq_id: Uuid, request: &PublishRfqV2IndicativeQuoteRequest, ) -> Result<PublishRfqV2QuoteResponse>

Publish a non-executable indicative quote.

Source

pub async fn publish_rfq_v2_firm_quote( &self, rfq_id: Uuid, request: &PublishRfqV2FirmQuoteRequest, ) -> Result<PublishRfqV2QuoteResponse>

Publish an executable firm quote for best-effort preflight and relay.

Source

pub async fn request_rfq_v2_firm_quote( &self, rfq_id: Uuid, indicative_quote_id: Uuid, request: &RequestRfqV2FirmQuoteRequest, ) -> Result<RfqV2OperationResponse>

Ask the maker of an indicative quote for a fresh firm authorization.

Source

pub async fn decline_rfq_v2( &self, rfq_id: Uuid, request: &DeclineRfqV2Request, ) -> Result<RfqV2OperationResponse>

Decline an RFQ this maker was routed. Only the taker and this maker can see the decline. It does not affect any quote or execution.

Source

pub async fn execute_rfq_v2( &self, rfq_id: Uuid, request: &RfqV2ExecutionRequest, ) -> Result<RfqV2ExecutionResponse>

Submit one signed firm-quote allocation for execution.

Source

pub async fn sweep_rfq_v2( &self, rfq_id: Uuid, request: &RfqV2SweepRequest, ) -> Result<RfqV2ExecutionResponse>

Submit an exact, ordered, all-or-nothing multi-quote allocation.

Source

pub async fn cancel_rfq_v2( &self, rfq_id: Uuid, request: &RfqV2InvalidationRequest, ) -> Result<RfqV2OperationResponse>

Make a signed parent RFQ terminal.

Source

pub async fn withdraw_rfq_v2_quote( &self, rfq_id: Uuid, quote_id: Uuid, request: &RfqV2InvalidationRequest, ) -> Result<RfqV2OperationResponse>

Make a signed quote terminal when its withdrawal policy permits it.

Source

pub async fn withdraw_rfq_v2_quotes( &self, request: &RfqV2BulkWithdrawalRequest, ) -> Result<RfqV2OperationResponse>

Atomically withdraw a signed maker-scoped set of open quotes.

Source

pub async fn replace_rfq_v2( &self, rfq_id: Uuid, request: &RfqV2ReplacementRequest<CreateRfqV2Request>, ) -> Result<CreateRfqV2Response>

Retire a parent and publish a fresh signed replacement.

Source

pub async fn replace_rfq_v2_quote( &self, rfq_id: Uuid, quote_id: Uuid, request: &RfqV2ReplacementRequest<RfqV2QuoteReplacement>, ) -> Result<PublishRfqV2QuoteResponse>

Retire a quote and publish a fresh signed replacement of the same kind.

Source

pub async fn get_rfq_v2( &self, rfq_id: Uuid, credentials: RfqV2ReadCredentials<'_>, ) -> Result<RfqV2Response>

Read the authorization-aware RFQ view for the current caller.

Source

pub async fn list_rfqs_v2( &self, query: &ListRfqV2Query, credentials: RfqV2ReadCredentials<'_>, ) -> Result<ListRfqV2Response>

List RFQs visible to the authorized caller, including terminal history.

Source

pub async fn list_rfq_v2_changes( &self, query: &ListRfqV2ChangesQuery, credentials: RfqV2ReadCredentials<'_>, ) -> Result<ListRfqV2ChangesResponse>

List the RFQ IDs that changed for this signed account after a global sequence. Gaps in the sequence are expected.

Source

pub async fn list_rfq_v2_quotes( &self, rfq_id: Uuid, query: &ListRfqV2QuotesQuery, credentials: RfqV2ReadCredentials<'_>, ) -> Result<ListRfqV2QuotesResponse>

List quotes visible to the authorized caller for one RFQ.

Source

pub async fn get_rfq_v2_quote( &self, rfq_id: Uuid, quote_id: Uuid, credentials: RfqV2ReadCredentials<'_>, ) -> Result<RfqV2QuoteView>

Read one full quote visible to the authorized caller.

Source§

impl HypercallClient

Source

pub async fn reconcile_rfq_v2_execution( &self, rfq_id: Uuid, request: &RfqV2ExecutionRequest, policy: RfqV2ReconcilePolicy, ) -> Result<RfqV2ReconciledExecution>

Reconcile an execution after ClientError::RfqV2SubmissionAmbiguous.

A timeout is not an execution result: the request may still complete later. This resends the identical signed request, byte for byte, under its original operation ID. The server treats that as an exact retry, so a completed operation returns its original result and is never applied twice. It never signs, renumbers, or alters the request. A definite rejection is returned as is; if every resubmission is still ambiguous, the result stays ambiguous.

Source

pub async fn reconcile_rfq_v2_sweep( &self, rfq_id: Uuid, request: &RfqV2SweepRequest, policy: RfqV2ReconcilePolicy, ) -> Result<RfqV2ReconciledExecution>

Reconcile a sweep after ClientError::RfqV2SubmissionAmbiguous, with the same exact-retry rules as HypercallClient::reconcile_rfq_v2_execution.

Source§

impl HypercallClient

Source

pub async fn next_rfq_v2_quote_page( &self, history: &mut RfqV2QuoteHistory, credentials: RfqV2ReadCredentials<'_>, ) -> Result<()>

Fetch the next page of a quote history and merge it. A quote ID seen on an earlier page is a protocol violation and fails the page.

Source

pub async fn sync_rfq_v2_quote_history( &self, history: &mut RfqV2QuoteHistory, credentials: RfqV2ReadCredentials<'_>, ) -> Result<()>

Page a quote history until the scan is complete.

Source

pub async fn sync_rfq_v2_mirror( &self, mirror: &mut RfqV2PrivateMirror, credentials: RfqV2ReadCredentials<'_>, ) -> Result<BTreeSet<Uuid>>

Read the recipient change feed from the mirror’s last applied cursor and refresh each named RFQ from authorized reads. The cursor advances page by page, only after that page’s reads are applied, so an error leaves a mirror that resumes safely. Call it after connecting, after every reconnect, whenever a hint requires it, and periodically. It only reads; it never resubmits an operation.

Source

pub async fn refresh_rfq_v2_execution_action( &self, rfq_id: Uuid, quote_id: Uuid, requested_units: u128, observed: Option<&RfqV2QuoteView>, credentials: RfqV2ReadCredentials<'_>, ) -> Result<RfqV2ExecutionAction>

Decide whether to offer an execution from fresh server reads of the parent and quote. A cached or event-derived observed view is never trusted: a stale “capacity remains” event cannot enable a fill whose capacity is already used.

Source

pub async fn reconcile_rfq_v2_maker_hold( &self, hold: &mut RfqV2MakerHold, credentials: RfqV2ReadCredentials<'_>, ) -> Result<RfqV2MakerHoldEvidence>

Re-decide a maker hold from server reads, then advance its change-feed cursor. A 404 or missing status leaves the hold unresolved; only identity-bound own-fill, competing-winner, or terminal evidence releases it. A released hold is final.

Source§

impl HypercallClient

Source

pub async fn server_now_ms(&self) -> Result<u64>

The API server’s current Unix millisecond, from the /health Date header (cached for a minute per client and its clones).

Source

pub async fn next_tee_perp_nonce(&self, signer: AccountAddress) -> Result<u64>

Next TEE perp nonce for signer, stamped on the server clock and strictly increasing per signer within this process.

Source

pub async fn resend_tee_submission<T>( &self, route: &str, request_json: &str, ) -> Result<T>

Resend the exact signed body of a ClientError::TeeSubmissionAmbiguous. The server recognises the same signed action (same nonce, same terms) and does not submit it to the venue twice; a repeat comes back with duplicate_directive and stage unknown, meaning reconcile. Pass the error’s route and request_json unchanged.

Any failure of the resend, including a 4xx such as an expired signature, is returned as ClientError::TeeSubmissionAmbiguous: the original request may still have executed, so reconcile before signing a fresh action.

Source

pub async fn place_tee_perp_limit_order<S>( &self, signer: &S, params: PerpLimitOrderParams, ) -> Result<TeePerpOrderResponse>

Place one plain limit order (GTC, IOC, or ALO) on the TEE route.

client_order_id defaults to the nonce.

Source

pub async fn place_tee_perp_market_order<S>( &self, signer: &S, params: TeePerpMarketOrderParams, ) -> Result<TeePerpOrderResponse>

Place a market order: an IOC limit bounded by slippage_bps.

Source

pub async fn place_tee_perp_trigger_order<S>( &self, signer: &S, params: TeePerpTriggerOrderParams, ) -> Result<TeePerpOrderBatchResponse>
where S: TeePerpSigner + ?Sized,

Place one native stop-loss or take-profit order (market or limit).

Source

pub async fn place_tee_perp_order_batch<S>( &self, signer: &S, params: TeePerpOrderBatchParams, ) -> Result<TeePerpOrderBatchResponse>
where S: TeePerpSigner + ?Sized,

Submit a caller-built order batch (1 to 100 children).

Source

pub async fn place_tee_perp_bracket_order<S>( &self, signer: &S, params: TeePerpBracketOrderParams, ) -> Result<TeePerpOrderBatchResponse>
where S: TeePerpSigner + ?Sized,

Place an entry with attached TP/SL exits (normalTpsl).

Source

pub async fn place_tee_perp_position_tpsl<S>( &self, signer: &S, params: TeePerpPositionTpslParams, ) -> Result<TeePerpOrderBatchResponse>
where S: TeePerpSigner + ?Sized,

Place TP/SL exits on an existing position (positionTpsl).

Source

pub async fn place_tee_perp_scale_order<S>( &self, signer: &S, params: TeePerpScaleOrderParams, ) -> Result<TeePerpOrderBatchResponse>
where S: TeePerpSigner + ?Sized,

Place a scale order: its legs as one ungrouped batch.

Source

pub async fn cancel_tee_perp_order_by_oid<S>( &self, signer: &S, params: PerpCancelByOidParams, ) -> Result<TeePerpVenueActionResponse>

Cancel a resting order by Hyperliquid order ID.

Source

pub async fn cancel_tee_perp_order_by_cloid<S>( &self, signer: &S, params: PerpCancelByCloidParams, ) -> Result<TeePerpCancelResponse>

Cancel a resting order by client order ID.

Source

pub async fn update_tee_perp_leverage<S>( &self, signer: &S, params: TeePerpLeverageParams, ) -> Result<TeePerpLeverageResponse>
where S: TeePerpSigner + ?Sized,

Change leverage and margin mode for one market. Read the venue’s resulting setting back with HyperliquidInfoClient::active_asset_leverage.

Source

pub async fn modify_tee_perp_order<S>( &self, signer: &S, params: TeePerpModifyParams, ) -> Result<TeePerpModifyResponse>
where S: TeePerpSigner + ?Sized,

Replace one resting limit order’s price, size, side, TIF and reduce-only flag (Hyperliquid modify). The cloid is preserved.

The engine reserves the larger of the old and new terms until the outcome is known: rejected or not_submitted restores the old terms (the original order still rests); accepted moves to the new terms. An unknown stage must be reconciled before modifying again.

Source

pub async fn batch_modify_tee_perp_orders<S>( &self, signer: &S, params: TeePerpBatchModifyParams, ) -> Result<TeePerpBatchModifyResponse>
where S: TeePerpSigner + ?Sized,

Replace several resting limit orders in one signed Hyperliquid batchModify (one nonce, one venue call).

The engine admits every child or none. After the venue answers, each child settles on its own: read TeePerpBatchModifyResponse::children (or TeePerpBatchModifyResponse::children_to_reconcile) rather than only the whole-action stage, which is accepted or rejected only when every child agrees. Charged as one order placement per child against the rate limit.

Refused locally, before signing, when the batch is empty, exceeds max_children (50 by default), repeats a target or cloid, or carries an invalid child. A deployment whose enclave release does not enable batch modify answers 400 unsupported_action (ClientError::is_unsupported_action).

Source

pub async fn place_tee_perp_twap_order<S>( &self, signer: &S, params: TeePerpTwapParams, ) -> Result<TeePerpTwapResponse>
where S: TeePerpSigner + ?Sized,

Start a native Hyperliquid TWAP (twapOrder). The engine reserves the full size at admission and releases it as fills arrive. Keep TeePerpTwapResponse::twap_id to cancel it.

TWAP is disabled at runtime on deployments whose enclave release does not enable it; those answer 400 unsupported_action (ClientError::is_unsupported_action).

Source

pub async fn cancel_tee_perp_twap<S>( &self, signer: &S, params: TeePerpTwapCancelParams, ) -> Result<TeePerpVenueActionResponse>
where S: TeePerpSigner + ?Sized,

Cancel a running native TWAP (twapCancel). Like TWAP submit, this can answer 400 unsupported_action where TWAP is disabled.

Source

pub async fn preview_tee_perp_action( &self, request: &PerpPreviewRequest, ) -> Result<PerpPreviewResponse>

Preview an action’s admission, margin, liquidation prices and max size without signing or reserving anything.

Source

pub async fn get_tee_perp_markets(&self) -> Result<TeePerpMarketsResponse>

Configured TEE perp markets and whether each is supported.

Source

pub async fn request_tee_api_wallet_approval<S>( &self, manager: &S, account: AccountAddress, ) -> Result<TeeApiWalletApprovalChallenge>

Step 1 of enrollment: authenticate as the manager and fetch the account’s TEE API wallet with its HLAddApiWallet approval payload.

Source

pub async fn submit_tee_api_wallet_approval<S>( &self, manager: &S, challenge: &TeeApiWalletApprovalChallenge, ) -> Result<DirectiveSubmitResponse>

Step 2 of enrollment: sign the approval (after checking the returned typed data names exactly the packaged wallet) and submit it.

Source

pub async fn enroll_tee_api_wallet<S>( &self, manager: &S, account: AccountAddress, hyperliquid: &HyperliquidInfoClient, polling: TeeApiWalletEnrollmentPolling, ) -> Result<TeeApiWalletEnrollment>

Enroll the account’s TEE API wallet end to end, as the Hypercall order panel does: request it, skip the approval when Hyperliquid already binds it, otherwise submit the approval, poll the directive until it finalizes, and confirm the binding on Hyperliquid.

Source

pub async fn approve_hypercall_builder( &self, manager: &HypercallWallet, params: ApproveHypercallBuilderParams, ) -> Result<B256>

Approve the zero-fee Hypercall builder for the account on Hyperliquid with one manager HyperEVM transaction calling Account.approveZeroFeeBuilder(builder). Idempotent on the venue.

Needed once per account before TEE perp orders are accepted (they are refused with builder_not_approved until then). Requires Account 0.2.4 or newer and a little HYPE on the manager for gas.

Trait Implementations§

Source§

impl Clone for HypercallClient

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HypercallClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more