Hyperliquid 백서

Hyperliquid

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 27쪽 중 15쪽

,</p><p> "toPerp": true if (spot -> perp) else false,</p><p>"nonce": current timestamp in milliseconds as a Number, must match nonce in outer request body</p><p>}</p></td></tr><tr><td>nonce<mark style="color:red;">*</mark></td><td>Number</td><td>Recommended to use the current timestamp in milliseconds, must match the nonce in the action Object above</td></tr><tr><td>signature<mark style="color:red;">*</mark></td><td>Object</td><td></td></tr></tbody></table> **Response** {% tabs %} {% tab title="200: OK" %} ```json {'status': 'ok', 'response': {'type': 'default'}} ``` {% endtab %} {% endtabs %} ## Deposit into staking <mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange` This method is used to transfer native token from the user's spot account into staking for delegating to validators. #### Headers | Name | Value | | ---------------------------------------------- | ------------------ | | Content-Type<mark style="color:red;">\*</mark> | `application/json` | #### Body | Name | Type | Description | | ------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "cDeposit",</p><p> "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),<br> "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p> "wei": amount of wei to transfer as a number,</p><p>"nonce": current timestamp in milliseconds as a Number, must match nonce in outer request body</p><p>}</p> | | nonce<mark style="color:red;">\*</mark> | Number | Recommended to use the current timestamp in milliseconds, must match the nonce in the action Object above | | signature<mark style="color:red;">\*</mark> | Object | | #### Response {% tabs %} {% tab title="200: OK" %} ```json {'status': 'ok', 'response': {'type': 'default'}} ``` {% endtab %} {% endtabs %} ## Withdraw from staking <mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange` This method is used to transfer native token from staking into the user's spot account. Note that transfers from staking to spot account go through a 7 day unstaking queue. #### Headers | Name | Value | | ---------------------------------------------- | ------------------ | | Content-Type<mark style="color:red;">\*</mark> | `application/json` | #### Body | Name | Type | Description | | ------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "cWithdraw",</p><p> "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),<br> "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p> "wei": amount of wei to transfer as a number,</p><p>"nonce": current timestamp in milliseconds as a Number, must match nonce in outer request body</p><p>}</p> | | nonce<mark style="color:red;">\*</mark> | Number | Recommended to use the current timestamp in milliseconds, must match the nonce in the action Object above | | signature<mark style="color:red;">\*</mark> | Object | | #### Response {% tabs %} {% tab title="200: OK" %} ```json {'status': 'ok', 'response': {'type': 'default'}} ``` {% endtab %} {% endtabs %} ## Delegate or undelegate stake from validator <mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange` Delegate or undelegate native tokens to or from a validator. Note that delegations to a particular validator have a lockup duration of 1 day. #### Headers | Name | Value | | ---------------------------------------------- | ------------------ | | Content-Type<mark style="color:red;">\*</mark> | `application/json` | #### Body | Name | Type | Description | | ------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "tokenDelegate",</p><p> "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),<br> "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p> "validator": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,<br>"isUndelegate": boolean,</p><p>"wei": number,</p><p>"nonce": current timestamp in milliseconds as a Number, must match nonce in outer request body</p><p>}</p> | | nonce<mark style="color:red;">\*</mark> | number | Recommended to use the current timestamp in milliseconds | | signature<mark style="color:red;">\*</mark> | Object | | #### Response {% tabs %} {% tab title="200: OK" %} ```json {'status': 'ok', 'response': {'type': 'default'}} ``` {% endtab %} {% endtabs %} ## Deposit or withdraw from a vault <mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange` Add or remove funds from a vault. **Headers** | Name | Value | | ---------------------------------------------- | ------------------ | | Content-Type<mark style="color:red;">\*</mark> | `application/json` | **Body** | Name | Type | Description | | ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "vaultTransfer",</p><p> "vaultAddress": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,<br>"isDeposit": boolean,</p><p>"usd": number</p><p>}</p> | | nonce<mark style="color:red;">\*</mark> | number | Recommended to use the current timestamp in milliseconds | | signature<mark style="color:red;">\*</mark> | Object | | | expiresAfter | Number | Timestamp in milliseconds | **Response** {% tabs %} {% tab title="200" %} ```json {'status': 'ok', 'response': {'type': 'default'}} ``` {% endtab %} {% endtabs %} ## Deposit or withdraw from an HIP-3 DEX's backstop liquidator <mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange` Add or remove funds from HIP-3 backstop liquidator address. `ntl` is an integer in units of 1e-6 quote tokens. Amount must be a multiple of 1000 quote tokens (i.e. `ntl % 1000000000 == 0`). Only principal amount is withdrawable, not pnl. **Headers** | Name | Value | | ---------------------------------------------- | ------------------ | | Content-Type<mark style="color:red;">\*</mark> | `application/json` | **Body** | Name | Type | Description | | ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------- | | action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "hip3LiquidatorTransfer",</p><p> "dex": string (e.g. "xyz"),</p><p>"ntl": number,<br>"isDeposit": boolean</p><p>}</p> | | nonce<mark style="color:red;">\*</mark> | number | Recommended to use the current timestamp in milliseconds | | signature<mark style="color:red;">\*</mark> | Object | | | expiresAfter | Number | Timestamp in milliseconds | **Response** {% tabs %} {% tab title="200" %} ```json {'status': 'ok', 'response': {'type': 'default'}} ``` {% endtab %} {% endtabs %} ## Approve an API wallet <mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange` Approves an API Wallet (also sometimes referred to as an Agent Wallet). See [here](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/nonces-and-api-wallets#api-wallets) for more details. **Headers** | Name | Value | | ---------------------------------------------- | ------------------ | | Content-Type<mark style="color:red;">\*</mark> | `application/json` | **Body** | Name | Type | Description | | ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | action<mark style="color:red;">\*</mark> | Object | <p>{<br> "type": "approveAgent",</p><p> "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),<br> "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p> "agentAddress": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,</p><p>"agentName": Optional name for the API wallet. An account can have 1 unnamed approved wallet and up to 3 named ones. And additional 2 named agents are allowed per subaccount. A custom expiration can be set by appending <code>valid\_until {timestamp}</code> after the name. The expiration can be at most 180 days in the future,</p><p> "nonce": current timestamp in milliseconds as a Number, must match nonce in outer request body</p><p>}</p> | | nonce<mark style="color:red;">\*</mark> | number | Recommended to use the current timestamp in milliseconds | | signature<mark style="color:red;">\*</mark> | Object | | **Response** {% tabs %} {% tab title="200" %} ```json {'status': 'ok', 'response': {'type': 'default'}} ``` {% endtab %} {% endtabs %} ## Approve a builder fee <mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange` Approve a maximum fee rate for a builder. **Headers** | Name | Value | | ---------------------------------------------- | ------------------ | | Content-Type<mark style="color:red;">\*</mark> | `application/json` | **Body** | Name | Type | Description | | ------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | action<mark style="color:red;">\*</mark> | Object | <p>{<br> "type": "approveBuilderFee",</p><p> "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),<br> "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p> "maxFeeRate": the maximum allowed builder fee rate as a percent string; e.g. "0.001%",</p><p> "builder": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,</p><p> "nonce": current timestamp in milliseconds as a Number, must match nonce in outer request body</p><p>}</p> | | nonce<mark style="color:red;">\*</mark> | number | Recommended to use the current timestamp in milliseconds | | signature<mark style="color:red;">\*</mark> | Object | | **Response** {% tabs %} {% tab title="200" %} ```json {'status': 'ok', 'response': {'type': 'default'}} ``` {% endtab %} {% endtabs %} ## Place a TWAP order <mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange` #### Headers | Name | Type | Description | | ---------------------------------------------- | ------ | ------------------ | | Content-Type<mark style="color:red;">\*</mark> | String | "application/json" | #### Request Body | Name | Type | Description | | ------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "twapOrder",<br> "twap": {</p><p> "a": Number,</p><p> "b": Boolean,</p><p> "s": String,</p><p> "r": Boolean,</p><p> "m": Number,</p><p> "t": Boolean</p><p> }</p><p> }<br><br>Meaning of keys:<br>a is asset<br>b is isBuy<br>s is size<br>r is reduceOnly</p><p>m is minutes<br>t is randomize</p> | | nonce<mark style="color:red;">\*</mark> | Number | Recommended to use the current timestamp in milliseconds | | signature<mark style="color:red;">\*</mark> | Object | | | vaultAddress | String | If trading on behalf of a vault or subaccount, its Onchain address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000 | | expiresAfter | Number | Timestamp in milliseconds | {% tabs %} {% tab title="200: OK Successful Response" %} ``` { "status":"ok", "response":{ "type":"twapOrder", "data":{ "status": { "running":{ "twapId":77738308 } } } } } ``` {% endtab %} {% tab title="200: OK Error Response" %} ``` { "status":"ok", "response":{ "type":"twapOrder", "data":{ "status": { "error":"Invalid TWAP duration: 1 min(s)" } } } } ``` {% endtab %} {% endtabs %} ## Cancel a TWAP order <mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange` #### Headers | Name | Type | Description | | ---------------------------------------------- | ------ | ------------------ | | Content-Type<mark style="color:red;">\*</mark> | String | "application/json" | #### Request Body | Name | Type | Description | | ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | | action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "twapCancel",</p><p> "a": Number,</p><p> "t": Number</p><p>}<br><br>Meaning of keys:<br>a is asset<br>t is twap\_id</p> | | nonce<mark style="color:red;">\*</mark> | Number | Recommended to use the current timestamp in milliseconds | | signature<mark style="color:red;">\*</mark> | Object | | | vaultAddress | String | If trading on behalf of a vault or subaccount, its address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000 | | expiresAfter | Number | Timestamp in milliseconds | {% tabs %} {% tab title="200: OK Successful Response" %} ``` { "status":"ok", "response":{ "type":"twapCancel", "data":{ "status": "success" } } } ``` {% endtab %} {% tab title="200: OK Error Response" %} ``` { "status":"ok", "response":{ "type":"twapCancel", "data":{ "status": { "error": "TWAP was never placed, already canceled, or filled." } } } } ``` {% endtab %} {% endtabs %} ## Place a trailing stop order <mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange` #### Headers | Name | Type | Description | | ---------------------------------------------- | ------ | ------------------ | | Content-Type<mark style="color:red;">\*</mark> | String | "application/json" | #### Request Body | Name | Type | Description | | | ------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | | action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "trailingStop",</p><p> "asset": Number,</p><p> "isBuy": Boolean,</p><p> "sz": String,</p><p> "reduceOnly": Boolean,</p><p> "retracement": {"pct": as a percent string; e.g. "1.234%"} or {"px": String},</p><p> "activationPx": String | null</p><p>}</p> | | nonce<mark style="color:red;">\*</mark> | Number | Recommended to use the current timestamp in milliseconds | | | signature<mark style="color:red;">\*</mark> | Object | | | | vaultAddress | String | If trading on behalf of a vault or subaccount, its address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000 | | | expiresAfter | Number | Timestamp in milliseconds | | {% tabs %} {% tab title="200: OK Successful Response" %} ``` { "status":"ok", "response":{ "type":"trailingStop", "data":{ "oid":77738308 } } } ``` {% endtab %} {% endtabs %} ## Reserve Additional Actions <mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange` Instead of trading to increase the address based rate limits, this action allows reserving additional actions for 0.0005 USDC per request. The cost is paid from the Perps balance. `destination` may be set to pay for another L1 user. The destination user must already exist. This field is skipped in hashing if it is unset. #### Headers | Name | Type | Description | | ---------------------------------------------- | ------ | ------------------ | | Content-Type<mark style="color:red;">\*</mark> | String | "application/json" | #### Request Body | Name | Type | Description | | | ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------- | ---------------- | | action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "reserveRequestWeight",</p><p> "weight": Number,</p><p> "destination": Address | null</p><p>}</p> | | nonce<mark style="color:red;">\*</mark> | Number | Recommended to use the current timestamp in milliseconds | | | signature<mark style="color:red;">\*</mark> | Object | | | | expiresAfter | Number | Timestamp in milliseconds | | {% tabs %} {% tab title="200: OK Successful Response" %} ``` {'status': 'ok', 'response': {'type': 'default'}} ``` {% endtab %} {% endtabs %} ## Invalidate Pending Nonce (noop) <mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange` This action does not do anything (no operation), but causes the nonce to be marked as used. This can be a more effective way to cancel in-flight orders than the cancel action. #### Headers | Name | Type | Description | | ---------------------------------------------- | ------ | ------------------ | | Content-Type<mark style="
프로젝트로 돌아가기