@valiron/sdk 1.1.1 → 1.2.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Official TypeScript SDK for **Valiron** — Trust & Reputation Middleware for API Protection
4
4
 
5
- Protect your API endpoints from bad or malicious AI agents. Valiron evaluates incoming agents using on-chain identity (ERC-8004/Solana), key-based identity for local/Web2 agents, behavioral sandbox testing, predictive risk forecasts, and Moody's-style credit ratings — so you can allow trusted agents and block risky ones automatically.
5
+ Protect your API endpoints from bad or malicious AI agents. Valiron evaluates incoming agents using on-chain identity (ERC-8004/Solana), key-based identity for local/Web2 agents, behavioral sandbox testing, optional wallet-history intelligence, predictive risk forecasts, and Moody's-style credit ratings — so you can allow trusted agents and block risky ones automatically.
6
6
 
7
7
  ## Installation
8
8
 
@@ -15,7 +15,10 @@ npm install @valiron/sdk
15
15
  ```typescript
16
16
  import { ValironSDK, createValironGate } from "@valiron/sdk";
17
17
 
18
- const valiron = new ValironSDK({ chain: "ethereum" });
18
+ const valiron = new ValironSDK({
19
+ chain: "ethereum",
20
+ apiKey: process.env.VALIRON_API_KEY, // required for Pro signals
21
+ });
19
22
 
20
23
  // Check if an on-chain agent is trusted
21
24
  const route = await valiron.checkAgent("AGENT_ID");
@@ -35,14 +38,14 @@ app.use("/api/paid", createValironGate({ sdk: valiron }));
35
38
  // Optional: choose endpoint-specific trust signals
36
39
  app.use("/api/paid", createValironGate({
37
40
  sdk: valiron,
38
- trustSignals: ["8004", "sandbox"], // Pro can add "world", "self", and "icebreaker"
41
+ trustSignals: ["8004", "sandbox"], // Pro can add "world", "self", "icebreaker", and "wallet"
39
42
  }));
40
43
 
41
44
  // Fastify, Next.js, and generic middleware also available
42
45
  // See SDK Reference for valironFastifyPlugin, createValironNextMiddleware, valironGateCheck
43
46
  ```
44
47
 
45
- No API key required for read operations.
48
+ No API key is required for basic read operations. Pro trust signals and `getWalletRisk()` require an operator API key.
46
49
 
47
50
  Use `x-agent-id` for ERC-8004/Solana agents. Use `x-agent-address` plus Valiron challenge-response for local, Web2, or non-ERC-8004 agents. Agents can follow the hosted identity skill at https://www.valiron.co/auth.md.
48
51
 
@@ -54,6 +57,7 @@ Use `x-agent-id` for ERC-8004/Solana agents. Use `x-agent-address` plus Valiron
54
57
  - **Key-Based Agents** — Support Web2 agents via EIP-191 challenge-response (auto-detected, auto-sandboxed)
55
58
  - **World ID** — Verify agent-human linkage via Worldcoin proof-of-personhood
56
59
  - **Self** — Create Self Enterprise sessions and store signed eligible-human webhook results
60
+ - **Wallet Intelligence** (Pro) — Score bounded Alchemy/Helius wallet history with confidence and explainable reasons
57
61
  - **Telemetry** — Optional anonymous usage metrics (disable with `telemetry: { enabled: false }`)
58
62
 
59
63
  ### Cleanup
package/dist/clients.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValironConfig, AgentProfile, AgentSnapshotSummary, WalletProfile, WalletResolution, SandboxResult, KeyAgentSandboxResult, GateResult, GateOptions, CallOptions, KeyAgentChallenge, KeyAgentProfile, WorldIdStatus, WorldIdAgentProfile, SelfAgentProfile, SelfProofPayload, SelfSessionRequest, SelfSessionResponse, SelfStatus, ProxyRequest, ProxyResponse } from "./types";
1
+ import { ValironConfig, AgentProfile, AgentSnapshotSummary, WalletProfile, WalletResolution, WalletRiskSnapshot, SandboxResult, KeyAgentSandboxResult, GateResult, GateOptions, CallOptions, KeyAgentChallenge, KeyAgentProfile, WorldIdStatus, WorldIdAgentProfile, SelfAgentProfile, SelfProofPayload, SelfSessionRequest, SelfSessionResponse, SelfStatus, ProxyRequest, ProxyResponse } from "./types";
2
2
  /**
3
3
  * HTTP client for the Valiron Operator API.
4
4
  *
@@ -34,6 +34,8 @@ export declare class ValironClient {
34
34
  * `GET /operator/wallet/:wallet`
35
35
  */
36
36
  getWalletProfile(wallet: string, options?: CallOptions): Promise<WalletProfile>;
