Skip to main content
In your own frontend, each user trades with their own wallet. They sign in to get a session, and that session plus the wallet is all createTotalis needs. How the pieces fit is on Your users’ own wallets.

Sign in with a wallet

signInWithWallet asks for a challenge, checks it is the Totalis sign-in for this origin, wallet and request, has the wallet sign it, and returns the session. Outside a browser, pass origin and send the same value as the Origin header with every request on the session:
  • A partner’s wallet uses the partner’s registered origin.
  • A maker uses the Totalis app’s origin: https://app.totalis.trade, or https://hip4-staging.totalis.trade on staging.

Admit a wallet

A partner’s wallet must be admitted before it can trade. The wallet consents in the browser, and your server admits it with your tpk_ key.
signAdmissionConsent returns the wallet’s address and its consent, and takes an optional lifetimeSeconds. createPartnerServer refuses to run in a browser or a React Native app, so the server key cannot leak there. See Partner frontend.

Deposit

Move cash to HyperCore

exitToCore moves vault cash to HyperCore. Store exit.exit_id if the process may restart: after one, waitForCoreExit(exitId) follows it. signCoreExit and sendCoreExit split it into sign and send. returnToCore() takes no amount. It moves free vault cash and the wallet’s available USDC (WALLET_USDC less pending.wallet_reserved) back to HyperCore. Available wallet USDC under the sponsored deposit minimum (Limits) stays in the wallet. signReturnToCore and sendReturnToCore split it. returnToCore throws for a Totalis app wallet (wallet_kind: EMBEDDED on GET /v1/me). A wallet embedded in your own app is EXTERNAL and can use it. Staging runs no exits to HyperCore, so both functions throw ExitUnavailableError there, before anything is signed.

Vault agents

agent takes the same signer shapes as signer. Its grant rules, risk and a server-side setup are on Vault agents.

Issue a key from a session

totalis.issueApiKey({ label, scopes }) issues the account’s own ttk_ key from a wallet session, with the wallet’s approval. rotateApiKey replaces one. Makers issue their keys with the .../api-keys helpers instead (Onboard headless).