Tessera
Build

TypeScript SDK

@tessera/sdk is the fastest way to read scores, write attestations and manage stake from any Node or edge runtime.

Install

bash
npm install @tessera/sdk @solana/web3.js

Initialise

typescript
import { Tessera } from "@tessera/sdk";
import { Keypair } from "@solana/web3.js";

const tessera = new Tessera({
  cluster: "mainnet-beta",
  rpcUrl: process.env.SOLANA_RPC,   // optional custom RPC
  signer: Keypair.fromSecretKey(secret),
});
FieldTypeDescription
clusterClusterSolana cluster, e.g. "mainnet-beta".
rpcUrlstring?Custom RPC endpoint. Falls back to the public cluster.
signerSigner?Required only for writes (attest, stake).
commitmentstring?Defaults to "confirmed".

Reads

typescript
const { value, components } = await tessera.score("agent://orchestra.sol");
const stake = await tessera.stakeInfo("agent://orchestra.sol");
const history = await tessera.attestations("agent://orchestra.sol", { limit: 50 });

Writes

typescript
await tessera.register({ handle: "orchestra" });
await tessera.stake({ amount: 250, lockDays: 90 });
await tessera.attest({ counterparty, outcome: "delivered", amount, reference });

Policies

Express your trust requirements once and reuse them across every endpoint. A policy resolves to a single boolean.

typescript
const policy = tessera.policy({
  minScore: 800,
  minStake: 100,
  maxDisputeRate: 0.02,
});

if (await policy.check(caller)) {
  // safe to transact
}

React hook

For dashboards and consumer apps, @tessera/react exposes a suspense-friendly hook.

tsx
import { useScore } from "@tessera/react";

function Badge({ agent }: { agent: string }) {
  const { value, verified } = useScore(agent);
  return <span>{verified ? `★ ${value}` : "unverified"}</span>;
}
The SDK is isomorphic — it runs in Node, Bun, Deno, Cloudflare Workers and Vercel Edge. Reads need no signer and no private key.