diff --git a/docs.json b/docs.json index 80e21c5a..0985a37d 100644 --- a/docs.json +++ b/docs.json @@ -2131,6 +2131,15 @@ "reference/hyperliquid-info-approved-builders", "reference/hyperliquid-info-perp-concise-annotations", "reference/hyperliquid-info-settled-outcome", + "reference/hyperliquid-info-gossip-priority-auction-status", + "reference/hyperliquid-info-sub-accounts2", + "reference/hyperliquid-info-is-vip", + "reference/hyperliquid-info-legal-check", + "reference/hyperliquid-info-pre-transfer-check", + "reference/hyperliquid-info-twap-history", + "reference/hyperliquid-info-user-borrow-lend-interest", + "reference/hyperliquid-info-user-twap-slice-fills-by-time", + "reference/hyperliquid-info-validator-summaries", "reference/hyperliquid-exchange-place-order", "reference/hyperliquid-exchange-cancel-order", "reference/hyperliquid-exchange-cancel-order-by-cloid", @@ -2146,6 +2155,18 @@ "reference/hyperliquid-exchange-twap-order", "reference/hyperliquid-exchange-twap-cancel", "reference/hyperliquid-exchange-user-outcome", + "reference/hyperliquid-exchange-borrow-lend", + "reference/hyperliquid-exchange-create-vault", + "reference/hyperliquid-exchange-vault-modify", + "reference/hyperliquid-exchange-vault-distribute", + "reference/hyperliquid-exchange-sub-account-modify", + "reference/hyperliquid-exchange-set-display-name", + "reference/hyperliquid-exchange-register-referrer", + "reference/hyperliquid-exchange-finalize-evm-contract", + "reference/hyperliquid-exchange-gossip-priority-bid", + "reference/hyperliquid-exchange-link-staking-user", + "reference/hyperliquid-exchange-staking-link-disable-trading-user", + "reference/hyperliquid-exchange-user-portfolio-margin", "reference/hyperliquid-exchange-approve-agent", "reference/hyperliquid-exchange-approve-builder-fee", "reference/hyperliquid-exchange-set-referrer", diff --git a/openapi/hyperliquid_node_api/hypercore_exchange/exchange_borrow_lend.json b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_borrow_lend.json new file mode 100644 index 00000000..55cd790a --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_borrow_lend.json @@ -0,0 +1,82 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Exchange API", + "version": "1.0.0", + "description": "API for trading operations on Hyperliquid exchange requiring authentication. ⚠️ WARNING: These endpoints require EIP-712 signatures for authentication. The example values provided will NOT work without proper cryptographic signing. You must implement EIP-712 signing to use these endpoints successfully." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/exchange": { + "post": { + "tags": [ + "hyperliquid exchange" + ], + "summary": "Borrow / lend (supply, withdraw, repay, borrow)", + "operationId": "borrowLend", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "action": { + "type": "object", + "properties": { + "type": { "type": "string", "default": "borrowLend", "enum": ["borrowLend"], "description": "Action type" }, + "operation": { "type": "string", "enum": ["supply", "withdraw", "repay", "borrow"], "description": "Borrow/lend operation to perform" }, + "token": { "type": "integer", "description": "Token ID" }, + "amount": { "type": "string", "nullable": true, "description": "Amount to supply/withdraw/repay/borrow (null = full)" } + }, + "required": ["type", "operation", "token", "amount"] + }, + "nonce": { "type": "integer", "description": "Current timestamp in milliseconds" }, + "signature": { + "type": "object", + "description": "EIP-712 signature of the action with r, s, v components", + "properties": { + "r": { "type": "string", "example": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" }, + "s": { "type": "string", "example": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321" }, + "v": { "type": "integer", "example": 27 } + }, + "required": ["r", "s", "v"] + }, + "vaultAddress": { "type": "string", "nullable": true, "description": "Address when acting on behalf of a vault (optional)" }, + "expiresAfter": { "type": "integer", "description": "Timestamp in milliseconds after which the request is rejected (optional)" } + }, + "required": ["action", "nonce", "signature"] + }, + "example": { + "action": { "type": "borrowLend", "operation": "supply", "token": 0, "amount": "1" }, + "nonce": 1705234567890, + "signature": { "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321", "v": 27 } + } + } + } + }, + "responses": { + "200": { + "description": "Borrow/lend result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string", "description": "Request status" }, + "response": { "type": "object", "properties": { "type": { "type": "string", "default": "default" } } } + }, + "example": { "status": "ok", "response": { "type": "default" } } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_exchange/exchange_create_vault.json b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_create_vault.json new file mode 100644 index 00000000..eb071f0e --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_create_vault.json @@ -0,0 +1,88 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Exchange API", + "version": "1.0.0", + "description": "API for trading operations on Hyperliquid exchange requiring authentication. ⚠️ WARNING: These endpoints require EIP-712 signatures for authentication. The example values provided will NOT work without proper cryptographic signing. You must implement EIP-712 signing to use these endpoints successfully." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/exchange": { + "post": { + "tags": [ + "hyperliquid exchange" + ], + "summary": "Create vault", + "operationId": "createVault", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "action": { + "type": "object", + "properties": { + "type": { "type": "string", "default": "createVault", "enum": ["createVault"], "description": "Action type" }, + "name": { "type": "string", "description": "Vault name (3-50 characters)" }, + "description": { "type": "string", "description": "Vault description (10-250 characters)" }, + "initialUsd": { "type": "integer", "description": "Initial balance as USD float * 1e6 (minimum 100 USD = 100000000)" }, + "nonce": { "type": "integer", "description": "Timestamp in milliseconds, equal to the envelope nonce" } + }, + "required": ["type", "name", "description", "initialUsd", "nonce"] + }, + "nonce": { "type": "integer", "description": "Current timestamp in milliseconds" }, + "signature": { + "type": "object", + "description": "EIP-712 signature of the action with r, s, v components", + "properties": { + "r": { "type": "string", "example": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" }, + "s": { "type": "string", "example": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321" }, + "v": { "type": "integer", "example": 27 } + }, + "required": ["r", "s", "v"] + }, + "expiresAfter": { "type": "integer", "description": "Timestamp in milliseconds after which the request is rejected (optional)" } + }, + "required": ["action", "nonce", "signature"] + }, + "example": { + "action": { "type": "createVault", "name": "My vault", "description": "A vault for copy trading", "initialUsd": 100000000, "nonce": 1705234567890 }, + "nonce": 1705234567890, + "signature": { "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321", "v": 27 } + } + } + } + }, + "responses": { + "200": { + "description": "Create vault result, including the new vault address", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string", "description": "Request status" }, + "response": { + "type": "object", + "properties": { + "type": { "type": "string", "default": "createVault" }, + "data": { "type": "string", "description": "Address of the newly created vault" } + } + } + }, + "example": { "status": "ok", "response": { "type": "createVault", "data": "0x1719884eb866cb12b2287399b15f7db5e7d775ea" } } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_exchange/exchange_finalize_evm_contract.json b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_finalize_evm_contract.json new file mode 100644 index 00000000..a7644f4d --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_finalize_evm_contract.json @@ -0,0 +1,94 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Exchange API", + "version": "1.0.0", + "description": "API for trading operations on Hyperliquid exchange requiring authentication. ⚠️ WARNING: These endpoints require EIP-712 signatures for authentication. The example values provided will NOT work without proper cryptographic signing. You must implement EIP-712 signing to use these endpoints successfully." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/exchange": { + "post": { + "tags": ["hyperliquid exchange"], + "summary": "Finalize EVM contract linkage", + "operationId": "finalizeEvmContract", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "action": { + "type": "object", + "properties": { + "type": { "type": "string", "default": "finalizeEvmContract", "enum": ["finalizeEvmContract"], "description": "Action type" }, + "token": { "type": "integer", "description": "Token identifier to link" }, + "input": { + "description": "Verification method matching how the EVM contract was deployed. Either an object { \"create\": { \"nonce\": } } for an EOA-deployed contract, or one of the string literals \"firstStorageSlot\" or \"customStorageSlot\".", + "oneOf": [ + { + "type": "object", + "properties": { + "create": { + "type": "object", + "properties": { "nonce": { "type": "integer", "description": "Nonce used to deploy the EVM contract" } }, + "required": ["nonce"] + } + }, + "required": ["create"] + }, + { "type": "string", "enum": ["firstStorageSlot", "customStorageSlot"] } + ] + } + }, + "required": ["type", "token", "input"] + }, + "nonce": { "type": "integer", "description": "Current timestamp in milliseconds" }, + "signature": { + "type": "object", + "description": "EIP-712 signature of the action with r, s, v components", + "properties": { + "r": { "type": "string", "example": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" }, + "s": { "type": "string", "example": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321" }, + "v": { "type": "integer", "example": 27 } + }, + "required": ["r", "s", "v"] + }, + "expiresAfter": { "type": "integer", "description": "Timestamp in milliseconds after which the request is rejected (optional)" } + }, + "required": ["action", "nonce", "signature"] + }, + "example": { + "action": { "type": "finalizeEvmContract", "token": 0, "input": "firstStorageSlot" }, + "nonce": 1705234567890, + "signature": { "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321", "v": 27 } + } + } + } + }, + "responses": { + "200": { + "description": "Finalize EVM contract result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string", "description": "Request status" }, + "response": { "type": "object", "properties": { "type": { "type": "string", "default": "default" } } } + }, + "example": { "status": "ok", "response": { "type": "default" } } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_exchange/exchange_gossip_priority_bid.json b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_gossip_priority_bid.json new file mode 100644 index 00000000..6b80023d --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_gossip_priority_bid.json @@ -0,0 +1,79 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Exchange API", + "version": "1.0.0", + "description": "API for trading operations on Hyperliquid exchange requiring authentication. ⚠️ WARNING: These endpoints require EIP-712 signatures for authentication. The example values provided will NOT work without proper cryptographic signing. You must implement EIP-712 signing to use these endpoints successfully." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/exchange": { + "post": { + "tags": ["hyperliquid exchange"], + "summary": "Bid in the gossip priority auction", + "operationId": "gossipPriorityBid", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "action": { + "type": "object", + "properties": { + "type": { "type": "string", "default": "gossipPriorityBid", "enum": ["gossipPriorityBid"], "description": "Action type" }, + "slotId": { "type": "integer", "enum": [0, 1], "description": "Auction slot identifier (0 or 1). Lower-indexed slots are strictly prioritized." }, + "ip": { "type": "string", "description": "IP address (IPv4 or IPv6) to prioritize. Any address may bid on behalf of any IP." }, + "maxGas": { "type": "integer", "description": "Max gas in wei (1 HYPE = 10^8 wei) charged from spot balance. Minimum auction price is 0.1 HYPE." } + }, + "required": ["type", "slotId", "ip", "maxGas"] + }, + "nonce": { "type": "integer", "description": "Current timestamp in milliseconds" }, + "signature": { + "type": "object", + "description": "EIP-712 signature of the action with r, s, v components", + "properties": { + "r": { "type": "string", "example": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" }, + "s": { "type": "string", "example": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321" }, + "v": { "type": "integer", "example": 27 } + }, + "required": ["r", "s", "v"] + }, + "expiresAfter": { "type": "integer", "description": "Timestamp in milliseconds after which the request is rejected (optional)" } + }, + "required": ["action", "nonce", "signature"] + }, + "example": { + "action": { "type": "gossipPriorityBid", "slotId": 0, "ip": "1.2.3.4", "maxGas": 10000000 }, + "nonce": 1705234567890, + "signature": { "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321", "v": 27 } + } + } + } + }, + "responses": { + "200": { + "description": "Gossip priority bid result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string", "description": "Request status" }, + "response": { "type": "object", "properties": { "type": { "type": "string", "default": "default" } } } + }, + "example": { "status": "ok", "response": { "type": "default" } } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_exchange/exchange_link_staking_user.json b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_link_staking_user.json new file mode 100644 index 00000000..315d3c21 --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_link_staking_user.json @@ -0,0 +1,80 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Exchange API", + "version": "1.0.0", + "description": "API for trading operations on Hyperliquid exchange requiring authentication. ⚠️ WARNING: These endpoints require EIP-712 signatures for authentication. The example values provided will NOT work without proper cryptographic signing. You must implement EIP-712 signing to use these endpoints successfully." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/exchange": { + "post": { + "tags": ["hyperliquid exchange"], + "summary": "Link a staking user (initiate or finalize)", + "operationId": "linkStakingUser", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "action": { + "type": "object", + "properties": { + "type": { "type": "string", "default": "linkStakingUser", "enum": ["linkStakingUser"], "description": "Action type" }, + "signatureChainId": { "type": "string", "description": "Chain ID in hex format used for EIP-712 signing" }, + "hyperliquidChain": { "type": "string", "enum": ["Mainnet", "Testnet"], "description": "Hyperliquid network type" }, + "user": { "type": "string", "description": "Target account address. Trading user initiating: enter the staking account address. Staking user finalizing: enter the trading account address." }, + "isFinalize": { "type": "boolean", "description": "false = trading user initiates the link request; true = staking user finalizes the permanent link" }, + "nonce": { "type": "integer", "description": "Timestamp in milliseconds, equal to the envelope nonce" } + }, + "required": ["type", "signatureChainId", "hyperliquidChain", "user", "isFinalize", "nonce"] + }, + "nonce": { "type": "integer", "description": "Current timestamp in milliseconds" }, + "signature": { + "type": "object", + "description": "EIP-712 signature of the action with r, s, v components", + "properties": { + "r": { "type": "string", "example": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" }, + "s": { "type": "string", "example": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321" }, + "v": { "type": "integer", "example": 27 } + }, + "required": ["r", "s", "v"] + } + }, + "required": ["action", "nonce", "signature"] + }, + "example": { + "action": { "type": "linkStakingUser", "signatureChainId": "0x66eee", "hyperliquidChain": "Mainnet", "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", "isFinalize": false, "nonce": 1705234567890 }, + "nonce": 1705234567890, + "signature": { "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321", "v": 27 } + } + } + } + }, + "responses": { + "200": { + "description": "Link staking user result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string", "description": "Request status" }, + "response": { "type": "object", "properties": { "type": { "type": "string", "default": "default" } } } + }, + "example": { "status": "ok", "response": { "type": "default" } } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_exchange/exchange_register_referrer.json b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_register_referrer.json new file mode 100644 index 00000000..f88ffe00 --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_register_referrer.json @@ -0,0 +1,77 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Exchange API", + "version": "1.0.0", + "description": "API for trading operations on Hyperliquid exchange requiring authentication. ⚠️ WARNING: These endpoints require EIP-712 signatures for authentication. The example values provided will NOT work without proper cryptographic signing. You must implement EIP-712 signing to use these endpoints successfully." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/exchange": { + "post": { + "tags": ["hyperliquid exchange"], + "summary": "Register a referral code", + "operationId": "registerReferrer", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "action": { + "type": "object", + "properties": { + "type": { "type": "string", "default": "registerReferrer", "enum": ["registerReferrer"], "description": "Action type" }, + "code": { "type": "string", "description": "Referral code to create (1-20 characters)" } + }, + "required": ["type", "code"] + }, + "nonce": { "type": "integer", "description": "Current timestamp in milliseconds" }, + "signature": { + "type": "object", + "description": "EIP-712 signature of the action with r, s, v components", + "properties": { + "r": { "type": "string", "example": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" }, + "s": { "type": "string", "example": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321" }, + "v": { "type": "integer", "example": 27 } + }, + "required": ["r", "s", "v"] + }, + "expiresAfter": { "type": "integer", "description": "Timestamp in milliseconds after which the request is rejected (optional)" } + }, + "required": ["action", "nonce", "signature"] + }, + "example": { + "action": { "type": "registerReferrer", "code": "CHAINSTACK" }, + "nonce": 1705234567890, + "signature": { "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321", "v": 27 } + } + } + } + }, + "responses": { + "200": { + "description": "Register referrer result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string", "description": "Request status" }, + "response": { "type": "object", "properties": { "type": { "type": "string", "default": "default" } } } + }, + "example": { "status": "ok", "response": { "type": "default" } } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_exchange/exchange_set_display_name.json b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_set_display_name.json new file mode 100644 index 00000000..d5856126 --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_set_display_name.json @@ -0,0 +1,77 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Exchange API", + "version": "1.0.0", + "description": "API for trading operations on Hyperliquid exchange requiring authentication. ⚠️ WARNING: These endpoints require EIP-712 signatures for authentication. The example values provided will NOT work without proper cryptographic signing. You must implement EIP-712 signing to use these endpoints successfully." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/exchange": { + "post": { + "tags": ["hyperliquid exchange"], + "summary": "Set display name", + "operationId": "setDisplayName", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "action": { + "type": "object", + "properties": { + "type": { "type": "string", "default": "setDisplayName", "enum": ["setDisplayName"], "description": "Action type" }, + "displayName": { "type": "string", "description": "Display name (max 20 characters). Set to an empty string to remove it." } + }, + "required": ["type", "displayName"] + }, + "nonce": { "type": "integer", "description": "Current timestamp in milliseconds" }, + "signature": { + "type": "object", + "description": "EIP-712 signature of the action with r, s, v components", + "properties": { + "r": { "type": "string", "example": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" }, + "s": { "type": "string", "example": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321" }, + "v": { "type": "integer", "example": 27 } + }, + "required": ["r", "s", "v"] + }, + "expiresAfter": { "type": "integer", "description": "Timestamp in milliseconds after which the request is rejected (optional)" } + }, + "required": ["action", "nonce", "signature"] + }, + "example": { + "action": { "type": "setDisplayName", "displayName": "satoshi" }, + "nonce": 1705234567890, + "signature": { "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321", "v": 27 } + } + } + } + }, + "responses": { + "200": { + "description": "Set display name result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string", "description": "Request status" }, + "response": { "type": "object", "properties": { "type": { "type": "string", "default": "default" } } } + }, + "example": { "status": "ok", "response": { "type": "default" } } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_exchange/exchange_staking_link_disable_trading_user.json b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_staking_link_disable_trading_user.json new file mode 100644 index 00000000..f1a9e060 --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_staking_link_disable_trading_user.json @@ -0,0 +1,79 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Exchange API", + "version": "1.0.0", + "description": "API for trading operations on Hyperliquid exchange requiring authentication. ⚠️ WARNING: These endpoints require EIP-712 signatures for authentication. The example values provided will NOT work without proper cryptographic signing. You must implement EIP-712 signing to use these endpoints successfully." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/exchange": { + "post": { + "tags": ["hyperliquid exchange"], + "summary": "Disable a linked trading user (staking side)", + "operationId": "stakingLinkDisableTradingUser", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "action": { + "type": "object", + "properties": { + "type": { "type": "string", "default": "stakingLinkDisableTradingUser", "enum": ["stakingLinkDisableTradingUser"], "description": "Action type" }, + "signatureChainId": { "type": "string", "description": "Chain ID in hex format used for EIP-712 signing" }, + "hyperliquidChain": { "type": "string", "enum": ["Mainnet", "Testnet"], "description": "Hyperliquid network type" }, + "tradingUser": { "type": "string", "description": "Trading user address to disable" }, + "nonce": { "type": "integer", "description": "Timestamp in milliseconds, equal to the envelope nonce" } + }, + "required": ["type", "signatureChainId", "hyperliquidChain", "tradingUser", "nonce"] + }, + "nonce": { "type": "integer", "description": "Current timestamp in milliseconds" }, + "signature": { + "type": "object", + "description": "EIP-712 signature of the action with r, s, v components", + "properties": { + "r": { "type": "string", "example": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" }, + "s": { "type": "string", "example": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321" }, + "v": { "type": "integer", "example": 27 } + }, + "required": ["r", "s", "v"] + } + }, + "required": ["action", "nonce", "signature"] + }, + "example": { + "action": { "type": "stakingLinkDisableTradingUser", "signatureChainId": "0x66eee", "hyperliquidChain": "Mainnet", "tradingUser": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", "nonce": 1705234567890 }, + "nonce": 1705234567890, + "signature": { "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321", "v": 27 } + } + } + } + }, + "responses": { + "200": { + "description": "Disable linked trading user result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string", "description": "Request status" }, + "response": { "type": "object", "properties": { "type": { "type": "string", "default": "default" } } } + }, + "example": { "status": "ok", "response": { "type": "default" } } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_exchange/exchange_sub_account_modify.json b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_sub_account_modify.json new file mode 100644 index 00000000..e7931816 --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_sub_account_modify.json @@ -0,0 +1,78 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Exchange API", + "version": "1.0.0", + "description": "API for trading operations on Hyperliquid exchange requiring authentication. ⚠️ WARNING: These endpoints require EIP-712 signatures for authentication. The example values provided will NOT work without proper cryptographic signing. You must implement EIP-712 signing to use these endpoints successfully." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/exchange": { + "post": { + "tags": ["hyperliquid exchange"], + "summary": "Modify a sub-account", + "operationId": "subAccountModify", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "action": { + "type": "object", + "properties": { + "type": { "type": "string", "default": "subAccountModify", "enum": ["subAccountModify"], "description": "Action type" }, + "subAccountUser": { "type": "string", "description": "Sub-account address to modify" }, + "name": { "type": "string", "description": "New sub-account name (1-16 characters)" } + }, + "required": ["type", "subAccountUser", "name"] + }, + "nonce": { "type": "integer", "description": "Current timestamp in milliseconds" }, + "signature": { + "type": "object", + "description": "EIP-712 signature of the action with r, s, v components", + "properties": { + "r": { "type": "string", "example": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" }, + "s": { "type": "string", "example": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321" }, + "v": { "type": "integer", "example": 27 } + }, + "required": ["r", "s", "v"] + }, + "expiresAfter": { "type": "integer", "description": "Timestamp in milliseconds after which the request is rejected (optional)" } + }, + "required": ["action", "nonce", "signature"] + }, + "example": { + "action": { "type": "subAccountModify", "subAccountUser": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", "name": "Strategy A" }, + "nonce": 1705234567890, + "signature": { "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321", "v": 27 } + } + } + } + }, + "responses": { + "200": { + "description": "Sub-account modify result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string", "description": "Request status" }, + "response": { "type": "object", "properties": { "type": { "type": "string", "default": "default" } } } + }, + "example": { "status": "ok", "response": { "type": "default" } } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_exchange/exchange_user_portfolio_margin.json b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_user_portfolio_margin.json new file mode 100644 index 00000000..25e10d9a --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_user_portfolio_margin.json @@ -0,0 +1,80 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Exchange API", + "version": "1.0.0", + "description": "API for trading operations on Hyperliquid exchange requiring authentication. ⚠️ WARNING: These endpoints require EIP-712 signatures for authentication. The example values provided will NOT work without proper cryptographic signing. You must implement EIP-712 signing to use these endpoints successfully." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/exchange": { + "post": { + "tags": ["hyperliquid exchange"], + "summary": "Enable or disable portfolio margin", + "operationId": "userPortfolioMargin", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "action": { + "type": "object", + "properties": { + "type": { "type": "string", "default": "userPortfolioMargin", "enum": ["userPortfolioMargin"], "description": "Action type" }, + "signatureChainId": { "type": "string", "description": "Chain ID in hex format used for EIP-712 signing" }, + "hyperliquidChain": { "type": "string", "enum": ["Mainnet", "Testnet"], "description": "Hyperliquid network type" }, + "user": { "type": "string", "description": "User address" }, + "enabled": { "type": "boolean", "description": "Whether to enable or disable portfolio margin" }, + "nonce": { "type": "integer", "description": "Timestamp in milliseconds, equal to the envelope nonce" } + }, + "required": ["type", "signatureChainId", "hyperliquidChain", "user", "enabled", "nonce"] + }, + "nonce": { "type": "integer", "description": "Current timestamp in milliseconds" }, + "signature": { + "type": "object", + "description": "EIP-712 signature of the action with r, s, v components", + "properties": { + "r": { "type": "string", "example": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" }, + "s": { "type": "string", "example": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321" }, + "v": { "type": "integer", "example": 27 } + }, + "required": ["r", "s", "v"] + } + }, + "required": ["action", "nonce", "signature"] + }, + "example": { + "action": { "type": "userPortfolioMargin", "signatureChainId": "0x66eee", "hyperliquidChain": "Mainnet", "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", "enabled": true, "nonce": 1705234567890 }, + "nonce": 1705234567890, + "signature": { "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321", "v": 27 } + } + } + } + }, + "responses": { + "200": { + "description": "User portfolio margin result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string", "description": "Request status" }, + "response": { "type": "object", "properties": { "type": { "type": "string", "default": "default" } } } + }, + "example": { "status": "ok", "response": { "type": "default" } } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_exchange/exchange_vault_distribute.json b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_vault_distribute.json new file mode 100644 index 00000000..8d7dd98b --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_vault_distribute.json @@ -0,0 +1,80 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Exchange API", + "version": "1.0.0", + "description": "API for trading operations on Hyperliquid exchange requiring authentication. ⚠️ WARNING: These endpoints require EIP-712 signatures for authentication. The example values provided will NOT work without proper cryptographic signing. You must implement EIP-712 signing to use these endpoints successfully." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/exchange": { + "post": { + "tags": [ + "hyperliquid exchange" + ], + "summary": "Distribute funds from a vault", + "operationId": "vaultDistribute", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "action": { + "type": "object", + "properties": { + "type": { "type": "string", "default": "vaultDistribute", "enum": ["vaultDistribute"], "description": "Action type" }, + "vaultAddress": { "type": "string", "description": "Vault address" }, + "usd": { "type": "integer", "description": "Amount to distribute as USD float * 1e6. Set to 0 to close the vault." } + }, + "required": ["type", "vaultAddress", "usd"] + }, + "nonce": { "type": "integer", "description": "Current timestamp in milliseconds" }, + "signature": { + "type": "object", + "description": "EIP-712 signature of the action with r, s, v components", + "properties": { + "r": { "type": "string", "example": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" }, + "s": { "type": "string", "example": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321" }, + "v": { "type": "integer", "example": 27 } + }, + "required": ["r", "s", "v"] + }, + "expiresAfter": { "type": "integer", "description": "Timestamp in milliseconds after which the request is rejected (optional)" } + }, + "required": ["action", "nonce", "signature"] + }, + "example": { + "action": { "type": "vaultDistribute", "vaultAddress": "0x1719884eb866cb12b2287399b15f7db5e7d775ea", "usd": 1000000 }, + "nonce": 1705234567890, + "signature": { "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321", "v": 27 } + } + } + } + }, + "responses": { + "200": { + "description": "Vault distribute result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string", "description": "Request status" }, + "response": { "type": "object", "properties": { "type": { "type": "string", "default": "default" } } } + }, + "example": { "status": "ok", "response": { "type": "default" } } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_exchange/exchange_vault_modify.json b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_vault_modify.json new file mode 100644 index 00000000..80097b16 --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_exchange/exchange_vault_modify.json @@ -0,0 +1,81 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Exchange API", + "version": "1.0.0", + "description": "API for trading operations on Hyperliquid exchange requiring authentication. ⚠️ WARNING: These endpoints require EIP-712 signatures for authentication. The example values provided will NOT work without proper cryptographic signing. You must implement EIP-712 signing to use these endpoints successfully." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/exchange": { + "post": { + "tags": [ + "hyperliquid exchange" + ], + "summary": "Modify vault settings", + "operationId": "vaultModify", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "action": { + "type": "object", + "properties": { + "type": { "type": "string", "default": "vaultModify", "enum": ["vaultModify"], "description": "Action type" }, + "vaultAddress": { "type": "string", "description": "Vault address to modify" }, + "allowDeposits": { "type": "boolean", "nullable": true, "description": "Allow deposits from followers (null to leave unchanged)" }, + "alwaysCloseOnWithdraw": { "type": "boolean", "nullable": true, "description": "Always close positions on withdrawal (null to leave unchanged)" } + }, + "required": ["type", "vaultAddress"] + }, + "nonce": { "type": "integer", "description": "Current timestamp in milliseconds" }, + "signature": { + "type": "object", + "description": "EIP-712 signature of the action with r, s, v components", + "properties": { + "r": { "type": "string", "example": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" }, + "s": { "type": "string", "example": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321" }, + "v": { "type": "integer", "example": 27 } + }, + "required": ["r", "s", "v"] + }, + "expiresAfter": { "type": "integer", "description": "Timestamp in milliseconds after which the request is rejected (optional)" } + }, + "required": ["action", "nonce", "signature"] + }, + "example": { + "action": { "type": "vaultModify", "vaultAddress": "0x1719884eb866cb12b2287399b15f7db5e7d775ea", "allowDeposits": true, "alwaysCloseOnWithdraw": false }, + "nonce": 1705234567890, + "signature": { "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321", "v": 27 } + } + } + } + }, + "responses": { + "200": { + "description": "Vault modify result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string", "description": "Request status" }, + "response": { "type": "object", "properties": { "type": { "type": "string", "default": "default" } } } + }, + "example": { "status": "ok", "response": { "type": "default" } } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_info/info_gossip_priority_auction_status.json b/openapi/hyperliquid_node_api/hypercore_info/info_gossip_priority_auction_status.json new file mode 100644 index 00000000..c44a198e --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_info/info_gossip_priority_auction_status.json @@ -0,0 +1,61 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Node API", + "version": "1.0.0", + "description": "This is an API for interacting with Chainstack Hyperliquid node." + }, + "servers": [ + { + "url": "https://hyperliquid-mainnet.core.chainstack.com" + } + ], + "paths": { + "/4f8d8f4040bdacd1577bff8058438274/info": { + "post": { + "tags": [ + "hyperliquid operations" + ], + "summary": "info (gossipPriorityAuctionStatus)", + "operationId": "infoGossipPriorityAuctionStatus", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Request type", + "default": "gossipPriorityAuctionStatus", + "enum": [ + "gossipPriorityAuctionStatus" + ] + } + }, + "required": [ + "type" + ] + } + } + } + }, + "responses": { + "200": { + "description": "Current gossip priority auction status: the prioritized IPs and the per-slot auctions.", + "content": { + "application/json": { + "schema": { + "type": "array", + "description": "Two-element array: [list of prioritized IP addresses, list of per-slot auction objects].", + "items": {} + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_info/info_is_vip.json b/openapi/hyperliquid_node_api/hypercore_info/info_is_vip.json new file mode 100644 index 00000000..e1776363 --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_info/info_is_vip.json @@ -0,0 +1,66 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Node API", + "version": "1.0.0", + "description": "This is an API for interacting with Chainstack Hyperliquid node." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/info": { + "post": { + "tags": [ + "hyperliquid operations" + ], + "summary": "info (isVip)", + "operationId": "infoIsVip", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Request type", + "default": "isVip", + "enum": [ + "isVip" + ] + }, + "user": { + "type": "string", + "description": "User address in 42-character hexadecimal format.", + "default": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568" + } + }, + "required": [ + "type", + "user" + ] + } + } + } + }, + "responses": { + "200": { + "description": "Whether the user currently has VIP status.", + "content": { + "application/json": { + "schema": { + "type": "boolean", + "nullable": true + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_info/info_legal_check.json b/openapi/hyperliquid_node_api/hypercore_info/info_legal_check.json new file mode 100644 index 00000000..7e8489b8 --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_info/info_legal_check.json @@ -0,0 +1,79 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Node API", + "version": "1.0.0", + "description": "This is an API for interacting with Chainstack Hyperliquid node." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/info": { + "post": { + "tags": [ + "hyperliquid operations" + ], + "summary": "info (legalCheck)", + "operationId": "infoLegalCheck", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Request type", + "default": "legalCheck", + "enum": [ + "legalCheck" + ] + }, + "user": { + "type": "string", + "description": "User address in 42-character hexadecimal format.", + "default": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568" + } + }, + "required": [ + "type", + "user" + ] + } + } + } + }, + "responses": { + "200": { + "description": "Legal/compliance status for the user.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "acceptedTerms": { + "type": "boolean", + "description": "Whether the user has accepted the terms." + }, + "userAllowed": { + "type": "boolean", + "description": "Whether the user is allowed to trade." + }, + "restrictions": { + "type": "string", + "description": "Restriction code applied to the user, if any." + } + } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_info/info_pre_transfer_check.json b/openapi/hyperliquid_node_api/hypercore_info/info_pre_transfer_check.json new file mode 100644 index 00000000..68bd2802 --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_info/info_pre_transfer_check.json @@ -0,0 +1,89 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Node API", + "version": "1.0.0", + "description": "This is an API for interacting with Chainstack Hyperliquid node." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/info": { + "post": { + "tags": [ + "hyperliquid operations" + ], + "summary": "info (preTransferCheck)", + "operationId": "infoPreTransferCheck", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Request type", + "default": "preTransferCheck", + "enum": [ + "preTransferCheck" + ] + }, + "user": { + "type": "string", + "description": "Destination address in 42-character hexadecimal format.", + "default": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568" + }, + "source": { + "type": "string", + "description": "Source address in 42-character hexadecimal format.", + "default": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568" + } + }, + "required": [ + "type", + "user", + "source" + ] + } + } + } + }, + "responses": { + "200": { + "description": "Pre-transfer check result for the destination user.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "isSanctioned": { + "type": "boolean", + "description": "Whether the address is sanctioned." + }, + "userExists": { + "type": "boolean", + "description": "Whether the destination user already exists on Hyperliquid." + }, + "fee": { + "type": "string", + "description": "Transfer fee that would apply." + }, + "userHasSentTx": { + "type": "boolean", + "description": "Whether the user has previously sent a transaction." + } + } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_info/info_sub_accounts2.json b/openapi/hyperliquid_node_api/hypercore_info/info_sub_accounts2.json new file mode 100644 index 00000000..ba91155d --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_info/info_sub_accounts2.json @@ -0,0 +1,70 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Node API", + "version": "1.0.0", + "description": "This is an API for interacting with Chainstack Hyperliquid node." + }, + "servers": [ + { + "url": "https://hyperliquid-mainnet.core.chainstack.com" + } + ], + "paths": { + "/4f8d8f4040bdacd1577bff8058438274/info": { + "post": { + "tags": [ + "hyperliquid operations" + ], + "summary": "info (subAccounts2)", + "operationId": "infoSubAccounts2", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Request type", + "default": "subAccounts2", + "enum": [ + "subAccounts2" + ] + }, + "user": { + "type": "string", + "description": "User address in 42-character hexadecimal format.", + "default": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568" + } + }, + "required": [ + "type", + "user" + ] + } + } + } + }, + "responses": { + "200": { + "description": "Array of the user's sub-accounts, or null if the user has none.", + "content": { + "application/json": { + "schema": { + "type": "array", + "nullable": true, + "description": "Each item describes a sub-account, including its name, address, master address, per-DEX clearinghouse state, and spot state.", + "items": { + "type": "object" + } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_info/info_twap_history.json b/openapi/hyperliquid_node_api/hypercore_info/info_twap_history.json new file mode 100644 index 00000000..16ab55e7 --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_info/info_twap_history.json @@ -0,0 +1,87 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Node API", + "version": "1.0.0", + "description": "This is an API for interacting with Chainstack Hyperliquid node." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/info": { + "post": { + "tags": [ + "hyperliquid operations" + ], + "summary": "info (twapHistory)", + "operationId": "infoTwapHistory", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Request type", + "default": "twapHistory", + "enum": [ + "twapHistory" + ] + }, + "user": { + "type": "string", + "description": "User address in 42-character hexadecimal format.", + "default": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568" + } + }, + "required": [ + "type", + "user" + ] + } + } + } + }, + "responses": { + "200": { + "description": "The user's TWAP order history.", + "content": { + "application/json": { + "schema": { + "type": "array", + "description": "Each item is a TWAP history record with its creation time, state, and status.", + "items": { + "type": "object", + "properties": { + "time": { + "type": "integer", + "description": "Creation time of the record (seconds since epoch)." + }, + "state": { + "type": "object", + "description": "State of the TWAP order." + }, + "status": { + "type": "object", + "description": "Current status of the TWAP order (e.g., finished, activated, terminated, error)." + }, + "twapId": { + "type": "integer", + "description": "ID of the TWAP order." + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_info/info_user_borrow_lend_interest.json b/openapi/hyperliquid_node_api/hypercore_info/info_user_borrow_lend_interest.json new file mode 100644 index 00000000..27de1f9e --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_info/info_user_borrow_lend_interest.json @@ -0,0 +1,87 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Node API", + "version": "1.0.0", + "description": "This is an API for interacting with Chainstack Hyperliquid node." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/info": { + "post": { + "tags": [ + "hyperliquid operations" + ], + "summary": "info (userBorrowLendInterest)", + "operationId": "infoUserBorrowLendInterest", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Request type", + "default": "userBorrowLendInterest", + "enum": [ + "userBorrowLendInterest" + ] + }, + "user": { + "type": "string", + "description": "User address in 42-character hexadecimal format.", + "default": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568" + } + }, + "required": [ + "type", + "user" + ] + } + } + } + }, + "responses": { + "200": { + "description": "The user's borrow/lend interest accrual records.", + "content": { + "application/json": { + "schema": { + "type": "array", + "description": "Each item is a borrow/lend interest record for a token at a point in time.", + "items": { + "type": "object", + "properties": { + "time": { + "type": "integer", + "description": "Timestamp of the update (ms since epoch)." + }, + "token": { + "type": "string", + "description": "Token symbol (e.g., USDC)." + }, + "borrow": { + "type": "string", + "description": "Borrow interest amount." + }, + "supply": { + "type": "string", + "description": "Supply interest amount." + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_info/info_user_twap_slice_fills_by_time.json b/openapi/hyperliquid_node_api/hypercore_info/info_user_twap_slice_fills_by_time.json new file mode 100644 index 00000000..b17fee59 --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_info/info_user_twap_slice_fills_by_time.json @@ -0,0 +1,79 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Node API", + "version": "1.0.0", + "description": "This is an API for interacting with Chainstack Hyperliquid node." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/info": { + "post": { + "tags": [ + "hyperliquid operations" + ], + "summary": "info (userTwapSliceFillsByTime)", + "operationId": "infoUserTwapSliceFillsByTime", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Request type", + "default": "userTwapSliceFillsByTime", + "enum": [ + "userTwapSliceFillsByTime" + ] + }, + "user": { + "type": "string", + "description": "User address in 42-character hexadecimal format.", + "default": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568" + }, + "startTime": { + "type": "integer", + "description": "Start time in milliseconds since epoch (inclusive).", + "default": 0 + }, + "endTime": { + "type": "integer", + "description": "End time in milliseconds since epoch (inclusive). Optional; defaults to now." + } + }, + "required": [ + "type", + "user", + "startTime" + ] + } + } + } + }, + "responses": { + "200": { + "description": "The user's TWAP slice fills within the time range.", + "content": { + "application/json": { + "schema": { + "type": "array", + "description": "Each item is a TWAP slice fill (a fill record paired with its TWAP order ID).", + "items": { + "type": "object" + } + } + } + } + } + } + } + } + } +} diff --git a/openapi/hyperliquid_node_api/hypercore_info/info_validator_summaries.json b/openapi/hyperliquid_node_api/hypercore_info/info_validator_summaries.json new file mode 100644 index 00000000..4b7005f1 --- /dev/null +++ b/openapi/hyperliquid_node_api/hypercore_info/info_validator_summaries.json @@ -0,0 +1,102 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Hyperliquid Node API", + "version": "1.0.0", + "description": "This is an API for interacting with Chainstack Hyperliquid node." + }, + "servers": [ + { + "url": "https://api.hyperliquid.xyz" + } + ], + "paths": { + "/info": { + "post": { + "tags": [ + "hyperliquid operations" + ], + "summary": "info (validatorSummaries)", + "operationId": "infoValidatorSummaries", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Request type", + "default": "validatorSummaries", + "enum": [ + "validatorSummaries" + ] + } + }, + "required": [ + "type" + ] + } + } + } + }, + "responses": { + "200": { + "description": "Summaries for all validators (stake, status, commission, uptime, and APR stats).", + "content": { + "application/json": { + "schema": { + "type": "array", + "description": "Each item summarizes one validator.", + "items": { + "type": "object", + "properties": { + "validator": { + "type": "string", + "description": "Validator address." + }, + "signer": { + "type": "string", + "description": "Validator signer address." + }, + "name": { + "type": "string", + "description": "Validator name." + }, + "description": { + "type": "string", + "description": "Validator description." + }, + "stake": { + "type": "integer", + "description": "Total stake delegated to the validator (in wei)." + }, + "isJailed": { + "type": "boolean", + "description": "Whether the validator is jailed." + }, + "isActive": { + "type": "boolean", + "description": "Whether the validator is active." + }, + "commission": { + "type": "string", + "description": "Validator commission rate." + }, + "stats": { + "type": "array", + "description": "Per-period uptime and predicted APR stats.", + "items": {} + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/reference/hyperliquid-exchange-borrow-lend.mdx b/reference/hyperliquid-exchange-borrow-lend.mdx new file mode 100644 index 00000000..0ebd303e --- /dev/null +++ b/reference/hyperliquid-exchange-borrow-lend.mdx @@ -0,0 +1,126 @@ +--- +title: Borrow lend | Hyperliquid exchange +openapi: /openapi/hyperliquid_node_api/hypercore_exchange/exchange_borrow_lend.json post /exchange +description: "Supply, withdraw, repay, or borrow a token in Hyperliquid's borrow/lend markets. On Hyperliquid exchange." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + + +This endpoint requires signature authentication. See our comprehensive [Authentication via Signatures guide](/docs/hyperliquid-authentication-guide) for implementation details. + + +The `borrowLend` action supplies, withdraws, repays, or borrows a token in Hyperliquid's borrow/lend markets. Choose the operation with the `operation` field. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Required parameters + +* `action` (object, required) — The borrow/lend action: + * `type` (string) — Must be `"borrowLend"`. + * `operation` (string) — One of `"supply"`, `"withdraw"`, `"repay"`, or `"borrow"`. + * `token` (number) — The token ID. + * `amount` (string or null) — The amount to act on; `null` means the full amount. +* `nonce` (number, required) — Current timestamp in milliseconds. +* `signature` (object, required) — EIP-712 signature of the action. + +### Optional parameters + +* `vaultAddress` (string, optional) — Address when acting on behalf of a vault. +* `expiresAfter` (number, optional) — Timestamp in milliseconds after which the request is rejected. + +## Returns + +Returns an object with the action status: + +* `status` — `"ok"` if the request was processed. +* `response` — Contains operation details, with `type` `"default"`. + +## Example request + + + +```shell cURL +curl -X POST https://api.hyperliquid.xyz/exchange \ + -H "Content-Type: application/json" \ + -d '{ + "action": {"type": "borrowLend", "operation": "supply", "token": 0, "amount": "1"}, + "nonce": 1234567890123, + "signature": {...} + }' +``` + +```python Python (hyperliquid-python-sdk) +# Note: the official hyperliquid-python-sdk does not expose a borrowLend helper +# yet, so build and post the signed action directly. +from hyperliquid.exchange import Exchange +from hyperliquid.utils import constants +from hyperliquid.utils.signing import sign_l1_action, get_timestamp_ms +import eth_account + +# Public Hyperliquid mainnet endpoint +wallet = eth_account.Account.from_key("0x...") # your private key +exchange = Exchange(wallet, constants.MAINNET_API_URL) + +timestamp = get_timestamp_ms() +action = {"type": "borrowLend", "operation": "supply", "token": 0, "amount": "1"} +signature = sign_l1_action( + wallet, + action, + None, # vault_address + timestamp, + None, # expires_after + exchange.base_url == constants.MAINNET_API_URL, +) +result = exchange._post_action(action, signature, timestamp) +print(result) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid"; +import { privateKeyToAccount } from "viem/accounts"; + +// Public Hyperliquid mainnet endpoint (default transport) +const wallet = privateKeyToAccount("0x..."); // viem or ethers account +const transport = new HttpTransport(); +const exchange = new ExchangeClient({ transport, wallet }); + +const result = await exchange.borrowLend({ + operation: "supply", // "supply" | "withdraw" | "repay" | "borrow" + token: 0, + amount: "1", +}); + +console.log(result); +``` + + + +## Response example + +```json +{ + "status": "ok", + "response": { + "type": "default" + } +} +``` + +## Use cases + +* **Earn yield** — Supply idle tokens to the borrow/lend markets +* **Access leverage** — Borrow against supplied collateral +* **Manage positions** — Repay borrows or withdraw supplied balances diff --git a/reference/hyperliquid-exchange-create-vault.mdx b/reference/hyperliquid-exchange-create-vault.mdx new file mode 100644 index 00000000..ffbc32f1 --- /dev/null +++ b/reference/hyperliquid-exchange-create-vault.mdx @@ -0,0 +1,139 @@ +--- +title: Create vault | Hyperliquid exchange +openapi: /openapi/hyperliquid_node_api/hypercore_exchange/exchange_create_vault.json post /exchange +description: "Create a new vault on Hyperliquid. Returns the new vault address. On Hyperliquid exchange." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + + +This endpoint requires signature authentication. See our comprehensive [Authentication via Signatures guide](/docs/hyperliquid-authentication-guide) for implementation details. + + +The `createVault` action creates a new vault. On success the response includes the address of the newly created vault. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Required parameters + +* `action` (object, required) — The create-vault action: + * `type` (string) — Must be `"createVault"`. + * `name` (string) — Vault name (3-50 characters). + * `description` (string) — Vault description (10-250 characters). + * `initialUsd` (number) — Initial balance as a USD float multiplied by 1e6 (minimum 100 USD, i.e. `100000000`). + * `nonce` (number) — Timestamp in milliseconds, equal to the envelope nonce. +* `nonce` (number, required) — Current timestamp in milliseconds. +* `signature` (object, required) — EIP-712 signature of the action. + +### Optional parameters + +* `expiresAfter` (number, optional) — Timestamp in milliseconds after which the request is rejected. + +## Returns + +Returns an object with the action status: + +* `status` — `"ok"` if the request was processed. +* `response` — Contains `type` `"createVault"` and `data`, the address of the new vault. + +## Example request + + + +```shell cURL +curl -X POST https://api.hyperliquid.xyz/exchange \ + -H "Content-Type: application/json" \ + -d '{ + "action": { + "type": "createVault", + "name": "My vault", + "description": "A vault for copy trading", + "initialUsd": 100000000, + "nonce": 1234567890123 + }, + "nonce": 1234567890123, + "signature": {...} + }' +``` + +```python Python (hyperliquid-python-sdk) +# Note: the official hyperliquid-python-sdk does not expose a createVault helper +# yet, so build and post the signed action directly. +from hyperliquid.exchange import Exchange +from hyperliquid.utils import constants +from hyperliquid.utils.signing import sign_l1_action, get_timestamp_ms +import eth_account + +# Public Hyperliquid mainnet endpoint +wallet = eth_account.Account.from_key("0x...") # your private key +exchange = Exchange(wallet, constants.MAINNET_API_URL) + +timestamp = get_timestamp_ms() +action = { + "type": "createVault", + "name": "My vault", + "description": "A vault for copy trading", + "initialUsd": 100000000, # 100 USD * 1e6 + "nonce": timestamp, +} +signature = sign_l1_action( + wallet, + action, + None, # vault_address + timestamp, + None, # expires_after + exchange.base_url == constants.MAINNET_API_URL, +) +result = exchange._post_action(action, signature, timestamp) +print(result) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid"; +import { privateKeyToAccount } from "viem/accounts"; + +// Public Hyperliquid mainnet endpoint (default transport) +const wallet = privateKeyToAccount("0x..."); // viem or ethers account +const transport = new HttpTransport(); +const exchange = new ExchangeClient({ transport, wallet }); + +const result = await exchange.createVault({ + name: "My vault", + description: "A vault for copy trading", + initialUsd: 100000000, // 100 USD * 1e6 +}); + +console.log(result); // response.data is the new vault address +``` + + + +## Response example + +```json +{ + "status": "ok", + "response": { + "type": "createVault", + "data": "0x1719884eb866cb12b2287399b15f7db5e7d775ea" + } +} +``` + +## Use cases + +* **Launch a vault** — Open a vault others can deposit into and follow +* **Copy trading** — Let depositors mirror your strategy +* **Capital pooling** — Aggregate capital under a single managed account diff --git a/reference/hyperliquid-exchange-finalize-evm-contract.mdx b/reference/hyperliquid-exchange-finalize-evm-contract.mdx new file mode 100644 index 00000000..b6b81d5e --- /dev/null +++ b/reference/hyperliquid-exchange-finalize-evm-contract.mdx @@ -0,0 +1,130 @@ +--- +title: Finalize EVM contract | Hyperliquid exchange +openapi: /openapi/hyperliquid_node_api/hypercore_exchange/exchange_finalize_evm_contract.json post /exchange +description: "Finalize the link between a HyperCore token and its HyperEVM contract. On Hyperliquid exchange." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + + +This endpoint requires signature authentication. See our comprehensive [Authentication via Signatures guide](/docs/hyperliquid-authentication-guide) for implementation details. + + +The `finalizeEvmContract` action finalizes the link between a HyperCore token and its HyperEVM contract, using a verification method that matches how the contract was deployed. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Required parameters + +* `action` (object, required) — The finalize-EVM-contract action: + * `type` (string) — Must be `"finalizeEvmContract"`. + * `token` (number) — The token identifier to link. + * `input` — The verification method, one of: + * `{ "create": { "nonce": } }` — for a contract deployed from an EOA; uses the EVM deployment nonce. + * `"firstStorageSlot"` — the finalizer address is stored at the contract's first storage slot. + * `"customStorageSlot"` — the finalizer address is stored at slot `keccak256("HyperCore deployer")`. +* `nonce` (number, required) — Current timestamp in milliseconds. +* `signature` (object, required) — EIP-712 signature of the action. + +### Optional parameters + +* `expiresAfter` (number, optional) — Timestamp in milliseconds after which the request is rejected. + +## Returns + +Returns an object with the action status: + +* `status` — `"ok"` if the request was processed. +* `response` — Contains operation details, with `type` `"default"`. + +## Example request + + + +```shell cURL +curl -X POST https://api.hyperliquid.xyz/exchange \ + -H "Content-Type: application/json" \ + -d '{ + "action": {"type": "finalizeEvmContract", "token": 0, "input": "firstStorageSlot"}, + "nonce": 1234567890123, + "signature": {...} + }' +``` + +```python Python (hyperliquid-python-sdk) +# Note: the official hyperliquid-python-sdk does not expose a finalizeEvmContract +# helper yet, so build and post the signed action directly. +from hyperliquid.exchange import Exchange +from hyperliquid.utils import constants +from hyperliquid.utils.signing import sign_l1_action, get_timestamp_ms +import eth_account + +# Public Hyperliquid mainnet endpoint +wallet = eth_account.Account.from_key("0x...") # your private key +exchange = Exchange(wallet, constants.MAINNET_API_URL) + +timestamp = get_timestamp_ms() +action = { + "type": "finalizeEvmContract", + "token": 0, + "input": "firstStorageSlot", # or "customStorageSlot", or {"create": {"nonce": 0}} +} +signature = sign_l1_action( + wallet, + action, + None, # vault_address + timestamp, + None, # expires_after + exchange.base_url == constants.MAINNET_API_URL, +) +result = exchange._post_action(action, signature, timestamp) +print(result) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid"; +import { privateKeyToAccount } from "viem/accounts"; + +// Public Hyperliquid mainnet endpoint (default transport) +const wallet = privateKeyToAccount("0x..."); // viem or ethers account +const transport = new HttpTransport(); +const exchange = new ExchangeClient({ transport, wallet }); + +const result = await exchange.finalizeEvmContract({ + token: 0, + input: "firstStorageSlot", // or "customStorageSlot", or { create: { nonce: 0 } } +}); + +console.log(result); +``` + + + +## Response example + +```json +{ + "status": "ok", + "response": { + "type": "default" + } +} +``` + +## Use cases + +* **Link a token to its EVM contract** — Complete HyperCore/HyperEVM token linkage +* **Token deployment tooling** — Finalize contracts as part of a deploy pipeline +* **Verify deployment ownership** — Prove control via deploy nonce or storage slot diff --git a/reference/hyperliquid-exchange-gossip-priority-bid.mdx b/reference/hyperliquid-exchange-gossip-priority-bid.mdx new file mode 100644 index 00000000..04cb1a12 --- /dev/null +++ b/reference/hyperliquid-exchange-gossip-priority-bid.mdx @@ -0,0 +1,113 @@ +--- +title: Gossip priority bid | Hyperliquid exchange +openapi: /openapi/hyperliquid_node_api/hypercore_exchange/exchange_gossip_priority_bid.json post /exchange +description: "Bid in the gossip priority auction to prioritize an IP address for gossip on Hyperliquid. On Hyperliquid exchange." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + + +This endpoint requires signature authentication. See our comprehensive [Authentication via Signatures guide](/docs/hyperliquid-authentication-guide) for implementation details. + + +The `gossipPriorityBid` action places a bid in the gossip priority auction to prioritize an IP address. Lower-indexed slots are strictly prioritized over higher ones. Use [gossipPriorityAuctionStatus](/reference/hyperliquid-info-gossip-priority-auction-status) to read the current auction state. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Required parameters + +* `action` (object, required) — The gossip-priority-bid action: + * `type` (string) — Must be `"gossipPriorityBid"`. + * `slotId` (number) — Auction slot identifier (`0` or `1`). Lower-indexed slots are strictly prioritized. + * `ip` (string) — The IP address (IPv4 or IPv6) to prioritize. Any address may bid on behalf of any IP. + * `maxGas` (number) — Max gas in wei (1 HYPE = 10^8 wei) charged from the spot balance. The minimum auction price is 0.1 HYPE. +* `nonce` (number, required) — Current timestamp in milliseconds. +* `signature` (object, required) — EIP-712 signature of the action. + +### Optional parameters + +* `expiresAfter` (number, optional) — Timestamp in milliseconds after which the request is rejected. + +## Returns + +Returns an object with the action status: + +* `status` — `"ok"` if the request was processed. +* `response` — Contains operation details, with `type` `"default"`. + +## Example request + + + +```shell cURL +curl -X POST https://api.hyperliquid.xyz/exchange \ + -H "Content-Type: application/json" \ + -d '{ + "action": {"type": "gossipPriorityBid", "slotId": 0, "ip": "1.2.3.4", "maxGas": 10000000}, + "nonce": 1234567890123, + "signature": {...} + }' +``` + +```python Python (hyperliquid-python-sdk) +from hyperliquid.exchange import Exchange +from hyperliquid.utils import constants +import eth_account + +# Public Hyperliquid mainnet endpoint +wallet = eth_account.Account.from_key("0x...") # your private key +exchange = Exchange(wallet, constants.MAINNET_API_URL) + +# slot_id is 0 or 1; max_gas is in wei (1 HYPE = 1e8 wei) +result = exchange.gossip_priority_bid(slot_id=0, ip="1.2.3.4", max_gas=10000000) +print(result) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid"; +import { privateKeyToAccount } from "viem/accounts"; + +// Public Hyperliquid mainnet endpoint (default transport) +const wallet = privateKeyToAccount("0x..."); // viem or ethers account +const transport = new HttpTransport(); +const exchange = new ExchangeClient({ transport, wallet }); + +const result = await exchange.gossipPriorityBid({ + slotId: 0, + ip: "1.2.3.4", + maxGas: 10000000, // wei; 1 HYPE = 1e8 wei +}); + +console.log(result); +``` + + + +## Response example + +```json +{ + "status": "ok", + "response": { + "type": "default" + } +} +``` + +## Use cases + +* **Prioritize a node's gossip** — Win a priority slot for a given IP +* **Node operations** — Improve propagation for latency-sensitive infrastructure +* **Auction tooling** — Automate bidding against the current auction status diff --git a/reference/hyperliquid-exchange-link-staking-user.mdx b/reference/hyperliquid-exchange-link-staking-user.mdx new file mode 100644 index 00000000..f34af86d --- /dev/null +++ b/reference/hyperliquid-exchange-link-staking-user.mdx @@ -0,0 +1,143 @@ +--- +title: Link staking user | Hyperliquid exchange +openapi: /openapi/hyperliquid_node_api/hypercore_exchange/exchange_link_staking_user.json post /exchange +description: "Link a staking account and a trading account for fee-discount attribution on Hyperliquid. On Hyperliquid exchange." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + + +This endpoint requires signature authentication. See our comprehensive [Authentication via Signatures guide](/docs/hyperliquid-authentication-guide) for implementation details. + + +The `linkStakingUser` action links a staking account and a trading account so that staking is attributed for fee discounts. The link is a two-step flow: the trading user initiates the request (`isFinalize: false`), then the staking user finalizes the permanent link (`isFinalize: true`). This is a user-signed EIP-712 action. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Required parameters + +* `action` (object, required) — The link-staking-user action: + * `type` (string) — Must be `"linkStakingUser"`. + * `signatureChainId` (string) — Chain ID in hex used for EIP-712 signing. + * `hyperliquidChain` (string) — `"Mainnet"` or `"Testnet"`. + * `user` (string) — Target account address. When the trading user initiates, this is the staking account address; when the staking user finalizes, this is the trading account address. + * `isFinalize` (boolean) — `false` to initiate (trading user), `true` to finalize the permanent link (staking user). + * `nonce` (number) — Timestamp in milliseconds, equal to the envelope nonce. +* `nonce` (number, required) — Current timestamp in milliseconds. +* `signature` (object, required) — EIP-712 signature of the action. + +## Returns + +Returns an object with the action status: + +* `status` — `"ok"` if the request was processed. +* `response` — Contains operation details, with `type` `"default"`. + +## Example request + + + +```shell cURL +curl -X POST https://api.hyperliquid.xyz/exchange \ + -H "Content-Type: application/json" \ + -d '{ + "action": { + "type": "linkStakingUser", + "signatureChainId": "0x66eee", + "hyperliquidChain": "Mainnet", + "user": "0x0000000000000000000000000000000000000000", + "isFinalize": false, + "nonce": 1234567890123 + }, + "nonce": 1234567890123, + "signature": {...} + }' +``` + +```python Python (hyperliquid-python-sdk) +# Note: the official hyperliquid-python-sdk does not expose a linkStakingUser +# helper yet. This is a user-signed (EIP-712) action, so supply its typed-data +# fields and primary type when signing. +from hyperliquid.exchange import Exchange +from hyperliquid.utils import constants +from hyperliquid.utils.signing import sign_user_signed_action, get_timestamp_ms +import eth_account + +# Public Hyperliquid mainnet endpoint +wallet = eth_account.Account.from_key("0x...") # your private key +exchange = Exchange(wallet, constants.MAINNET_API_URL) + +timestamp = get_timestamp_ms() +action = { + "type": "linkStakingUser", + "signatureChainId": "0x66eee", + "hyperliquidChain": "Mainnet", + "user": "0x0000000000000000000000000000000000000000", + "isFinalize": False, + "nonce": timestamp, +} +payload_types = [ + {"name": "hyperliquidChain", "type": "string"}, + {"name": "user", "type": "address"}, + {"name": "isFinalize", "type": "bool"}, + {"name": "nonce", "type": "uint64"}, +] +signature = sign_user_signed_action( + wallet, + action, + payload_types, + "HyperliquidTransaction:LinkStakingUser", + exchange.base_url == constants.MAINNET_API_URL, +) +result = exchange._post_action(action, signature, timestamp) +print(result) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid"; +import { privateKeyToAccount } from "viem/accounts"; + +// Public Hyperliquid mainnet endpoint (default transport) +const wallet = privateKeyToAccount("0x..."); // viem or ethers account +const transport = new HttpTransport(); +const exchange = new ExchangeClient({ transport, wallet }); + +// Trading user initiates the link request +const result = await exchange.linkStakingUser({ + user: "0x0000000000000000000000000000000000000000", + isFinalize: false, +}); + +console.log(result); +``` + + + +## Response example + +```json +{ + "status": "ok", + "response": { + "type": "default" + } +} +``` + +## Use cases + +* **Attribute staking for fee discounts** — Link a staking account to a trading account +* **Separate custody and trading** — Keep staked funds and trading funds in different accounts +* **Two-step linking** — Initiate from the trading user, finalize from the staking user diff --git a/reference/hyperliquid-exchange-register-referrer.mdx b/reference/hyperliquid-exchange-register-referrer.mdx new file mode 100644 index 00000000..d1231cbe --- /dev/null +++ b/reference/hyperliquid-exchange-register-referrer.mdx @@ -0,0 +1,119 @@ +--- +title: Register referrer | Hyperliquid exchange +openapi: /openapi/hyperliquid_node_api/hypercore_exchange/exchange_register_referrer.json post /exchange +description: "Register your own referral code on Hyperliquid so others can sign up under it. On Hyperliquid exchange." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + + +This endpoint requires signature authentication. See our comprehensive [Authentication via Signatures guide](/docs/hyperliquid-authentication-guide) for implementation details. + + +The `registerReferrer` action registers your own referral code so other users can sign up under it. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Required parameters + +* `action` (object, required) — The register-referrer action: + * `type` (string) — Must be `"registerReferrer"`. + * `code` (string) — The referral code to create (1-20 characters). +* `nonce` (number, required) — Current timestamp in milliseconds. +* `signature` (object, required) — EIP-712 signature of the action. + +### Optional parameters + +* `expiresAfter` (number, optional) — Timestamp in milliseconds after which the request is rejected. + +## Returns + +Returns an object with the action status: + +* `status` — `"ok"` if the request was processed. +* `response` — Contains operation details, with `type` `"default"`. + +## Example request + + + +```shell cURL +curl -X POST https://api.hyperliquid.xyz/exchange \ + -H "Content-Type: application/json" \ + -d '{ + "action": {"type": "registerReferrer", "code": "CHAINSTACK"}, + "nonce": 1234567890123, + "signature": {...} + }' +``` + +```python Python (hyperliquid-python-sdk) +# Note: the official hyperliquid-python-sdk does not expose a registerReferrer +# helper yet, so build and post the signed action directly. +from hyperliquid.exchange import Exchange +from hyperliquid.utils import constants +from hyperliquid.utils.signing import sign_l1_action, get_timestamp_ms +import eth_account + +# Public Hyperliquid mainnet endpoint +wallet = eth_account.Account.from_key("0x...") # your private key +exchange = Exchange(wallet, constants.MAINNET_API_URL) + +timestamp = get_timestamp_ms() +action = {"type": "registerReferrer", "code": "CHAINSTACK"} +signature = sign_l1_action( + wallet, + action, + None, # vault_address + timestamp, + None, # expires_after + exchange.base_url == constants.MAINNET_API_URL, +) +result = exchange._post_action(action, signature, timestamp) +print(result) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid"; +import { privateKeyToAccount } from "viem/accounts"; + +// Public Hyperliquid mainnet endpoint (default transport) +const wallet = privateKeyToAccount("0x..."); // viem or ethers account +const transport = new HttpTransport(); +const exchange = new ExchangeClient({ transport, wallet }); + +const result = await exchange.registerReferrer({ code: "CHAINSTACK" }); + +console.log(result); +``` + + + +## Response example + +```json +{ + "status": "ok", + "response": { + "type": "default" + } +} +``` + +## Use cases + +* **Run a referral program** — Create a code to share with new users +* **Track attribution** — Attribute sign-ups to your code +* **Grow your network** — Earn referral rewards from referred activity diff --git a/reference/hyperliquid-exchange-set-display-name.mdx b/reference/hyperliquid-exchange-set-display-name.mdx new file mode 100644 index 00000000..5527695f --- /dev/null +++ b/reference/hyperliquid-exchange-set-display-name.mdx @@ -0,0 +1,119 @@ +--- +title: Set display name | Hyperliquid exchange +openapi: /openapi/hyperliquid_node_api/hypercore_exchange/exchange_set_display_name.json post /exchange +description: "Set or clear your account display name on Hyperliquid (for leaderboards and social features). On Hyperliquid exchange." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + + +This endpoint requires signature authentication. See our comprehensive [Authentication via Signatures guide](/docs/hyperliquid-authentication-guide) for implementation details. + + +The `setDisplayName` action sets your account's display name, used in leaderboards and social features. Set an empty string to remove the display name. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Required parameters + +* `action` (object, required) — The set-display-name action: + * `type` (string) — Must be `"setDisplayName"`. + * `displayName` (string) — The display name (max 20 characters). An empty string removes it. +* `nonce` (number, required) — Current timestamp in milliseconds. +* `signature` (object, required) — EIP-712 signature of the action. + +### Optional parameters + +* `expiresAfter` (number, optional) — Timestamp in milliseconds after which the request is rejected. + +## Returns + +Returns an object with the action status: + +* `status` — `"ok"` if the request was processed. +* `response` — Contains operation details, with `type` `"default"`. + +## Example request + + + +```shell cURL +curl -X POST https://api.hyperliquid.xyz/exchange \ + -H "Content-Type: application/json" \ + -d '{ + "action": {"type": "setDisplayName", "displayName": "satoshi"}, + "nonce": 1234567890123, + "signature": {...} + }' +``` + +```python Python (hyperliquid-python-sdk) +# Note: the official hyperliquid-python-sdk does not expose a setDisplayName +# helper yet, so build and post the signed action directly. +from hyperliquid.exchange import Exchange +from hyperliquid.utils import constants +from hyperliquid.utils.signing import sign_l1_action, get_timestamp_ms +import eth_account + +# Public Hyperliquid mainnet endpoint +wallet = eth_account.Account.from_key("0x...") # your private key +exchange = Exchange(wallet, constants.MAINNET_API_URL) + +timestamp = get_timestamp_ms() +action = {"type": "setDisplayName", "displayName": "satoshi"} +signature = sign_l1_action( + wallet, + action, + None, # vault_address + timestamp, + None, # expires_after + exchange.base_url == constants.MAINNET_API_URL, +) +result = exchange._post_action(action, signature, timestamp) +print(result) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid"; +import { privateKeyToAccount } from "viem/accounts"; + +// Public Hyperliquid mainnet endpoint (default transport) +const wallet = privateKeyToAccount("0x..."); // viem or ethers account +const transport = new HttpTransport(); +const exchange = new ExchangeClient({ transport, wallet }); + +const result = await exchange.setDisplayName({ displayName: "satoshi" }); + +console.log(result); +``` + + + +## Response example + +```json +{ + "status": "ok", + "response": { + "type": "default" + } +} +``` + +## Use cases + +* **Personalize your account** — Show a name on leaderboards +* **Social features** — Make your account recognizable +* **Clear your name** — Send an empty string to remove the display name diff --git a/reference/hyperliquid-exchange-staking-link-disable-trading-user.mdx b/reference/hyperliquid-exchange-staking-link-disable-trading-user.mdx new file mode 100644 index 00000000..3c8d2b76 --- /dev/null +++ b/reference/hyperliquid-exchange-staking-link-disable-trading-user.mdx @@ -0,0 +1,141 @@ +--- +title: Staking link disable trading user | Hyperliquid exchange +openapi: /openapi/hyperliquid_node_api/hypercore_exchange/exchange_staking_link_disable_trading_user.json post /exchange +description: "Permanently disable a linked trading user from the staking side on Hyperliquid. This action is irreversible. On Hyperliquid exchange." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + + +This endpoint requires signature authentication. See our comprehensive [Authentication via Signatures guide](/docs/hyperliquid-authentication-guide) for implementation details. + + +The `stakingLinkDisableTradingUser` action is sent by the staking user to permanently disable a linked trading user, locking its funds. After one year of locking, the trading user's funds are automatically transferred to the staking user. This is a user-signed EIP-712 action. + + +This action is irreversible. It permanently disables the linked trading user and locks its funds. + + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Required parameters + +* `action` (object, required) — The disable-trading-user action: + * `type` (string) — Must be `"stakingLinkDisableTradingUser"`. + * `signatureChainId` (string) — Chain ID in hex used for EIP-712 signing. + * `hyperliquidChain` (string) — `"Mainnet"` or `"Testnet"`. + * `tradingUser` (string) — The trading user address to disable. + * `nonce` (number) — Timestamp in milliseconds, equal to the envelope nonce. +* `nonce` (number, required) — Current timestamp in milliseconds. +* `signature` (object, required) — EIP-712 signature of the action. + +## Returns + +Returns an object with the action status: + +* `status` — `"ok"` if the request was processed. +* `response` — Contains operation details, with `type` `"default"`. + +## Example request + + + +```shell cURL +curl -X POST https://api.hyperliquid.xyz/exchange \ + -H "Content-Type: application/json" \ + -d '{ + "action": { + "type": "stakingLinkDisableTradingUser", + "signatureChainId": "0x66eee", + "hyperliquidChain": "Mainnet", + "tradingUser": "0x0000000000000000000000000000000000000000", + "nonce": 1234567890123 + }, + "nonce": 1234567890123, + "signature": {...} + }' +``` + +```python Python (hyperliquid-python-sdk) +# Note: the official hyperliquid-python-sdk does not expose a +# stakingLinkDisableTradingUser helper yet. This is a user-signed (EIP-712) +# action, so supply its typed-data fields and primary type when signing. +from hyperliquid.exchange import Exchange +from hyperliquid.utils import constants +from hyperliquid.utils.signing import sign_user_signed_action, get_timestamp_ms +import eth_account + +# Public Hyperliquid mainnet endpoint +wallet = eth_account.Account.from_key("0x...") # your private key +exchange = Exchange(wallet, constants.MAINNET_API_URL) + +timestamp = get_timestamp_ms() +action = { + "type": "stakingLinkDisableTradingUser", + "signatureChainId": "0x66eee", + "hyperliquidChain": "Mainnet", + "tradingUser": "0x0000000000000000000000000000000000000000", + "nonce": timestamp, +} +payload_types = [ + {"name": "hyperliquidChain", "type": "string"}, + {"name": "tradingUser", "type": "address"}, + {"name": "nonce", "type": "uint64"}, +] +signature = sign_user_signed_action( + wallet, + action, + payload_types, + "HyperliquidTransaction:StakingLinkDisableTradingUser", + exchange.base_url == constants.MAINNET_API_URL, +) +result = exchange._post_action(action, signature, timestamp) +print(result) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid"; +import { privateKeyToAccount } from "viem/accounts"; + +// Public Hyperliquid mainnet endpoint (default transport) +const wallet = privateKeyToAccount("0x..."); // viem or ethers account +const transport = new HttpTransport(); +const exchange = new ExchangeClient({ transport, wallet }); + +const result = await exchange.stakingLinkDisableTradingUser({ + tradingUser: "0x0000000000000000000000000000000000000000", +}); + +console.log(result); +``` + + + +## Response example + +```json +{ + "status": "ok", + "response": { + "type": "default" + } +} +``` + +## Use cases + +* **Revoke a trading link** — Permanently disable a linked trading user +* **Secure staked funds** — Lock and eventually reclaim a trading user's funds +* **Account lifecycle** — Wind down a delegated trading relationship diff --git a/reference/hyperliquid-exchange-sub-account-modify.mdx b/reference/hyperliquid-exchange-sub-account-modify.mdx new file mode 100644 index 00000000..c97ee3f6 --- /dev/null +++ b/reference/hyperliquid-exchange-sub-account-modify.mdx @@ -0,0 +1,131 @@ +--- +title: Sub-account modify | Hyperliquid exchange +openapi: /openapi/hyperliquid_node_api/hypercore_exchange/exchange_sub_account_modify.json post /exchange +description: "Rename a sub-account under your master account on Hyperliquid. On Hyperliquid exchange." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + + +This endpoint requires signature authentication. See our comprehensive [Authentication via Signatures guide](/docs/hyperliquid-authentication-guide) for implementation details. + + +The `subAccountModify` action renames a sub-account under your master account. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Required parameters + +* `action` (object, required) — The sub-account-modify action: + * `type` (string) — Must be `"subAccountModify"`. + * `subAccountUser` (string) — The sub-account address to modify. + * `name` (string) — The new sub-account name (1-16 characters). +* `nonce` (number, required) — Current timestamp in milliseconds. +* `signature` (object, required) — EIP-712 signature of the action. + +### Optional parameters + +* `expiresAfter` (number, optional) — Timestamp in milliseconds after which the request is rejected. + +## Returns + +Returns an object with the action status: + +* `status` — `"ok"` if the request was processed. +* `response` — Contains operation details, with `type` `"default"`. + +## Example request + + + +```shell cURL +curl -X POST https://api.hyperliquid.xyz/exchange \ + -H "Content-Type: application/json" \ + -d '{ + "action": { + "type": "subAccountModify", + "subAccountUser": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", + "name": "Strategy A" + }, + "nonce": 1234567890123, + "signature": {...} + }' +``` + +```python Python (hyperliquid-python-sdk) +# Note: the official hyperliquid-python-sdk does not expose a subAccountModify +# helper yet, so build and post the signed action directly. +from hyperliquid.exchange import Exchange +from hyperliquid.utils import constants +from hyperliquid.utils.signing import sign_l1_action, get_timestamp_ms +import eth_account + +# Public Hyperliquid mainnet endpoint +wallet = eth_account.Account.from_key("0x...") # your private key +exchange = Exchange(wallet, constants.MAINNET_API_URL) + +timestamp = get_timestamp_ms() +action = { + "type": "subAccountModify", + "subAccountUser": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", + "name": "Strategy A", +} +signature = sign_l1_action( + wallet, + action, + None, # vault_address + timestamp, + None, # expires_after + exchange.base_url == constants.MAINNET_API_URL, +) +result = exchange._post_action(action, signature, timestamp) +print(result) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid"; +import { privateKeyToAccount } from "viem/accounts"; + +// Public Hyperliquid mainnet endpoint (default transport) +const wallet = privateKeyToAccount("0x..."); // viem or ethers account +const transport = new HttpTransport(); +const exchange = new ExchangeClient({ transport, wallet }); + +const result = await exchange.subAccountModify({ + subAccountUser: "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", + name: "Strategy A", +}); + +console.log(result); +``` + + + +## Response example + +```json +{ + "status": "ok", + "response": { + "type": "default" + } +} +``` + +## Use cases + +* **Organize sub-accounts** — Give sub-accounts meaningful names +* **Strategy labeling** — Name sub-accounts by strategy or desk +* **Account management** — Maintain a clear sub-account structure diff --git a/reference/hyperliquid-exchange-user-portfolio-margin.mdx b/reference/hyperliquid-exchange-user-portfolio-margin.mdx new file mode 100644 index 00000000..f7e67164 --- /dev/null +++ b/reference/hyperliquid-exchange-user-portfolio-margin.mdx @@ -0,0 +1,142 @@ +--- +title: User portfolio margin | Hyperliquid exchange +openapi: /openapi/hyperliquid_node_api/hypercore_exchange/exchange_user_portfolio_margin.json post /exchange +description: "Enable or disable portfolio margin for a Hyperliquid account. On Hyperliquid exchange." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + + +This endpoint requires signature authentication. See our comprehensive [Authentication via Signatures guide](/docs/hyperliquid-authentication-guide) for implementation details. + + +The `userPortfolioMargin` action enables or disables portfolio margin for an account. This is a user-signed EIP-712 action. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Required parameters + +* `action` (object, required) — The portfolio-margin action: + * `type` (string) — Must be `"userPortfolioMargin"`. + * `signatureChainId` (string) — Chain ID in hex used for EIP-712 signing. + * `hyperliquidChain` (string) — `"Mainnet"` or `"Testnet"`. + * `user` (string) — The user address. + * `enabled` (boolean) — `true` to enable portfolio margin, `false` to disable it. + * `nonce` (number) — Timestamp in milliseconds, equal to the envelope nonce. +* `nonce` (number, required) — Current timestamp in milliseconds. +* `signature` (object, required) — EIP-712 signature of the action. + +## Returns + +Returns an object with the action status: + +* `status` — `"ok"` if the request was processed. +* `response` — Contains operation details, with `type` `"default"`. + +## Example request + + + +```shell cURL +curl -X POST https://api.hyperliquid.xyz/exchange \ + -H "Content-Type: application/json" \ + -d '{ + "action": { + "type": "userPortfolioMargin", + "signatureChainId": "0x66eee", + "hyperliquidChain": "Mainnet", + "user": "0x0000000000000000000000000000000000000000", + "enabled": true, + "nonce": 1234567890123 + }, + "nonce": 1234567890123, + "signature": {...} + }' +``` + +```python Python (hyperliquid-python-sdk) +# Note: the official hyperliquid-python-sdk does not expose a userPortfolioMargin +# helper yet. This is a user-signed (EIP-712) action, so supply its typed-data +# fields and primary type when signing. +from hyperliquid.exchange import Exchange +from hyperliquid.utils import constants +from hyperliquid.utils.signing import sign_user_signed_action, get_timestamp_ms +import eth_account + +# Public Hyperliquid mainnet endpoint +wallet = eth_account.Account.from_key("0x...") # your private key +exchange = Exchange(wallet, constants.MAINNET_API_URL) + +timestamp = get_timestamp_ms() +action = { + "type": "userPortfolioMargin", + "signatureChainId": "0x66eee", + "hyperliquidChain": "Mainnet", + "user": "0x0000000000000000000000000000000000000000", + "enabled": True, + "nonce": timestamp, +} +payload_types = [ + {"name": "hyperliquidChain", "type": "string"}, + {"name": "user", "type": "address"}, + {"name": "enabled", "type": "bool"}, + {"name": "nonce", "type": "uint64"}, +] +signature = sign_user_signed_action( + wallet, + action, + payload_types, + "HyperliquidTransaction:UserPortfolioMargin", + exchange.base_url == constants.MAINNET_API_URL, +) +result = exchange._post_action(action, signature, timestamp) +print(result) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid"; +import { privateKeyToAccount } from "viem/accounts"; + +// Public Hyperliquid mainnet endpoint (default transport) +const wallet = privateKeyToAccount("0x..."); // viem or ethers account +const transport = new HttpTransport(); +const exchange = new ExchangeClient({ transport, wallet }); + +const result = await exchange.userPortfolioMargin({ + user: "0x0000000000000000000000000000000000000000", + enabled: true, +}); + +console.log(result); +``` + + + +## Response example + +```json +{ + "status": "ok", + "response": { + "type": "default" + } +} +``` + +## Use cases + +* **Enable portfolio margin** — Margin across the whole portfolio rather than per-position +* **Toggle margin mode** — Switch portfolio margin on or off +* **Capital efficiency** — Optimize margin usage for diversified portfolios diff --git a/reference/hyperliquid-exchange-vault-distribute.mdx b/reference/hyperliquid-exchange-vault-distribute.mdx new file mode 100644 index 00000000..3804da16 --- /dev/null +++ b/reference/hyperliquid-exchange-vault-distribute.mdx @@ -0,0 +1,131 @@ +--- +title: Vault distribute | Hyperliquid exchange +openapi: /openapi/hyperliquid_node_api/hypercore_exchange/exchange_vault_distribute.json post /exchange +description: "Distribute funds from a vault to its depositors, or close the vault by distributing zero. On Hyperliquid exchange." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + + +This endpoint requires signature authentication. See our comprehensive [Authentication via Signatures guide](/docs/hyperliquid-authentication-guide) for implementation details. + + +The `vaultDistribute` action distributes funds from a vault to its depositors. Setting `usd` to `0` closes the vault. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Required parameters + +* `action` (object, required) — The vault-distribute action: + * `type` (string) — Must be `"vaultDistribute"`. + * `vaultAddress` (string) — The vault address. + * `usd` (number) — Amount to distribute as a USD float multiplied by 1e6. Set to `0` to close the vault. +* `nonce` (number, required) — Current timestamp in milliseconds. +* `signature` (object, required) — EIP-712 signature of the action. + +### Optional parameters + +* `expiresAfter` (number, optional) — Timestamp in milliseconds after which the request is rejected. + +## Returns + +Returns an object with the action status: + +* `status` — `"ok"` if the request was processed. +* `response` — Contains operation details, with `type` `"default"`. + +## Example request + + + +```shell cURL +curl -X POST https://api.hyperliquid.xyz/exchange \ + -H "Content-Type: application/json" \ + -d '{ + "action": { + "type": "vaultDistribute", + "vaultAddress": "0x1719884eb866cb12b2287399b15f7db5e7d775ea", + "usd": 1000000 + }, + "nonce": 1234567890123, + "signature": {...} + }' +``` + +```python Python (hyperliquid-python-sdk) +# Note: the official hyperliquid-python-sdk does not expose a vaultDistribute +# helper yet, so build and post the signed action directly. +from hyperliquid.exchange import Exchange +from hyperliquid.utils import constants +from hyperliquid.utils.signing import sign_l1_action, get_timestamp_ms +import eth_account + +# Public Hyperliquid mainnet endpoint +wallet = eth_account.Account.from_key("0x...") # your private key +exchange = Exchange(wallet, constants.MAINNET_API_URL) + +timestamp = get_timestamp_ms() +action = { + "type": "vaultDistribute", + "vaultAddress": "0x1719884eb866cb12b2287399b15f7db5e7d775ea", + "usd": 1000000, # 1 USD * 1e6; use 0 to close the vault +} +signature = sign_l1_action( + wallet, + action, + None, # vault_address + timestamp, + None, # expires_after + exchange.base_url == constants.MAINNET_API_URL, +) +result = exchange._post_action(action, signature, timestamp) +print(result) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid"; +import { privateKeyToAccount } from "viem/accounts"; + +// Public Hyperliquid mainnet endpoint (default transport) +const wallet = privateKeyToAccount("0x..."); // viem or ethers account +const transport = new HttpTransport(); +const exchange = new ExchangeClient({ transport, wallet }); + +const result = await exchange.vaultDistribute({ + vaultAddress: "0x1719884eb866cb12b2287399b15f7db5e7d775ea", + usd: 1000000, // 1 USD * 1e6; use 0 to close the vault +}); + +console.log(result); +``` + + + +## Response example + +```json +{ + "status": "ok", + "response": { + "type": "default" + } +} +``` + +## Use cases + +* **Return profits** — Distribute gains to vault depositors +* **Wind down** — Close a vault by distributing zero +* **Vault administration** — Manage payouts as a vault leader diff --git a/reference/hyperliquid-exchange-vault-modify.mdx b/reference/hyperliquid-exchange-vault-modify.mdx new file mode 100644 index 00000000..951db29c --- /dev/null +++ b/reference/hyperliquid-exchange-vault-modify.mdx @@ -0,0 +1,135 @@ +--- +title: Vault modify | Hyperliquid exchange +openapi: /openapi/hyperliquid_node_api/hypercore_exchange/exchange_vault_modify.json post /exchange +description: "Modify a vault's settings — whether it accepts deposits and whether it always closes positions on withdrawal. On Hyperliquid exchange." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + + +This endpoint requires signature authentication. See our comprehensive [Authentication via Signatures guide](/docs/hyperliquid-authentication-guide) for implementation details. + + +The `vaultModify` action updates a vault's settings — whether it accepts deposits from followers and whether it always closes positions on withdrawal. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Required parameters + +* `action` (object, required) — The vault-modify action: + * `type` (string) — Must be `"vaultModify"`. + * `vaultAddress` (string) — The vault address to modify. + * `allowDeposits` (boolean or null) — Allow deposits from followers; `null` leaves it unchanged. + * `alwaysCloseOnWithdraw` (boolean or null) — Always close positions on withdrawal; `null` leaves it unchanged. +* `nonce` (number, required) — Current timestamp in milliseconds. +* `signature` (object, required) — EIP-712 signature of the action. + +### Optional parameters + +* `expiresAfter` (number, optional) — Timestamp in milliseconds after which the request is rejected. + +## Returns + +Returns an object with the action status: + +* `status` — `"ok"` if the request was processed. +* `response` — Contains operation details, with `type` `"default"`. + +## Example request + + + +```shell cURL +curl -X POST https://api.hyperliquid.xyz/exchange \ + -H "Content-Type: application/json" \ + -d '{ + "action": { + "type": "vaultModify", + "vaultAddress": "0x1719884eb866cb12b2287399b15f7db5e7d775ea", + "allowDeposits": true, + "alwaysCloseOnWithdraw": false + }, + "nonce": 1234567890123, + "signature": {...} + }' +``` + +```python Python (hyperliquid-python-sdk) +# Note: the official hyperliquid-python-sdk does not expose a vaultModify helper +# yet, so build and post the signed action directly. +from hyperliquid.exchange import Exchange +from hyperliquid.utils import constants +from hyperliquid.utils.signing import sign_l1_action, get_timestamp_ms +import eth_account + +# Public Hyperliquid mainnet endpoint +wallet = eth_account.Account.from_key("0x...") # your private key +exchange = Exchange(wallet, constants.MAINNET_API_URL) + +timestamp = get_timestamp_ms() +action = { + "type": "vaultModify", + "vaultAddress": "0x1719884eb866cb12b2287399b15f7db5e7d775ea", + "allowDeposits": True, + "alwaysCloseOnWithdraw": False, +} +signature = sign_l1_action( + wallet, + action, + None, # vault_address + timestamp, + None, # expires_after + exchange.base_url == constants.MAINNET_API_URL, +) +result = exchange._post_action(action, signature, timestamp) +print(result) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid"; +import { privateKeyToAccount } from "viem/accounts"; + +// Public Hyperliquid mainnet endpoint (default transport) +const wallet = privateKeyToAccount("0x..."); // viem or ethers account +const transport = new HttpTransport(); +const exchange = new ExchangeClient({ transport, wallet }); + +const result = await exchange.vaultModify({ + vaultAddress: "0x1719884eb866cb12b2287399b15f7db5e7d775ea", + allowDeposits: true, + alwaysCloseOnWithdraw: false, +}); + +console.log(result); +``` + + + +## Response example + +```json +{ + "status": "ok", + "response": { + "type": "default" + } +} +``` + +## Use cases + +* **Open or close to deposits** — Control whether followers can deposit +* **Set withdrawal behavior** — Toggle always-close-on-withdraw +* **Vault administration** — Adjust vault policy as a vault leader diff --git a/reference/hyperliquid-info-gossip-priority-auction-status.mdx b/reference/hyperliquid-info-gossip-priority-auction-status.mdx new file mode 100644 index 00000000..ee84d35b --- /dev/null +++ b/reference/hyperliquid-info-gossip-priority-auction-status.mdx @@ -0,0 +1,95 @@ +--- +title: gossipPriorityAuctionStatus | Hyperliquid info +openapi: /openapi/hyperliquid_node_api/hypercore_info/info_gossip_priority_auction_status.json post /4f8d8f4040bdacd1577bff8058438274/info +description: "The info endpoint with type: \"gossipPriorityAuctionStatus\" returns the current gossip priority auction status — prioritized IPs and the active per-slot auctions." +--- + + +This method is available on Chainstack. Not all Hyperliquid methods are available on Chainstack, as the open-source node implementation does not support them yet — see [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + +The `info` endpoint with `type: "gossipPriorityAuctionStatus"` returns the current status of the gossip priority auction — the IP addresses currently prioritized for gossip, and the active per-slot auctions with their gas pricing. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Request body + +* `type` (string, required) — The request type. Must be `"gossipPriorityAuctionStatus"`. + +## Response + +Returns a two-element array: the list of currently prioritized IP addresses, followed by the list of active per-slot auctions. Each auction includes `startTimeSeconds`, `durationSeconds`, `startGas`, `currentGas`, and `endGas`. + +## Example request + + + +```shell Shell +curl -X POST \ + -H "Content-Type: application/json" \ + -d '{"type": "gossipPriorityAuctionStatus"}' \ + https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/info +``` + +```python Python (hyperliquid-python-sdk) +from hyperliquid.info import Info + +# skip_ws=True avoids opening a WebSocket connection for this REST call +info = Info("YOUR_CHAINSTACK_ENDPOINT", skip_ws=True) + +# The SDK has no dedicated gossipPriorityAuctionStatus helper, so post the request directly. +status = info.post("/info", {"type": "gossipPriorityAuctionStatus"}) +print(status) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { HttpTransport, InfoClient } from "@nktkas/hyperliquid"; + +// apiUrl points the transport at a custom server (your Chainstack endpoint) +const transport = new HttpTransport({ apiUrl: "YOUR_CHAINSTACK_ENDPOINT" }); +const info = new InfoClient({ transport }); + +const status = await info.gossipPriorityAuctionStatus(); +console.log(status); +``` + + + + +**Use your own endpoint in your code.** The code examples use a placeholder Chainstack endpoint (YOUR_CHAINSTACK_ENDPOINT) — replace it with your own Hyperliquid node endpoint from the [Chainstack console](https://console.chainstack.com/). The curl above uses a shared public endpoint for quick checks only; do not use it in production. + + +## Example response + +```json +[ + ["54.64.2.87", "18.180.228.50"], + [ + { + "startTimeSeconds": 1782287280, + "durationSeconds": 180, + "startGas": "11.9842756", + "currentGas": "9.30001388", + "endGas": null + } + ] +] +``` + +## Use cases + +The `info` endpoint with `type: "gossipPriorityAuctionStatus"` is useful for: + +* Monitoring the live gossip priority auction and its gas pricing +* Tooling for node operators bidding for gossip priority +* Observing which IP addresses are currently prioritized diff --git a/reference/hyperliquid-info-is-vip.mdx b/reference/hyperliquid-info-is-vip.mdx new file mode 100644 index 00000000..031d5d62 --- /dev/null +++ b/reference/hyperliquid-info-is-vip.mdx @@ -0,0 +1,85 @@ +--- +title: isVip | Hyperliquid info +openapi: /openapi/hyperliquid_node_api/hypercore_info/info_is_vip.json post /info +description: "The info endpoint with type: \"isVip\" returns whether a user currently has VIP status on Hyperliquid." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + +The `info` endpoint with `type: "isVip"` returns whether a user currently has VIP status on Hyperliquid. VIP status affects fee tiers and access to certain features. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Request body + +* `type` (string, required) — The request type. Must be `"isVip"`. +* `user` (string, required) — Address in 42-character hexadecimal format. + +## Response + +Returns a boolean indicating whether the user currently has VIP status (`true`), or `false` otherwise. May be `null` if the status is unknown. + +## Example request + + + +```shell Shell +curl -X POST \ + -H "Content-Type: application/json" \ + -d '{"type": "isVip", "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568"}' \ + https://api.hyperliquid.xyz/info +``` + +```python Python (hyperliquid-python-sdk) +from hyperliquid.info import Info +from hyperliquid.utils import constants + +info = Info(constants.MAINNET_API_URL, skip_ws=True) + +# The SDK has no dedicated isVip helper, so post the request directly. +is_vip = info.post("/info", { + "type": "isVip", + "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", +}) +print(is_vip) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { HttpTransport, InfoClient } from "@nktkas/hyperliquid"; + +const transport = new HttpTransport(); +const info = new InfoClient({ transport }); + +const isVip = await info.isVip({ + user: "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", +}); +console.log(isVip); +``` + + + +## Example response + +```json +false +``` + +## Use cases + +The `info` endpoint with `type: "isVip"` is useful for: + +* Displaying a user's fee tier or VIP badge +* Gating VIP-only features in a frontend +* Analytics on VIP participation diff --git a/reference/hyperliquid-info-legal-check.mdx b/reference/hyperliquid-info-legal-check.mdx new file mode 100644 index 00000000..135bd63f --- /dev/null +++ b/reference/hyperliquid-info-legal-check.mdx @@ -0,0 +1,93 @@ +--- +title: legalCheck | Hyperliquid info +openapi: /openapi/hyperliquid_node_api/hypercore_info/info_legal_check.json post /info +description: "The info endpoint with type: \"legalCheck\" returns a user's legal/compliance status — accepted terms, trading permission, and restrictions." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + +The `info` endpoint with `type: "legalCheck"` returns a user's legal and compliance status — whether they have accepted the terms, whether they are allowed to trade, and any restrictions that apply. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Request body + +* `type` (string, required) — The request type. Must be `"legalCheck"`. +* `user` (string, required) — Address in 42-character hexadecimal format. + +## Response + +Returns a legal-status object: + +* `acceptedTerms` (boolean) — Whether the user has accepted the terms. +* `userAllowed` (boolean) — Whether the user is allowed to trade. +* `restrictions` (string) — A restriction code applied to the user, if any. + +## Example request + + + +```shell Shell +curl -X POST \ + -H "Content-Type: application/json" \ + -d '{"type": "legalCheck", "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568"}' \ + https://api.hyperliquid.xyz/info +``` + +```python Python (hyperliquid-python-sdk) +from hyperliquid.info import Info +from hyperliquid.utils import constants + +info = Info(constants.MAINNET_API_URL, skip_ws=True) + +# The SDK has no dedicated legalCheck helper, so post the request directly. +legal = info.post("/info", { + "type": "legalCheck", + "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", +}) +print(legal) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { HttpTransport, InfoClient } from "@nktkas/hyperliquid"; + +const transport = new HttpTransport(); +const info = new InfoClient({ transport }); + +const legal = await info.legalCheck({ + user: "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", +}); +console.log(legal); +``` + + + +## Example response + +```json +{ + "acceptedTerms": false, + "userAllowed": true, + "restrictions": "o" +} +``` + +## Use cases + +The `info` endpoint with `type: "legalCheck"` is useful for: + +* Compliance gating before allowing trading actions +* Surfacing onboarding steps (for example, accepting terms) +* Displaying any restrictions that apply to a user diff --git a/reference/hyperliquid-info-pre-transfer-check.mdx b/reference/hyperliquid-info-pre-transfer-check.mdx new file mode 100644 index 00000000..360f3878 --- /dev/null +++ b/reference/hyperliquid-info-pre-transfer-check.mdx @@ -0,0 +1,98 @@ +--- +title: preTransferCheck | Hyperliquid info +openapi: /openapi/hyperliquid_node_api/hypercore_info/info_pre_transfer_check.json post /info +description: "The info endpoint with type: \"preTransferCheck\" pre-flights a transfer to a destination — sanction status, whether the destination exists, the fee, and transaction history." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + +The `info` endpoint with `type: "preTransferCheck"` pre-flights a transfer to a destination address. It returns whether the destination is sanctioned, whether it already exists on Hyperliquid, the fee that would apply, and whether the user has previously transacted. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Request body + +* `type` (string, required) — The request type. Must be `"preTransferCheck"`. +* `user` (string, required) — Destination address in 42-character hexadecimal format. +* `source` (string, required) — Source address in 42-character hexadecimal format. + +## Response + +Returns a pre-transfer check object: + +* `isSanctioned` (boolean) — Whether the destination address is sanctioned. +* `userExists` (boolean) — Whether the destination already exists on Hyperliquid. +* `fee` (string) — The transfer fee that would apply. +* `userHasSentTx` (boolean) — Whether the user has previously sent a transaction. + +## Example request + + + +```shell Shell +curl -X POST \ + -H "Content-Type: application/json" \ + -d '{"type": "preTransferCheck", "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", "source": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568"}' \ + https://api.hyperliquid.xyz/info +``` + +```python Python (hyperliquid-python-sdk) +from hyperliquid.info import Info +from hyperliquid.utils import constants + +info = Info(constants.MAINNET_API_URL, skip_ws=True) + +# The SDK has no dedicated preTransferCheck helper, so post the request directly. +check = info.post("/info", { + "type": "preTransferCheck", + "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", + "source": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", +}) +print(check) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { HttpTransport, InfoClient } from "@nktkas/hyperliquid"; + +const transport = new HttpTransport(); +const info = new InfoClient({ transport }); + +const check = await info.preTransferCheck({ + user: "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", + source: "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", +}); +console.log(check); +``` + + + +## Example response + +```json +{ + "isSanctioned": false, + "userExists": true, + "fee": "0.0", + "userHasSentTx": true +} +``` + +## Use cases + +The `info` endpoint with `type: "preTransferCheck"` is useful for: + +* Pre-flighting a transfer before submitting it +* Surfacing the applicable fee to the user before sending +* Sanctions screening of a destination address diff --git a/reference/hyperliquid-info-sub-accounts2.mdx b/reference/hyperliquid-info-sub-accounts2.mdx new file mode 100644 index 00000000..e66c39f4 --- /dev/null +++ b/reference/hyperliquid-info-sub-accounts2.mdx @@ -0,0 +1,98 @@ +--- +title: subAccounts2 | Hyperliquid info +openapi: /openapi/hyperliquid_node_api/hypercore_info/info_sub_accounts2.json post /4f8d8f4040bdacd1577bff8058438274/info +description: "The info endpoint with type: \"subAccounts2\" returns a user's sub-accounts (V2), including each sub-account's per-DEX clearinghouse state and spot state." +--- + + +This method is available on Chainstack. Not all Hyperliquid methods are available on Chainstack, as the open-source node implementation does not support them yet — see [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + +The `info` endpoint with `type: "subAccounts2"` returns the sub-accounts owned by a user (the V2 response), including each sub-account's per-DEX clearinghouse state and spot state. Use it to enumerate and inspect the sub-accounts under a master account. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Request body + +* `type` (string, required) — The request type. Must be `"subAccounts2"`. +* `user` (string, required) — Master account address in 42-character hexadecimal format. + +## Response + +Returns an array of the user's sub-accounts, or `null` if the user has none. Each sub-account contains: + +* `name` (string) — The sub-account name. +* `subAccountUser` (string) — The sub-account address. +* `master` (string) — The master account address. +* `dexToClearinghouseState` (array) — `[dex, state]` tuples mapping each DEX (empty string for the main DEX) to its clearinghouse state. +* `spotState` (object) — The sub-account's spot clearinghouse state. + +## Example request + + + +```shell Shell +curl -X POST \ + -H "Content-Type: application/json" \ + -d '{"type": "subAccounts2", "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568"}' \ + https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/info +``` + +```python Python (hyperliquid-python-sdk) +from hyperliquid.info import Info + +# skip_ws=True avoids opening a WebSocket connection for this REST call +info = Info("YOUR_CHAINSTACK_ENDPOINT", skip_ws=True) + +# The SDK has no dedicated subAccounts2 helper, so post the request directly. +sub_accounts = info.post("/info", { + "type": "subAccounts2", + "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", +}) +print(sub_accounts) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { HttpTransport, InfoClient } from "@nktkas/hyperliquid"; + +// apiUrl points the transport at a custom server (your Chainstack endpoint) +const transport = new HttpTransport({ apiUrl: "YOUR_CHAINSTACK_ENDPOINT" }); +const info = new InfoClient({ transport }); + +const subAccounts = await info.subAccounts2({ + user: "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", +}); +console.log(subAccounts); +``` + + + + +**Use your own endpoint in your code.** The code examples use a placeholder Chainstack endpoint (YOUR_CHAINSTACK_ENDPOINT) — replace it with your own Hyperliquid node endpoint from the [Chainstack console](https://console.chainstack.com/). The curl above uses a shared public endpoint for quick checks only; do not use it in production. + + +## Example response + +```json +null +``` + +The example returns `null` because the queried address has no sub-accounts. An account with sub-accounts returns an array of sub-account objects as described above. + +## Use cases + +The `info` endpoint with `type: "subAccounts2"` is useful for: + +* Enumerating the sub-accounts under a master account +* Building dashboards that aggregate positions across sub-accounts +* Portfolio tooling that needs each sub-account's clearinghouse and spot state diff --git a/reference/hyperliquid-info-twap-history.mdx b/reference/hyperliquid-info-twap-history.mdx new file mode 100644 index 00000000..c159e101 --- /dev/null +++ b/reference/hyperliquid-info-twap-history.mdx @@ -0,0 +1,92 @@ +--- +title: twapHistory | Hyperliquid info +openapi: /openapi/hyperliquid_node_api/hypercore_info/info_twap_history.json post /info +description: "The info endpoint with type: \"twapHistory\" returns a user's TWAP order history on Hyperliquid." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + +The `info` endpoint with `type: "twapHistory"` returns a user's TWAP (time-weighted average price) order history — each record's creation time, state, and current status. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Request body + +* `type` (string, required) — The request type. Must be `"twapHistory"`. +* `user` (string, required) — Address in 42-character hexadecimal format. + +## Response + +Returns an array of TWAP history records. Each record contains: + +* `time` (integer) — Creation time of the record (seconds since epoch). +* `state` (object) — The state of the TWAP order (coin, size, executed amounts, side, and related fields). +* `status` (object) — The current status, for example `{"status": "finished"}`, `{"status": "activated"}`, `{"status": "terminated"}`, or `{"status": "error", "description": "..."}`. +* `twapId` (integer) — The ID of the TWAP order. + +## Example request + + + +```shell Shell +curl -X POST \ + -H "Content-Type: application/json" \ + -d '{"type": "twapHistory", "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568"}' \ + https://api.hyperliquid.xyz/info +``` + +```python Python (hyperliquid-python-sdk) +from hyperliquid.info import Info +from hyperliquid.utils import constants + +info = Info(constants.MAINNET_API_URL, skip_ws=True) + +# The SDK has no dedicated twapHistory helper, so post the request directly. +twap_history = info.post("/info", { + "type": "twapHistory", + "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", +}) +print(twap_history) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { HttpTransport, InfoClient } from "@nktkas/hyperliquid"; + +const transport = new HttpTransport(); +const info = new InfoClient({ transport }); + +const twapHistory = await info.twapHistory({ + user: "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", +}); +console.log(twapHistory); +``` + + + +## Example response + +```json +[] +``` + +The example returns an empty array because the queried address has no TWAP history. An account with TWAP orders returns an array of history records as described above. + +## Use cases + +The `info` endpoint with `type: "twapHistory"` is useful for: + +* Auditing a user's past TWAP orders +* Trading dashboards that show TWAP execution history +* Analyzing TWAP order outcomes over time diff --git a/reference/hyperliquid-info-user-borrow-lend-interest.mdx b/reference/hyperliquid-info-user-borrow-lend-interest.mdx new file mode 100644 index 00000000..9c48c707 --- /dev/null +++ b/reference/hyperliquid-info-user-borrow-lend-interest.mdx @@ -0,0 +1,97 @@ +--- +title: userBorrowLendInterest | Hyperliquid info +openapi: /openapi/hyperliquid_node_api/hypercore_info/info_user_borrow_lend_interest.json post /info +description: "The info endpoint with type: \"userBorrowLendInterest\" returns a user's borrow/lend interest accrual records per token on Hyperliquid." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + +The `info` endpoint with `type: "userBorrowLendInterest"` returns a user's borrow and lend interest accrual records, per token. Use it to track interest earned on supplied balances and paid on borrowed balances. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Request body + +* `type` (string, required) — The request type. Must be `"userBorrowLendInterest"`. +* `user` (string, required) — Address in 42-character hexadecimal format. + +## Response + +Returns an array of interest records. Each record contains: + +* `time` (integer) — Timestamp of the update (milliseconds since epoch). +* `token` (string) — Token symbol (for example, `USDC`). +* `borrow` (string) — Borrow interest amount. +* `supply` (string) — Supply interest amount. + +## Example request + + + +```shell Shell +curl -X POST \ + -H "Content-Type: application/json" \ + -d '{"type": "userBorrowLendInterest", "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568"}' \ + https://api.hyperliquid.xyz/info +``` + +```python Python (hyperliquid-python-sdk) +from hyperliquid.info import Info +from hyperliquid.utils import constants + +info = Info(constants.MAINNET_API_URL, skip_ws=True) + +# The SDK has no dedicated userBorrowLendInterest helper, so post the request directly. +interest = info.post("/info", { + "type": "userBorrowLendInterest", + "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", +}) +print(interest) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { HttpTransport, InfoClient } from "@nktkas/hyperliquid"; + +const transport = new HttpTransport(); +const info = new InfoClient({ transport }); + +const interest = await info.userBorrowLendInterest({ + user: "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", +}); +console.log(interest); +``` + + + +## Example response + +```json +[ + { + "time": 1710000000000, + "token": "USDC", + "borrow": "0.0", + "supply": "1.234567" + } +] +``` + +## Use cases + +The `info` endpoint with `type: "userBorrowLendInterest"` is useful for: + +* Tracking interest earned and paid over time +* Accounting and tax reporting for borrow/lend activity +* Analyzing the cost and yield of positions diff --git a/reference/hyperliquid-info-user-twap-slice-fills-by-time.mdx b/reference/hyperliquid-info-user-twap-slice-fills-by-time.mdx new file mode 100644 index 00000000..e952510b --- /dev/null +++ b/reference/hyperliquid-info-user-twap-slice-fills-by-time.mdx @@ -0,0 +1,91 @@ +--- +title: userTwapSliceFillsByTime | Hyperliquid info +openapi: /openapi/hyperliquid_node_api/hypercore_info/info_user_twap_slice_fills_by_time.json post /info +description: "The info endpoint with type: \"userTwapSliceFillsByTime\" returns a user's TWAP slice fills within a time range on Hyperliquid." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + +The `info` endpoint with `type: "userTwapSliceFillsByTime"` returns a user's TWAP slice fills within a time range. Each TWAP order executes as a series of slices; this method returns those individual slice fills filtered by time. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Request body + +* `type` (string, required) — The request type. Must be `"userTwapSliceFillsByTime"`. +* `user` (string, required) — Address in 42-character hexadecimal format. +* `startTime` (integer, required) — Start time in milliseconds since epoch (inclusive). +* `endTime` (integer, optional) — End time in milliseconds since epoch (inclusive). Defaults to the current time. + +## Response + +Returns an array of TWAP slice fills. Each entry is a fill record (with the standard fill fields such as `coin`, `px`, `sz`, `side`, `time`, and `hash`) paired with the TWAP order ID it belongs to. + +## Example request + + + +```shell Shell +curl -X POST \ + -H "Content-Type: application/json" \ + -d '{"type": "userTwapSliceFillsByTime", "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", "startTime": 0}' \ + https://api.hyperliquid.xyz/info +``` + +```python Python (hyperliquid-python-sdk) +from hyperliquid.info import Info +from hyperliquid.utils import constants + +info = Info(constants.MAINNET_API_URL, skip_ws=True) + +# The SDK has no dedicated userTwapSliceFillsByTime helper, so post the request directly. +fills = info.post("/info", { + "type": "userTwapSliceFillsByTime", + "user": "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", + "startTime": 0, +}) +print(fills) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { HttpTransport, InfoClient } from "@nktkas/hyperliquid"; + +const transport = new HttpTransport(); +const info = new InfoClient({ transport }); + +const fills = await info.userTwapSliceFillsByTime({ + user: "0x1442ad477ded1b0028b57621aa7b6f7eadb8f568", + startTime: 0, +}); +console.log(fills); +``` + + + +## Example response + +```json +[] +``` + +The example returns an empty array because the queried address has no TWAP slice fills in the range. An account with TWAP executions returns an array of slice fills as described above. + +## Use cases + +The `info` endpoint with `type: "userTwapSliceFillsByTime"` is useful for: + +* Reconciling TWAP executions within a specific time window +* Backtesting and performance analysis of TWAP strategies +* Reporting on slice-level execution detail diff --git a/reference/hyperliquid-info-validator-summaries.mdx b/reference/hyperliquid-info-validator-summaries.mdx new file mode 100644 index 00000000..2c0a7140 --- /dev/null +++ b/reference/hyperliquid-info-validator-summaries.mdx @@ -0,0 +1,105 @@ +--- +title: validatorSummaries | Hyperliquid info +openapi: /openapi/hyperliquid_node_api/hypercore_info/info_validator_summaries.json post /info +description: "The info endpoint with type: \"validatorSummaries\" returns summaries for all validators — stake, status, commission, and uptime/APR stats." +--- + + +You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown. + + +The `info` endpoint with `type: "validatorSummaries"` returns summaries for all validators on Hyperliquid — including delegated stake, active/jailed status, commission, and uptime and predicted-APR statistics. + + + +**Get your own node endpoint today** + +[Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required. + +You can sign up with your GitHub, X, Google, or Microsoft account. + + + +## Parameters + +### Request body + +* `type` (string, required) — The request type. Must be `"validatorSummaries"`. + +## Response + +Returns an array of validator summaries. Each summary includes fields such as: + +* `validator` (string) — The validator address. +* `signer` (string) — The validator signer address. +* `name` (string) — The validator name. +* `description` (string) — The validator description. +* `stake` (integer) — Total stake delegated to the validator (in wei). +* `isJailed` (boolean) — Whether the validator is jailed. +* `isActive` (boolean) — Whether the validator is active. +* `commission` (string) — The validator commission rate. +* `stats` (array) — Per-period (`day`, `week`, `month`) uptime fraction and predicted APR. + +## Example request + + + +```shell Shell +curl -X POST \ + -H "Content-Type: application/json" \ + -d '{"type": "validatorSummaries"}' \ + https://api.hyperliquid.xyz/info +``` + +```python Python (hyperliquid-python-sdk) +from hyperliquid.info import Info +from hyperliquid.utils import constants + +info = Info(constants.MAINNET_API_URL, skip_ws=True) + +# The SDK has no dedicated validatorSummaries helper, so post the request directly. +validators = info.post("/info", {"type": "validatorSummaries"}) +print(validators) +``` + +```typescript TypeScript (@nktkas/hyperliquid) +import { HttpTransport, InfoClient } from "@nktkas/hyperliquid"; + +const transport = new HttpTransport(); +const info = new InfoClient({ transport }); + +const validators = await info.validatorSummaries(); +console.log(validators); +``` + + + +## Example response + +```json +[ + { + "validator": "0x000000000056f99d36b6f2e0c51fd41496bbacb8", + "signer": "0x0000000008b0b558419582041f85740344ae8fde", + "name": "ValiDAO", + "description": "The People's Validator", + "nRecentBlocks": 1, + "stake": 658880656542139, + "isJailed": false, + "unjailableAfter": null, + "isActive": true, + "commission": "0.04", + "stats": [ + ["day", { "uptimeFraction": "1.0", "predictedApr": "0.0215529962", "nSamples": 1440 }] + ] + } +] +``` + +## Use cases + +The `info` endpoint with `type: "validatorSummaries"` is useful for: + +* Staking dashboards that list validators and their APRs +* Helping delegators choose a validator by stake, commission, and uptime +* Monitoring validator status and network health