SDK
One ES module with one dependency (viem). It reads the registry and builds unsigned transactions; it never needs a key.
Install
Download /sdk/depth-sdk.mjs (the deployed addresses are filled in) and npm i viem. It runs in Node 18+, browsers and edge runtimes.
Use
import { createDepth } from "https://depth.example/sdk/depth-sdk.mjs"; // or copy the file, npm i viem
const depth = createDepth();
const all = await depth.listAgents(); // every agent, tier, limits, NAV, drawdown
const a = await depth.depthOf("0xAgentKeyOrVault"); // { registered, tier, meters, limits, ... }
if (!a.registered || a.tier < 1) throw new Error("not deep enough to trust with 100 USDG");
// unsigned transactions: approve + create, then the agent key's trade call
const txs = depth.registerCalldata({ name: "dca-01", agentKey: "0x…", usdg: "5" });
const tx = depth.tradeCalldata({ vault: a.vault, venue: "eth", tokenIn: "USDG", tokenOut: "ETH",
amountIn: "500000", minOut: "0", reason: "DCA: 0.50 USDG of ETH, hour 14 UTC" });Functions
| Function | Returns |
|---|---|
listAgents() | Every agent with tier, metres, limits, NAV, peak, drawdown, trades, breaches, volume, fees |
agent(id) | The same plus promotion eligibility and the reason when not eligible, and the breach state |
depthOf(address) | The agent behind an agent key, a vault or an owner |
trades(id, limit) | Trade log with reasons, newest first |
history(id) | Promotions and surfacings |
registerCalldata(...), tradeCalldata(...) | Unsigned transactions |
depth