@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/README.md CHANGED
@@ -242,42 +242,45 @@ Client for liquidity providers.
242
242
 
243
243
  ### ScoringClient
244
244
 
245
- Client for the off-chain scoring service.
245
+ Client for the off-chain scoring service. Supports multi-chain via optional `chainId` parameter.
246
246
 
247
247
  #### Methods
248
248
 
249
249
  | Method | Returns | Description |
250
250
  |--------|---------|-------------|
251
- | `evaluateCredit(request)` | `Promise<ScoringResult>` | Request credit evaluation |
252
- | `checkRisk(agentId, amount)` | `Promise<RiskCheckResponse>` | Quick risk check |
253
- | `getStatus()` | `Promise<ServiceStatus>` | Get service status |
251
+ | `requestScore(agentId, chainId?)` | `Promise<ScoreResult>` | x402-gated: compute & submit score onchain |
252
+ | `getCurrentScore(agentId, chainId?)` | `Promise<{score, timestamp, ...}>` | Free: read current onchain score |
253
+ | `getAgentDetails(agentId, chainId?)` | `Promise<{agentId, owner, ...}>` | Agent details from backend |
254
+ | `getAgentCount(chainId?)` | `Promise<{totalAgents, totalAccounts}>` | Agent count |
255
+ | `getHealth()` | `Promise<{status, timestamp}>` | Service health check |
256
+ | `getStatus()` | `Promise<{status, chain, ...}>` | Detailed service status |
254
257
 
255
258
  #### Usage
256
259
 
257
260
  ```typescript
258
- import { ScoringClient } from '@agether/sdk';
261
+ import { ScoringClient, ChainId } from '@agether/sdk';
259
262
 
260
- const scoring = new ScoringClient('https://scoring.agether.ai/v1');
263
+ const scoring = new ScoringClient({
264
+ endpoint: 'https://api.agether.ai',
265
+ chainId: ChainId.Ethereum, // default chain for all calls
266
+ // x402: { ... } // optional: for paid scoring
267
+ });
261
268
 
262
- // Check risk score for a potential draw
263
- const risk = await scoring.checkRisk(BigInt(123), parseUnits('50', 6));
269
+ // Get current score (free) uses default chain
270
+ const score = await scoring.getCurrentScore(BigInt(123));
271
+ console.log('Score:', score.score);
264
272
 
265
- console.log('Risk score:', risk.riskScore);
266
- console.log('Level:', risk.level); // 'low' | 'medium' | 'high'
267
- console.log('Would approve:', risk.wouldApprove);
273
+ // Get score on a specific chain (overrides default)
274
+ const baseScore = await scoring.getCurrentScore(BigInt(123), ChainId.Base);
268
275
 
269
- // Get detailed evaluation
270
- const result = await scoring.evaluateCredit({
271
- agentId: BigInt(123),
272
- requestedLimit: parseUnits('1000', 6),
273
- context: {
274
- purpose: 'API payments',
275
- },
276
- });
276
+ // Get agent details
277
+ const details = await scoring.getAgentDetails(BigInt(123));
278
+ console.log('Eligible:', details.eligible);
277
279
 
278
- if (result.approved) {
279
- console.log('Credit limit:', result.creditLimit);
280
- console.log('APR:', result.aprBps / 100, '%');
280
+ // Agent count per chain
281
+ const ethCount = await scoring.getAgentCount(ChainId.Ethereum);
282
+ const baseCount = await scoring.getAgentCount(ChainId.Base);
283
+ console.log(`Ethereum: ${ethCount.totalAgents}, Base: ${baseCount.totalAgents}`);
281
284
  }
282
285
  ```
283
286
 
@@ -479,12 +482,21 @@ agether balance
479
482
  ### Example Flow
480
483
 
481
484
  ```bash
482
- # 1. Initialize
485
+ # 1. Initialize (Ethereum mainnet by default)
483
486
  $ agether init 0x5de4...
484
487
  ✅ Initialized Agether CLI
485
488
  Address: 0x3C44C...
486
- RPC: http://95.179.189.214:8545
487
- Backend: http://95.179.189.214
489
+ Chain: Ethereum (1)
490
+ RPC: https://ethereum-rpc.publicnode.com
491
+ Backend: https://api.agether.ai
492
+
493
+ # 1b. Initialize on Base
494
+ $ agether init 0x5de4... --chain 8453
495
+ ✅ Initialized Agether CLI
496
+ Address: 0x3C44C...
497
+ Chain: Base (8453)
498
+ RPC: https://base-rpc.publicnode.com
499
+ Backend: https://api.agether.ai
488
500
 
489
501
  # 2. Register agent
490
502
  $ agether register --name "OpenClaw" --code-url "https://github.com/user/openclaw"
@@ -553,8 +565,8 @@ $ agether draw --amount 1000
553
565
  ### Environment Variables
554
566
 
555
567
  ```bash
