@agether/sdk 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -6,11 +6,11 @@ import { WalletClient } from 'viem';
6
6
  *
7
7
  * Architecture (v2 — Safe + Safe7579):
8
8
  * - Agent registers via ERC-8004 → gets agentId
9
- * - SafeAgentFactory creates Safe proxy with Safe7579 adapter per agent
10
- * - ERC8004ValidationModule: ownership + KYA gate + module lock (single 7579 validator)
11
- * - HookMultiplexer: admin-managed hook chain
9
+ * - Agether4337Factory creates Safe proxy with Safe7579 adapter per agent
10
+ * - Agether8004ValidationModule: ownership + KYA gate + module lock (single 7579 validator)
11
+ * - AgetherHookMultiplexer: admin-managed hook chain
12
12
  * - All execution via ERC-4337 UserOps through EntryPoint v0.7
13
- * - AgentReputation: oracle-based credit scoring
13
+ * - Agether8004Scorer: oracle-based credit scoring
14
14
  * - Morpho Blue: direct overcollateralized lending (agents interact via UserOps)
15
15
  * - x402: HTTP payment protocol for scoring API
16
16
  */
@@ -29,13 +29,13 @@ interface MorphoMarketParams {
29
29
  irm: string;
30
30
  lltv: bigint;
31
31
  }
32
- /** Morpho Blue on-chain position for an account */
32
+ /** Morpho Blue onchain position for an account */
33
33
  interface MorphoPosition {
34
34
  supplyShares: bigint;
35
35
  borrowShares: bigint;
36
36
  collateral: bigint;
37
37
  }