37
+ /** Get an explainable wallet-history risk assessment. Pro plans only. */
38
+ getWalletRisk(wallet: string, options?: CallOptions): Promise<WalletRiskSnapshot>;
37
39
  /**
38
40
  * Resolve a wallet address to an ERC-8004 agent ID.
39
41
  *
package/dist/clients.js CHANGED
@@ -60,6 +60,7 @@ class ValironClient {
60
60
  world_included: options?.trustSignals?.includes("world"),
61
61
  icebreaker_included: options?.trustSignals?.includes("icebreaker"),
62
62
  self_included: options?.trustSignals?.includes("self"),
63
+ wallet_included: options?.trustSignals?.includes("wallet"),
63
64
  });
64
65
  return profile;
65
66
  }
@@ -80,6 +81,10 @@ class ValironClient {
80
81
  }
81
82
  return profile;
82
83
  }
84
+ /** Get an explainable wallet-history risk assessment. Pro plans only. */
85
+ async getWalletRisk(wallet, options) {
86
+ return this.get(`/operator/wallet-risk/${wallet}`, this.resolveChain(options));
87
+ }
83
88
  /**
84
89
  * Resolve a wallet address to an ERC-8004 agent ID.
85
90
  *
@@ -461,6 +466,8 @@ class ValironClient {
461
466
  return "getAgentProfile";
462
467
  if (path.startsWith("/operator/resolve-wallet/"))
463
468
  return "resolveWallet";
469
+ if (path.startsWith("/operator/wallet-risk/"))
470
+ return "getWalletRisk";
464
471
  if (path.startsWith("/operator/wallet/"))
465
472
  return "getWalletProfile";
466
473
  if (path.startsWith("/operator/trigger-sandbox/"))
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValironConfig, CallOptions, AgentProfile, AgentSnapshotSummary, WalletProfile, WalletResolution, SandboxResult, KeyAgentSandboxResult, GateResult, GateOptions, RouteDecision, KeyAgentProfile, KeyAgentChallenge, WorldIdStatus, WorldIdAgentProfile, SelfAgentProfile, SelfProofPayload, SelfSessionRequest, SelfSessionResponse, SelfStatus, ProxyRequest, ProxyResponse } from "./types";
1
+ import { ValironConfig, CallOptions, AgentProfile, AgentSnapshotSummary, WalletProfile, WalletResolution, WalletRiskSnapshot, SandboxResult, KeyAgentSandboxResult, GateResult, GateOptions, RouteDecision, KeyAgentProfile, KeyAgentChallenge, WorldIdStatus, WorldIdAgentProfile, SelfAgentProfile, SelfProofPayload, SelfSessionRequest, SelfSessionResponse, SelfStatus, ProxyRequest, ProxyResponse } from "./types";
2
2
  /**
3
3
  * Valiron SDK – Official TypeScript SDK for the Trust Layer for Agentic Economy
4
4
  *
@@ -97,6 +97,11 @@ export declare class ValironSDK {
97
97
  * ```
98
98
  */
99
99
  getWalletProfile(wallet: string, options?: CallOptions): Promise<WalletProfile>;
100
+ /**
101
+ * Analyze the on-chain history of a wallet and return an explainable score,
102
+ * confidence, feature summary, and any hard-risk flags.
103
+ */
104
+ getWalletRisk(wallet: string, options?: CallOptions): Promise<WalletRiskSnapshot>;
100
105
  /**
101
106
  * Resolve a wallet address to an ERC-8004 agent ID.
102
107
  *
package/dist/index.js CHANGED
@@ -122,6 +122,13 @@ class ValironSDK {
122
122
  async getWalletProfile(wallet, options) {
123
123
  return this.client.getWalletProfile(wallet, options);
124
124
  }
125
+ /**
126
+ * Analyze the on-chain history of a wallet and return an explainable score,
127
+ * confidence, feature summary, and any hard-risk flags.
128
+ */
129
+ async getWalletRisk(wallet, options) {
130
+ return this.client.getWalletRisk(wallet, options);
131
+ }
125
132
  /**
126
133
  * Resolve a wallet address to an ERC-8004 agent ID.
127
134
  *
@@ -23,7 +23,7 @@ export interface ValironGateConfig {
23
23
  extractAgentAddress?: (req: any) => string | null;
24
24
  /** Minimum Valiron score to allow (default: 65). */
25
25
  minScore?: number;
26
- /** Customer-selected scoring signals. Free plans support 8004+sandbox; Pro adds world+self+icebreaker. */
26
+ /** Customer-selected scoring signals. Free plans support 8004+sandbox; Pro adds world+self+icebreaker+wallet. */
27
27
  trustSignals?: TrustSignal[];
28
28
  /**
29
29
  * Client-side profile cache TTL in ms.
@@ -91,7 +91,7 @@ export interface ValironFastifyConfig {
91
91
  extractAgentAddress?: (req: any) => string | null;
92
92
  /** Minimum Valiron score to allow (default: 65). */
93
93
  minScore?: number;
94
- /** Customer-selected scoring signals. Free plans support 8004+sandbox; Pro adds world+self+icebreaker. */
94
+ /** Customer-selected scoring signals. Free plans support 8004+sandbox; Pro adds world+self+icebreaker+wallet. */
95
95
  trustSignals?: TrustSignal[];
96
96
  /**
97
97
  * Client-side profile cache TTL in ms (default: 30000).
@@ -154,7 +154,7 @@ export interface ValironNextConfig {
154
154
  extractAgentAddress?: (req: Request) => string | null;
155
155
  /** Minimum Valiron score to allow (default: 65). */
156
156
  minScore?: number;
157
- /** Customer-selected scoring signals. Free plans support 8004+sandbox; Pro adds world+self+icebreaker. */
157
+ /** Customer-selected scoring signals. Free plans support 8004+sandbox; Pro adds world+self+icebreaker+wallet. */
158
158
  trustSignals?: TrustSignal[];
159
159
  /**
160
160
  * Client-side profile cache TTL in ms (default: 30000).
@@ -270,7 +270,7 @@ export declare function valironGateCheck(sdk: ValironSDK, opts: {
270
270
  /** Key-based agent hash (web2). Checked if agentId is not provided. */
271
271
  agentAddress?: string | null;
272
272
  minScore?: number;
273
- /** Customer-selected scoring signals. Free plans support 8004+sandbox; Pro adds world+self+icebreaker. */
273
+ /** Customer-selected scoring signals. Free plans support 8004+sandbox; Pro adds world+self+icebreaker+wallet. */
274
274
  trustSignals?: TrustSignal[];
