View Source Hyperliquid.Node (hyperliquid v0.4.1)

Client for interacting with a local Hyperliquid node.

Local nodes can serve EVM JSON-RPC (/evm) and Info API (/info) endpoints when started with --serve-eth-rpc and --serve-info flags. This gives lower latency, no rate limits, and reduced trust assumptions.

Info Endpoints

Convenience functions are generated for the info requests verified to work on the local info server. Each function sends the request to the node's /info endpoint and parses the response using the corresponding endpoint module when available.

# Documented endpoints with parsed struct responses
Hyperliquid.Node.meta()
Hyperliquid.Node.clearinghouse_state("0x...")

# Generic fallback for any info request (returns raw snake_cased map)
Hyperliquid.Node.info_request(%{type: "someEndpoint"})

File Snapshots

The local info server supports fileSnapshot requests that write large snapshot data to files on the node's filesystem.

Hyperliquid.Node.file_snapshot(%{type: "referrerStates"}, "/tmp/out.json")
Hyperliquid.Node.referrer_states_snapshot("/tmp/out.json")
Hyperliquid.Node.l4_snapshots("/tmp/out.json")

EVM RPC

When enable_node_rpc: true is configured, a :node named RPC is registered at startup pointing to node_url/evm. You can use it directly:

Hyperliquid.Rpc.Eth.block_number(rpc_name: :node)

Or through the convenience helpers:

Hyperliquid.Node.rpc_call("eth_blockNumber")

Configuration

Info and RPC can be enabled independently:

config :hyperliquid,
  node_url: "http://localhost:3001",
  enable_node_info: true,  # enables Node info convenience functions
  enable_node_rpc: true    # registers :node named RPC at startup

Summary

Functions

Fetch activeAssetData for the given user and coin from the local node.

Fetch alignedQuoteTokenInfo for the given token from the local node.

Fetch allBorrowLendReserveStates from the local node.

Fetch allPerpMetas from the local node.

Fetch approvedBuilders for the given user from the local node.

Fetch borrowLendReserveState for the given token from the local node.

Fetch borrowLendUserState for the given user from the local node.

Fetch clearinghouseState for the given user from the local node. Accepts [:dex] as optional keyword args.

Fetch delegations for the given user from the local node.

Fetch delegatorSummary for the given user from the local node.

Fetch exchangeStatus from the local node.

Fetch extraAgents for the given user from the local node.

Send a fileSnapshot request to the local node.

Fetch frontendOpenOrders for the given user from the local node. Accepts [:dex] as optional keyword args.

Fetch gossipPriorityAuctionStatus from the local node.

Send any info request to the local node.

Write L4 snapshots to a file on the node.

Fetch leadingVaults from the local node.

Fetch liquidatable from the local node.

Fetch marginTable for the given id from the local node.

Fetch maxBuilderFee for the given user from the local node.

Fetch maxMarketOrderNtls for the given user from the local node.

Fetch meta from the local node. Accepts [:dex] as optional keyword args.

Fetch openOrders for the given user from the local node. Accepts [:dex] as optional keyword args.

Fetch outcomeMeta from the local node.

Fetch outcomeTemplates from the local node.

Fetch perpAnnotation for the given coin from the local node.

Fetch perpCategories from the local node.

Fetch perpConciseAnnotations from the local node.

Fetch perpDeployAuctionStatus from the local node.

Fetch perpDexLimits for the given dex from the local node.

Fetch perpDexStatus for the given dex from the local node.

Fetch perpDexs from the local node.

Fetch perpsAtOpenInterestCap from the local node. Accepts [:dex] as optional keyword args.

Ping the local node by requesting exchange status.

Write a referrer states snapshot to a file on the node.

Make a JSON-RPC call to the node's EVM endpoint.

Like rpc_call/2 but raises on error.

Fetch settledOutcome for the given outcome from the local node.

Fetch spotClearinghouseState for the given user from the local node.

Fetch spotDeployState from the local node.

Fetch spotMeta from the local node.

Fetch spotPairDeployAuctionStatus from the local node.

Fetch subAccounts2 for the given user from the local node.

Fetch subAccounts for the given user from the local node.

Fetch userAbstraction for the given user from the local node.

Fetch userDexAbstraction for the given user from the local node.

Fetch userFees for the given user from the local node.

Fetch userRateLimit for the given user from the local node.

Fetch userRole for the given user from the local node.

Fetch userToMultiSigSigners for the given user from the local node.

Fetch userVaultEquities for the given user from the local node.

Fetch validatorL1Votes from the local node.

Fetch vaultSummaries from the local node.

Fetch webData2 for the given user from the local node.

Functions

Link to this function

active_asset_data(user, coin)

View Source

Fetch activeAssetData for the given user and coin from the local node.

Link to this function

aligned_quote_token_info(token)

View Source

Fetch alignedQuoteTokenInfo for the given token from the local node.

Link to this function

all_borrow_lend_reserve_states()

View Source

Fetch allBorrowLendReserveStates from the local node.

Fetch allPerpMetas from the local node.

Fetch approvedBuilders for the given user from the local node.

Link to this function

borrow_lend_reserve_state(token)

View Source

Fetch borrowLendReserveState for the given token from the local node.

