@agether/sdk 1.11.1 → 2.0.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 +2375 -0
- package/dist/index.d.mts +77 -32
- package/dist/index.d.ts +77 -32
- package/dist/index.js +304 -169
- package/dist/index.mjs +299 -167
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,19 +31,22 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
ACCOUNT_FACTORY_ABI: () => ACCOUNT_FACTORY_ABI,
|
|
34
|
-
AGENT_ACCOUNT_ABI: () => AGENT_ACCOUNT_ABI,
|
|
35
34
|
AGENT_REPUTATION_ABI: () => AGENT_REPUTATION_ABI,
|
|
36
35
|
AgentIdentityClient: () => AgentIdentityClient,
|
|
37
36
|
AgentNotApprovedError: () => AgentNotApprovedError,
|
|
38
37
|
AgetherClient: () => AgetherClient,
|
|
39
38
|
AgetherError: () => AgetherError,
|
|
40
39
|
ChainId: () => ChainId,
|
|
40
|
+
ENTRYPOINT_V07_ABI: () => ENTRYPOINT_V07_ABI,
|
|
41
41
|
ERC20_ABI: () => ERC20_ABI,
|
|
42
|
+
ERC8004_VALIDATION_MODULE_ABI: () => ERC8004_VALIDATION_MODULE_ABI,
|
|
43
|
+
HOOK_MULTIPLEXER_ABI: () => HOOK_MULTIPLEXER_ABI,
|
|
42
44
|
IDENTITY_REGISTRY_ABI: () => IDENTITY_REGISTRY_ABI,
|
|
43
45
|
InsufficientBalanceError: () => InsufficientBalanceError,
|
|
44
|
-
KYA_HOOK_ABI: () => KYA_HOOK_ABI,
|
|
45
46
|
MORPHO_BLUE_ABI: () => MORPHO_BLUE_ABI,
|
|
46
47
|
MorphoClient: () => MorphoClient,
|
|
48
|
+
SAFE7579_ACCOUNT_ABI: () => SAFE7579_ACCOUNT_ABI,
|
|
49
|
+
SAFE_AGENT_FACTORY_ABI: () => SAFE_AGENT_FACTORY_ABI,
|
|
47
50
|
ScoringClient: () => ScoringClient,
|
|
48
51
|
ScoringRejectedError: () => ScoringRejectedError,
|
|
49
52
|
VALIDATION_REGISTRY_ABI: () => VALIDATION_REGISTRY_ABI,
|
|
@@ -120,38 +123,41 @@ var IDENTITY_REGISTRY_ABI = [
|
|
|
120
123
|
"function register() returns (uint256 agentId)",
|
|
121
124
|
"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"
|
|
122
125
|
];
|
|
123
|
-
var
|
|
126
|
+
var SAFE_AGENT_FACTORY_ABI = [
|
|
124
127
|
"function getAccount(uint256 agentId) view returns (address)",
|
|
125
128
|
"function accountExists(uint256 agentId) view returns (bool)",
|
|
126
|
-
"function predictAddress(uint256 agentId) view returns (address)",
|
|
127
129
|
"function totalAccounts() view returns (uint256)",
|
|
128
130
|
"function getAgentId(address account) view returns (uint256)",
|
|
129
|
-
"function
|
|
130
|
-
"function
|
|
131
|
+
"function getAgentIdByIndex(uint256 index) view returns (uint256)",
|
|
132
|
+
"function getAllAgentIds() view returns (uint256[])",
|
|
133
|
+
"function createAccount(uint256 agentId) returns (address safeAccount)",
|
|
131
134
|
"function identityRegistry() view returns (address)",
|
|
132
|
-
"
|
|
135
|
+
"function validationModule() view returns (address)",
|
|
136
|
+
"function hookMultiplexer() view returns (address)",
|
|
137
|
+
"function safeSingleton() view returns (address)",
|
|
138
|
+
"function safe7579() view returns (address)",
|
|
139
|
+
"function bootstrap() view returns (address)",
|
|
140
|
+
"function SENTINEL_OWNER() view returns (address)",
|
|
141
|
+
"event AccountCreated(uint256 indexed agentId, address indexed safeAccount, address indexed owner)"
|
|
133
142
|
];
|
|
134
|
-
var
|
|
135
|
-
|
|
143
|
+
var ACCOUNT_FACTORY_ABI = SAFE_AGENT_FACTORY_ABI;
|
|
144
|
+
var ERC8004_VALIDATION_MODULE_ABI = [
|
|
145
|
+
// View
|
|
146
|
+
"function getConfig(address account) view returns (address registry, uint256 agentId)",
|
|
147
|
+
"function getOwner(address account) view returns (address)",
|
|
148
|
+
"function isInstalled(address account) view returns (bool)",
|
|
149
|
+
"function isKYAApproved(address account) view returns (bool)",
|
|
150
|
+
"function validationRegistry() view returns (address)",
|
|
136
151
|
"function owner() view returns (address)",
|
|
137
|
-
|
|
138
|
-
"function
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
"function
|
|
143
|
-
"function
|
|
144
|
-
|
|
145
|
-
"function
|
|
146
|
-
"function uninstallModule(uint256 moduleTypeId, address module, bytes deInitData) payable",
|
|
147
|
-
"function isModuleInstalled(uint256 moduleTypeId, address module, bytes additionalContext) view returns (bool)",
|
|
148
|
-
"function hook() view returns (address)",
|
|
149
|
-
// Funding (direct, no execution needed)
|
|
150
|
-
"function fund(address token, uint256 amount)",
|
|
151
|
-
"function withdraw(address token, uint256 amount, address to)",
|
|
152
|
-
"function withdrawETH(uint256 amount, address to)",
|
|
153
|
-
// EIP-1271
|
|
154
|
-
"function isValidSignature(bytes32 hash, bytes signature) view returns (bytes4)"
|
|
152
|
+
// Admin (via TimelockController)
|
|
153
|
+
"function setValidationRegistry(address registry_)"
|
|
154
|
+
];
|
|
155
|
+
var HOOK_MULTIPLEXER_ABI = [
|
|
156
|
+
"function getHooks() view returns (address[])",
|
|
157
|
+
"function hookCount() view returns (uint256)",
|
|
158
|
+
"function owner() view returns (address)",
|
|
159
|
+
"function addHook(address hook)",
|
|
160
|
+
"function removeHook(address hook)"
|
|
155
161
|
];
|
|
156
162
|
var AGENT_REPUTATION_ABI = [
|
|
157
163
|
"function getCreditScore(uint256 agentId) view returns (uint256)",
|
|
@@ -197,57 +203,113 @@ var ERC20_ABI = [
|
|
|
197
203
|
"function symbol() view returns (string)",
|
|
198
204
|
"function name() view returns (string)"
|
|
199
205
|
];
|
|
200
|
-
var
|
|
201
|
-
"function
|
|
202
|
-
"function
|
|
206
|
+
var ENTRYPOINT_V07_ABI = [
|
|
207
|
+
"function handleOps(tuple(address sender, uint256 nonce, bytes initCode, bytes callData, bytes32 accountGasLimits, uint256 preVerificationGas, bytes32 gasFees, bytes paymasterAndData, bytes signature)[] ops, address payable beneficiary)",
|
|
208
|
+
"function getUserOpHash(tuple(address sender, uint256 nonce, bytes initCode, bytes callData, bytes32 accountGasLimits, uint256 preVerificationGas, bytes32 gasFees, bytes paymasterAndData, bytes signature) userOp) view returns (bytes32)",
|
|
209
|
+
"function getNonce(address sender, uint192 key) view returns (uint256 nonce)",
|
|
210
|
+
"function balanceOf(address account) view returns (uint256)",
|
|
211
|
+
"function depositTo(address account) payable",
|
|
212
|
+
"event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed)"
|
|
213
|
+
];
|
|
214
|
+
var SAFE7579_ACCOUNT_ABI = [
|
|
215
|
+
// ERC-7579 execution (called via UserOp through Safe7579 fallback)
|
|
216
|
+
"function execute(bytes32 mode, bytes executionCalldata) payable",
|
|
217
|
+
"function executeFromExecutor(bytes32 mode, bytes executionCalldata) payable returns (bytes[])",
|
|
218
|
+
// ERC-7579 module queries
|
|
219
|
+
"function isModuleInstalled(uint256 moduleTypeId, address module, bytes additionalContext) view returns (bool)",
|
|
220
|
+
// EIP-1271
|
|
221
|
+
"function isValidSignature(bytes32 hash, bytes signature) view returns (bytes4)"
|
|
203
222
|
];
|
|
204
223
|
|
|
205
224
|
// src/utils/config.ts
|
|
225
|
+
var ZERO = "0x0000000000000000000000000000000000000000";
|
|
226
|
+
var ENTRYPOINT_V07 = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
|
|
227
|
+
var ERC8004_IDENTITY_REGISTRY = "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
|
|
228
|
+
var ERC8004_IDENTITY_REGISTRY_TESTNET = "0x8004A818BFB912233c491871b3d84c89A494BD9e";
|
|
229
|
+
var MORPHO_BLUE = "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
|
|
230
|
+
var SAFE_SINGLETON = "0x41675C099F32341bf84BFc5382aF534df5C7461a";
|
|
231
|
+
var SAFE_PROXY_FACTORY = "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67";
|
|
232
|
+
var SAFE7579 = "0x7579EE8307284F293B1927136486880611F20002";
|
|
206
233
|
var CONTRACT_ADDRESSES = {
|
|
207
234
|
[1 /* Ethereum */]: {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
235
|
+
safeSingleton: SAFE_SINGLETON,
|
|
236
|
+
safeProxyFactory: SAFE_PROXY_FACTORY,
|
|
237
|
+
safe7579: SAFE7579,
|
|
238
|
+
entryPoint: ENTRYPOINT_V07,
|
|
239
|
+
safeAgentFactory: ZERO,
|
|
240
|
+
safe7579Bootstrap: ZERO,
|
|
241
|
+
erc8004ValidationModule: ZERO,
|
|
242
|
+
hookMultiplexer: ZERO,
|
|
243
|
+
validationRegistry: ZERO,
|
|
244
|
+
agentReputation: ZERO,
|
|
245
|
+
timelockController: ZERO,
|
|
212
246
|
usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
213
|
-
identityRegistry:
|
|
214
|
-
morphoBlue:
|
|
247
|
+
identityRegistry: ERC8004_IDENTITY_REGISTRY,
|
|
248
|
+
morphoBlue: MORPHO_BLUE
|
|
215
249
|
},
|
|
216
250
|
[8453 /* Base */]: {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
251
|
+
safeSingleton: SAFE_SINGLETON,
|
|
252
|
+
safeProxyFactory: SAFE_PROXY_FACTORY,
|
|
253
|
+
safe7579: SAFE7579,
|
|
254
|
+
entryPoint: ENTRYPOINT_V07,
|
|
255
|
+
safeAgentFactory: "0xB0A88ffe28491E793F7706829278f20d724947d1",
|
|
256
|
+
safe7579Bootstrap: "0x72A636bc23B2644138489c3bBE3B05a0a7184b33",
|
|
257
|
+
erc8004ValidationModule: "0x49e27A6B4d012B87271897b51d0296ABcFCb0BBd",
|
|
258
|
+
hookMultiplexer: "0x12c77f17F91f06a11C2C34C618ce9d78f9a34541",
|
|
259
|
+
validationRegistry: "0x88E21e8883c093E4c8d0d0cE68f1c93Cf6190f51",
|
|
260
|
+
agentReputation: "0x4C2d42cbD35f6541f0902499CFEC27C1Cf5683E3",
|
|
261
|
+
timelockController: "0x0517b4f73b61774C88A2B1c5745141315E831015",
|
|
221
262
|
usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
222
|
-
identityRegistry:
|
|
223
|
-
morphoBlue:
|
|
263
|
+
identityRegistry: ERC8004_IDENTITY_REGISTRY,
|
|
264
|
+
morphoBlue: MORPHO_BLUE
|
|
224
265
|
},
|
|
225
266
|
[84532 /* BaseSepolia */]: {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
267
|
+
safeSingleton: SAFE_SINGLETON,
|
|
268
|
+
safeProxyFactory: SAFE_PROXY_FACTORY,
|
|
269
|
+
safe7579: SAFE7579,
|
|
270
|
+
entryPoint: ENTRYPOINT_V07,
|
|
271
|
+
safeAgentFactory: ZERO,
|
|
272
|
+
safe7579Bootstrap: ZERO,
|
|
273
|
+
erc8004ValidationModule: ZERO,
|
|
274
|
+
hookMultiplexer: ZERO,
|
|
275
|
+
validationRegistry: ZERO,
|
|
276
|
+
agentReputation: ZERO,
|
|
277
|
+
timelockController: ZERO,
|
|
230
278
|
usdc: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
231
|
-
identityRegistry:
|
|
232
|
-
morphoBlue:
|
|
279
|
+
identityRegistry: ERC8004_IDENTITY_REGISTRY_TESTNET,
|
|
280
|
+
morphoBlue: ZERO
|
|
233
281
|
},
|
|
234
282
|
[11155111 /* Sepolia */]: {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
283
|
+
safeSingleton: SAFE_SINGLETON,
|
|
284
|
+
safeProxyFactory: SAFE_PROXY_FACTORY,
|
|
285
|
+
safe7579: SAFE7579,
|
|
286
|
+
entryPoint: ENTRYPOINT_V07,
|
|
287
|
+
safeAgentFactory: ZERO,
|
|
288
|
+
safe7579Bootstrap: ZERO,
|
|
289
|
+
erc8004ValidationModule: ZERO,
|
|
290
|
+
hookMultiplexer: ZERO,
|
|
291
|
+
validationRegistry: ZERO,
|
|
292
|
+
agentReputation: ZERO,
|
|
293
|
+
timelockController: ZERO,
|
|
239
294
|
usdc: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
|
|
240
|
-
identityRegistry:
|
|
241
|
-
morphoBlue:
|
|
295
|
+
identityRegistry: ERC8004_IDENTITY_REGISTRY_TESTNET,
|
|
296
|
+
morphoBlue: ZERO
|
|
242
297
|
},
|
|
243
298
|
[31337 /* Hardhat */]: {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
299
|
+
safeSingleton: SAFE_SINGLETON,
|
|
300
|
+
safeProxyFactory: SAFE_PROXY_FACTORY,
|
|
301
|
+
safe7579: SAFE7579,
|
|
302
|
+
entryPoint: ENTRYPOINT_V07,
|
|
303
|
+
safeAgentFactory: ZERO,
|
|
304
|
+
safe7579Bootstrap: ZERO,
|
|
305
|
+
erc8004ValidationModule: ZERO,
|
|
306
|
+
hookMultiplexer: ZERO,
|
|
307
|
+
validationRegistry: ZERO,
|
|
308
|
+
agentReputation: ZERO,
|
|
309
|
+
timelockController: ZERO,
|
|
248
310
|
usdc: "0x56d4d6aEe0278c5Df2FA23Ecb32eC146C9446FDf",
|
|
249
|
-
identityRegistry:
|
|
250
|
-
morphoBlue:
|
|
311
|
+
identityRegistry: ERC8004_IDENTITY_REGISTRY,
|
|
312
|
+
morphoBlue: ZERO
|
|
251
313
|
}
|
|
252
314
|
};
|
|
253
315
|
var RPC_URLS = {
|
|
@@ -292,9 +354,9 @@ var AgetherClient = class _AgetherClient {
|
|
|
292
354
|
this.agentId = options.agentId;
|
|
293
355
|
const provider = options.signer.provider;
|
|
294
356
|
if (!provider) throw new AgetherError("Signer must have a provider", "NO_PROVIDER");
|
|
295
|
-
this.
|
|
296
|
-
options.config.contracts.
|
|
297
|
-
|
|
357
|
+
this.safeAgentFactory = new import_ethers.Contract(
|
|
358
|
+
options.config.contracts.safeAgentFactory,
|
|
359
|
+
SAFE_AGENT_FACTORY_ABI,
|
|
298
360
|
options.signer
|
|
299
361
|
);
|
|
300
362
|
this.identityRegistry = new import_ethers.Contract(
|
|
@@ -302,16 +364,16 @@ var AgetherClient = class _AgetherClient {
|
|
|
302
364
|
IDENTITY_REGISTRY_ABI,
|
|
303
365
|
provider
|
|
304
366
|
);
|
|
305
|
-
this.validationRegistry = new import_ethers.Contract(
|
|
306
|
-
options.config.contracts.validationRegistry,
|
|
307
|
-
VALIDATION_REGISTRY_ABI,
|
|
308
|
-
provider
|
|
309
|
-
);
|
|
310
367
|
this.agentReputation = new import_ethers.Contract(
|
|
311
368
|
options.config.contracts.agentReputation,
|
|
312
369
|
AGENT_REPUTATION_ABI,
|
|
313
370
|
provider
|
|
314
371
|
);
|
|
372
|
+
this.validationModule = new import_ethers.Contract(
|
|
373
|
+
options.config.contracts.erc8004ValidationModule,
|
|
374
|
+
ERC8004_VALIDATION_MODULE_ABI,
|
|
375
|
+
provider
|
|
376
|
+
);
|
|
315
377
|
}
|
|
316
378
|
// Static Factory
|
|
317
379
|
static fromPrivateKey(privateKey, agentId, chainIdOrConfig) {
|
|
@@ -322,26 +384,26 @@ var AgetherClient = class _AgetherClient {
|
|
|
322
384
|
}
|
|
323
385
|
// Account Management
|
|
324
386
|
async createAccount() {
|
|
325
|
-
const tx = await this.
|
|
387
|
+
const tx = await this.safeAgentFactory.createAccount(this.agentId);
|
|
326
388
|
const receipt = await tx.wait();
|
|
327
389
|
const event = receipt.logs.map((log) => {
|
|
328
390
|
try {
|
|
329
|
-
return this.
|
|
391
|
+
return this.safeAgentFactory.interface.parseLog(log);
|
|
330
392
|
} catch (e) {
|
|
331
393
|
console.warn("[agether] createAccount parseLog skip:", e instanceof Error ? e.message : e);
|
|
332
394
|
return null;
|
|
333
395
|
}
|
|
334
396
|
}).find((e) => e?.name === "AccountCreated");
|
|
335
397
|
if (event) {
|
|
336
|
-
this.accountAddress = event.args.
|
|
398
|
+
this.accountAddress = event.args.safeAccount;
|
|
337
399
|
} else {
|
|
338
|
-
this.accountAddress = await this.
|
|
400
|
+
this.accountAddress = await this.safeAgentFactory.getAccount(this.agentId);
|
|
339
401
|
}
|
|
340
402
|
return this.accountAddress;
|
|
341
403
|
}
|
|
342
404
|
async getAccountAddress() {
|
|
343
405
|
if (this.accountAddress) return this.accountAddress;
|
|
344
|
-
const addr = await this.
|
|
406
|
+
const addr = await this.safeAgentFactory.getAccount(this.agentId);
|
|
345
407
|
if (addr === import_ethers.ethers.ZeroAddress) {
|
|
346
408
|
throw new AgetherError("No account found. Create one with createAccount().", "NO_ACCOUNT");
|
|
347
409
|
}
|
|
@@ -349,10 +411,7 @@ var AgetherClient = class _AgetherClient {
|
|
|
349
411
|
return addr;
|
|
350
412
|
}
|
|
351
413
|
async accountExists() {
|
|
352
|
-
return this.
|
|
353
|
-
}
|
|
354
|
-
async predictAddress() {
|
|
355
|
-
return this.accountFactory.predictAddress(this.agentId);
|
|
414
|
+
return this.safeAgentFactory.accountExists(this.agentId);
|
|
356
415
|
}
|
|
357
416
|
// Balances
|
|
358
417
|
async getBalances() {
|
|
@@ -374,10 +433,14 @@ var AgetherClient = class _AgetherClient {
|
|
|
374
433
|
usdc: import_ethers.ethers.formatUnits(acctUsdc, 6)
|
|
375
434
|
};
|
|
376
435
|
} catch (e) {
|
|
377
|
-
console.warn("[agether] getBalances: no
|
|
436
|
+
console.warn("[agether] getBalances: no Safe account or fetch failed:", e instanceof Error ? e.message : e);
|
|
378
437
|
}
|
|
379
438
|
return result;
|
|
380
439
|
}
|
|
440
|
+
/**
|
|
441
|
+
* Fund the Safe account with USDC from EOA.
|
|
442
|
+
* This is a simple ERC-20 transfer (does NOT require a UserOp).
|
|
443
|
+
*/
|
|
381
444
|
async fundAccount(usdcAmount) {
|
|
382
445
|
const acctAddr = await this.getAccountAddress();
|
|
383
446
|
const usdc = new import_ethers.Contract(this.config.contracts.usdc, ERC20_ABI, this.signer);
|
|
@@ -391,37 +454,30 @@ var AgetherClient = class _AgetherClient {
|
|
|
391
454
|
gasUsed: receipt.gasUsed
|
|
392
455
|
};
|
|
393
456
|
}
|
|
394
|
-
async withdrawUsdc(usdcAmount) {
|
|
395
|
-
const acctAddr = await this.getAccountAddress();
|
|
396
|
-
const account = new import_ethers.Contract(acctAddr, AGENT_ACCOUNT_ABI, this.signer);
|
|
397
|
-
const amount = import_ethers.ethers.parseUnits(usdcAmount, 6);
|
|
398
|
-
const eoaAddr = await this.signer.getAddress();
|
|
399
|
-
const tx = await account.withdraw(this.config.contracts.usdc, amount, eoaAddr);
|
|
400
|
-
const receipt = await tx.wait();
|
|
401
|
-
return {
|
|
402
|
-
txHash: receipt.hash,
|
|
403
|
-
blockNumber: receipt.blockNumber,
|
|
404
|
-
status: receipt.status === 1 ? "success" : "failed",
|
|
405
|
-
gasUsed: receipt.gasUsed
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
async withdrawEth(ethAmount) {
|
|
409
|
-
const acctAddr = await this.getAccountAddress();
|
|
410
|
-
const account = new import_ethers.Contract(acctAddr, AGENT_ACCOUNT_ABI, this.signer);
|
|
411
|
-
const amount = import_ethers.ethers.parseEther(ethAmount);
|
|
412
|
-
const eoaAddr = await this.signer.getAddress();
|
|
413
|
-
const tx = await account.withdrawETH(amount, eoaAddr);
|
|
414
|
-
const receipt = await tx.wait();
|
|
415
|
-
return {
|
|
416
|
-
txHash: receipt.hash,
|
|
417
|
-
blockNumber: receipt.blockNumber,
|
|
418
|
-
status: receipt.status === 1 ? "success" : "failed",
|
|
419
|
-
gasUsed: receipt.gasUsed
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
457
|
// Identity & Validation
|
|
458
|
+
/**
|
|
459
|
+
* Check if the KYA gate is active on the validation module.
|
|
460
|
+
* If validationRegistry is not set, all txs pass (KYA disabled).
|
|
461
|
+
*/
|
|
462
|
+
async isKyaRequired() {
|
|
463
|
+
try {
|
|
464
|
+
const registryAddr = await this.validationModule.validationRegistry();
|
|
465
|
+
return registryAddr !== import_ethers.ethers.ZeroAddress;
|
|
466
|
+
} catch {
|
|
467
|
+
return false;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Check if this agent's code is KYA-approved.
|
|
472
|
+
* Uses the ERC8004ValidationModule.isKYAApproved(account) view.
|
|
473
|
+
*/
|
|
423
474
|
async isKyaApproved() {
|
|
424
|
-
|
|
475
|
+
try {
|
|
476
|
+
const acctAddr = await this.getAccountAddress();
|
|
477
|
+
return this.validationModule.isKYAApproved(acctAddr);
|
|
478
|
+
} catch {
|
|
479
|
+
return false;
|
|
480
|
+
}
|
|
425
481
|
}
|
|
426
482
|
async identityExists() {
|
|
427
483
|
try {
|
|
@@ -509,27 +565,24 @@ var MorphoClient = class {
|
|
|
509
565
|
this._eoaAddress = wallet.address;
|
|
510
566
|
}
|
|
511
567
|
const addrs = { ...defaultCfg.contracts, ...config.contracts };
|
|
512
|
-
this.
|
|
568
|
+
this.safeAgentFactory = new import_ethers2.Contract(addrs.safeAgentFactory, ACCOUNT_FACTORY_ABI, this._signer);
|
|
513
569
|
this.morphoBlue = new import_ethers2.Contract(addrs.morphoBlue, MORPHO_BLUE_ABI, this.provider);
|
|
514
570
|
this.agentReputation = new import_ethers2.Contract(addrs.agentReputation, AGENT_REPUTATION_ABI, this._signer);
|
|
515
571
|
this.identityRegistry = new import_ethers2.Contract(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this._signer);
|
|
572
|
+
this.entryPoint = new import_ethers2.Contract(addrs.entryPoint, ENTRYPOINT_V07_ABI, this._signer);
|
|
573
|
+
this.validationModule = new import_ethers2.Contract(addrs.erc8004ValidationModule, ERC8004_VALIDATION_MODULE_ABI, this.provider);
|
|
516
574
|
}
|
|
517
575
|
// ════════════════════════════════════════════════════════
|
|
518
576
|
// KYA Gate Check
|
|
519
577
|
// ════════════════════════════════════════════════════════
|
|
520
578
|
/**
|
|
521
579
|
* Check whether the KYA (Know Your Agent) code verification gate is active.
|
|
522
|
-
* Reads the
|
|
523
|
-
*
|
|
580
|
+
* Reads the ERC8004ValidationModule's validationRegistry — when set to
|
|
581
|
+
* a non-zero address, the module enforces KYA code approval.
|
|
524
582
|
*/
|
|
525
583
|
async isKyaRequired() {
|
|
526
584
|
try {
|
|
527
|
-
const
|
|
528
|
-
const account = new import_ethers2.Contract(acctAddr, AGENT_ACCOUNT_ABI, this.provider);
|
|
529
|
-
const hookAddr = await account.hook();
|
|
530
|
-
if (hookAddr === import_ethers2.ethers.ZeroAddress) return false;
|
|
531
|
-
const hook = new import_ethers2.Contract(hookAddr, KYA_HOOK_ABI, this.provider);
|
|
532
|
-
const registryAddr = await hook.validationRegistry();
|
|
585
|
+
const registryAddr = await this.validationModule.validationRegistry();
|
|
533
586
|
return registryAddr !== import_ethers2.ethers.ZeroAddress;
|
|
534
587
|
} catch {
|
|
535
588
|
return false;
|
|
@@ -546,7 +599,7 @@ var MorphoClient = class {
|
|
|
546
599
|
let lastErr;
|
|
547
600
|
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
548
601
|
try {
|
|
549
|
-
const addr = await this.
|
|
602
|
+
const addr = await this.safeAgentFactory.getAccount(BigInt(this.agentId));
|
|
550
603
|
if (addr === import_ethers2.ethers.ZeroAddress) {
|
|
551
604
|
throw new AgetherError("No AgentAccount found. Call register() first.", "NO_ACCOUNT");
|
|
552
605
|
}
|
|
@@ -624,9 +677,9 @@ var MorphoClient = class {
|
|
|
624
677
|
async register(_name) {
|
|
625
678
|
const eoaAddr = await this.getSignerAddress();
|
|
626
679
|
if (this.agentId) {
|
|
627
|
-
const exists = await this.
|
|
680
|
+
const exists = await this.safeAgentFactory.accountExists(BigInt(this.agentId));
|
|
628
681
|
if (exists) {
|
|
629
|
-
const acct = await this.
|
|
682
|
+
const acct = await this.safeAgentFactory.getAccount(BigInt(this.agentId));
|
|
630
683
|
this._accountAddress = acct;
|
|
631
684
|
const kyaRequired2 = await this.isKyaRequired();
|
|
632
685
|
return { agentId: this.agentId, address: eoaAddr, agentAccount: acct, alreadyRegistered: true, kyaRequired: kyaRequired2 };
|
|
@@ -644,15 +697,15 @@ var MorphoClient = class {
|
|
|
644
697
|
agentId = await this._mintNewIdentity();
|
|
645
698
|
}
|
|
646
699
|
this.agentId = agentId.toString();
|
|
647
|
-
const acctExists = await this.
|
|
700
|
+
const acctExists = await this.safeAgentFactory.accountExists(agentId);
|
|
648
701
|
let txHash;
|
|
649
702
|
if (!acctExists) {
|
|
650
|
-
const tx = await this.
|
|
703
|
+
const tx = await this.safeAgentFactory.createAccount(agentId);
|
|
651
704
|
const receipt = await tx.wait();
|
|
652
705
|
this._refreshSigner();
|
|
653
706
|
txHash = receipt.hash;
|
|
654
707
|
}
|
|
655
|
-
const acctAddr = await this.
|
|
708
|
+
const acctAddr = await this.safeAgentFactory.getAccount(agentId);
|
|
656
709
|
this._accountAddress = acctAddr;
|
|
657
710
|
const kyaRequired = await this.isKyaRequired();
|
|
658
711
|
return {
|
|
@@ -854,7 +907,7 @@ var MorphoClient = class {
|
|
|
854
907
|
const mkt = await this.morphoBlue.market(m.uniqueKey);
|
|
855
908
|
const totalBorrowShares = BigInt(mkt.totalBorrowShares);
|
|
856
909
|
const totalBorrowAssets = BigInt(mkt.totalBorrowAssets);
|
|
857
|
-
debt = totalBorrowShares > 0n ? BigInt(pos.borrowShares) * totalBorrowAssets / totalBorrowShares : 0n;
|
|
910
|
+
debt = totalBorrowShares > 0n ? (BigInt(pos.borrowShares) * totalBorrowAssets + totalBorrowShares - 1n) / totalBorrowShares : 0n;
|
|
858
911
|
totalDebt += debt;
|
|
859
912
|
} catch (e) {
|
|
860
913
|
console.warn(`[agether] debt calc failed for market ${m.uniqueKey}:`, e instanceof Error ? e.message : e);
|
|
@@ -916,7 +969,7 @@ var MorphoClient = class {
|
|
|
916
969
|
const mktState = await this.morphoBlue.market(m.uniqueKey);
|
|
917
970
|
const totalBorrowShares = BigInt(mktState.totalBorrowShares);
|
|
918
971
|
const totalBorrowAssets = BigInt(mktState.totalBorrowAssets);
|
|
919
|
-
const currentDebt = totalBorrowShares > 0n ? BigInt(pos.borrowShares) * totalBorrowAssets / totalBorrowShares : 0n;
|
|
972
|
+
const currentDebt = totalBorrowShares > 0n ? (BigInt(pos.borrowShares) * totalBorrowAssets + totalBorrowShares - 1n) / totalBorrowShares : 0n;
|
|
920
973
|
let collateralValueInLoan;
|
|
921
974
|
try {
|
|
922
975
|
const oracleContract = new import_ethers2.Contract(m.oracle, [
|
|
@@ -1279,13 +1332,14 @@ var MorphoClient = class {
|
|
|
1279
1332
|
if (!colInfo) throw new AgetherError(`Unknown collateral: ${tokenSymbol}`, "UNKNOWN_COLLATERAL");
|
|
1280
1333
|
const params = marketParams ?? await this.findMarketForCollateral(tokenSymbol);
|
|
1281
1334
|
const morphoAddr = this.config.contracts.morphoBlue;
|
|
1335
|
+
const usdcAddr = this.config.contracts.usdc;
|
|
1282
1336
|
const dest = receiver || await this.getSignerAddress();
|
|
1283
1337
|
let weiAmount;
|
|
1338
|
+
const markets = await this.getMarkets();
|
|
1339
|
+
const market = markets.find(
|
|
1340
|
+
(m) => m.collateralAsset?.address.toLowerCase() === colInfo.address.toLowerCase()
|
|
1341
|
+
);
|
|
1284
1342
|
if (amount === "all") {
|
|
1285
|
-
const markets = await this.getMarkets();
|
|
1286
|
-
const market = markets.find(
|
|
1287
|
-
(m) => m.collateralAsset.address.toLowerCase() === colInfo.address.toLowerCase()
|
|
1288
|
-
);
|
|
1289
1343
|
if (!market) throw new AgetherError("Market not found", "MARKET_NOT_FOUND");
|
|
1290
1344
|
const pos = await this.morphoBlue.position(market.uniqueKey, acctAddr);
|
|
1291
1345
|
weiAmount = pos.collateral;
|
|
@@ -1293,19 +1347,65 @@ var MorphoClient = class {
|
|
|
1293
1347
|
} else {
|
|
1294
1348
|
weiAmount = import_ethers2.ethers.parseUnits(amount, colInfo.decimals);
|
|
1295
1349
|
}
|
|
1296
|
-
|
|
1350
|
+
let hasDustDebt = false;
|
|
1351
|
+
let dustBorrowShares = 0n;
|
|
1352
|
+
let dustApproveAmount = 0n;
|
|
1353
|
+
if (market) {
|
|
1354
|
+
try {
|
|
1355
|
+
const pos = await this.morphoBlue.position(market.uniqueKey, acctAddr);
|
|
1356
|
+
dustBorrowShares = BigInt(pos.borrowShares);
|
|
1357
|
+
if (dustBorrowShares > 0n) {
|
|
1358
|
+
hasDustDebt = true;
|
|
1359
|
+
const onChainMkt = await this.morphoBlue.market(market.uniqueKey);
|
|
1360
|
+
const totalBorrowAssets = BigInt(onChainMkt.totalBorrowAssets);
|
|
1361
|
+
const totalBorrowShares = BigInt(onChainMkt.totalBorrowShares);
|
|
1362
|
+
const estimated = totalBorrowShares > 0n ? dustBorrowShares * totalBorrowAssets / totalBorrowShares + 10n : 0n;
|
|
1363
|
+
dustApproveAmount = estimated > 0n ? estimated : import_ethers2.ethers.parseUnits("1", 6);
|
|
1364
|
+
console.log(`[agether] dust borrow shares detected: ${dustBorrowShares} shares \u2248 ${import_ethers2.ethers.formatUnits(dustApproveAmount, 6)} USDC \u2014 auto-repaying before withdraw`);
|
|
1365
|
+
}
|
|
1366
|
+
} catch (e) {
|
|
1367
|
+
console.warn("[agether] failed to check borrow shares before withdraw:", e instanceof Error ? e.message : e);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
const withdrawData = morphoIface.encodeFunctionData("withdrawCollateral", [
|
|
1297
1371
|
this._toTuple(params),
|
|
1298
1372
|
weiAmount,
|
|
1299
1373
|
acctAddr,
|
|
1300
1374
|
dest
|
|
1301
1375
|
]);
|
|
1302
|
-
|
|
1376
|
+
let receipt;
|
|
1377
|
+
if (hasDustDebt) {
|
|
1378
|
+
const usdcContract = new import_ethers2.Contract(usdcAddr, ERC20_ABI, this._signer);
|
|
1379
|
+
const acctBalance = await usdcContract.balanceOf(acctAddr);
|
|
1380
|
+
if (acctBalance < dustApproveAmount) {
|
|
1381
|
+
const shortfall = dustApproveAmount - acctBalance;
|
|
1382
|
+
const eoaBalance = await usdcContract.balanceOf(await this.getSignerAddress());
|
|
1383
|
+
if (eoaBalance >= shortfall) {
|
|
1384
|
+
console.log(`[agether] transferring ${import_ethers2.ethers.formatUnits(shortfall, 6)} USDC from EOA \u2192 AgentAccount for dust repay`);
|
|
1385
|
+
const transferTx = await usdcContract.transfer(acctAddr, shortfall);
|
|
1386
|
+
await transferTx.wait();
|
|
1387
|
+
this._refreshSigner();
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
const targets = [usdcAddr, morphoAddr, morphoAddr];
|
|
1391
|
+
const values = [0n, 0n, 0n];
|
|
1392
|
+
const datas = [
|
|
1393
|
+
erc20Iface.encodeFunctionData("approve", [morphoAddr, dustApproveAmount]),
|
|
1394
|
+
morphoIface.encodeFunctionData("repay", [
|
|
1395
|
+
this._toTuple(params),
|
|
1396
|
+
0n,
|
|
1397
|
+
dustBorrowShares,
|
|
1398
|
+
acctAddr,
|
|
1399
|
+
"0x"
|
|
1400
|
+
]),
|
|
1401
|
+
withdrawData
|
|
1402
|
+
];
|
|
1403
|
+
receipt = await this.batch(targets, values, datas);
|
|
1404
|
+
} else {
|
|
1405
|
+
receipt = await this.exec(morphoAddr, withdrawData);
|
|
1406
|
+
}
|
|
1303
1407
|
let remainingCollateral = "0";
|
|
1304
1408
|
try {
|
|
1305
|
-
const markets = await this.getMarkets();
|
|
1306
|
-
const market = markets.find(
|
|
1307
|
-
(m) => m.collateralAsset.address.toLowerCase() === colInfo.address.toLowerCase()
|
|
1308
|
-
);
|
|
1309
1409
|
if (market) {
|
|
1310
1410
|
const pos = await this.morphoBlue.position(market.uniqueKey, acctAddr);
|
|
1311
1411
|
remainingCollateral = import_ethers2.ethers.formatUnits(pos.collateral, colInfo.decimals);
|
|
@@ -1332,7 +1432,7 @@ var MorphoClient = class {
|
|
|
1332
1432
|
if (target.address) {
|
|
1333
1433
|
targetAddr = target.address;
|
|
1334
1434
|
} else if (target.agentId) {
|
|
1335
|
-
targetAddr = await this.
|
|
1435
|
+
targetAddr = await this.safeAgentFactory.getAccount(BigInt(target.agentId));
|
|
1336
1436
|
if (targetAddr === import_ethers2.ethers.ZeroAddress) throw new AgetherError("Target agent has no account", "NO_ACCOUNT");
|
|
1337
1437
|
} else {
|
|
1338
1438
|
throw new AgetherError("Provide agentId or address", "INVALID_TARGET");
|
|
@@ -1385,7 +1485,9 @@ var MorphoClient = class {
|
|
|
1385
1485
|
_refreshSigner() {
|
|
1386
1486
|
if (this._useExternalSigner) {
|
|
1387
1487
|
const addrs = this.config.contracts;
|
|
1388
|
-
this.
|
|
1488
|
+
this.safeAgentFactory = new import_ethers2.Contract(addrs.safeAgentFactory, ACCOUNT_FACTORY_ABI, this._signer);
|
|
1489
|
+
this.entryPoint = new import_ethers2.Contract(addrs.entryPoint, ENTRYPOINT_V07_ABI, this._signer);
|
|
1490
|
+
this.validationModule = new import_ethers2.Contract(addrs.erc8004ValidationModule, ERC8004_VALIDATION_MODULE_ABI, this.provider);
|
|
1389
1491
|
this.agentReputation = new import_ethers2.Contract(addrs.agentReputation, AGENT_REPUTATION_ABI, this._signer);
|
|
1390
1492
|
this.identityRegistry = new import_ethers2.Contract(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this._signer);
|
|
1391
1493
|
} else {
|
|
@@ -1394,57 +1496,87 @@ var MorphoClient = class {
|
|
|
1394
1496
|
this._signer = wallet;
|
|
1395
1497
|
this._eoaAddress = wallet.address;
|
|
1396
1498
|
const addrs = this.config.contracts;
|
|
1397
|
-
this.
|
|
1499
|
+
this.safeAgentFactory = new import_ethers2.Contract(addrs.safeAgentFactory, ACCOUNT_FACTORY_ABI, this._signer);
|
|
1500
|
+
this.entryPoint = new import_ethers2.Contract(addrs.entryPoint, ENTRYPOINT_V07_ABI, this._signer);
|
|
1501
|
+
this.validationModule = new import_ethers2.Contract(addrs.erc8004ValidationModule, ERC8004_VALIDATION_MODULE_ABI, this.provider);
|
|
1398
1502
|
this.agentReputation = new import_ethers2.Contract(addrs.agentReputation, AGENT_REPUTATION_ABI, this._signer);
|
|
1399
1503
|
this.identityRegistry = new import_ethers2.Contract(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this._signer);
|
|
1400
1504
|
}
|
|
1401
1505
|
}
|
|
1506
|
+
// ────────────────────────────────────────────────────────────
|
|
1507
|
+
// ERC-4337 UserOp helpers (Safe + Safe7579 + EntryPoint v0.7)
|
|
1508
|
+
// ────────────────────────────────────────────────────────────
|
|
1402
1509
|
/**
|
|
1403
|
-
*
|
|
1510
|
+
* Pack two uint128 values into a single bytes32:
|
|
1511
|
+
* bytes32 = (hi << 128) | lo
|
|
1512
|
+
*/
|
|
1513
|
+
_packUint128(hi, lo) {
|
|
1514
|
+
return import_ethers2.ethers.zeroPadValue(import_ethers2.ethers.toBeHex(hi << 128n | lo), 32);
|
|
1515
|
+
}
|
|
1516
|
+
/**
|
|
1517
|
+
* Build, sign and submit a PackedUserOperation through EntryPoint.handleOps.
|
|
1518
|
+
*
|
|
1519
|
+
* @param callData – the ABI-encoded calldata for the Safe7579 account
|
|
1520
|
+
* (e.g. `execute(mode, executionCalldata)`)
|
|
1521
|
+
* @returns the transaction receipt of the handleOps call
|
|
1522
|
+
*/
|
|
1523
|
+
async _submitUserOp(callData) {
|
|
1524
|
+
const sender = await this.getAccountAddress();
|
|
1525
|
+
const nonce = await this.entryPoint.getNonce(sender, 0);
|
|
1526
|
+
const feeData = await this.provider.getFeeData();
|
|
1527
|
+
const maxFeePerGas = feeData.maxFeePerGas ?? import_ethers2.ethers.parseUnits("0.5", "gwei");
|
|
1528
|
+
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? import_ethers2.ethers.parseUnits("0.1", "gwei");
|
|
1529
|
+
const verificationGasLimit = 500000n;
|
|
1530
|
+
const callGasLimit = 800000n;
|
|
1531
|
+
const preVerificationGas = 100000n;
|
|
1532
|
+
const accountGasLimits = this._packUint128(verificationGasLimit, callGasLimit);
|
|
1533
|
+
const gasFees = this._packUint128(maxPriorityFeePerGas, maxFeePerGas);
|
|
1534
|
+
const userOp = {
|
|
1535
|
+
sender,
|
|
1536
|
+
nonce,
|
|
1537
|
+
initCode: "0x",
|
|
1538
|
+
callData,
|
|
1539
|
+
accountGasLimits,
|
|
1540
|
+
preVerificationGas,
|
|
1541
|
+
gasFees,
|
|
1542
|
+
paymasterAndData: "0x",
|
|
1543
|
+
signature: "0x"
|
|
1544
|
+
// placeholder — replaced after signing
|
|
1545
|
+
};
|
|
1546
|
+
const userOpHash = await this.entryPoint.getUserOpHash(userOp);
|
|
1547
|
+
const signature = await this._signer.signMessage(import_ethers2.ethers.getBytes(userOpHash));
|
|
1548
|
+
userOp.signature = signature;
|
|
1549
|
+
const tx = await this.entryPoint.handleOps([userOp], await this.getSignerAddress());
|
|
1550
|
+
const receipt = await tx.wait();
|
|
1551
|
+
this._refreshSigner();
|
|
1552
|
+
return receipt;
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* Execute a single call via Safe7579 account (ERC-7579 single mode)
|
|
1556
|
+
* through an ERC-4337 UserOperation.
|
|
1404
1557
|
*/
|
|
1405
1558
|
async exec(target, data, value = 0n) {
|
|
1406
|
-
const acctAddr = await this.getAccountAddress();
|
|
1407
|
-
const account = new import_ethers2.Contract(acctAddr, AGENT_ACCOUNT_ABI, this._signer);
|
|
1408
1559
|
const executionCalldata = import_ethers2.ethers.AbiCoder.defaultAbiCoder().encode(
|
|
1409
1560
|
["address", "uint256", "bytes"],
|
|
1410
1561
|
[target, value, data]
|
|
1411
1562
|
);
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
gasLimit = estimate * 130n / 100n;
|
|
1416
|
-
} catch (e) {
|
|
1417
|
-
console.warn("[agether] exec gas estimation failed, using default 500k:", e instanceof Error ? e.message : e);
|
|
1418
|
-
gasLimit = 500000n;
|
|
1419
|
-
}
|
|
1420
|
-
const tx = await account.execute(MODE_SINGLE, executionCalldata, { gasLimit });
|
|
1421
|
-
const receipt = await tx.wait();
|
|
1422
|
-
this._refreshSigner();
|
|
1423
|
-
return receipt;
|
|
1563
|
+
const safe7579Iface = new import_ethers2.ethers.Interface(SAFE7579_ACCOUNT_ABI);
|
|
1564
|
+
const callData = safe7579Iface.encodeFunctionData("execute", [MODE_SINGLE, executionCalldata]);
|
|
1565
|
+
return this._submitUserOp(callData);
|
|
1424
1566
|
}
|
|
1425
1567
|
/**
|
|
1426
|
-
* Execute multiple calls via
|
|
1568
|
+
* Execute multiple calls via Safe7579 account (ERC-7579 batch mode)
|
|
1569
|
+
* through an ERC-4337 UserOperation.
|
|
1427
1570
|
*/
|
|
1428
1571
|
async batch(targets, values, datas) {
|
|
1429
|
-
const acctAddr = await this.getAccountAddress();
|
|
1430
|
-
const account = new import_ethers2.Contract(acctAddr, AGENT_ACCOUNT_ABI, this._signer);
|
|
1431
1572
|
const executions = targets.map((t, i) => [t, values[i], datas[i]]);
|
|
1432
1573
|
const executionCalldata = import_ethers2.ethers.AbiCoder.defaultAbiCoder().encode(
|
|
1433
1574
|
["(address,uint256,bytes)[]"],
|
|
1434
1575
|
[executions]
|
|
1435
1576
|
);
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
gasLimit = estimate * 130n / 100n;
|
|
1440
|
-
} catch (e) {
|
|
1441
|
-
console.warn("[agether] batch gas estimation failed, using default 800k:", e instanceof Error ? e.message : e);
|
|
1442
|
-
gasLimit = 800000n;
|
|
1443
|
-
}
|
|
1444
|
-
const tx = await account.execute(MODE_BATCH, executionCalldata, { gasLimit });
|
|
1445
|
-
const receipt = await tx.wait();
|
|
1446
|
-
this._refreshSigner();
|
|
1447
|
-
return receipt;
|
|
1577
|
+
const safe7579Iface = new import_ethers2.ethers.Interface(SAFE7579_ACCOUNT_ABI);
|
|
1578
|
+
const callData = safe7579Iface.encodeFunctionData("execute", [MODE_BATCH, executionCalldata]);
|
|
1579
|
+
return this._submitUserOp(callData);
|
|
1448
1580
|
}
|
|
1449
1581
|
/** Convert MorphoMarketParams to Solidity tuple. */
|
|
1450
1582
|
_toTuple(p) {
|
|
@@ -2271,19 +2403,22 @@ function rateToBps(rate) {
|
|
|
2271
2403
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2272
2404
|
0 && (module.exports = {
|
|
2273
2405
|
ACCOUNT_FACTORY_ABI,
|
|
2274
|
-
AGENT_ACCOUNT_ABI,
|
|
2275
2406
|
AGENT_REPUTATION_ABI,
|
|
2276
2407
|
AgentIdentityClient,
|
|
2277
2408
|
AgentNotApprovedError,
|
|
2278
2409
|
AgetherClient,
|
|
2279
2410
|
AgetherError,
|
|
2280
2411
|
ChainId,
|
|
2412
|
+
ENTRYPOINT_V07_ABI,
|
|
2281
2413
|
ERC20_ABI,
|
|
2414
|
+
ERC8004_VALIDATION_MODULE_ABI,
|
|
2415
|
+
HOOK_MULTIPLEXER_ABI,
|
|
2282
2416
|
IDENTITY_REGISTRY_ABI,
|
|
2283
2417
|
InsufficientBalanceError,
|
|
2284
|
-
KYA_HOOK_ABI,
|
|
2285
2418
|
MORPHO_BLUE_ABI,
|
|
2286
2419
|
MorphoClient,
|
|
2420
|
+
SAFE7579_ACCOUNT_ABI,
|
|
2421
|
+
SAFE_AGENT_FACTORY_ABI,
|
|
2287
2422
|
ScoringClient,
|
|
2288
2423
|
ScoringRejectedError,
|
|
2289
2424
|
VALIDATION_REGISTRY_ABI,
|