Scan your whole stack
Are you using @totalis/hip4-client?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.134.0
@totalis/hip4-client was last scanned on 29 Nov 2026 at version 0.134.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.134.0 LATEST | 29 Nov 2026 | No rules fired |
| 0.133.0 | 29 Nov 2026 | No rules fired |
| 0.132.0 | 29 Nov 2026 | No rules fired |
| 0.131.0 | 28 Nov 2026 | Not shown |
| 0.130.0 | 28 Nov 2026 | Not shown |
Findings for v0.134.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.134.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
@totalis/hip4-clientThe official TypeScript SDK for Totalis on Hyperliquid (HIP-4).
Idempotency-Key and is resent byte for byte, so a retry never trades twiceIt never holds a key. Every signature goes to the signer you pass in: a viem account or wallet client, an
EIP-1193 provider such as window.ethereum, or an ethers signer. It is ESM, runs in Node, browsers and
React Native (Runtimes), and has no wallet dependency.
Documentation: docs.totalis.trade/hyperliquid/sdk
npm install @totalis/hip4-client viem
viem is optional. The examples below use it to turn a private key into a signer.
| Runtime | Versions |
|---|---|
| Node | 22 or later |
| Browsers | Current Chrome, Firefox, Safari and Edge |
| React Native | 0.81 or later (Expo SDK 54 or later) |
On React Native, import react-native-get-random-values once, before the SDK. React Native has no secure
random source of its own, and the SDK needs one for request IDs, idempotency keys and signed nonces. Most
wallet libraries need it too, so an app that signs usually has it already.
A partner server key (createPartnerServer, or serverKey in signInWithWallet) is a secret, so it is
accepted only on a server, never in a browser or an app.
Create a ttk_ API key for your account
(Authentication), then:
import { createClient, unwrap } from "@totalis/hip4-client";
const client = createClient("production", { accessToken: process.env.TOTALIS_API_KEY! });
const me = unwrap(await client.GET("/v1/me"));
console.log(me.wallet);
Every route in the API reference is on
client, typed. unwrap returns the body or throws an ApiError.
import { createTotalis } from "@totalis/hip4-client";
import { privateKeyToAccount } from "viem/accounts";
const totalis = createTotalis({
environment: "production",
accessToken: process.env.TOTALIS_API_KEY!,
signer: privateKeyToAccount(process.env.TOTALIS_WALLET_KEY as `0x${string}`),
});
const opened = await totalis.openPosition({
legs: [{ outcome_id: "13160", side: "YES" }],
stake: 5_000_000n, // 5 USDC
});
if (opened.operationId) {
const { status } = await totalis.waitForOperation(opened.operationId);
if (status === "COMMITTED") {
const sale = await totalis.cashOut({ positionId: opened.positionId });
}
}
totalis.close();
openPosition creates the RFQ, signs the funding for any shortfall from the wallet, then takes the best quote
and signs the acceptance. If the maker replaced the quote first, declined it or didn't answer, it signs the best
other quote paying at least the first one's payout (minPayout) and tries again. Pass minNetPayout, the payout
net of fees the user saw, to rank quotes by what the taker receives and never take one that nets less. Only
COMMITTED means the trade happened. A decided position settles and pays out on its own. To settle a cash-out
after a restart from a record that holds no signature, use recoverCashout.
With funding: "approval", a shortfall the vault lacks comes from the wallet's USDC approval to WalletAccept
instead of a signed authorization per Combo. When the approval left is short, the SDK asks the wallet for one
permit of the larger of 10,000 USDC (defaultWalletApproval) and the shortfall, and waits until it lands:
const opened = await totalis.openPosition({
legs: [{ outcome_id: "13160", side: "YES" }],
stake: 5_000_000n,
funding: "approval",
onApproval: (record) => save("approval", record), // recoverWalletApproval(record) after a restart
});
await totalis.revokeWalletApproval(); // resolves once permit(0) landed
readWalletApproval() reads the approval and permit nonce; approveWallet({ value }),
signWalletApproval / sendWalletApproval / recoverWalletApproval and walletPermitTypedData (in
./typed-data) are the parts. Once approved, anyone can relay any live acceptance named to the account through
WalletAccept; revoke it with revokeWalletApproval, since a wallet's own approve(0) can be undone by a signed
permit that has not landed yet. Approvals are per vault: these calls serve the active vault's WalletAccept. Once
a vault is retired its WalletAccept can't pull, and the wallet clears an approval left to it with its own
approve(0) or permit(0).
A single buys or sells one side of one outcome on Hyperliquid's own book. You sign the order with the account
or its Hyperliquid agent key and the SDK sends it straight to Hyperliquid; Totalis never sees it. Every order
carries the Totalis builder fee, 10 bps of its notional (totalisBuilder), as orders in the Totalis app do, so
the account approves that fee once first:
import { approveTotalisBuilder, hyperliquidNetwork, placeSingle, readSingleOrder, readTotalisBuilderFee, totalisBuilder } from "@totalis/hip4-client";
import { privateKeyToAccount } from "viem/accounts";
const network = hyperliquidNetwork(999); // GET /v1/deployment chain_id
const wallet = privateKeyToAccount(process.env.TOTALIS_WALLET_KEY as `0x${string}`);
// Once per account, signed by its own wallet (Hyperliquid refuses it from an agent).
if ((await readTotalisBuilderFee(network, wallet.address)) < totalisBuilder.feeDecibps) {
await approveTotalisBuilder(wallet, network);
}
const { signed, answer } = await placeSingle(wallet, network, {
outcomeId: "13160",
side: "YES",
buy: true,
price: "0.42", // USDC per share, at most 5 significant figures; a buy pays at most this
shares: 20, // whole shares, each pays 1 USDC if YES wins
tif: "Ioc", // fill what crosses now; "Gtc" (default) rests the rest
});
// answer: resting, filled, refused, or unknown. Unknown means no answer arrived:
// look it up by its cloid before placing it again.
if (answer.kind === "unknown") await readSingleOrder(network, wallet.address, signed.action.orders[0].c);
cancelSingles cancels resting singles by cloid or oid. Browser wallets often refuse to sign orders (their
signing domain names chain 1337), so in a browser approve an agent key once with approveHyperliquidAgent and
sign orders with that. The agent can trade but never withdraw. Generate a fresh agent key every time you approve
one and never approve an old key again: once Hyperliquid prunes an agent (replaced, expired, or its account
emptied) it may forget the nonces the key used, and anything it signed before can then be replayed. singleOrderAction, signL1Action and
submitSingleOrder are the parts, if you send through your own Hyperliquid client;
singleOrderAction(order, { builder: false }) leaves the builder fee off for an account that has not approved it.
To place an IOC at most once per press, even across retries and crashes, use placeSingleIoc with an
intentId you make once per press. Your save claims the intent with its record (SingleOrderRecord, plain
JSON without the signature) under singleIntentKey(record) before anything is signed; an intent already claimed
comes back as its record and is never signed or sent again. The SDK then signs exactly what was saved and sends
it once, and only when the account (or the agent you name as agent) signed it. When the answer is
lost, settle it from the record with totalis.settleSingleOrder(record), which reads the venue's node order
history and Hyperliquid's order status. That history can also prove an order never landed, so pass history:
the latest totalis.readOrderHistory(), read in the background before the order. Until it settles, hold new
buys of the same outcome (buyHeldBy); sells can go ahead.
A buy spends HyperCore spot USDC. When the account's Cash sits in the vault, totalis.fundCore({ need, purpose: "ORDER", record }) moves only what spot lacks before you place the order, and resolves once spot shows it. Hold
the account's funding lock around it. record keeps the account's one exit record (CoreExitIntent, plain JSON
without the signature, under coreExitKey(account)): it is saved before the exit is signed, so after a crash
totalis.settleCoreExit(intent) reads or fences it and nothing is signed twice. A move already under way is joined
rather than repeated.
To size an order as the Totalis app does, walk the book with bookPreview (or limitPreview at your own
price): it returns the shares and the IOC limit to sign, the worst level the walk reaches, or a reason code such
as BELOW_MINIMUM. buyCost and sellProceeds state what it is expected to spend or land net of
closingFees; maxCost and minProceeds bound it from the limit you finally sign.
totalis.planWithdrawal({ destination, network: "HYPEREVM" }) says the most that can reach an address now from
all of the account's Cash (wallet, vault and HyperCore spot), with each Hyperliquid fee as its own row. Show it,
then totalis.withdrawFromCash({ terms: plan.terms, intentId, record }) sends it in one press. record
(read and save) keeps the request (WithdrawalIntent), saved before anything is signed; when the app is killed mid-way,
totalis.continueWithdrawal(intent) finishes it from that record and never signs a step twice. Moving cash between
the account's own places never changes Cash, so a request whose amount Cash no longer covers closes (CHANGED, with
the new max) and a different amount is a new press. totalis.cancelWithdrawal closes one unless its payment may
still land. A saved record never goes back to an earlier state: Continue and Cancel trust it to hold the latest step.
import { createMaker, type MakerAcceptance } from "@totalis/hip4-client/maker";
import { privateKeyToAccount } from "viem/accounts";
// Optional: re-check your price and capital before you commit. This placeholder always confirms.
const stillGood = async (_acceptance: MakerAcceptance) => true;
const maker = createMaker({
environment: "production",
apiKey: process.env.TOTALIS_MAKER_KEY!,
makerId: process.env.TOTALIS_MAKER_ID!,
signer: privateKeyToAccount(process.env.TOTALIS_WALLET_KEY as `0x${string}`),
lastLook: async (acceptance) => ((await stillGood(acceptance)) ? "CONFIRM" : "DECLINE"),
});
maker.onRfq(async (rfq) => {
if (rfq.kind === "ENTRY") {
await maker.quote(rfq, { payout: (BigInt(rfq.stake) * 18n) / 10n }); // placeholder price
}
});
When a taker accepts a quote, the SDK checks the terms against the price you published and signs them
within the 2-second deadline. You write no confirm code. lastLook is optional; leave it out to confirm every
accept. A new quote or bid while an accept of your quote is being answered waits for that answer, then
publishes. If a separate process confirms for this one, pass autoConfirm: false here.
Set up the maker first (Market making).
examples/onboard.mjs onboards a maker headless, and examples/node-bot.mjs is a fuller bot.
environment |
REST | WebSocket |
|---|---|---|
"production" |
https://hip4-api.totalis.trade |
wss://hip4-ws.totalis.trade |
"staging" |
https://hip4-api-staging.totalis.trade |
wss://hip4-ws-staging.totalis.trade |
Staging runs on Hyperliquid testnet (Staging). Pass
baseUrl to point at another origin.
Money is atomic USDC (6 decimals): 25_000_000n is 25 USDC.
| Import | Holds |
|---|---|
@totalis/hip4-client |
createClient, createTotalis, errors, pagination, TotalisStream, the money and UI helpers |
.../maker |
createMaker, createMakerClient, maker onboarding |
.../wallet-session |
signInWithWallet, signOutWallet |
.../partner |
signAdmissionConsent, createPartnerServer |
.../api-keys |
Issuing, rotating, listing and revoking keys |
.../typed-data |
Builders and hashing for every signed message |
.../signer |
toTotalisSigner |
.../realtime |
TotalisStream and the frame types |
.../errors |
The error registry, ApiError, NetworkError |
The package ships runnable examples in examples/:
| File | Shows |
|---|---|
onboard.mjs |
Headless maker onboarding: sign in, open and admit the maker, issue its key, deposit, start the bot |
node-bot.mjs |
A maker bot that quotes entries, buys back cash-outs and confirms acceptances |
browser-wallet.html, browser-wallet.mjs |
Opening and cashing out from an injected wallet, with no bundler |
partner-frontend.mjs |
A partner page that collects consent, signs a wallet in and trades |
partner-server.mjs |
A partner server that admits a wallet with its tpk_ key |
The SDK follows semver. See CHANGELOG.md.
Apache-2.0
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.