The SDK refuses to send a server key from a browser, and refuses a server key as the browser key. The API
refuses an admission that carries an
Origin header.
Onboard a user
1
The wallet consents to you, in your frontend
personal_sign message naming your slug, the wallet, the environment, the chain and an
expiry. It authorizes no financial action:lifetimeSeconds changes it, within the
limit.2
Your server admits the wallet
3
The wallet signs in
4
The wallet trades
totalis has the same flows as any account: openPosition, cashOut, withdraw. See
Trading, Withdrawals and the
SDK.Which wallets can sign in
The
signer is any EIP-1193 provider, viem account or wallet client, or ethers signer. Trade signatures accept
ERC-1271, but sign-in does not.
A Totalis app user’s wallet is embedded inside the Totalis app (wallet_kind: EMBEDDED), so they have no wallet to sign in with
on your site. To trade through your product they create an API key in the
Totalis app, or export their wallet key
(Wallet key). An account created in the Totalis app is not admitted by
you, so its RFQs are attributed to you only with your origin code, sent from a browser on your registered origin
(How a code counts). That needs the user to sign in on your
page with their exported wallet key. RFQs it sends with an API key cannot be attributed to you.
Sessions
The SDK calls Create wallet challenge, Create wallet session and End wallet session.
A browser sets
Origin itself. Outside a browser, pass origin, one of your registered origins, to
signInWithWallet and signOutWallet, and send it as the Origin header on every later call and stream
(headers on createTotalis).
Origins and CORS
The API answers CORS from your registered origins. Preflights allowAuthorization, Content-Type,
Idempotency-Key, traceparent and X-Totalis-Partner, and expose Idempotency-Replayed, Retry-After and
X-Request-ID.
To add or remove an origin, email founders@totalis.trade.
Funding
readComboCash(). Its allowance counts
vault cash, HyperEVM USDC and the HyperCore USDC a bridge can move, after Hyperliquid’s setup fee and the bridge’s
gas. Pass the read as cash and its offeredCore as core to openPosition
(How much one Combo can stake).
Signatures and quote life
An entry takes one to three signatures, depending on where the stake comes from.openPosition asks for the
funding ones first, while quotes arrive, then for TakerAccept once it has picked the quote, and sends the accept
at once. The wallet’s USDC needs no signature per entry, only a permit once, when the approval left is short. To ask for that permit at sign-up instead of at the first bet, call
approveWallet({ value }). In your own flow, use prepareEntryFunding, then signEntry({ quote, prepared })
(Sign the funding first).
signEntry without prepared asks for them all at once.
Every one of them, the Hyperliquid bridge included, names the deployment’s chain:
chain_id in
Get deployment, 999.
Some extension wallets refuse to sign for a chain other than the one they are on. Switch the wallet to HyperEVM
before the first prompt.
The SDK does not time quotes: a quote stays takeable while watchQuotes lists it, and bestQuote()(quotes) picks
the highest payout from a list. Over the HTTP API too, every listed quote can be accepted
(Accept).
Makers replace a quote when they renew it, and the venue keeps one live quote per maker, so an accept can arrive
after its quote was replaced (QUOTE_REPLACED). Pick the quote as late as you can, after the funding is signed. If
it is gone, nothing traded: take the best quote still paying what you showed the user and sign again.
openPosition does this for you, up to maxAttempts, waiting up to quoteTimeoutMs for each quote. When every
retry needs a wallet prompt, consider one attempt and let the user press again.
The accept goes first. The bridge from HyperCore goes only once the accept answers ACCEPTED, and only within
4 seconds of sending the accept (fundWindowMs). The venue waits at least 6 seconds from the accept’s arrival for
the wallet’s USDC. An accept the maker declines, or that times out, moves nothing. If the wallet’s USDC or its
approval still falls short when the trade is sent, nothing trades: the operation ends EXPIRED_UNEXECUTED, the RFQ
FAILED with reason INSUFFICIENT_CASH, and the acceptance’s reason is INSUFFICIENT_WALLET_USDC or
INSUFFICIENT_APPROVAL. Pass cash, a spendableCash read you already hold, to skip a balances read
on the press.
If an entry fails after its bridge
The bridge and the accept are separate. The bridge is a HyperCore action that moves USDC from the user’s HyperCore spot balance to their wallet on HyperEVM. The accept is the HyperEVM transaction that takes the stake. The bridge moves only after the accept answersACCEPTED, so a declined, timed-out or refused accept moves nothing. When the
maker confirmed but the trade does not execute, nothing trades and the vault takes nothing, and a bridge that
already landed stays landed: its USDC is now in the wallet on HyperEVM, not in the user’s HyperCore balance. Get
balances shows it as WALLET_USDC. This happens when the operation ends REVERTED or EXPIRED_UNEXECUTED. The SDK
names the amount as bridged on the result, so show it as wallet cash rather than as gone.
A bridge whose answer never arrived can still land after the SDK stops waiting for it,
fundWindowMs after the
accept. recoverAcceptance never sends a bridge: it discards one never sent and leaves a sent one SENT. Read the balances to learn where the cash is;
never infer it from a missing answer.
Moving cash to HyperCore
An external wallet’s vault cash, including a wallet embedded in your own app, is not swept to HyperCore in the background. Before a native HyperCore order, move it:Exit, and Totalis pays the gas (Create HyperCore exit,
Get HyperCore exit). One move at a time per account: another is
CORE_MOVE_IN_FLIGHT.
returnToCore() moves all of the account’s available cash back together: free vault cash, plus the wallet’s
available USDC on HyperEVM. Available wallet USDC is WALLET_USDC less pending.wallet_reserved
(Get balances); USDC reserved for work in flight stays in the
wallet. It takes no amount. The wallet signs a USDC ReceiveWithAuthorization that deposits its available USDC
into the vault, then one Exit of that plus the free vault cash. Totalis pays the gas for both, so the wallet
needs no HYPE. When the available wallet USDC is under the
sponsored deposit minimum, it stays in the wallet and
only the free vault cash moves. To move a chosen amount, use exitToCore.
The first credit to a HyperCore account that does not exist yet pays Hyperliquid’s activation fee, so it has a
higher minimum (Limits). Until the user accepts that
1 USDC fee, exitToCore and returnToCore fail with 409 CORE_ACCOUNT_ACTIVATION_REQUIRED. Pass
activationFeeAccepted: true once they accept it.
Withdrawals
Withdrawals and exits to HyperCore are sponsored. For an account that signs in with an external wallet they share one minimum and one hourly count (Limits).Vault agents
A vault agent is a key the account’s wallet approves once. Until the grant ends, the agent signs the account’s entry accepts, cash-outs and moves of vault cash back to the account, so those need no wallet prompt. It works for the Totalis vault the way a Hyperliquid agent wallet works for HyperCore orders. Which messages it can sign is in Every signature. The wallet still signs everything that moves USDC out of the wallet, out of HyperCore or to another address.1
The wallet grants the agent, from a wallet session
2
The agent signs
signer stays required: the SDK reads the account from it, and asks it for every message the agent cannot
sign. openPosition asks the wallet for any funding first, while quotes arrive (only a permit when the
approval left is short, and any bridge from HyperCore), and the agent signs the accept as soon as a quote
is picked.
An agent cannot send cash anywhere but the account’s own wallet or HyperCore. It can still spend the account’s
vault cash on positions, including against a maker its holder controls, and sell the account’s positions at any
price. Make a separate agent for each account, keep its key secret, and revoke it when the user disconnects or
the key may have leaked.
Agent on your server, wallet on the device
Your server can hold the account’s API key and its agent while the wallet stays on the user’s device. GivecreateTotalis a signer that names the account and sends each wallet message to the device:
Every signature
Each action the wallet signs, and what it signs. With a vault agent, the agent signs the messages in the Agent column in the wallet’s place. Typed data iseth_signTypedData_v4; the full domains and types
are on Domain and Types. Read the
values from Get deployment.
The bridge’s domain is Hyperliquid’s: its
verifyingContract is the zero address. If your signing policy
allowlists verifying contracts, add the zero address on chain_id for HyperliquidTransaction:SendAsset only.
Signing on your server
If your server signs for your users, for example through a server wallet API such as Privy’s, your server is the only thing between a user’s click and their money. A policy that allows a primary type allows every message of that type: an allowedTransferWithAuthorization pays anyone.
-
Sign only the message you built. For each request, build the expected typed data on your server, for the
authenticated user and the action they confirmed in your UI, with the SDK’s builders.
Sign only when the request equals it in full: domain, primary type and every field, the nonce included.
Comparing the two
hashTypedDatadigests checks all of it at once. Checking a few fields is not enough: a deposit names the account it credits only inside its nonce. - One user, one signer. Resolve the wallet from the user’s own authenticated request every time. Never fall back to a shared or default wallet. Each user signs in with their own wallet and keeps their own Totalis session token.
-
Policies are a backstop, not the check. Restrict
chainIdandverifyingContractper message as in the table above. A policy that compares message fields against atypesmap needs that map exactly as your signer sends it.
signer you give it, so a server signer is any viem account, viem wallet
client or ethers signer that calls your wallet API.
Attribution and revenue share
An account you admit is yours for good. The partner is fixed when the account is created, so a copied browser key cannot move it to another partner. Every RFQ from the account records your account code, whatever credential it uses: its session, or an API key it issued. You send no builder fields for it. Its requests spend your share of rate limits. An account you did not admit is attributed only RFQ by RFQ, when your page sends your origin code from your registered origin: pass it toopenPosition as builderCode. No signature is needed, and the code costs the user
nothing. Its API key RFQs are never yours. The cases and revocation are on
Builder codes, with payouts and reports.
If something is switched off
Accounts in the Totalis app are never affected.

