@agether/sdk 1.5.2 → 1.5.3

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MorphoClient
3
- } from "./chunk-GAFDBPDW.mjs";
3
+ } from "./chunk-OMCWZ3VN.mjs";
4
4
  export {
5
5
  MorphoClient
6
6
  };
@@ -224,8 +224,8 @@ var MorphoClient = class {
224
224
  const addrs = { ...defaultCfg.contracts, ...config.contracts };
225
225
  this.accountFactory = new Contract(addrs.accountFactory, ACCOUNT_FACTORY_ABI, this.wallet);
226
226
  this.morphoBlue = new Contract(addrs.morphoBlue, MORPHO_BLUE_ABI, this.provider);
227
- this.agentReputation = new Contract(addrs.agentReputation, AGENT_REPUTATION_ABI, this.provider);
228
- this.identityRegistry = new Contract(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this.provider);
227
+ this.agentReputation = new Contract(addrs.agentReputation, AGENT_REPUTATION_ABI, this.wallet);
228
+ this.identityRegistry = new Contract(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this.wallet);
229
229
  }
230
230
  // ════════════════════════════════════════════════════════
231
231
  // Account Management
@@ -266,6 +266,11 @@ var MorphoClient = class {
266
266
  let agentId;
267
267
  if (balance > 0n && this.agentId) {
268
268
  agentId = BigInt(this.agentId);
269
+ } else if (balance > 0n) {
270
+ throw new AgetherError(
271
+ "Wallet already has an ERC-8004 identity but agentId is unknown. Pass agentId in config.",
272
+ "AGENT_ID_UNKNOWN"
273
+ );
269
274
  } else {
270
275
  const regTx = await this.identityRegistry.register();
271
276
  const regReceipt = await regTx.wait();
package/dist/cli.js CHANGED
@@ -232,8 +232,8 @@ var init_MorphoClient = __esm({
232
232
  const addrs = { ...defaultCfg.contracts, ...config.contracts };
233
233
  this.accountFactory = new import_ethers.Contract(addrs.accountFactory, ACCOUNT_FACTORY_ABI, this.wallet);
234
234
  this.morphoBlue = new import_ethers.Contract(addrs.morphoBlue, MORPHO_BLUE_ABI, this.provider);
235
- this.agentReputation = new import_ethers.Contract(addrs.agentReputation, AGENT_REPUTATION_ABI, this.provider);
236
- this.identityRegistry = new import_ethers.Contract(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this.provider);
235
+ this.agentReputation = new import_ethers.Contract(addrs.agentReputation, AGENT_REPUTATION_ABI, this.wallet);
236
+ this.identityRegistry = new import_ethers.Contract(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this.wallet);
237
237
  }
238
238
  // ════════════════════════════════════════════════════════
239
239
  // Account Management
@@ -274,6 +274,11 @@ var init_MorphoClient = __esm({
274
274
  let agentId;
275
275
  if (balance > 0n && this.agentId) {
276
276
  agentId = BigInt(this.agentId);
277
+ } else if (balance > 0n) {
278
+ throw new AgetherError(
279
+ "Wallet already has an ERC-8004 identity but agentId is unknown. Pass agentId in config.",
280
+ "AGENT_ID_UNKNOWN"
281
+ );
277
282
  } else {
278
283
  const regTx = await this.identityRegistry.register();
279
284
  const regReceipt = await regTx.wait();
package/dist/cli.mjs CHANGED
@@ -44,7 +44,7 @@ async function waitForTx(tx, retries = 5) {
44
44
  throw new Error("Failed to get transaction receipt after retries");
45
45
  }
46
46
  async function getMorphoClient(config) {
47
- const { MorphoClient } = await import("./MorphoClient-3UAKN2VR.mjs");
47
+ const { MorphoClient } = await import("./MorphoClient-AV27HBOF.mjs");
48
48
  return new MorphoClient({
49
49
  privateKey: config.privateKey,
50
50
  rpcUrl: config.rpcUrl,
package/dist/index.js CHANGED
@@ -467,8 +467,8 @@ var MorphoClient = class {
467
467
  const addrs = { ...defaultCfg.contracts, ...config.contracts };
468
468
  this.accountFactory = new import_ethers2.Contract(addrs.accountFactory, ACCOUNT_FACTORY_ABI, this.wallet);
469
469
  this.morphoBlue = new import_ethers2.Contract(addrs.morphoBlue, MORPHO_BLUE_ABI, this.provider);
470
- this.agentReputation = new import_ethers2.Contract(addrs.agentReputation, AGENT_REPUTATION_ABI, this.provider);
471
- this.identityRegistry = new import_ethers2.Contract(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this.provider);
470
+ this.agentReputation = new import_ethers2.Contract(addrs.agentReputation, AGENT_REPUTATION_ABI, this.wallet);
471
+ this.identityRegistry = new import_ethers2.Contract(addrs.identityRegistry, IDENTITY_REGISTRY_ABI, this.wallet);
472
472
  }
473
473
  // ════════════════════════════════════════════════════════
474
474
  // Account Management
@@ -509,6 +509,11 @@ var MorphoClient = class {
509
509
  let agentId;
510
510
  if (balance > 0n && this.agentId) {
511
511
  agentId = BigInt(this.agentId);
512
+ } else if (balance > 0n) {
513
+ throw new AgetherError(
514
+ "Wallet already has an ERC-8004 identity but agentId is unknown. Pass agentId in config.",
515
+ "AGENT_ID_UNKNOWN"
516
+ );
512
517
  } else {
513
518
  const regTx = await this.identityRegistry.register();
514
519
  const regReceipt = await regTx.wait();
package/dist/index.mjs CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  VALIDATION_REGISTRY_ABI,
15
15
  createConfig,
16
16
  getDefaultConfig
17
- } from "./chunk-GAFDBPDW.mjs";
17
+ } from "./chunk-OMCWZ3VN.mjs";
18
18
  import {
19
19
  X402Client
20
20
  } from "./chunk-PTXYOTCG.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agether/sdk",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
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",