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 a signed origin builder code,
which 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. In your own flow, use prepareEntryFunding, then signEntry({ quote, prepared })
(Resume and retry).
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 in production and 998 on staging.
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.
An entry quote can be accepted until its accept_before, 14 seconds before its expiry, which leaves time for the
maker to confirm and the trade to land. Every prompt spends that time, so sign at once. bestQuote() keeps the
highest payout whose accept_before is still ahead on the venue’s clock. To pick from your own list, pass that
clock: bestQuote()(quotes, totalis.stream.serverNow()), or the serverNowMs that watchQuotes gives you.
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 within refreshMs. 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 after the maker confirms, and only before the
acceptance’s fund_by, two seconds after the confirm. An accept the maker declines, or that times out, moves
nothing. If the wallet still lacks the funding when the trade is sent, nothing trades: the operation ends
EXPIRED_UNEXECUTED and the RFQ FAILED with terminal_reason INSUFFICIENT_CASH. 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 maker confirms, 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 asWALLET_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 resending it at
fund_by.
recoverAcceptance resends only the same bytes, only before fund_by. 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.
Staging runs no exits to HyperCore, so exitToCore and returnToCore fail there
(Staging).
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, 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:
accept_before. A withdrawal asks the device for its payout. Granting, revoking and issuing the API
key need a wallet session, so run them while the user is signed in.
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. Its requests spend your share of rate limits. Payouts, reports and other accounts are on Builder codes.If something is switched off
Accounts in the Totalis app are never affected.

