SDK
One ES module, served by this site, that runs the app's own code in the browser or in Node: key derivation, scanning, proving, relaying and disclosure.
curl -O https://<site>/sdk/talos.mjs npm i viem snarkjs poseidon-lite @noble/curves @noble/ciphers @noble/hashes
| deriveKeys(signature) | Your keypair from the wallet signature of KEY_MESSAGE |
| shieldedAddress(keys) | Your shielded address (ts_...), to receive private sends |
| poolContext({ client, asset, origin }) | A pool (usdc or hype) read through this site's feed and proving files |
| fetchEvents(ctx) | The pool's public events, to rebuild the tree |
| scan(keys, events) | Your notes, spent notes and balance, opened locally |
| prepareShield | Proof and wallet calls (approve, then transact) for a shield |
| prepareSend | Proof for a private send to a shielded address |
| prepareSwap | Proof with the swap action bound (v4 pool, minOut, deadline, one-time owner key) |
| prepareWithdraw | Proof for a withdrawal to any address, with the relayer fee and gas drop |
| relayerQuote(origin) | The relayer's address and fees |
| relay(origin, pool, prepared) | Sends a proved transaction through the relayer and waits for the receipt |
| disclose({ client, chainId, pools, keypair, notes, tx }) | The disclosure file for one of your transactions |
| verifyDisclosure(client, file) | Checks a disclosure or a trace against the chain, returns each check |
import * as talos from './talos.mjs'
import { createPublicClient, http } from 'viem'
const origin = 'https://<site>'
const client = createPublicClient({ transport: http('https://rpc.elysium.kinetiq.xyz') })
const keys = talos.deriveKeys(await wallet.signMessage({ message: talos.KEY_MESSAGE }))
const ctx = talos.poolContext({ client, asset: 'usdc', origin })
const events = await talos.fetchEvents(ctx)
const mine = talos.scan(keys, events)
const q = await talos.relayerQuote(origin)
const p = await talos.prepareWithdraw({
ctx, keypair: keys, wallet: mine, events, recipient: '0x...', amount: 100_000000n,
relayer: q.relayer, fee: BigInt(q.pools.usdc.withdraw), refund: BigInt(q.gasDrop),
})
const { hash } = await talos.relay(origin, ctx.pool, p)Proving loads /zk/talos_tx.wasm and /zk/talos_tx.zkey from the site (about 10 MB, cached by the browser after one proof). Pass local paths in Node.
Talos