275
275
  /**
276
276
  * Client-side profile cache TTL in ms (default: 30000).
@@ -177,6 +177,7 @@ function emitGateTelemetry(sdk, payload) {
177
177
  world_included: signals?.includes("world"),
178
178
  icebreaker_included: signals?.includes("icebreaker"),
179
179
  self_included: signals?.includes("self"),
180
+ wallet_included: signals?.includes("wallet"),
180
181
  status: payload.status || "ok",
181
182
  latency_ms: payload.latencyMs,
182
183
  });
@@ -23,7 +23,7 @@ export interface PaywallConfig {
23
23
  pricePerCall: number;
24
24
  /** Minimum trust score to allow (default: 45). */
25
25
  minTrustScore?: number;
26
- /** Customer-selected scoring signals. Free plans support 8004+sandbox; Pro adds world+self+icebreaker. */
26
+ /** Customer-selected scoring signals. Free plans support 8004+sandbox; Pro adds world+self+icebreaker+wallet. */
27
27
  trustSignals?: TrustSignal[];
28
28
  /**
29
29
  * Server-side gate result TTL in ms (default: 86400000 = 24h).
@@ -66,6 +66,7 @@ class ValironOperator {
66
66
  world_included: trustSignals.includes("world"),
67
67
  icebreaker_included: trustSignals.includes("icebreaker"),
68
68
  self_included: trustSignals.includes("self"),
69
+ wallet_included: trustSignals.includes("wallet"),
69
70
  };
70
71
  void fetch(this.buildAnalyticsUrl(), {
71
72
  method: "POST",
package/dist/types.d.ts CHANGED
@@ -9,7 +9,8 @@ export type SupportedChain = "ethereum" | "monad" | "arbitrum" | "base" | "avala
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";
12
- export type TrustSignal = "8004" | "sandbox" | "world" | "icebreaker" | "self";
12
+ export type TrustSignal = "8004" | "sandbox" | "world" | "icebreaker" | "self" | "wallet";
13
+ export type WalletRiskLevel = "LOW" | "MEDIUM" | "HIGH" | "CRITICAL";
13
14
  export interface AgentIdentity {
14
15
  agentId: string;
15
16
  wallet: string;
@@ -123,6 +124,36 @@ export interface WalletProfile {
123
124
  resolutionSource?: "redis" | "subgraph" | "cache" | "none";
124
125
  timestamp: string;
125
126
  }
127
+ export interface WalletHistoryFeatures {
128
+ transactionCount: number;
129
+ activeDays: number;
130
+ walletAgeDays?: number;
131
+ uniqueCounterparties?: number;
132
+ failedTransactionRate?: number;
133
+ rapidPassThroughRate?: number;
134
+ activitySpikeRatio?: number;
135
+ flaggedCounterpartyCount?: number;
136
+ maliciousReportCount?: number;
137
+ sanctioned?: boolean;
138
+ historyTruncated?: boolean;
139
+ }
140
+ export interface WalletRiskSnapshot {
141
+ available: boolean;
142
+ wallet: string;
143
+ network: SupportedChain;
144
+ provider: "alchemy" | "helius" | "none";
145
+ score: number;
146
+ rawScore: number;
147
+ risk: number;
148
+ confidence: number;
149
+ riskLevel: WalletRiskLevel;
150
+ reasons: string[];
151
+ hardFlags: string[];
152
+ features: WalletHistoryFeatures;
153
+ observedAt: string;
154
+ expiresAt: string;
155
+ error?: string;
156
+ }
126
157
  /**
127
158
  * Response from `GET /operator/resolve-wallet/:wallet`
128
159
  *
@@ -193,7 +224,7 @@ export interface GateOptions {
193
224
  minScore?: number;
194
225
  /** TTL in ms for cached sandbox results. Stale results trigger re-testing (default: 86400000 = 24 h). */
195
226
  ttlMs?: number;
196
- /** Customer-selected scoring signals. Free plans support 8004+sandbox; Pro adds world+self+icebreaker. */
227
+ /** Customer-selected scoring signals. Free plans support 8004+sandbox; Pro adds world+self+icebreaker+wallet. */
197
228
  trustSignals?: TrustSignal[];
198
229
  /** Override the blockchain network for this call. */
199
230
  chain?: SupportedChain;
@@ -218,6 +249,8 @@ export interface GateResult {
218
249
  cached: boolean;
219
250
  /** 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. */
220
251
  provisional?: boolean;
252
+ /** Wallet intelligence result when the wallet signal was requested. */
253
+ walletRisk?: WalletRiskSnapshot;
221
254
  }
