@totalis/hip4-client is the official TypeScript SDK for Totalis on Hyperliquid. It wraps every route
with typed requests and responses, runs the taker and maker flows end to end, builds every signed message, and
keeps a WebSocket in sync. It never holds a key: every signature goes to the signer you pass in.
Install
viem (or ethers) is only there to turn a private key into a signer.
The package used to be
@totalistrading/hip4-client, and versions up to 0.65.0 were published to GitHub
Packages under that name. Change your imports to @totalis/hip4-client, and remove any
@totalistrading:registry=https://npm.pkg.github.com line from your .npmrc.Make a first call
Create attk_ API key for your account (Create, rotate, revoke),
then read your account:
client, with its path,
parameters and response typed. unwrap returns the body or throws an ApiError.
Pick a client
createTotalis and createMaker each carry a typed client and a stream too, so you rarely need more than one.
Environments
Staging runs on Hyperliquid testnet (Staging). To point at another origin, pass
baseUrl. It serves the streams too unless you also set streamBaseUrl.
Options
Every client takes the same options.createMaker takes apiKey (the maker’s ttk_ key) and makerId in place of accessToken.
A signer can be a viem account or wallet client, an EIP-1193 provider such as window.ethereum, or an ethers
signer. toTotalisSigner, from .../signer, converts any of them yourself when you need to.
Conventions
- Money is atomic USDC (6 decimals), as a
bigintor a decimal string.25_000_000nis 25 USDC. - Time comes from the venue. Deadlines such as
accept_beforeandfund_byare judged on the venue clock, whichstream.serverNow()gives you. - Commands are idempotent. Each one is built once with its
Idempotency-Keyand resent byte for byte, so a retry never trades twice. - Clean up. Call
close()oncreateTotalisandcreateMakerwhen you are done, to stop their streams.
Entry points
Examples
The package ships runnable examples innode_modules/@totalis/hip4-client/examples.
The SDK follows semver. What changed in each release is on the Changelog.

