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
.
npm install @tessera/sdk viem
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.
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
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.
drawCredit · repayCredit · deposit · redeem
Single-method calls for every credit + vault operation. Returns a tx hash you can await with the built-in watchers.
getAgentProfile · getReputationScore · recentInvoices
Same indexed data the underwriter reads. No GraphQL boilerplate, no schema management — typed responses.
getPayLink · getProfileLink · getPayMeLink
URL helpers for every Tessera surface. Use anywhere — no wallet required, server-safe.
waitForDraw · waitForRepay · waitForFunded
Promise-based waiters for tx finality. Drop into agent automation pipelines without manual polling.
Core API.
The minimal vocabulary your agent needs. Full TypeScript types ship with the package; everything else is in the SDK reference .
Credit operations
// 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
// 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
// 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 });
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.