222
255
  /**
223
256
  * Options for the proxy gateway request.
@@ -4,7 +4,7 @@ Base URL: `https://valiron-edge-proxy.onrender.com`
4
4
 
5
5
  Endpoints are organized into three groups:
6
6
 
7
- - **Trust evaluation** (`/operator/agent/*`, `/operator/gate/*`, etc.) — No authentication required. Used by the SDK to evaluate agents.
7
+ - **Trust evaluation** (`/operator/agent/*`, `/operator/gate/*`, etc.) — Basic evaluation is public. Pro trust signals and wallet intelligence require `Authorization: Bearer val_op_...`.
8
8
  - **Dashboard** (`/operator/register`, `/operator/login`, `/operator/endpoints`, etc.) — JWT-authenticated. Used by the Operator Dashboard. See [DASHBOARD.md](./DASHBOARD.md) for the UI guide.
9
9
  - **Agent-ready wrappers** (`/wrap/:operatorId/*`) — Public agent-facing URLs created from Dashboard endpoint configs. These can enforce x402/MPP payment, optional trust checks, rate limits, and upstream forwarding.
10
10
 
@@ -83,6 +83,61 @@ Same structure as `GET /operator/agent/:agentId`.
83
83
 
84
84
  ---
85
85
 
86
+ ## GET /operator/wallet-risk/:wallet (Pro)
87
+
88
+ Return an explainable wallet-history assessment. Requires a Pro or Enterprise operator API key in `Authorization: Bearer val_op_...`.
89
+
90
+ ### Parameters
91
+
92
+ | Parameter | Location | Type | Required | Description |
93
+ |-----------|----------|------|----------|-------------|
94
+ | `wallet` | path | string | yes | EVM address or Solana public key |
95
+ | `chain` | query | string | no | `ethereum`, `base`, `arbitrum`, `optimism`, `polygon`, or `solana` |
96
+
97
+ ### Response — 200 OK
98
+
99
+ ```json
100
+ {
101
+ "available": true,
102
+ "wallet": "0x52ce...",
103
+ "network": "base",
104
+ "provider": "alchemy",
105
+ "score": 78,
106
+ "rawScore": 85,
107
+ "risk": 22,
108
+ "confidence": 0.81,
109
+ "riskLevel": "LOW",
110
+ "reasons": [
111
+ "Wallet has at least one year of history",
112
+ "Score is based on a bounded transaction sample"
113
+ ],
114
+ "hardFlags": [],
115
+ "features": {
116
+ "transactionCount": 146,
117
+ "activeDays": 41,
118
+ "walletAgeDays": 620,
119
+ "uniqueCounterparties": 77,
120
+ "historyTruncated": true
121
+ },
122
+ "observedAt": "2026-07-20T12:00:00.000Z",
123
+ "expiresAt": "2026-07-20T18:00:00.000Z"
124
+ }
125
+ ```
126
+
127
+ `score` is trust-oriented: higher is better. `risk` is `100 - score`. `confidence` dampens sparse assessments toward neutral. `historyTruncated: true` means the score uses a bounded sample rather than complete transaction history.
128
+
129
+ Provider failures return HTTP 200 with `available: false`, `provider: "none"`, and an `error` explaining why the signal was unavailable. Gate/profile endpoints exclude unavailable wallet intelligence from composite scoring.
130
+
131
+ ### Error Responses
132
+
133
+ | Status | Meaning |
134
+ |--------|---------|
135
+ | 400 | Invalid EVM or Solana wallet address |
136
+ | 403 | Missing operator key or plan does not include enriched profiles |
137
+ | 500 | Unexpected wallet-risk route failure |
138
+
139
+ ---
140
+
86
141
  ## GET /operator/resolve-wallet/:wallet
87
142
 
88
143
  Lightweight wallet → agentId resolution. Returns just the agent ID and how it was resolved, without the full trust profile.
@@ -159,12 +214,16 @@ Trust gate — combined on-chain reputation + sandbox check. Returns an allow/de
159
214
 
160
215
  ```json
161
216
  {
217
+ "minScore": 65,
218
+ "trustSignals": ["8004", "sandbox", "wallet"],
162
219
  "ttlMs": 86400000
163
220
  }
164
221
  ```
165
222
 
166
223
  | Field | Type | Default | Description |
167
224
  |-------|------|---------|-------------|
225
+ | `minScore` | number | 65 | Minimum composite trust score required to allow |
226
+ | `trustSignals` | string[] | automatic | Selected signals. `wallet`, `world`, `self`, and `icebreaker` require Pro |
168
227
  | `ttlMs` | number | 86400000 | Cache TTL in milliseconds (default 24 hours) |
169
228
 
170
229
  ### Response — 200 OK
@@ -183,7 +242,15 @@ Trust gate — combined on-chain reputation + sandbox check. Returns an allow/de
183
242
  "chainId": 1
184
243
  },
185
244
  "sandboxRan": false,
186
- "cached": true
245
+ "cached": true,
246
+ "walletRisk": {
247
+ "available": true,
248
+ "score": 78,
249
+ "risk": 22,
250
+ "riskLevel": "LOW",
251
+ "confidence": 0.81,
252
+ "hardFlags": []
253
+ }
187
254
  }
188
255
  ```
189
256
 
@@ -193,6 +260,8 @@ Trust gate — combined on-chain reputation + sandbox check. Returns an allow/de
193
260
  2. If the agent does not meet the threshold → `allow: false`
194
261
  3. Cached sandbox results are reused within the `ttlMs` window
195
262
  4. If no cached result exists, sandbox tests run automatically
263
+ 5. If `wallet` is selected and available, its confidence-damped score is included in the composite result
264
+ 6. Unavailable wallet history is excluded; any populated wallet hard flag forces `sandbox_only`
196
265
 
197
266
  ---
198
267
 
package/docs/CHAINS.md CHANGED
@@ -89,6 +89,30 @@ Solana support is powered by [QuantuLabs 8004-solana](https://8004.qnt.sh/) —
89
89
  | `SOLANA_CLUSTER` | `mainnet-beta` | Solana cluster (`mainnet-beta` or `devnet`) |
90
90
  | `SOLANA_RPC_URL` | Public RPC | Custom Solana RPC endpoint for production use |
91
91
 
92
+ ## Wallet Intelligence Coverage
93
+
94
+ Wallet intelligence is available on a smaller network subset than identity and ERC-8004 reputation:
95
+
96
+ | Network | SDK Value | History Provider |
97
+ |---------|-----------|------------------|
98
+ | Ethereum Mainnet | `ethereum` | Alchemy |
99
+ | Base Mainnet | `base` | Alchemy |
100
+ | Arbitrum Mainnet | `arbitrum` | Alchemy |
101
+ | Optimism Mainnet | `optimism` | Alchemy |
102
+ | Polygon Mainnet | `polygon` | Alchemy |
103
+ | Solana Mainnet | `solana` | Helius |
104
+
105
+ For other supported chains, identity and reputation continue to work, but a requested wallet assessment returns `available: false` and is excluded from composite scoring.
106
+
107
+ | Environment Variable | Default | Description |
108
+ |---------------------|---------|-------------|
109
+ | `ALCHEMY_API_KEY` | — | Enables EVM wallet history on the five supported mainnets |
110
+ | `HELIUS_API_KEY` | — | Enables Solana mainnet wallet history |
111
+ | `WALLET_HISTORY_CACHE_TTL_SECONDS` | `21600` | Available-assessment cache duration in seconds |
112
+ | `WALLET_HISTORY_TIMEOUT_MS` | `4000` | Per-provider request timeout in milliseconds |
113
+
114
+ Wallet history is a bounded sample. See [TRUST-MODEL.md](./TRUST-MODEL.md#wallet-intelligence) for scoring behavior and limitations.
115
+
92
116
  ## Specifying a Chain
93
117
 
94
118
  ### SDK
package/docs/ERRORS.md CHANGED
@@ -108,6 +108,31 @@ If the agent is registered on Monad but you query Ethereum (the default), it wil
108
108
  const valiron = new ValironSDK({ chain: "monad" });
109
109
  ```
110
110
 
111
+ ### Wallet intelligence unavailable
112
+
113
+ `getWalletRisk()` may return HTTP 200 with `available: false`. This is a graceful degradation response, not an SDK transport error. Inspect `error` for the exact reason:
114
+
115
+ - `ALCHEMY_API_KEY is not configured` for supported EVM mainnets
116
+ - `HELIUS_API_KEY is not configured` for Solana
117
+ - `Wallet history is not configured for <network>` when the selected chain is outside the supported history subset
118
+ - `Wallet history lookup timed out` or a provider HTTP/RPC error
119
+
120
+ Unavailable wallet intelligence is excluded from profile and gate composite scoring. Retry provider failures according to your policy; do not reinterpret an unavailable assessment as malicious activity.
121
+
122
+ ### Wallet intelligence requires Pro
123
+
124
+ Direct wallet-risk requests and policies containing `trustSignals: ["wallet"]` require a valid Pro or Enterprise operator key. A Free or unauthenticated request returns:
125
+
126
+ ```json
127
+ {
128
+ "error": "upgrade_required",
129
+ "feature": "enriched_profiles",
130
+ "message": "World ID, Self, Icebreaker, and wallet intelligence signals require a Pro plan. Free plans can use ERC-8004 and sandbox signals."
131
+ }
132
+ ```
133
+
134
+ Invalid EVM or Solana wallet formats return HTTP 400 before any provider request is made.
135
+
111
136
  ---
112
137
 
113
138
  ## Solana-Specific Errors
package/docs/IDENTITY.md CHANGED
@@ -10,6 +10,12 @@ Valiron supports two identity paths:
10
10
 
11
11
  Use `/operator/agent/:agentId` only for registry-backed on-chain agents. Local and Web2 agents should generate or reuse a persistent keypair, prove ownership through Valiron's challenge-response flow, and then use their `x-agent-address` for trust checks.
12
12
 
13
+ ## Wallet as a Trust Input
14
+
15
+ When a Pro policy selects `trustSignals: ["wallet"]`, Valiron evaluates the wallet associated with the chosen identity path. ERC-8004 and Solana agents use the wallet resolved from their registry identity; key-based agents use their verified persistent agent address. Wallet intelligence does not establish identity by itself—it is an additional economic-history signal applied after Valiron has a wallet address.
16
+
17
+ Use `getWalletProfile()` to resolve a wallet to an agent profile. Use `getWalletRisk()` when you need only the explainable wallet-history assessment. See [TRUST-MODEL.md](./TRUST-MODEL.md#wallet-intelligence) for supported networks and limitations.
18
+
13
19
  ## ERC-8004 Identity
14
20
 
15
21
  For EVM on-chain agents, Valiron uses the ERC-8004 standard for AI agent identity. Each agent is represented by an ERC-721 token in the Identity Registry.
@@ -96,6 +96,20 @@ app.use("/api/paid", createValironGate({ sdk: valiron }));
96
96
 
97
97
  This checks `x-agent-id` first for on-chain agents, then falls back to `x-agent-address` for key-based agents. It returns 403 for untrusted agents, is safe with Express 4 (async errors are handled), and includes a 30-second client-side cache for x402 compatibility.
98
98
 
99
+ Pro operators can include wallet history in an endpoint policy:
100
+
101
+ ```typescript
102
+ const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
103
+
104
+ app.use("/api/high-trust", createValironGate({
105
+ sdk: valiron,
106
+ trustSignals: ["8004", "sandbox", "wallet"],
107
+ minScore: 80,
108
+ }));
109
+ ```
110
+
111
+ The `wallet` signal supports Ethereum, Base, Arbitrum, Optimism, Polygon, and Solana. If wallet history is unavailable, Valiron excludes it from the composite score instead of penalizing the agent.
112
+
99
113
  Or use `getAgentProfile()` directly for on-chain custom logic:
100
114
 
101
115
  ```typescript
@@ -235,6 +249,7 @@ process.on("SIGTERM", async () => {
235
249
  - **[Key-Based Agents](./SDK-REFERENCE.md#key-based-agents)** — Support Web2 agents without on-chain identity
236
250
  - **[World ID](./SDK-REFERENCE.md#world-id-methods)** — Verify agent-human linkage
237
251
  - **[Self](./SDK-REFERENCE.md#self-methods)** — Create Self Enterprise sessions and verify eligible-human linkage
252
+ - **[Wallet Intelligence](./TRUST-MODEL.md#wallet-intelligence)** — Add explainable wallet-history risk to Pro endpoint policies
238
253
  - **[Fastify / Next.js / Hono middleware](./SDK-REFERENCE.md#middleware)** — Framework-specific middleware
239
254
  - **[Plans & Limits](./SDK-REFERENCE.md#plans--limits)** — Free vs Pro feature comparison
240
255
 
package/docs/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## What is Valiron?
6
6
 
7
- Valiron is trust infrastructure for API sellers. It evaluates AI agents using on-chain identity (ERC-8004 or Solana), key-based identity for non-ERC-8004 agents, behavioral sandbox testing, and a Moody's-style credit rating system — so you can allow trusted agents and block risky ones automatically.
7
+ Valiron is trust infrastructure for API sellers. It evaluates AI agents using on-chain identity (ERC-8004 or Solana), key-based identity for non-ERC-8004 agents, behavioral sandbox testing, optional wallet-history intelligence, and a Moody's-style credit rating system — so you can allow trusted agents and block risky ones automatically.
8
8
 
9
9
  **If you sell APIs**, Valiron's core product is middleware deployed within the API backend through the SDK. It provides direct control over trust checks, routing, sandboxing, payment gating, and analytics before requests reach application handlers.
10
10
 
@@ -36,6 +36,7 @@ Valiron also provides **API Scaffolding** as a separate product for organization
36
36
  - **API Scaffolding**: A separate hosted Valiron wrapper product at `/wrap/{operatorId}/{path}` that can collect x402/MPP payments, optionally gate by trust, and forward to an upstream API.
37
37
  - **Payment Protocol**: `x402` for Base/USDC HTTP payments or `mpp` for Machine Payment Protocol payments through Tempo.
38
38
  - **Sandbox**: An isolated test environment where Valiron evaluates agent behavior before granting production access.
39
+ - **Wallet Intelligence**: A Pro trust signal that converts bounded Alchemy or Helius wallet history into an explainable score, risk level, confidence, and reasons.
39
40
  - **Liveness** (Solana only): Endpoint health probe via `isItAlive()`. See [API-REFERENCE.md](./API-REFERENCE.md#solana-support).
40
41
 
41
42
  ## Which Identity Path Should I Use?
@@ -22,7 +22,7 @@ const valiron = new ValironSDK(config?: ValironConfig);
22
22
 
23
23
  | Field | Type | Default | Description |
24
24
  |-------|------|---------|-------------|
25
- | `apiKey` | string | — | API key (optional for read operations) |
25
+ | `apiKey` | string | — | Operator API key. Optional for basic reads; required for Pro trust signals and `getWalletRisk()` |
26
26
  | `endpoint` | string | `https://valiron-edge-proxy.onrender.com` | API base URL |
27
27
  | `chain` | SupportedChain | `"ethereum"` | Default blockchain network |
28
28
  | `timeout` | number | method-aware | Request timeout in milliseconds. Defaults are 10s generally, 15s for `gate()`/`proxy()`, and 30s for sandbox triggers. If set, this value overrides all method-aware defaults. |
@@ -158,6 +158,29 @@ const profile = await valiron.getWalletProfile("VSAnVX4MQjEXreHc92iHxWuXPQZ1tjwi
158
158
 
159
159
  ---
160
160
 
161
+ ### getWalletRisk(wallet, options?)
162
+
163
+ Return an explainable wallet-history assessment. This is a Pro feature and requires an operator API key.
164
+
165
+ ```typescript
166
+ const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
167
+ const assessment = await valiron.getWalletRisk("0x52ce...", { chain: "base" });
168
+
169
+ if (assessment.available) {
170
+ console.log(assessment.score); // 0-100 trust score; higher is better
171
+ console.log(assessment.risk); // 100 - score
172
+ console.log(assessment.riskLevel); // "LOW" | "MEDIUM" | "HIGH" | "CRITICAL"
173
+ console.log(assessment.confidence); // 0-1 history coverage confidence
174
+ console.log(assessment.reasons);
175
+ } else {
176
+ console.log(assessment.error); // missing key, unsupported network, timeout, etc.
177
+ }
178
+ ```
179
+
180
+ Supported history networks are Ethereum, Base, Arbitrum, Optimism, Polygon, and Solana. EVM uses Alchemy; Solana uses Helius. The assessment uses bounded samples rather than complete transaction history. It does not provide sanctions, mixer, scam, or criminal attribution without an additional intelligence provider.
181
+
182
+ ---
183
+
161
184
  ### resolveWallet(wallet, options?)
162
185
 
163
186
  Lightweight wallet → agentId resolution without the full trust profile. Useful when you only need to know which agent owns a wallet (e.g. after extracting a wallet from an x402 payment header).
@@ -273,7 +296,9 @@ Trust gate — single call for allow/deny decisions. Combines on-chain reputatio
273
296
 
274
297
  ```typescript
275
298
  const result = await valiron.gate(agentId: string, options?: {
299
+ minScore?: number; // default: 65
276
300
  ttlMs?: number; // default: 86400000 (24h)
301
+ trustSignals?: Array<"8004" | "sandbox" | "world" | "self" | "icebreaker" | "wallet">;
277
302
  chain?: SupportedChain;
278
303
  }): Promise<GateResult>;
279
304
  ```
@@ -292,6 +317,7 @@ interface GateResult {
292
317
  chain: ChainContext;
293
318
  sandboxRan: boolean;
294
319
  cached: boolean;
320
+ walletRisk?: WalletRiskSnapshot;
295
321
  }
296
322
  ```
297
323
 
@@ -360,7 +386,7 @@ import { ValironSDK, createValironGate } from "@valiron/sdk";
360
386
  const gate = createValironGate(config: {
361
387
  sdk: ValironSDK;
362
388
  minScore?: number; // default: 65
363
- trustSignals?: Array<"8004" | "sandbox" | "world" | "self" | "icebreaker">;
389
+ trustSignals?: Array<"8004" | "sandbox" | "world" | "self" | "icebreaker" | "wallet">;
364
390
  cacheTtlMs?: number; // default: 30000 (30s client-side cache)
365
391
  extractAgentId?: (req: Request) => string | null;
366
392
  extractAgentAddress?: (req: Request) => string | null;
@@ -735,6 +761,29 @@ Returned by `gate()` and middleware.
735
761
  | `chain` | object | Chain context |
736
762
  | `sandboxRan` | boolean | Whether sandbox was executed |
737
763
  | `cached` | boolean | Whether the result was served from cache |
764
+ | `walletRisk` | WalletRiskSnapshot? | Wallet assessment when the `wallet` signal was requested |
765
+
766
+ ### WalletRiskSnapshot
767
+
768
+ Returned by `getWalletRisk()` and optionally included in agent profiles and gate results.
769
+
770
+ | Field | Type | Description |
771
+ |-------|------|-------------|
772
+ | `available` | boolean | Whether provider-backed history was available |
773
+ | `wallet` | string | Normalized wallet address |
774
+ | `network` | SupportedChain | Evaluated network |
775
+ | `provider` | `alchemy` \| `helius` \| `none` | History provider used |
776
+ | `score` | number | Confidence-damped trust score, 0-100; higher is better |
777
+ | `rawScore` | number | Score before confidence damping |
778
+ | `risk` | number | `100 - score` |
779
+ | `confidence` | number | History-coverage confidence from 0-1 |
780
+ | `riskLevel` | string | LOW / MEDIUM / HIGH / CRITICAL |
781
+ | `reasons` | string[] | Explainable scoring reasons |
782
+ | `hardFlags` | string[] | Hard-risk flags; any populated flag forces `sandbox_only` in gates |
783
+ | `features` | WalletHistoryFeatures | Normalized history measurements |
784
+ | `observedAt` | string | ISO observation timestamp |
785
+ | `expiresAt` | string | ISO cache-expiry timestamp |
786
+ | `error` | string? | Provider/configuration failure when unavailable |
738
787
 
739
788
  ### AgentProfile
740
789
 
@@ -774,6 +823,8 @@ import {
774
823
  valironGateCheck,
775
824
  isValidAddress,
776
825
  generateChallenge,
826
+ type WalletRiskSnapshot,
827
+ type WalletRiskLevel,
777
828
  } from "@valiron/sdk";
778
829
  ```
779
830
 
@@ -790,5 +841,6 @@ import {
790
841
  | Analytics & logs | — | ✓ |
791
842
  | Evaluation history | — | ✓ |
792
843
  | Custom tier thresholds | — | ✓ |
844
+ | Wallet intelligence | — | ✓ |
793
845
 
794
846
  Pro plan requires an operator API key (`val_op_` prefix) from the [Operator Dashboard](./DASHBOARD.md).
@@ -31,6 +31,7 @@ Supported signals:
31
31
  | `world` | World ID human-agent link | Pro |
32
32
  | `self` | Self eligible-human proof and optional Self Agent ID link | Pro |
33
33
  | `icebreaker` | Icebreaker human/background attestation | Pro |
34
+ | `wallet` | Explainable wallet-history activity and risk signal | Pro |
34
35
 
35
36
  When multiple signals are selected, Valiron computes each signal on a `0-100` scale and normalizes the configured weights across only those selected signals. The default weights are:
36
37
 
@@ -41,9 +42,37 @@ When multiple signals are selected, Valiron computes each signal on a `0-100` sc
41
42
  | `world` | 15 |
42
43
  | `self` | 15 |
43
44
  | `icebreaker` | 5 |
45
+ | `wallet` | 15 |
44
46
 
45
47
  If no signals are specified, Valiron uses the plug-and-play default: sandbox plus any other available trust signals.
46
48
 
49
+ ## Wallet Intelligence
50
+
51
+ The optional `wallet` signal evaluates the history of the wallet Valiron resolves for an incoming agent. EVM history is read through Alchemy on Ethereum, Base, Arbitrum, Optimism, and Polygon. Solana history is read through Helius.
52
+
53
+ The assessment returns a `0-100` trust score where higher is better, `risk = 100 - score`, a `LOW` / `MEDIUM` / `HIGH` / `CRITICAL` risk level, a confidence value, explainable reasons, and the normalized history features used by the scorer. Current features include transaction count, active days, wallet age, unique counterparties on EVM, failed transaction rate on Solana, and recent activity spikes when enough timestamps are available.
54
+
55
+ Confidence dampens sparse assessments toward a neutral score. If a provider key is missing, the network is unsupported, or the provider times out, wallet intelligence is marked unavailable and excluded from the composite score rather than being treated as malicious. A populated hard-risk flag forces `sandbox_only`, but the current history providers do not independently supply sanctions or malicious-address attribution.
56
+
57
+ Wallet history is bounded, not exhaustive: EVM uses up to 100 recent incoming and 100 recent outgoing transfers plus oldest-transfer lookups; Solana uses up to 1,000 recent signatures. The signal should not be described as AML, sanctions compliance, mixer detection, or complete fund tracing without an additional blockchain-intelligence provider.
58
+
59
+ Request wallet intelligence directly:
60
+
61
+ ```typescript
62
+ const assessment = await valiron.getWalletRisk("0x52ce...", { chain: "base" });
63
+ console.log(assessment.score, assessment.riskLevel, assessment.confidence);
64
+ ```
65
+
66
+ Or include it in an endpoint policy:
67
+
68
+ ```typescript
69
+ app.use("/api/high-trust", createValironGate({
70
+ sdk: valiron,
71
+ trustSignals: ["8004", "sandbox", "wallet"],
72
+ minScore: 80,
73
+ }));
74
+ ```
75
+
47
76
  ## Behavioral Factors
48
77
 
49
78
  Valiron evaluates agents across multiple behavioral dimensions. The behavioral evaluation is holistic — no single sandbox behavior determines the outcome. The specific factors evaluated and their weights are proprietary and not disclosed.
package/docs/llms.txt CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Protect your API endpoints from bad or malicious AI agents.
4
4
 
5
- Valiron is trust and reputation middleware for API sellers. It evaluates incoming AI agents using on-chain identity (ERC-8004/Solana), key-based identity for local/Web2/non-ERC-8004 agents, behavioral sandbox testing, predictive risk forecasts, and Moody's-style credit ratings (AAA to C). Trustworthy agents get production access. Risky agents are throttled, sandboxed, or blocked — automatically.
5
+ Valiron is trust and reputation middleware for API sellers. It evaluates incoming AI agents using on-chain identity (ERC-8004/Solana), key-based identity for local/Web2/non-ERC-8004 agents, behavioral sandbox testing, optional wallet-history intelligence, predictive risk forecasts, and Moody's-style credit ratings (AAA to C). Trustworthy agents get production access. Risky agents are throttled, sandboxed, or blocked — automatically.
6
6
 
7
7
  ## Identity Paths
8
8
 
@@ -20,6 +20,11 @@ GET /operator/agent/{agentId}?chain={chain}
20
20
  ### Lookup by wallet
21
21
  GET /operator/wallet/{wallet}?chain={chain}
22
22
 
23
+ ### Wallet-history risk (Pro)
24
+ GET /operator/wallet-risk/{wallet}?chain={chain}
25
+ Requires: Authorization: Bearer val_op_...
26
+ Returns: { available, wallet, network, provider, score, rawScore, risk, confidence, riskLevel, reasons, hardFlags, features, observedAt, expiresAt, error? }
27
+
23
28
  ### Resolve wallet to agent ID
24
29
  GET /operator/resolve-wallet/{wallet}?chain={chain}
25
30
  Returns: { wallet, agentId, source, chainId?, agentName?, timestamp }
@@ -72,6 +77,9 @@ const route = await valiron.checkAgent("AGENT_ID");
72
77
  // Full profile
73
78
  const profile = await valiron.getAgentProfile("AGENT_ID");
74
79
 
80
+ // Pro wallet-history assessment
81
+ const walletRisk = await valiron.getWalletRisk("0x...", { chain: "base" });
82
+
75
83
  // Resolve wallet → agentId (lightweight)
76
84
  const res = await valiron.resolveWallet("0x...");
77
85
  // Returns: { agentId, source: "redis"|"subgraph"|"cache"|"none" }
@@ -135,13 +143,16 @@ PaywallConfig options: pricePerCall (number, required), minTrustScore (number, d
135
143
 
136
144
  ## Trust Model
137
145
 
138
- Valiron evaluates agents using five independent trust signals:
146
+ Valiron evaluates agents using six independent trust signals:
139
147
 
140
148
  1. **On-Chain Reputation (ERC-8004)** — Feedback from other agents/operators (0-100 per review).
141
149
  2. **Behavioral Sandbox** — Simulated API interactions testing rate-limit compliance, auth behavior, payment handling, injection safety, PII handling, session isolation, and task completion. Exact weights are proprietary.
142
150
  3. **World ID** — Proof-of-personhood via Worldcoin. Verification levels: orb (biometric, highest boost), device (passkey), phone (SMS).
143
151
  4. **Self** — Self Enterprise eligible-human proof via signed session webhooks, with optional Self Agent ID binding.
144
152
  5. **Icebreaker** — Human attestation via Ethereum Attestation Service (EAS) on Base. A human attests this is their "designated agent."
153
+ 6. **Wallet Intelligence** (Pro) — Bounded Alchemy history on Ethereum/Base/Arbitrum/Optimism/Polygon or Helius signature history on Solana. Returns a trust score, inverse risk, confidence, reasons, hard flags, and normalized activity features.
154
+
155
+ Wallet intelligence is confidence-damped toward neutral when history is sparse. Provider failures are excluded from composite scoring. Current adapters do not provide sanctions, mixer, scam, or criminal attribution and do not trace complete transaction history.
145
156
 
146
157
  Predictive risk is available in the dashboard/API for observed agents. It forecasts the next score, pass probability, trend, confidence, recommended policy, suggested tests, and reasons from recent sandbox evaluations, behavioral fingerprints, and operator call logs. It does not replace the trust gate; low-confidence forecasts mean more evaluation data is needed.
147
158
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valiron/sdk",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "Official TypeScript SDK for Valiron — Trust & Reputation Middleware for API Protection",
5
5
  "repository": {
6
6
  "type": "git",