@agether/sdk 1.10.1 → 1.11.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/cli.js CHANGED
@@ -47,7 +47,7 @@ var init_types = __esm({
47
47
  });
48
48
 
49
49
  // src/utils/abis.ts
50
- var IDENTITY_REGISTRY_ABI, ACCOUNT_FACTORY_ABI, AGENT_ACCOUNT_ABI, AGENT_REPUTATION_ABI, MORPHO_BLUE_ABI, ERC20_ABI;
50
+ var IDENTITY_REGISTRY_ABI, ACCOUNT_FACTORY_ABI, AGENT_ACCOUNT_ABI, AGENT_REPUTATION_ABI, MORPHO_BLUE_ABI, ERC20_ABI, KYA_HOOK_ABI;
51
51
  var init_abis = __esm({
52
52
  "src/utils/abis.ts"() {
53
53
  "use strict";
@@ -66,24 +66,30 @@ var init_abis = __esm({
66
66
  "function totalAccounts() view returns (uint256)",
67
67
  "function getAgentId(address account) view returns (uint256)",
68
68
  "function createAccount(uint256 agentId) returns (address account)",
69
- "function validationRegistry() view returns (address)",
70
- "function setValidationRegistry(address newRegistry)",
71
- "event AccountCreated(uint256 indexed agentId, address indexed account, address indexed owner)",
72
- "event ValidationRegistryUpdated(address indexed oldRegistry, address indexed newRegistry)"
69
+ "function protocolHook() view returns (address)",
70
+ "function identityRegistry() view returns (address)",
71
+ "event AccountCreated(uint256 indexed agentId, address indexed account, address indexed owner)"
73
72
  ];
74
73
  AGENT_ACCOUNT_ABI = [
75
74
  "function agentId() view returns (uint256)",
76
75
  "function owner() view returns (address)",
77
76
  "function factory() view returns (address)",
78
- "function validationRegistry() view returns (address)",
79
77
  "function identityRegistry() view returns (address)",
80
78
  "function balanceOf(address token) view returns (uint256)",
81
79
  "function ethBalance() view returns (uint256)",
82
- "function execute(address target, uint256 value, bytes data) payable returns (bytes)",
83
- "function executeBatch(address[] targets, uint256[] values, bytes[] datas) payable returns (bytes[])",
80
+ // ERC-7579 execution
81
+ "function execute(bytes32 mode, bytes executionCalldata) payable",
82
+ "function executeFromExecutor(bytes32 mode, bytes executionCalldata) payable returns (bytes[])",
83
+ // ERC-7579 module management
84
+ "function installModule(uint256 moduleTypeId, address module, bytes initData) payable",
85
+ "function uninstallModule(uint256 moduleTypeId, address module, bytes deInitData) payable",
86
+ "function isModuleInstalled(uint256 moduleTypeId, address module, bytes additionalContext) view returns (bool)",
87
+ "function hook() view returns (address)",
88
+ // Funding (direct, no execution needed)
84
89
  "function fund(address token, uint256 amount)",
85
90
  "function withdraw(address token, uint256 amount, address to)",
86
91
  "function withdrawETH(uint256 amount, address to)",
92
+ // EIP-1271
87
93
  "function isValidSignature(bytes32 hash, bytes signature) view returns (bytes4)"
88
94
  ];
89
95
  AGENT_REPUTATION_ABI = [
@@ -124,6 +130,10 @@ var init_abis = __esm({
124
130
  "function symbol() view returns (string)",
125
131
  "function name() view returns (string)"
126
132
  ];
133
+ KYA_HOOK_ABI = [
134
+ "function validationRegistry() view returns (address)",
135
+ "function setValidationRegistry(address newRegistry)"
136
+ ];
127
137
  }
128
138
  });
129
139
 
@@ -146,14 +156,16 @@ var init_config = __esm({
146
156
  accountFactory: "0x0000000000000000000000000000000000000000",
147
157
  validationRegistry: "0x0000000000000000000000000000000000000000",
148
158
  agentReputation: "0x0000000000000000000000000000000000000000",
159
+ kyaHook: "0x0000000000000000000000000000000000000000",
149
160
  usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
150
161
  identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
151
162
  morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb"
152
163
  },
153
164
  [8453 /* Base */]: {
154
- accountFactory: "0xFab8b924fb292a736BA05AF7b4AEC2c8d05cdcbF",
155
- validationRegistry: "0x493f1551cbbC75afb2127CDBD5375ad8e8959f42",
156
- agentReputation: "0x1fcb28eE3E8F3234E653b0A7a6fb56dE11E3c203",
165
+ accountFactory: "0x89a8758E60A56EcB47247D92E05447eFd450d6Bf",
166
+ validationRegistry: "0x6f76cF69B71Dc5F9A414BCEe4583b12738E47985",
167
+ agentReputation: "0xe88f3419a2dbac70e3aF6E487b0C63e8301C6A87",
168
+ kyaHook: "0x28e50Aa9eD517E369b2806928709B44062aD9821",
157
169
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
158
170
  identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
159
171
  morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb"
@@ -162,6 +174,7 @@ var init_config = __esm({
162
174
  accountFactory: "0x0000000000000000000000000000000000000000",
163
175
  validationRegistry: "0x0000000000000000000000000000000000000000",
164
176
  agentReputation: "0x0000000000000000000000000000000000000000",
177
+ kyaHook: "0x0000000000000000000000000000000000000000",
165
178
  usdc: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
166
179
  identityRegistry: "0x8004A818BFB912233c491871b3d84c89A494BD9e",
167
180
  morphoBlue: "0x0000000000000000000000000000000000000000"
@@ -170,6 +183,7 @@ var init_config = __esm({
170
183
  accountFactory: "0x0000000000000000000000000000000000000000",
171
184
  validationRegistry: "0x0000000000000000000000000000000000000000",
172
185
  agentReputation: "0x0000000000000000000000000000000000000000",
186
+ kyaHook: "0x0000000000000000000000000000000000000000",
173
187
  usdc: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
174
188
  identityRegistry: "0x8004A818BFB912233c491871b3d84c89A494BD9e",
175
189
  morphoBlue: "0x0000000000000000000000000000000000000000"
@@ -178,6 +192,7 @@ var init_config = __esm({
178
192
  accountFactory: "0x0000000000000000000000000000000000000000",
179
193
  validationRegistry: "0x0000000000000000000000000000000000000000",
180
194
  agentReputation: "0x0000000000000000000000000000000000000000",
195
+ kyaHook: "0x0000000000000000000000000000000000000000",
181
196
  usdc: "0x56d4d6aEe0278c5Df2FA23Ecb32eC146C9446FDf",
182
197
  identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
183
198
  morphoBlue: "0x0000000000000000000000000000000000000000"
@@ -205,7 +220,7 @@ var MorphoClient_exports = {};
205
220
  __export(MorphoClient_exports, {
206
221
  MorphoClient: () => MorphoClient
207
222
  });
208
- var import_ethers, import_axios, BASE_COLLATERALS, MORPHO_API_URL, morphoIface, erc20Iface, MorphoClient;
223
+ var import_ethers, import_axios, BASE_COLLATERALS, MORPHO_API_URL, MODE_SINGLE, MODE_BATCH, morphoIface, erc20Iface, MorphoClient;
209
224
  var init_MorphoClient = __esm({
210
225
  "src/clients/MorphoClient.ts"() {
211
226
  "use strict";
@@ -220,6 +235,8 @@ var init_MorphoClient = __esm({
220
235
  cbETH: { address: "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22", symbol: "cbETH", decimals: 18 }
221
236
  };
222
237
  MORPHO_API_URL = "https://api.morpho.org/graphql";
238
+ MODE_SINGLE = "0x0000000000000000000000000000000000000000000000000000000000000000";
239
+ MODE_BATCH = "0x0100000000000000000000000000000000000000000000000000000000000000";
223
240
  morphoIface = new import_ethers.ethers.Interface(MORPHO_BLUE_ABI);
224
241
  erc20Iface = new import_ethers.ethers.Interface(ERC20_ABI);
225
242
  MorphoClient = class {
@@ -263,12 +280,21 @@ var init_MorphoClient = __esm({
263
280
  // ════════════════════════════════════════════════════════
264
281
  /**
265
282
  * Check whether the KYA (Know Your Agent) code verification gate is active.
266
- * When validationRegistry is address(0), KYA is disabled agents can use
267
- * execute/executeBatch without prior code approval.
283
+ * Reads the account's installed hook and checks if it has a non-zero
284
+ * validationRegistry when set, the hook enforces KYA code approval.
268
285
  */
269
286
  async isKyaRequired() {
270
- const registryAddr = await this.accountFactory.validationRegistry();
271
- return registryAddr !== import_ethers.ethers.ZeroAddress;
287
+ try {
288
+ const acctAddr = await this.getAccountAddress();
289
+ const account = new import_ethers.Contract(acctAddr, AGENT_ACCOUNT_ABI, this.provider);
290
+ const hookAddr = await account.hook();
291
+ if (hookAddr === import_ethers.ethers.ZeroAddress) return false;
292
+ const hook = new import_ethers.Contract(hookAddr, KYA_HOOK_ABI, this.provider);
293
+ const registryAddr = await hook.validationRegistry();
294
+ return registryAddr !== import_ethers.ethers.ZeroAddress;
295
+ } catch {
296
+ return false;
297
+ }
272
298
  }
273
299
  // ════════════════════════════════════════════════════════
274
300
  // Account Management
@@ -344,7 +370,8 @@ var init_MorphoClient = __esm({
344
370
  agentId = parsed.args[2];
345
371
  break;
346
372
  }
347
- } catch {
373
+ } catch (e) {
374
+ console.warn("[agether] parseLog skip:", e instanceof Error ? e.message : e);
348
375
  continue;
349
376
  }
350
377
  }
@@ -410,7 +437,8 @@ var init_MorphoClient = __esm({
410
437
  const token = new import_ethers.Contract(info.address, ERC20_ABI, this.provider);
411
438
  const bal = await token.balanceOf(eoaAddr);
412
439
  eoaCollateral[symbol] = import_ethers.ethers.formatUnits(bal, info.decimals);
413
- } catch {
440
+ } catch (e) {
441
+ console.warn(`[agether] EOA collateral fetch failed for ${symbol}:`, e instanceof Error ? e.message : e);
414
442
  eoaCollateral[symbol] = "0";
415
443
  }
416
444
  }
@@ -431,7 +459,8 @@ var init_MorphoClient = __esm({
431
459
  const token = new import_ethers.Contract(info.address, ERC20_ABI, this.provider);
432
460
  const bal = await token.balanceOf(acctAddr);
433
461
  acctCollateral[symbol] = import_ethers.ethers.formatUnits(bal, info.decimals);
434
- } catch {
462
+ } catch (e) {
463
+ console.warn(`[agether] AgentAccount collateral fetch failed for ${symbol}:`, e instanceof Error ? e.message : e);
435
464
  acctCollateral[symbol] = "0";
436
465
  }
437
466
  }
@@ -521,7 +550,8 @@ var init_MorphoClient = __esm({
521
550
  }
522
551
  }
523
552
  return this._discoveredMarkets;
524
- } catch {
553
+ } catch (e) {
554
+ console.warn("[agether] getMarkets failed, using cache:", e instanceof Error ? e.message : e);
525
555
  return this._discoveredMarkets ?? [];
526
556
  }
527
557
  }
@@ -587,7 +617,8 @@ var init_MorphoClient = __esm({
587
617
  const totalBorrowAssets = BigInt(mkt.totalBorrowAssets);
588
618
  debt = totalBorrowShares > 0n ? BigInt(pos.borrowShares) * totalBorrowAssets / totalBorrowShares : 0n;
589
619
  totalDebt += debt;
590
- } catch {
620
+ } catch (e) {
621
+ console.warn(`[agether] debt calc failed for market ${m.uniqueKey}:`, e instanceof Error ? e.message : e);
591
622
  }
592
623
  }
593
624
  positions.push({
@@ -598,7 +629,8 @@ var init_MorphoClient = __esm({
598
629
  supplyShares: pos.supplyShares.toString(),
599
630
  debt: import_ethers.ethers.formatUnits(debt, 6)
600
631
  });
601
- } catch {
632
+ } catch (e) {
633
+ console.warn(`[agether] position read failed for market:`, e instanceof Error ? e.message : e);
602
634
  continue;
603
635
  }
604
636
  }
@@ -654,7 +686,8 @@ var init_MorphoClient = __esm({
654
686
  const oraclePrice = await oracleContract.price();
655
687
  const ORACLE_PRICE_SCALE = 10n ** 36n;
656
688
  collateralValueInLoan = BigInt(pos.collateral) * oraclePrice / ORACLE_PRICE_SCALE;
657
- } catch {
689
+ } catch (e) {
690
+ console.warn(`[agether] oracle price fetch failed:`, e instanceof Error ? e.message : e);
658
691
  continue;
659
692
  }
660
693
  const maxBorrowTotal = collateralValueInLoan * m.lltv / 10n ** 18n;
@@ -666,7 +699,8 @@ var init_MorphoClient = __esm({
666
699
  currentDebt,
667
700
  collateralValue: collateralValueInLoan
668
701
  });
669
- } catch {
702
+ } catch (e) {
703
+ console.warn(`[agether] maxBorrow calc failed:`, e instanceof Error ? e.message : e);
670
704
  continue;
671
705
  }
672
706
  }
@@ -726,7 +760,8 @@ var init_MorphoClient = __esm({
726
760
  lltv: `${(Number(m.lltv) / 1e16).toFixed(0)}%`,
727
761
  marketId: m.uniqueKey
728
762
  }));
729
- } catch {
763
+ } catch (e) {
764
+ console.warn("[agether] getMarketRates failed:", e instanceof Error ? e.message : e);
730
765
  return [];
731
766
  }
732
767
  }
@@ -767,7 +802,8 @@ var init_MorphoClient = __esm({
767
802
  const amountWei = import_ethers.ethers.parseUnits(amount, colInfo.decimals);
768
803
  const valueInUsdc = amountWei * oraclePrice / ORACLE_PRICE_SCALE;
769
804
  collateralValueUsd = Number(valueInUsdc) / 1e6;
770
- } catch {
805
+ } catch (e) {
806
+ console.warn("[agether] oracle price fetch for yield estimation failed:", e instanceof Error ? e.message : e);
771
807
  throw new AgetherError("Cannot determine collateral value. Provide ethPriceUsd.", "PRICE_UNAVAILABLE");
772
808
  }
773
809
  }
@@ -970,7 +1006,8 @@ var init_MorphoClient = __esm({
970
1006
  approveAmount = currentDebt + 10n;
971
1007
  }
972
1008
  }
973
- } catch {
1009
+ } catch (e) {
1010
+ console.warn("[agether] share-based repay detection failed, falling through to asset-based:", e instanceof Error ? e.message : e);
974
1011
  }
975
1012
  }
976
1013
  const targets = [usdcAddr, morphoAddr];
@@ -990,7 +1027,8 @@ var init_MorphoClient = __esm({
990
1027
  try {
991
1028
  const status = await this.getStatus();
992
1029
  remainingDebt = status.totalDebt;
993
- } catch {
1030
+ } catch (e) {
1031
+ console.warn("[agether] failed to read remaining debt after repay:", e instanceof Error ? e.message : e);
994
1032
  }
995
1033
  return { tx: receipt.hash, amount: usdcAmount, remainingDebt };
996
1034
  }
@@ -1038,7 +1076,8 @@ var init_MorphoClient = __esm({
1038
1076
  const pos = await this.morphoBlue.position(market.uniqueKey, acctAddr);
1039
1077
  remainingCollateral = import_ethers.ethers.formatUnits(pos.collateral, colInfo.decimals);
1040
1078
  }
1041
- } catch {
1079
+ } catch (e) {
1080
+ console.warn("[agether] failed to read remaining collateral after withdraw:", e instanceof Error ? e.message : e);
1042
1081
  }
1043
1082
  return {
1044
1083
  tx: receipt.hash,
@@ -1127,37 +1166,48 @@ var init_MorphoClient = __esm({
1127
1166
  }
1128
1167
  }
1129
1168
  /**
1130
- * Execute a single call via AgentAccount.execute.
1169
+ * Execute a single call via AgentAccount.execute (ERC-7579 single mode).
1131
1170
  */
1132
1171
  async exec(target, data, value = 0n) {
1133
1172
  const acctAddr = await this.getAccountAddress();
1134
1173
  const account = new import_ethers.Contract(acctAddr, AGENT_ACCOUNT_ABI, this._signer);
1174
+ const executionCalldata = import_ethers.ethers.AbiCoder.defaultAbiCoder().encode(
1175
+ ["address", "uint256", "bytes"],
1176
+ [target, value, data]
1177
+ );
1135
1178
  let gasLimit;
1136
1179
  try {
1137
- const estimate = await account.execute.estimateGas(target, value, data);
1180
+ const estimate = await account.execute.estimateGas(MODE_SINGLE, executionCalldata);
1138
1181
  gasLimit = estimate * 130n / 100n;
1139
- } catch {
1182
+ } catch (e) {
1183
+ console.warn("[agether] exec gas estimation failed, using default 500k:", e instanceof Error ? e.message : e);
1140
1184
  gasLimit = 500000n;
1141
1185
  }
1142
- const tx = await account.execute(target, value, data, { gasLimit });
1186
+ const tx = await account.execute(MODE_SINGLE, executionCalldata, { gasLimit });
1143
1187
  const receipt = await tx.wait();
1144
1188
  this._refreshSigner();
1145
1189
  return receipt;
1146
1190
  }
1147
1191
  /**
1148
- * Execute multiple calls via AgentAccount.executeBatch.
1192
+ * Execute multiple calls via AgentAccount.execute (ERC-7579 batch mode).
1149
1193
  */
1150
1194
  async batch(targets, values, datas) {
1151
1195
  const acctAddr = await this.getAccountAddress();
1152
1196
  const account = new import_ethers.Contract(acctAddr, AGENT_ACCOUNT_ABI, this._signer);
1197
+ const executions = targets.map((t, i) => [t, values[i], datas[i]]);
1198
+ const executionCalldata = import_ethers.ethers.AbiCoder.defaultAbiCoder().encode(
1199
+ ["(address,uint256,bytes)[]"],
1200
+ [executions]
1201
+ );
1153
1202
  let gasLimit;
1154
1203
  try {
1155
- const estimate = await account.executeBatch.estimateGas(targets, values, datas);
1204
+ const estimate = await account.execute.estimateGas(MODE_BATCH, executionCalldata);
1156
1205
  gasLimit = estimate * 130n / 100n;
1157
- } catch {
1206
+ } catch (e) {
1207
+ console.warn("[agether] batch gas estimation failed, using default 800k:", e instanceof Error ? e.message : e);
1158
1208
  gasLimit = 800000n;
1159
1209
  }
1160
- const tx = await account.executeBatch(targets, values, datas, { gasLimit });
1210
+ const tx = await account.execute(MODE_BATCH, executionCalldata, { gasLimit });
1161
1211
  const receipt = await tx.wait();
1162
1212
  this._refreshSigner();
1163
1213
  return receipt;
@@ -1186,7 +1236,8 @@ var init_MorphoClient = __esm({
1186
1236
  symbol: m.collateralAsset.symbol
1187
1237
  };
1188
1238
  }
1189
- } catch {
1239
+ } catch (e) {
1240
+ console.warn("[agether] _findActiveMarket position check failed:", e instanceof Error ? e.message : e);
1190
1241
  continue;
1191
1242
  }
1192
1243
  }
@@ -1388,7 +1439,8 @@ var init_X402Client = __esm({
1388
1439
  Buffer.from(paymentResponse, "base64").toString("utf-8")
1389
1440
  );
1390
1441
  txHash = settlement.transaction;
1391
- } catch {
1442
+ } catch (e) {
1443
+ console.warn("[agether] x402 payment response parse failed:", e instanceof Error ? e.message : e);
1392
1444
  }
1393
1445
  }
1394
1446
  return {
@@ -1443,10 +1495,12 @@ var init_X402Client = __esm({
1443
1495
  return BigInt(amount);
1444
1496
  }
1445
1497
  }
1446
- } catch {
1498
+ } catch (e) {
1499
+ console.warn("[agether] x402 payment header parse failed:", e instanceof Error ? e.message : e);
1447
1500
  }
1448
1501
  return null;
1449
- } catch {
1502
+ } catch (e) {
1503
+ console.warn("[agether] x402 getPaymentRequired failed:", e instanceof Error ? e.message : e);
1450
1504
  return null;
1451
1505
  }
1452
1506
  }
@@ -1486,7 +1540,8 @@ var init_X402Client = __esm({
1486
1540
  // 1 day
1487
1541
  );
1488
1542
  totalDailyYieldUsdc += estimate.estimatedYieldUsd;
1489
- } catch {
1543
+ } catch (e) {
1544
+ console.warn(`[agether] yield calc failed for ${pos.collateralToken}:`, e instanceof Error ? e.message : e);
1490
1545
  }
1491
1546
  }
1492
1547
  }
@@ -1498,7 +1553,8 @@ var init_X402Client = __esm({
1498
1553
  reason: `Yield-limited spending exceeded. Daily yield cap: $${(Number(yieldLimit) / 1e6).toFixed(2)}, already spent: $${(Number(this._spendingTracker.totalBorrowed) / 1e6).toFixed(2)}, requested: $${(Number(amount) / 1e6).toFixed(2)}`
1499
1554
  };
1500
1555
  }
1501
- } catch {
1556
+ } catch (e) {
1557
+ console.warn("[agether] yield-limited spending check failed, falling through to fixed limit:", e instanceof Error ? e.message : e);
1502
1558
  }
1503
1559
  }
1504
1560
  if (this._spendingTracker.dailyLimit > 0n) {
package/dist/index.d.mts CHANGED
@@ -103,6 +103,7 @@ interface ContractAddresses {
103
103
  accountFactory: string;
104
104
  validationRegistry: string;
105
105
  agentReputation: string;
106
+ kyaHook: string;
106
107
  usdc: string;
107
108
  identityRegistry: string;
108
109
  morphoBlue: string;
@@ -176,10 +177,14 @@ declare class AgetherClient {
176
177
  }
177
178
 
178
179
  /**
179
- * MorphoClient — Direct Morpho Blue lending via AgentAccount.executeBatch
180
+ * MorphoClient — Direct Morpho Blue lending via AgentAccount (ERC-7579)
180
181
  *
181
182
  * Architecture (no intermediary contract):
182
- * EOA → AgentAccount.executeBatch → Morpho Blue (direct)
183
+ * EOA → AgentAccount.execute(MODE_BATCH, ...) → Morpho Blue (direct)
184
+ *
185
+ * ERC-7579 execution modes:
186
+ * - Single: execute(MODE_SINGLE, abi.encode(target, value, callData))
187
+ * - Batch: execute(MODE_BATCH, abi.encode(Execution[]))
183
188
  *
184
189
  * Batched operations:
185
190
  * - depositAndBorrow: [ERC20.approve, Morpho.supplyCollateral, Morpho.borrow]
@@ -342,8 +347,8 @@ declare class MorphoClient {
342
347
  constructor(config: MorphoClientConfig);
343
348
  /**
344
349
  * Check whether the KYA (Know Your Agent) code verification gate is active.
345
- * When validationRegistry is address(0), KYA is disabled agents can use
346
- * execute/executeBatch without prior code approval.
350
+ * Reads the account's installed hook and checks if it has a non-zero
351
+ * validationRegistry when set, the hook enforces KYA code approval.
347
352
  */
348
353
  isKyaRequired(): Promise<boolean>;
349
354
  /** Resolve the AgentAccount address (cached, with retry for flaky RPCs). */
@@ -535,11 +540,11 @@ declare class MorphoClient {
535
540
  */
536
541
  private _refreshSigner;
537
542
  /**
538
- * Execute a single call via AgentAccount.execute.
543
+ * Execute a single call via AgentAccount.execute (ERC-7579 single mode).
539
544
  */
540
545
  private exec;
541
546
  /**
542
- * Execute multiple calls via AgentAccount.executeBatch.
547
+ * Execute multiple calls via AgentAccount.execute (ERC-7579 batch mode).
543
548
  */
544
549
  private batch;
545
550
  /** Convert MorphoMarketParams to Solidity tuple. */
@@ -1040,6 +1045,7 @@ declare const AGENT_REPUTATION_ABI: string[];
1040
1045
  declare const VALIDATION_REGISTRY_ABI: string[];
1041
1046
  declare const MORPHO_BLUE_ABI: string[];
1042
1047
  declare const ERC20_ABI: string[];
1048
+ declare const KYA_HOOK_ABI: string[];
1043
1049
 
1044
1050
  /**
1045
1051
  * Network configurations
@@ -1063,4 +1069,4 @@ declare function getDefaultConfig(chainId: ChainId): AgetherConfig;
1063
1069
  */
1064
1070
  declare function createConfig(chainId: ChainId, options?: Partial<AgetherConfig>): AgetherConfig;
1065
1071
 
1066
- export { ACCOUNT_FACTORY_ABI, AGENT_ACCOUNT_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, ERC20_ABI, type FundResult, IDENTITY_REGISTRY_ABI, InsufficientBalanceError, MORPHO_BLUE_ABI, MorphoClient, type MorphoClientConfig, type MorphoMarketInfo, type MorphoMarketParams, type MorphoPosition, type PaymentRequirements, type PositionResult, type RegisterResult, type RepayResult, 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 };
1072
+ export { ACCOUNT_FACTORY_ABI, AGENT_ACCOUNT_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, ERC20_ABI, type FundResult, IDENTITY_REGISTRY_ABI, InsufficientBalanceError, KYA_HOOK_ABI, MORPHO_BLUE_ABI, MorphoClient, type MorphoClientConfig, type MorphoMarketInfo, type MorphoMarketParams, type MorphoPosition, type PaymentRequirements, type PositionResult, type RegisterResult, type RepayResult, 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.d.ts CHANGED
@@ -103,6 +103,7 @@ interface ContractAddresses {
103
103
  accountFactory: string;
104
104
  validationRegistry: string;
105
105
  agentReputation: string;
106
+ kyaHook: string;
106
107
  usdc: string;
107
108
  identityRegistry: string;
108
109
  morphoBlue: string;
@@ -176,10 +177,14 @@ declare class AgetherClient {
176
177
  }
177
178
 
178
179
  /**
179
- * MorphoClient — Direct Morpho Blue lending via AgentAccount.executeBatch
180
+ * MorphoClient — Direct Morpho Blue lending via AgentAccount (ERC-7579)
180
181
  *
181
182
  * Architecture (no intermediary contract):
182
- * EOA → AgentAccount.executeBatch → Morpho Blue (direct)
183
+ * EOA → AgentAccount.execute(MODE_BATCH, ...) → Morpho Blue (direct)
184
+ *
185
+ * ERC-7579 execution modes:
186
+ * - Single: execute(MODE_SINGLE, abi.encode(target, value, callData))
187
+ * - Batch: execute(MODE_BATCH, abi.encode(Execution[]))
183
188
  *
184
189
  * Batched operations:
185
190
  * - depositAndBorrow: [ERC20.approve, Morpho.supplyCollateral, Morpho.borrow]
@@ -342,8 +347,8 @@ declare class MorphoClient {
342
347
  constructor(config: MorphoClientConfig);
343
348
  /**
344
349
  * Check whether the KYA (Know Your Agent) code verification gate is active.
345
- * When validationRegistry is address(0), KYA is disabled agents can use
346
- * execute/executeBatch without prior code approval.
350
+ * Reads the account's installed hook and checks if it has a non-zero
351
+ * validationRegistry when set, the hook enforces KYA code approval.
347
352
  */
348
353
  isKyaRequired(): Promise<boolean>;
349
354
  /** Resolve the AgentAccount address (cached, with retry for flaky RPCs). */
@@ -535,11 +540,11 @@ declare class MorphoClient {
535
540
  */
536
541
  private _refreshSigner;
537
542
  /**
538
- * Execute a single call via AgentAccount.execute.
543
+ * Execute a single call via AgentAccount.execute (ERC-7579 single mode).
539
544
  */
540
545
  private exec;
541
546
  /**
542
- * Execute multiple calls via AgentAccount.executeBatch.
547
+ * Execute multiple calls via AgentAccount.execute (ERC-7579 batch mode).
543
548
  */
544
549
  private batch;
545
550
  /** Convert MorphoMarketParams to Solidity tuple. */
@@ -1040,6 +1045,7 @@ declare const AGENT_REPUTATION_ABI: string[];
1040
1045
  declare const VALIDATION_REGISTRY_ABI: string[];
1041
1046
  declare const MORPHO_BLUE_ABI: string[];
1042
1047
  declare const ERC20_ABI: string[];
1048
+ declare const KYA_HOOK_ABI: string[];
1043
1049
 
1044
1050
  /**
1045
1051
  * Network configurations
@@ -1063,4 +1069,4 @@ declare function getDefaultConfig(chainId: ChainId): AgetherConfig;
1063
1069
  */
1064
1070
  declare function createConfig(chainId: ChainId, options?: Partial<AgetherConfig>): AgetherConfig;
1065
1071
 
1066
- export { ACCOUNT_FACTORY_ABI, AGENT_ACCOUNT_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, ERC20_ABI, type FundResult, IDENTITY_REGISTRY_ABI, InsufficientBalanceError, MORPHO_BLUE_ABI, MorphoClient, type MorphoClientConfig, type MorphoMarketInfo, type MorphoMarketParams, type MorphoPosition, type PaymentRequirements, type PositionResult, type RegisterResult, type RepayResult, 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 };
1072
+ export { ACCOUNT_FACTORY_ABI, AGENT_ACCOUNT_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, ERC20_ABI, type FundResult, IDENTITY_REGISTRY_ABI, InsufficientBalanceError, KYA_HOOK_ABI, MORPHO_BLUE_ABI, MorphoClient, type MorphoClientConfig, type MorphoMarketInfo, type MorphoMarketParams, type MorphoPosition, type PaymentRequirements, type PositionResult, type RegisterResult, type RepayResult, 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 };