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
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.
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 writtenopts::include_height- Whether to include block height in output (default:false)
Examples
Hyperliquid.Node.file_snapshot(%{type: "referrerStates"}, "/tmp/out.json")
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.
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..."})
Write L4 snapshots to a file on the node.
Parameters
out_path: File path on the nodeopts::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.
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.
Returns {:ok, data} if the node is reachable, {:error, reason} otherwise.
Write a referrer states snapshot to a file on the node.
Parameters
out_path: File path on the nodeopts: Seefile_snapshot/3
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"])
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.