@agether/sdk 2.6.1 → 2.8.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.
Files changed (37) hide show
  1. package/README.md +39 -27
  2. package/dist/cli.js +54 -36
  3. package/dist/index.d.mts +43 -14
  4. package/dist/index.d.ts +43 -14
  5. package/dist/index.js +65 -32
  6. package/dist/index.mjs +62 -32
  7. package/package.json +2 -2
  8. package/dist/cli.d.ts +0 -27
  9. package/dist/cli.d.ts.map +0 -1
  10. package/dist/clients/AgentIdentityClient.d.ts +0 -188
  11. package/dist/clients/AgentIdentityClient.d.ts.map +0 -1
  12. package/dist/clients/AgentIdentityClient.js +0 -337
  13. package/dist/clients/AgetherClient.d.ts +0 -74
  14. package/dist/clients/AgetherClient.d.ts.map +0 -1
  15. package/dist/clients/AgetherClient.js +0 -172
  16. package/dist/clients/MorphoClient.d.ts +0 -482
  17. package/dist/clients/MorphoClient.d.ts.map +0 -1
  18. package/dist/clients/MorphoClient.js +0 -1717
  19. package/dist/clients/ScoringClient.d.ts +0 -89
  20. package/dist/clients/ScoringClient.d.ts.map +0 -1
  21. package/dist/clients/ScoringClient.js +0 -93
  22. package/dist/clients/X402Client.d.ts +0 -168
  23. package/dist/clients/X402Client.d.ts.map +0 -1
  24. package/dist/clients/X402Client.js +0 -378
  25. package/dist/index.d.ts.map +0 -1
  26. package/dist/types/index.d.ts +0 -132
  27. package/dist/types/index.d.ts.map +0 -1
  28. package/dist/types/index.js +0 -46
  29. package/dist/utils/abis.d.ts +0 -29
  30. package/dist/utils/abis.d.ts.map +0 -1
  31. package/dist/utils/abis.js +0 -139
  32. package/dist/utils/config.d.ts +0 -36
  33. package/dist/utils/config.d.ts.map +0 -1
  34. package/dist/utils/config.js +0 -168
  35. package/dist/utils/format.d.ts +0 -44
  36. package/dist/utils/format.d.ts.map +0 -1
  37. package/dist/utils/format.js +0 -75
package/dist/index.js CHANGED
@@ -64,7 +64,10 @@ __export(index_exports, {
64
64
  formatTimestamp: () => formatTimestamp,
65
65
  formatUSD: () => formatUSD,
66
66
  formatUnits: () => formatUnits,
67
+ getContractAddresses: () => getContractAddresses,
67
68
  getDefaultConfig: () => getDefaultConfig,
69
+ getMorphoBlueAddress: () => getMorphoBlueAddress,
70
+ getUSDCAddress: () => getUSDCAddress,
68
71
  parseUnits: () => parseUnits,
69
72
  rateToBps: () => rateToBps
70
73
  });
@@ -74,13 +77,13 @@ module.exports = __toCommonJS(index_exports);
74
77
  var import_ethers = require("ethers");
75
78
 
76
79
  // src/types/index.ts
