Tessera
Try the demo
[S0]SDK · TypeScript · Edge runtime

The Tessera SDK. Credit-aware agents in 3 lines.

@tessera/sdk is a TypeScript client for any Node.js or Edge runtime. Bring your own viem WalletClient — addresses, subgraph URL, and link generators are all preset for Base mainnet via TESSERA_BASE_MAINNET.

installbash
npm install @tessera/sdk viem
Runtime
Node + Edge
works anywhere
Signer
Any viem
bring your own
Preset
Base mainnet
all addresses included
[01]

In 30 seconds.

Three lines of config gets you on the rails. The SDK ships with every address, subgraph URL, and link generator preset for Base mainnet — no manual wiring.

agent.tstypescript
import { Tessera, TESSERA_BASE_MAINNET } from "@tessera/sdk";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const wallet = createWalletClient({
  account: privateKeyToAccount(process.env.AGENT_PK as `0x${string}`),
  chain: base,
  transport: http(),
});

const tessera = new Tessera({
  ...TESSERA_BASE_MAINNET,
  walletClient: wallet,
});

// Read your agent's current credit picture
const profile = await tessera.getAgentProfile(wallet.account.address);
console.log("Computed limit:", profile.creditLimit);   // Phase 1
[02]

What you get.

One client, four surface areas. Same instance handles writes, subgraph reads, deep-link generators, and async watchers — so your agent code reads top-to-bottom without juggling clients.

On-chain writes

drawCredit · repayCredit · deposit · redeem

Single-method calls for every credit + vault operation. Returns a tx hash you can await with the built-in watchers.

Subgraph reads

getAgentProfile · getReputationScore · recentInvoices

Same indexed data the underwriter reads. No GraphQL boilerplate, no schema management — typed responses.

Link generators

getPayLink · getProfileLink · getPayMeLink

URL helpers for every Tessera surface. Use anywhere — no wallet required, server-safe.

Async watchers

waitForDraw · waitForRepay · waitForFunded

Promise-based waiters for tx finality. Drop into agent automation pipelines without manual polling.

Auth · SIWE-compatible

signInWithTessera · verifyTesseraSession

One call gets a dapp cryptographic proof of an agent's wallet plus their full Tessera profile. Drop-in OAuth for the agent economy.

[03]

Core API.

The minimal vocabulary your agent needs. Full TypeScript types ship with the package; everything else is in the SDK reference.

Credit operations

credit.tstypescript
// Phase 1 — simulated today via /demo
await tessera.drawCredit(amountUsdc);
await tessera.repayCredit(amountUsdc);

// Read your live limit + utilization
const { creditLimit, drawn, available } =
  await tessera.getAgentProfile(address);

Settlement primitives

settlement.tstypescript
// Originator
await tessera.createInvoice({
  buyer: "0x…",
  faceValueUsdc: 1000n * 10n ** 6n,
  maturityUnix: Math.floor(Date.now() / 1000) + 14 * 86400,
  discountBps: 300,                        // 3%
});

// Buyer
await tessera.repayInvoice(invoiceId);

// Lender vault
await tessera.deposit(amountUsdc);
await tessera.redeem(shares);

Reads + helpers

reads.tstypescript
// Subgraph reads
const profile = await tessera.getAgentProfile(address);
const score   = await tessera.getReputationScore(address);
const recent  = await tessera.recentInvoices({ agent: address, limit: 25 });

// Link generators — no wallet required, edge-safe
tessera.getPayLink(invoiceId);             // /pay/<id>
tessera.getProfileLink(address);           // /a/<address>
tessera.getPayMeLink(address);             // /pay-me/<address>

// Async watchers — for agent automation
await tessera.waitForFunded(invoiceId,  { timeoutMs: 60_000 });
await tessera.waitForRepaid(invoiceId,  { timeoutMs: 60_000 });
await tessera.waitForDraw(drawId,       { timeoutMs: 60_000 });
[04]

Sign in with Tessera.

One SDK call gets a dapp cryptographic proof an agent owns the wallet (standard EIP-4361 SIWE) plus their full Tessera profile — ecosystem, score, credit tier, history. The OAuth of the agent economy.

Client — request a signed session

client.tstypescript
import { signInWithTessera } from "@tessera/sdk";
import { useWalletClient } from "wagmi";

const { data: walletClient } = useWalletClient();

const session = await signInWithTessera(walletClient, {
  statement: "Sign in to MyAgentApp to verify your Tessera identity.",
});

// session = {
//   address, domain, uri, chainId, nonce,
//   issuedAt, expiresAt,
//   message,           // EIP-4361 SIWE message
//   signature,         // standard ECDSA hex
//   profile: { ecosystem, score?, tier?, creditLineEstimate? }
// }

Server — verify the session

Two options — verify locally with the SDK (zero network calls), or POST to our hosted endpoint if your runtime can’t bundle viem.

server-local.tstypescript
// Option A — verify with the SDK (recommended)
import { verifyTesseraSession } from "@tessera/sdk";

const result = await verifyTesseraSession(session, {
  expectedDomain: "myagentapp.com",  // pin to your domain
  maxAgeSeconds: 3600,               // reject sessions older than 1h
});

if (!result.valid) throw new Error(`unauthorized: ${result.reason}`);
// result.address is the verified wallet — trust it.
server-remote.tstypescript
// Option B — POST to the Tessera hosted endpoint
const res = await fetch("https://www.tesseracredit.com/api/auth/verify", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    session,
    options: { expectedDomain: "myagentapp.com", maxAgeSeconds: 3600 },
  }),
});
const { valid, address, reason } = await res.json();
if (!valid) throw new Error(`unauthorized: ${reason}`);
Try it live /signin runs the full round-trip in-browser. Connect a wallet, sign once, watch the session JSON + verify response render side-by-side.
[05]

Built for agent runtimes.

Edge runtime safe

Tree-shakes cleanly. No filesystem, no Node-only APIs. Ships into Vercel Edge, Cloudflare Workers, Deno, you name it.

Bring your own signer

Accepts any viem WalletClient. Works with browser-injected, Coinbase Smart Wallet, WalletConnect, hosted keystores, MPC.

Zero vendor lock-in

Pure functions over public addresses + a public subgraph. Read everything the SDK reads with your own GraphQL client or RPC.

MCP server — a drop-in Model Context Protocol integration for Claude, Cursor, and other agent frameworks — is on the Phase 2 roadmap. Wraps every method above as a native tool. Watch the repo for release.