agentsla 2.0.1 → 2.0.3

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.
Files changed (4) hide show
  1. package/README.md +51 -26
  2. package/index.js +95 -154
  3. package/package.json +22 -12
  4. package/test.js +0 -32
package/README.md CHANGED
@@ -1,50 +1,75 @@
1
- # AgentSLA SDK (v2.0.0)
1
+ # AgentSLA (`agentsla` v2.0.3)
2
2
 
3
- Official M2M JavaScript/TypeScript SDK for **AgentSLA** (https://agentsla.io) — the autonomous API telemetry directory, EIP-712 cryptographic SLA oracle, Streamable HTTP MCP server, and Circle USDC escrow protocol on **Base Mainnet (Chain ID 8453)**.
3
+ SDK and MCP client for **AgentSLA**: search indexed APIs and MCP servers, check any endpoint for free, get
4
+ EIP-712 signed SLA checks, and use refundable USDC escrow on **Base Mainnet (chain 8453)**.
4
5
 
5
- ## Production Infrastructure (Base Mainnet)
6
+ - **Site:** [https://agentsla.io](https://agentsla.io)
7
+ - **MCP server (streamable HTTP):** `https://agentsla.io/mcp`
8
+ - **MCP config:** [https://agentsla.io/.well-known/mcp.json](https://agentsla.io/.well-known/mcp.json)
9
+ - **OpenAPI:** [https://agentsla.io/openapi.json](https://agentsla.io/openapi.json)
10
+ - **llms.txt:** [https://agentsla.io/llms.txt](https://agentsla.io/llms.txt)
11
+ - **Escrow contract (Base):** `0x5c8D11AB570D7384d01226bC80123D0dD103Fb57`
12
+ - **USDC (Base):** `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`
6
13
 
7
- - **Verified Escrow Contract:** [0x6ca6cDDd6EC59D75Ea0a36882AC57fc199Ba79CD](https://basescan.org/address/0x6ca6cDDd6EC59D75Ea0a36882AC57fc199Ba79CD)
8
- - **Settlement Token (Circle USDC):** [0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913](https://basescan.org/token/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) (6 decimals)
9
- - **Streamable HTTP MCP Endpoint:** https://agentsla.io/mcp
10
- - **LLM Discovery Manifests:** https://agentsla.io/llms.txt | https://agentsla.io/llms-full.txt
11
- - **OpenAPI 3.1.0 Spec:** https://agentsla.io/openapi.json
14
+ > **Upgrade from 2.0.2 or earlier.** Those versions pointed at a retired escrow contract
15
+ > (`0x6ca6cDDd…99Ba79CD`) and sent `jobId: 1` with every `verifyEndpoint` call. 2.0.3 uses the current contract
16
+ > and only sends `jobId` when you pass one.
12
17
 
13
- ## Installation
18
+ ## Install
14
19
 
15
20
  ```bash
16
21
  npm install agentsla ethers
17
22
  ```
18
23
 
19
- ## Quick Start
24
+ ## Search the directory
20
25
 
21
26
  ```javascript
22
- import { ethers } from "ethers";
23
27
  import { AgentSLA } from "agentsla";
24
28
 
25
- const provider = new ethers.JsonRpcProvider("https://mainnet.base.org");
26
- const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
27
- const client = new AgentSLA({ signer: wallet });
29
+ const sla = new AgentSLA();
30
+ const result = await sla.discoverApis({ category: "mcp-connectors", search: "weather", limit: 10 });
31
+ console.log(result.matchedCount, result.agents); // listings are in `agents`
32
+ ```
33
+
34
+ Listings are indexed and periodically probed, not audited or endorsed.
35
+
36
+ ## Check an endpoint (free)
37
+
38
+ ```javascript
39
+ const check = await sla.checkEndpoint({ endpointUrl: "https://api.example.com/health", maxLatencyMs: 1000 });
40
+ console.log(check.httpStatus, check.edgeLatencyMs, check.meetsSla);
41
+ ```
42
+
43
+ ## Signed check (EIP-712)
28
44
 
29
- // 1. Discover top-ranked APIs by category
30
- const directory = await client.discover("ai-models");
45
+ A signed check needs one of: a 7-day pass (5 USDC), an active escrow job, or an x402 payment of 0.05 USDC per
46
+ check on `POST https://agentsla.io/v1/verify`.
31
47
 
32
- // 2. Probe an endpoint and receive a signed EIP-712 SLA attestation
33
- const proof = await client.verify("https://mainnet.base.org");
48
+ ```javascript
49
+ const sla = new AgentSLA({ privateKey: process.env.AGENT_PRIVATE_KEY }); // the agent's own wallet
50
+ if (!(await sla.isSubscribed())) await sla.subscribeSevenDays(); // approves and pays 5 USDC on Base
51
+ const signed = await sla.verifyEndpoint({ endpointUrl: "https://api.example.com/health" });
52
+ console.log(signed.slaMet, signed.eip712Signature, signed.oracleSigner);
53
+ ```
54
+
55
+ Without a pass the response has `paymentRequired: true` and the payment options. Verify a signature with
56
+ `ethers.verifyTypedData` using the domain and types from `GET https://agentsla.io/v1/attestations?url=...`.
57
+
58
+ ## MCP tools
34
59
 
35
- // 3. Lock Circle USDC in Base Mainnet Escrow for an M2M API task
36
- const receipt = await client.lockEscrowUsdc(wallet.address, 1, "0.01");
60
+ ```javascript
61
+ const res = await sla.callMcpTool("check_endpoint", { endpointUrl: "https://api.example.com" });
37
62
  ```
38
63
 
39
- ## Streamable HTTP MCP Configuration
64
+ Tools: `discover_monitored_apis` (free), `check_endpoint` (free), `verify_endpoint_sla` (pass required),
65
+ `get_usdc_escrow_contract` (free).
66
+
67
+ ## Connect Claude Desktop, Cursor or Windsurf
40
68
 
41
69
  ```json
42
70
  {
43
71
  "mcpServers": {
44
- "agentsla": {
45
- "type": "streamable-http",
46
- "url": "https://agentsla.io/mcp"
47
- }
72
+ "agentsla": { "url": "https://agentsla.io/mcp" }
48
73
  }
49
74
  }
50
- ```
75
+ ```
package/index.js CHANGED
@@ -1,192 +1,133 @@
1
1
  import { ethers } from "ethers";
2
2
 
3
- export const DEFAULT_ORACLE_URL = "https://agentsla-oracle.agentsla-dev.workers.dev";
4
- export const DEFAULT_MCP_URL = "https://agentsla.io/mcp";
5
- export const ESCROW_ADDRESS = "0x6ca6cDDd6EC59D75Ea0a36882AC57fc199Ba79CD";
6
- export const USDC_ADDRESS = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
7
- export const BASE_CHAIN_ID = 8453;
8
-
9
- export const ESCROW_ABI = [
10
- "function owner() view returns (address)",
11
- "function payoutWallet() view returns (address)",
12
- "function usdcToken() view returns (address)",
13
- "function nextJobId() view returns (uint256)",
14
- "function accumulatedFees() view returns (uint256)",
15
- "function isSubscribed(address) view returns (bool)",
16
- "function jobs(uint256) view returns (address creator, address agent, uint256 apiId, uint256 lockedAmount, bool isActive)",
17
- "function paySubscription() external",
3
+ export const AGENTSLA_CONFIG = {
4
+ API_URL: "https://agentsla.io",
5
+ ORACLE_URL: "https://agentsla-oracle.agentsla-dev.workers.dev",
6
+ MCP_URL: "https://agentsla.io/mcp",
7
+ CHAIN_ID: 8453,
8
+ RPC_URL: "https://mainnet.base.org",
9
+ // Current escrow contract (the one the oracle settles). 2.0.2 and earlier pointed at the retired 0x6ca6cDDd... contract.
10
+ ESCROW_CONTRACT: "0x5c8D11AB570D7384d01226bC80123D0dD103Fb57",
11
+ USDC_TOKEN: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
12
+ TREASURY_WALLET: "0x9A0d2dD2402991eC8095fE2Be0d96A59d9DCF13C"
13
+ };
14
+
15
+ const ESCROW_ABI = [
18
16
  "function createJob(address _agent, uint256 _apiId, uint256 _lockedAmount) external returns (uint256)",
19
- "function resolveJob(uint256 _jobId, bool _slaMet) external"
17
+ "function paySubscription() external"
20
18
  ];
21
19
 
22
- export const USDC_ABI = [
23
- "function balanceOf(address account) view returns (uint256)",
20
+ const USDC_ABI = [
21
+ "function approve(address spender, uint256 amount) external returns (bool)",
24
22
  "function allowance(address owner, address spender) view returns (uint256)",
25
- "function approve(address spender, uint256 amount) external returns (bool)"
23
+ "function balanceOf(address account) view returns (uint256)",
24
+ "function transfer(address to, uint256 amount) external returns (bool)"
26
25
  ];
27
26
 
28
27
  export class AgentSLA {
29
- /**
30
- * @param {Object} config
31
- * @param {string} [config.oracleUrl] - Custom AgentSLA Oracle Worker URL
32
- * @param {string} [config.mcpUrl] - Streamable HTTP MCP URL (https://agentsla.io/mcp)
33
- * @param {string} [config.escrowAddress] - Base Mainnet Escrow Contract Address
34
- * @param {string} [config.usdcAddress] - Base Mainnet Circle USDC Address
35
- * @param {string} [config.walletAddress] - Subscribed Base Mainnet wallet address (0x...)
36
- * @param {ethers.Signer|ethers.Provider} [config.signer] - Ethers v6 Signer or Provider
37
- */
38
- constructor(config = {}) {
39
- this.oracleUrl = config.oracleUrl || DEFAULT_ORACLE_URL;
40
- this.mcpUrl = config.mcpUrl || DEFAULT_MCP_URL;
41
- this.escrowAddress = config.escrowAddress || ESCROW_ADDRESS;
42
- this.usdcAddress = config.usdcAddress || USDC_ADDRESS;
43
- this.walletAddress = config.walletAddress || null;
44
- this.signer = config.signer || null;
45
-
46
- if (this.signer) {
47
- this.contract = new ethers.Contract(this.escrowAddress, ESCROW_ABI, this.signer);
48
- this.usdc = new ethers.Contract(this.usdcAddress, USDC_ABI, this.signer);
49
- }
28
+ constructor(options = {}) {
29
+ this.apiUrl = (options.apiUrl || AGENTSLA_CONFIG.API_URL).replace(/\/+$/, "");
30
+ this.oracleUrl = options.oracleUrl || AGENTSLA_CONFIG.ORACLE_URL;
31
+ this.mcpUrl = options.mcpUrl || AGENTSLA_CONFIG.MCP_URL;
32
+ this.rpcUrl = options.rpcUrl || AGENTSLA_CONFIG.RPC_URL;
33
+ this.provider = new ethers.JsonRpcProvider(this.rpcUrl);
34
+ this.signer = options.privateKey ? new ethers.Wallet(options.privateKey, this.provider) : null;
50
35
  }
51
36
 
52
- async _resolveWallet(explicitWallet) {
53
- if (explicitWallet) return explicitWallet;
54
- if (this.walletAddress) return this.walletAddress;
55
- if (this.signer) {
56
- if (this.signer.address) return this.signer.address;
57
- if (typeof this.signer.getAddress === "function") {
58
- try { return await this.signer.getAddress(); } catch (e) {}
59
- }
37
+ /**
38
+ * Search the AgentSLA directory of indexed APIs and MCP servers (indexed and probed, not audited).
39
+ * @param {string|object} filter - Category string OR { category, search, limit, offset }
40
+ */
41
+ async discoverApis(filter = {}) {
42
+ const params = new URLSearchParams();
43
+ if (typeof filter === "string") {
44
+ if (filter && filter !== "all") params.set("category", filter);
45
+ } else if (filter && typeof filter === "object") {
46
+ if (filter.category && filter.category !== "all") params.set("category", filter.category);
47
+ if (filter.search) params.set("search", filter.search);
48
+ if (filter.limit) params.set("limit", String(filter.limit));
49
+ if (filter.offset) params.set("offset", String(filter.offset));
60
50
  }
61
- return undefined;
51
+ const qs = params.toString();
52
+ const res = await fetch(`${this.oracleUrl}/v1/directory${qs ? `?${qs}` : ""}`);
53
+ return await res.json();
62
54
  }
63
55
 
64
56
  /**
65
- * Probe an API endpoint via the AgentSLA Oracle, generate a signed EIP-712 SLA proof,
66
- * and optionally resolve an active on-chain Base Mainnet USDC escrow job.
67
- * @param {string} targetApiUrl - Target API endpoint to probe
68
- * @param {number} [jobId=0] - Active Base Mainnet escrow jobId (0 for probe-only)
69
- * @param {Object} [targetApiPayload] - Optional POST payload for the target API
70
- * @param {string} [walletAddress] - Optional subscribed Base Mainnet wallet address
57
+ * Call the remote Streamable HTTP MCP server at https://agentsla.io/mcp
71
58
  */
72
- async verify(targetApiUrl, jobId = 0, targetApiPayload = undefined, walletAddress = undefined) {
73
- if (!targetApiUrl) throw new Error("targetApiUrl is required.");
74
-
75
- const resolvedWallet = await this._resolveWallet(walletAddress);
76
-
77
- const response = await fetch(`${this.oracleUrl}/v1/verify`, {
59
+ async callMcpTool(name, args = {}) {
60
+ const res = await fetch(this.mcpUrl, {
78
61
  method: "POST",
79
- headers: { "Content-Type": "application/json" },
62
+ headers: { "Content-Type": "application/json", Accept: "application/json, text/event-stream" },
80
63
  body: JSON.stringify({
81
- jobId,
82
- targetApiUrl,
83
- targetApiPayload,
84
- walletAddress: resolvedWallet
64
+ jsonrpc: "2.0",
65
+ id: Date.now(),
66
+ method: "tools/call",
67
+ params: { name, arguments: args }
85
68
  })
86
69
  });
87
-
88
- const data = await response.json();
89
- if (!response.ok) {
90
- const err = new Error(data.error || "Failed to verify endpoint via AgentSLA Oracle.");
91
- err.status = response.status;
92
- err.paymentDetails = data;
93
- throw err;
94
- }
95
- return data;
70
+ return await res.json();
96
71
  }
97
72
 
98
73
  /**
99
- * Approve Circle USDC (if needed) and lock USDC in Base Mainnet Escrow for an M2M API task.
100
- * @param {string} agentWallet - Provider agent wallet address
101
- * @param {number|bigint} apiId - Monitored API ID from the AgentSLA directory
102
- * @param {string|number} amountUsdc - Amount in USDC (e.g., "0.01" or "5.00")
74
+ * Free, unsigned single check of any endpoint: HTTP status, latency and the SLA rule (2xx/3xx within maxLatencyMs).
103
75
  */
104
- async lockEscrowUsdc(agentWallet, apiId, amountUsdc) {
105
- if (!this.contract || !this.usdc || typeof this.signer.getAddress !== "function") {
106
- throw new Error("A connected ethers.js Signer is required to lock USDC in escrow.");
107
- }
108
-
109
- const amountUnits = ethers.parseUnits(amountUsdc.toString(), 6);
110
- const ownerAddress = await this.signer.getAddress();
111
- const currentAllowance = await this.usdc.allowance(ownerAddress, this.escrowAddress);
112
-
113
- if (currentAllowance < amountUnits) {
114
- const approveTx = await this.usdc.approve(this.escrowAddress, amountUnits);
115
- await approveTx.wait(1);
116
- }
117
-
118
- const createTx = await this.contract.createJob(agentWallet, BigInt(apiId), amountUnits);
119
- return await createTx.wait(1);
76
+ async checkEndpoint({ endpointUrl, maxLatencyMs = 1000 }) {
77
+ const qs = new URLSearchParams({ url: endpointUrl, max_latency_ms: String(maxLatencyMs) });
78
+ const res = await fetch(`${this.apiUrl}/v1/verify?${qs}`);
79
+ return await res.json();
120
80
  }
121
81
 
122
82
  /**
123
- * Pay the 5 USDC 7-day autonomous oracle subscription on Base Mainnet.
83
+ * Signed check: probes the endpoint and returns an EIP-712 SLA attestation from the oracle.
84
+ * Needs an active 7-day pass on the signer's wallet (subscribeSevenDays), unless jobId names an active escrow job
85
+ * (that probes the job's registered endpoint and settles the job). Without either, the response is HTTP 402 and
86
+ * explains how to pay (pass, escrow job, or x402 at 0.05 USDC per check).
87
+ * 2.0.2 and earlier sent jobId 1 by default, which tried to settle escrow job #1 instead of checking endpointUrl.
124
88
  */
125
- async paySubscription() {
126
- if (!this.contract || !this.usdc || typeof this.signer.getAddress !== "function") {
127
- throw new Error("A connected ethers.js Signer is required to pay subscription.");
128
- }
129
-
130
- const feeUnits = ethers.parseUnits("5.0", 6);
131
- const ownerAddress = await this.signer.getAddress();
132
- const currentAllowance = await this.usdc.allowance(ownerAddress, this.escrowAddress);
133
-
134
- if (currentAllowance < feeUnits) {
135
- const approveTx = await this.usdc.approve(this.escrowAddress, feeUnits);
136
- await approveTx.wait(1);
137
- }
138
-
139
- const tx = await this.contract.paySubscription();
140
- return await tx.wait(1);
141
- }
142
-
143
- /**
144
- * Discover ranked APIs in the AgentSLA directory.
145
- * @param {string} [category="all"]
146
- */
147
- async discover(category = "all") {
148
- const query = category && category !== "all" ? `?category=${encodeURIComponent(category)}` : "";
149
- const response = await fetch(`${this.oracleUrl}/v1/directory${query}`);
150
- return await response.json();
151
- }
152
-
153
- /**
154
- * Register a new API endpoint in the AgentSLA directory.
155
- */
156
- async register({ service_name, endpoint_url, category = "general", sla_threshold = 99.9, capabilities = [] }) {
157
- const response = await fetch(`${this.oracleUrl}/v1/directory`, {
89
+ async verifyEndpoint({ endpointUrl, jobId, payload, maxLatencyMs, walletAddress } = {}) {
90
+ const wallet = walletAddress || (this.signer ? await this.signer.getAddress() : undefined);
91
+ const body = { targetApiUrl: endpointUrl, walletAddress: wallet };
92
+ if (jobId) body.jobId = jobId;
93
+ if (payload && Object.keys(payload).length) body.targetApiPayload = payload;
94
+ if (maxLatencyMs) body.maxLatencyMs = maxLatencyMs;
95
+ const res = await fetch(`${this.apiUrl}/v1/verify`, {
158
96
  method: "POST",
159
97
  headers: { "Content-Type": "application/json" },
160
- body: JSON.stringify({ service_name, endpoint_url, category, sla_threshold, capabilities })
98
+ body: JSON.stringify(body)
161
99
  });
162
- return await response.json();
100
+ const data = await res.json();
101
+ if (res.status === 402 && data && typeof data === "object") data.paymentRequired = true;
102
+ return data;
163
103
  }
164
104
 
165
- /**
166
- * Fetch recent EIP-712 signed oracle attestations.
167
- */
168
- async getAttestations() {
169
- const response = await fetch(`${this.oracleUrl}/api/attestations`);
170
- return await response.json();
105
+ /** True if the wallet (default: the signer) holds an active 7-day pass on the current escrow contract. */
106
+ async isSubscribed(address) {
107
+ const who = address || (this.signer ? await this.signer.getAddress() : null);
108
+ if (!who) throw new Error("Pass an address or construct AgentSLA with a privateKey.");
109
+ const escrow = new ethers.Contract(AGENTSLA_CONFIG.ESCROW_CONTRACT, ["function isSubscribed(address) view returns (bool)"], this.provider);
110
+ return await escrow.isSubscribed(who);
171
111
  }
172
112
 
173
113
  /**
174
- * Call a tool directly on the hosted Streamable HTTP MCP server (https://agentsla.io/mcp).
114
+ * Pay the 5.00 Circle USDC 7-day M2M Oracle Subscription on Base Mainnet (8453).
175
115
  */
176
- async callMcpTool(name, args = {}) {
177
- const resolvedWallet = await this._resolveWallet(args.walletAddress);
178
- const finalArgs = resolvedWallet && !args.walletAddress ? { ...args, walletAddress: resolvedWallet } : args;
179
-
180
- const response = await fetch(this.mcpUrl, {
181
- method: "POST",
182
- headers: { "Content-Type": "application/json" },
183
- body: JSON.stringify({
184
- jsonrpc: "2.0",
185
- id: Date.now(),
186
- method: "tools/call",
187
- params: { name, arguments: finalArgs }
188
- })
189
- });
190
- return await response.json();
116
+ async subscribeSevenDays() {
117
+ if (!this.signer) throw new Error("Private key required to sign Base Mainnet USDC transactions.");
118
+ const userAddress = await this.signer.getAddress();
119
+ const usdc = new ethers.Contract(AGENTSLA_CONFIG.USDC_TOKEN, USDC_ABI, this.signer);
120
+ const escrow = new ethers.Contract(AGENTSLA_CONFIG.ESCROW_CONTRACT, ESCROW_ABI, this.signer);
121
+ const fee = ethers.parseUnits("5.0", 6);
122
+
123
+ const allowance = await usdc.allowance(userAddress, AGENTSLA_CONFIG.ESCROW_CONTRACT);
124
+ if (allowance < fee) {
125
+ const approveTx = await usdc.approve(AGENTSLA_CONFIG.ESCROW_CONTRACT, fee);
126
+ await approveTx.wait(1);
127
+ }
128
+ const tx = await escrow.paySubscription();
129
+ return await tx.wait(1);
191
130
  }
192
- }
131
+ }
132
+
133
+ export default AgentSLA;
package/package.json CHANGED
@@ -1,27 +1,37 @@
1
1
  {
2
2
  "name": "agentsla",
3
- "version": "2.0.1",
4
- "description": "Official M2M SDK for the AgentSLA API Telemetry Directory, EIP-712 SLA Oracle, Streamable HTTP MCP Server, and Circle USDC Escrow Contract on Base Mainnet (8453).",
3
+ "version": "2.0.3",
4
+ "description": "SDK and MCP client for AgentSLA: search indexed APIs and MCP servers, check endpoints, signed EIP-712 SLA checks, and refundable USDC escrow on Base.",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "test": "node test.js"
9
9
  },
10
10
  "keywords": [
11
- "ai",
12
- "agents",
13
- "m2m",
14
11
  "mcp",
15
- "web3",
16
- "sla",
17
- "oracle",
12
+ "model-context-protocol",
13
+ "ai-agents",
14
+ "m2m",
15
+ "sla-oracle",
16
+ "base-mainnet",
18
17
  "usdc",
18
+ "x402",
19
19
  "eip-712",
20
- "base-mainnet"
20
+ "llmstxt",
21
+ "glama"
21
22
  ],
22
23
  "author": "AgentSLA (https://agentsla.io)",
23
24
  "license": "MIT",
24
- "dependencies": {
25
- "ethers": "^6.7.0"
26
- }
25
+ "homepage": "https://agentsla.io",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/agentsla/agentsla-sdk.git"
29
+ },
30
+ "peerDependencies": {
31
+ "ethers": "^6.0.0"
32
+ },
33
+ "files": [
34
+ "index.js",
35
+ "README.md"
36
+ ]
27
37
  }
package/test.js DELETED
@@ -1,32 +0,0 @@
1
- import { AgentSLA } from "./index.js";
2
-
3
- async function main() {
4
- const unpaidClient = new AgentSLA();
5
-
6
- console.log("=== 1. Testing Free AgentSLA Directory Discovery ===");
7
- const dir = await unpaidClient.discover("ai-models");
8
- console.log(`Discovered ${dir.count} AI Model APIs (Escrow Contract: ${dir.escrowContract})`);
9
-
10
- console.log("\n=== 2. Testing Unpaid Call to /v1/verify (Verifying 402 Paywall) ===");
11
- try {
12
- await unpaidClient.verify("https://mainnet.base.org");
13
- } catch (err) {
14
- console.log(`Blocked with HTTP ${err.status}: ${err.message}`);
15
- }
16
-
17
- console.log("\n=== 3. Testing Authenticated Wallet Call to /v1/verify ===");
18
- const paidClient = new AgentSLA({
19
- walletAddress: "0x9A0d2dD2402991eC8095fE2Be0d96A59d9DCF13C"
20
- });
21
- const verification = await paidClient.verify("https://mainnet.base.org");
22
- console.log("Latency (ms) :", verification.latencyMs);
23
- console.log("SLA Met :", verification.slaMet);
24
- console.log("EIP-712 Signature:", verification.eip712Signature);
25
- console.log("Oracle Signer :", verification.oracleSigner);
26
-
27
- console.log("\n=== 4. Testing Hosted Streamable HTTP MCP Server (https://agentsla.io/mcp) ===");
28
- const mcpRes = await paidClient.callMcpTool("get_usdc_escrow_contract", {});
29
- console.log("MCP Tool Output :", mcpRes.result.content[0].text);
30
- }
31
-
32
- main().catch(console.error);