bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 27쪽 중 14쪽
/p><p> },</p><p> "c": Cloid (optional)</p><p> }</p><p> }],</p><p> "a": Boolean // always\_place</p><p>}<br><br>Meaning of keys:<br>a is asset<br>b is isBuy<br>p is price<br>s is size<br>r is reduceOnly<br>t is type<br>c is cloid (client order 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 Onchain address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000 | | | | |
| expiresAfter | Number | Timestamp in milliseconds | | | | |
## Update leverage
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
Update cross or isolated leverage on a coin.
#### 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": "updateLeverage",</p><p> "asset": index of coin,</p><p> "isCross": true or false if updating cross-leverage,</p><p> "leverage": integer representing new leverage, subject to leverage constraints on that coin</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 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': 'default'}}
```
{% endtab %}
{% endtabs %}
## Update isolated margin
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
Add or remove margin from isolated position
Note that to target a specific leverage instead of a USDC value of margin change, there is an alternate action `{"type": "topUpIsolatedOnlyMargin", "asset": <asset>, "leverage": <float string>}`
#### 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": "updateIsolatedMargin",</p><p> "asset": index of coin,</p><p> "isBuy": true, (this parameter won't have any effect until hedge mode is introduced)</p><p> "ntli": int representing amount to add or remove with 6 decimals, e.g. 1000000 for 1 usd,</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 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': 'default'}}
```
{% endtab %}
{% endtabs %}
## Send Asset
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
This generalized method is used to transfer tokens between different perp DEXs, spot balance, users, and/or sub-accounts. Use "" to specify the default USDC perp DEX and "spot" to specify spot. Only the collateral token can be transferred to or from a perp DEX.
#### 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": "sendAsset",</p><p> "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),</p><p> "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p> "destination": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,</p><p> "sourceDex": name of perp dex to transfer from,</p><p> "destinationDex": name of the perp dex to transfer to,</p><p> "token": tokenName:tokenId; e.g. "PURR:0xc4bf3f870c0e9465323c0b6ed28096c2",</p><p> "amount": amount of token to send as a string; e.g. "0.01",</p><p> "fromSubAccount": address in 42-character hexadecimal format or empty string if not from a subaccount,</p><p> "nonce": current timestamp in milliseconds as a Number, should match nonce</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" %}
```
{'status': 'ok', 'response': {'type': 'default'}}
```
{% endtab %}
{% endtabs %}
## Agent Send Asset
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
Similar to send asset, but can be signed by an agent. Destination must match the source address. Use "" to specify the default USDC perp DEX and "spot" to specify spot. Only the collateral token can be transferred to or from a perp DEX.
#### 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": "agentSendAsset",</p><p> "destination": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,</p><p> "sourceDex": name of perp dex to transfer from,</p><p> "destinationDex": name of the perp dex to transfer to,</p><p> "token": tokenName:tokenId; e.g. "PURR:0xc4bf3f870c0e9465323c0b6ed28096c2",</p><p> "amount": amount of token to send as a string; e.g. "0.01",</p><p> "fromSubAccount": address in 42-character hexadecimal format or empty string if not from a subaccount,</p><p> "nonce": current timestamp in milliseconds as a Number, should match nonce</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" %}
```
{'status': 'ok', 'response': {'type': 'default'}}
```
{% endtab %}
{% endtabs %}
## Send to EVM with data
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
Specialized action for Core to EVM transfer that includes an additional data payload. See [HyperCore <> HyperEVM transfers](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/hypercore-less-than-greater-than-hyperevm-transfers) for more details. When used coreReceiveWithData will be called on the linked contract instead of transfer. IMPORTANT: it is the caller's responsibility to ensure that the token is properly linked and the linked contract supports the following interface:<br>
```
interface ICoreReceiveWithData {
function coreReceiveWithData(
address from,
bytes32 destinationRecipient,
uint32 destinationChainId,
uint256 amount,
uint64 nonce,
bytes calldata data
) external;
}
```
#### 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": "sendToEvmWithData",</p><p> "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),</p><p> "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p> "token": tokenName:tokenId; e.g. "PURR:0xc4bf3f870c0e9465323c0b6ed28096c2",</p><p> "amount": amount of token to send as a string; e.g. "0.01",</p><p> "sourceDex": name of perp dex to transfer from,</p><p> "destinationRecipient": address in addressEncoding format,</p><p> "addressEncoding": "hex" | "base58",</p><p> "destinationChainId": number,</p><p> "gasLimit": number,</p><p> "data": bytes,</p><p> "nonce": current timestamp in milliseconds as a Number, should match nonce</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" %}
```
{'status': 'ok', 'response': {'type': 'default'}}
```
{% endtab %}
{% endtabs %}
## Core USDC transfer
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
Send usd to another address. This transfer does not touch the EVM bridge. The signature format is human readable for wallet interfaces.
#### 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": "usdSend",</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> "destination": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,</p><p> "amount": amount of usd to send as a string, e.g. "1" for 1 usd,</p><p> "time": current timestamp in milliseconds as a Number, should match nonce</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 | |
{% tabs %}
{% tab title="200: OK Successful Response" %}
```
{'status': 'ok', 'response': {'type': 'default'}}
```
{% endtab %}
{% endtabs %}
## Core spot transfer
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
Send spot assets to another address. This transfer does not touch the EVM bridge. The signature format is human readable for wallet interfaces.
#### 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": "spotSend",</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> "destination": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,<br> "token": tokenName:tokenId; e.g. "PURR:0xc4bf3f870c0e9465323c0b6ed28096c2",</p><p> "amount": amount of token to send as a string, e.g. "0.01",</p><p> "time": current timestamp in milliseconds as a Number, should match nonce</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 | |
{% tabs %}
{% tab title="200: OK Successful Response" %}
```
{'status': 'ok', 'response': {'type': 'default'}}
```
{% endtab %}
{% endtabs %}
```
Example sign typed data for generating the signature:
{
"types": {
"HyperliquidTransaction:SpotSend": [
{
"name": "hyperliquidChain",
"type": "string"
},
{
"name": "destination",
"type": "string"
},
{
"name": "token",
"type": "string"
},
{
"name": "amount",
"type": "string"
},
{
"name": "time",
"type": "uint64"
}
]
},
"primaryType": "HyperliquidTransaction:SpotSend",
"domain": {
"name": "HyperliquidSignTransaction",
"version": "1",
"chainId": 42161,
"verifyingContract": "0x0000000000000000000000000000000000000000"
},
"message": {
"destination": "0x0000000000000000000000000000000000000000",
"token": "PURR:0xc1fb593aeffbeb02f85e0308e9956a90",
"amount": "0.1",
"time": 1716531066415,
"hyperliquidChain": "Mainnet"
}
}
```
## Initiate a withdrawal request
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
This method is used to initiate the withdrawal flow. After making this request, the L1 validators will sign and send the withdrawal request to the bridge contract. There is a $1 fee for withdrawing at the time of this writing and withdrawals take approximately 5 minutes to finalize.
#### 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>{<br> "type": "withdraw3",</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> "amount": amount of usd to send as a string, e.g. "1" for 1 usd,</p><p> "time": current timestamp in milliseconds as a Number, should match nonce,</p><p> "destination": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000</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 | |
{% tabs %}
{% tab title="200: OK " %}
```
{'status': 'ok', 'response': {'type': 'default'}}
```
{% endtab %}
{% endtabs %}
## Transfer from Spot account to Perp account (and vice versa)
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
This method is used to transfer USDC from the user's spot wallet to perp wallet and vice versa.
**Headers**
| Name | Value |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | "application/json" |
**Body**
<table><thead><tr><th>Name</th><th width="200">Type</th><th>Description</th></tr></thead><tbody><tr><td>action<mark style="color:red;">*</mark></td><td>Object</td><td><p>{</p><p> "type": "usdClassTransfer",</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> "amount": amount of usd to transfer as a string, e.g. "1" for 1 usd. If you want to use this action for a subaccount, you can include subaccount: address after the amount, e.g. "1" subaccount:0x0000000000000000000000000000000000000000프로젝트로 돌아가기