Link to this function

borrow_lend_user_state(user)

View Source

Fetch borrowLendUserState for the given user from the local node.

Link to this function

clearinghouse_state(user, opts \\ [])

View Source

Fetch clearinghouseState for the given user from the local node. Accepts [:dex] as optional keyword args.

Fetch delegations for the given user from the local node.

Fetch delegatorSummary for the given user from the local node.

Fetch exchangeStatus from the local node.

Fetch extraAgents for the given user from the local node.

Link to this function

file_snapshot(request, out_path, opts \\ [])

View Source

Send a fileSnapshot request to the local node.

File snapshot requests write large data sets to a file on the node's filesystem rather than returning them in the HTTP response.

Parameters

  • request: The inner request map (e.g., %{type: "referrerStates"})
  • out_path: Absolute path on the node where the snapshot file will be written
  • opts:
    • :include_height - Whether to include block height in output (default: false)

Examples

Hyperliquid.Node.file_snapshot(%{type: "referrerStates"}, "/tmp/out.json")
Link to this function

frontend_open_orders(user, opts \\ [])

View Source

Fetch frontendOpenOrders for the given user from the local node. Accepts [:dex] as optional keyword args.

Link to this function

gossip_priority_auction_status()

View Source

Fetch gossipPriorityAuctionStatus from the local node.

Link to this function

info_request(payload, opts \\ [])

View Source

Send any info request to the local node.

This is a generic fallback that accepts any payload. Use this for undocumented endpoints or when you need full control over the request.

Examples

Hyperliquid.Node.info_request(%{type: "someEndpoint"})
Hyperliquid.Node.info_request(%{type: "clearinghouseState", user: "0x..."})
Link to this function

l4_snapshots(out_path, opts \\ [])

View Source

Write L4 snapshots to a file on the node.

Parameters

  • out_path: File path on the node
  • opts:
    • :include_users - Include user data (default: true)
    • :include_trigger_orders - Include trigger orders (default: true)
    • :include_height - Include block height in output (default: false)

Fetch leadingVaults from the local node.

Fetch liquidatable from the local node.

Fetch marginTable for the given id from the local node.

Fetch maxBuilderFee for the given user from the local node.

Link to this function

max_market_order_ntls(user)

View Source

Fetch maxMarketOrderNtls for the given user from the local node.

Fetch meta from the local node. Accepts [:dex] as optional keyword args.

Link to this function

open_orders(user, opts \\ [])

View Source

Fetch openOrders for the given user from the local node. Accepts [:dex] as optional keyword args.

Fetch outcomeMeta from the local node.

Fetch outcomeTemplates from the local node.

Fetch perpAnnotation for the given coin from the local node.

Fetch perpCategories from the local node.

Link to this function

perp_concise_annotations()

View Source

Fetch perpConciseAnnotations from the local node.

Link to this function

perp_deploy_auction_status()

View Source

Fetch perpDeployAuctionStatus from the local node.

Fetch perpDexLimits for the given dex from the local node.

Fetch perpDexStatus for the given dex from the local node.

Fetch perpDexs from the local node.

Link to this function

perps_at_open_interest_cap(opts \\ [])

View Source

Fetch perpsAtOpenInterestCap from the local node. Accepts [:dex] as optional keyword args.

Ping the local node by requesting exchange status.

Returns {:ok, data} if the node is reachable, {:error, reason} otherwise.

Link to this function

referrer_states_snapshot(out_path, opts \\ [])

View Source

Write a referrer states snapshot to a file on the node.

Parameters

Link to this function

rpc_call(method, params \\ [])

View Source

Make a JSON-RPC call to the node's EVM endpoint.

Requires enable_node_rpc: true in config so the :node named RPC is registered.

Examples

Hyperliquid.Node.rpc_call("eth_blockNumber")
Hyperliquid.Node.rpc_call("eth_getBalance", ["0x...", "latest"])
Link to this function

rpc_call!(method, params \\ [])

View Source

Like rpc_call/2 but raises on error.

Link to this function

settled_outcome(outcome)

View Source

Fetch settledOutcome for the given outcome from the local node.

Link to this function

spot_clearinghouse_state(user)

View Source

Fetch spotClearinghouseState for the given user from the local node.

Fetch spotDeployState from the local node.

Fetch spotMeta from the local node.

Link to this function

spot_pair_deploy_auction_status()

View Source

Fetch spotPairDeployAuctionStatus from the local node.

Fetch subAccounts2 for the given user from the local node.

Fetch subAccounts for the given user from the local node.

Fetch userAbstraction for the given user from the local node.

Link to this function

user_dex_abstraction(user)

View Source

Fetch userDexAbstraction for the given user from the local node.

Fetch userFees for the given user from the local node.

Fetch userRateLimit for the given user from the local node.

Fetch userRole for the given user from the local node.

Link to this function

user_to_multi_sig_signers(user)

View Source

Fetch userToMultiSigSigners for the given user from the local node.

Link to this function

user_vault_equities(user)

View Source

Fetch userVaultEquities for the given user from the local node.

Fetch validatorL1Votes from the local node.

Fetch vaultSummaries from the local node.

Fetch webData2 for the given user from the local node.