@fangorn-network/sdk 2026.10.20-dev → 2026.10.21-dev
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/README.md +2 -2
- package/lib/cli/cli.js +68 -42
- package/lib/cli/erc8004.d.ts +54 -0
- package/lib/cli/erc8004.js +140 -0
- package/lib/cli/index.d.ts +2 -2
- package/lib/config.d.ts +81 -81
- package/lib/engine/index.d.ts +2 -16
- package/lib/engine/index.js +2 -18
- package/lib/fangorn.d.ts +3 -6
- package/lib/fangorn.js +2 -7
- package/lib/test/testbed.d.ts +4973 -4973
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Fangorn SDK
|
|
2
2
|
|
|
3
|
-
The Fangorn SDK is a
|
|
3
|
+
The Fangorn SDK is a decentralized "git for data" protocol. It follows an app <> publisher paradigm. An "app" is synonymous with gauranteed data availability and a 'view' of its underlying data. For publishers, it lets you cryptographically commit to to a version controlled "repo", which is data stored as a Merkle search tree in IPFS. Published data exists independently of an app, and apps emerge on top of data that they sponsor (pin).
|
|
4
4
|
|
|
5
5
|
A **repo** belongs to its publisher, keyed **`publisher : repo`**. Its state is a map of **records** (`{ id, type, payload }`, content-addressed), and its head is the digest of the latest commit block. Any wallet can update its own repos; updating a head is a compare-and-swap on the parent (i.e. a git ref update), and an update names no app.
|
|
6
6
|
|
|
@@ -57,7 +57,6 @@ ETH_PRIVATE_KEY=0x...
|
|
|
57
57
|
PINATA_JWT=...
|
|
58
58
|
PINATA_GATEWAY=https://your-gateway.mypinata.cloud
|
|
59
59
|
CHAIN_NAME=arbitrumSepolia # or baseSepolia
|
|
60
|
-
ACCESS_WORKER_URL=https://access-worker.your-subdomain.workers.dev # optional (sealed fields)
|
|
61
60
|
SIGNED_URL_WORKER_URL=https://pinata-url-provider.your-subdomain.workers.dev # optional
|
|
62
61
|
```
|
|
63
62
|
|
|
@@ -112,6 +111,7 @@ fangorn app suspend <address> # suspend a member from THIS app only
|
|
|
112
111
|
fangorn app reinstate <address>
|
|
113
112
|
fangorn app renew # pay for the next period
|
|
114
113
|
fangorn app cancel # end the subscription now, no refund
|
|
114
|
+
fangorn app agent --access-worker <url> # register the worker's agent card with ERC-8004 (or pass a card URL)
|
|
115
115
|
fangorn app withdraw-fees [to] # join fees still owed from before joining was removed
|
|
116
116
|
```
|
|
117
117
|
|
package/lib/cli/cli.js
CHANGED
|
@@ -4,7 +4,8 @@ import { PublisherStatus } from "../contracts/types.js";
|
|
|
4
4
|
import "../contracts/index.js";
|
|
5
5
|
import { Fangorn } from "../fangorn.js";
|
|
6
6
|
import { handleCancel, selectChain } from "./index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { agentCardUrl, mcpTools, mintAgent, parseAgentId, registrationFile, setAgentFile } from "./erc8004.js";
|
|
8
|
+
import { createPublicClient, createWalletClient, formatEther, formatUnits, http } from "viem";
|
|
8
9
|
import { privateKeyToAccount } from "viem/accounts";
|
|
9
10
|
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
10
11
|
import { dirname, join } from "path";
|
|
@@ -32,7 +33,6 @@ function loadConfig() {
|
|
|
32
33
|
const privateKey = process.env.ETH_PRIVATE_KEY;
|
|
33
34
|
const pinataJwt = process.env.PINATA_JWT;
|
|
34
35
|
const pinataGateway = process.env.PINATA_GATEWAY;
|
|
35
|
-
const accessWorkerUrl = process.env.ACCESS_WORKER_URL;
|
|
36
36
|
const signedUrlWorkerUrl = process.env.SIGNED_URL_WORKER_URL;
|
|
37
37
|
const envAppId = nonBlank(process.env.FANGORN_APP_ID);
|
|
38
38
|
const envChain = nonBlank(process.env.CHAIN_NAME);
|
|
@@ -45,7 +45,6 @@ function loadConfig() {
|
|
|
45
45
|
appId: envAppId ?? nonBlank(stored.appId),
|
|
46
46
|
pinataJwt: stored.pinataJwt,
|
|
47
47
|
pinataGateway: stored.pinataGateway,
|
|
48
|
-
accessWorkerUrl: stored.accessWorkerUrl ?? "",
|
|
49
48
|
signedUrlWorkerUrl: stored.signedUrlWorkerUrl ?? ""
|
|
50
49
|
};
|
|
51
50
|
return _config;
|
|
@@ -58,7 +57,6 @@ function loadConfig() {
|
|
|
58
57
|
appId: envAppId,
|
|
59
58
|
pinataJwt: pinataJwt ?? "",
|
|
60
59
|
pinataGateway: pinataGateway ?? "",
|
|
61
|
-
accessWorkerUrl: accessWorkerUrl ?? "",
|
|
62
60
|
signedUrlWorkerUrl: signedUrlWorkerUrl ?? ""
|
|
63
61
|
};
|
|
64
62
|
return _config;
|
|
@@ -172,11 +170,6 @@ program.command("init").description("Configure your Fangorn credentials").action
|
|
|
172
170
|
placeholder: "https://your-gateway.mypinata.cloud"
|
|
173
171
|
});
|
|
174
172
|
handleCancel(pinataGateway);
|
|
175
|
-
const accessWorkerUrl = await text({
|
|
176
|
-
message: "Access-gating worker URL (optional):",
|
|
177
|
-
placeholder: "https://access-worker.your-subdomain.workers.dev"
|
|
178
|
-
});
|
|
179
|
-
handleCancel(accessWorkerUrl);
|
|
180
173
|
const signedUrlWorkerUrl = await text({
|
|
181
174
|
message: "Presigned-URL worker URL (optional; blank uses the hosted default):",
|
|
182
175
|
placeholder: "https://pinata-url-provider.your-subdomain.workers.dev"
|
|
@@ -187,7 +180,6 @@ program.command("init").description("Configure your Fangorn credentials").action
|
|
|
187
180
|
chainName,
|
|
188
181
|
pinataJwt,
|
|
189
182
|
pinataGateway,
|
|
190
|
-
accessWorkerUrl,
|
|
191
183
|
signedUrlWorkerUrl,
|
|
192
184
|
appId: existsSync(CONFIG_PATH) ? readStoredConfig().appId : void 0
|
|
193
185
|
});
|
|
@@ -295,16 +287,18 @@ appCmd.command("claim").description("Claim the configured app on-chain (first co
|
|
|
295
287
|
process.exit(1);
|
|
296
288
|
}
|
|
297
289
|
});
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
290
|
+
async function retryNonce(f, tries = 4) {
|
|
291
|
+
for (let i = 0;; i++) try {
|
|
292
|
+
return await f();
|
|
293
|
+
} catch (e) {
|
|
294
|
+
if (i >= tries - 1 || !/underpriced|nonce too low|nonce has already been used|already known/i.test(e.message)) throw e;
|
|
295
|
+
await new Promise((ok) => setTimeout(ok, 3e3 * (i + 1)));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
appCmd.command("agent").description("Register this app's gateway as an ERC-8004 agent and point the app at its card (owner only)").argument("[cardUrl]", "The agent card URL; or pass --access-worker to use its /.well-known/agent-card.json").option("--access-worker <url>", "The access worker serving the agent card").option("--mcp <url>", "An MCP endpoint to index alongside the card").option("--skip-register", "Only set agent_uri on-chain — for a gateway already registered with ERC-8004").option("--update <agentId>", "Update an agent already registered (e.g. 84532:10323) from the card as it is now: a new registration file, pointed to by setAgentURI; mints nothing").action(async (cardUrl, opts) => {
|
|
304
299
|
try {
|
|
305
300
|
const cfg = loadConfig();
|
|
306
|
-
const url = cardUrl
|
|
307
|
-
if (!url) throw new Error("No card URL. Pass one, or set an access worker URL with `fangorn init`.");
|
|
301
|
+
const url = agentCardUrl(cardUrl, opts.accessWorker);
|
|
308
302
|
const s = spinner();
|
|
309
303
|
s.start(`Reading ${url}`);
|
|
310
304
|
const res = await fetch(url);
|
|
@@ -318,34 +312,66 @@ appCmd.command("agent").description("Register this app's gateway as an ERC-8004
|
|
|
318
312
|
let agentId;
|
|
319
313
|
if (!opts.skipRegister) {
|
|
320
314
|
if (!cfg.pinataJwt) throw new Error("ERC-8004 registration pins the registration file to IPFS — set PINATA_JWT, or pass --skip-register.");
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
315
|
+
const c = {
|
|
316
|
+
chain: cfg.cfg.chain,
|
|
317
|
+
publicClient: createPublicClient({
|
|
318
|
+
chain: cfg.cfg.chain,
|
|
319
|
+
transport: http(cfg.cfg.rpcUrl)
|
|
320
|
+
}),
|
|
321
|
+
walletClient: createWalletClient({
|
|
322
|
+
account: getAccount(),
|
|
323
|
+
chain: cfg.cfg.chain,
|
|
324
|
+
transport: http(cfg.cfg.rpcUrl)
|
|
325
|
+
}),
|
|
326
|
+
pinataJwt: cfg.pinataJwt
|
|
327
|
+
};
|
|
328
|
+
const chainId = cfg.cfg.caip2;
|
|
329
|
+
const named = {
|
|
330
|
+
...card,
|
|
331
|
+
name: card.name,
|
|
332
|
+
description: card.description
|
|
333
|
+
};
|
|
334
334
|
s.start("Indexing skills and capabilities from the card");
|
|
335
|
-
|
|
336
|
-
|
|
335
|
+
const mcp = opts.mcp ? {
|
|
336
|
+
endpoint: opts.mcp,
|
|
337
|
+
tools: await mcpTools(opts.mcp)
|
|
338
|
+
} : void 0;
|
|
337
339
|
s.stop();
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
340
|
+
const file = (id) => registrationFile({
|
|
341
|
+
cardUrl: url,
|
|
342
|
+
card: named,
|
|
343
|
+
chainId,
|
|
344
|
+
agentId: id,
|
|
345
|
+
mcp
|
|
346
|
+
});
|
|
347
|
+
if (opts.update) {
|
|
348
|
+
const id = parseAgentId(opts.update, chainId);
|
|
349
|
+
s.start(`Updating ERC-8004 agent ${opts.update}`);
|
|
350
|
+
await retryNonce(() => setAgentFile(c, id, file(id)));
|
|
351
|
+
s.stop();
|
|
352
|
+
agentId = `${String(chainId)}:${String(id)}`;
|
|
353
|
+
} else {
|
|
354
|
+
s.start("Registering with the ERC-8004 identity registry");
|
|
355
|
+
const id = await mintAgent(c);
|
|
356
|
+
agentId = `${String(chainId)}:${String(id)}`;
|
|
357
|
+
s.message(`Minted ${agentId}; pinning its registration file`);
|
|
358
|
+
try {
|
|
359
|
+
await retryNonce(() => setAgentFile(c, id, file(id)));
|
|
360
|
+
} catch (e) {
|
|
361
|
+
s.stop();
|
|
362
|
+
throw new Error(`agent ${agentId} was minted but its registration file was not set (${e.message}). Finish it with: fangorn app agent ${url} --update ${agentId}`);
|
|
363
|
+
}
|
|
364
|
+
s.stop();
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
const apps = getFangorn().getAppRegistry();
|
|
368
|
+
const bound = opts.update ? await apps.appAgentUri().catch(() => "") : "";
|
|
369
|
+
let txHash = "(already bound)";
|
|
370
|
+
if (bound !== url) {
|
|
371
|
+
s.start("Pointing the app at its card");
|
|
372
|
+
txHash = await retryNonce(() => apps.setAppAgentUri(url));
|
|
343
373
|
s.stop();
|
|
344
|
-
agentId = String(result.agentId);
|
|
345
374
|
}
|
|
346
|
-
s.start("Pointing the app at its card");
|
|
347
|
-
const txHash = await getFangorn().getAppRegistry().setAppAgentUri(url);
|
|
348
|
-
s.stop();
|
|
349
375
|
if (agentId) console.log(`Agent ID: ${agentId}`);
|
|
350
376
|
console.log(`Card: ${url}`);
|
|
351
377
|
console.log(`Tx: ${txHash}`);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Address, Chain, Hex, PublicClient, WalletClient } from "viem";
|
|
2
|
+
|
|
3
|
+
//#region src/cli/erc8004.d.ts
|
|
4
|
+
/** The ERC-8004 identity registry by chain id */
|
|
5
|
+
declare const IDENTITY_REGISTRY: Record<number, Address>;
|
|
6
|
+
interface AgentCard {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
skills?: {
|
|
10
|
+
tags?: unknown;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get the agent card URL based on the access worker if defined, else return the carUrl
|
|
15
|
+
* Both params are optional, but at least one must be defined.
|
|
16
|
+
*
|
|
17
|
+
* Agent cards must live at accessWorker/.well-known/agent-card.json
|
|
18
|
+
*
|
|
19
|
+
* @param cardUrl The cardUrl (passthrough when defined)
|
|
20
|
+
* @param accessWorker The (optional) access worker url
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
declare function agentCardUrl(cardUrl?: string, accessWorker?: string): string;
|
|
24
|
+
declare function mcpTools(endpoint: string): Promise<string[] | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* Build a registration file
|
|
27
|
+
* Since it desfines its own agent id,
|
|
28
|
+
* first registration mints without an agent URI and must be set retroactively.
|
|
29
|
+
*/
|
|
30
|
+
declare function registrationFile(opts: {
|
|
31
|
+
cardUrl: string;
|
|
32
|
+
card: AgentCard;
|
|
33
|
+
chainId: number;
|
|
34
|
+
agentId: bigint;
|
|
35
|
+
mcp?: {
|
|
36
|
+
endpoint: string;
|
|
37
|
+
tools?: string[];
|
|
38
|
+
};
|
|
39
|
+
now?: number;
|
|
40
|
+
}): Record<string, unknown>;
|
|
41
|
+
/** `84532:10323` or `10323` → the token id, refusing an agent on another chain. */
|
|
42
|
+
declare function parseAgentId(id: string, chainId: number): bigint;
|
|
43
|
+
interface Erc8004Clients {
|
|
44
|
+
chain: Chain;
|
|
45
|
+
publicClient: PublicClient;
|
|
46
|
+
walletClient: WalletClient;
|
|
47
|
+
pinataJwt: string;
|
|
48
|
+
}
|
|
49
|
+
/** Pin `file` and point agent `agentId` at it. */
|
|
50
|
+
declare function setAgentFile(c: Erc8004Clients, agentId: bigint, file: unknown): Promise<Hex>;
|
|
51
|
+
/** Mint an agent with no URI yet, and return its id. */
|
|
52
|
+
declare function mintAgent(c: Erc8004Clients): Promise<bigint>;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { AgentCard, Erc8004Clients, IDENTITY_REGISTRY, agentCardUrl, mcpTools, mintAgent, parseAgentId, registrationFile, setAgentFile };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { parseAbi, parseEventLogs } from "viem";
|
|
2
|
+
import { PinataSDK } from "pinata";
|
|
3
|
+
|
|
4
|
+
//#region src/cli/erc8004.ts
|
|
5
|
+
/** The ERC-8004 identity registry by chain id */
|
|
6
|
+
const IDENTITY_REGISTRY = {
|
|
7
|
+
84532: "0x8004A818BFB912233c491871b3d84c89A494BD9e",
|
|
8
|
+
421614: "0x8004A818BFB912233c491871b3d84c89A494BD9e"
|
|
9
|
+
};
|
|
10
|
+
const ABI = parseAbi([
|
|
11
|
+
"function register(string agentURI, (string metadataKey, bytes metadataValue)[] metadata) returns (uint256 agentId)",
|
|
12
|
+
"function setAgentURI(uint256 agentId, string newURI)",
|
|
13
|
+
"event Registered(uint256 indexed agentId, string agentURI, address indexed owner)"
|
|
14
|
+
]);
|
|
15
|
+
/**
|
|
16
|
+
* Get the agent card URL based on the access worker if defined, else return the carUrl
|
|
17
|
+
* Both params are optional, but at least one must be defined.
|
|
18
|
+
*
|
|
19
|
+
* Agent cards must live at accessWorker/.well-known/agent-card.json
|
|
20
|
+
*
|
|
21
|
+
* @param cardUrl The cardUrl (passthrough when defined)
|
|
22
|
+
* @param accessWorker The (optional) access worker url
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
function agentCardUrl(cardUrl, accessWorker) {
|
|
26
|
+
if (cardUrl) return cardUrl;
|
|
27
|
+
if (!accessWorker) throw new Error("No card URL. Pass one, or pass --access-worker <url>.");
|
|
28
|
+
return `${accessWorker.replace(/\/$/, "")}/.well-known/agent-card.json`;
|
|
29
|
+
}
|
|
30
|
+
async function mcpTools(endpoint) {
|
|
31
|
+
try {
|
|
32
|
+
const res = await fetch(endpoint, {
|
|
33
|
+
method: "POST",
|
|
34
|
+
headers: {
|
|
35
|
+
"Content-Type": "application/json",
|
|
36
|
+
Accept: "application/json, text/event-stream"
|
|
37
|
+
},
|
|
38
|
+
body: JSON.stringify({
|
|
39
|
+
jsonrpc: "2.0",
|
|
40
|
+
id: 1,
|
|
41
|
+
method: "tools/list"
|
|
42
|
+
}),
|
|
43
|
+
signal: AbortSignal.timeout(1e4)
|
|
44
|
+
});
|
|
45
|
+
if (!res.ok) return void 0;
|
|
46
|
+
const text = await res.text();
|
|
47
|
+
const body = text.split("\n").find((l) => l.startsWith("data: "))?.slice(6) ?? text;
|
|
48
|
+
const names = (JSON.parse(body).result?.tools ?? []).map((t) => t.name).filter((n) => typeof n === "string");
|
|
49
|
+
return names.length ? names : void 0;
|
|
50
|
+
} catch {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Build a registration file
|
|
56
|
+
* Since it desfines its own agent id,
|
|
57
|
+
* first registration mints without an agent URI and must be set retroactively.
|
|
58
|
+
*/
|
|
59
|
+
function registrationFile(opts) {
|
|
60
|
+
const { cardUrl, card, chainId, agentId, mcp } = opts;
|
|
61
|
+
const tags = [...new Set((card.skills ?? []).flatMap((s) => Array.isArray(s.tags) ? s.tags : []).filter((t) => typeof t === "string"))];
|
|
62
|
+
const services = [{
|
|
63
|
+
name: "A2A",
|
|
64
|
+
endpoint: cardUrl,
|
|
65
|
+
version: "0.30",
|
|
66
|
+
...tags.length && { a2aSkills: tags }
|
|
67
|
+
}];
|
|
68
|
+
if (mcp) services.push({
|
|
69
|
+
name: "MCP",
|
|
70
|
+
endpoint: mcp.endpoint,
|
|
71
|
+
version: "2025-06-18",
|
|
72
|
+
...mcp.tools && { mcpTools: mcp.tools }
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
type: "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
|
|
76
|
+
name: card.name,
|
|
77
|
+
description: card.description,
|
|
78
|
+
services,
|
|
79
|
+
registrations: [{
|
|
80
|
+
agentId: Number(agentId),
|
|
81
|
+
agentRegistry: `eip155:${String(chainId)}:${IDENTITY_REGISTRY[chainId]}`
|
|
82
|
+
}],
|
|
83
|
+
supportedTrust: ["reputation"],
|
|
84
|
+
active: true,
|
|
85
|
+
x402Support: card.skills?.some((s) => Array.isArray(s.tags) && s.tags.includes("x402")) ?? false,
|
|
86
|
+
updatedAt: opts.now ?? Math.floor(Date.now() / 1e3)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** `84532:10323` or `10323` → the token id, refusing an agent on another chain. */
|
|
90
|
+
function parseAgentId(id, chainId) {
|
|
91
|
+
const m = /^(?:(\d+):)?(\d+)$/.exec(id.trim());
|
|
92
|
+
if (!m) throw new Error(`not an agent id: ${JSON.stringify(id)} (expected <chainId>:<tokenId>, e.g. 84532:10323)`);
|
|
93
|
+
if (m[1] && Number(m[1]) !== chainId) throw new Error(`agent ${id} is on chain ${m[1]}, but the CLI is configured for ${String(chainId)}`);
|
|
94
|
+
return BigInt(m[2]);
|
|
95
|
+
}
|
|
96
|
+
async function pin(jwt, data) {
|
|
97
|
+
const file = new File([JSON.stringify(data, null, 2)], "agent-registration.json", { type: "application/json" });
|
|
98
|
+
return (await new PinataSDK({ pinataJwt: jwt }).upload.public.file(file)).cid;
|
|
99
|
+
}
|
|
100
|
+
function registry(chain) {
|
|
101
|
+
const address = IDENTITY_REGISTRY[chain.id];
|
|
102
|
+
if (!address) throw new Error(`no ERC-8004 identity registry known for chain ${String(chain.id)}`);
|
|
103
|
+
return address;
|
|
104
|
+
}
|
|
105
|
+
/** Pin `file` and point agent `agentId` at it. */
|
|
106
|
+
async function setAgentFile(c, agentId, file) {
|
|
107
|
+
const cid = await pin(c.pinataJwt, file);
|
|
108
|
+
const hash = await c.walletClient.writeContract({
|
|
109
|
+
address: registry(c.chain),
|
|
110
|
+
abi: ABI,
|
|
111
|
+
functionName: "setAgentURI",
|
|
112
|
+
args: [agentId, `ipfs://${cid}`],
|
|
113
|
+
chain: c.chain,
|
|
114
|
+
account: c.walletClient.account ?? null
|
|
115
|
+
});
|
|
116
|
+
await c.publicClient.waitForTransactionReceipt({ hash });
|
|
117
|
+
return hash;
|
|
118
|
+
}
|
|
119
|
+
/** Mint an agent with no URI yet, and return its id. */
|
|
120
|
+
async function mintAgent(c) {
|
|
121
|
+
const address = registry(c.chain);
|
|
122
|
+
const hash = await c.walletClient.writeContract({
|
|
123
|
+
address,
|
|
124
|
+
abi: ABI,
|
|
125
|
+
functionName: "register",
|
|
126
|
+
args: ["", []],
|
|
127
|
+
chain: c.chain,
|
|
128
|
+
account: c.walletClient.account ?? null
|
|
129
|
+
});
|
|
130
|
+
const minted = parseEventLogs({
|
|
131
|
+
abi: ABI,
|
|
132
|
+
eventName: "Registered",
|
|
133
|
+
logs: (await c.publicClient.waitForTransactionReceipt({ hash })).logs
|
|
134
|
+
}).find((l) => l.address.toLowerCase() === address.toLowerCase());
|
|
135
|
+
if (!minted) throw new Error(`register ${hash} confirmed with no Registered event`);
|
|
136
|
+
return minted.args.agentId;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
//#endregion
|
|
140
|
+
export { IDENTITY_REGISTRY, agentCardUrl, mcpTools, mintAgent, parseAgentId, registrationFile, setAgentFile };
|
package/lib/cli/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./cli.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as viem5575 from "viem";
|
|
3
3
|
|
|
4
4
|
//#region src/cli/index.d.ts
|
|
5
|
-
declare const getChain: (chainStr: string) =>
|
|
5
|
+
declare const getChain: (chainStr: string) => viem5575.Chain;
|
|
6
6
|
declare const handleCancel: (value: unknown) => void;
|
|
7
7
|
declare const selectChain: () => Promise<string>;
|
|
8
8
|
declare function parseGadgetArg(raw: string): {
|