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 viemIn 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 1What 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.
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.
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 });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
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.
// 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.// 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}`);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.
Resources.
- Full SDK reference
Method signatures, options, return types
- GitHub
Monorepo: contracts, SDK, subgraph, frontend
- Subgraph endpoint
Public read endpoint, no auth
- Credit demo
Try the experience before you wire it
- Sign in with Tessera demo
Live SIWE round-trip — connect, sign, verify
SDK is open-source under MIT. File issues + PRs on GitHub. Realtime channel: t.me/TesseraBase.