@valiron/sdk 0.11.0 → 0.12.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/README.md +26 -61
- package/dist/clients.d.ts +113 -1
- package/dist/clients.js +228 -0
- package/dist/identity.d.ts +80 -0
- package/dist/identity.js +121 -0
- package/dist/index.d.ts +218 -1
- package/dist/index.js +229 -1
- package/dist/middleware.d.ts +30 -4
- package/dist/middleware.js +98 -27
- package/dist/operatorSdk.d.ts +103 -0
- package/dist/operatorSdk.js +128 -0
- package/dist/types.d.ts +200 -1
- package/docs/API-REFERENCE.md +375 -3
- package/docs/CHAINS.md +37 -3
- package/docs/ERRORS.md +40 -2
- package/docs/IDENTITY.md +94 -8
- package/docs/QUICKSTART.md +185 -28
- package/docs/README.md +21 -11
- package/docs/SANDBOX.md +58 -23
- package/docs/SDK-REFERENCE.md +275 -1
- package/docs/TRUST-MODEL.md +57 -60
- package/docs/llms.txt +52 -4
- package/package.json +5 -4
package/dist/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Matches the actual edge-proxy /operator/* endpoints
|
|
6
6
|
*/
|
|
7
7
|
/** Blockchain networks supported by the Valiron Operator API. */
|
|
8
|
-
export type SupportedChain = "ethereum" | "monad" | "arbitrum" | "base" | "avalanche" | "celo" | "polygon" | "linea" | "abstract" | "bsc" | "gnosis" | "goat" | "mantle" | "megaeth" | "metis" | "optimism" | "scroll" | "skale_base" | "soneium" | "taiko" | "xlayer" | "base_sepolia" | "ethereum_sepolia" | "abstract_testnet" | "arbitrum_sepolia" | "avalanche_testnet" | "bsc_testnet" | "celo_testnet" | "linea_sepolia" | "mantle_testnet" | "megaeth_testnet" | "metis_sepolia" | "optimism_sepolia" | "polygon_amoy" | "scroll_sepolia" | "skale_base_sepolia" | "soneium_minato" | "taiko_hoodi" | "xlayer_testnet" | "hedera_testnet" | "arc_testnet" | "solana";
|
|
8
|
+
export type SupportedChain = "ethereum" | "monad" | "arbitrum" | "base" | "avalanche" | "celo" | "polygon" | "linea" | "abstract" | "bsc" | "gnosis" | "goat" | "mantle" | "megaeth" | "metis" | "optimism" | "scroll" | "skale_base" | "soneium" | "taiko" | "xlayer" | "base_sepolia" | "ethereum_sepolia" | "abstract_testnet" | "arbitrum_sepolia" | "avalanche_testnet" | "bsc_testnet" | "celo_testnet" | "linea_sepolia" | "mantle_testnet" | "megaeth_testnet" | "metis_sepolia" | "optimism_sepolia" | "polygon_amoy" | "scroll_sepolia" | "skale_base_sepolia" | "soneium_minato" | "taiko_hoodi" | "xlayer_testnet" | "hedera_testnet" | "arc_testnet" | "world_chain" | "solana";
|
|
9
9
|
export type RouteDecision = "prod" | "prod_throttled" | "sandbox" | "sandbox_only";
|
|
10
10
|
export type RiskLevel = "GREEN" | "YELLOW" | "RED";
|
|
11
11
|
export type MoodysRating = "AAA" | "AA" | "A" | "BAA" | "BA" | "B" | "CAA" | "CA" | "C";
|
|
@@ -74,6 +74,10 @@ export interface RoutingSignals {
|
|
|
74
74
|
tier: string;
|
|
75
75
|
riskLevel: string;
|
|
76
76
|
};
|
|
77
|
+
worldId?: {
|
|
78
|
+
verified: boolean;
|
|
79
|
+
verificationLevel: string | null;
|
|
80
|
+
};
|
|
77
81
|
}
|
|
78
82
|
export interface RoutingExplanation {
|
|
79
83
|
finalRoute: RouteDecision;
|
|
@@ -99,6 +103,8 @@ export interface AgentProfile {
|
|
|
99
103
|
localReputation: LocalReputation | null;
|
|
100
104
|
routing: RoutingExplanation;
|
|
101
105
|
chain: ChainContext;
|
|
106
|
+
/** World ID proof-of-personhood verification status */
|
|
107
|
+
worldId?: WorldIdStatus;
|
|
102
108
|
timestamp: string;
|
|
103
109
|
}
|
|
104
110
|
/**
|
|
@@ -196,6 +202,117 @@ export interface GateResult {
|
|
|
196
202
|
/** Whether the score is from a micro-sandbox (fast, limited coverage). When true, a full deep test is running in the background and will update the cached score. */
|
|
197
203
|
provisional?: boolean;
|
|
198
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Response from `POST /operator/key/:agentKeyHash/challenge`
|
|
207
|
+
*/
|
|
208
|
+
export interface KeyAgentChallenge {
|
|
209
|
+
/** Random nonce the agent must sign */
|
|
210
|
+
challenge: string;
|
|
211
|
+
/** ISO 8601 expiry timestamp for the challenge */
|
|
212
|
+
expiresAt: string;
|
|
213
|
+
/** The agent key hash this challenge was issued for */
|
|
214
|
+
agentKeyHash: string;
|
|
215
|
+
}
|
|
216
|
+
/** Verification level from World ID */
|
|
217
|
+
export type WorldIdVerificationLevel = "orb" | "device" | "phone";
|
|
218
|
+
/**
|
|
219
|
+
* World ID verification status for an agent.
|
|
220
|
+
*
|
|
221
|
+
* Returned from `GET /operator/world-id/status/:agentId`
|
|
222
|
+
*/
|
|
223
|
+
export interface WorldIdStatus {
|
|
224
|
+
/** Whether the agent has a verified World ID human link */
|
|
225
|
+
verified: boolean;
|
|
226
|
+
/** Verification level (orb = biometric, device = passkey, phone = SMS) */
|
|
227
|
+
verificationLevel?: WorldIdVerificationLevel;
|
|
228
|
+
/** Nullifier hash — unique per (user, action, app) tuple */
|
|
229
|
+
nullifierHash?: string;
|
|
230
|
+
/** The agent ID this verification is linked to */
|
|
231
|
+
agentId?: string;
|
|
232
|
+
/** Network this verification is scoped to */
|
|
233
|
+
network?: string;
|
|
234
|
+
/** ISO 8601 timestamp of when verification occurred */
|
|
235
|
+
verifiedAt?: string;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Enriched human-agent trust profile combining World ID + Icebreaker.
|
|
239
|
+
*
|
|
240
|
+
* Response from `GET /operator/world-id/profile/:agentId`
|
|
241
|
+
*/
|
|
242
|
+
export interface WorldIdAgentProfile {
|
|
243
|
+
agentId: string;
|
|
244
|
+
/** World ID proof-of-personhood status */
|
|
245
|
+
worldId: WorldIdStatus;
|
|
246
|
+
/** Icebreaker background enrichment (LinkedIn, GitHub, etc.) */
|
|
247
|
+
icebreaker: {
|
|
248
|
+
attested: boolean;
|
|
249
|
+
owner?: string;
|
|
250
|
+
bio?: string;
|
|
251
|
+
verifiedHandles?: {
|
|
252
|
+
source: string;
|
|
253
|
+
handle: string;
|
|
254
|
+
}[];
|
|
255
|
+
organization?: string;
|
|
256
|
+
profileUrl?: string;
|
|
257
|
+
};
|
|
258
|
+
/** On-chain identity summary */
|
|
259
|
+
identity: {
|
|
260
|
+
wallet: string;
|
|
261
|
+
name: string;
|
|
262
|
+
} | null;
|
|
263
|
+
/** Aggregated human trust signals */
|
|
264
|
+
humanTrust: {
|
|
265
|
+
hasHumanLink: boolean;
|
|
266
|
+
hasBackground: boolean;
|
|
267
|
+
verificationLevel: WorldIdVerificationLevel | null;
|
|
268
|
+
};
|
|
269
|
+
reasons: string[];
|
|
270
|
+
timestamp: string;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Icebreaker ownership attestation linked to an agent key hash.
|
|
274
|
+
*/
|
|
275
|
+
export interface IcebreakerOwnership {
|
|
276
|
+
/** Whether an Icebreaker attestation was found */
|
|
277
|
+
attested: boolean;
|
|
278
|
+
/** The human owner's name or address */
|
|
279
|
+
owner?: string;
|
|
280
|
+
/** Human-readable bio or description */
|
|
281
|
+
description?: string;
|
|
282
|
+
/** Verified social handles (e.g. "github: alice", "x: @alice") */
|
|
283
|
+
verifiedHandles?: string[];
|
|
284
|
+
/** Workplace or organization affiliation, if verified */
|
|
285
|
+
organization?: string;
|
|
286
|
+
/** EAS attestation UID on Base */
|
|
287
|
+
attestationUid?: string;
|
|
288
|
+
/** Icebreaker profile URL for the agent's linked address */
|
|
289
|
+
profileUrl?: string;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Trust profile for a key-based (non-ERC-8004) agent.
|
|
293
|
+
*
|
|
294
|
+
* Response from `POST /operator/key/verify` and `GET /operator/key/:agentKeyHash`
|
|
295
|
+
*/
|
|
296
|
+
export interface KeyAgentProfile {
|
|
297
|
+
/** SHA-256 hash of the agent's public key */
|
|
298
|
+
agentKeyHash: string;
|
|
299
|
+
/** Whether identity has been verified via challenge-response */
|
|
300
|
+
verified: boolean;
|
|
301
|
+
/** Behavioral score (0-110) — same scoring as ERC-8004 agents */
|
|
302
|
+
score: number | null;
|
|
303
|
+
/** Moody's-style tier (AAA → C) */
|
|
304
|
+
tier: MoodysRating | null;
|
|
305
|
+
/** Risk level derived from tier */
|
|
306
|
+
riskLevel: RiskLevel | null;
|
|
307
|
+
/** Route decision */
|
|
308
|
+
route: RouteDecision | null;
|
|
309
|
+
/** Icebreaker ownership context (optional enrichment) */
|
|
310
|
+
icebreaker: IcebreakerOwnership | null;
|
|
311
|
+
/** Human-readable trust explanation */
|
|
312
|
+
reasons: string[];
|
|
313
|
+
/** ISO 8601 timestamp */
|
|
314
|
+
timestamp: string;
|
|
315
|
+
}
|
|
199
316
|
/** Options that can be passed to individual SDK method calls. */
|
|
200
317
|
export interface CallOptions {
|
|
201
318
|
/**
|
|
@@ -257,6 +374,88 @@ export interface ValironConfig {
|
|
|
257
374
|
*/
|
|
258
375
|
telemetry?: TelemetryConfig;
|
|
259
376
|
}
|
|
377
|
+
/** Response from `POST /channel/preflight/:agentId` */
|
|
378
|
+
export interface ChannelPreflightResponse {
|
|
379
|
+
agentId: string;
|
|
380
|
+
tier: string;
|
|
381
|
+
score: number;
|
|
382
|
+
riskLevel: string;
|
|
383
|
+
creditLine: string;
|
|
384
|
+
creditLineReadable: string;
|
|
385
|
+
maxRequests: number | null;
|
|
386
|
+
durationSeconds: number;
|
|
387
|
+
escrowAddress: string;
|
|
388
|
+
}
|
|
389
|
+
/** Response from `POST /channel/open/:agentId` */
|
|
390
|
+
export interface ChannelOpenResponse {
|
|
391
|
+
sessionId: string;
|
|
392
|
+
agentId: string;
|
|
393
|
+
tier: string;
|
|
394
|
+
score: number;
|
|
395
|
+
riskLevel: string;
|
|
396
|
+
creditLine: string;
|
|
397
|
+
creditLineReadable: string;
|
|
398
|
+
maxRequests: number | null;
|
|
399
|
+
expiresAt: string;
|
|
400
|
+
durationSeconds: number;
|
|
401
|
+
depositConfirmed: boolean;
|
|
402
|
+
depositSignature: string;
|
|
403
|
+
escrowAddress: string;
|
|
404
|
+
}
|
|
405
|
+
/** Response from `POST /channel/consume/:sessionId` */
|
|
406
|
+
export interface ChannelConsumeResponse {
|
|
407
|
+
requestId: string;
|
|
408
|
+
cost: string;
|
|
409
|
+
costReadable: string;
|
|
410
|
+
description?: string;
|
|
411
|
+
session: {
|
|
412
|
+
consumed: string;
|
|
413
|
+
consumedReadable: string;
|
|
414
|
+
remaining: string;
|
|
415
|
+
remainingReadable: string;
|
|
416
|
+
requestCount: number;
|
|
417
|
+
maxRequests: number | null;
|
|
418
|
+
secondsRemaining: number;
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
/** Response from `GET /channel/status/:sessionId` */
|
|
422
|
+
export interface ChannelStatusResponse {
|
|
423
|
+
sessionId: string;
|
|
424
|
+
agentId: string;
|
|
425
|
+
tier: string;
|
|
426
|
+
creditLine: string;
|
|
427
|
+
creditLineReadable: string;
|
|
428
|
+
consumed: string;
|
|
429
|
+
consumedReadable: string;
|
|
430
|
+
remaining: string;
|
|
431
|
+
remainingReadable: string;
|
|
432
|
+
requestCount: number;
|
|
433
|
+
maxRequests: number | null;
|
|
434
|
+
expiresAt: string;
|
|
435
|
+
secondsRemaining: number;
|
|
436
|
+
active: boolean;
|
|
437
|
+
settled: boolean;
|
|
438
|
+
}
|
|
439
|
+
/** Response from `POST /channel/settle/:sessionId` */
|
|
440
|
+
export interface ChannelSettlementResponse {
|
|
441
|
+
sessionId: string;
|
|
442
|
+
settled: boolean;
|
|
443
|
+
totalConsumed: string;
|
|
444
|
+
totalConsumedReadable: string;
|
|
445
|
+
requestsServed: number;
|
|
446
|
+
unusedCredit: string;
|
|
447
|
+
unusedCreditReadable: string;
|
|
448
|
+
refundAmount?: string;
|
|
449
|
+
refundReadable?: string;
|
|
450
|
+
refundSignature?: string;
|
|
451
|
+
refundWarning?: string;
|
|
452
|
+
}
|
|
453
|
+
/** Response from `GET /channel/health` */
|
|
454
|
+
export interface ChannelHealthResponse {
|
|
455
|
+
status: string;
|
|
456
|
+
service: string;
|
|
457
|
+
escrowAddress: string | null;
|
|
458
|
+
}
|
|
260
459
|
export declare class ValironError extends Error {
|
|
261
460
|
code: string;
|
|
262
461
|
statusCode?: number | undefined;
|
package/docs/API-REFERENCE.md
CHANGED
|
@@ -68,7 +68,7 @@ Reverse-lookup a wallet address to get its trust profile.
|
|
|
68
68
|
|
|
69
69
|
| Parameter | Location | Type | Required | Description |
|
|
70
70
|
|-----------|----------|------|----------|-------------|
|
|
71
|
-
| `wallet` | path | string | yes | Ethereum address (0x...) |
|
|
71
|
+
| `wallet` | path | string | yes | Ethereum address (0x...) or Solana pubkey (base-58, with `chain=solana`) |
|
|
72
72
|
| `chain` | query | string | no | Network override |
|
|
73
73
|
|
|
74
74
|
### Response — 200 OK
|
|
@@ -81,13 +81,13 @@ Same structure as `GET /operator/agent/:agentId`.
|
|
|
81
81
|
|
|
82
82
|
Lightweight wallet → agentId resolution. Returns just the agent ID and how it was resolved, without the full trust profile.
|
|
83
83
|
|
|
84
|
-
Resolution chain: Redis → Agent0 subgraph → null.
|
|
84
|
+
Resolution chain: Redis → Agent0 subgraph → null. For Solana (`chain=solana`): QuantuLabs `getAgentsByOwner()`.
|
|
85
85
|
|
|
86
86
|
### Parameters
|
|
87
87
|
|
|
88
88
|
| Parameter | Location | Type | Required | Description |
|
|
89
89
|
|-----------|----------|------|----------|-------------|
|
|
90
|
-
| `wallet` | path | string | yes | Ethereum address (0x...) |
|
|
90
|
+
| `wallet` | path | string | yes | Ethereum address (0x...) or Solana pubkey (base-58, with `chain=solana`) |
|
|
91
91
|
| `chain` | query | string | no | Network override (default: ethereum) |
|
|
92
92
|
|
|
93
93
|
### Response — 200 OK
|
|
@@ -291,3 +291,375 @@ Health check endpoint.
|
|
|
291
291
|
"defaultChain": "ethereum"
|
|
292
292
|
}
|
|
293
293
|
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Payment Channels (Solana)
|
|
298
|
+
|
|
299
|
+
Trust-adaptive USDC payment channels on Solana. Base URL: `https://valiron-edge-proxy.onrender.com`
|
|
300
|
+
|
|
301
|
+
All channel endpoints are under the `/channel/` prefix (not `/operator/`).
|
|
302
|
+
|
|
303
|
+
### POST /channel/preflight/:agentId
|
|
304
|
+
|
|
305
|
+
Pre-flight gate check. Returns escrow address, credit line, and tier policy.
|
|
306
|
+
|
|
307
|
+
#### Parameters
|
|
308
|
+
|
|
309
|
+
| Parameter | Location | Type | Required | Description |
|
|
310
|
+
|-----------|----------|------|----------|-------------|
|
|
311
|
+
| `agentId` | path | string | yes | Agent ID (ERC-8004 or Solana sequential) |
|
|
312
|
+
| `walletAddress` | body | string | yes | Agent's Solana wallet pubkey |
|
|
313
|
+
|
|
314
|
+
#### Request
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
curl -X POST https://valiron-edge-proxy.onrender.com/channel/preflight/1226 \
|
|
318
|
+
-H "Content-Type: application/json" \
|
|
319
|
+
-d '{"walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"}'
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
#### Response — 200 OK
|
|
323
|
+
|
|
324
|
+
```json
|
|
325
|
+
{
|
|
326
|
+
"agentId": "1226",
|
|
327
|
+
"tier": "AA",
|
|
328
|
+
"score": 85,
|
|
329
|
+
"riskLevel": "GREEN",
|
|
330
|
+
"creditLine": "50000000",
|
|
331
|
+
"creditLineReadable": "$50.00",
|
|
332
|
+
"maxRequests": null,
|
|
333
|
+
"durationSeconds": 2700,
|
|
334
|
+
"escrowAddress": "EscrowPubkey..."
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
#### Error Responses
|
|
339
|
+
|
|
340
|
+
| Status | Error | Meaning |
|
|
341
|
+
|--------|-------|---------|
|
|
342
|
+
| 400 | `wallet_required` | Missing `walletAddress` in body |
|
|
343
|
+
| 403 | `agent_denied` | Agent trust score below threshold |
|
|
344
|
+
| 503 | `escrow_not_configured` | Server has no escrow wallet configured |
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
### POST /channel/open/:agentId
|
|
349
|
+
|
|
350
|
+
Open a payment channel by verifying a USDC deposit transaction.
|
|
351
|
+
|
|
352
|
+
#### Parameters
|
|
353
|
+
|
|
354
|
+
| Parameter | Location | Type | Required | Description |
|
|
355
|
+
|-----------|----------|------|----------|-------------|
|
|
356
|
+
| `agentId` | path | string | yes | Agent ID |
|
|
357
|
+
| `walletAddress` | body | string | yes | Agent's Solana wallet |
|
|
358
|
+
| `depositSignature` | body | string | yes | Solana TX signature of USDC deposit |
|
|
359
|
+
|
|
360
|
+
#### Request
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
curl -X POST https://valiron-edge-proxy.onrender.com/channel/open/1226 \
|
|
364
|
+
-H "Content-Type: application/json" \
|
|
365
|
+
-d '{"walletAddress": "7xKXtg...", "depositSignature": "5eykt..."}'
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
#### Response — 200 OK
|
|
369
|
+
|
|
370
|
+
```json
|
|
371
|
+
{
|
|
372
|
+
"sessionId": "ch_a1b2c3d4",
|
|
373
|
+
"agentId": "1226",
|
|
374
|
+
"tier": "AA",
|
|
375
|
+
"score": 85,
|
|
376
|
+
"riskLevel": "GREEN",
|
|
377
|
+
"creditLine": "50000000",
|
|
378
|
+
"creditLineReadable": "$50.00",
|
|
379
|
+
"maxRequests": null,
|
|
380
|
+
"expiresAt": "2026-04-23T13:45:00.000Z",
|
|
381
|
+
"durationSeconds": 2700,
|
|
382
|
+
"depositConfirmed": true,
|
|
383
|
+
"depositSignature": "5eykt...",
|
|
384
|
+
"escrowAddress": "EscrowPubkey..."
|
|
385
|
+
}
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
#### Error Responses
|
|
389
|
+
|
|
390
|
+
| Status | Error | Meaning |
|
|
391
|
+
|--------|-------|---------|
|
|
392
|
+
| 400 | `wallet_required` | Missing wallet address |
|
|
393
|
+
| 400 | `deposit_required` | Missing deposit signature |
|
|
394
|
+
| 409 | `deposit_already_claimed` | TX signature already used for another channel |
|
|
395
|
+
| 503 | `escrow_not_configured` | No escrow wallet on server |
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
### POST /channel/consume/:sessionId
|
|
400
|
+
|
|
401
|
+
Charge against an open channel. Requires the session ID as a Bearer token.
|
|
402
|
+
|
|
403
|
+
#### Parameters
|
|
404
|
+
|
|
405
|
+
| Parameter | Location | Type | Required | Description |
|
|
406
|
+
|-----------|----------|------|----------|-------------|
|
|
407
|
+
| `sessionId` | path | string | yes | Channel session ID |
|
|
408
|
+
| `Authorization` | header | string | yes | `Bearer <sessionId>` |
|
|
409
|
+
| `cost` | body | number | yes | Amount to charge (USDC, e.g. 0.50) |
|
|
410
|
+
| `description` | body | string | no | Description of the charge |
|
|
411
|
+
|
|
412
|
+
#### Request
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
curl -X POST https://valiron-edge-proxy.onrender.com/channel/consume/ch_a1b2c3d4 \
|
|
416
|
+
-H "Content-Type: application/json" \
|
|
417
|
+
-H "Authorization: Bearer ch_a1b2c3d4" \
|
|
418
|
+
-d '{"cost": 0.50, "description": "GPT-4o inference"}'
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
#### Response — 200 OK
|
|
422
|
+
|
|
423
|
+
```json
|
|
424
|
+
{
|
|
425
|
+
"requestId": "req_xyz789",
|
|
426
|
+
"cost": "500000",
|
|
427
|
+
"costReadable": "$0.50",
|
|
428
|
+
"description": "GPT-4o inference",
|
|
429
|
+
"session": {
|
|
430
|
+
"consumed": "500000",
|
|
431
|
+
"consumedReadable": "$0.50",
|
|
432
|
+
"remaining": "49500000",
|
|
433
|
+
"remainingReadable": "$49.50",
|
|
434
|
+
"requestCount": 1,
|
|
435
|
+
"maxRequests": null,
|
|
436
|
+
"secondsRemaining": 2685
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
#### Error Responses
|
|
442
|
+
|
|
443
|
+
| Status | Error | Meaning |
|
|
444
|
+
|--------|-------|---------|
|
|
445
|
+
| 400 | `bad_request` | Missing `cost` field |
|
|
446
|
+
| 401 | `unauthorized` | Missing or invalid Authorization header |
|
|
447
|
+
| 403 | `credit_exceeded` | Insufficient credit remaining |
|
|
448
|
+
| 404 | `not_found` | Channel not found |
|
|
449
|
+
| 410 | `channel_expired` | Channel has expired |
|
|
450
|
+
| 429 | `max_requests` | Request limit reached |
|
|
451
|
+
| 429 | `consume_in_progress` | Another consume is being processed (retry) |
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
### GET /channel/status/:sessionId
|
|
456
|
+
|
|
457
|
+
Get current status of a payment channel.
|
|
458
|
+
|
|
459
|
+
#### Request
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
curl https://valiron-edge-proxy.onrender.com/channel/status/ch_a1b2c3d4
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
#### Response — 200 OK
|
|
466
|
+
|
|
467
|
+
```json
|
|
468
|
+
{
|
|
469
|
+
"sessionId": "ch_a1b2c3d4",
|
|
470
|
+
"agentId": "1226",
|
|
471
|
+
"tier": "AA",
|
|
472
|
+
"creditLine": "50000000",
|
|
473
|
+
"creditLineReadable": "$50.00",
|
|
474
|
+
"consumed": "500000",
|
|
475
|
+
"consumedReadable": "$0.50",
|
|
476
|
+
"remaining": "49500000",
|
|
477
|
+
"remainingReadable": "$49.50",
|
|
478
|
+
"requestCount": 1,
|
|
479
|
+
"maxRequests": null,
|
|
480
|
+
"expiresAt": "2026-04-23T13:45:00.000Z",
|
|
481
|
+
"secondsRemaining": 2685,
|
|
482
|
+
"active": true,
|
|
483
|
+
"settled": false
|
|
484
|
+
}
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
#### Error Responses
|
|
488
|
+
|
|
489
|
+
| Status | Error | Meaning |
|
|
490
|
+
|--------|-------|---------|
|
|
491
|
+
| 404 | `not_found` | Channel not found |
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
### POST /channel/settle/:sessionId
|
|
496
|
+
|
|
497
|
+
Close a payment channel and refund unused USDC.
|
|
498
|
+
|
|
499
|
+
#### Request
|
|
500
|
+
|
|
501
|
+
```bash
|
|
502
|
+
curl -X POST https://valiron-edge-proxy.onrender.com/channel/settle/ch_a1b2c3d4 \
|
|
503
|
+
-H "Content-Type: application/json" \
|
|
504
|
+
-d '{}'
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
#### Response — 200 OK
|
|
508
|
+
|
|
509
|
+
```json
|
|
510
|
+
{
|
|
511
|
+
"sessionId": "ch_a1b2c3d4",
|
|
512
|
+
"settled": true,
|
|
513
|
+
"totalConsumed": "500000",
|
|
514
|
+
"totalConsumedReadable": "$0.50",
|
|
515
|
+
"requestsServed": 1,
|
|
516
|
+
"unusedCredit": "49500000",
|
|
517
|
+
"unusedCreditReadable": "$49.50",
|
|
518
|
+
"refundAmount": "49500000",
|
|
519
|
+
"refundReadable": "$49.50",
|
|
520
|
+
"refundSignature": "4sGjMW..."
|
|
521
|
+
}
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
#### Error Responses
|
|
525
|
+
|
|
526
|
+
| Status | Error | Meaning |
|
|
527
|
+
|--------|-------|---------|
|
|
528
|
+
| 404 | `not_found` | Channel not found |
|
|
529
|
+
| 409 | `already_settled` | Channel already settled |
|
|
530
|
+
|
|
531
|
+
---
|
|
532
|
+
|
|
533
|
+
### GET /channel/health
|
|
534
|
+
|
|
535
|
+
Health check for the payment channel service.
|
|
536
|
+
|
|
537
|
+
#### Response — 200 OK
|
|
538
|
+
|
|
539
|
+
```json
|
|
540
|
+
{
|
|
541
|
+
"status": "ok",
|
|
542
|
+
"service": "dynamic-payment-channels",
|
|
543
|
+
"escrowAddress": "EscrowPubkey..."
|
|
544
|
+
}
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
`escrowAddress` is `null` if no escrow wallet is configured.
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
## Solana Support
|
|
552
|
+
|
|
553
|
+
All `/operator/*` endpoints support Solana agents when `chain=solana` is passed as a query parameter or `x-chain: solana` header.
|
|
554
|
+
|
|
555
|
+
Solana agent identity and reputation data is provided by [QuantuLabs 8004-solana](https://8004.qnt.sh/), while EVM chains use the 8004 team's registry contracts. The two registries have different schemas — this is by design.
|
|
556
|
+
|
|
557
|
+
### Key Differences from EVM
|
|
558
|
+
|
|
559
|
+
| Area | EVM | Solana |
|
|
560
|
+
|------|-----|--------|
|
|
561
|
+
| **Agent ID format** | Numeric token ID (e.g. `25459`) | Base-58 Metaplex Core asset pubkey (e.g. `GL4k...`) or sequential ID (e.g. `1`, `42`) |
|
|
562
|
+
| **Wallet format** | `0x`-prefixed hex address | Base-58 public key |
|
|
563
|
+
| **Identity source** | ERC-8004 `ownerOf()` on-chain call | QuantuLabs `loadAgent()` SDK call |
|
|
564
|
+
| **Reputation source** | ERC-8004 `getSummary()` | QuantuLabs ATOM engine (`getEnrichedSummary()`) |
|
|
565
|
+
| **Extra reputation fields** | — | `solana.trustTier`, `solana.qualityScore`, `solana.confidence`, `solana.riskScore`, `solana.uniqueCallers` |
|
|
566
|
+
| **Wallet → Agent resolution** | Redis → Agent0 subgraph | QuantuLabs `getAgentsByOwner()` |
|
|
567
|
+
| **Liveness check** | — | `isItAlive()` endpoint-by-endpoint health probe |
|
|
568
|
+
| **Feedback write-back** | — | Valiron scores written on-chain via `giveFeedback()` (requires `SOLANA_FEEDBACK_KEYPAIR`) |
|
|
569
|
+
|
|
570
|
+
### Sequential Agent IDs
|
|
571
|
+
|
|
572
|
+
Solana agents are primarily identified by their base-58 asset pubkey, but the QuantuLabs indexer also assigns sequential integer IDs (1, 2, 3, …). You can use either format:
|
|
573
|
+
|
|
574
|
+
```bash
|
|
575
|
+
# By asset pubkey (primary)
|
|
576
|
+
curl "https://valiron-edge-proxy.onrender.com/operator/agent/GL4k...?chain=solana"
|
|
577
|
+
|
|
578
|
+
# By sequential ID (convenience)
|
|
579
|
+
curl "https://valiron-edge-proxy.onrender.com/operator/agent/42?chain=solana"
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
When a sequential ID is used, the response includes a `sequentialId` field mapping back to the numeric ID.
|
|
583
|
+
|
|
584
|
+
### Liveness Check
|
|
585
|
+
|
|
586
|
+
`GET /operator/agent/:agentId/liveness?chain=solana`
|
|
587
|
+
|
|
588
|
+
Pings each service endpoint from the agent's on-chain metadata and returns a health report. Only available for Solana agents.
|
|
589
|
+
|
|
590
|
+
**Response:**
|
|
591
|
+
```json
|
|
592
|
+
{
|
|
593
|
+
"agentId": "GL4k...",
|
|
594
|
+
"chain": { "network": "solana", "cluster": "mainnet-beta" },
|
|
595
|
+
"liveness": {
|
|
596
|
+
"status": "live",
|
|
597
|
+
"okCount": 3,
|
|
598
|
+
"totalPinged": 3,
|
|
599
|
+
"skippedCount": 0,
|
|
600
|
+
"results": [
|
|
601
|
+
{ "type": "rest", "endpoint": "https://...", "ok": true, "latencyMs": 120 }
|
|
602
|
+
]
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
The `trigger-sandbox` endpoint also includes a `liveness` summary in its response for Solana agents.
|
|
608
|
+
|
|
609
|
+
### Feedback Write-Back
|
|
610
|
+
|
|
611
|
+
When `SOLANA_FEEDBACK_KEYPAIR` is configured, Valiron automatically writes evaluation scores back to the Solana reputation registry after sandbox testing and gate evaluations. This closes the trust loop — other consumers of the 8004-solana registry can see Valiron's scores.
|
|
612
|
+
|
|
613
|
+
Feedback is submitted as fire-and-forget using the `starred` tag with `tag2: "valiron"` for attribution.
|
|
614
|
+
|
|
615
|
+
### Solana-Specific Response Fields
|
|
616
|
+
|
|
617
|
+
When querying a Solana agent, the `onchainReputation` object may include an additional `solana` block with ATOM engine metrics:
|
|
618
|
+
|
|
619
|
+
```json
|
|
620
|
+
{
|
|
621
|
+
"onchainReputation": {
|
|
622
|
+
"count": "42",
|
|
623
|
+
"averageScore": 88.5,
|
|
624
|
+
"feedbackEntries": [],
|
|
625
|
+
"totalFeedback": 42,
|
|
626
|
+
"solana": {
|
|
627
|
+
"trustTier": "trusted",
|
|
628
|
+
"qualityScore": 92.1,
|
|
629
|
+
"confidence": 0.87,
|
|
630
|
+
"riskScore": 0.08,
|
|
631
|
+
"uniqueCallers": 15
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
### Example Requests
|
|
638
|
+
|
|
639
|
+
```bash
|
|
640
|
+
# Get Solana agent profile
|
|
641
|
+
curl "https://valiron-edge-proxy.onrender.com/operator/agent/GL4k...?chain=solana"
|
|
642
|
+
|
|
643
|
+
# Get Solana agent by sequential ID
|
|
644
|
+
curl "https://valiron-edge-proxy.onrender.com/operator/agent/42?chain=solana"
|
|
645
|
+
|
|
646
|
+
# Gate a Solana agent
|
|
647
|
+
curl -X POST "https://valiron-edge-proxy.onrender.com/operator/gate/GL4k...?chain=solana"
|
|
648
|
+
|
|
649
|
+
# Check liveness
|
|
650
|
+
curl "https://valiron-edge-proxy.onrender.com/operator/agent/GL4k.../liveness?chain=solana"
|
|
651
|
+
|
|
652
|
+
# Look up by Solana wallet
|
|
653
|
+
curl "https://valiron-edge-proxy.onrender.com/operator/wallet/7xKX...?chain=solana"
|
|
654
|
+
|
|
655
|
+
# Trigger sandbox for Solana agent
|
|
656
|
+
curl -X POST "https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/GL4k...?chain=solana"
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
### Environment Variables
|
|
660
|
+
|
|
661
|
+
| Variable | Default | Description |
|
|
662
|
+
|----------|---------|-------------|
|
|
663
|
+
| `SOLANA_CLUSTER` | `mainnet-beta` | Solana cluster (`mainnet-beta` or `devnet`) |
|
|
664
|
+
| `SOLANA_RPC_URL` | Public RPC | Custom Solana RPC endpoint |
|
|
665
|
+
| `SOLANA_FEEDBACK_KEYPAIR` | — | JSON array secret key (e.g. `[1,2,...,64]`) for feedback write-back. When set, Valiron scores are written on-chain after evaluation. |
|
package/docs/CHAINS.md
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
# Supported Chains
|
|
2
2
|
|
|
3
|
-
Valiron operates across 41 blockchain networks
|
|
3
|
+
Valiron operates across 41 EVM blockchain networks plus Solana.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## EVM Chains
|
|
6
|
+
|
|
7
|
+
The ERC-8004 contracts are deployed at the same addresses on every EVM chain. Identity and reputation data is provided by the [8004 team](https://erc8004.org).
|
|
8
|
+
|
|
9
|
+
### Contract Addresses (all EVM chains)
|
|
6
10
|
|
|
7
11
|
| Contract | Address |
|
|
8
12
|
|----------|---------|
|
|
9
13
|
| Identity Registry | `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432` |
|
|
10
14
|
| Reputation Registry | `0x8004BAa17C55a88189AE136b182e5fdA19dE9b63` |
|
|
11
15
|
|
|
12
|
-
|
|
16
|
+
### Supported EVM Networks
|
|
13
17
|
|
|
14
18
|
| Chain ID | Name | SDK Value |
|
|
15
19
|
|----------|------|-----------|
|
|
@@ -55,6 +59,36 @@ Valiron operates across 41 blockchain networks. The ERC-8004 contracts are deplo
|
|
|
55
59
|
| — | Hedera Testnet | `hedera_testnet` |
|
|
56
60
|
| — | Arc Testnet | `arc_testnet` |
|
|
57
61
|
|
|
62
|
+
## Solana
|
|
63
|
+
|
|
64
|
+
Solana support is powered by [QuantuLabs 8004-solana](https://8004.qnt.sh/) — a separate registry from the EVM 8004 contracts.
|
|
65
|
+
|
|
66
|
+
| Network | SDK Value | Registry Provider |
|
|
67
|
+
|---------|-----------|-------------------|
|
|
68
|
+
| Solana Mainnet | `solana` | QuantuLabs 8004-solana |
|
|
69
|
+
|
|
70
|
+
### Program IDs (Solana)
|
|
71
|
+
|
|
72
|
+
| Program | Address |
|
|
73
|
+
|---------|---------|
|
|
74
|
+
| Identity Registry | `8oo4dC4JvBLwy5tGgiH3WwK4B9PWxL9Z4XjA2jzkQMbQ` |
|
|
75
|
+
| Reputation Registry (ATOM) | `AToMw53aiPQ8j7iHVb4fGt6nzUNxUhcPc3tbPBZuzVVb` |
|
|
76
|
+
|
|
77
|
+
### Key Differences
|
|
78
|
+
|
|
79
|
+
- **Agent IDs** are base-58 Metaplex Core asset pubkeys (not numeric token IDs)
|
|
80
|
+
- **Wallets** are base-58 Solana public keys (not `0x`-prefixed)
|
|
81
|
+
- **Reputation** may include ATOM engine metrics: `trustTier`, `qualityScore`, `confidence`, `riskScore`, `uniqueCallers`
|
|
82
|
+
- **Identity** is resolved via `loadAgent()` on the QuantuLabs SDK
|
|
83
|
+
- **Wallet → Agent resolution** uses `getAgentsByOwner()` (no subgraph)
|
|
84
|
+
|
|
85
|
+
### Configuration
|
|
86
|
+
|
|
87
|
+
| Environment Variable | Default | Description |
|
|
88
|
+
|---------------------|---------|-------------|
|
|
89
|
+
| `SOLANA_CLUSTER` | `mainnet-beta` | Solana cluster (`mainnet-beta` or `devnet`) |
|
|
90
|
+
| `SOLANA_RPC_URL` | Public RPC | Custom Solana RPC endpoint for production use |
|
|
91
|
+
|
|
58
92
|
## Specifying a Chain
|
|
59
93
|
|
|
60
94
|
### SDK
|