@agether/sdk 2.1.0 → 2.3.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
@@ -191,13 +191,13 @@ var init_config = __esm({
191
191
  safeProxyFactory: SAFE_PROXY_FACTORY,
192
192
  safe7579: SAFE7579,
193
193
  entryPoint: ENTRYPOINT_V07,
194
- agether4337Factory: "0x7B23470dCD65b8fEA3Bf49466860b3A55D56268C",
195
- agether7579Bootstrap: "0x62d34D22D379367EEDcb7D1E4dE899A654E982D0",
196
- erc8004ValidationModule: "0xfC6ccFd12e163460C7Ef92d38DC0be6C6cA10f6C",
197
- agetherHookMultiplexer: "0x094FE93a8b733a97a6945530cA83058CaCbf5278",
194
+ agether4337Factory: "0x67DE66D07ff3dba0092C21f070f8a0f53D657BC3",
195
+ agether7579Bootstrap: "0xCc83AA714c05B7141B21a17e80EB21bD09652b27",
196
+ erc8004ValidationModule: "0xde896C58163b5f6cAC5B16C1b0109843f26106F6",
197
+ agetherHookMultiplexer: "0x4AB6DaD0f7360fa8d8c75889A5c206B65d7CbeDb",
198
198
  validationRegistry: ZERO,
199
- agether8004Scorer: "0x9f0084E5c941365149c8953133cF062E33a19b8d",
200
- timelockController: "0x2807912DA2a7278AF883a376bE15bBBf3ab99f52",
199
+ agether8004Scorer: "0x56c7D35A976fac67b1993b66b861fCA32f59104F",
200
+ timelockController: "0xc600e7AAB8a230326C714CE66f356fdf6aC021d8",
201
201
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
202
202
  identityRegistry: ERC8004_IDENTITY_REGISTRY,
203
203
  morphoBlue: MORPHO_BLUE
@@ -1280,7 +1280,9 @@ var init_MorphoClient = __esm({
1280
1280
  */
1281
1281
  async _submitUserOp(callData) {
1282
1282
  const sender = await this.getAccountAddress();
1283
- const nonce = await this.entryPoint.getNonce(sender, 0);
1283
+ const validatorAddr = this.config.contracts.erc8004ValidationModule;
1284
+ const nonceKey = BigInt(validatorAddr) << 32n;
1285
+ const nonce = await this.entryPoint.getNonce(sender, nonceKey);
1284
1286
  const feeData = await this.provider.getFeeData();
1285
1287
  const maxFeePerGas = feeData.maxFeePerGas ?? import_ethers.ethers.parseUnits("0.5", "gwei");
1286
1288
  const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? import_ethers.ethers.parseUnits("0.1", "gwei");
@@ -1289,6 +1291,18 @@ var init_MorphoClient = __esm({
1289
1291
  const preVerificationGas = 100000n;
1290
1292
  const accountGasLimits = this._packUint128(verificationGasLimit, callGasLimit);
1291
1293
  const gasFees = this._packUint128(maxPriorityFeePerGas, maxFeePerGas);
1294
+ const requiredPrefund = (verificationGasLimit + callGasLimit + preVerificationGas) * maxFeePerGas;
1295
+ const accountBalance = await this.provider.getBalance(sender);
1296
+ if (accountBalance < requiredPrefund) {
1297
+ const topUp = requiredPrefund - accountBalance;
1298
+ const topUpWithBuffer = topUp * 120n / 100n;
1299
+ const fundTx = await this._signer.sendTransaction({
1300
+ to: sender,
1301
+ value: topUpWithBuffer
1302
+ });
1303
+ await fundTx.wait();
1304
+ this._refreshSigner();
1305
+ }
1292
1306
  const userOp = {
1293
1307
  sender,
1294
1308
  nonce,
package/dist/index.js CHANGED
@@ -259,13 +259,13 @@ var CONTRACT_ADDRESSES = {
259
259
  safeProxyFactory: SAFE_PROXY_FACTORY,
260
260
  safe7579: SAFE7579,
261
261
  entryPoint: ENTRYPOINT_V07,
262
- agether4337Factory: "0x7B23470dCD65b8fEA3Bf49466860b3A55D56268C",
263
- agether7579Bootstrap: "0x62d34D22D379367EEDcb7D1E4dE899A654E982D0",
264
- erc8004ValidationModule: "0xfC6ccFd12e163460C7Ef92d38DC0be6C6cA10f6C",
265
- agetherHookMultiplexer: "0x094FE93a8b733a97a6945530cA83058CaCbf5278",
262
+ agether4337Factory: "0x67DE66D07ff3dba0092C21f070f8a0f53D657BC3",
263
+ agether7579Bootstrap: "0xCc83AA714c05B7141B21a17e80EB21bD09652b27",
264
+ erc8004ValidationModule: "0xde896C58163b5f6cAC5B16C1b0109843f26106F6",
265
+ agetherHookMultiplexer: "0x4AB6DaD0f7360fa8d8c75889A5c206B65d7CbeDb",
266
266
  validationRegistry: ZERO,
267
- agether8004Scorer: "0x9f0084E5c941365149c8953133cF062E33a19b8d",
268
- timelockController: "0x2807912DA2a7278AF883a376bE15bBBf3ab99f52",
267
+ agether8004Scorer: "0x56c7D35A976fac67b1993b66b861fCA32f59104F",
268
+ timelockController: "0xc600e7AAB8a230326C714CE66f356fdf6aC021d8",
269
269
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
270
270
  identityRegistry: ERC8004_IDENTITY_REGISTRY,
271
271
  morphoBlue: MORPHO_BLUE
@@ -1529,7 +1529,9 @@ var MorphoClient = class {
1529
1529
  */
1530
1530
  async _submitUserOp(callData) {
1531
1531
  const sender = await this.getAccountAddress();
1532
- const nonce = await this.entryPoint.getNonce(sender, 0);
1532
+ const validatorAddr = this.config.contracts.erc8004ValidationModule;
1533
+ const nonceKey = BigInt(validatorAddr) << 32n;
1534
+ const nonce = await this.entryPoint.getNonce(sender, nonceKey);
1533
1535
  const feeData = await this.provider.getFeeData();
1534
1536
  const maxFeePerGas = feeData.maxFeePerGas ?? import_ethers2.ethers.parseUnits("0.5", "gwei");
1535
1537
  const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? import_ethers2.ethers.parseUnits("0.1", "gwei");
@@ -1538,6 +1540,18 @@ var MorphoClient = class {
1538
1540
  const preVerificationGas = 100000n;
1539
1541
  const accountGasLimits = this._packUint128(verificationGasLimit, callGasLimit);
1540
1542
  const gasFees = this._packUint128(maxPriorityFeePerGas, maxFeePerGas);
1543
+ const requiredPrefund = (verificationGasLimit + callGasLimit + preVerificationGas) * maxFeePerGas;
1544
+ const accountBalance = await this.provider.getBalance(sender);
1545
+ if (accountBalance < requiredPrefund) {
1546
+ const topUp = requiredPrefund - accountBalance;
1547
+ const topUpWithBuffer = topUp * 120n / 100n;
1548
+ const fundTx = await this._signer.sendTransaction({
1549
+ to: sender,
1550
+ value: topUpWithBuffer
1551
+ });
1552
+ await fundTx.wait();
1553
+ this._refreshSigner();
1554
+ }
1541
1555
  const userOp = {
1542
1556
  sender,
1543
1557
  nonce,
package/dist/index.mjs CHANGED
@@ -187,13 +187,13 @@ var CONTRACT_ADDRESSES = {
187
187
  safeProxyFactory: SAFE_PROXY_FACTORY,
188
188
  safe7579: SAFE7579,
189
189
  entryPoint: ENTRYPOINT_V07,
190
- agether4337Factory: "0x7B23470dCD65b8fEA3Bf49466860b3A55D56268C",
191
- agether7579Bootstrap: "0x62d34D22D379367EEDcb7D1E4dE899A654E982D0",
192
- erc8004ValidationModule: "0xfC6ccFd12e163460C7Ef92d38DC0be6C6cA10f6C",
193
- agetherHookMultiplexer: "0x094FE93a8b733a97a6945530cA83058CaCbf5278",
190
+ agether4337Factory: "0x67DE66D07ff3dba0092C21f070f8a0f53D657BC3",
191
+ agether7579Bootstrap: "0xCc83AA714c05B7141B21a17e80EB21bD09652b27",
192
+ erc8004ValidationModule: "0xde896C58163b5f6cAC5B16C1b0109843f26106F6",
193
+ agetherHookMultiplexer: "0x4AB6DaD0f7360fa8d8c75889A5c206B65d7CbeDb",
194
194
  validationRegistry: ZERO,
195
- agether8004Scorer: "0x9f0084E5c941365149c8953133cF062E33a19b8d",
196
- timelockController: "0x2807912DA2a7278AF883a376bE15bBBf3ab99f52",
195
+ agether8004Scorer: "0x56c7D35A976fac67b1993b66b861fCA32f59104F",
196
+ timelockController: "0xc600e7AAB8a230326C714CE66f356fdf6aC021d8",
197
197
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
198
198
  identityRegistry: ERC8004_IDENTITY_REGISTRY,
199
199
  morphoBlue: MORPHO_BLUE
@@ -1457,7 +1457,9 @@ var MorphoClient = class {
1457
1457
  */
1458
1458
  async _submitUserOp(callData) {
1459
1459
  const sender = await this.getAccountAddress();
1460
- const nonce = await this.entryPoint.getNonce(sender, 0);
1460
+ const validatorAddr = this.config.contracts.erc8004ValidationModule;
1461
+ const nonceKey = BigInt(validatorAddr) << 32n;
1462
+ const nonce = await this.entryPoint.getNonce(sender, nonceKey);
1461
1463
  const feeData = await this.provider.getFeeData();
1462
1464
  const maxFeePerGas = feeData.maxFeePerGas ?? ethers2.parseUnits("0.5", "gwei");
1463
1465
  const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? ethers2.parseUnits("0.1", "gwei");
@@ -1466,6 +1468,18 @@ var MorphoClient = class {
1466
1468
  const preVerificationGas = 100000n;
1467
1469
  const accountGasLimits = this._packUint128(verificationGasLimit, callGasLimit);
1468
1470
  const gasFees = this._packUint128(maxPriorityFeePerGas, maxFeePerGas);
1471
+ const requiredPrefund = (verificationGasLimit + callGasLimit + preVerificationGas) * maxFeePerGas;
1472
+ const accountBalance = await this.provider.getBalance(sender);
1473
+ if (accountBalance < requiredPrefund) {
1474
+ const topUp = requiredPrefund - accountBalance;
1475
+ const topUpWithBuffer = topUp * 120n / 100n;
1476
+ const fundTx = await this._signer.sendTransaction({
1477
+ to: sender,
1478
+ value: topUpWithBuffer
1479
+ });
1480
+ await fundTx.wait();
1481
+ this._refreshSigner();
1482
+ }
1469
1483
  const userOp = {
1470
1484
  sender,
1471
1485
  nonce,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agether/sdk",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "TypeScript SDK for Agether - autonomous credit for AI agents on Base",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",