@agether/sdk 2.12.0 → 2.12.2
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 +22 -0
- package/dist/index.js +22 -0
- package/dist/index.mjs +22 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -58,6 +58,7 @@ var init_abis = __esm({
|
|
|
58
58
|
"function exists(uint256 agentId) view returns (bool)",
|
|
59
59
|
"function register() returns (uint256 agentId)",
|
|
60
60
|
"function register(string agentURI) returns (uint256 agentId)",
|
|
61
|
+
"function setAgentURI(uint256 agentId, string newURI)",
|
|
61
62
|
"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"
|
|
62
63
|
];
|
|
63
64
|
AGETHER_4337_FACTORY_ABI = [
|
|
@@ -1837,6 +1838,27 @@ var init_AgetherClient = __esm({
|
|
|
1837
1838
|
}
|
|
1838
1839
|
const acctAddr = await this.agether4337Factory.getAccount(agentId);
|
|
1839
1840
|
this.accountAddress = acctAddr;
|
|
1841
|
+
if (!acctExists) {
|
|
1842
|
+
try {
|
|
1843
|
+
const updatedMeta = JSON.stringify({
|
|
1844
|
+
type: "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
|
|
1845
|
+
name: options?.name || "Unnamed Agent",
|
|
1846
|
+
description: options?.description || "AI agent registered via @agether/sdk",
|
|
1847
|
+
active: true,
|
|
1848
|
+
wallet: `eip155:${this.config.chainId}:${acctAddr}`,
|
|
1849
|
+
registrations: [{
|
|
1850
|
+
agentId: Number(agentId),
|
|
1851
|
+
agentRegistry: `eip155:${this.config.chainId}:${this.config.contracts.identityRegistry}`
|
|
1852
|
+
}]
|
|
1853
|
+
});
|
|
1854
|
+
const finalURI = `data:application/json;base64,${Buffer.from(updatedMeta).toString("base64")}`;
|
|
1855
|
+
const uriTx = await this.identityRegistry.setAgentURI(agentId, finalURI);
|
|
1856
|
+
await uriTx.wait();
|
|
1857
|
+
this._refreshSigner();
|
|
1858
|
+
} catch (e) {
|
|
1859
|
+
console.warn("[agether] setAgentURI failed (non-fatal):", e instanceof Error ? e.message : e);
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1840
1862
|
const kyaRequired = await this.isKyaRequired();
|
|
1841
1863
|
return {
|
|
1842
1864
|
agentId: agentId.toString(),
|
package/dist/index.js
CHANGED
|
@@ -129,6 +129,7 @@ var IDENTITY_REGISTRY_ABI = [
|
|
|
129
129
|
"function exists(uint256 agentId) view returns (bool)",
|
|
130
130
|
"function register() returns (uint256 agentId)",
|
|
131
131
|
"function register(string agentURI) returns (uint256 agentId)",
|
|
132
|
+
"function setAgentURI(uint256 agentId, string newURI)",
|
|
132
133
|
"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"
|
|
133
134
|
];
|
|
134
135
|
var AGETHER_4337_FACTORY_ABI = [
|
|
@@ -492,6 +493,27 @@ var AgetherClient = class _AgetherClient {
|
|
|
492
493
|
}
|
|
493
494
|
const acctAddr = await this.agether4337Factory.getAccount(agentId);
|
|
494
495
|
this.accountAddress = acctAddr;
|
|
496
|
+
if (!acctExists) {
|
|
497
|
+
try {
|
|
498
|
+
const updatedMeta = JSON.stringify({
|
|
499
|
+
type: "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
|
|
500
|
+
name: options?.name || "Unnamed Agent",
|
|
501
|
+
description: options?.description || "AI agent registered via @agether/sdk",
|
|
502
|
+
active: true,
|
|
503
|
+
wallet: `eip155:${this.config.chainId}:${acctAddr}`,
|
|
504
|
+
registrations: [{
|
|
505
|
+
agentId: Number(agentId),
|
|
506
|
+
agentRegistry: `eip155:${this.config.chainId}:${this.config.contracts.identityRegistry}`
|
|
507
|
+
}]
|
|
508
|
+
});
|
|
509
|
+
const finalURI = `data:application/json;base64,${Buffer.from(updatedMeta).toString("base64")}`;
|
|
510
|
+
const uriTx = await this.identityRegistry.setAgentURI(agentId, finalURI);
|
|
511
|
+
await uriTx.wait();
|
|
512
|
+
this._refreshSigner();
|
|
513
|
+
} catch (e) {
|
|
514
|
+
console.warn("[agether] setAgentURI failed (non-fatal):", e instanceof Error ? e.message : e);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
495
517
|
const kyaRequired = await this.isKyaRequired();
|
|
496
518
|
return {
|
|
497
519
|
agentId: agentId.toString(),
|
package/dist/index.mjs
CHANGED
|
@@ -54,6 +54,7 @@ var IDENTITY_REGISTRY_ABI = [
|
|
|
54
54
|
"function exists(uint256 agentId) view returns (bool)",
|
|
55
55
|
"function register() returns (uint256 agentId)",
|
|
56
56
|
"function register(string agentURI) returns (uint256 agentId)",
|
|
57
|
+
"function setAgentURI(uint256 agentId, string newURI)",
|
|
57
58
|
"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"
|
|
58
59
|
];
|
|
59
60
|
var AGETHER_4337_FACTORY_ABI = [
|
|
@@ -417,6 +418,27 @@ var AgetherClient = class _AgetherClient {
|
|
|
417
418
|
}
|
|
418
419
|
const acctAddr = await this.agether4337Factory.getAccount(agentId);
|
|
419
420
|
this.accountAddress = acctAddr;
|
|
421
|
+
if (!acctExists) {
|
|
422
|
+
try {
|
|
423
|
+
const updatedMeta = JSON.stringify({
|
|
424
|
+
type: "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
|
|
425
|
+
name: options?.name || "Unnamed Agent",
|
|
426
|
+
description: options?.description || "AI agent registered via @agether/sdk",
|
|
427
|
+
active: true,
|
|
428
|
+
wallet: `eip155:${this.config.chainId}:${acctAddr}`,
|
|
429
|
+
registrations: [{
|
|
430
|
+
agentId: Number(agentId),
|
|
431
|
+
agentRegistry: `eip155:${this.config.chainId}:${this.config.contracts.identityRegistry}`
|
|
432
|
+
}]
|
|
433
|
+
});
|
|
434
|
+
const finalURI = `data:application/json;base64,${Buffer.from(updatedMeta).toString("base64")}`;
|
|
435
|
+
const uriTx = await this.identityRegistry.setAgentURI(agentId, finalURI);
|
|
436
|
+
await uriTx.wait();
|
|
437
|
+
this._refreshSigner();
|
|
438
|
+
} catch (e) {
|
|
439
|
+
console.warn("[agether] setAgentURI failed (non-fatal):", e instanceof Error ? e.message : e);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
420
442
|
const kyaRequired = await this.isKyaRequired();
|
|
421
443
|
return {
|
|
422
444
|
agentId: agentId.toString(),
|