maiat-sdk 0.2.0 → 0.3.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
@@ -19,10 +19,14 @@ const maiat = new Maiat();
19
19
  const trusted = await maiat.isTrusted("0x...");
20
20
 
21
21
  // Token safety check
22
- const safe = await maiat.isTokenSafe("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913");
22
+ const safe = await maiat.isTokenSafe(
23
+ "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
24
+ );
23
25
 
24
26
  // Full trust score
25
- const score = await maiat.agentTrust("0xAf1aE6F344c60c7Fe56CB53d1809f2c0B997a2b9");
27
+ const score = await maiat.agentTrust(
28
+ "0xE6ac05D2b50cd525F793024D75BB6f519a52Af5D",
29
+ );
26
30
  console.log(score.trustScore, score.verdict); // 69, "caution"
27
31
 
28
32
  // Trust-verified swap quote
@@ -40,22 +44,22 @@ console.log(swap.calldata); // ready-to-sign tx calldata
40
44
 
41
45
  ### `new Maiat(config?)`
42
46
 
43
- | Option | Default | Description |
44
- |--------|---------|-------------|
45
- | `baseUrl` | `https://maiat-protocol.vercel.app` | API base URL |
46
- | `apiKey` | — | Optional API key for higher rate limits |
47
- | `timeout` | `15000` | Request timeout (ms) |
47
+ | Option | Default | Description |
48
+ | --------- | ----------------------------------- | --------------------------------------- |
49
+ | `baseUrl` | `https://app.maiat.io` | API base URL |
50
+ | `apiKey` | — | Optional API key for higher rate limits |
51
+ | `timeout` | `15000` | Request timeout (ms) |
48
52
 
49
53
  ### Methods
50
54
 
51
- | Method | Returns | Description |
52
- |--------|---------|-------------|
53
- | `agentTrust(address)` | `AgentTrustResult` | Full trust score + breakdown |
54
- | `tokenCheck(address)` | `TokenCheckResult` | Token safety analysis |
55
- | `trustSwap(params)` | `TrustSwapResult` | Swap quote with trust verification |
56
- | `listAgents(limit?)` | `{ agents, total }` | Browse indexed agents |
57
- | `isTrusted(address, threshold?)` | `boolean` | Quick trust check (default ≥60) |
58
- | `isTokenSafe(address)` | `boolean` | Quick token safety check |
55
+ | Method | Returns | Description |
56
+ | -------------------------------- | ------------------- | ---------------------------------- |
57
+ | `agentTrust(address)` | `AgentTrustResult` | Full trust score + breakdown |
58
+ | `tokenCheck(address)` | `TokenCheckResult` | Token safety analysis |
59
+ | `trustSwap(params)` | `TrustSwapResult` | Swap quote with trust verification |
60
+ | `listAgents(limit?)` | `{ agents, total }` | Browse indexed agents |
61
+ | `isTrusted(address, threshold?)` | `boolean` | Quick trust check (default ≥60) |
62
+ | `isTokenSafe(address)` | `boolean` | Quick token safety check |
59
63
 
60
64
  ## Outcome Reporting (Training Data)
61
65
 
