@agether/sdk 2.11.1 → 2.12.1
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 +23 -6
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +23 -6
- package/dist/index.mjs +23 -6
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -57,6 +57,7 @@ var init_abis = __esm({
|
|
|
57
57
|
"function totalSupply() view returns (uint256)",
|
|
58
58
|
"function exists(uint256 agentId) view returns (bool)",
|
|
59
59
|
"function register() returns (uint256 agentId)",
|
|
60
|
+
"function register(string agentURI) returns (uint256 agentId)",
|
|
60
61
|
"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"
|
|
61
62
|
];
|
|
62
63
|
AGETHER_4337_FACTORY_ABI = [
|
|
@@ -1793,8 +1794,11 @@ var init_AgetherClient = __esm({
|
|
|
1793
1794
|
* If already registered, returns existing state.
|
|
1794
1795
|
*
|
|
1795
1796
|
* Sets `this.agentId` on success so subsequent operations work immediately.
|
|
1797
|
+
*
|
|
1798
|
+
* @param options.name Agent display name (stored in on-chain metadata URI)
|
|
1799
|
+
* @param options.description Agent description (defaults to 'AI agent registered via @agether/sdk')
|
|
1796
1800
|
*/
|
|
1797
|
-
async register() {
|
|
1801
|
+
async register(options) {
|
|
1798
1802
|
const eoaAddr = await this._getSignerAddress();
|
|
1799
1803
|
if (this.agentId !== void 0) {
|
|
1800
1804
|
const exists = await this.agether4337Factory.accountExists(this.agentId);
|
|
@@ -1817,10 +1821,10 @@ var init_AgetherClient = __esm({
|
|
|
1817
1821
|
if (balance > 0n) {
|
|
1818
1822
|
agentId = this.agentId;
|
|
1819
1823
|
} else {
|
|
1820
|
-
agentId = await this._mintNewIdentity();
|
|
1824
|
+
agentId = await this._mintNewIdentity(options?.name, options?.description);
|
|
1821
1825
|
}
|
|
1822
1826
|
} else {
|
|
1823
|
-
agentId = await this._mintNewIdentity();
|
|
1827
|
+
agentId = await this._mintNewIdentity(options?.name, options?.description);
|
|
1824
1828
|
}
|
|
1825
1829
|
this.agentId = agentId;
|
|
1826
1830
|
const acctExists = await this.agether4337Factory.accountExists(agentId);
|
|
@@ -1843,9 +1847,22 @@ var init_AgetherClient = __esm({
|
|
|
1843
1847
|
tx: txHash
|
|
1844
1848
|
};
|
|
1845
1849
|
}
|
|
1846
|
-
/** Mint a new ERC-8004 identity and return the agentId.
|
|
1847
|
-
|
|
1848
|
-
|
|
1850
|
+
/** Mint a new ERC-8004 identity and return the agentId.
|
|
1851
|
+
* Builds a JSON metadata document per ERC-8004 spec and encodes it as a data: URI.
|
|
1852
|
+
*/
|
|
1853
|
+
async _mintNewIdentity(name, description) {
|
|
1854
|
+
const registrationFile = JSON.stringify({
|
|
1855
|
+
type: "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
|
|
1856
|
+
name: name || "Unnamed Agent",
|
|
1857
|
+
description: description || "AI agent registered via @agether/sdk",
|
|
1858
|
+
active: true,
|
|
1859
|
+
registrations: [{
|
|
1860
|
+
agentId: 0,
|
|
1861
|
+
agentRegistry: `eip155:${this.config.chainId}:${this.config.contracts.identityRegistry}`
|
|
1862
|
+
}]
|
|
1863
|
+
});
|
|
1864
|
+
const agentURI = `data:application/json;base64,${Buffer.from(registrationFile).toString("base64")}`;
|
|
1865
|
+
const regTx = await this.identityRegistry["register(string)"](agentURI);
|
|
1849
1866
|
const regReceipt = await regTx.wait();
|
|
1850
1867
|
this._refreshSigner();
|
|
1851
1868
|
let agentId = 0n;
|
package/dist/index.d.mts
CHANGED
|
@@ -222,9 +222,17 @@ declare class AgetherClient {
|
|
|
222
222
|
* If already registered, returns existing state.
|
|
223
223
|
*
|
|
224
224
|
* Sets `this.agentId` on success so subsequent operations work immediately.
|
|
225
|
+
*
|
|
226
|
+
* @param options.name Agent display name (stored in on-chain metadata URI)
|
|
227
|
+
* @param options.description Agent description (defaults to 'AI agent registered via @agether/sdk')
|
|
228
|
+
*/
|
|
229
|
+
register(options?: {
|
|
230
|
+
name?: string;
|
|
231
|
+
description?: string;
|
|
232
|
+
}): Promise<RegisterResult>;
|
|
233
|
+
/** Mint a new ERC-8004 identity and return the agentId.
|
|
234
|
+
* Builds a JSON metadata document per ERC-8004 spec and encodes it as a data: URI.
|
|
225
235
|
*/
|
|
226
|
-
register(): Promise<RegisterResult>;
|
|
227
|
-
/** Mint a new ERC-8004 identity and return the agentId. */
|
|
228
236
|
private _mintNewIdentity;
|
|
229
237
|
/**
|
|
230
238
|
* Deploy a Safe account smart wallet for the agent.
|
package/dist/index.d.ts
CHANGED
|
@@ -222,9 +222,17 @@ declare class AgetherClient {
|
|
|
222
222
|
* If already registered, returns existing state.
|
|
223
223
|
*
|
|
224
224
|
* Sets `this.agentId` on success so subsequent operations work immediately.
|
|
225
|
+
*
|
|
226
|
+
* @param options.name Agent display name (stored in on-chain metadata URI)
|
|
227
|
+
* @param options.description Agent description (defaults to 'AI agent registered via @agether/sdk')
|
|
228
|
+
*/
|
|
229
|
+
register(options?: {
|
|
230
|
+
name?: string;
|
|
231
|
+
description?: string;
|
|
232
|
+
}): Promise<RegisterResult>;
|
|
233
|
+
/** Mint a new ERC-8004 identity and return the agentId.
|
|
234
|
+
* Builds a JSON metadata document per ERC-8004 spec and encodes it as a data: URI.
|
|
225
235
|
*/
|
|
226
|
-
register(): Promise<RegisterResult>;
|
|
227
|
-
/** Mint a new ERC-8004 identity and return the agentId. */
|
|
228
236
|
private _mintNewIdentity;
|
|
229
237
|
/**
|
|
230
238
|
* Deploy a Safe account smart wallet for the agent.
|
package/dist/index.js
CHANGED
|
@@ -128,6 +128,7 @@ var IDENTITY_REGISTRY_ABI = [
|
|
|
128
128
|
"function totalSupply() view returns (uint256)",
|
|
129
129
|
"function exists(uint256 agentId) view returns (bool)",
|
|
130
130
|
"function register() returns (uint256 agentId)",
|
|
131
|
+
"function register(string agentURI) returns (uint256 agentId)",
|
|
131
132
|
"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"
|
|
132
133
|
];
|
|
133
134
|
var AGETHER_4337_FACTORY_ABI = [
|
|
@@ -448,8 +449,11 @@ var AgetherClient = class _AgetherClient {
|
|
|
448
449
|
* If already registered, returns existing state.
|
|
449
450
|
*
|
|
450
451
|
* Sets `this.agentId` on success so subsequent operations work immediately.
|
|
452
|
+
*
|
|
453
|
+
* @param options.name Agent display name (stored in on-chain metadata URI)
|
|
454
|
+
* @param options.description Agent description (defaults to 'AI agent registered via @agether/sdk')
|
|
451
455
|
*/
|
|
452
|
-
async register() {
|
|
456
|
+
async register(options) {
|
|
453
457
|
const eoaAddr = await this._getSignerAddress();
|
|
454
458
|
if (this.agentId !== void 0) {
|
|
455
459
|
const exists = await this.agether4337Factory.accountExists(this.agentId);
|
|
@@ -472,10 +476,10 @@ var AgetherClient = class _AgetherClient {
|
|
|
472
476
|
if (balance > 0n) {
|
|
473
477
|
agentId = this.agentId;
|
|
474
478
|
} else {
|
|
475
|
-
agentId = await this._mintNewIdentity();
|
|
479
|
+
agentId = await this._mintNewIdentity(options?.name, options?.description);
|
|
476
480
|
}
|
|
477
481
|
} else {
|
|
478
|
-
agentId = await this._mintNewIdentity();
|
|
482
|
+
agentId = await this._mintNewIdentity(options?.name, options?.description);
|
|
479
483
|
}
|
|
480
484
|
this.agentId = agentId;
|
|
481
485
|
const acctExists = await this.agether4337Factory.accountExists(agentId);
|
|
@@ -498,9 +502,22 @@ var AgetherClient = class _AgetherClient {
|
|
|
498
502
|
tx: txHash
|
|
499
503
|
};
|
|
500
504
|
}
|
|
501
|
-
/** Mint a new ERC-8004 identity and return the agentId.
|
|
502
|
-
|
|
503
|
-
|
|
505
|
+
/** Mint a new ERC-8004 identity and return the agentId.
|
|
506
|
+
* Builds a JSON metadata document per ERC-8004 spec and encodes it as a data: URI.
|
|
507
|
+
*/
|
|
508
|
+
async _mintNewIdentity(name, description) {
|
|
509
|
+
const registrationFile = JSON.stringify({
|
|
510
|
+
type: "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
|
|
511
|
+
name: name || "Unnamed Agent",
|
|
512
|
+
description: description || "AI agent registered via @agether/sdk",
|
|
513
|
+
active: true,
|
|
514
|
+
registrations: [{
|
|
515
|
+
agentId: 0,
|
|
516
|
+
agentRegistry: `eip155:${this.config.chainId}:${this.config.contracts.identityRegistry}`
|
|
517
|
+
}]
|
|
518
|
+
});
|
|
519
|
+
const agentURI = `data:application/json;base64,${Buffer.from(registrationFile).toString("base64")}`;
|
|
520
|
+
const regTx = await this.identityRegistry["register(string)"](agentURI);
|
|
504
521
|
const regReceipt = await regTx.wait();
|
|
505
522
|
this._refreshSigner();
|
|
506
523
|
let agentId = 0n;
|
package/dist/index.mjs
CHANGED
|
@@ -53,6 +53,7 @@ var IDENTITY_REGISTRY_ABI = [
|
|
|
53
53
|
"function totalSupply() view returns (uint256)",
|
|
54
54
|
"function exists(uint256 agentId) view returns (bool)",
|
|
55
55
|
"function register() returns (uint256 agentId)",
|
|
56
|
+
"function register(string agentURI) returns (uint256 agentId)",
|
|
56
57
|
"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"
|
|
57
58
|
];
|
|
58
59
|
var AGETHER_4337_FACTORY_ABI = [
|
|
@@ -373,8 +374,11 @@ var AgetherClient = class _AgetherClient {
|
|
|
373
374
|
* If already registered, returns existing state.
|
|
374
375
|
*
|
|
375
376
|
* Sets `this.agentId` on success so subsequent operations work immediately.
|
|
377
|
+
*
|
|
378
|
+
* @param options.name Agent display name (stored in on-chain metadata URI)
|
|
379
|
+
* @param options.description Agent description (defaults to 'AI agent registered via @agether/sdk')
|
|
376
380
|
*/
|
|
377
|
-
async register() {
|
|
381
|
+
async register(options) {
|
|
378
382
|
const eoaAddr = await this._getSignerAddress();
|
|
379
383
|
if (this.agentId !== void 0) {
|
|
380
384
|
const exists = await this.agether4337Factory.accountExists(this.agentId);
|
|
@@ -397,10 +401,10 @@ var AgetherClient = class _AgetherClient {
|
|
|
397
401
|
if (balance > 0n) {
|
|
398
402
|
agentId = this.agentId;
|
|
399
403
|
} else {
|
|
400
|
-
agentId = await this._mintNewIdentity();
|
|
404
|
+
agentId = await this._mintNewIdentity(options?.name, options?.description);
|
|
401
405
|
}
|
|
402
406
|
} else {
|
|
403
|
-
agentId = await this._mintNewIdentity();
|
|
407
|
+
agentId = await this._mintNewIdentity(options?.name, options?.description);
|
|
404
408
|
}
|
|
405
409
|
this.agentId = agentId;
|
|
406
410
|
const acctExists = await this.agether4337Factory.accountExists(agentId);
|
|
@@ -423,9 +427,22 @@ var AgetherClient = class _AgetherClient {
|
|
|
423
427
|
tx: txHash
|
|
424
428
|
};
|
|
425
429
|
}
|
|
426
|
-
/** Mint a new ERC-8004 identity and return the agentId.
|
|
427
|
-
|
|
428
|
-
|
|
430
|
+
/** Mint a new ERC-8004 identity and return the agentId.
|
|
431
|
+
* Builds a JSON metadata document per ERC-8004 spec and encodes it as a data: URI.
|
|
432
|
+
*/
|
|
433
|
+
async _mintNewIdentity(name, description) {
|
|
434
|
+
const registrationFile = JSON.stringify({
|
|
435
|
+
type: "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
|
|
436
|
+
name: name || "Unnamed Agent",
|
|
437
|
+
description: description || "AI agent registered via @agether/sdk",
|
|
438
|
+
active: true,
|
|
439
|
+
registrations: [{
|
|
440
|
+
agentId: 0,
|
|
441
|
+
agentRegistry: `eip155:${this.config.chainId}:${this.config.contracts.identityRegistry}`
|
|
442
|
+
}]
|
|
443
|
+
});
|
|
444
|
+
const agentURI = `data:application/json;base64,${Buffer.from(registrationFile).toString("base64")}`;
|
|
445
|
+
const regTx = await this.identityRegistry["register(string)"](agentURI);
|
|
429
446
|
const regReceipt = await regTx.wait();
|
|
430
447
|
this._refreshSigner();
|
|
431
448
|
let agentId = 0n;
|