556
- export AGETHER_RPC_URL=http://95.179.189.214:8545
557
- export AGETHER_BACKEND_URL=http://95.179.189.214
568
+ export AGETHER_RPC_URL=https://ethereum-rpc.publicnode.com # or https://base-rpc.publicnode.com
569
+ export AGETHER_BACKEND_URL=https://api.agether.ai
558
570
  ```
559
571
 
560
572
  ---
package/dist/cli.js CHANGED
@@ -176,13 +176,13 @@ var init_config = __esm({
176
176
  safeProxyFactory: SAFE_PROXY_FACTORY,
177
177
  safe7579: SAFE7579,
178
178
  entryPoint: ENTRYPOINT_V07,
179
- agether4337Factory: ZERO,
180
- agether7579Bootstrap: ZERO,
181
- erc8004ValidationModule: ZERO,
182
- agetherHookMultiplexer: ZERO,
179
+ agether4337Factory: "0xE350660Ab3EA87b50233854eacCC6328e268fb48",
180
+ agether7579Bootstrap: "0xD1268B50149e468591Bcba5f6fD3E87b49D43008",
181
+ erc8004ValidationModule: "0x87Aa07Be4Ab4A2e8EeBf4a4e2451c775D0e3fbf1",
182
+ agetherHookMultiplexer: "0xC0b96e36B20d6689F4E4b8C7A0c19C28e8B45B8B",
183
183
  validationRegistry: ZERO,
184
- agether8004Scorer: ZERO,
185
- timelockController: ZERO,
184
+ agether8004Scorer: "0xd281a8ec667E406Fcf1097A64A65d1C88Fb0F7Fa",
185
+ timelockController: "0x2033CD354aAf19191F23211c6A6974fCE038AFBe",
186
186
  usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
187
187
  identityRegistry: ERC8004_IDENTITY_REGISTRY,
188
188
  morphoBlue: MORPHO_BLUE
@@ -192,13 +192,13 @@ var init_config = __esm({
192
192
  safeProxyFactory: SAFE_PROXY_FACTORY,
193
193
  safe7579: SAFE7579,
194
194
  entryPoint: ENTRYPOINT_V07,
195
- agether4337Factory: "0x67DE66D07ff3dba0092C21f070f8a0f53D657BC3",
196
- agether7579Bootstrap: "0xCc83AA714c05B7141B21a17e80EB21bD09652b27",
197
- erc8004ValidationModule: "0xde896C58163b5f6cAC5B16C1b0109843f26106F6",
198
- agetherHookMultiplexer: "0x4AB6DaD0f7360fa8d8c75889A5c206B65d7CbeDb",
195
+ agether4337Factory: "0x8aeE4961EfaA4a1D36e2b24C5b430C8613fB5b8C",
196
+ agether7579Bootstrap: "0x5e8e4644c628CB464936981e338635476d012B5F",
197
+ erc8004ValidationModule: "0x7B18a7E3D5B3d043FC3525Efcd9a2bB1aE1369Ab",
198
+ agetherHookMultiplexer: "0x2D98eff4b959F3dc76f14c5682A8546438406c4A",
199
199
  validationRegistry: ZERO,
200
- agether8004Scorer: "0x56c7D35A976fac67b1993b66b861fCA32f59104F",
201
- timelockController: "0xc600e7AAB8a230326C714CE66f356fdf6aC021d8",
200
+ agether8004Scorer: "0xA1a0B09147688a09A3027F960623Ae16d1ca7F69",
201
+ timelockController: "0x7f104DBe209E2a05FFc1700b27eaE1C397f011c4",
202
202
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
203
203
  identityRegistry: ERC8004_IDENTITY_REGISTRY,
204
204
  morphoBlue: MORPHO_BLUE
@@ -260,9 +260,9 @@ var init_config = __esm({
260
260
  [31337 /* Hardhat */]: "http://127.0.0.1:8545"
261
261
  };
262
262
  SCORING_ENDPOINTS = {
263
- [1 /* Ethereum */]: "https://scoring.agether.ai/v1",
264
- [8453 /* Base */]: "http://95.179.189.214:3001",
265
- [84532 /* BaseSepolia */]: "http://95.179.189.214:3001",
263
+ [1 /* Ethereum */]: "https://api.agether.ai",
264
+ [8453 /* Base */]: "https://api.agether.ai",
265
+ [84532 /* BaseSepolia */]: "https://api.agether.ai",
266
266
  [11155111 /* Sepolia */]: "https://scoring-testnet.agether.ai/v1",
267
267
  [31337 /* Hardhat */]: "http://127.0.0.1:3001"
268
268
  };
@@ -294,7 +294,7 @@ var init_MorphoClient = __esm({
294
294
  /** Dynamic token registry: symbol (uppercase) → { address, symbol, decimals } */
295
295
  this._tokenCache = /* @__PURE__ */ new Map();
296
296
  this._discoveredAt = 0;
297
- const chainId = config.chainId ?? 8453 /* Base */;
297
+ const chainId = config.chainId ?? 1 /* Ethereum */;
298
298
  const defaultCfg = getDefaultConfig(chainId);
299
299
  this.config = defaultCfg;
300
300
  this.agentId = config.agentId;
@@ -2205,12 +2205,14 @@ var init_X402Client = __esm({
2205
2205
  const data = await response.json();
2206
2206
  const paymentResponse = response.headers.get("PAYMENT-RESPONSE");
2207
2207
  let txHash;
2208
+ let settlementNetwork;
2208
2209
  if (paymentResponse) {
2209
2210
  try {
2210
2211
  const settlement = JSON.parse(
2211
2212
  Buffer.from(paymentResponse, "base64").toString("utf-8")
2212
2213
  );
2213
2214
  txHash = settlement.transaction;
2215
+ settlementNetwork = settlement.network;
2214
2216
  } catch (e) {
2215
2217
  console.warn("[agether] x402 payment response parse failed:", e instanceof Error ? e.message : e);
2216
2218
  }
@@ -2222,7 +2224,7 @@ var init_X402Client = __esm({
2222
2224
  paymentInfo: {
2223
2225
  amount: "",
2224
2226
  asset: "USDC",
2225
- network: "eip155:8453",
2227
+ network: settlementNetwork || "eip155",
2226
2228
  txHash
2227
2229
  }
2228
2230
  } : {}
@@ -2328,8 +2330,8 @@ var fs = __toESM(require("fs"));
2328
2330
  var path = __toESM(require("path"));
2329
2331
  var os = __toESM(require("os"));
2330
2332
  var CONFIG_PATH = path.join(os.homedir(), ".agether", "config.json");
2331
- var DEFAULT_RPC = "https://base-rpc.publicnode.com";
2332
- var DEFAULT_BACKEND = "http://95.179.189.214:3001";
2333
+ var DEFAULT_RPC = "https://ethereum-rpc.publicnode.com";
2334
+ var BACKEND_URL = "https://api.agether.ai";
2333
2335
  function loadConfig() {
2334
2336
  try {
2335
2337
  if (fs.existsSync(CONFIG_PATH)) {
@@ -2370,7 +2372,8 @@ async function getMorphoClient(config) {
2370
2372
  return new MorphoClient2({
2371
2373
  privateKey: config.privateKey,
2372
2374
  rpcUrl: config.rpcUrl,
2373
- agentId: config.agentId !== "0" ? config.agentId : void 0
2375
+ agentId: config.agentId !== "0" ? config.agentId : void 0,
2376
+ chainId: config.chainId
2374
2377
  });
2375
2378
  }
2376
2379
  async function getX402Client(config) {
@@ -2384,7 +2387,6 @@ async function getX402Client(config) {
2384
2387
  return new X402Client2({
2385
2388
  privateKey: config.privateKey,
2386
2389
  rpcUrl: config.rpcUrl,
2387
- backendUrl: config.backendUrl,
2388
2390
  agentId: config.agentId,
2389
2391
  accountAddress
2390
2392
  });
@@ -2408,8 +2410,8 @@ var VALIDATION_REGISTRY_ABI = [
2408
2410
  var MOCK_ERC20_ABI = [
2409
2411
  "function mint(address to, uint256 amount) external"
2410
2412
  ];
2411
- async function apiGet(backendUrl, endpoint) {
2412
- const res = await fetch(`${backendUrl}${endpoint}`);
2413
+ async function apiGet(endpoint) {
2414
+ const res = await fetch(`${BACKEND_URL}${endpoint}`);
2413
2415
  return res.json();
2414
2416
  }
2415
2417
  function decodeError(error) {
@@ -2424,9 +2426,16 @@ function decodeError(error) {
2424
2426
  if (msg.length > 200) return msg.slice(0, 200) + "...";
2425
2427
  return msg;
2426
2428
  }
2427
- async function cmdInit(privateKey, agentId) {
2428
- const rpcUrl = process.env.AGETHER_RPC_URL || DEFAULT_RPC;
2429
- const backendUrl = process.env.AGETHER_BACKEND_URL || DEFAULT_BACKEND;
2429
+ var CHAIN_RPC = {
2430
+ 1: "https://ethereum-rpc.publicnode.com",
2431
+ 8453: "https://base-rpc.publicnode.com",
2432
+ 84532: "https://sepolia.base.org",
2433
+ 11155111: "https://rpc.sepolia.org",
2434
+ 31337: "http://127.0.0.1:8545"
2435
+ };
2436
+ async function cmdInit(privateKey, agentId, chain) {
2437
+ const chainId = chain ? Number(chain) : 1;
2438
+ const rpcUrl = process.env.AGETHER_RPC_URL || CHAIN_RPC[chainId] || DEFAULT_RPC;
2430
2439
  let wallet;
2431
2440
  try {
2432
2441
  wallet = new import_ethers2.ethers.Wallet(privateKey);
@@ -2434,12 +2443,14 @@ async function cmdInit(privateKey, agentId) {
2434
2443
  console.error("\u274C Invalid private key");
2435
2444
  process.exit(1);
2436
2445
  }
2437
- const config = { privateKey, agentId: agentId || "0", rpcUrl, backendUrl };
2446
+ const config = { privateKey, agentId: agentId || "0", rpcUrl, chainId };
2438
2447
  saveConfig(config);
2448
+ const chainName = chainId === 1 ? "Ethereum" : chainId === 8453 ? "Base" : `Chain ${chainId}`;
2439
2449
  console.log("\u2705 Initialized Agether CLI");
2440
2450
  console.log(` Address: ${wallet.address}`);
2451
+ console.log(` Chain: ${chainName} (${chainId})`);
2441
2452
  console.log(` RPC: ${rpcUrl}`);
2442
- console.log(` Backend: ${backendUrl}`);
2453
+ console.log(` Backend: ${BACKEND_URL}`);
2443
2454
  console.log(` Config: ${CONFIG_PATH}`);
2444
2455
  }
2445
2456
  async function cmdRegister(name) {
@@ -2453,7 +2464,7 @@ async function cmdRegister(name) {
2453
2464
  console.log("\n [1/4] Fetching contract addresses...");
2454
2465
  let contracts;
2455
2466
  try {
2456
- const statusResp = await apiGet(config.backendUrl, "/status");
2467
+ const statusResp = await apiGet("/status");
2457
2468
  contracts = statusResp.contracts || {};
2458
2469
  console.log(" \u2713 Backend OK");
2459
2470
  } catch (e) {
@@ -2640,7 +2651,7 @@ async function cmdScore() {
2640
2651
  \u{1F4C8} Agent #${config.agentId} Score
2641
2652
  `);
