@telaro/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/QUICKSTART.md +216 -0
- package/README.md +129 -0
- package/dist/accounts.d.ts +51 -0
- package/dist/accounts.d.ts.map +1 -0
- package/dist/accounts.js +169 -0
- package/dist/accounts.js.map +1 -0
- package/dist/api.d.ts +177 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +158 -0
- package/dist/api.js.map +1 -0
- package/dist/borsh.d.ts +33 -0
- package/dist/borsh.d.ts.map +1 -0
- package/dist/borsh.js +100 -0
- package/dist/borsh.js.map +1 -0
- package/dist/client.d.ts +70 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +164 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +46 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +47 -0
- package/dist/constants.js.map +1 -0
- package/dist/credit.d.ts +61 -0
- package/dist/credit.d.ts.map +1 -0
- package/dist/credit.js +133 -0
- package/dist/credit.js.map +1 -0
- package/dist/decimal.d.ts +36 -0
- package/dist/decimal.d.ts.map +1 -0
- package/dist/decimal.js +87 -0
- package/dist/decimal.js.map +1 -0
- package/dist/discriminators.d.ts +86 -0
- package/dist/discriminators.d.ts.map +1 -0
- package/dist/discriminators.js +100 -0
- package/dist/discriminators.js.map +1 -0
- package/dist/events.d.ts +268 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +223 -0
- package/dist/events.js.map +1 -0
- package/dist/format.d.ts +10 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +39 -0
- package/dist/format.js.map +1 -0
- package/dist/hash.d.ts +9 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +33 -0
- package/dist/hash.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/instructions.d.ts +368 -0
- package/dist/instructions.d.ts.map +1 -0
- package/dist/instructions.js +841 -0
- package/dist/instructions.js.map +1 -0
- package/dist/metaplex.d.ts +64 -0
- package/dist/metaplex.d.ts.map +1 -0
- package/dist/metaplex.js +123 -0
- package/dist/metaplex.js.map +1 -0
- package/dist/pda.d.ts +35 -0
- package/dist/pda.d.ts.map +1 -0
- package/dist/pda.js +84 -0
- package/dist/pda.js.map +1 -0
- package/dist/realtime.d.ts +67 -0
- package/dist/realtime.d.ts.map +1 -0
- package/dist/realtime.js +112 -0
- package/dist/realtime.js.map +1 -0
- package/dist/score.d.ts +51 -0
- package/dist/score.d.ts.map +1 -0
- package/dist/score.js +63 -0
- package/dist/score.js.map +1 -0
- package/dist/types.d.ts +139 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +51 -0
- package/dist/types.js.map +1 -0
- package/package.json +88 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@telaro/sdk` will be documented in this file.
|
|
4
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the
|
|
5
|
+
project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0] — 2026-05-06
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- High-level `TelaroClient` — wraps register/record/claim/resolve/withdraw flows.
|
|
13
|
+
- `TelaroApi` typed HTTP client for the public REST API.
|
|
14
|
+
- `build*Ix` composable instruction builders (10 ixs).
|
|
15
|
+
- `buildRegisterAndBondIxs` two-ix helper for atomic register-and-bond.
|
|
16
|
+
- Deterministic Anchor instruction / event / account discriminators (sha256-derived).
|
|
17
|
+
- Borsh event decoder + typed payloads for all 8 program events.
|
|
18
|
+
- Reference scoring policy (`computeScore`) including `bond_ratio` component.
|
|
19
|
+
- PDA helpers (`findAgentPda`, `findClaimPda`, `findBondVaultPda`, …).
|
|
20
|
+
- Format helpers (`formatUsdc`, `formatPercent`, `formatRelativeTime`, `shortenPubkey`).
|
|
21
|
+
- Subpath exports: `./score`, `./pda`, `./api`.
|
|
22
|
+
- Isomorphic SHA-256 via `@noble/hashes` (works in Node, browsers, edge runtimes).
|
|
23
|
+
- Quick-start docs for three audiences: DApp consumer, framework integrator, end user.
|
|
24
|
+
|
|
25
|
+
### Notes
|
|
26
|
+
- Program ID (devnet): `BondedAg3nts1111111111111111111111111111111`.
|
|
27
|
+
- Mainnet program ID reserved; deployment paused pending audit.
|
package/QUICKSTART.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Quickstart — `@telaro/sdk`
|
|
2
|
+
|
|
3
|
+
Three audiences, three patterns. Pick the one that matches what you're building.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @telaro/sdk @solana/web3.js @solana/spl-token
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Add this `overrides` block to your `package.json` first (needed on Node 20 — see [README](./README.md#-required-pin-rpc-websockets)):
|
|
10
|
+
|
|
11
|
+
```jsonc
|
|
12
|
+
{ "overrides": { "rpc-websockets": "9.1.1" } }
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 1. DApp consumer (just want to *read* trust data)
|
|
18
|
+
|
|
19
|
+
You're building a DApp that lists agents, gates capital delegation, or shows
|
|
20
|
+
trust badges. **No wallet, no Anchor, no Solana SDK needed** — just fetch.
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { TelaroApi, tierOf } from "@telaro/sdk";
|
|
24
|
+
|
|
25
|
+
const api = new TelaroApi("https://telaro.xyz");
|
|
26
|
+
|
|
27
|
+
// Find safe agents for our pool
|
|
28
|
+
const candidates = await api.listAgents({ minScore: 700, minBond: "1000000000" });
|
|
29
|
+
console.log(`${candidates.length} agents qualify for our LP delegation`);
|
|
30
|
+
|
|
31
|
+
// Drill into one
|
|
32
|
+
const agent = await api.agent("AgentSenda1JupiterLPv3...");
|
|
33
|
+
if (agent && !agent.agent.frozen) {
|
|
34
|
+
console.log(`✓ score=${agent.agent.score} bond=$${agent.agent.bond_human}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Embed Trust Card on your site
|
|
38
|
+
const cardUrl = api.cardUrl("AgentSenda1JupiterLPv3...");
|
|
39
|
+
// → https://telaro.xyz/api/card/AgentSenda1JupiterLPv3....png
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For **on-chain enforcement** in your own Anchor program, invoke `view_bond` via CPI:
|
|
43
|
+
|
|
44
|
+
```rust
|
|
45
|
+
use telaro::cpi::{view_bond, accounts::ViewBond};
|
|
46
|
+
|
|
47
|
+
view_bond(
|
|
48
|
+
CpiContext::new(telaro_program, ViewBond { agent: agent_account }),
|
|
49
|
+
1_000_000_000u64, // min_bond = 1000 USDC
|
|
50
|
+
700u16, // min_score
|
|
51
|
+
)?;
|
|
52
|
+
// reaches here only if agent meets policy → safe to delegate
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 2. Framework integrator (you build agent runtimes)
|
|
58
|
+
|
|
59
|
+
You're integrating Telaro into Sendai / Eliza / GOAT / your own framework
|
|
60
|
+
so every agent your users spin up gets bonded automatically.
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import {
|
|
64
|
+
TelaroClient,
|
|
65
|
+
ActionKind,
|
|
66
|
+
ActionOutcome,
|
|
67
|
+
hashAction,
|
|
68
|
+
} from "@telaro/sdk";
|
|
69
|
+
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
|
|
70
|
+
|
|
71
|
+
const connection = new Connection("https://api.devnet.solana.com");
|
|
72
|
+
const controller = Keypair.fromSecretKey(/* … */);
|
|
73
|
+
const rep = new TelaroClient(connection, controller);
|
|
74
|
+
|
|
75
|
+
// 1. One-time: register agent + post bond (single tx, two-ix)
|
|
76
|
+
await rep.registerAgent({
|
|
77
|
+
framework: "sendai",
|
|
78
|
+
metadataUri: "https://my-agent.example/metadata.json",
|
|
79
|
+
scorer: new PublicKey("ScorerPubkeyOfTheIndexer..."),
|
|
80
|
+
bondMint: new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), // mainnet USDC
|
|
81
|
+
bondAmount: 100_000_000n, // 100 USDC
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// 2. Every action: call recordAction. Add this hook to your framework's
|
|
85
|
+
// "after-tx" handler so it fires automatically.
|
|
86
|
+
await rep.recordAction({
|
|
87
|
+
payload: { type: "swap", inMint: "SOL", outMint: "USDC", amount: 1.0 },
|
|
88
|
+
kind: ActionKind.Swap,
|
|
89
|
+
outcome: ActionOutcome.Success,
|
|
90
|
+
valueAtomic: 50_000_000n, // ≈ $50 value-at-risk
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// 3. (Optional) preview a CPI policy check before delegating
|
|
94
|
+
const ok = await rep.previewViewBond(rep.agentPda(), 1_000_000_000n, 700);
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Want **browser/wallet-adapter** instead of node Keypair? Use the lower-level builders:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import { buildRecordActionIx, ActionKind, ActionOutcome, hashAction } from "@telaro/sdk";
|
|
101
|
+
import { useConnection, useWallet } from "@solana/wallet-adapter-react";
|
|
102
|
+
import { Transaction } from "@solana/web3.js";
|
|
103
|
+
|
|
104
|
+
function useRecord() {
|
|
105
|
+
const { connection } = useConnection();
|
|
106
|
+
const { publicKey, signTransaction } = useWallet();
|
|
107
|
+
|
|
108
|
+
return async (payload: unknown) => {
|
|
109
|
+
if (!publicKey || !signTransaction) throw new Error("connect wallet");
|
|
110
|
+
const ix = buildRecordActionIx(publicKey, {
|
|
111
|
+
actionHash: hashAction(payload),
|
|
112
|
+
kind: ActionKind.Swap,
|
|
113
|
+
outcome: ActionOutcome.Success,
|
|
114
|
+
valueAtomic: 50_000_000n,
|
|
115
|
+
});
|
|
116
|
+
const tx = new Transaction().add(ix);
|
|
117
|
+
tx.feePayer = publicKey;
|
|
118
|
+
tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;
|
|
119
|
+
const signed = await signTransaction(tx);
|
|
120
|
+
return connection.sendRawTransaction(signed.serialize());
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 3. End user (you got rugged and want your bond payout)
|
|
128
|
+
|
|
129
|
+
You used a bonded agent. It misbehaved. You want compensation.
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
import { TelaroClient, hashAction } from "@telaro/sdk";
|
|
133
|
+
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
|
|
134
|
+
|
|
135
|
+
const rep = new TelaroClient(connection, userKeypair);
|
|
136
|
+
|
|
137
|
+
// 1. File a claim with 5% deposit
|
|
138
|
+
await rep.submitClaim(
|
|
139
|
+
{
|
|
140
|
+
agent: new PublicKey("AgentRug2hiscustomframework..."),
|
|
141
|
+
actionHash: hashAction({ tx: "OffendingTxSignature...", ts: Date.now() }),
|
|
142
|
+
claimedAmount: 1_000_000_000n, // claim 1000 USDC
|
|
143
|
+
evidenceUri: "ipfs://bafy...", // public proof
|
|
144
|
+
},
|
|
145
|
+
USDC_MINT
|
|
146
|
+
);
|
|
147
|
+
// Now wait 7 days. If builder is silent, your bond payout auto-triggers.
|
|
148
|
+
|
|
149
|
+
// 2. After deadline, anyone (incl. you) can call AutoTimeout to release the payout
|
|
150
|
+
import { ResolveAction } from "@telaro/sdk";
|
|
151
|
+
|
|
152
|
+
await rep.resolveClaim({
|
|
153
|
+
agent: new PublicKey("AgentRug2hiscustomframework..."),
|
|
154
|
+
actionHash,
|
|
155
|
+
claimer: userKeypair.publicKey,
|
|
156
|
+
bondMint: USDC_MINT,
|
|
157
|
+
action: ResolveAction.AutoTimeout,
|
|
158
|
+
});
|
|
159
|
+
// USDC moves from agent's bond vault → your wallet. Score collapses.
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The web app at `telaro.xyz/agent/{pubkey}` exposes a no-code modal for this same flow.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Common helpers
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
import {
|
|
170
|
+
computeScore,
|
|
171
|
+
tierOf,
|
|
172
|
+
formatUsdc,
|
|
173
|
+
formatPercent,
|
|
174
|
+
shortenPubkey,
|
|
175
|
+
} from "@telaro/sdk";
|
|
176
|
+
|
|
177
|
+
const out = computeScore({
|
|
178
|
+
actionCount: 412n,
|
|
179
|
+
successCount: 401n,
|
|
180
|
+
disputedCount: 1n,
|
|
181
|
+
currentBond: 5_247_000_000n,
|
|
182
|
+
valueHandled30d: 21_400_000_000n,
|
|
183
|
+
});
|
|
184
|
+
// { score: 870, bondRatioBps: 2451, components: {...} }
|
|
185
|
+
|
|
186
|
+
tierOf(870); // "high"
|
|
187
|
+
formatUsdc(5_247_000_000n); // "$5,247"
|
|
188
|
+
formatPercent(0.992, 1); // "99.2%"
|
|
189
|
+
shortenPubkey("AgentSenda1JupiterLPv31111111111111111111111");
|
|
190
|
+
// "Agen…1111"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Subpath imports (smaller bundles)
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
import { computeScore } from "@telaro/sdk/score";
|
|
197
|
+
import { findAgentPda } from "@telaro/sdk/pda";
|
|
198
|
+
import { TelaroApi } from "@telaro/sdk/api";
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## All exports
|
|
202
|
+
|
|
203
|
+
| Module | Exports |
|
|
204
|
+
|---|---|
|
|
205
|
+
| `client` | `TelaroClient`, `TelaroClientOptions` |
|
|
206
|
+
| `api` | `TelaroApi`, `TelaroApiError`, full types |
|
|
207
|
+
| `instructions` | `build*Ix` for every program ix + `buildRegisterAndBondIxs` helper |
|
|
208
|
+
| `pda` | `findAgentPda`, `findClaimPda`, `findBondVaultPda`, … |
|
|
209
|
+
| `score` | `computeScore`, `tierOf`, `ScoreInputs`, `ScoreOutput` |
|
|
210
|
+
| `events` | `decodeEvent`, `decodeEventsFromLogs`, all event types |
|
|
211
|
+
| `types` | `AgentAccount`, `ActionKind`, `ActionOutcome`, `ClaimStatus`, … |
|
|
212
|
+
| `format` | `formatUsdc`, `formatPercent`, `formatRelativeTime`, … |
|
|
213
|
+
| `constants` | `PROGRAM_ID`, `MIN_BOND_USDC`, `CLAIM_*`, … |
|
|
214
|
+
| `discriminators` | `INSTRUCTION_DISC`, `EVENT_DISC`, `ACCOUNT_DISC` |
|
|
215
|
+
| `hash` | `hashAction(payload)` deterministic action_hash |
|
|
216
|
+
| `borsh` | `BorshReader` (for custom Borsh decoding) |
|
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# `@telaro/sdk`
|
|
2
|
+
|
|
3
|
+
> TypeScript SDK for the **Telaro** protocol on Solana — skin-in-the-game reputation primitive for AI agents.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @telaro/sdk @solana/web3.js @solana/spl-token
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
> Other package managers also work: `yarn add`, `pnpm add`, `bun add`.
|
|
12
|
+
|
|
13
|
+
### ⚠️ Required: pin `rpc-websockets`
|
|
14
|
+
|
|
15
|
+
`@solana/web3.js@1.x` pulls a `rpc-websockets` build whose transitive `uuid@14` (ESM-only) breaks a CJS shim — you'll hit `ERR_REQUIRE_ESM` at the first import. Add this to your `package.json` before running `npm install`:
|
|
16
|
+
|
|
17
|
+
```jsonc
|
|
18
|
+
{
|
|
19
|
+
"overrides": {
|
|
20
|
+
"rpc-websockets": "9.1.1"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`pnpm` and `yarn` users: use `"pnpm": { "overrides": ... }` / `"resolutions": { ... }` in the same shape. Node ≥22 fixes this natively, so you can skip the override if you're on Node 22+. This is a Solana ecosystem-wide issue, not specific to Telaro.
|
|
26
|
+
|
|
27
|
+
### Requirements
|
|
28
|
+
|
|
29
|
+
- **Node ≥ 20** (recommended: **≥ 22** to skip the override above)
|
|
30
|
+
- **ESM project** (`"type": "module"` in `package.json` or `.mts` files)
|
|
31
|
+
- **Compatible runtimes**: Next.js 15+, Vite, Bun, Deno, Anchor 0.30+ TS templates, modern Node
|
|
32
|
+
- **Not compatible**: legacy CommonJS-only environments. Use a dynamic `await import("@telaro/sdk")` if you must call from CJS.
|
|
33
|
+
|
|
34
|
+
## Quick start — agent-side (framework integrator)
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { TelaroClient, ActionKind, ActionOutcome } from "@telaro/sdk";
|
|
38
|
+
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
|
|
39
|
+
|
|
40
|
+
const conn = new Connection("https://api.devnet.solana.com", "confirmed");
|
|
41
|
+
const controller = Keypair.fromSecretKey(/* ... */);
|
|
42
|
+
const rep = new TelaroClient(conn, controller);
|
|
43
|
+
|
|
44
|
+
// 1. Register the agent + post bond.
|
|
45
|
+
await rep.registerAgent({
|
|
46
|
+
framework: "sendai",
|
|
47
|
+
metadataUri: "https://my-agent.example/metadata.json",
|
|
48
|
+
scorer: new PublicKey("ScorerPubkeyOfTheIndexer..."),
|
|
49
|
+
bondMint: new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), // USDC
|
|
50
|
+
bondAmount: 100_000_000n, // 100 USDC
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// 2. Record actions as the agent acts.
|
|
54
|
+
await rep.recordAction({
|
|
55
|
+
payload: { type: "swap", in: "SOL", out: "USDC", amount: 1.0 },
|
|
56
|
+
kind: ActionKind.Swap,
|
|
57
|
+
outcome: ActionOutcome.Success,
|
|
58
|
+
valueAtomic: 50_000_000n, // ≈ $50 value-at-risk
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Quick start — DApp-side (consumer)
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import { findAgentPda, computeScore, tierOf } from "@telaro/sdk";
|
|
66
|
+
|
|
67
|
+
// Read agent state from chain (use Anchor account decoder or direct fetch).
|
|
68
|
+
// Then locally compute / verify the score:
|
|
69
|
+
const { score, components } = computeScore({
|
|
70
|
+
actionCount: 412n,
|
|
71
|
+
successCount: 401n,
|
|
72
|
+
disputedCount: 1n,
|
|
73
|
+
currentBond: 5_247_000_000n, // $5,247
|
|
74
|
+
valueHandled30d: 21_000_000_000n,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
if (tierOf(score) === "high" && score >= 700) {
|
|
78
|
+
// OK to delegate.
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Quick start — DApp on-chain enforcement (Anchor CPI)
|
|
83
|
+
|
|
84
|
+
In your own Anchor program, before delegating capital to an agent, invoke
|
|
85
|
+
`view_bond` on the Telaro program. Reverts if the agent doesn't meet
|
|
86
|
+
your policy:
|
|
87
|
+
|
|
88
|
+
```rust
|
|
89
|
+
use telaro::cpi::{view_bond, accounts::ViewBond};
|
|
90
|
+
|
|
91
|
+
view_bond(
|
|
92
|
+
CpiContext::new(telaro_program, ViewBond { agent: agent_account.into() }),
|
|
93
|
+
1_000_000_000u64, // min_bond = 1000 USDC
|
|
94
|
+
700u16, // min_score
|
|
95
|
+
)?;
|
|
96
|
+
// If we reach here, the agent meets the policy. Delegate safely.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## API surface
|
|
100
|
+
|
|
101
|
+
| Module | Exports |
|
|
102
|
+
|---|---|
|
|
103
|
+
| `client` | `TelaroClient`, `TelaroClientOptions` |
|
|
104
|
+
| `instructions` | `build*Ix` for each instruction (composable) |
|
|
105
|
+
| `pda` | `findAgentPda`, `findClaimPda`, `findBondVaultPda`, … |
|
|
106
|
+
| `score` | `computeScore`, `tierOf`, `ScoreInputs`, `ScoreOutput` |
|
|
107
|
+
| `types` | `AgentAccount`, `ActionKind`, `ActionOutcome`, `ClaimStatus`, … |
|
|
108
|
+
| `format` | `formatUsdc`, `formatPercent`, `formatRelativeTime`, … |
|
|
109
|
+
| `constants` | `PROGRAM_ID`, `MIN_BOND_USDC`, `CLAIM_*`, … |
|
|
110
|
+
| `hash` | `hashAction(payload)` deterministic action_hash |
|
|
111
|
+
|
|
112
|
+
## Scoring policy (default, v1)
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
score = 500
|
|
116
|
+
+ 50 × tanh(log10(action_count)) // tenure
|
|
117
|
+
+ 200 × (success / action) // success rate
|
|
118
|
+
- 300 × (disputed / action) // disputes
|
|
119
|
+
+ 100 × min(1.0, bond / value_handled_30d) // skin in the game
|
|
120
|
+
- 100 if recent_high_value_failure_in_7d // hot incident decay
|
|
121
|
+
clamp(0, 1000)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The `bondRatioBps` returned alongside the score is what the on-chain
|
|
125
|
+
`update_score` instruction emits, allowing consumers to verify the policy.
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT — see [LICENSE](../LICENSE).
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-rolled Borsh decoders for the on-chain account types.
|
|
3
|
+
*
|
|
4
|
+
* Why hand-rolled (vs `BorshAccountsCoder` from `@coral-xyz/anchor`):
|
|
5
|
+
* - Avoids depending on the IDL JSON, which our toolchain currently
|
|
6
|
+
* can't generate cleanly (anchor-syn ↔ proc-macro2 drift).
|
|
7
|
+
* - The struct shapes are stable; layout is documented in
|
|
8
|
+
* `programs/bonded_agents/src/state.rs`.
|
|
9
|
+
*
|
|
10
|
+
* Used by the indexer's startup backfill and by client-side account
|
|
11
|
+
* lookups (`getAgent(pubkey)`).
|
|
12
|
+
*/
|
|
13
|
+
import { PublicKey } from "@solana/web3.js";
|
|
14
|
+
import type { AgentAccount, ClaimAccount } from "./types.js";
|
|
15
|
+
export interface LpPositionAccount {
|
|
16
|
+
bump: number;
|
|
17
|
+
agent: PublicKey;
|
|
18
|
+
lpKind: number;
|
|
19
|
+
yieldRouter: PublicKey;
|
|
20
|
+
marginfiAccount: PublicKey;
|
|
21
|
+
marginfiBank: PublicKey;
|
|
22
|
+
totalDeposited: bigint;
|
|
23
|
+
totalWithdrawn: bigint;
|
|
24
|
+
totalHarvested: bigint;
|
|
25
|
+
lastRouteAt: number;
|
|
26
|
+
lastHarvestAt: number;
|
|
27
|
+
createdAt: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Decode the raw bytes of an `LpPosition` account. Returns null if the
|
|
31
|
+
* discriminator doesn't match. Layout mirrors
|
|
32
|
+
* `programs/telaro/src/state.rs::LpPosition`.
|
|
33
|
+
*/
|
|
34
|
+
export interface ScoreFeedAccount {
|
|
35
|
+
bump: number;
|
|
36
|
+
agent: PublicKey;
|
|
37
|
+
scorer: PublicKey;
|
|
38
|
+
score: number;
|
|
39
|
+
updatedAt: number;
|
|
40
|
+
publishCount: bigint;
|
|
41
|
+
}
|
|
42
|
+
export declare function decodeScoreFeedAccount(data: Buffer): ScoreFeedAccount | null;
|
|
43
|
+
export declare function decodeLpPositionAccount(data: Buffer): LpPositionAccount | null;
|
|
44
|
+
/**
|
|
45
|
+
* Decode the raw bytes of an `Agent` account (with its 8-byte
|
|
46
|
+
* Anchor discriminator at the front). Returns null if the
|
|
47
|
+
* discriminator does not match.
|
|
48
|
+
*/
|
|
49
|
+
export declare function decodeAgentAccount(data: Buffer): AgentAccount | null;
|
|
50
|
+
export declare function decodeClaimAccount(data: Buffer): ClaimAccount | null;
|
|
51
|
+
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAe,MAAM,YAAY,CAAC;AAE1E,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,SAAS,CAAC;IACvB,eAAe,EAAE,SAAS,CAAC;IAC3B,YAAY,EAAE,SAAS,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAY5E;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CA+B9E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAoEpE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAsCpE"}
|
package/dist/accounts.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { ACCOUNT_DISC } from "./discriminators.js";
|
|
2
|
+
import { BorshReader } from "./borsh.js";
|
|
3
|
+
export function decodeScoreFeedAccount(data) {
|
|
4
|
+
if (data.length < 8)
|
|
5
|
+
return null;
|
|
6
|
+
if (!data.subarray(0, 8).equals(ACCOUNT_DISC.ScoreFeed))
|
|
7
|
+
return null;
|
|
8
|
+
const r = new BorshReader(data.subarray(8));
|
|
9
|
+
const bump = r.u8();
|
|
10
|
+
r.fixedBytes(5); // _pad0
|
|
11
|
+
const agent = r.pubkey();
|
|
12
|
+
const scorer = r.pubkey();
|
|
13
|
+
const score = r.u16();
|
|
14
|
+
const updatedAt = Number(r.i64());
|
|
15
|
+
const publishCount = r.u64();
|
|
16
|
+
return { bump, agent, scorer, score, updatedAt, publishCount };
|
|
17
|
+
}
|
|
18
|
+
export function decodeLpPositionAccount(data) {
|
|
19
|
+
if (data.length < 8)
|
|
20
|
+
return null;
|
|
21
|
+
if (!data.subarray(0, 8).equals(ACCOUNT_DISC.LpPosition))
|
|
22
|
+
return null;
|
|
23
|
+
const r = new BorshReader(data.subarray(8));
|
|
24
|
+
const bump = r.u8();
|
|
25
|
+
const agent = r.pubkey();
|
|
26
|
+
const lpKind = r.u8();
|
|
27
|
+
r.fixedBytes(6); // _pad0
|
|
28
|
+
const yieldRouter = r.pubkey();
|
|
29
|
+
const marginfiAccount = r.pubkey();
|
|
30
|
+
const marginfiBank = r.pubkey();
|
|
31
|
+
const totalDeposited = r.u64();
|
|
32
|
+
const totalWithdrawn = r.u64();
|
|
33
|
+
const totalHarvested = r.u64();
|
|
34
|
+
const lastRouteAt = Number(r.i64());
|
|
35
|
+
const lastHarvestAt = Number(r.i64());
|
|
36
|
+
const createdAt = Number(r.i64());
|
|
37
|
+
return {
|
|
38
|
+
bump,
|
|
39
|
+
agent,
|
|
40
|
+
lpKind,
|
|
41
|
+
yieldRouter,
|
|
42
|
+
marginfiAccount,
|
|
43
|
+
marginfiBank,
|
|
44
|
+
totalDeposited,
|
|
45
|
+
totalWithdrawn,
|
|
46
|
+
totalHarvested,
|
|
47
|
+
lastRouteAt,
|
|
48
|
+
lastHarvestAt,
|
|
49
|
+
createdAt,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Decode the raw bytes of an `Agent` account (with its 8-byte
|
|
54
|
+
* Anchor discriminator at the front). Returns null if the
|
|
55
|
+
* discriminator does not match.
|
|
56
|
+
*/
|
|
57
|
+
export function decodeAgentAccount(data) {
|
|
58
|
+
if (data.length < 8)
|
|
59
|
+
return null;
|
|
60
|
+
if (!data.subarray(0, 8).equals(ACCOUNT_DISC.Agent))
|
|
61
|
+
return null;
|
|
62
|
+
const r = new BorshReader(data.subarray(8));
|
|
63
|
+
const controller = r.pubkey();
|
|
64
|
+
const bondMint = r.pubkey();
|
|
65
|
+
const bondVault = r.pubkey();
|
|
66
|
+
const scorer = r.pubkey();
|
|
67
|
+
const framework = r.string();
|
|
68
|
+
const metadataUri = r.string();
|
|
69
|
+
const createdAt = Number(r.i64());
|
|
70
|
+
const lastActionAt = Number(r.i64());
|
|
71
|
+
const actionCount = r.u64();
|
|
72
|
+
const successCount = r.u64();
|
|
73
|
+
const failedCount = r.u64();
|
|
74
|
+
const disputedCount = r.u64();
|
|
75
|
+
const currentBond = r.u64();
|
|
76
|
+
const reservedForClaims = r.u64();
|
|
77
|
+
const valueHandled30d = r.u64();
|
|
78
|
+
const currentScore = r.u16();
|
|
79
|
+
const openClaims = r.u32();
|
|
80
|
+
const frozen = r.bool();
|
|
81
|
+
// bump + vault_bump are implementation detail; skip them — they'd cost
|
|
82
|
+
// 2 reads but the consumer doesn't need them.
|
|
83
|
+
r.u8();
|
|
84
|
+
r.u8();
|
|
85
|
+
// Yield routing (added v0)
|
|
86
|
+
// total_yield_accrued / builder_yield_unclaimed / treasury_yield_unclaimed / last_yield_at
|
|
87
|
+
// These are decoded best-effort; if older accounts predate them, the
|
|
88
|
+
// remaining buffer is shorter and we return zeros.
|
|
89
|
+
let totalYieldAccrued = 0n;
|
|
90
|
+
let builderYieldUnclaimed = 0n;
|
|
91
|
+
let treasuryYieldUnclaimed = 0n;
|
|
92
|
+
let lastYieldAt = 0;
|
|
93
|
+
if (r.remaining >= 8 + 8 + 8 + 8) {
|
|
94
|
+
totalYieldAccrued = r.u64();
|
|
95
|
+
builderYieldUnclaimed = r.u64();
|
|
96
|
+
treasuryYieldUnclaimed = r.u64();
|
|
97
|
+
lastYieldAt = Number(r.i64());
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
controller,
|
|
101
|
+
bondMint,
|
|
102
|
+
bondVault,
|
|
103
|
+
scorer,
|
|
104
|
+
framework,
|
|
105
|
+
metadataUri,
|
|
106
|
+
createdAt,
|
|
107
|
+
lastActionAt,
|
|
108
|
+
actionCount,
|
|
109
|
+
successCount,
|
|
110
|
+
failedCount,
|
|
111
|
+
disputedCount,
|
|
112
|
+
currentBond,
|
|
113
|
+
reservedForClaims,
|
|
114
|
+
valueHandled30d,
|
|
115
|
+
currentScore,
|
|
116
|
+
openClaims,
|
|
117
|
+
frozen,
|
|
118
|
+
// The yield fields aren't part of the public AgentAccount type yet,
|
|
119
|
+
// so we attach them as optional properties on the returned object.
|
|
120
|
+
...{
|
|
121
|
+
totalYieldAccrued,
|
|
122
|
+
builderYieldUnclaimed,
|
|
123
|
+
treasuryYieldUnclaimed,
|
|
124
|
+
lastYieldAt,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export function decodeClaimAccount(data) {
|
|
129
|
+
if (data.length < 8)
|
|
130
|
+
return null;
|
|
131
|
+
if (!data.subarray(0, 8).equals(ACCOUNT_DISC.Claim))
|
|
132
|
+
return null;
|
|
133
|
+
const r = new BorshReader(data.subarray(8));
|
|
134
|
+
const agent = r.pubkey();
|
|
135
|
+
const claimer = r.pubkey();
|
|
136
|
+
const actionHash = r.fixedBytes(32);
|
|
137
|
+
const claimedAmount = r.u64();
|
|
138
|
+
const depositAmount = r.u64();
|
|
139
|
+
const evidenceUri = r.string();
|
|
140
|
+
const deadline = Number(r.i64());
|
|
141
|
+
const createdAt = Number(r.i64());
|
|
142
|
+
const status = r.u8();
|
|
143
|
+
const resolvedAt = Number(r.i64());
|
|
144
|
+
// bump
|
|
145
|
+
r.u8();
|
|
146
|
+
// v0.3 fields — best-effort, fall back to zero if older account predates them
|
|
147
|
+
let escalationDeposit = 0n;
|
|
148
|
+
let escalatedAt = 0;
|
|
149
|
+
let resolvedBy = 0;
|
|
150
|
+
if (r.remaining >= 8 + 8 + 1) {
|
|
151
|
+
escalationDeposit = r.u64();
|
|
152
|
+
escalatedAt = Number(r.i64());
|
|
153
|
+
resolvedBy = r.u8();
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
agent,
|
|
157
|
+
claimer,
|
|
158
|
+
actionHash,
|
|
159
|
+
claimedAmount,
|
|
160
|
+
depositAmount,
|
|
161
|
+
evidenceUri,
|
|
162
|
+
createdAt,
|
|
163
|
+
deadline,
|
|
164
|
+
status,
|
|
165
|
+
resolvedAt,
|
|
166
|
+
...{ escalationDeposit, escalatedAt, resolvedBy },
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=accounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgCzC,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACjC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IACrE,MAAM,CAAC,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAA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