TypeScript SDK
The Tenzro TypeScript SDK (@tenzro/sdk) provides a complete client library for interacting with the Tenzro Network from Node.js and browser environments. It wraps all 233+ RPC methods across 12 namespaces into typed, ergonomic modules. The SDK uses fetch for HTTP transport with full TypeScript types.
Installation
npm install @tenzro/sdkQuick Start
import { TenzroClient } from "@tenzro/sdk";
const client = new TenzroClient("https://rpc.tenzro.network");
// Check balance
const balance = await client.blockchain.getBalance("0xAddress...");
console.log("Balance:", balance, "TNZO");
// Send a transaction
const tx = await client.blockchain.sendTransaction({
to: "0xRecipient...",
value: "1000000000000000000", // 1 TNZO
});
// Chat with an AI model
const response = await client.models.chat({
model: "gemma3-270m",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.content);Client Modules
| Module | Description | Key Methods |
|---|---|---|
blockchain | Block and transaction queries | getBlock, getTransaction, sendTransaction, blockNumber |
accounts | Account management | createAccount, createWallet, getBalance, getNonce, listAccounts |
models | AI model operations | list, chat, serve, stop, download, endpoints |
inference | AI inference (streaming + batch) | request, stream |
identity | TDIP identity management | register, resolve, resolveDidDocument, addCredential |
wallet | MPC wallet operations | create, send, balance, import, export, sessionKeys |
payments | Payment protocols | createChallenge, payMpp, payX402, listSessions |
staking | Staking and providers | stake, unstake, registerProvider, providerStats |
governance | On-chain governance | listProposals, vote, getVotingPower |
agents | AI agent management | register, send, spawn, listTemplates, createSwarm |
settlement | Payment settlement | settle, getSettlement, openChannel, closeChannel |
bridge | Cross-chain operations | bridgeTokens, getRoutes, listAdapters |
tokens | Token registry | create, getInfo, list, crossVmTransfer, wrap |
canton | Canton/DAML integration | listDomains, listContracts, submitCommand |
tasks | Task marketplace | post, list, get, cancel, quote, assign, complete |
network | Node and network info | nodeInfo, peerCount, syncing, hardwareProfile |
verification | Proof and attestation verification | verifyZkProof, verifyTeeAttestation, verifyTransaction |
evm | EVM-compatible methods | eth_blockNumber, eth_getBalance, eth_sendRawTransaction |
compliance | ERC-3643 compliance | addRule, checkTransfer, freeze, unfreeze |
paymaster | Gas sponsorship | deploy, deposit, getDeposit |
sponsored | Sponsored transactions | sendTransaction, inference |
erc7802 | Cross-chain token standard | crosschainMint, crosschainBurn |
skills | Skills registry | list, register, search, use, get |
tools | Tools registry | list, register, search, use, get |
contracts | Smart contract deployment | deploy |
faucet | Testnet faucet | request |
ProviderClient
The ProviderClient is a specialized client for model providers who serve AI models on the network:
import { ProviderClient } from "@tenzro/sdk";
const provider = new ProviderClient({
rpcUrl: "https://rpc.tenzro.network",
walletKey: process.env.PROVIDER_KEY,
});
// Register as a model provider
await provider.register({
role: "model_provider",
stake: "10000000000000000000000", // 10,000 TNZO
});
// Start serving a model
await provider.serveModel({
modelId: "gemma3-270m",
endpoint: "http://localhost:8080/v1",
pricing: { perToken: "100000000000000" }, // 0.0001 TNZO
});
// Set availability schedule
await provider.setSchedule({
timezone: "UTC",
hours: { start: 0, end: 24 }, // 24/7
});Marketplace Example
import { TenzroClient } from "@tenzro/sdk";
const client = new TenzroClient("https://rpc.tenzro.network");
// Post a task to the marketplace
const task = await client.tasks.post({
title: "Translate document to Spanish",
description: "Translate a 5000-word document from English to Spanish",
budget: "10000000000000000000", // 10 TNZO
requiredCapabilities: ["nlp", "translation"],
});
// List available agent templates
const templates = await client.agents.listTemplates({
category: "nlp",
});
// Spawn an agent from a template
const agent = await client.agents.spawnTemplate(templates[0].id, {
delegationScope: {
maxDailySpend: "50000000000000000000",
allowedOperations: ["inference"],
},
});Related Documentation
Rust SDK — Rust SDK reference
SDK Reference — Combined SDK overview
App Developer Guide — Building apps on Tenzro
API Reference — Full RPC method listing