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://hip4.totalis.trade, orhttps://hip4-staging.totalis.tradeon 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 yourtpk_ key.
signAdmissionConsent returns the wallet’s address and its consent, and takes an optional
lifetimeSeconds. createPartnerServer refuses to run in a browser, 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.
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).