@@ -76,8 +80,8 @@ if (score.trustScore >= 60) {
76
80
  await maiat.reportOutcome({
77
81
  target: "0xCounterparty",
78
82
  action: "swap",
79
- result: "success", // or "failure", "scam"
80
- txHash: "0x...", // on-chain proof
83
+ result: "success", // or "failure", "scam"
84
+ txHash: "0x...", // on-chain proof
81
85
  maiatVerdict: score.verdict,
82
86
  maiatScore: score.trustScore,
83
87
  });
@@ -87,6 +91,6 @@ This closes the feedback loop: check → act → report → oracle gets smarter.
87
91
 
88
92
  ## Links
89
93
 
90
- - Protocol: [maiat-protocol.vercel.app](https://maiat-protocol.vercel.app)
94
+ - Protocol: [app.maiat.io](https://app.maiat.io)
91
95
  - GitHub: [JhiNResH/maiat-protocol](https://github.com/JhiNResH/maiat-protocol)
92
96
  - ACP: [Agent #3723 on Virtuals](https://app.virtuals.io/acp)
package/dist/index.d.ts CHANGED
@@ -7,10 +7,10 @@
7
7
  * const score = await maiat.agentTrust("0x...");
8
8
  * const token = await maiat.tokenCheck("0x...");
9
9
  * const swap = await maiat.trustSwap({ ... });
10
- * await maiat.reportOutcome({ agent: "0x...", action: "swap", result: "success" });
10
+ * await maiat.reportOutcome({ jobId: "...", outcome: "success" });
11
11
  */
12
12
  export interface MaiatConfig {
13
- /** Base URL for Maiat Protocol API. Default: https://maiat-protocol.vercel.app */
13
+ /** Base URL for Maiat Protocol API. Default: https://app.maiat.io */
14
14
  baseUrl?: string;
15
15
  /** Optional API key for higher rate limits */
16
16
  apiKey?: string;
@@ -32,6 +32,17 @@ export interface AgentTrustResult {
32
32
  };
33
33
  verdict: "proceed" | "caution" | "avoid";
34
34
  lastUpdated: string;
35
+ feedback?: {
36
+ queryId: string;
37
+ };
38
+ }
39
+ export interface DeepAnalysisResult {
40
+ address: string;
41
+ trustScore: number;
42
+ verdict: "proceed" | "caution" | "avoid";
43
+ deepAnalysis: Record<string, unknown>;
44
+ signals: Record<string, unknown>;
45
+ lastUpdated: string;
35
46
  }
36
47
  export interface TokenCheckResult {
37
48
  address: string;
@@ -42,6 +53,14 @@ export interface TokenCheckResult {
42
53
  riskSummary: string;
43
54
  dataSource: string;
44
55
  }
56
+ export interface ForensicsResult {
57
+ address: string;
58
+ chain: string;
59
+ forensics: Record<string, unknown>;
60
+ riskFlags: string[];
61
+ verdict: "proceed" | "caution" | "avoid";
62
+ lastUpdated: string;
63
+ }
45
64
  export interface TrustSwapParams {
46
65
  swapper: string;
47
66
  tokenIn: string;
@@ -87,6 +106,24 @@ export interface OutcomeResponse {
87
106
  logged: boolean;
88
107
  id?: string;
89
108
  }
109
+ export interface OutcomeParams {
110
+ jobId: string;
111
+ outcome: "success" | "failure" | "partial" | "expired";
112
+ reporter?: string;
113
+ note?: string;
114
+ }
115
+ export interface OutcomeResult {
116
+ success: boolean;
117
+ id?: string;
118
+ message?: string;
119
+ }
120
+ export interface ScarabResult {
121
+ address: string;
122
+ balance: string;
123
+ balanceFormatted: number;
124
+ tier: string;
125
+ lastUpdated: string;
126
+ }
90
127
  export declare class Maiat {
91
128
  private baseUrl;
92
129
  private apiKey?;
@@ -96,8 +133,12 @@ export declare class Maiat {
96
133
  private request;
97
134
  /** Get trust score for an ACP agent by wallet address */
98
135
  agentTrust(address: string): Promise<AgentTrustResult>;
136
+ /** Get deep analysis for an ACP agent by wallet address */
137
+ deep(address: string): Promise<DeepAnalysisResult>;
99
138
  /** Check if a token is safe (honeypot, rug, liquidity) */
100
139
  tokenCheck(address: string): Promise<TokenCheckResult>;
140
+ /** Get forensics data for a token address */
141
+ forensics(address: string, chain?: string): Promise<ForensicsResult>;
101
142
  /** Get a trust-verified swap quote with calldata */
102
143
  trustSwap(params: TrustSwapParams): Promise<TrustSwapResult>;
103
144
  /** List indexed agents with trust scores */
@@ -105,16 +146,17 @@ export declare class Maiat {
105
146
  agents: AgentTrustResult[];
106
147
  total: number;
107
148
  }>;
149
+ /** Get SCARAB token balance for an address */
150
+ scarab(address: string): Promise<ScarabResult>;
108
151
  /**
109
- * Report the outcome of an action taken after a Maiat trust check.
110
- * This is the most valuable data for training the oracle.
152
+ * Report the outcome of a job (new API).
111
153
  *
112
154
  * Example flow:
113
- * 1. maiat.isTrusted("0x...") → true
114
- * 2. You swap with that agent
115
- * 3. maiat.reportOutcome({ target: "0x...", action: "swap", result: "success" })
155
+ * 1. maiat.agentTrust("0x...") → proceed
156
+ * 2. You execute the job
157
+ * 3. maiat.reportOutcome({ jobId: "...", outcome: "success" })
116
158
  */
117
- reportOutcome(report: OutcomeReport): Promise<OutcomeResponse>;
159
+ reportOutcome(params: OutcomeParams): Promise<OutcomeResult>;
118
160
  /** Quick check: is this agent trustworthy? Returns true if score >= threshold */
119
161
  isTrusted(address: string, threshold?: number): Promise<boolean>;
120
162
  /** Quick check: is this token safe to swap? */
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@
7
7
  * const score = await maiat.agentTrust("0x...");
8
8
  * const token = await maiat.tokenCheck("0x...");
9
9
  * const swap = await maiat.trustSwap({ ... });
10
- * await maiat.reportOutcome({ agent: "0x...", action: "swap", result: "success" });
10
+ * await maiat.reportOutcome({ jobId: "...", outcome: "success" });
11
11
  */
12
12
  // ─── Client ───────────────────────────────────────────────────────────────────
13
13
  export class Maiat {
@@ -16,7 +16,7 @@ export class Maiat {
16
16
  clientId;
17
17
  timeout;
18
18
  constructor(config = {}) {
19
- this.baseUrl = (config.baseUrl ?? "https://maiat-protocol.vercel.app").replace(/\/$/, "");
19
+ this.baseUrl = (config.baseUrl ?? "https://app.maiat.io").replace(/\/$/, "");
20
20
  this.apiKey = config.apiKey;
21
21
  this.clientId = config.clientId;
22
22
  this.timeout = config.timeout ?? 15_000;
@@ -43,10 +43,19 @@ export class Maiat {
43
43
  async agentTrust(address) {
44
44
  return this.request(`/api/v1/agent/${address}`);
45
45
  }
46
+ /** Get deep analysis for an ACP agent by wallet address */
47
+ async deep(address) {
48
+ return this.request(`/api/v1/agent/${address}/deep`);
49
+ }
46
50
  /** Check if a token is safe (honeypot, rug, liquidity) */
47
51
  async tokenCheck(address) {
48
52
  return this.request(`/api/v1/token/${address}`);
49
53
  }
54
+ /** Get forensics data for a token address */
55
+ async forensics(address, chain) {
56
+ const query = chain ? `?chain=${chain}` : "";
57
+ return this.request(`/api/v1/token/${address}/forensics${query}`);
58
+ }
50
59
  /** Get a trust-verified swap quote with calldata */
51
60
  async trustSwap(params) {
52
61
  return this.request("/api/v1/swap/quote", {
@@ -58,20 +67,23 @@ export class Maiat {
58
67
  async listAgents(limit = 50) {
59
68
  return this.request(`/api/v1/agents?limit=${limit}`);
60
69
  }
61
- // ─── Outcome Reporting (Training Data) ────────────────────────────────────
70
+ /** Get SCARAB token balance for an address */
71
+ async scarab(address) {
72
+ return this.request(`/api/v1/scarab?address=${address}`);
73
+ }
74
+ // ─── Outcome Reporting ────────────────────────────────────────────────────
62
75
  /**
63
- * Report the outcome of an action taken after a Maiat trust check.
64
- * This is the most valuable data for training the oracle.
76
+ * Report the outcome of a job (new API).
65
77
  *
66
78
  * Example flow:
67
- * 1. maiat.isTrusted("0x...") → true
68
- * 2. You swap with that agent
69
- * 3. maiat.reportOutcome({ target: "0x...", action: "swap", result: "success" })
79
+ * 1. maiat.agentTrust("0x...") → proceed
80
+ * 2. You execute the job
81
+ * 3. maiat.reportOutcome({ jobId: "...", outcome: "success" })
70
82
  */
71
- async reportOutcome(report) {
83
+ async reportOutcome(params) {
72
84
  return this.request("/api/v1/outcome", {
73
85
  method: "POST",
74
- body: JSON.stringify(report),
86
+ body: JSON.stringify(params),
75
87
  });
76
88
  }
77
89
  // ─── Convenience ──────────────────────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maiat-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Maiat Protocol SDK — trust scores, token safety, and swap verification for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",