API quickstart
Connect, read an account and place an order. The SDK handles signing and nonces.
1. Install
npm install @hyperjutsu/hyperliquid viem2. Connect a wallet
Use your API URL and signing key:
import { ExchangeClient, HttpTransport, InfoClient } from '@hyperjutsu/hyperliquid'
import { privateKeyToAccount } from 'viem/accounts'
const wallet = privateKeyToAccount(privateKey)
const transport = new HttpTransport({ apiUrl })
const info = new InfoClient({ transport, wallet })
const exchange = new ExchangeClient({ transport, wallet })Use a verified transport. Set isTestnet: true for testnet. Connection setup.
3. Read your account
const orders = await info.openOrders({ user: accountAddress })Use the account owner's address. No open orders returns [].
4. Place an order
const result = await exchange.order({
orders: [{
a: 0,
b: true,
p: '100000',
s: '0.001',
r: false,
t: { limit: { tif: 'Gtc' } },
c: '0x11111111111111111111111111111111',
}],
grouping: 'na',
})Use valid market values and a new CLOID for each new order. Inspect each result; check status before replacing an order with a lost response.
Next steps
WebSocket examples · Permissions · API reference