@agether/sdk 2.6.0 → 2.7.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 +49 -33
  3. package/dist/index.d.mts +43 -19
  4. package/dist/index.d.ts +43 -19
  5. package/dist/index.js +60 -29
  6. package/dist/index.mjs +57 -29
  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: "0x94875D0E6c588a73b47b688164AC04AdcC32aA33",
251
+ agether7579Bootstrap: "0xfa1Fe090C6a959455a221d577c2A497307854e34",
252
+ erc8004ValidationModule: "0xD06561888328587e15475681b5936E25694B330B",
253
+ agetherHookMultiplexer: "0x951A010568304a8c54173a63E5Ea74098Ddd8bDB",
251
254
  validationRegistry: ZERO,
252
- agether8004Scorer: ZERO,
253
- timelockController: ZERO,
255
+ agether8004Scorer: "0x09AA6Bb7D4f2b027a3Adb52c2222a0cfDf891201",
256
+ timelockController: "0x8F77bdA1c2E62Cd0F8EE2388C7bc8Fd8Bf6aed6D",
254
257
  usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
255
258
  identityRegistry: ERC8004_IDENTITY_REGISTRY,
256
259
  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;
@@ -2344,9 +2356,7 @@ var X402Client = class {
2344
2356
  const paymentAmount = await this._probePaymentAmount(url, fetchOpts);
2345
2357
  if (paymentAmount !== null) {
2346
2358
  console.log(` [auto-fund] Payment required: ${(Number(paymentAmount) / 1e6).toFixed(6)} USDC`);
2347
- const bufferStr = this.config.autoDrawBuffer || "0.5";
2348
- const buffer = BigInt(Math.round(parseFloat(bufferStr) * 1e6));
2349
- const needed = paymentAmount + buffer;
2359
+ const needed = paymentAmount;
2350
2360
  if (usdcBalance < needed) {
2351
2361
  const totalDeficit = needed - usdcBalance;
2352
2362
  console.log(` [auto-fund] Insufficient balance. Deficit: ${(Number(totalDeficit) / 1e6).toFixed(2)} USDC`);
@@ -2449,12 +2459,14 @@ var X402Client = class {
2449
2459
  const data = await response.json();
2450
2460
  const paymentResponse = response.headers.get("PAYMENT-RESPONSE");
2451
2461
  let txHash;
2462
+ let settlementNetwork;
2452
2463
  if (paymentResponse) {
2453
2464
  try {
2454
2465
  const settlement = JSON.parse(
2455
2466
  Buffer.from(paymentResponse, "base64").toString("utf-8")
2456
2467
  );
2457
2468
  txHash = settlement.transaction;
2469
+ settlementNetwork = settlement.network;
2458
2470
  } catch (e) {
2459
2471
  console.warn("[agether] x402 payment response parse failed:", e instanceof Error ? e.message : e);
2460
2472
  }
@@ -2466,7 +2478,7 @@ var X402Client = class {
2466
2478
  paymentInfo: {
2467
2479
  amount: "",
2468
2480
  asset: "USDC",
2469
- network: "eip155:8453",
2481
+ network: settlementNetwork || "eip155",
2470
2482
  txHash
2471
2483
  }
2472
2484
  } : {}
@@ -2568,6 +2580,7 @@ var X402Client = class {
2568
2580
  var ScoringClient = class {
2569
2581
  constructor(config) {
2570
2582
  this.endpoint = config.endpoint;
2583
+ this.defaultChainId = config.chainId;
2571
2584
  this.client = import_axios2.default.create({
2572
2585
  baseURL: config.endpoint,
2573
2586
  headers: { "Content-Type": "application/json" },
@@ -2577,6 +2590,11 @@ var ScoringClient = class {
2577
2590
  this.x402Client = new X402Client(config.x402);
2578
2591
  }
2579
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
+ }
2580
2598
  // ════════════════════════════════════════════════════════
2581
2599
  // Score (x402-gated — computes & submits onchain)
2582
2600
  // ════════════════════════════════════════════════════════
@@ -2588,9 +2606,13 @@ var ScoringClient = class {
2588
2606
  * the score onchain via AgentReputation.submitScore().
2589
2607
  *
2590
2608
  * Returns the ScoreResult with breakdown and txHash.
2609
+ *
2610
+ * @param agentId Agent ID
2611
+ * @param chainId Target chain (optional — overrides default)
2591
2612
  */
2592
- async requestScore(agentId) {
2613
+ async requestScore(agentId, chainId) {
2593
2614
  const id = agentId.toString();
2615
+ const qs = this.chainQuery(chainId);
2594
2616
  if (!this.x402Client) {
2595
2617
  throw new AgetherError(
2596
2618
  "x402 config required for paid scoring. Provide x402 in ScoringClientConfig.",
@@ -2598,7 +2620,7 @@ var ScoringClient = class {
2598
2620
  );
2599
2621
  }
2600
2622
  const result = await this.x402Client.get(
2601
- `${this.endpoint}/score/${id}`
2623
+ `${this.endpoint}/score/${id}${qs}`
2602
2624
  );
2603
2625
  if (!result.success || !result.data) {
2604
2626
  throw new AgetherError(
@@ -2613,9 +2635,11 @@ var ScoringClient = class {
2613
2635
  // ════════════════════════════════════════════════════════
2614
2636
  /**
2615
2637
  * Get the current onchain score (free, no payment required).
2638
+ * @param chainId Target chain (optional — overrides default)
2616
2639
  */
2617
- async getCurrentScore(agentId) {
2618
- 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}`);
2619
2643
  return response.data;
2620
2644
  }
2621
2645
  // ════════════════════════════════════════════════════════
@@ -2623,9 +2647,11 @@ var ScoringClient = class {
2623
2647
  // ════════════════════════════════════════════════════════
2624
2648
  /**
2625
2649
  * Get detailed agent info from backend.
2650
+ * @param chainId Target chain (optional — overrides default)
2626
2651
  */
2627
- async getAgentDetails(agentId) {
2628
- 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}`);
2629
2655
  return response.data;
2630
2656
  }
2631
2657
  // ════════════════════════════════════════════════════════
@@ -2647,9 +2673,11 @@ var ScoringClient = class {
2647
2673
  }
2648
2674
  /**
2649
2675
  * Agent count and list.
2676
+ * @param chainId Target chain (optional — overrides default)
2650
2677
  */
2651
- async getAgentCount() {
2652
- 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}`);
2653
2681
  return response.data;
2654
2682
  }
2655
2683
  };
@@ -3071,7 +3099,10 @@ function rateToBps(rate) {
3071
3099
  formatTimestamp,
3072
3100
  formatUSD,
3073
3101
  formatUnits,
3102
+ getContractAddresses,
3074
3103
  getDefaultConfig,
3104
+ getMorphoBlueAddress,
3105
+ getUSDCAddress,
3075
3106
  parseUnits,
3076
3107
  rateToBps
3077
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: "0x94875D0E6c588a73b47b688164AC04AdcC32aA33",
176
+ agether7579Bootstrap: "0xfa1Fe090C6a959455a221d577c2A497307854e34",
177
+ erc8004ValidationModule: "0xD06561888328587e15475681b5936E25694B330B",
178
+ agetherHookMultiplexer: "0x951A010568304a8c54173a63E5Ea74098Ddd8bDB",
179
179
  validationRegistry: ZERO,
180
- agether8004Scorer: ZERO,
181
- timelockController: ZERO,
180
+ agether8004Scorer: "0x09AA6Bb7D4f2b027a3Adb52c2222a0cfDf891201",
181
+ timelockController: "0x8F77bdA1c2E62Cd0F8EE2388C7bc8Fd8Bf6aed6D",
182
182
  usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
183
183
  identityRegistry: ERC8004_IDENTITY_REGISTRY,
184
184
  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;
@@ -2272,9 +2281,7 @@ var X402Client = class {
2272
2281
  const paymentAmount = await this._probePaymentAmount(url, fetchOpts);
2273
2282
  if (paymentAmount !== null) {
2274
2283
  console.log(` [auto-fund] Payment required: ${(Number(paymentAmount) / 1e6).toFixed(6)} USDC`);
2275
- const bufferStr = this.config.autoDrawBuffer || "0.5";
2276
- const buffer = BigInt(Math.round(parseFloat(bufferStr) * 1e6));
2277
- const needed = paymentAmount + buffer;
2284
+ const needed = paymentAmount;
2278
2285
  if (usdcBalance < needed) {
2279
2286
  const totalDeficit = needed - usdcBalance;
2280
2287
  console.log(` [auto-fund] Insufficient balance. Deficit: ${(Number(totalDeficit) / 1e6).toFixed(2)} USDC`);
@@ -2377,12 +2384,14 @@ var X402Client = class {
2377
2384
  const data = await response.json();
2378
2385
  const paymentResponse = response.headers.get("PAYMENT-RESPONSE");
2379
2386
  let txHash;
2387
+ let settlementNetwork;
2380
2388
  if (paymentResponse) {
2381
2389
  try {
2382
2390
  const settlement = JSON.parse(
2383
2391
  Buffer.from(paymentResponse, "base64").toString("utf-8")
2384
2392
  );
2385
2393
  txHash = settlement.transaction;
2394
+ settlementNetwork = settlement.network;
2386
2395
  } catch (e) {
2387
2396
  console.warn("[agether] x402 payment response parse failed:", e instanceof Error ? e.message : e);
2388
2397
  }
@@ -2394,7 +2403,7 @@ var X402Client = class {
2394
2403
  paymentInfo: {
2395
2404
  amount: "",
2396
2405
  asset: "USDC",
2397
- network: "eip155:8453",
2406
+ network: settlementNetwork || "eip155",
2398
2407
  txHash
2399
2408
  }
2400
2409
  } : {}
@@ -2496,6 +2505,7 @@ var X402Client = class {
2496
2505
  var ScoringClient = class {
2497
2506
  constructor(config) {
2498
2507
  this.endpoint = config.endpoint;
2508
+ this.defaultChainId = config.chainId;
2499
2509
  this.client = axios2.create({
2500
2510
  baseURL: config.endpoint,
2501
2511
  headers: { "Content-Type": "application/json" },
@@ -2505,6 +2515,11 @@ var ScoringClient = class {
2505
2515
  this.x402Client = new X402Client(config.x402);
2506
2516
  }
2507
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
+ }
2508
2523
  // ════════════════════════════════════════════════════════
2509
2524
  // Score (x402-gated — computes & submits onchain)
2510
2525
  // ════════════════════════════════════════════════════════
@@ -2516,9 +2531,13 @@ var ScoringClient = class {
2516
2531
  * the score onchain via AgentReputation.submitScore().
2517
2532
  *
2518
2533
  * Returns the ScoreResult with breakdown and txHash.
2534
+ *
2535
+ * @param agentId Agent ID
2536
+ * @param chainId Target chain (optional — overrides default)
2519
2537
  */
2520
- async requestScore(agentId) {
2538
+ async requestScore(agentId, chainId) {
2521
2539
  const id = agentId.toString();
2540
+ const qs = this.chainQuery(chainId);
2522
2541
  if (!this.x402Client) {
2523
2542
  throw new AgetherError(
2524
2543
  "x402 config required for paid scoring. Provide x402 in ScoringClientConfig.",
@@ -2526,7 +2545,7 @@ var ScoringClient = class {
2526
2545
  );
2527
2546
  }
2528
2547
  const result = await this.x402Client.get(
2529
- `${this.endpoint}/score/${id}`
2548
+ `${this.endpoint}/score/${id}${qs}`
2530
2549
  );
2531
2550
  if (!result.success || !result.data) {
2532
2551
  throw new AgetherError(
@@ -2541,9 +2560,11 @@ var ScoringClient = class {
2541
2560
  // ════════════════════════════════════════════════════════
2542
2561
  /**
2543
2562
  * Get the current onchain score (free, no payment required).
2563
+ * @param chainId Target chain (optional — overrides default)
2544
2564
  */
2545
- async getCurrentScore(agentId) {
2546
- 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}`);
2547
2568
  return response.data;
2548
2569
  }
2549
2570
  // ════════════════════════════════════════════════════════
@@ -2551,9 +2572,11 @@ var ScoringClient = class {
2551
2572
  // ════════════════════════════════════════════════════════
2552
2573
  /**
2553
2574
  * Get detailed agent info from backend.
2575
+ * @param chainId Target chain (optional — overrides default)
2554
2576
  */
2555
- async getAgentDetails(agentId) {
2556
- 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}`);
2557
2580
  return response.data;
2558
2581
  }
2559
2582
  // ════════════════════════════════════════════════════════
@@ -2575,9 +2598,11 @@ var ScoringClient = class {
2575
2598
  }
2576
2599
  /**
2577
2600
  * Agent count and list.
2601
+ * @param chainId Target chain (optional — overrides default)
2578
2602
  */
2579
- async getAgentCount() {
2580
- 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}`);
2581
2606
  return response.data;
2582
2607
  }
2583
2608
  };
@@ -2998,7 +3023,10 @@ export {
2998
3023
  formatTimestamp,
2999
3024
  formatUSD,
3000
3025
  formatUnits,
3026
+ getContractAddresses,
3001
3027
  getDefaultConfig,
3028
+ getMorphoBlueAddress,
3029
+ getUSDCAddress,
3002
3030
  parseUnits,
3003
3031
  rateToBps
3004
3032
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agether/sdk",
3
- "version": "2.6.0",
4
- "description": "TypeScript SDK for Agether - autonomous credit for AI agents on Base",
3
+ "version": "2.7.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
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentIdentityClient.d.ts","sourceRoot":"","sources":["../../src/clients/AgentIdentity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