chainId=999
. This document details how to deposit and withdraw from Hyperliquid within your app.
API Access
Hyperliquid can be accessed using the standard Relay API flow, with the following properties. To get started, check out the execution steps of our API. Then when you’re ready to swap, head over to the Get Quote API endpoint.Hyperliquid Specific API Parameters
Action | Parameter | Input | Description |
---|---|---|---|
Deposit to Hyperliquid | toChainId | 1337 | Hyperliquid Chain Id |
recipient | Hyperliquid Address | ||
Withdrawals from Hyperliquid | useDepositAddress*** | true | |
fromChainId | 1337 | Hyperliquid Chain Id |
useDepositAddress:true
is a required param do to the current structure of hypercore.
Interacting with Hyperliquid to Initiate Withdrawals
In order to facilitate withdrawals from hyperliquid in your application, you need to query users balances, and submit hyperliquid transactions.Getting Hyperliquid Balances
You can use the Hyperliquid info API to get balances. Make sure to pass inclearinghouseState
as the type
. Then you can read the withdrawable
property which should be a USD value in human readable format.
Submitting Hyperliquid Tx
Once you verify that your address has a usdc perps balance you must sign a message proving ownership over the account and verifying an amount of USDC perps that can be withdrawn. The Relay SDK already handles this for you but here’s a step by step guide on how to do this yourself.- You’ll need to take the quote (which returns a transaction step) and convert this into signature data:
domain
- static except for thechainId
.chainId
is the active chain id in the connected wallet. This is the chain id that will sign the message. Next up is the types. These are also static and can be hardcoded.primaryType
should match the name of the first type.value
dynamic execution datasignatureChainId
is the hex representation of the aforementioned active chain id.
“ok”
.
To see how an example you can have a look at our publicly available SDK.