HOOK use-hip4-client

useHIP4Client

Creates and caches InfoClient + SubscriptionClient from @nktkas/hyperliquid. Returns { info, sub, close }. Cached in ref — stable across rerenders. Pass { testnet: true } for testnet. Usually consumed via HIP4Provider rather than directly.

Install

$ npx shadcn@latest add https://ui.purrdict.xyz/r/use-hip4-client.json

Signature

useHIP4Client(opts?: { testnet?: boolean })

Returns

HIP4Client
Usage
const client = useHIP4Client({ testnet: true })

// Or use HIP4Provider for zero prop-drilling:
// <HIP4Provider testnet={true}><App /></HIP4Provider>
// Then all hooks read from context automatically.

Dependencies

npm packages