@agether/sdk 2.0.0 → 2.1.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/README.md +1 -1
- package/dist/cli.js +56 -55
- package/dist/index.d.mts +40 -36
- package/dist/index.d.ts +40 -36
- package/dist/index.js +83 -72
- package/dist/index.mjs +79 -72
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -55,7 +55,7 @@ var IDENTITY_REGISTRY_ABI = [
|
|
|
55
55
|
"function register() returns (uint256 agentId)",
|
|
56
56
|
"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"
|
|
57
57
|
];
|
|
58
|
-
var
|
|
58
|
+
var AGETHER_4337_FACTORY_ABI = [
|
|
59
59
|
"function getAccount(uint256 agentId) view returns (address)",
|
|
60
60
|
"function accountExists(uint256 agentId) view returns (bool)",
|
|
61
61
|
"function totalAccounts() view returns (uint256)",
|
|
@@ -69,11 +69,11 @@ var SAFE_AGENT_FACTORY_ABI = [
|
|
|
69
69
|
"function safeSingleton() view returns (address)",
|
|
70
70
|
"function safe7579() view returns (address)",
|
|
71
71
|
"function bootstrap() view returns (address)",
|
|
72
|
-
"function SENTINEL_OWNER() view returns (address)",
|
|
73
72
|
"event AccountCreated(uint256 indexed agentId, address indexed safeAccount, address indexed owner)"
|
|
74
73
|
];
|
|
75
|
-
var
|
|
76
|
-
var
|
|
74
|
+
var SAFE_AGENT_FACTORY_ABI = AGETHER_4337_FACTORY_ABI;
|
|
75
|
+
var ACCOUNT_FACTORY_ABI = AGETHER_4337_FACTORY_ABI;
|
|
76
|
+
var AGETHER_8004_VALIDATION_MODULE_ABI = [
|
|
77
77
|
// View
|
|
78
78
|
"function getConfig(address account) view returns (address registry, uint256 agentId)",
|
|
79
79
|
"function getOwner(address account) view returns (address)",
|
|
@@ -84,14 +84,16 @@ var ERC8004_VALIDATION_MODULE_ABI = [
|
|
|
84
84
|
// Admin (via TimelockController)
|
|
85
85
|
"function setValidationRegistry(address registry_)"
|
|
86
86
|
];
|
|
87
|
-
var
|
|
87
|
+
var ERC8004_VALIDATION_MODULE_ABI = AGETHER_8004_VALIDATION_MODULE_ABI;
|
|
88
|
+
var AGETHER_HOOK_MULTIPLEXER_ABI = [
|
|
88
89
|
"function getHooks() view returns (address[])",
|
|
89
90
|
"function hookCount() view returns (uint256)",
|
|
90
91
|
"function owner() view returns (address)",
|
|
91
92
|
"function addHook(address hook)",
|
|
92
93
|
"function removeHook(address hook)"
|
|
93
94
|
];
|
|
94
|
-
var
|
|
95
|
+
var HOOK_MULTIPLEXER_ABI = AGETHER_HOOK_MULTIPLEXER_ABI;
|
|
96
|
+
var AGETHER_8004_SCORER_ABI = [
|
|
95
97
|
"function getCreditScore(uint256 agentId) view returns (uint256)",
|
|
96
98
|
"function getAttestation(uint256 agentId) view returns (tuple(uint256 score, uint256 timestamp, address signer))",
|
|
97
99
|
"function isScoreFresh(uint256 agentId) view returns (bool fresh, uint256 age)",
|
|
@@ -101,6 +103,7 @@ var AGENT_REPUTATION_ABI = [
|
|
|
101
103
|
"function setOracleSigner(address signer_)",
|
|
102
104
|
"event ScoreUpdated(uint256 indexed agentId, uint256 score, uint256 timestamp, address signer)"
|
|
103
105
|
];
|
|
106
|
+
var AGENT_REPUTATION_ABI = AGETHER_8004_SCORER_ABI;
|
|
104
107
|
var VALIDATION_REGISTRY_ABI = [
|
|
105
108
|
"function isAgentCodeApproved(uint256 agentId) view returns (bool)",
|
|
106
109
|
"function isAgentCodeApprovedForTag(uint256 agentId, string tag) view returns (bool)",
|
|
@@ -168,12 +171,12 @@ var CONTRACT_ADDRESSES = {
|
|
|
168
171
|
safeProxyFactory: SAFE_PROXY_FACTORY,
|
|
169
172
|
safe7579: SAFE7579,
|
|
170
173
|
entryPoint: ENTRYPOINT_V07,
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
agether4337Factory: ZERO,
|
|
175
|
+
agether7579Bootstrap: ZERO,
|
|
173
176
|
erc8004ValidationModule: ZERO,
|
|
174
|
-
|
|
177
|
+
agetherHookMultiplexer: ZERO,
|
|
175
178
|
validationRegistry: ZERO,
|
|
176
|
-
|
|
179
|
+
agether8004Scorer: ZERO,
|
|
177
180
|
timelockController: ZERO,
|
|
178
181
|
usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
179
182
|
identityRegistry: ERC8004_IDENTITY_REGISTRY,
|
|
@@ -184,13 +187,13 @@ var CONTRACT_ADDRESSES = {
|
|
|
184
187
|
safeProxyFactory: SAFE_PROXY_FACTORY,
|
|
185
188
|
safe7579: SAFE7579,
|
|
186
189
|
entryPoint: ENTRYPOINT_V07,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
erc8004ValidationModule: "
|
|
190
|
-
|
|
191
|
-
validationRegistry:
|
|
192
|
-
|
|
193
|
-
timelockController: "
|
|
190
|
+
agether4337Factory: "0x7B23470dCD65b8fEA3Bf49466860b3A55D56268C",
|
|
191
|
+
agether7579Bootstrap: "0x62d34D22D379367EEDcb7D1E4dE899A654E982D0",
|
|
192
|
+
erc8004ValidationModule: "0xfC6ccFd12e163460C7Ef92d38DC0be6C6cA10f6C",
|
|
193
|
+
agetherHookMultiplexer: "0x094FE93a8b733a97a6945530cA83058CaCbf5278",
|
|
194
|
+
validationRegistry: ZERO,
|
|
195
|
+
agether8004Scorer: "0x9f0084E5c941365149c8953133cF062E33a19b8d",
|
|
196
|
+
timelockController: "0x2807912DA2a7278AF883a376bE15bBBf3ab99f52",
|
|
194
197
|
usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
195
198
|
identityRegistry: ERC8004_IDENTITY_REGISTRY,
|
|
196
199
|
morphoBlue: MORPHO_BLUE
|
|
@@ -200,12 +203,12 @@ var CONTRACT_ADDRESSES = {
|
|
|
200
203
|
safeProxyFactory: SAFE_PROXY_FACTORY,
|
|
201
204
|
safe7579: SAFE7579,
|
|
202
205
|
entryPoint: ENTRYPOINT_V07,
|
|
203
|
-
|
|
204
|
-
|
|
206
|
+
agether4337Factory: ZERO,
|
|
207
|
+
agether7579Bootstrap: ZERO,
|
|
205
208
|
erc8004ValidationModule: ZERO,
|
|
206
|
-
|
|
209
|
+
agetherHookMultiplexer: ZERO,
|
|
207
210
|
validationRegistry: ZERO,
|
|
208
|
-
|
|
211
|
+
agether8004Scorer: ZERO,
|
|
209
212
|
timelockController: ZERO,
|
|
210
213
|
usdc: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
211
214
|
identityRegistry: ERC8004_IDENTITY_REGISTRY_TESTNET,
|
|
@@ -216,12 +219,12 @@ var CONTRACT_ADDRESSES = {
|
|
|
216
219
|
safeProxyFactory: SAFE_PROXY_FACTORY,
|
|
217
220
|
safe7579: SAFE7579,
|
|
218
221
|
entryPoint: ENTRYPOINT_V07,
|
|
219
|
-
|
|
220
|
-
|
|
222
|
+
agether4337Factory: ZERO,
|
|
223
|
+
agether7579Bootstrap: ZERO,
|
|
221
224
|
erc8004ValidationModule: ZERO,
|
|
222
|
-
|
|
225
|
+
agetherHookMultiplexer: ZERO,
|
|
223
226
|
validationRegistry: ZERO,
|
|
224
|
-
|
|
227
|
+
agether8004Scorer: ZERO,
|
|
225
228
|
timelockController: ZERO,
|
|
226
229
|
usdc: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
|
|
227
230
|
identityRegistry: ERC8004_IDENTITY_REGISTRY_TESTNET,
|
|
@@ -232,12 +235,12 @@ var CONTRACT_ADDRESSES = {
|
|
|
232
235
|
safeProxyFactory: SAFE_PROXY_FACTORY,
|
|
233
236
|
safe7579: SAFE7579,
|
|
234
237
|
entryPoint: ENTRYPOINT_V07,
|
|
235
|
-
|
|
236
|
-
|
|
238
|
+
agether4337Factory: ZERO,
|
|
239
|
+
agether7579Bootstrap: ZERO,
|
|
237
240
|
erc8004ValidationModule: ZERO,
|
|
238
|
-
|
|
241
|
+
agetherHookMultiplexer: ZERO,
|
|
239
242
|
validationRegistry: ZERO,
|
|
240
|
-
|
|
243
|
+
agether8004Scorer: ZERO,
|
|
241
244
|
timelockController: ZERO,
|
|
242
245
|
usdc: "0x56d4d6aEe0278c5Df2FA23Ecb32eC146C9446FDf",
|
|
243
246
|
identityRegistry: ERC8004_IDENTITY_REGISTRY,
|
|
@@ -286,9 +289,9 @@ var AgetherClient = class _AgetherClient {
|
|
|
286
289
|
this.agentId = options.agentId;
|
|
287
290
|
const provider = options.signer.provider;
|
|
288
291
|
if (!provider) throw new AgetherError("Signer must have a provider", "NO_PROVIDER");
|
|
289
|
-
this.
|
|
290
|
-
options.config.contracts.
|
|
291
|
-
|
|
292
|
+
this.agether4337Factory = new Contract(
|
|
293
|
+
options.config.contracts.agether4337Factory,
|
|
294
|
+
AGETHER_4337_FACTORY_ABI,
|
|
292
295
|
options.signer
|
|
293
296
|
);
|
|
294
297
|
this.identityRegistry = new Contract(
|
|
@@ -296,14 +299,14 @@ var AgetherClient = class _AgetherClient {
|
|
|
296
299
|
IDENTITY_REGISTRY_ABI,
|
|
297
300
|
provider
|
|
298
301
|
);
|
|
299
|
-
this.
|
|
300
|
-
options.config.contracts.
|
|
301
|
-
|
|
302
|
+
this.agether8004Scorer = new Contract(
|
|
303
|
+
options.config.contracts.agether8004Scorer,
|
|
304
|
+
AGETHER_8004_SCORER_ABI,
|
|
302
305
|
provider
|
|
303
306
|
);
|
|
304
307
|
this.validationModule = new Contract(
|
|
305
308
|
options.config.contracts.erc8004ValidationModule,
|
|
306
|
-
|
|
309
|
+
AGETHER_8004_VALIDATION_MODULE_ABI,
|
|
307
310
|
provider
|
|
308
311
|
);
|
|
309
312
|
}
|
|
@@ -316,11 +319,11 @@ var AgetherClient = class _AgetherClient {
|
|
|
316
319
|
}
|
|
317
320
|
// Account Management
|
|
318
321
|
async createAccount() {
|
|
319
|
-
const tx = await this.
|
|
322
|
+
const tx = await this.agether4337Factory.createAccount(this.agentId);
|
|
320
323
|
const receipt = await tx.wait();
|
|
321
324
|
const event = receipt.logs.map((log) => {
|
|
322
325
|
try {
|
|
323
|
-
return this.
|
|
326
|
+
return this.agether4337Factory.interface.parseLog(log);
|
|
324
327
|
} catch (e) {
|
|
325
328
|
console.warn("[agether] createAccount parseLog skip:", e instanceof Error ? e.message : e);
|
|
326
329
|
return null;
|
|
@@ -329,13 +332,13 @@ var AgetherClient = class _AgetherClient {
|
|
|
329
332
|
if (event) {
|
|
330
333
|
this.accountAddress = event.args.safeAccount;
|
|
331
334
|
} else {
|
|
332
|
-
this.accountAddress = await this.
|
|
335
|
+
this.accountAddress = await this.agether4337Factory.getAccount(this.agentId);
|
|
333
336
|
}
|
|
334
337
|
return this.accountAddress;
|
|
335
338
|
}
|
|
336
339
|
async getAccountAddress() {
|
|
337
340
|
if (this.accountAddress) return this.accountAddress;
|
|
338
|
-
const addr = await this.
|
|
341
|
+
const addr = await this.agether4337Factory.getAccount(this.agentId);
|
|
339
342
|
if (addr === ethers.ZeroAddress) {
|
|
340
343
|
throw new AgetherError("No account found. Create one with createAccount().", "NO_ACCOUNT");
|
|
341
344
|
}
|
|
@@ -343,7 +346,7 @@ var AgetherClient = class _AgetherClient {
|
|
|
343
346
|
return addr;
|
|
344
347
|
}
|
|
345
348
|
async accountExists() {
|
|
346
|
-
return this.
|
|
349
|
+
return this.agether4337Factory.accountExists(this.agentId);
|
|
347
350
|
}
|
|
348
351
|
// Balances
|
|
349
352
|
async getBalances() {
|
|
@@ -425,14 +428,14 @@ var AgetherClient = class _AgetherClient {
|
|
|
425
428
|
}
|
|
426
429
|
// Reputation
|
|
427
430
|
async getCreditScore() {
|
|
428
|
-
return this.
|
|
431
|
+
return this.agether8004Scorer.getCreditScore(this.agentId);
|
|
429
432
|
}
|
|
430
433
|
async isScoreFresh() {
|
|
431
|
-
const [fresh, age] = await this.
|
|
434
|
+
const [fresh, age] = await this.agether8004Scorer.isScoreFresh(this.agentId);
|
|
432
435
|
return { fresh, age };
|
|
433
436
|
}
|
|
434
437
|
async isEligible(minScore = 500n) {
|
|
435
|
-
const [eligible, currentScore] = await this.
|
|
438
|
+
const [eligible, currentScore] = await this.agether8004Scorer.isEligible(this.agentId, minScore);
|
|
436
439
|
return { eligible, currentScore };
|
|
437
440
|
}
|
|
438
441
|
// Getters
|
|
@@ -497,9 +500,9 @@ var MorphoClient = class {
|
|
|
497
500
|
this._eoaAddress = wallet.address;
|
|
498
501
|
}
|
|
499
502
|
const addrs = { ...defaultCfg.contracts, ...config.contracts };
|
|
500
|
-
this.
|
|
503
|
+
this.agether4337Factory = new Contract2(addrs.agether4337Factory, ACCOUNT_FACTORY_ABI, this._signer);
|
|
501
504
|
this.morphoBlue = new Contract2(addrs.morphoBlue, MORPHO_BLUE_ABI, this.provider);
|
|
502
|
-
this.
|
|
505
|
+
this.agether8004Scorer = new Contract2(addrs.agether8004Scorer, AGENT_REPUTATION_ABI, this._signer);
|
|
503
506
|
this.identityRegistry = new Contract2(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this._signer);
|
|
504
507
|
this.entryPoint = new Contract2(addrs.entryPoint, ENTRYPOINT_V07_ABI, this._signer);
|
|
505
508
|
this.validationModule = new Contract2(addrs.erc8004ValidationModule, ERC8004_VALIDATION_MODULE_ABI, this.provider);
|
|
@@ -531,7 +534,7 @@ var MorphoClient = class {
|
|
|
531
534
|
let lastErr;
|
|
532
535
|
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
533
536
|
try {
|
|
534
|
-
const addr = await this.
|
|
537
|
+
const addr = await this.agether4337Factory.getAccount(BigInt(this.agentId));
|
|
535
538
|
if (addr === ethers2.ZeroAddress) {
|
|
536
539
|
throw new AgetherError("No AgentAccount found. Call register() first.", "NO_ACCOUNT");
|
|
537
540
|
}
|
|
@@ -609,9 +612,9 @@ var MorphoClient = class {
|
|
|
609
612
|
async register(_name) {
|
|
610
613
|
const eoaAddr = await this.getSignerAddress();
|
|
611
614
|
if (this.agentId) {
|
|
612
|
-
const exists = await this.
|
|
615
|
+
const exists = await this.agether4337Factory.accountExists(BigInt(this.agentId));
|
|
613
616
|
if (exists) {
|
|
614
|
-
const acct = await this.
|
|
617
|
+
const acct = await this.agether4337Factory.getAccount(BigInt(this.agentId));
|
|
615
618
|
this._accountAddress = acct;
|
|
616
619
|
const kyaRequired2 = await this.isKyaRequired();
|
|
617
620
|
return { agentId: this.agentId, address: eoaAddr, agentAccount: acct, alreadyRegistered: true, kyaRequired: kyaRequired2 };
|
|
@@ -629,15 +632,15 @@ var MorphoClient = class {
|
|
|
629
632
|
agentId = await this._mintNewIdentity();
|
|
630
633
|
}
|
|
631
634
|
this.agentId = agentId.toString();
|
|
632
|
-
const acctExists = await this.
|
|
635
|
+
const acctExists = await this.agether4337Factory.accountExists(agentId);
|
|
633
636
|
let txHash;
|
|
634
637
|
if (!acctExists) {
|
|
635
|
-
const tx = await this.
|
|
638
|
+
const tx = await this.agether4337Factory.createAccount(agentId);
|
|
636
639
|
const receipt = await tx.wait();
|
|
637
640
|
this._refreshSigner();
|
|
638
641
|
txHash = receipt.hash;
|
|
639
642
|
}
|
|
640
|
-
const acctAddr = await this.
|
|
643
|
+
const acctAddr = await this.agether4337Factory.getAccount(agentId);
|
|
641
644
|
this._accountAddress = acctAddr;
|
|
642
645
|
const kyaRequired = await this.isKyaRequired();
|
|
643
646
|
return {
|
|
@@ -781,7 +784,7 @@ var MorphoClient = class {
|
|
|
781
784
|
}
|
|
782
785
|
/**
|
|
783
786
|
* Get MarketParams for a collateral token.
|
|
784
|
-
* Tries cache → API →
|
|
787
|
+
* Tries cache → API → onchain idToMarketParams.
|
|
785
788
|
*/
|
|
786
789
|
async findMarketForCollateral(collateralSymbolOrAddress) {
|
|
787
790
|
const colInfo = BASE_COLLATERALS[collateralSymbolOrAddress];
|
|
@@ -796,7 +799,7 @@ var MorphoClient = class {
|
|
|
796
799
|
"MARKET_NOT_FOUND"
|
|
797
800
|
);
|
|
798
801
|
}
|
|
799
|
-
/** Read MarketParams
|
|
802
|
+
/** Read MarketParams onchain by market ID (bytes32). */
|
|
800
803
|
async getMarketParams(marketId) {
|
|
801
804
|
const result = await this.morphoBlue.idToMarketParams(marketId);
|
|
802
805
|
return {
|
|
@@ -810,7 +813,7 @@ var MorphoClient = class {
|
|
|
810
813
|
// ════════════════════════════════════════════════════════
|
|
811
814
|
// Position Reads
|
|
812
815
|
// ════════════════════════════════════════════════════════
|
|
813
|
-
/** Read
|
|
816
|
+
/** Read onchain position for a specific market. */
|
|
814
817
|
async getPosition(marketId) {
|
|
815
818
|
const acctAddr = await this.getAccountAddress();
|
|
816
819
|
const pos = await this.morphoBlue.position(marketId, acctAddr);
|
|
@@ -1364,7 +1367,7 @@ var MorphoClient = class {
|
|
|
1364
1367
|
if (target.address) {
|
|
1365
1368
|
targetAddr = target.address;
|
|
1366
1369
|
} else if (target.agentId) {
|
|
1367
|
-
targetAddr = await this.
|
|
1370
|
+
targetAddr = await this.agether4337Factory.getAccount(BigInt(target.agentId));
|
|
1368
1371
|
if (targetAddr === ethers2.ZeroAddress) throw new AgetherError("Target agent has no account", "NO_ACCOUNT");
|
|
1369
1372
|
} else {
|
|
1370
1373
|
throw new AgetherError("Provide agentId or address", "INVALID_TARGET");
|
|
@@ -1377,25 +1380,25 @@ var MorphoClient = class {
|
|
|
1377
1380
|
return { tx: receipt.hash, targetAccount: targetAddr, targetAgentId: target.agentId };
|
|
1378
1381
|
}
|
|
1379
1382
|
// ════════════════════════════════════════════════════════
|
|
1380
|
-
// Reputation (
|
|
1383
|
+
// Reputation (Agether8004Scorer contract)
|
|
1381
1384
|
// ════════════════════════════════════════════════════════
|
|
1382
1385
|
async getCreditScore() {
|
|
1383
1386
|
if (!this.agentId) throw new AgetherError("agentId not set", "NO_AGENT_ID");
|
|
1384
|
-
return this.
|
|
1387
|
+
return this.agether8004Scorer.getCreditScore(BigInt(this.agentId));
|
|
1385
1388
|
}
|
|
1386
1389
|
async getAttestation() {
|
|
1387
1390
|
if (!this.agentId) throw new AgetherError("agentId not set", "NO_AGENT_ID");
|
|
1388
|
-
const att = await this.
|
|
1391
|
+
const att = await this.agether8004Scorer.getAttestation(BigInt(this.agentId));
|
|
1389
1392
|
return { score: att.score, timestamp: att.timestamp, signer: att.signer };
|
|
1390
1393
|
}
|
|
1391
1394
|
async isEligible(minScore = 500n) {
|
|
1392
1395
|
if (!this.agentId) throw new AgetherError("agentId not set", "NO_AGENT_ID");
|
|
1393
|
-
const [eligible, currentScore] = await this.
|
|
1396
|
+
const [eligible, currentScore] = await this.agether8004Scorer.isEligible(BigInt(this.agentId), minScore);
|
|
1394
1397
|
return { eligible, currentScore };
|
|
1395
1398
|
}
|
|
1396
1399
|
async isScoreFresh() {
|
|
1397
1400
|
if (!this.agentId) throw new AgetherError("agentId not set", "NO_AGENT_ID");
|
|
1398
|
-
const [fresh, age] = await this.
|
|
1401
|
+
const [fresh, age] = await this.agether8004Scorer.isScoreFresh(BigInt(this.agentId));
|
|
1399
1402
|
return { fresh, age };
|
|
1400
1403
|
}
|
|
1401
1404
|
// ════════════════════════════════════════════════════════
|
|
@@ -1417,10 +1420,10 @@ var MorphoClient = class {
|
|
|
1417
1420
|
_refreshSigner() {
|
|
1418
1421
|
if (this._useExternalSigner) {
|
|
1419
1422
|
const addrs = this.config.contracts;
|
|
1420
|
-
this.
|
|
1423
|
+
this.agether4337Factory = new Contract2(addrs.agether4337Factory, ACCOUNT_FACTORY_ABI, this._signer);
|
|
1421
1424
|
this.entryPoint = new Contract2(addrs.entryPoint, ENTRYPOINT_V07_ABI, this._signer);
|
|
1422
1425
|
this.validationModule = new Contract2(addrs.erc8004ValidationModule, ERC8004_VALIDATION_MODULE_ABI, this.provider);
|
|
1423
|
-
this.
|
|
1426
|
+
this.agether8004Scorer = new Contract2(addrs.agether8004Scorer, AGENT_REPUTATION_ABI, this._signer);
|
|
1424
1427
|
this.identityRegistry = new Contract2(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this._signer);
|
|
1425
1428
|
} else {
|
|
1426
1429
|
this.provider = new ethers2.JsonRpcProvider(this._rpcUrl);
|
|
@@ -1428,10 +1431,10 @@ var MorphoClient = class {
|
|
|
1428
1431
|
this._signer = wallet;
|
|
1429
1432
|
this._eoaAddress = wallet.address;
|
|
1430
1433
|
const addrs = this.config.contracts;
|
|
1431
|
-
this.
|
|
1434
|
+
this.agether4337Factory = new Contract2(addrs.agether4337Factory, ACCOUNT_FACTORY_ABI, this._signer);
|
|
1432
1435
|
this.entryPoint = new Contract2(addrs.entryPoint, ENTRYPOINT_V07_ABI, this._signer);
|
|
1433
1436
|
this.validationModule = new Contract2(addrs.erc8004ValidationModule, ERC8004_VALIDATION_MODULE_ABI, this.provider);
|
|
1434
|
-
this.
|
|
1437
|
+
this.agether8004Scorer = new Contract2(addrs.agether8004Scorer, AGENT_REPUTATION_ABI, this._signer);
|
|
1435
1438
|
this.identityRegistry = new Contract2(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this._signer);
|
|
1436
1439
|
}
|
|
1437
1440
|
}
|
|
@@ -1875,14 +1878,14 @@ var ScoringClient = class {
|
|
|
1875
1878
|
}
|
|
1876
1879
|
}
|
|
1877
1880
|
// ════════════════════════════════════════════════════════
|
|
1878
|
-
// Score (x402-gated — computes & submits
|
|
1881
|
+
// Score (x402-gated — computes & submits onchain)
|
|
1879
1882
|
// ════════════════════════════════════════════════════════
|
|
1880
1883
|
/**
|
|
1881
1884
|
* Request a fresh score computation.
|
|
1882
1885
|
*
|
|
1883
1886
|
* This is x402-gated: the backend returns 402, the X402Client
|
|
1884
1887
|
* signs an EIP-3009 payment, and the backend computes + submits
|
|
1885
|
-
* the score
|
|
1888
|
+
* the score onchain via AgentReputation.submitScore().
|
|
1886
1889
|
*
|
|
1887
1890
|
* Returns the ScoreResult with breakdown and txHash.
|
|
1888
1891
|
*/
|
|
@@ -1906,10 +1909,10 @@ var ScoringClient = class {
|
|
|
1906
1909
|
return result.data;
|
|
1907
1910
|
}
|
|
1908
1911
|
// ════════════════════════════════════════════════════════
|
|
1909
|
-
// Current Score (free — reads
|
|
1912
|
+
// Current Score (free — reads onchain)
|
|
1910
1913
|
// ════════════════════════════════════════════════════════
|
|
1911
1914
|
/**
|
|
1912
|
-
* Get the current
|
|
1915
|
+
* Get the current onchain score (free, no payment required).
|
|
1913
1916
|
*/
|
|
1914
1917
|
async getCurrentScore(agentId) {
|
|
1915
1918
|
const response = await this.client.get(`/score/${agentId.toString()}/current`);
|
|
@@ -2058,7 +2061,7 @@ var AgentIdentityClient = class {
|
|
|
2058
2061
|
return { ...result, existing: false };
|
|
2059
2062
|
}
|
|
2060
2063
|
/**
|
|
2061
|
-
* Register agent with URI and
|
|
2064
|
+
* Register agent with URI and onchain metadata
|
|
2062
2065
|
*/
|
|
2063
2066
|
async registerWithMetadata(agentURI, metadata) {
|
|
2064
2067
|
const metadataEntries = metadata.map((m) => ({
|
|
@@ -2094,7 +2097,7 @@ var AgentIdentityClient = class {
|
|
|
2094
2097
|
return receipt.hash;
|
|
2095
2098
|
}
|
|
2096
2099
|
/**
|
|
2097
|
-
* Set
|
|
2100
|
+
* Set onchain metadata (key-value)
|
|
2098
2101
|
*/
|
|
2099
2102
|
async setMetadata(agentId, key, value) {
|
|
2100
2103
|
const tx = await this.identityRegistry.setMetadata(
|
|
@@ -2106,7 +2109,7 @@ var AgentIdentityClient = class {
|
|
|
2106
2109
|
return receipt.hash;
|
|
2107
2110
|
}
|
|
2108
2111
|
/**
|
|
2109
|
-
* Get
|
|
2112
|
+
* Get onchain metadata
|
|
2110
2113
|
*/
|
|
2111
2114
|
async getMetadata(agentId, key) {
|
|
2112
2115
|
const value = await this.identityRegistry.getMetadata(agentId, key);
|
|
@@ -2335,6 +2338,10 @@ function rateToBps(rate) {
|
|
|
2335
2338
|
export {
|
|
2336
2339
|
ACCOUNT_FACTORY_ABI,
|
|
2337
2340
|
AGENT_REPUTATION_ABI,
|
|
2341
|
+
AGETHER_4337_FACTORY_ABI,
|
|
2342
|
+
AGETHER_8004_SCORER_ABI,
|
|
2343
|
+
AGETHER_8004_VALIDATION_MODULE_ABI,
|
|
2344
|
+
AGETHER_HOOK_MULTIPLEXER_ABI,
|
|
2338
2345
|
AgentIdentityClient,
|
|
2339
2346
|
AgentNotApprovedError,
|
|
2340
2347
|
AgetherClient,
|