2642
2653
  try {
2643
- const data = await apiGet(config.backendUrl, `/score/${config.agentId}/current`);
2654
+ const data = await apiGet(`/score/${config.agentId}/current`);
2644
2655
  if (data.score !== void 0) {
2645
2656
  console.log(` Onchain Score: ${data.score}`);
2646
2657
  console.log(` Timestamp: ${data.timestamp ? new Date(Number(data.timestamp) * 1e3).toISOString() : "N/A"}`);
@@ -2653,7 +2664,7 @@ async function cmdScore() {
2653
2664
  console.log(" Could not fetch current score.");
2654
2665
  }
2655
2666
  console.log("\n To compute a fresh score (x402-gated, costs USDC):");
2656
- console.log(` agether x402 ${config.backendUrl}/score/${config.agentId}`);
2667
+ console.log(` agether x402 ${BACKEND_URL}/score/${config.agentId}`);
2657
2668
  }
2658
2669
  async function cmdMarkets() {
2659
2670
  const config = requireConfig();
@@ -2819,11 +2830,14 @@ function cmdHelp() {
2819
2830
  console.log(`
2820
2831
  \u{1F3E6} Agether CLI \u2014 Direct Morpho Blue Credit for AI Agents (Safe + Safe7579)
2821
2832
 
2833
+ Supported chains: Ethereum (1, default), Base (8453)
2834
+
2822
2835
  USAGE:
2823
2836
  agether <command> [options]
2824
2837
 
2825
2838
  SETUP:
2826
- init <private-key> [--agent-id <id>] Initialize with private key
2839
+ init <private-key> [--agent-id <id>] [--chain <chainId>]
2840
+ Initialize (default: Ethereum mainnet)
2827
2841
  register [--name <n>] Register ERC-8004 + create Safe account
2828
2842
 
2829
2843
  INFO:
@@ -2847,16 +2861,20 @@ x402 PAYMENTS:
2847
2861
 
2848
2862
  ENVIRONMENT:
2849
2863
  AGETHER_RPC_URL RPC endpoint (default: ${DEFAULT_RPC})
2850
- AGETHER_BACKEND_URL Backend URL (default: ${DEFAULT_BACKEND})
2851
2864
 
2852
- EXAMPLE FLOW:
2853
- agether init 0xYOUR_PRIVATE_KEY
2865
+ EXAMPLE FLOW (Ethereum):
2866
+ agether init 0xYOUR_PRIVATE_KEY # Defaults to Ethereum
2854
2867
  agether register --name "MyAgent"
2855
2868
  agether deposit --amount 0.05 --token WETH # ~$125 collateral
2856
2869
  agether borrow --amount 50 # Borrow $50 USDC
2857
2870
  agether status # Check positions
2858
2871
  agether repay --amount 50 # Repay when done
2859
2872
  agether withdraw --amount all --token WETH # Withdraw collateral
2873
+
2874
+ EXAMPLE FLOW (Base):
2875
+ agether init 0xYOUR_PRIVATE_KEY --chain 8453 # Use Base
2876
+ agether register --name "MyAgent"
2877
+ agether deposit --amount 0.05 --token WETH
2860
2878
  `);
2861
2879
  }
2862
2880
  function parseArgs(args) {
@@ -2889,7 +2907,7 @@ async function main() {
2889
2907
  console.error("\u274C Private key required: agether init <private-key>");
2890
2908
  process.exit(1);
2891
2909
  }
2892
- await cmdInit(positional[0], options["agent-id"]);
2910
+ await cmdInit(positional[0], options["agent-id"], options["chain"]);
2893
2911
  break;
2894
2912
  case "register":
2895
2913
  await cmdRegister(options.name);
package/dist/index.d.mts CHANGED
@@ -750,7 +750,6 @@ type AgetherViemWallet = WalletClient;
750
750
  /** Base configuration fields shared by both signing modes. */
751
751
  interface X402BaseConfig {
752
752
  rpcUrl: string;
753
- backendUrl: string;
754
753
  agentId?: string;
755
754
  accountAddress?: string;
756
755
  /**
@@ -914,17 +913,22 @@ declare class X402Client {
914
913
  /**
915
914
  * ScoringClient — Client for the Agether backend scoring API
916
915
  *
916
+ * Supports multi-chain: pass `chainId` to target a specific chain
917
+ * (Base 8453, Ethereum 1). When omitted, the backend uses its default chain.
918
+ *
917
919
  * Endpoints:
918
- * GET /score/:agentId — x402-gated, compute + submit score onchain
919
- * GET /score/:agentId/current — free, read current onchain score
920
- * GET /health — service health
921
- * GET /status — detailed status
922
- * GET /agents/:agentId/details — agent details
920
+ * GET /score/:agentId?chain=<chainId> — x402-gated, compute + submit score onchain
921
+ * GET /score/:agentId/current?chain=<chainId> — free, read current onchain score
922
+ * GET /health — service health
923
+ * GET /status — detailed status
924
+ * GET /agents/:agentId/details?chain=<chainId> — agent details
923
925
  */
924
926
 
925
927
  interface ScoringClientConfig {
926
- /** Backend base URL (e.g. http://95.179.189.214:3001) */
928
+ /** Backend base URL (e.g. https://api.agether.ai) */
927
929
  endpoint: string;
930
+ /** Default chain to use for all calls (optional — backend falls back to its own default) */
931
+ chainId?: ChainId;
928
932
  /** x402 config for paid scoring calls (optional — if not set, paid calls will fail) */
929
933
  x402?: X402Config;
930
934
  }
@@ -932,7 +936,10 @@ declare class ScoringClient {
932
936
  private client;
933
937
  private x402Client?;
934
938
  private endpoint;
939
+ private defaultChainId?;
935
940
  constructor(config: ScoringClientConfig);
941
+ /** Build query string with ?chain= if chainId is set */
942
+ private chainQuery;
936
943
  /**
937
944
  * Request a fresh score computation.
938
945
  *
@@ -941,12 +948,16 @@ declare class ScoringClient {
941
948
  * the score onchain via AgentReputation.submitScore().
942
949
  *
943
950
  * Returns the ScoreResult with breakdown and txHash.
951
+ *
952
+ * @param agentId Agent ID
953
+ * @param chainId Target chain (optional — overrides default)
944
954
  */
945
- requestScore(agentId: string | bigint): Promise<ScoreResult>;
955
+ requestScore(agentId: string | bigint, chainId?: ChainId): Promise<ScoreResult>;
946
956
  /**
947
957
  * Get the current onchain score (free, no payment required).
958
+ * @param chainId Target chain (optional — overrides default)
948
959
  */
949
- getCurrentScore(agentId: string | bigint): Promise<{
960
+ getCurrentScore(agentId: string | bigint, chainId?: ChainId): Promise<{
950
961
  agentId: string;
951
962
  score: number;
952
963
  timestamp: number;
@@ -956,8 +967,9 @@ declare class ScoringClient {
956
967
  }>;
957
968
  /**
958
969
  * Get detailed agent info from backend.
970
+ * @param chainId Target chain (optional — overrides default)
959
971
  */
960
- getAgentDetails(agentId: string | bigint): Promise<{
972
+ getAgentDetails(agentId: string | bigint, chainId?: ChainId): Promise<{
961
973
  agentId: string;
962
974
  owner: string;
963
975
  account: string;
@@ -992,8 +1004,9 @@ declare class ScoringClient {
992
1004
  }>;
993
1005
  /**
994
1006
  * Agent count and list.
1007
+ * @param chainId Target chain (optional — overrides default)
995
1008
  */
996
- getAgentCount(): Promise<{
1009
+ getAgentCount(chainId?: ChainId): Promise<{
997
1010
  totalAgents: number;
998
1011
  totalAccounts: number;
999
1012
  }>;
@@ -1002,8 +1015,12 @@ declare class ScoringClient {
1002
1015
  /**
1003
1016
  * AgentIdentityClient - Integration with ag0 (ERC-8004)
1004
1017
  *
1005
- * ERC-8004 Contract Addresses:
1006
- * - Sepolia IdentityRegistry: 0x8004A818BFB912233c491871b3d84c89A494BD9e
1018
+ * ERC-8004 is a per-chain singleton — different chain = different agentId.
1019
+ *
1020
+ * Contract Addresses:
1021
+ * - Ethereum IdentityRegistry: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
1022
+ * - Base IdentityRegistry: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
1023
+ * - Sepolia IdentityRegistry: 0x8004A818BFB912233c491871b3d84c89A494BD9e
1007
1024
  * - Sepolia ReputationRegistry: 0x8004B663056A597Dffe9eCcC1965A193B7388713
1008
1025
  *
1009
1026
  * SDKs:
@@ -1278,5 +1295,17 @@ declare function getDefaultConfig(chainId: ChainId): AgetherConfig;
1278
1295
  * Create custom config (override any defaults)
1279
1296
  */
1280
1297
  declare function createConfig(chainId: ChainId, options?: Partial<AgetherConfig>): AgetherConfig;
1298
+ /**
1299
+ * Get USDC address for chain
1300
+ */
1301
+ declare function getUSDCAddress(chainId: ChainId): string;
1302
+ /**
1303
+ * Get Morpho Blue address for chain
1304
+ */
1305
+ declare function getMorphoBlueAddress(chainId: ChainId): string;
1306
+ /**
1307
+ * Get all contract addresses for a chain
1308
+ */
1309
+ declare function getContractAddresses(chainId: ChainId): ContractAddresses;
1281
1310
 
1282
- export { ACCOUNT_FACTORY_ABI, AGENT_REPUTATION_ABI, AGETHER_4337_FACTORY_ABI, AGETHER_8004_SCORER_ABI, AGETHER_8004_VALIDATION_MODULE_ABI, AGETHER_HOOK_MULTIPLEXER_ABI, AgentIdentityClient, type AgentIdentityClientOptions, AgentNotApprovedError, AgetherClient, type AgetherClientOptions, type AgetherConfig, AgetherError, type AgetherSigner, type AgetherViemWallet, type BalancesResult, type BorrowResult, ChainId, type ContractAddresses, type DepositAndBorrowResult, type DepositResult, ENTRYPOINT_V07_ABI, ERC20_ABI, ERC8004_VALIDATION_MODULE_ABI, type FundResult, HOOK_MULTIPLEXER_ABI, IDENTITY_REGISTRY_ABI, InsufficientBalanceError, MORPHO_BLUE_ABI, MorphoClient, type MorphoClientConfig, type MorphoMarketInfo, type MorphoMarketParams, type MorphoPosition, type PayFromYieldResult, type PaymentRequirements, type PositionResult, type RegisterResult, type RepayResult, SAFE7579_ACCOUNT_ABI, SAFE_AGENT_FACTORY_ABI, type ScoreAttestation, type ScoreResult, ScoringClient, type ScoringClientConfig, ScoringRejectedError, type SpendingTracker, type StatusResult, type SupplyAssetResult, type SupplyPositionResult, type TransactionResult, VALIDATION_REGISTRY_ABI, type WithdrawFromAccountResult, type WithdrawResult, type WithdrawSupplyResult, X402Client, type X402Config, type X402PaymentRequest, type X402PaymentResult, type X402Response, bpsToRate, createConfig, formatAPR, formatAddress, formatHealthFactor, formatPercent, formatTimestamp, formatUSD, formatUnits, getDefaultConfig, parseUnits, rateToBps };
1311
+ export { ACCOUNT_FACTORY_ABI, AGENT_REPUTATION_ABI, AGETHER_4337_FACTORY_ABI, AGETHER_8004_SCORER_ABI, AGETHER_8004_VALIDATION_MODULE_ABI, AGETHER_HOOK_MULTIPLEXER_ABI, AgentIdentityClient, type AgentIdentityClientOptions, AgentNotApprovedError, AgetherClient, type AgetherClientOptions, type AgetherConfig, AgetherError, type AgetherSigner, type AgetherViemWallet, type BalancesResult, type BorrowResult, ChainId, type ContractAddresses, type DepositAndBorrowResult, type DepositResult, ENTRYPOINT_V07_ABI, ERC20_ABI, ERC8004_VALIDATION_MODULE_ABI, type FundResult, HOOK_MULTIPLEXER_ABI, IDENTITY_REGISTRY_ABI, InsufficientBalanceError, MORPHO_BLUE_ABI, MorphoClient, type MorphoClientConfig, type MorphoMarketInfo, type MorphoMarketParams, type MorphoPosition, type PayFromYieldResult, type PaymentRequirements, type PositionResult, type RegisterResult, type RepayResult, SAFE7579_ACCOUNT_ABI, SAFE_AGENT_FACTORY_ABI, type ScoreAttestation, type ScoreResult, ScoringClient, type ScoringClientConfig, ScoringRejectedError, type SpendingTracker, type StatusResult, type SupplyAssetResult, type SupplyPositionResult, type TransactionResult, VALIDATION_REGISTRY_ABI, type WithdrawFromAccountResult, type WithdrawResult, type WithdrawSupplyResult, X402Client, type X402Config, type X402PaymentRequest, type X402PaymentResult, type X402Response, bpsToRate, createConfig, formatAPR, formatAddress, formatHealthFactor, formatPercent, formatTimestamp, formatUSD, formatUnits, getContractAddresses, getDefaultConfig, getMorphoBlueAddress, getUSDCAddress, parseUnits, rateToBps };
package/dist/index.d.ts CHANGED
@@ -750,7 +750,6 @@ type AgetherViemWallet = WalletClient;
750
750
  /** Base configuration fields shared by both signing modes. */
751
751
  interface X402BaseConfig {
752
752
  rpcUrl: string;
753
- backendUrl: string;
754
753
  agentId?: string;
755
754
  accountAddress?: string;
756
755
  /**
@@ -914,17 +913,22 @@ declare class X402Client {
914
913
  /**
915
914
  * ScoringClient — Client for the Agether backend scoring API
916
915
  *
916
+ * Supports multi-chain: pass `chainId` to target a specific chain
917
+ * (Base 8453, Ethereum 1). When omitted, the backend uses its default chain.
918
+ *
917
919
  * Endpoints:
918
- * GET /score/:agentId — x402-gated, compute + submit score onchain
919
- * GET /score/:agentId/current — free, read current onchain score
920
- * GET /health — service health
921
- * GET /status — detailed status
922
- * GET /agents/:agentId/details — agent details
920
+ * GET /score/:agentId?chain=<chainId> — x402-gated, compute + submit score onchain
921
+ * GET /score/:agentId/current?chain=<chainId> — free, read current onchain score
922
+ * GET /health — service health
923
+ * GET /status — detailed status
924
+ * GET /agents/:agentId/details?chain=<chainId> — agent details
923
925
  */
924
926
 
925
927
  interface ScoringClientConfig {
926
- /** Backend base URL (e.g. http://95.179.189.214:3001) */
928
+ /** Backend base URL (e.g. https://api.agether.ai) */
927
929
  endpoint: string;
930
+ /** Default chain to use for all calls (optional — backend falls back to its own default) */
931
+ chainId?: ChainId;
928
932
  /** x402 config for paid scoring calls (optional — if not set, paid calls will fail) */
929
933
  x402?: X402Config;
930
934
  }
@@ -932,7 +936,10 @@ declare class ScoringClient {
932
936
  private client;
933
937
  private x402Client?;
934
938
  private endpoint;
939
+ private defaultChainId?;
935
940
  constructor(config: ScoringClientConfig);
941
+ /** Build query string with ?chain= if chainId is set */
942
+ private chainQuery;
936
943
  /**
937
944
  * Request a fresh score computation.
938
945
  *
@@ -941,12 +948,16 @@ declare class ScoringClient {
941
948
  * the score onchain via AgentReputation.submitScore().
942
949
  *
943
950
  * Returns the ScoreResult with breakdown and txHash.
951
+ *
952
+ * @param agentId Agent ID
953
+ * @param chainId Target chain (optional — overrides default)
944
954
  */
945
- requestScore(agentId: string | bigint): Promise<ScoreResult>;
955
+ requestScore(agentId: string | bigint, chainId?: ChainId): Promise<ScoreResult>;
946
956
  /**
947
957
  * Get the current onchain score (free, no payment required).
958
+ * @param chainId Target chain (optional — overrides default)
948
959
  */
949
- getCurrentScore(agentId: string | bigint): Promise<{
960
+ getCurrentScore(agentId: string | bigint, chainId?: ChainId): Promise<{
950
961
  agentId: string;
951
962
  score: number;
952
963
  timestamp: number;
@@ -956,8 +967,9 @@ declare class ScoringClient {
956
967
  }>;
957
968
  /**
958
969
  * Get detailed agent info from backend.
970
+ * @param chainId Target chain (optional — overrides default)
959
971
  */
960
- getAgentDetails(agentId: string | bigint): Promise<{
972
+ getAgentDetails(agentId: string | bigint, chainId?: ChainId): Promise<{
961
973
  agentId: string;
962
974
  owner: string;
963
975
  account: string;
@@ -992,8 +1004,9 @@ declare class ScoringClient {
992
1004
  }>;
993
1005
  /**
994
1006
  * Agent count and list.
1007
+ * @param chainId Target chain (optional — overrides default)
995
1008
  */
996
- getAgentCount(): Promise<{
1009
+ getAgentCount(chainId?: ChainId): Promise<{
997
1010
  totalAgents: number;
998
1011
  totalAccounts: number;
999
1012
  }>;
@@ -1002,8 +1015,12 @@ declare class ScoringClient {
1002
1015
  /**
1003
1016
  * AgentIdentityClient - Integration with ag0 (ERC-8004)
1004
1017
  *
1005
- * ERC-8004 Contract Addresses:
1006
- * - Sepolia IdentityRegistry: 0x8004A818BFB912233c491871b3d84c89A494BD9e
1018
+ * ERC-8004 is a per-chain singleton — different chain = different agentId.
1019
+ *
1020
+ * Contract Addresses:
1021
+ * - Ethereum IdentityRegistry: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
1022
+ * - Base IdentityRegistry: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
1023
+ * - Sepolia IdentityRegistry: 0x8004A818BFB912233c491871b3d84c89A494BD9e
1007
1024
  * - Sepolia ReputationRegistry: 0x8004B663056A597Dffe9eCcC1965A193B7388713
1008
1025
  *
1009
1026
  * SDKs:
@@ -1278,5 +1295,17 @@ declare function getDefaultConfig(chainId: ChainId): AgetherConfig;
1278
1295
  * Create custom config (override any defaults)
1279
1296
  */
1280
1297
  declare function createConfig(chainId: ChainId, options?: Partial<AgetherConfig>): AgetherConfig;
1298
+ /**
1299
+ * Get USDC address for chain
1300
+ */
1301
+ declare function getUSDCAddress(chainId: ChainId): string;
1302
+ /**
1303
+ * Get Morpho Blue address for chain
1304
+ */
1305
+ declare function getMorphoBlueAddress(chainId: ChainId): string;
1306
+ /**
1307
+ * Get all contract addresses for a chain
1308
+ */
1309
+ declare function getContractAddresses(chainId: ChainId): ContractAddresses;
1281
1310
 
1282
- export { ACCOUNT_FACTORY_ABI, AGENT_REPUTATION_ABI, AGETHER_4337_FACTORY_ABI, AGETHER_8004_SCORER_ABI, AGETHER_8004_VALIDATION_MODULE_ABI, AGETHER_HOOK_MULTIPLEXER_ABI, AgentIdentityClient, type AgentIdentityClientOptions, AgentNotApprovedError, AgetherClient, type AgetherClientOptions, type AgetherConfig, AgetherError, type AgetherSigner, type AgetherViemWallet, type BalancesResult, type BorrowResult, ChainId, type ContractAddresses, type DepositAndBorrowResult, type DepositResult, ENTRYPOINT_V07_ABI, ERC20_ABI, ERC8004_VALIDATION_MODULE_ABI, type FundResult, HOOK_MULTIPLEXER_ABI, IDENTITY_REGISTRY_ABI, InsufficientBalanceError, MORPHO_BLUE_ABI, MorphoClient, type MorphoClientConfig, type MorphoMarketInfo, type MorphoMarketParams, type MorphoPosition, type PayFromYieldResult, type PaymentRequirements, type PositionResult, type RegisterResult, type RepayResult, SAFE7579_ACCOUNT_ABI, SAFE_AGENT_FACTORY_ABI, type ScoreAttestation, type ScoreResult, ScoringClient, type ScoringClientConfig, ScoringRejectedError, type SpendingTracker, type StatusResult, type SupplyAssetResult, type SupplyPositionResult, type TransactionResult, VALIDATION_REGISTRY_ABI, type WithdrawFromAccountResult, type WithdrawResult, type WithdrawSupplyResult, X402Client, type X402Config, type X402PaymentRequest, type X402PaymentResult, type X402Response, bpsToRate, createConfig, formatAPR, formatAddress, formatHealthFactor, formatPercent, formatTimestamp, formatUSD, formatUnits, getDefaultConfig, parseUnits, rateToBps };
1311
+ export { ACCOUNT_FACTORY_ABI, AGENT_REPUTATION_ABI, AGETHER_4337_FACTORY_ABI, AGETHER_8004_SCORER_ABI, AGETHER_8004_VALIDATION_MODULE_ABI, AGETHER_HOOK_MULTIPLEXER_ABI, AgentIdentityClient, type AgentIdentityClientOptions, AgentNotApprovedError, AgetherClient, type AgetherClientOptions, type AgetherConfig, AgetherError, type AgetherSigner, type AgetherViemWallet, type BalancesResult, type BorrowResult, ChainId, type ContractAddresses, type DepositAndBorrowResult, type DepositResult, ENTRYPOINT_V07_ABI, ERC20_ABI, ERC8004_VALIDATION_MODULE_ABI, type FundResult, HOOK_MULTIPLEXER_ABI, IDENTITY_REGISTRY_ABI, InsufficientBalanceError, MORPHO_BLUE_ABI, MorphoClient, type MorphoClientConfig, type MorphoMarketInfo, type MorphoMarketParams, type MorphoPosition, type PayFromYieldResult, type PaymentRequirements, type PositionResult, type RegisterResult, type RepayResult, SAFE7579_ACCOUNT_ABI, SAFE_AGENT_FACTORY_ABI, type ScoreAttestation, type ScoreResult, ScoringClient, type ScoringClientConfig, ScoringRejectedError, type SpendingTracker, type StatusResult, type SupplyAssetResult, type SupplyPositionResult, type TransactionResult, VALIDATION_REGISTRY_ABI, type WithdrawFromAccountResult, type WithdrawResult, type WithdrawSupplyResult, X402Client, type X402Config, type X402PaymentRequest, type X402PaymentResult, type X402Response, bpsToRate, createConfig, formatAPR, formatAddress, formatHealthFactor, formatPercent, formatTimestamp, formatUSD, formatUnits, getContractAddresses, getDefaultConfig, getMorphoBlueAddress, getUSDCAddress, parseUnits, rateToBps };