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.

[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]

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.