77
- var ChainId = /* @__PURE__ */ ((ChainId3) => {
78
- ChainId3[ChainId3["Ethereum"] = 1] = "Ethereum";
79
- ChainId3[ChainId3["Base"] = 8453] = "Base";
80
- ChainId3[ChainId3["BaseSepolia"] = 84532] = "BaseSepolia";
81
- ChainId3[ChainId3["Sepolia"] = 11155111] = "Sepolia";
82
- ChainId3[ChainId3["Hardhat"] = 31337] = "Hardhat";
83
- return ChainId3;
80
+ var ChainId = /* @__PURE__ */ ((ChainId4) => {
81
+ ChainId4[ChainId4["Ethereum"] = 1] = "Ethereum";
82
+ ChainId4[ChainId4["Base"] = 8453] = "Base";
83
+ ChainId4[ChainId4["BaseSepolia"] = 84532] = "BaseSepolia";
84
+ ChainId4[ChainId4["Sepolia"] = 11155111] = "Sepolia";
85
+ ChainId4[ChainId4["Hardhat"] = 31337] = "Hardhat";
86
+ return ChainId4;
84
87
  })(ChainId || {});
85
88
  var AgetherError = class extends Error {
86
89
  constructor(message, code, details) {
@@ -244,13 +247,13 @@ var CONTRACT_ADDRESSES = {
244
247
  safeProxyFactory: SAFE_PROXY_FACTORY,
245
248
  safe7579: SAFE7579,
246
249
  entryPoint: ENTRYPOINT_V07,
247
- agether4337Factory: ZERO,
248
- agether7579Bootstrap: ZERO,
249
- erc8004ValidationModule: ZERO,
250
- agetherHookMultiplexer: ZERO,
250
+ agether4337Factory: "0xE350660Ab3EA87b50233854eacCC6328e268fb48",
251
+ agether7579Bootstrap: "0xD1268B50149e468591Bcba5f6fD3E87b49D43008",
252
+ erc8004ValidationModule: "0x87Aa07Be4Ab4A2e8EeBf4a4e2451c775D0e3fbf1",
253
+ agetherHookMultiplexer: "0xC0b96e36B20d6689F4E4b8C7A0c19C28e8B45B8B",
251
254
  validationRegistry: ZERO,
252
- agether8004Scorer: ZERO,
253
- timelockController: ZERO,
255
+ agether8004Scorer: "0xd281a8ec667E406Fcf1097A64A65d1C88Fb0F7Fa",
256
+ timelockController: "0x2033CD354aAf19191F23211c6A6974fCE038AFBe",
254
257
  usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
255
258
  identityRegistry: ERC8004_IDENTITY_REGISTRY,
256
259
  morphoBlue: MORPHO_BLUE
@@ -260,13 +263,13 @@ var CONTRACT_ADDRESSES = {
260
263
  safeProxyFactory: SAFE_PROXY_FACTORY,
261
264
  safe7579: SAFE7579,
262
265
  entryPoint: ENTRYPOINT_V07,
263
- agether4337Factory: "0x67DE66D07ff3dba0092C21f070f8a0f53D657BC3",
264
- agether7579Bootstrap: "0xCc83AA714c05B7141B21a17e80EB21bD09652b27",
265
- erc8004ValidationModule: "0xde896C58163b5f6cAC5B16C1b0109843f26106F6",
266
- agetherHookMultiplexer: "0x4AB6DaD0f7360fa8d8c75889A5c206B65d7CbeDb",
266
+ agether4337Factory: "0x8aeE4961EfaA4a1D36e2b24C5b430C8613fB5b8C",
267
+ agether7579Bootstrap: "0x5e8e4644c628CB464936981e338635476d012B5F",
268
+ erc8004ValidationModule: "0x7B18a7E3D5B3d043FC3525Efcd9a2bB1aE1369Ab",
269
+ agetherHookMultiplexer: "0x2D98eff4b959F3dc76f14c5682A8546438406c4A",
267
270
  validationRegistry: ZERO,
268
- agether8004Scorer: "0x56c7D35A976fac67b1993b66b861fCA32f59104F",
269
- timelockController: "0xc600e7AAB8a230326C714CE66f356fdf6aC021d8",
271
+ agether8004Scorer: "0xA1a0B09147688a09A3027F960623Ae16d1ca7F69",
272
+ timelockController: "0x7f104DBe209E2a05FFc1700b27eaE1C397f011c4",
270
273
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
271
274
  identityRegistry: ERC8004_IDENTITY_REGISTRY,
272
275
  morphoBlue: MORPHO_BLUE
@@ -328,9 +331,9 @@ var RPC_URLS = {
328
331
  [31337 /* Hardhat */]: "http://127.0.0.1:8545"
329
332
  };
330
333
  var SCORING_ENDPOINTS = {
331
- [1 /* Ethereum */]: "https://scoring.agether.ai/v1",
332
- [8453 /* Base */]: "http://95.179.189.214:3001",
333
- [84532 /* BaseSepolia */]: "http://95.179.189.214:3001",
334
+ [1 /* Ethereum */]: "https://api.agether.ai",
335
+ [8453 /* Base */]: "https://api.agether.ai",
336
+ [84532 /* BaseSepolia */]: "https://api.agether.ai",
334
337
  [11155111 /* Sepolia */]: "https://scoring-testnet.agether.ai/v1",
335
338
  [31337 /* Hardhat */]: "http://127.0.0.1:3001"
336
339
  };
@@ -353,6 +356,15 @@ function createConfig(chainId, options) {
353
356
  }
354
357
  };
355
358
  }
359
+ function getUSDCAddress(chainId) {
360
+ return CONTRACT_ADDRESSES[chainId].usdc;
361
+ }
362
+ function getMorphoBlueAddress(chainId) {
363
+ return CONTRACT_ADDRESSES[chainId].morphoBlue;
364
+ }
365
+ function getContractAddresses(chainId) {
366
+ return CONTRACT_ADDRESSES[chainId];
367
+ }
356
368
 
357
369
  // src/clients/AgetherClient.ts
358
370
  var AgetherClient = class _AgetherClient {
@@ -543,7 +555,7 @@ var MorphoClient = class {
543
555
  /** Dynamic token registry: symbol (uppercase) → { address, symbol, decimals } */
544
556
  this._tokenCache = /* @__PURE__ */ new Map();
545
557
  this._discoveredAt = 0;
546
- const chainId = config.chainId ?? 8453 /* Base */;
558
+ const chainId = config.chainId ?? 1 /* Ethereum */;
547
559
  const defaultCfg = getDefaultConfig(chainId);
548
560
  this.config = defaultCfg;
549
561
  this.agentId = config.agentId;
@@ -2447,12 +2459,14 @@ var X402Client = class {
2447
2459
  const data = await response.json();
2448
2460
  const paymentResponse = response.headers.get("PAYMENT-RESPONSE");
2449
2461
  let txHash;
2462
+ let settlementNetwork;
2450
2463
  if (paymentResponse) {
2451
2464
  try {
2452
2465
  const settlement = JSON.parse(
2453
2466
  Buffer.from(paymentResponse, "base64").toString("utf-8")
2454
2467
  );
2455
2468
  txHash = settlement.transaction;
2469
+ settlementNetwork = settlement.network;
2456
2470
  } catch (e) {
2457
2471
  console.warn("[agether] x402 payment response parse failed:", e instanceof Error ? e.message : e);
2458
2472
  }
@@ -2464,7 +2478,7 @@ var X402Client = class {
2464
2478
  paymentInfo: {
2465
2479
  amount: "",
2466
2480
  asset: "USDC",
2467
- network: "eip155:8453",
2481
+ network: settlementNetwork || "eip155",
2468
2482
  txHash
2469
2483
  }
2470
2484
  } : {}
@@ -2566,6 +2580,7 @@ var X402Client = class {
2566
2580
  var ScoringClient = class {
2567
2581
  constructor(config) {
2568
2582
  this.endpoint = config.endpoint;
2583
+ this.defaultChainId = config.chainId;
2569
2584
  this.client = import_axios2.default.create({
2570
2585
  baseURL: config.endpoint,
2571
2586
  headers: { "Content-Type": "application/json" },
@@ -2575,6 +2590,11 @@ var ScoringClient = class {
2575
2590
  this.x402Client = new X402Client(config.x402);
2576
2591
  }
2577
2592
  }
2593
+ /** Build query string with ?chain= if chainId is set */
2594
+ chainQuery(chainId) {
2595
+ const id = chainId ?? this.defaultChainId;
2596
+ return id != null ? `?chain=${id}` : "";
2597
+ }
2578
2598
  // ════════════════════════════════════════════════════════
2579
2599
  // Score (x402-gated — computes & submits onchain)
2580
2600
  // ════════════════════════════════════════════════════════
@@ -2586,9 +2606,13 @@ var ScoringClient = class {
2586
2606
  * the score onchain via AgentReputation.submitScore().
2587
2607
  *
2588
2608
  * Returns the ScoreResult with breakdown and txHash.
2609
+ *
2610
+ * @param agentId Agent ID
2611
+ * @param chainId Target chain (optional — overrides default)
2589
2612
  */
2590
- async requestScore(agentId) {
2613
+ async requestScore(agentId, chainId) {
2591
2614
  const id = agentId.toString();
2615
+ const qs = this.chainQuery(chainId);
2592
2616
  if (!this.x402Client) {
2593
2617
  throw new AgetherError(
2594
2618
  "x402 config required for paid scoring. Provide x402 in ScoringClientConfig.",
@@ -2596,7 +2620,7 @@ var ScoringClient = class {
2596
2620
  );
2597
2621
  }
2598
2622
  const result = await this.x402Client.get(
2599
- `${this.endpoint}/score/${id}`
2623
+ `${this.endpoint}/score/${id}${qs}`
2600
2624
  );
2601
2625
  if (!result.success || !result.data) {
2602
2626
  throw new AgetherError(
@@ -2611,9 +2635,11 @@ var ScoringClient = class {
2611
2635
  // ════════════════════════════════════════════════════════
2612
2636
  /**
2613
2637
  * Get the current onchain score (free, no payment required).
2638
+ * @param chainId Target chain (optional — overrides default)
2614
2639
  */
2615
- async getCurrentScore(agentId) {
2616
- const response = await this.client.get(`/score/${agentId.toString()}/current`);
2640
+ async getCurrentScore(agentId, chainId) {
2641
+ const qs = this.chainQuery(chainId);
2642
+ const response = await this.client.get(`/score/${agentId.toString()}/current${qs}`);
2617
2643
  return response.data;
2618
2644
  }
2619
2645
  // ════════════════════════════════════════════════════════
@@ -2621,9 +2647,11 @@ var ScoringClient = class {
2621
2647
  // ════════════════════════════════════════════════════════
2622
2648
  /**
2623
2649
  * Get detailed agent info from backend.
2650
+ * @param chainId Target chain (optional — overrides default)
2624
2651
  */
2625
- async getAgentDetails(agentId) {
2626
- const response = await this.client.get(`/agents/${agentId.toString()}/details`);
2652
+ async getAgentDetails(agentId, chainId) {
2653
+ const qs = this.chainQuery(chainId);
2654
+ const response = await this.client.get(`/agents/${agentId.toString()}/details${qs}`);
2627
2655
  return response.data;
2628
2656
  }
2629
2657
  // ════════════════════════════════════════════════════════
@@ -2645,9 +2673,11 @@ var ScoringClient = class {
2645
2673
  }
2646
2674
  /**
2647
2675
  * Agent count and list.
2676
+ * @param chainId Target chain (optional — overrides default)
2648
2677
  */
2649
- async getAgentCount() {
2650
- const response = await this.client.get("/agents/count");
2678
+ async getAgentCount(chainId) {
2679
+ const qs = this.chainQuery(chainId);
2680
+ const response = await this.client.get(`/agents/count${qs}`);
2651
2681
  return response.data;
2652
2682
  }
2653
2683
  };
@@ -3069,7 +3099,10 @@ function rateToBps(rate) {
3069
3099
  formatTimestamp,
3070
3100
  formatUSD,
3071
3101
  formatUnits,
3102
+ getContractAddresses,
3072
3103
  getDefaultConfig,
3104
+ getMorphoBlueAddress,
3105
+ getUSDCAddress,
3073
3106
  parseUnits,
3074
3107
  rateToBps
3075
3108
  });
package/dist/index.mjs CHANGED
@@ -2,13 +2,13 @@
2
2
  import { ethers, Contract } from "ethers";
3
3
 
4
4
  // src/types/index.ts
5
- var ChainId = /* @__PURE__ */ ((ChainId3) => {
6
- ChainId3[ChainId3["Ethereum"] = 1] = "Ethereum";
7
- ChainId3[ChainId3["Base"] = 8453] = "Base";
8
- ChainId3[ChainId3["BaseSepolia"] = 84532] = "BaseSepolia";
9
- ChainId3[ChainId3["Sepolia"] = 11155111] = "Sepolia";
10
- ChainId3[ChainId3["Hardhat"] = 31337] = "Hardhat";
11
- return ChainId3;
5
+ var ChainId = /* @__PURE__ */ ((ChainId4) => {
6
+ ChainId4[ChainId4["Ethereum"] = 1] = "Ethereum";
7
+ ChainId4[ChainId4["Base"] = 8453] = "Base";
8
+ ChainId4[ChainId4["BaseSepolia"] = 84532] = "BaseSepolia";
9
+ ChainId4[ChainId4["Sepolia"] = 11155111] = "Sepolia";
10
+ ChainId4[ChainId4["Hardhat"] = 31337] = "Hardhat";
11
+ return ChainId4;
12
12
  })(ChainId || {});
13
13
  var AgetherError = class extends Error {
14
14
  constructor(message, code, details) {
@@ -172,13 +172,13 @@ var CONTRACT_ADDRESSES = {
172
172
  safeProxyFactory: SAFE_PROXY_FACTORY,
173
173
  safe7579: SAFE7579,
174
174
  entryPoint: ENTRYPOINT_V07,
175
- agether4337Factory: ZERO,
176
- agether7579Bootstrap: ZERO,
177
- erc8004ValidationModule: ZERO,
178
- agetherHookMultiplexer: ZERO,
175
+ agether4337Factory: "0xE350660Ab3EA87b50233854eacCC6328e268fb48",
176
+ agether7579Bootstrap: "0xD1268B50149e468591Bcba5f6fD3E87b49D43008",
177
+ erc8004ValidationModule: "0x87Aa07Be4Ab4A2e8EeBf4a4e2451c775D0e3fbf1",
178
+ agetherHookMultiplexer: "0xC0b96e36B20d6689F4E4b8C7A0c19C28e8B45B8B",
179
179
  validationRegistry: ZERO,
180
- agether8004Scorer: ZERO,
181
- timelockController: ZERO,
180
+ agether8004Scorer: "0xd281a8ec667E406Fcf1097A64A65d1C88Fb0F7Fa",
181
+ timelockController: "0x2033CD354aAf19191F23211c6A6974fCE038AFBe",
182
182
  usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
183
183
  identityRegistry: ERC8004_IDENTITY_REGISTRY,
184
184
  morphoBlue: MORPHO_BLUE
@@ -188,13 +188,13 @@ var CONTRACT_ADDRESSES = {
188
188
  safeProxyFactory: SAFE_PROXY_FACTORY,
189
189
  safe7579: SAFE7579,
190
190
  entryPoint: ENTRYPOINT_V07,
191
- agether4337Factory: "0x67DE66D07ff3dba0092C21f070f8a0f53D657BC3",
192
- agether7579Bootstrap: "0xCc83AA714c05B7141B21a17e80EB21bD09652b27",
193
- erc8004ValidationModule: "0xde896C58163b5f6cAC5B16C1b0109843f26106F6",
194
- agetherHookMultiplexer: "0x4AB6DaD0f7360fa8d8c75889A5c206B65d7CbeDb",
191
+ agether4337Factory: "0x8aeE4961EfaA4a1D36e2b24C5b430C8613fB5b8C",
192
+ agether7579Bootstrap: "0x5e8e4644c628CB464936981e338635476d012B5F",
193
+ erc8004ValidationModule: "0x7B18a7E3D5B3d043FC3525Efcd9a2bB1aE1369Ab",
194
+ agetherHookMultiplexer: "0x2D98eff4b959F3dc76f14c5682A8546438406c4A",
195
195
  validationRegistry: ZERO,
196
- agether8004Scorer: "0x56c7D35A976fac67b1993b66b861fCA32f59104F",
197
- timelockController: "0xc600e7AAB8a230326C714CE66f356fdf6aC021d8",
196
+ agether8004Scorer: "0xA1a0B09147688a09A3027F960623Ae16d1ca7F69",
197
+ timelockController: "0x7f104DBe209E2a05FFc1700b27eaE1C397f011c4",
198
198
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
199
199
  identityRegistry: ERC8004_IDENTITY_REGISTRY,
200
200
  morphoBlue: MORPHO_BLUE
@@ -256,9 +256,9 @@ var RPC_URLS = {
256
256
  [31337 /* Hardhat */]: "http://127.0.0.1:8545"
257
257
  };
258
258
  var SCORING_ENDPOINTS = {
259
- [1 /* Ethereum */]: "https://scoring.agether.ai/v1",
260
- [8453 /* Base */]: "http://95.179.189.214:3001",
261
- [84532 /* BaseSepolia */]: "http://95.179.189.214:3001",
259
+ [1 /* Ethereum */]: "https://api.agether.ai",
260
+ [8453 /* Base */]: "https://api.agether.ai",
261
+ [84532 /* BaseSepolia */]: "https://api.agether.ai",
262
262
  [11155111 /* Sepolia */]: "https://scoring-testnet.agether.ai/v1",
263
263
  [31337 /* Hardhat */]: "http://127.0.0.1:3001"
264
264
  };
@@ -281,6 +281,15 @@ function createConfig(chainId, options) {
281
281
  }
282
282
  };
283
283
  }
284
+ function getUSDCAddress(chainId) {
285
+ return CONTRACT_ADDRESSES[chainId].usdc;
286
+ }
287
+ function getMorphoBlueAddress(chainId) {
288
+ return CONTRACT_ADDRESSES[chainId].morphoBlue;
289
+ }
290
+ function getContractAddresses(chainId) {
291
+ return CONTRACT_ADDRESSES[chainId];
292
+ }
284
293
 
285
294
  // src/clients/AgetherClient.ts
286
295
  var AgetherClient = class _AgetherClient {
@@ -471,7 +480,7 @@ var MorphoClient = class {
471
480
  /** Dynamic token registry: symbol (uppercase) → { address, symbol, decimals } */
472
481
  this._tokenCache = /* @__PURE__ */ new Map();
473
482
  this._discoveredAt = 0;
474
- const chainId = config.chainId ?? 8453 /* Base */;
483
+ const chainId = config.chainId ?? 1 /* Ethereum */;
475
484
  const defaultCfg = getDefaultConfig(chainId);
476
485
  this.config = defaultCfg;
477
486
  this.agentId = config.agentId;
@@ -2375,12 +2384,14 @@ var X402Client = class {
2375
2384
  const data = await response.json();
2376
2385
  const paymentResponse = response.headers.get("PAYMENT-RESPONSE");
2377
2386
  let txHash;
2387
+ let settlementNetwork;
2378
2388
  if (paymentResponse) {
2379
2389
  try {
2380
2390
  const settlement = JSON.parse(
2381
2391
  Buffer.from(paymentResponse, "base64").toString("utf-8")
2382
2392
  );
2383
2393
  txHash = settlement.transaction;
2394
+ settlementNetwork = settlement.network;
2384
2395
  } catch (e) {
2385
2396
  console.warn("[agether] x402 payment response parse failed:", e instanceof Error ? e.message : e);
2386
2397
  }
@@ -2392,7 +2403,7 @@ var X402Client = class {
2392
2403
  paymentInfo: {
2393
2404
  amount: "",
2394
2405
  asset: "USDC",
2395
- network: "eip155:8453",
2406
+ network: settlementNetwork || "eip155",
2396
2407
  txHash
2397
2408
  }
2398
2409
  } : {}
@@ -2494,6 +2505,7 @@ var X402Client = class {
2494
2505
  var ScoringClient = class {
2495
2506
  constructor(config) {
2496
2507
  this.endpoint = config.endpoint;
2508
+ this.defaultChainId = config.chainId;
2497
2509
  this.client = axios2.create({
2498
2510
  baseURL: config.endpoint,
2499
2511
  headers: { "Content-Type": "application/json" },
@@ -2503,6 +2515,11 @@ var ScoringClient = class {
2503
2515
  this.x402Client = new X402Client(config.x402);
2504
2516
  }
2505
2517
  }
2518
+ /** Build query string with ?chain= if chainId is set */
2519
+ chainQuery(chainId) {
2520
+ const id = chainId ?? this.defaultChainId;
2521
+ return id != null ? `?chain=${id}` : "";
2522
+ }
2506
2523
  // ════════════════════════════════════════════════════════
2507
2524
  // Score (x402-gated — computes & submits onchain)
2508
2525
  // ════════════════════════════════════════════════════════
@@ -2514,9 +2531,13 @@ var ScoringClient = class {
2514
2531
  * the score onchain via AgentReputation.submitScore().
2515
2532
  *
2516
2533
  * Returns the ScoreResult with breakdown and txHash.
2534
+ *
2535
+ * @param agentId Agent ID
2536
+ * @param chainId Target chain (optional — overrides default)
2517
2537
  */
2518
- async requestScore(agentId) {
2538
+ async requestScore(agentId, chainId) {
2519
2539
  const id = agentId.toString();
2540
+ const qs = this.chainQuery(chainId);
2520
2541
  if (!this.x402Client) {
2521
2542
  throw new AgetherError(
2522
2543
  "x402 config required for paid scoring. Provide x402 in ScoringClientConfig.",
@@ -2524,7 +2545,7 @@ var ScoringClient = class {
2524
2545
  );
2525
2546
  }
2526
2547
  const result = await this.x402Client.get(
2527
- `${this.endpoint}/score/${id}`
2548
+ `${this.endpoint}/score/${id}${qs}`
2528
2549
  );
2529
2550
  if (!result.success || !result.data) {
2530
2551
  throw new AgetherError(
@@ -2539,9 +2560,11 @@ var ScoringClient = class {
2539
2560
  // ════════════════════════════════════════════════════════
2540
2561
  /**
2541
2562
  * Get the current onchain score (free, no payment required).
2563
+ * @param chainId Target chain (optional — overrides default)
2542
2564
  */
2543
- async getCurrentScore(agentId) {
2544
- const response = await this.client.get(`/score/${agentId.toString()}/current`);
2565
+ async getCurrentScore(agentId, chainId) {
2566
+ const qs = this.chainQuery(chainId);
2567
+ const response = await this.client.get(`/score/${agentId.toString()}/current${qs}`);
2545
2568
  return response.data;
2546
2569
  }
2547
2570
  // ════════════════════════════════════════════════════════
@@ -2549,9 +2572,11 @@ var ScoringClient = class {
2549
2572
  // ════════════════════════════════════════════════════════
2550
2573
  /**
2551
2574
  * Get detailed agent info from backend.
2575
+ * @param chainId Target chain (optional — overrides default)
2552
2576
  */
2553
- async getAgentDetails(agentId) {
2554
- const response = await this.client.get(`/agents/${agentId.toString()}/details`);
2577
+ async getAgentDetails(agentId, chainId) {
2578
+ const qs = this.chainQuery(chainId);
2579
+ const response = await this.client.get(`/agents/${agentId.toString()}/details${qs}`);
2555
2580
  return response.data;
2556
2581
  }
2557
2582
  // ════════════════════════════════════════════════════════
@@ -2573,9 +2598,11 @@ var ScoringClient = class {
2573
2598
  }
2574
2599
  /**
2575
2600
  * Agent count and list.
2601
+ * @param chainId Target chain (optional — overrides default)
2576
2602
  */
2577
- async getAgentCount() {
2578
- const response = await this.client.get("/agents/count");
2603
+ async getAgentCount(chainId) {
2604
+ const qs = this.chainQuery(chainId);
2605
+ const response = await this.client.get(`/agents/count${qs}`);
2579
2606
  return response.data;
2580
2607
  }
2581
2608
  };
@@ -2996,7 +3023,10 @@ export {
2996
3023
  formatTimestamp,
2997
3024
  formatUSD,
2998
3025
  formatUnits,
3026
+ getContractAddresses,
2999
3027
  getDefaultConfig,
3028
+ getMorphoBlueAddress,
3029
+ getUSDCAddress,
3000
3030
  parseUnits,
3001
3031
  rateToBps
3002
3032
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agether/sdk",
3
- "version": "2.6.1",
4
- "description": "TypeScript SDK for Agether - autonomous credit for AI agents on Base",
3
+ "version": "2.8.0",
4
+ "description": "TypeScript SDK for Agether - autonomous credit for AI agents on Ethereum & Base",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
package/dist/cli.d.ts DELETED
@@ -1,27 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Agether CLI — Direct Morpho Blue Credit for AI Agents
4
- *
5
- * Architecture (v2 — Safe + Safe7579):
6
- * - All commands sign transactions directly with the agent's private key
7
- * - Uses MorphoClient for lending (ERC-4337 UserOps through Safe account)
8
- * - Uses X402Client for paid API calls
9
- *
10
- * Usage:
11
- * agether init <private-key> [--agent-id <id>] Initialize
12
- * agether register [--name <n>] Register ERC-8004 + Safe account
13
- * agether balance Check balances
14
- * agether status Show Morpho positions
15
- * agether score Get credit score (x402-gated)
16
- * agether markets List Morpho markets
17
- * agether deposit --amount 0.05 --token WETH Deposit collateral
18
- * agether borrow --amount 100 Borrow USDC
19
- * agether deposit-and-borrow --amount 0.05 --token WETH --borrow 100
20
- * agether repay --amount 50 Repay USDC
21
- * agether withdraw --amount 0.05 --token WETH Withdraw collateral
22
- * agether sponsor --amount 0.05 --token WETH --agent-id 123
23
- * agether fund --amount 50 Fund Safe account with USDC
24
- * agether x402 <url> [--method GET|POST] [--body <json>]
25
- */
26
- export {};
27
- //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}
@@ -1,188 +0,0 @@
1
- /**
2
- * AgentIdentityClient - Integration with ag0 (ERC-8004)
3
- *
4
- * ERC-8004 Contract Addresses:
5
- * - Sepolia IdentityRegistry: 0x8004A818BFB912233c491871b3d84c89A494BD9e
6
- * - Sepolia ReputationRegistry: 0x8004B663056A597Dffe9eCcC1965A193B7388713
7
- *
8
- * SDKs:
9
- * - TypeScript: https://github.com/agent0lab/agent0-ts
10
- * - Python: https://github.com/agent0lab/agent0-py
11
- *
12
- * Docs: https://sdk.ag0.xyz/docs
13
- */
14
- import { Signer } from 'ethers';
15
- import { AgetherConfig } from '../types';
16
- export declare const ERC8004_SEPOLIA: {
17
- identityRegistry: string;
18
- reputationRegistry: string;
19
- };
20
- export interface AgentIdentityClientOptions {
21
- config: AgetherConfig;
22
- signer: Signer;
23
- /** Optional: Use ag0 TypeScript SDK instead of direct contracts */
24
- useAg0SDK?: boolean;
25
- }
26
- export interface AgentMetadata {
27
- name: string;
28
- description: string;
29
- image?: string;
30
- endpoints?: {
31
- name: string;
32
- endpoint: string;
33
- version?: string;
34
- }[];
35
- x402Support?: boolean;
36
- active?: boolean;
37
- }
38
- export interface FeedbackInput {
39
- agentId: bigint;
40
- value: number;
41
- decimals?: number;
42
- tag1?: string;
43
- tag2?: string;
44
- endpoint?: string;
45
- feedbackURI?: string;
46
- }
47
- export interface ReputationSummary {
48
- count: number;
49
- totalValue: number;
50
- averageValue: number;
51
- clients: string[];
52
- }
53
- export declare class AgentIdentityClient {
54
- readonly config: AgetherConfig;
55
- private signer;
56
- private identityRegistry;
57
- private reputationRegistry;
58
- constructor(options: AgentIdentityClientOptions);
59
- /**
60
- * Register a new agent (minimal - no metadata)
61
- */
62
- register(): Promise<{
63
- agentId: bigint;
64
- txHash: string;
65
- }>;
66
- /**
67
- * Register agent with IPFS/HTTP URI to metadata JSON
68
- * @param agentURI URI pointing to agent metadata (ipfs:// or https://)
69
- */
70
- registerWithURI(agentURI: string): Promise<{
71
- agentId: bigint;
72
- txHash: string;
73
- }>;
74
- /**
75
- * Check if the signer already owns an ERC-8004 identity token.
76
- * Returns true if balanceOf > 0, false otherwise.
77
- * Note: Cannot determine the specific agentId without enumeration —
78
- * use agether init <pk> --agent-id <id> if you know your agentId.
79
- */
80
- hasExistingIdentity(): Promise<boolean>;
81
- /**
82
- * Register only if no identity exists; otherwise throw.
83
- * Prevents accidental double-registration.
84
- */
85
- registerOrGet(): Promise<{
86
- agentId: bigint;
87
- txHash: string | null;
88
- existing: boolean;
89
- }>;
90
- /**
91
- * Register with URI only if no identity exists; otherwise throw.
92
- * Prevents accidental double-registration.
93
- */
94
- registerOrGetWithURI(agentURI: string): Promise<{
95
- agentId: bigint;
96
- txHash: string | null;
97
- existing: boolean;
98
- }>;
99
- /**
100
- * Register agent with URI and onchain metadata
101
- */
102
- registerWithMetadata(agentURI: string, metadata: {
103
- key: string;
104
- value: string;
105
- }[]): Promise<{
106
- agentId: bigint;
107
- txHash: string;
108
- }>;
109
- /**
110
- * Get agent owner address
111
- */
112
- getOwner(agentId: bigint): Promise<string>;
113
- /**
114
- * Get agent URI (metadata JSON location)
115
- */
116
- getAgentURI(agentId: bigint): Promise<string>;
117
- /**
118
- * Update agent URI
119
- */
120
- setAgentURI(agentId: bigint, newURI: string): Promise<string>;
121
- /**
122
- * Set onchain metadata (key-value)
123
- */
124
- setMetadata(agentId: bigint, key: string, value: string): Promise<string>;
125
- /**
126
- * Get onchain metadata
127
- */
128
- getMetadata(agentId: bigint, key: string): Promise<string>;
129
- /**
130
- * Transfer agent to new owner
131
- */
132
- transfer(agentId: bigint, to: string): Promise<string>;
133
- /**
134
- * Fetch and parse agent metadata from URI
135
- */
136
- fetchAgentMetadata(agentId: bigint): Promise<AgentMetadata | null>;
137
- /**
138
- * Give feedback to an agent
139
- */
140
- giveFeedback(input: FeedbackInput): Promise<string>;
141
- /**
142
- * Give positive feedback (shorthand)
143
- */
144
- givePosisitiveFeedback(agentId: bigint, value?: number, tags?: {
145
- tag1?: string;
146
- tag2?: string;
147
- }): Promise<string>;
148
- /**
149
- * Give negative feedback (e.g., for defaults)
150
- */
151
- giveNegativeFeedback(agentId: bigint, value?: number, tags?: {
152
- tag1?: string;
153
- tag2?: string;
154
- }): Promise<string>;
155
- /**
156
- * Record credit default in reputation system
157
- */
158
- recordCreditDefault(agentId: bigint, creditLineId: bigint): Promise<string>;
159
- /**
160
- * Get reputation summary for an agent
161
- */
162
- getReputation(agentId: bigint, tag1?: string, tag2?: string): Promise<ReputationSummary>;
163
- /**
164
- * Check if agent has negative credit reputation
165
- */
166
- hasNegativeCreditReputation(agentId: bigint): Promise<boolean>;
167
- /**
168
- * Verify agent is eligible for Agether credit
169
- * Checks:
170
- * 1. Agent exists in ERC-8004 registry
171
- * 2. Agent has no negative credit reputation
172
- */
173
- verifyForCredit(agentId: bigint): Promise<{
174
- eligible: boolean;
175
- reason?: string;
176
- owner?: string;
177
- reputation?: ReputationSummary;
178
- }>;
179
- private parseAgentIdFromReceipt;
180
- /**
181
- * Get contract addresses
182
- */
183
- getContractAddresses(): {
184
- identity: string;
185
- reputation: string;
186
- };
187
- }
188
- //# sourceMappingURL=AgentIdentityClient.d.ts.map