38
- /** Morpho market info (from GraphQL API or on-chain) */
38
+ /** Morpho market info (from GraphQL API or onchain) */
39
39
  interface MorphoMarketInfo {
40
40
  uniqueKey: string;
41
41
  loanAsset: {
@@ -55,7 +55,7 @@ interface MorphoMarketInfo {
55
55
  totalBorrowAssets: bigint;
56
56
  utilization: number;
57
57
  }
58
- /** On-chain score attestation from AgentReputation contract */
58
+ /** Onchain score attestation from Agether8004Scorer contract */
59
59
  interface ScoreAttestation {
60
60
  score: bigint;
61
61
  timestamp: bigint;
@@ -107,12 +107,12 @@ interface ContractAddresses {
107
107
  safeProxyFactory: string;
108
108
  safe7579: string;
109
109
  entryPoint: string;
110
- safeAgentFactory: string;
111
- safe7579Bootstrap: string;
110
+ agether4337Factory: string;
111
+ agether7579Bootstrap: string;
112
112
  erc8004ValidationModule: string;
113
- hookMultiplexer: string;
113
+ agetherHookMultiplexer: string;
114
114
  validationRegistry: string;
115
- agentReputation: string;
115
+ agether8004Scorer: string;
116
116
  timelockController: string;
117
117
  identityRegistry: string;
118
118
  usdc: string;
@@ -142,9 +142,9 @@ declare class AgetherClient {
142
142
  private config;
143
143
  private signer;
144
144
  private agentId;
145
- private safeAgentFactory;
145
+ private agether4337Factory;
146
146
  private identityRegistry;
147
- private agentReputation;
147
+ private agether8004Scorer;
148
148
  private validationModule;
149
149
  private accountAddress?;
150
150
  constructor(options: AgetherClientOptions);
@@ -228,10 +228,10 @@ interface MorphoClientBaseConfig {
228
228
  agentId?: string;
229
229
  chainId?: ChainId;
230
230
  contracts?: Partial<{
231
- safeAgentFactory: string;
231
+ agether4337Factory: string;
232
232
  morphoBlue: string;
233
233
  usdc: string;
234
- agentReputation: string;
234
+ agether8004Scorer: string;
235
235
  identityRegistry: string;
236
236
  erc8004ValidationModule: string;
237
237
  entryPoint: string;
@@ -356,9 +356,9 @@ declare class MorphoClient {
356
356
  private _privateKey?;
357
357
  private _useExternalSigner;
358
358
  private _eoaAddress?;
359
- private safeAgentFactory;
359
+ private agether4337Factory;
360
360
  private morphoBlue;
361
- private agentReputation;
361
+ private agether8004Scorer;
362
362
  private identityRegistry;
363
363
  private entryPoint;
364
364
  private validationModule;
@@ -407,12 +407,12 @@ declare class MorphoClient {
407
407
  getMarkets(forceRefresh?: boolean): Promise<MorphoMarketInfo[]>;
408
408
  /**
409
409
  * Get MarketParams for a collateral token.
410
- * Tries cache → API → on-chain idToMarketParams.
410
+ * Tries cache → API → onchain idToMarketParams.
411
411
  */
412
412
  findMarketForCollateral(collateralSymbolOrAddress: string): Promise<MorphoMarketParams>;
413
- /** Read MarketParams on-chain by market ID (bytes32). */
413
+ /** Read MarketParams onchain by market ID (bytes32). */
414
414
  getMarketParams(marketId: string): Promise<MorphoMarketParams>;
415
- /** Read on-chain position for a specific market. */
415
+ /** Read onchain position for a specific market. */
416
416
  getPosition(marketId: string): Promise<MorphoPosition>;
417
417
  /**
418
418
  * Full status: positions across all discovered markets.
@@ -754,8 +754,8 @@ declare class X402Client {
754
754
  * ScoringClient — Client for the Agether backend scoring API
755
755
  *
756
756
  * Endpoints:
757
- * GET /score/:agentId — x402-gated, compute + submit score on-chain
758
- * GET /score/:agentId/current — free, read current on-chain score
757
+ * GET /score/:agentId — x402-gated, compute + submit score onchain
758
+ * GET /score/:agentId/current — free, read current onchain score
759
759
  * GET /health — service health
760
760
  * GET /status — detailed status
761
761
  * GET /agents/:agentId/details — agent details
@@ -777,13 +777,13 @@ declare class ScoringClient {
777
777
  *
778
778
  * This is x402-gated: the backend returns 402, the X402Client
779
779
  * signs an EIP-3009 payment, and the backend computes + submits
780
- * the score on-chain via AgentReputation.submitScore().
780
+ * the score onchain via AgentReputation.submitScore().
781
781
  *
782
782
  * Returns the ScoreResult with breakdown and txHash.
783
783
  */
784
784
  requestScore(agentId: string | bigint): Promise<ScoreResult>;
785
785
  /**
786
- * Get the current on-chain score (free, no payment required).
786
+ * Get the current onchain score (free, no payment required).
787
787
  */
788
788
  getCurrentScore(agentId: string | bigint): Promise<{
789
789
  agentId: string;
@@ -932,7 +932,7 @@ declare class AgentIdentityClient {
932
932
  existing: boolean;
933
933
  }>;
934
934
  /**
935
- * Register agent with URI and on-chain metadata
935
+ * Register agent with URI and onchain metadata
936
936
  */
937
937
  registerWithMetadata(agentURI: string, metadata: {
938
938
  key: string;
@@ -954,11 +954,11 @@ declare class AgentIdentityClient {
954
954
  */
955
955
  setAgentURI(agentId: bigint, newURI: string): Promise<string>;
956
956
  /**
957
- * Set on-chain metadata (key-value)
957
+ * Set onchain metadata (key-value)
958
958
  */
959
959
  setMetadata(agentId: bigint, key: string, value: string): Promise<string>;
960
960
  /**
961
- * Get on-chain metadata
961
+ * Get onchain metadata
962
962
  */
963
963
  getMetadata(agentId: bigint, key: string): Promise<string>;
964
964
  /**
@@ -1069,20 +1069,24 @@ declare function rateToBps(rate: number): bigint;
1069
1069
  * Contract ABIs (minimal for SDK)
1070
1070
  *
1071
1071
  * Architecture (v2 — Safe + Safe7579):
1072
- * - SafeAgentFactory (deploys Safe proxies with modules)
1073
- * - ERC8004ValidationModule (ownership + KYA + module lock)
1074
- * - HookMultiplexer (admin-managed hooks)
1075
- * - AgentReputation (oracle-based credit scores)
1072
+ * - Agether4337Factory (deploys Safe proxies with modules)
1073
+ * - Agether8004ValidationModule (ownership + KYA + module lock)
1074
+ * - AgetherHookMultiplexer (admin-managed hooks)
1075
+ * - Agether8004Scorer (oracle-based credit scores)
1076
1076
  * - ValidationRegistry (KYA code validation)
1077
1077
  * - ERC-8004 IdentityRegistry
1078
1078
  * - Morpho Blue (direct overcollateralized lending)
1079
1079
  * - EntryPoint v0.7 (ERC-4337 UserOp submission)
1080
1080
  */
1081
1081
  declare const IDENTITY_REGISTRY_ABI: string[];
1082
+ declare const AGETHER_4337_FACTORY_ABI: string[];
1082
1083
  declare const SAFE_AGENT_FACTORY_ABI: string[];
1083
1084
  declare const ACCOUNT_FACTORY_ABI: string[];
1085
+ declare const AGETHER_8004_VALIDATION_MODULE_ABI: string[];
1084
1086
  declare const ERC8004_VALIDATION_MODULE_ABI: string[];
1087
+ declare const AGETHER_HOOK_MULTIPLEXER_ABI: string[];
1085
1088
  declare const HOOK_MULTIPLEXER_ABI: string[];
1089
+ declare const AGETHER_8004_SCORER_ABI: string[];
1086
1090
  declare const AGENT_REPUTATION_ABI: string[];
1087
1091
  declare const VALIDATION_REGISTRY_ABI: string[];
1088
1092
  declare const MORPHO_BLUE_ABI: string[];
@@ -1094,10 +1098,10 @@ declare const SAFE7579_ACCOUNT_ABI: string[];
1094
1098
  * Network configurations
1095
1099
  *
1096
1100
  * Contract architecture (v2 — Safe + Safe7579):
1097
- * - SafeAgentFactory + Safe proxy (4337-only smart wallets)
1098
- * - ERC8004ValidationModule (ownership + KYA + module lock)
1099
- * - HookMultiplexer (admin-managed hooks)
1100
- * - AgentReputation (oracle-based scoring)
1101
+ * - Agether4337Factory + Safe proxy (4337-only smart wallets)
1102
+ * - Agether8004ValidationModule (ownership + KYA + module lock)
1103
+ * - AgetherHookMultiplexer (admin-managed hooks)
1104
+ * - Agether8004Scorer (oracle-based scoring)
1101
1105
  * - ValidationRegistry (KYA code validation)
1102
1106
  * - ERC-8004 IdentityRegistry
1103
1107
  * - Morpho Blue (direct overcollateralized lending)
@@ -1114,4 +1118,4 @@ declare function getDefaultConfig(chainId: ChainId): AgetherConfig;
1114
1118
  */
1115
1119
  declare function createConfig(chainId: ChainId, options?: Partial<AgetherConfig>): AgetherConfig;
1116
1120
 
1117
- export { ACCOUNT_FACTORY_ABI, AGENT_REPUTATION_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 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 TransactionResult, VALIDATION_REGISTRY_ABI, type WithdrawResult, X402Client, type X402Config, type X402PaymentRequest, type X402PaymentResult, type X402Response, bpsToRate, createConfig, formatAPR, formatAddress, formatHealthFactor, formatPercent, formatTimestamp, formatUSD, formatUnits, getDefaultConfig, parseUnits, rateToBps };
1121
+ 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 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 TransactionResult, VALIDATION_REGISTRY_ABI, type WithdrawResult, X402Client, type X402Config, type X402PaymentRequest, type X402PaymentResult, type X402Response, bpsToRate, createConfig, formatAPR, formatAddress, formatHealthFactor, formatPercent, formatTimestamp, formatUSD, formatUnits, getDefaultConfig, parseUnits, rateToBps };
package/dist/index.js CHANGED
@@ -32,6 +32,10 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  ACCOUNT_FACTORY_ABI: () => ACCOUNT_FACTORY_ABI,
34
34
  AGENT_REPUTATION_ABI: () => AGENT_REPUTATION_ABI,
35
+ AGETHER_4337_FACTORY_ABI: () => AGETHER_4337_FACTORY_ABI,
36
+ AGETHER_8004_SCORER_ABI: () => AGETHER_8004_SCORER_ABI,
37
+ AGETHER_8004_VALIDATION_MODULE_ABI: () => AGETHER_8004_VALIDATION_MODULE_ABI,
38
+ AGETHER_HOOK_MULTIPLEXER_ABI: () => AGETHER_HOOK_MULTIPLEXER_ABI,
35
39
  AgentIdentityClient: () => AgentIdentityClient,
36
40
  AgentNotApprovedError: () => AgentNotApprovedError,
37
41
  AgetherClient: () => AgetherClient,
@@ -123,7 +127,7 @@ var IDENTITY_REGISTRY_ABI = [
123
127
  "function register() returns (uint256 agentId)",
124
128
  "event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"
125
129
  ];
126
- var SAFE_AGENT_FACTORY_ABI = [
130
+ var AGETHER_4337_FACTORY_ABI = [
127
131
  "function getAccount(uint256 agentId) view returns (address)",
128
132
  "function accountExists(uint256 agentId) view returns (bool)",
129
133
  "function totalAccounts() view returns (uint256)",
@@ -137,11 +141,11 @@ var SAFE_AGENT_FACTORY_ABI = [
137
141
  "function safeSingleton() view returns (address)",
138
142
  "function safe7579() view returns (address)",
139
143
  "function bootstrap() view returns (address)",
140
- "function SENTINEL_OWNER() view returns (address)",
141
144
  "event AccountCreated(uint256 indexed agentId, address indexed safeAccount, address indexed owner)"
142
145
  ];
143
- var ACCOUNT_FACTORY_ABI = SAFE_AGENT_FACTORY_ABI;
144
- var ERC8004_VALIDATION_MODULE_ABI = [
146
+ var SAFE_AGENT_FACTORY_ABI = AGETHER_4337_FACTORY_ABI;
147
+ var ACCOUNT_FACTORY_ABI = AGETHER_4337_FACTORY_ABI;
148
+ var AGETHER_8004_VALIDATION_MODULE_ABI = [
145
149
  // View
146
150
  "function getConfig(address account) view returns (address registry, uint256 agentId)",
147
151
  "function getOwner(address account) view returns (address)",
@@ -152,14 +156,16 @@ var ERC8004_VALIDATION_MODULE_ABI = [
152
156
  // Admin (via TimelockController)
153
157
  "function setValidationRegistry(address registry_)"
154
158
  ];
155
- var HOOK_MULTIPLEXER_ABI = [
159
+ var ERC8004_VALIDATION_MODULE_ABI = AGETHER_8004_VALIDATION_MODULE_ABI;
160
+ var AGETHER_HOOK_MULTIPLEXER_ABI = [
156
161
  "function getHooks() view returns (address[])",
157
162
  "function hookCount() view returns (uint256)",
158
163
  "function owner() view returns (address)",
159
164
  "function addHook(address hook)",
160
165
  "function removeHook(address hook)"
161
166
  ];
162
- var AGENT_REPUTATION_ABI = [
167
+ var HOOK_MULTIPLEXER_ABI = AGETHER_HOOK_MULTIPLEXER_ABI;
168
+ var AGETHER_8004_SCORER_ABI = [
163
169
  "function getCreditScore(uint256 agentId) view returns (uint256)",
164
170
  "function getAttestation(uint256 agentId) view returns (tuple(uint256 score, uint256 timestamp, address signer))",
165
171
  "function isScoreFresh(uint256 agentId) view returns (bool fresh, uint256 age)",
@@ -169,6 +175,7 @@ var AGENT_REPUTATION_ABI = [
169
175
  "function setOracleSigner(address signer_)",
170
176
  "event ScoreUpdated(uint256 indexed agentId, uint256 score, uint256 timestamp, address signer)"
171
177
  ];
178
+ var AGENT_REPUTATION_ABI = AGETHER_8004_SCORER_ABI;
172
179
  var VALIDATION_REGISTRY_ABI = [
173
180
  "function isAgentCodeApproved(uint256 agentId) view returns (bool)",
174
181
  "function isAgentCodeApprovedForTag(uint256 agentId, string tag) view returns (bool)",
@@ -236,12 +243,12 @@ var CONTRACT_ADDRESSES = {
236
243
  safeProxyFactory: SAFE_PROXY_FACTORY,
237
244
  safe7579: SAFE7579,
238
245
  entryPoint: ENTRYPOINT_V07,
239
- safeAgentFactory: ZERO,
240
- safe7579Bootstrap: ZERO,
246
+ agether4337Factory: ZERO,
247
+ agether7579Bootstrap: ZERO,
241
248
  erc8004ValidationModule: ZERO,
242
- hookMultiplexer: ZERO,
249
+ agetherHookMultiplexer: ZERO,
243
250
  validationRegistry: ZERO,
244
- agentReputation: ZERO,
251
+ agether8004Scorer: ZERO,
245
252
  timelockController: ZERO,
246
253
  usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
247
254
  identityRegistry: ERC8004_IDENTITY_REGISTRY,
@@ -252,13 +259,13 @@ var CONTRACT_ADDRESSES = {
252
259
  safeProxyFactory: SAFE_PROXY_FACTORY,
253
260
  safe7579: SAFE7579,
254
261
  entryPoint: ENTRYPOINT_V07,
255
- safeAgentFactory: "0xB0A88ffe28491E793F7706829278f20d724947d1",
256
- safe7579Bootstrap: "0x72A636bc23B2644138489c3bBE3B05a0a7184b33",
257
- erc8004ValidationModule: "0x49e27A6B4d012B87271897b51d0296ABcFCb0BBd",
258
- hookMultiplexer: "0x12c77f17F91f06a11C2C34C618ce9d78f9a34541",
259
- validationRegistry: "0x88E21e8883c093E4c8d0d0cE68f1c93Cf6190f51",
260
- agentReputation: "0x4C2d42cbD35f6541f0902499CFEC27C1Cf5683E3",
261
- timelockController: "0x0517b4f73b61774C88A2B1c5745141315E831015",
262
+ agether4337Factory: "0x67DE66D07ff3dba0092C21f070f8a0f53D657BC3",
263
+ agether7579Bootstrap: "0xCc83AA714c05B7141B21a17e80EB21bD09652b27",
264
+ erc8004ValidationModule: "0xde896C58163b5f6cAC5B16C1b0109843f26106F6",
265
+ agetherHookMultiplexer: "0x4AB6DaD0f7360fa8d8c75889A5c206B65d7CbeDb",
266
+ validationRegistry: ZERO,
267
+ agether8004Scorer: "0x56c7D35A976fac67b1993b66b861fCA32f59104F",
268
+ timelockController: "0xc600e7AAB8a230326C714CE66f356fdf6aC021d8",
262
269
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
263
270
  identityRegistry: ERC8004_IDENTITY_REGISTRY,
264
271
  morphoBlue: MORPHO_BLUE
@@ -268,12 +275,12 @@ var CONTRACT_ADDRESSES = {
268
275
  safeProxyFactory: SAFE_PROXY_FACTORY,
269
276
  safe7579: SAFE7579,
270
277
  entryPoint: ENTRYPOINT_V07,
271
- safeAgentFactory: ZERO,
272
- safe7579Bootstrap: ZERO,
278
+ agether4337Factory: ZERO,
279
+ agether7579Bootstrap: ZERO,
273
280
  erc8004ValidationModule: ZERO,
274
- hookMultiplexer: ZERO,
281
+ agetherHookMultiplexer: ZERO,
275
282
  validationRegistry: ZERO,
276
- agentReputation: ZERO,
283
+ agether8004Scorer: ZERO,
277
284
  timelockController: ZERO,
278
285
  usdc: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
279
286
  identityRegistry: ERC8004_IDENTITY_REGISTRY_TESTNET,
@@ -284,12 +291,12 @@ var CONTRACT_ADDRESSES = {
284
291
  safeProxyFactory: SAFE_PROXY_FACTORY,
285
292
  safe7579: SAFE7579,
286
293
  entryPoint: ENTRYPOINT_V07,
287
- safeAgentFactory: ZERO,
288
- safe7579Bootstrap: ZERO,
294
+ agether4337Factory: ZERO,
295
+ agether7579Bootstrap: ZERO,
289
296
  erc8004ValidationModule: ZERO,
290
- hookMultiplexer: ZERO,
297
+ agetherHookMultiplexer: ZERO,
291
298
  validationRegistry: ZERO,
292
- agentReputation: ZERO,
299
+ agether8004Scorer: ZERO,
293
300
  timelockController: ZERO,
294
301
  usdc: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
295
302
  identityRegistry: ERC8004_IDENTITY_REGISTRY_TESTNET,
@@ -300,12 +307,12 @@ var CONTRACT_ADDRESSES = {
300
307
  safeProxyFactory: SAFE_PROXY_FACTORY,
301
308
  safe7579: SAFE7579,
302
309
  entryPoint: ENTRYPOINT_V07,
303
- safeAgentFactory: ZERO,
304
- safe7579Bootstrap: ZERO,
310
+ agether4337Factory: ZERO,
311
+ agether7579Bootstrap: ZERO,
305
312
  erc8004ValidationModule: ZERO,
306
- hookMultiplexer: ZERO,
313
+ agetherHookMultiplexer: ZERO,
307
314
  validationRegistry: ZERO,
308
- agentReputation: ZERO,
315
+ agether8004Scorer: ZERO,
309
316
  timelockController: ZERO,
310
317
  usdc: "0x56d4d6aEe0278c5Df2FA23Ecb32eC146C9446FDf",
311
318
  identityRegistry: ERC8004_IDENTITY_REGISTRY,
@@ -354,9 +361,9 @@ var AgetherClient = class _AgetherClient {
354
361
  this.agentId = options.agentId;
355
362
  const provider = options.signer.provider;
356
363
  if (!provider) throw new AgetherError("Signer must have a provider", "NO_PROVIDER");
357
- this.safeAgentFactory = new import_ethers.Contract(
358
- options.config.contracts.safeAgentFactory,
359
- SAFE_AGENT_FACTORY_ABI,
364
+ this.agether4337Factory = new import_ethers.Contract(
365
+ options.config.contracts.agether4337Factory,
366
+ AGETHER_4337_FACTORY_ABI,
360
367
  options.signer
361
368
  );
362
369
  this.identityRegistry = new import_ethers.Contract(
@@ -364,14 +371,14 @@ var AgetherClient = class _AgetherClient {
364
371
  IDENTITY_REGISTRY_ABI,
365
372
  provider
366
373
  );
367
- this.agentReputation = new import_ethers.Contract(
368
- options.config.contracts.agentReputation,
369
- AGENT_REPUTATION_ABI,
374
+ this.agether8004Scorer = new import_ethers.Contract(
375
+ options.config.contracts.agether8004Scorer,
376
+ AGETHER_8004_SCORER_ABI,
370
377
  provider
371
378
  );
372
379
  this.validationModule = new import_ethers.Contract(
373
380
  options.config.contracts.erc8004ValidationModule,
374
- ERC8004_VALIDATION_MODULE_ABI,
381
+ AGETHER_8004_VALIDATION_MODULE_ABI,
375
382
  provider
376
383
  );
377
384
  }
@@ -384,11 +391,11 @@ var AgetherClient = class _AgetherClient {
384
391
  }
385
392
  // Account Management
386
393
  async createAccount() {
387
- const tx = await this.safeAgentFactory.createAccount(this.agentId);
394
+ const tx = await this.agether4337Factory.createAccount(this.agentId);
388
395
  const receipt = await tx.wait();
389
396
  const event = receipt.logs.map((log) => {
390
397
  try {
391
- return this.safeAgentFactory.interface.parseLog(log);
398
+ return this.agether4337Factory.interface.parseLog(log);
392
399
  } catch (e) {
393
400
  console.warn("[agether] createAccount parseLog skip:", e instanceof Error ? e.message : e);
394
401
  return null;
@@ -397,13 +404,13 @@ var AgetherClient = class _AgetherClient {
397
404
  if (event) {
398
405
  this.accountAddress = event.args.safeAccount;
399
406
  } else {
400
- this.accountAddress = await this.safeAgentFactory.getAccount(this.agentId);
407
+ this.accountAddress = await this.agether4337Factory.getAccount(this.agentId);
401
408
  }
402
409
  return this.accountAddress;
403
410
  }
404
411
  async getAccountAddress() {
405
412
  if (this.accountAddress) return this.accountAddress;
406
- const addr = await this.safeAgentFactory.getAccount(this.agentId);
413
+ const addr = await this.agether4337Factory.getAccount(this.agentId);
407
414
  if (addr === import_ethers.ethers.ZeroAddress) {
408
415
  throw new AgetherError("No account found. Create one with createAccount().", "NO_ACCOUNT");
409
416
  }
@@ -411,7 +418,7 @@ var AgetherClient = class _AgetherClient {
411
418
  return addr;
412
419
  }
413
420
  async accountExists() {
414
- return this.safeAgentFactory.accountExists(this.agentId);
421
+ return this.agether4337Factory.accountExists(this.agentId);
415
422
  }
416
423
  // Balances
417
424
  async getBalances() {
@@ -493,14 +500,14 @@ var AgetherClient = class _AgetherClient {
493
500
  }
494
501
  // Reputation
495
502
  async getCreditScore() {
496
- return this.agentReputation.getCreditScore(this.agentId);
503
+ return this.agether8004Scorer.getCreditScore(this.agentId);
497
504
  }
498
505
  async isScoreFresh() {
499
- const [fresh, age] = await this.agentReputation.isScoreFresh(this.agentId);
506
+ const [fresh, age] = await this.agether8004Scorer.isScoreFresh(this.agentId);
500
507
  return { fresh, age };
501
508
  }
502
509
  async isEligible(minScore = 500n) {
503
- const [eligible, currentScore] = await this.agentReputation.isEligible(this.agentId, minScore);
510
+ const [eligible, currentScore] = await this.agether8004Scorer.isEligible(this.agentId, minScore);
504
511
  return { eligible, currentScore };
505
512
  }
506
513
  // Getters
@@ -565,9 +572,9 @@ var MorphoClient = class {
565
572
  this._eoaAddress = wallet.address;
566
573
  }
567
574
  const addrs = { ...defaultCfg.contracts, ...config.contracts };
568
- this.safeAgentFactory = new import_ethers2.Contract(addrs.safeAgentFactory, ACCOUNT_FACTORY_ABI, this._signer);
575
+ this.agether4337Factory = new import_ethers2.Contract(addrs.agether4337Factory, ACCOUNT_FACTORY_ABI, this._signer);
569
576
  this.morphoBlue = new import_ethers2.Contract(addrs.morphoBlue, MORPHO_BLUE_ABI, this.provider);
570
- this.agentReputation = new import_ethers2.Contract(addrs.agentReputation, AGENT_REPUTATION_ABI, this._signer);
577
+ this.agether8004Scorer = new import_ethers2.Contract(addrs.agether8004Scorer, AGENT_REPUTATION_ABI, this._signer);
571
578
  this.identityRegistry = new import_ethers2.Contract(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this._signer);
572
579
  this.entryPoint = new import_ethers2.Contract(addrs.entryPoint, ENTRYPOINT_V07_ABI, this._signer);
573
580
  this.validationModule = new import_ethers2.Contract(addrs.erc8004ValidationModule, ERC8004_VALIDATION_MODULE_ABI, this.provider);
@@ -599,7 +606,7 @@ var MorphoClient = class {
599
606
  let lastErr;
600
607
  for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
601
608
  try {
602
- const addr = await this.safeAgentFactory.getAccount(BigInt(this.agentId));
609
+ const addr = await this.agether4337Factory.getAccount(BigInt(this.agentId));
603
610
  if (addr === import_ethers2.ethers.ZeroAddress) {
604
611
  throw new AgetherError("No AgentAccount found. Call register() first.", "NO_ACCOUNT");
605
612
  }
@@ -677,9 +684,9 @@ var MorphoClient = class {
677
684
  async register(_name) {
678
685
  const eoaAddr = await this.getSignerAddress();
679
686
  if (this.agentId) {
680
- const exists = await this.safeAgentFactory.accountExists(BigInt(this.agentId));
687
+ const exists = await this.agether4337Factory.accountExists(BigInt(this.agentId));
681
688
  if (exists) {
682
- const acct = await this.safeAgentFactory.getAccount(BigInt(this.agentId));
689
+ const acct = await this.agether4337Factory.getAccount(BigInt(this.agentId));
683
690
  this._accountAddress = acct;
684
691
  const kyaRequired2 = await this.isKyaRequired();
685
692
  return { agentId: this.agentId, address: eoaAddr, agentAccount: acct, alreadyRegistered: true, kyaRequired: kyaRequired2 };
@@ -697,15 +704,15 @@ var MorphoClient = class {
697
704
  agentId = await this._mintNewIdentity();
698
705
  }
699
706
  this.agentId = agentId.toString();
700
- const acctExists = await this.safeAgentFactory.accountExists(agentId);
707
+ const acctExists = await this.agether4337Factory.accountExists(agentId);
701
708
  let txHash;
702
709
  if (!acctExists) {
703
- const tx = await this.safeAgentFactory.createAccount(agentId);
710
+ const tx = await this.agether4337Factory.createAccount(agentId);
704
711
  const receipt = await tx.wait();
705
712
  this._refreshSigner();
706
713
  txHash = receipt.hash;
707
714
  }
708
- const acctAddr = await this.safeAgentFactory.getAccount(agentId);
715
+ const acctAddr = await this.agether4337Factory.getAccount(agentId);
709
716
  this._accountAddress = acctAddr;
710
717
  const kyaRequired = await this.isKyaRequired();
711
718
  return {
@@ -849,7 +856,7 @@ var MorphoClient = class {
849
856
  }
850
857
  /**
851
858
  * Get MarketParams for a collateral token.
852
- * Tries cache → API → on-chain idToMarketParams.
859
+ * Tries cache → API → onchain idToMarketParams.
853
860
  */
854
861
  async findMarketForCollateral(collateralSymbolOrAddress) {
855
862
  const colInfo = BASE_COLLATERALS[collateralSymbolOrAddress];
@@ -864,7 +871,7 @@ var MorphoClient = class {
864
871
  "MARKET_NOT_FOUND"
865
872
  );
866
873
  }
867
- /** Read MarketParams on-chain by market ID (bytes32). */
874
+ /** Read MarketParams onchain by market ID (bytes32). */
868
875
  async getMarketParams(marketId) {
869
876
  const result = await this.morphoBlue.idToMarketParams(marketId);
870
877
  return {
@@ -878,7 +885,7 @@ var MorphoClient = class {
878
885
  // ════════════════════════════════════════════════════════
879
886
  // Position Reads
880
887
  // ════════════════════════════════════════════════════════
881
- /** Read on-chain position for a specific market. */
888
+ /** Read onchain position for a specific market. */
882
889
  async getPosition(marketId) {
883
890
  const acctAddr = await this.getAccountAddress();
884
891
  const pos = await this.morphoBlue.position(marketId, acctAddr);
@@ -1432,7 +1439,7 @@ var MorphoClient = class {
1432
1439
  if (target.address) {
1433
1440
  targetAddr = target.address;
1434
1441
  } else if (target.agentId) {
1435
- targetAddr = await this.safeAgentFactory.getAccount(BigInt(target.agentId));
1442
+ targetAddr = await this.agether4337Factory.getAccount(BigInt(target.agentId));
1436
1443
  if (targetAddr === import_ethers2.ethers.ZeroAddress) throw new AgetherError("Target agent has no account", "NO_ACCOUNT");
1437
1444
  } else {
1438
1445
  throw new AgetherError("Provide agentId or address", "INVALID_TARGET");
@@ -1445,25 +1452,25 @@ var MorphoClient = class {
1445
1452
  return { tx: receipt.hash, targetAccount: targetAddr, targetAgentId: target.agentId };
1446
1453
  }
1447
1454
  // ════════════════════════════════════════════════════════
1448
- // Reputation (AgentReputation contract)
1455
+ // Reputation (Agether8004Scorer contract)
1449
1456
  // ════════════════════════════════════════════════════════
1450
1457
  async getCreditScore() {
1451
1458
  if (!this.agentId) throw new AgetherError("agentId not set", "NO_AGENT_ID");
1452
- return this.agentReputation.getCreditScore(BigInt(this.agentId));
1459
+ return this.agether8004Scorer.getCreditScore(BigInt(this.agentId));
1453
1460
  }
1454
1461
  async getAttestation() {
1455
1462
  if (!this.agentId) throw new AgetherError("agentId not set", "NO_AGENT_ID");
1456
- const att = await this.agentReputation.getAttestation(BigInt(this.agentId));
1463
+ const att = await this.agether8004Scorer.getAttestation(BigInt(this.agentId));
1457
1464
  return { score: att.score, timestamp: att.timestamp, signer: att.signer };
1458
1465
  }
1459
1466
  async isEligible(minScore = 500n) {
1460
1467
  if (!this.agentId) throw new AgetherError("agentId not set", "NO_AGENT_ID");
1461
- const [eligible, currentScore] = await this.agentReputation.isEligible(BigInt(this.agentId), minScore);
1468
+ const [eligible, currentScore] = await this.agether8004Scorer.isEligible(BigInt(this.agentId), minScore);
1462
1469
  return { eligible, currentScore };
1463
1470
  }
1464
1471
  async isScoreFresh() {
1465
1472
  if (!this.agentId) throw new AgetherError("agentId not set", "NO_AGENT_ID");
1466
- const [fresh, age] = await this.agentReputation.isScoreFresh(BigInt(this.agentId));
1473
+ const [fresh, age] = await this.agether8004Scorer.isScoreFresh(BigInt(this.agentId));
1467
1474
  return { fresh, age };
1468
1475
  }
1469
1476
  // ════════════════════════════════════════════════════════
@@ -1485,10 +1492,10 @@ var MorphoClient = class {
1485
1492
  _refreshSigner() {
1486
1493
  if (this._useExternalSigner) {
1487
1494
  const addrs = this.config.contracts;
1488
- this.safeAgentFactory = new import_ethers2.Contract(addrs.safeAgentFactory, ACCOUNT_FACTORY_ABI, this._signer);
1495
+ this.agether4337Factory = new import_ethers2.Contract(addrs.agether4337Factory, ACCOUNT_FACTORY_ABI, this._signer);
1489
1496
  this.entryPoint = new import_ethers2.Contract(addrs.entryPoint, ENTRYPOINT_V07_ABI, this._signer);
1490
1497
  this.validationModule = new import_ethers2.Contract(addrs.erc8004ValidationModule, ERC8004_VALIDATION_MODULE_ABI, this.provider);
1491
- this.agentReputation = new import_ethers2.Contract(addrs.agentReputation, AGENT_REPUTATION_ABI, this._signer);
1498
+ this.agether8004Scorer = new import_ethers2.Contract(addrs.agether8004Scorer, AGENT_REPUTATION_ABI, this._signer);
1492
1499
  this.identityRegistry = new import_ethers2.Contract(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this._signer);
1493
1500
  } else {
1494
1501
  this.provider = new import_ethers2.ethers.JsonRpcProvider(this._rpcUrl);
@@ -1496,10 +1503,10 @@ var MorphoClient = class {
1496
1503
  this._signer = wallet;
1497
1504
  this._eoaAddress = wallet.address;
1498
1505
  const addrs = this.config.contracts;
1499
- this.safeAgentFactory = new import_ethers2.Contract(addrs.safeAgentFactory, ACCOUNT_FACTORY_ABI, this._signer);
1506
+ this.agether4337Factory = new import_ethers2.Contract(addrs.agether4337Factory, ACCOUNT_FACTORY_ABI, this._signer);
1500
1507
  this.entryPoint = new import_ethers2.Contract(addrs.entryPoint, ENTRYPOINT_V07_ABI, this._signer);
1501
1508
  this.validationModule = new import_ethers2.Contract(addrs.erc8004ValidationModule, ERC8004_VALIDATION_MODULE_ABI, this.provider);
1502
- this.agentReputation = new import_ethers2.Contract(addrs.agentReputation, AGENT_REPUTATION_ABI, this._signer);
1509
+ this.agether8004Scorer = new import_ethers2.Contract(addrs.agether8004Scorer, AGENT_REPUTATION_ABI, this._signer);
1503
1510
  this.identityRegistry = new import_ethers2.Contract(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this._signer);
1504
1511
  }
1505
1512
  }
@@ -1943,14 +1950,14 @@ var ScoringClient = class {
1943
1950
  }
1944
1951
  }
1945
1952
  // ════════════════════════════════════════════════════════
1946
- // Score (x402-gated — computes & submits on-chain)
1953
+ // Score (x402-gated — computes & submits onchain)
1947
1954
  // ════════════════════════════════════════════════════════
1948
1955
  /**
1949
1956
  * Request a fresh score computation.
1950
1957
  *
1951
1958
  * This is x402-gated: the backend returns 402, the X402Client
1952
1959
  * signs an EIP-3009 payment, and the backend computes + submits
1953
- * the score on-chain via AgentReputation.submitScore().
1960
+ * the score onchain via AgentReputation.submitScore().
1954
1961
  *
1955
1962
  * Returns the ScoreResult with breakdown and txHash.
1956
1963
  */
@@ -1974,10 +1981,10 @@ var ScoringClient = class {
1974
1981
  return result.data;
1975
1982
  }
1976
1983
  // ════════════════════════════════════════════════════════
1977
- // Current Score (free — reads on-chain)
1984
+ // Current Score (free — reads onchain)
1978
1985
  // ════════════════════════════════════════════════════════
1979
1986
  /**
1980
- * Get the current on-chain score (free, no payment required).
1987
+ * Get the current onchain score (free, no payment required).
1981
1988
  */
1982
1989
  async getCurrentScore(agentId) {
1983
1990
  const response = await this.client.get(`/score/${agentId.toString()}/current`);
@@ -2126,7 +2133,7 @@ var AgentIdentityClient = class {
2126
2133
  return { ...result, existing: false };
2127
2134
  }
2128
2135
  /**
2129
- * Register agent with URI and on-chain metadata
2136
+ * Register agent with URI and onchain metadata
2130
2137
  */
2131
2138
  async registerWithMetadata(agentURI, metadata) {
2132
2139
  const metadataEntries = metadata.map((m) => ({
@@ -2162,7 +2169,7 @@ var AgentIdentityClient = class {
2162
2169
  return receipt.hash;
2163
2170
  }
2164
2171
  /**
2165
- * Set on-chain metadata (key-value)
2172
+ * Set onchain metadata (key-value)
2166
2173
  */
2167
2174
  async setMetadata(agentId, key, value) {
2168
2175
  const tx = await this.identityRegistry.setMetadata(
@@ -2174,7 +2181,7 @@ var AgentIdentityClient = class {
2174
2181
  return receipt.hash;
2175
2182
  }
2176
2183
  /**
2177
- * Get on-chain metadata
2184
+ * Get onchain metadata
2178
2185
  */
2179
2186
  async getMetadata(agentId, key) {
2180
2187
  const value = await this.identityRegistry.getMetadata(agentId, key);
@@ -2404,6 +2411,10 @@ function rateToBps(rate) {
2404
2411
  0 && (module.exports = {
2405
2412
  ACCOUNT_FACTORY_ABI,
2406
2413
  AGENT_REPUTATION_ABI,
2414
+ AGETHER_4337_FACTORY_ABI,
2415
+ AGETHER_8004_SCORER_ABI,
2416
+ AGETHER_8004_VALIDATION_MODULE_ABI,
2417
+ AGETHER_HOOK_MULTIPLEXER_ABI,
2407
2418
  AgentIdentityClient,
2408
2419
  AgentNotApprovedError,
2409
2420
  AgetherClient,