@totalistrading/hip4-client 0.14.0 wraps every route, both flows, every signed message and the
WebSocket. It never stores a key: every signature goes to the signer you pass in.
Install
The SDK is private. Email founders@totalis.trade with the GitHub account that should read it, then:.npmrc
viem or ethers only turns a private key into a signer.
Clients
environment is "production" or "staging"; baseUrl overrides it. Money is atomic USDC as a
bigint or decimal string. createTotalis and createMaker expose client and stream; call
close() when done.
Open a position
openPosition subscribes, creates the RFQ, picks a quote, signs, accepts with any funding, and recovers
a lost accept. It returns rfqId, acceptanceId, quoteId, positionId, entry, status and
operationId.
status can also be NOT_ADMITTED: every response was lost, and the SDK cancelled the RFQ.
watchQuotes(rfqId, listener) reports live quotes, and [] while the stream is down.
Cash out and withdraw
waitForWithdrawal(withdrawalId) follows a started withdrawal. To store the signed
request first, signWithdrawal returns { idempotencyKey, account, body } and sendWithdrawal(signed)
sends it.
Make markets
onRfqruns once per open RFQ, from events and the snapshot, and pages a truncated snapshot.quotebuildsentryterms with the deployment’s fees and a 20 second life (lifetimeSeconds).bidbuildssell_backortransferterms with a 45 second life.onAcceptancechecks the terms, signs them once, and resends a lost answer byte for byte. It never signs terms this maker did not create.publishedstores thequote_ids this maker created (record,forget,expiry). Back it with durable storage so a restarted process can confirm them.- Pass
stream: { cursor }to resume, and savemaker.stream.cursorafter each event.
approveUsdc, deposit, requestWithdraw, executeWithdraw, cancelWithdraw,
setQuoteSigner, resetDiscount.
Signing
hashTypedData gives a digest, canonicalSignature the form the API accepts, depositNonce and
payoutNonce the USDC nonces.
WebSocket and pagination
status is live only while caught up.
Retries and errors
Each command is built once with itsIdempotency-Key and resent byte for byte after a network failure
or a BACKOFF error, up to five sends (retry: { attempts }, or retry: false). unwrap throws
ApiError with code, retry, status, requestId, fieldViolations and retryAfterMs.
NetworkError means the outcome is unknown. Call resend(), never a new command.
Changes in 0.14.0
Breaking; needs contract 118. Signed messages and digests are unchanged. The full list ships asCHANGELOG.md.

