Reference

TypeScript SDK

The client library for wallets and apps (preview).

Preview

The SDK is being prepared alongside the programs. The API below is the planned shape and may change before the first release; nothing is published to npm yet.

Install

terminal
pnpm add @crepus/sdk @solana/web3.js

Derive keys from a wallet signature

keys.ts
import { deriveStealthKeys } from "@crepus/sdk";

// One signature by the user's wallet; the same wallet always rebuilds the same keys.
const keys = await deriveStealthKeys(wallet);
keys.metaAddress; // "st:sol:<K>:<V>"

Pay a .sol name

send.ts
import { Crepus } from "@crepus/sdk";

const crepus = new Crepus({ connection });

const { transaction, stealthAddress } = await crepus.buildPayment({
  to: "bob.sol",          // or a meta-address
  amount: 2.5,            // in SOL, or pass mint for SPL tokens
  payer: wallet.publicKey,
});

await wallet.sendTransaction(transaction, connection);

Scan and sweep

receive.ts
const payments = await crepus.scan({ viewingKey: keys.viewing, since: lastSlot });

for (const p of payments) {
  const ix = crepus.buildSweep({ payment: p, spendingKey: keys.spending, to: freshWallet });
  await crepus.relay(ix); // the relayer pays the fee
}

Under the hood these follow exactly the math on How it works. The demo on the website runs the same derivation with @noble/ed25519.