@ens-node-metadata/agent 0.3.1 → 0.3.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.
Files changed (54) hide show
  1. package/README.md +32 -2
  2. package/SKILL.md +31 -21
  3. package/dist/{chunk-3VTAAUSG.js → chunk-6IGJKB4W.js} +5 -0
  4. package/dist/chunk-DXAESRZH.js +1122 -0
  5. package/dist/chunk-X6M7WZJF.js +43 -0
  6. package/dist/chunk-YZFATT7X.js +9 -0
  7. package/dist/cli.js +6 -1
  8. package/dist/commands/metadata/set.js +264 -11
  9. package/dist/commands/metadata/template.js +2 -1
  10. package/dist/commands/metadata/validate.js +2 -1
  11. package/dist/commands/registration-file/publish.js +1 -0
  12. package/dist/commands/registration-file/template.js +2 -0
  13. package/dist/commands/registration-file/validate.js +1 -0
  14. package/dist/commands/registry/identity/index.d.ts +3 -0
  15. package/dist/commands/registry/identity/index.js +7 -0
  16. package/dist/commands/registry/identity/query.d.ts +19 -0
  17. package/dist/commands/registry/identity/query.js +74 -0
  18. package/dist/commands/registry/identity/register.d.ts +25 -0
  19. package/dist/commands/registry/identity/register.js +112 -0
  20. package/dist/commands/registry/identity/set-uri.d.ts +25 -0
  21. package/dist/commands/registry/identity/set-uri.js +113 -0
  22. package/dist/commands/registry/identity/set-wallet.d.ts +31 -0
  23. package/dist/commands/registry/identity/set-wallet.js +191 -0
  24. package/dist/commands/registry/identity/unset-wallet.d.ts +25 -0
  25. package/dist/commands/registry/identity/unset-wallet.js +108 -0
  26. package/dist/commands/skill.js +2 -0
  27. package/dist/index.js +1 -0
  28. package/dist/meta-2D4D777X.js +99 -0
  29. package/dist/meta-3V4ARLLT.js +90 -0
  30. package/dist/meta-4FOJTBXM.js +99 -0
  31. package/dist/meta-4WYOTBTO.js +99 -0
  32. package/dist/meta-6ZW4JGML.js +99 -0
  33. package/dist/meta-CVZI45M2.js +99 -0
  34. package/dist/meta-GPMB2YZD.js +99 -0
  35. package/dist/meta-KQ3IEVWD.js +99 -0
  36. package/dist/meta-OVOAMXLB.js +99 -0
  37. package/dist/meta-PRCHJBWX.js +99 -0
  38. package/dist/meta-Q27UTR4Z.js +99 -0
  39. package/dist/meta-VOM2POTX.js +99 -0
  40. package/dist/schema-533SFVLQ.js +70 -0
  41. package/dist/schema-5VKXCUCI.js +58 -0
  42. package/dist/schema-FGOA4QOU.js +86 -0
  43. package/dist/schema-JNRQYFPA.js +79 -0
  44. package/dist/schema-JWSXL7CR.js +51 -0
  45. package/dist/schema-NESH3IQS.js +90 -0
  46. package/dist/schema-O4SLAGNC.js +65 -0
  47. package/dist/schema-SFNY6GI4.js +95 -0
  48. package/dist/schema-WUU2T2HE.js +53 -0
  49. package/dist/schema-YRD3DNDN.js +97 -0
  50. package/dist/schema-Z7FM6RGM.js +84 -0
  51. package/dist/schema-ZCETI367.js +83 -0
  52. package/package.json +3 -1
  53. package/dist/commands/registry/identity.d.ts +0 -19
  54. package/dist/commands/registry/identity.js +0 -91
@@ -0,0 +1,43 @@
1
+ // src/lib/estimate-cost.ts
2
+ import { formatEther } from "viem";
3
+ var COINGECKO_URL = "https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd";
4
+ var priceCache = null;
5
+ var CACHE_TTL_MS = 6e4;
6
+ async function getEthUsdPrice() {
7
+ if (priceCache && Date.now() - priceCache.ts < CACHE_TTL_MS) {
8
+ return priceCache.usd;
9
+ }
10
+ const res = await fetch(COINGECKO_URL);
11
+ if (!res.ok) throw new Error(`CoinGecko request failed: ${res.status}`);
12
+ const data = await res.json();
13
+ const usd = data.ethereum.usd;
14
+ priceCache = { usd, ts: Date.now() };
15
+ return usd;
16
+ }
17
+ async function estimateCost(client, tx) {
18
+ const [gas, fees, ethUsdPrice] = await Promise.all([
19
+ client.estimateGas(tx),
20
+ client.estimateFeesPerGas(),
21
+ getEthUsdPrice()
22
+ ]);
23
+ const maxFeePerGas = fees.maxFeePerGas ?? 0n;
24
+ const costWei = gas * maxFeePerGas;
25
+ const costEthNum = Number(formatEther(costWei));
26
+ return {
27
+ gas,
28
+ maxFeePerGas,
29
+ costWei,
30
+ costEth: formatEther(costWei),
31
+ costUsd: (costEthNum * ethUsdPrice).toFixed(2),
32
+ ethUsdPrice
33
+ };
34
+ }
35
+ function formatCost(est) {
36
+ const eth = Number.parseFloat(est.costEth).toPrecision(4);
37
+ return `$${est.costUsd} (${eth} ETH)`;
38
+ }
39
+
40
+ export {
41
+ estimateCost,
42
+ formatCost
43
+ };
@@ -0,0 +1,9 @@
1
+ var __glob = (map) => (path) => {
2
+ var fn = map[path];
3
+ if (fn) return fn();
4
+ throw new Error("Module not found in bundle: " + path);
5
+ };
6
+
7
+ export {
8
+ __glob
9
+ };
package/dist/cli.js CHANGED
@@ -15,7 +15,12 @@ Usage:
15
15
  ens-agent registration-file validate <file.json>
16
16
  ens-agent registration-file publish <file.json>
17
17
 
18
- ens-agent registry identity --chain-name <chain> <agent-uri>
18
+ ens-agent registry identity (show sub-commands)
19
+ ens-agent registry identity query --chain-name <chain> <agent-id>
20
+ ens-agent registry identity register --chain-name <chain> <agent-uri> --private-key <0x...> [--broadcast]
21
+ ens-agent registry identity set-uri --chain-name <chain> <agent-id> <new-uri> --private-key <0x...> [--broadcast]
22
+ ens-agent registry identity set-wallet --chain-name <chain> <agent-id> <wallet> --private-key <0x...> [--deadline <ts>] [--signature <0x...>] [--broadcast]
23
+ ens-agent registry identity unset-wallet --chain-name <chain> <agent-id> --private-key <0x...> [--broadcast]
19
24
 
20
25
  ens-agent metadata template
21
26
  ens-agent metadata validate <payload.json>
@@ -1,30 +1,265 @@
1
1
  import {
2
2
  SCHEMA_MAP
3
- } from "../../chunk-3VTAAUSG.js";
3
+ } from "../../chunk-6IGJKB4W.js";
4
+ import {
5
+ estimateCost,
6
+ formatCost
7
+ } from "../../chunk-X6M7WZJF.js";
8
+ import {
9
+ __glob
10
+ } from "../../chunk-YZFATT7X.js";
4
11
 
5
12
  // src/commands/metadata/set.tsx
6
13
  import { readFileSync } from "fs";
7
14
  import { Box, Text, useApp } from "ink";
8
15
  import React from "react";
9
16
  import { z } from "zod";
17
+
18
+ // ../schemas/published/_registry.json
19
+ var registry_default = {
20
+ schemas: {
21
+ agent: {
22
+ latest: "1.0.0",
23
+ published: {
24
+ "1.0.0": {
25
+ cid: "QmS1ZHmucPJCo8KGaBG2e27c6jqpjFrFWoZWoVPyBPqVyJ",
26
+ checksum: "sha256:6778eeaf90b71eb75c2a174f50062e8a5dbfcb62152e0ab905339a6da5e01e3b",
27
+ timestamp: 1771420402,
28
+ schemaPath: "packages/schemas/published/agent/versions/1.0.0/schema.json"
29
+ }
30
+ }
31
+ },
32
+ application: {
33
+ latest: "1.0.0",
34
+ published: {
35
+ "1.0.0": {
36
+ cid: "QmSsjRkk2xZSU6yXxjgPmyKpyfQVGmUw5qLGaPkYcdPW9A",
37
+ checksum: "sha256:79de7f6f9d48810193959754c27315a7558529d713a532d5c2566f3de2197819",
38
+ timestamp: 1771420672,
39
+ schemaPath: "packages/schemas/published/application/versions/1.0.0/schema.json"
40
+ }
41
+ }
42
+ },
43
+ contract: {
44
+ latest: "1.1.1",
45
+ published: {
46
+ "1.1.1": {
47
+ cid: "QmPq5xpj5LoCnAswuLk8ofgvpFLFNsRhJDPjvPVssCyPw1",
48
+ checksum: "sha256:ff0ef9190bc2e00e90ce30a7328187fdbe7bec54bf7945b17c25533685e6c014",
49
+ timestamp: 1771420678,
50
+ schemaPath: "packages/schemas/published/contract/versions/1.1.1/schema.json"
51
+ }
52
+ }
53
+ },
54
+ delegate: {
55
+ latest: "1.0.1",
56
+ published: {
57
+ "1.0.0": {
58
+ cid: "QmaDG9p9vJjsLBtbtCPTd6tmfJUh2wuXmYQfNwrpe2qQwe",
59
+ checksum: "sha256:a44ced384a3e28682f4ba1fc70124dee9a30a0339657a6ab6b33c0c3516a959c",
60
+ timestamp: 1771420683,
61
+ schemaPath: "packages/schemas/published/delegate/versions/1.0.0/schema.json"
62
+ },
63
+ "1.0.1": {
64
+ cid: "QmcHmNS3NhcrMgXmCm72bv77EKUx7inoeaS2QeWDuQGU1q",
65
+ checksum: "sha256:4208b2eec2ddf8d4ded2df34999070a21779af793d3b09b95f0a5cede999adf7",
66
+ timestamp: 1771433406,
67
+ schemaPath: "packages/schemas/published/delegate/versions/1.0.1/schema.json"
68
+ }
69
+ }
70
+ },
71
+ grant: {
72
+ latest: "1.0.0",
73
+ published: {
74
+ "1.0.0": {
75
+ cid: "QmdktToaxwvN31DGDEtWQ7uVKNURssW5k8oCtgceTFHemS",
76
+ checksum: "sha256:205ff736e4ce769bbc86332aedf56fe55275154ffcfda4d2c5003bc809ca4df4",
77
+ timestamp: 1771420688,
78
+ schemaPath: "packages/schemas/published/grant/versions/1.0.0/schema.json"
79
+ }
80
+ }
81
+ },
82
+ group: {
83
+ latest: "0.1.4",
84
+ published: {
85
+ "0.1.4": {
86
+ cid: "QmYJieM3KXTeDhrwcFr3cMSi1LVWofxjCVkMzv1HTuoYSw",
87
+ checksum: "sha256:ca4434bed698d565b4a5d24bf98c658dc3e6fa381c48f66cd49744fde1b47559",
88
+ timestamp: 1771420694,
89
+ schemaPath: "packages/schemas/published/group/versions/0.1.4/schema.json"
90
+ }
91
+ }
92
+ },
93
+ org: {
94
+ latest: "0.1.8",
95
+ published: {
96
+ "0.1.8": {
97
+ cid: "QmfPD2L38hREq356GxhMkyMJMECVwRAxm6dEJZh3bpPAdd",
98
+ checksum: "sha256:07522b2427846867ffd3a69c1955d08ec0d9a88a3da6d5a0efd5ec94ae103f2a",
99
+ timestamp: 1771420699,
100
+ schemaPath: "packages/schemas/published/org/versions/0.1.8/schema.json"
101
+ }
102
+ }
103
+ },
104
+ person: {
105
+ latest: "1.0.0",
106
+ published: {
107
+ "1.0.0": {
108
+ cid: "QmYZNmUKP751Vfj2ZEVwXawvGto1zsmi4oiTsnunzx6dsp",
109
+ checksum: "sha256:c40c06eff4eae205f64a70eb8ab2bb639e6ec7a62aeceeab7d7ae5eaf9959760",
110
+ timestamp: 1771420704,
111
+ schemaPath: "packages/schemas/published/person/versions/1.0.0/schema.json"
112
+ }
113
+ }
114
+ },
115
+ treasury: {
116
+ latest: "1.0.0",
117
+ published: {
118
+ "1.0.0": {
119
+ cid: "QmcrTCuN3FmpTP66LzQqDtaxmK7j5wMNtHKQEjE2SCLUZr",
120
+ checksum: "sha256:bd72ed65798aa3db260b2fa04c75263df19b06bff9dfbad540921d82c41a76a3",
121
+ timestamp: 1771420708,
122
+ schemaPath: "packages/schemas/published/treasury/versions/1.0.0/schema.json"
123
+ }
124
+ }
125
+ },
126
+ wallet: {
127
+ latest: "1.0.0",
128
+ published: {
129
+ "1.0.0": {
130
+ cid: "QmTdnHbDob1Cf7Uy1dYmrRezyETvf19QWcaNpFP3WSe2JD",
131
+ checksum: "sha256:1a6fadb35c51e238e7ddb947b1ac6b9e899df71247f0eb85c7724092fd075988",
132
+ timestamp: 1771420712,
133
+ schemaPath: "packages/schemas/published/wallet/versions/1.0.0/schema.json"
134
+ }
135
+ }
136
+ },
137
+ globals: {
138
+ latest: "1.0.0",
139
+ published: {
140
+ "1.0.0": {
141
+ cid: "QmVPf3nP4KC12An7v94ziWLE3ptFHXwUxFcvKEaPNXGRYd",
142
+ checksum: "sha256:128951c9c9c6e91ee0a07b36058180a2881dc0bf33e6216b9d89fb1288e7a27c",
143
+ timestamp: 1771421607,
144
+ schemaPath: "packages/schemas/published/globals/versions/1.0.0/schema.json"
145
+ }
146
+ }
147
+ }
148
+ }
149
+ };
150
+
151
+ // import("../published/**/*/versions/**/*/schema.json") in ../schemas/src/published.ts
152
+ var globImport_published_versions_schema_json = __glob({
153
+ "../published/agent/versions/1.0.0/schema.json": () => import("../../schema-SFNY6GI4.js"),
154
+ "../published/application/versions/1.0.0/schema.json": () => import("../../schema-ZCETI367.js"),
155
+ "../published/contract/versions/1.1.1/schema.json": () => import("../../schema-JNRQYFPA.js"),
156
+ "../published/delegate/versions/1.0.0/schema.json": () => import("../../schema-Z7FM6RGM.js"),
157
+ "../published/delegate/versions/1.0.1/schema.json": () => import("../../schema-NESH3IQS.js"),
158
+ "../published/globals/versions/1.0.0/schema.json": () => import("../../schema-O4SLAGNC.js"),
159
+ "../published/grant/versions/1.0.0/schema.json": () => import("../../schema-FGOA4QOU.js"),
160
+ "../published/group/versions/0.1.4/schema.json": () => import("../../schema-YRD3DNDN.js"),
161
+ "../published/org/versions/0.1.8/schema.json": () => import("../../schema-533SFVLQ.js"),
162
+ "../published/person/versions/1.0.0/schema.json": () => import("../../schema-JWSXL7CR.js"),
163
+ "../published/treasury/versions/1.0.0/schema.json": () => import("../../schema-5VKXCUCI.js"),
164
+ "../published/wallet/versions/1.0.0/schema.json": () => import("../../schema-WUU2T2HE.js")
165
+ });
166
+
167
+ // import("../published/**/*/versions/**/*/meta.json") in ../schemas/src/published.ts
168
+ var globImport_published_versions_meta_json = __glob({
169
+ "../published/agent/versions/1.0.0/meta.json": () => import("../../meta-4FOJTBXM.js"),
170
+ "../published/application/versions/1.0.0/meta.json": () => import("../../meta-Q27UTR4Z.js"),
171
+ "../published/contract/versions/1.1.1/meta.json": () => import("../../meta-GPMB2YZD.js"),
172
+ "../published/delegate/versions/1.0.0/meta.json": () => import("../../meta-VOM2POTX.js"),
173
+ "../published/delegate/versions/1.0.1/meta.json": () => import("../../meta-6ZW4JGML.js"),
174
+ "../published/globals/versions/1.0.0/meta.json": () => import("../../meta-3V4ARLLT.js"),
175
+ "../published/grant/versions/1.0.0/meta.json": () => import("../../meta-OVOAMXLB.js"),
176
+ "../published/group/versions/0.1.4/meta.json": () => import("../../meta-4WYOTBTO.js"),
177
+ "../published/org/versions/0.1.8/meta.json": () => import("../../meta-2D4D777X.js"),
178
+ "../published/person/versions/1.0.0/meta.json": () => import("../../meta-PRCHJBWX.js"),
179
+ "../published/treasury/versions/1.0.0/meta.json": () => import("../../meta-CVZI45M2.js"),
180
+ "../published/wallet/versions/1.0.0/meta.json": () => import("../../meta-KQ3IEVWD.js")
181
+ });
182
+
183
+ // ../schemas/src/published.ts
184
+ async function getPublishedRegistry() {
185
+ const enhancedRegistry = {
186
+ schemas: {}
187
+ };
188
+ for (const [schemaId, schemaData] of Object.entries(registry_default.schemas)) {
189
+ enhancedRegistry.schemas[schemaId] = {
190
+ latest: schemaData.latest,
191
+ published: {}
192
+ };
193
+ for (const [version, versionData] of Object.entries(schemaData.published)) {
194
+ try {
195
+ const [schemaModule, metaModule] = await Promise.all([
196
+ globImport_published_versions_schema_json(`../published/${schemaId}/versions/${version}/schema.json`),
197
+ globImport_published_versions_meta_json(`../published/${schemaId}/versions/${version}/meta.json`)
198
+ ]);
199
+ enhancedRegistry.schemas[schemaId].published[version] = {
200
+ ...versionData,
201
+ schema: schemaModule.default || schemaModule,
202
+ meta: metaModule.default || metaModule
203
+ };
204
+ } catch (error) {
205
+ console.error(`Failed to load schema ${schemaId} v${version}:`, error);
206
+ enhancedRegistry.schemas[schemaId].published[version] = {
207
+ ...versionData
208
+ };
209
+ }
210
+ }
211
+ }
212
+ return enhancedRegistry;
213
+ }
214
+
215
+ // src/commands/metadata/set.tsx
10
216
  import { validateMetadataSchema } from "@ens-node-metadata/sdk";
11
217
 
12
218
  // src/lib/ens-write.ts
13
- import { http, createPublicClient, createWalletClient } from "viem";
219
+ import { encodeFunctionData, http, createPublicClient, createWalletClient } from "viem";
14
220
  import { privateKeyToAccount } from "viem/accounts";
15
221
  import { mainnet } from "viem/chains";
16
- async function setEnsTextRecords(ensName, texts, privateKey) {
222
+ async function ensSetup(privateKey) {
17
223
  const { addEnsContracts } = await import("@ensdomains/ensjs");
18
- const { setRecords } = await import("@ensdomains/ensjs/wallet");
19
- const { getResolver } = await import("@ensdomains/ensjs/public");
20
224
  const account = privateKeyToAccount(privateKey);
21
225
  const chain = addEnsContracts(mainnet);
22
226
  const publicClient = createPublicClient({ chain, transport: http() });
23
227
  const walletClient = createWalletClient({ account, chain, transport: http() });
228
+ return { account, chain, publicClient, walletClient };
229
+ }
230
+ async function resolveEns(publicClient, ensName) {
231
+ const { getResolver } = await import("@ensdomains/ensjs/public");
24
232
  const resolverAddress = await getResolver(publicClient, { name: ensName });
25
233
  if (!resolverAddress) {
26
234
  throw new Error(`No resolver found for ${ensName}. Set a resolver first.`);
27
235
  }
236
+ return resolverAddress;
237
+ }
238
+ async function estimateEnsTextRecordsCost(ensName, texts, privateKey) {
239
+ const { account, publicClient } = await ensSetup(privateKey);
240
+ const { namehash, generateRecordCallArray } = await import("@ensdomains/ensjs/utils");
241
+ const resolverAddress = await resolveEns(publicClient, ensName);
242
+ const node = namehash(ensName);
243
+ const calls = generateRecordCallArray({
244
+ namehash: node,
245
+ texts: texts.map((t) => ({ key: t.key, value: t.value })),
246
+ coins: []
247
+ });
248
+ const data = calls.length === 1 ? calls[0] : encodeFunctionData({
249
+ abi: [{ name: "multicall", type: "function", inputs: [{ name: "data", type: "bytes[]" }], outputs: [{ name: "", type: "bytes[]" }] }],
250
+ functionName: "multicall",
251
+ args: [calls]
252
+ });
253
+ return estimateCost(publicClient, {
254
+ account: account.address,
255
+ to: resolverAddress,
256
+ data
257
+ });
258
+ }
259
+ async function setEnsTextRecords(ensName, texts, privateKey) {
260
+ const { publicClient, walletClient } = await ensSetup(privateKey);
261
+ const { setRecords } = await import("@ensdomains/ensjs/wallet");
262
+ const resolverAddress = await resolveEns(publicClient, ensName);
28
263
  const hash = await setRecords(walletClient, {
29
264
  name: ensName,
30
265
  texts,
@@ -47,6 +282,10 @@ var options = z.object({
47
282
  function Set({ args: [ensName, payloadFile], options: options2 }) {
48
283
  const { exit } = useApp();
49
284
  const [state, setState] = React.useState({ status: "idle" });
285
+ React.useEffect(() => {
286
+ if (state.status === "done") exit();
287
+ else if (state.status === "error") exit(new Error(state.message));
288
+ }, [state, exit]);
50
289
  React.useEffect(() => {
51
290
  async function run() {
52
291
  let payload;
@@ -57,40 +296,54 @@ function Set({ args: [ensName, payloadFile], options: options2 }) {
57
296
  const issues = result.errors.map((e) => `[${e.key}] ${e.message}`).join("\n");
58
297
  setState({ status: "error", message: `Invalid payload:
59
298
  ${issues}` });
60
- exit(new Error("validation failed"));
61
299
  return;
62
300
  }
63
301
  payload = result.data;
64
302
  } catch (err) {
65
303
  setState({ status: "error", message: `Error reading payload: ${err.message}` });
66
- exit(new Error("read error"));
67
304
  return;
68
305
  }
306
+ try {
307
+ const registry = await getPublishedRegistry();
308
+ const agentSchema = registry.schemas["agent"];
309
+ if (agentSchema) {
310
+ const latestVersion = agentSchema.published[agentSchema.latest];
311
+ if (latestVersion?.cid) {
312
+ payload["schema"] = `ipfs://${latestVersion.cid}`;
313
+ }
314
+ }
315
+ } catch {
316
+ }
69
317
  const texts = Object.entries(payload).map(([key, value]) => ({ key, value }));
70
318
  if (!options2.broadcast) {
319
+ let costLine = " Est. Cost: unable to estimate";
320
+ try {
321
+ const est = await estimateEnsTextRecordsCost(ensName, texts, options2.privateKey);
322
+ costLine = ` Est. Cost: ${formatCost(est)}`;
323
+ } catch (err) {
324
+ console.error("DEBUG estimate error:", err);
325
+ }
71
326
  const lines = [
72
327
  `Dry run \u2014 would set ${texts.length} text records on ${ensName}:`,
73
328
  "",
74
329
  ...texts.map((t) => ` setText("${t.key}", "${t.value}")`),
330
+ costLine,
75
331
  "",
76
332
  "Run with --broadcast to submit on-chain."
77
333
  ];
78
334
  setState({ status: "done", message: lines.join("\n") });
79
- exit();
80
335
  return;
81
336
  }
82
337
  setState({ status: "working", message: `Setting ${texts.length} text records on ${ensName}\u2026` });
83
338
  try {
84
339
  const hash = await setEnsTextRecords(ensName, texts, options2.privateKey);
85
340
  setState({ status: "done", message: `\u2705 Transaction submitted: ${hash}` });
86
- exit();
87
341
  } catch (err) {
88
342
  setState({ status: "error", message: `Transaction failed: ${err.message}` });
89
- exit(new Error("tx failed"));
90
343
  }
91
344
  }
92
345
  run();
93
- }, [exit, ensName, payloadFile, options2]);
346
+ }, [ensName, payloadFile, options2]);
94
347
  return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, state.status === "idle" && /* @__PURE__ */ React.createElement(Text, { color: "gray" }, "Preparing\u2026"), state.status === "working" && /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.message), state.status === "done" && /* @__PURE__ */ React.createElement(Text, { color: "green" }, state.message), state.status === "error" && /* @__PURE__ */ React.createElement(Text, { color: "red" }, "\u274C ", state.message));
95
348
  }
96
349
  export {
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  SCHEMA_MAP
3
- } from "../../chunk-3VTAAUSG.js";
3
+ } from "../../chunk-6IGJKB4W.js";
4
+ import "../../chunk-YZFATT7X.js";
4
5
 
5
6
  // src/commands/metadata/template.tsx
6
7
  import { Text } from "ink";
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  SCHEMA_MAP
3
- } from "../../chunk-3VTAAUSG.js";
3
+ } from "../../chunk-6IGJKB4W.js";
4
+ import "../../chunk-YZFATT7X.js";
4
5
 
5
6
  // src/commands/metadata/validate.tsx
6
7
  import { readFileSync } from "fs";
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  validateRegistrationFile
3
3
  } from "../../chunk-UDZL55XF.js";
4
+ import "../../chunk-YZFATT7X.js";
4
5
 
5
6
  // src/commands/registration-file/publish.tsx
6
7
  import { readFileSync } from "fs";
@@ -1,3 +1,5 @@
1
+ import "../../chunk-YZFATT7X.js";
2
+
1
3
  // src/commands/registration-file/template.tsx
2
4
  import { useApp } from "ink";
3
5
  import React from "react";
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  validateRegistrationFile
3
3
  } from "../../chunk-UDZL55XF.js";
4
+ import "../../chunk-YZFATT7X.js";
4
5
 
5
6
  // src/commands/registration-file/validate.tsx
6
7
  import { readFileSync } from "fs";
@@ -0,0 +1,3 @@
1
+ declare const description = "ERC-8004 identity registry commands";
2
+
3
+ export { description };
@@ -0,0 +1,7 @@
1
+ import "../../../chunk-YZFATT7X.js";
2
+
3
+ // src/commands/registry/identity/index.tsx
4
+ var description = "ERC-8004 identity registry commands";
5
+ export {
6
+ description
7
+ };
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { z } from 'zod';
3
+
4
+ declare const description = "Query agent identity on ERC-8004 registry";
5
+ declare const options: z.ZodObject<{
6
+ chainName: z.ZodDefault<z.ZodEnum<[string, ...string[]]>>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ chainName: string;
9
+ }, {
10
+ chainName?: string | undefined;
11
+ }>;
12
+ declare const args: z.ZodTuple<[z.ZodString], null>;
13
+ type Props = {
14
+ options: z.infer<typeof options>;
15
+ args: z.infer<typeof args>;
16
+ };
17
+ declare function Query({ options: { chainName }, args: [agentId], }: Props): React.JSX.Element;
18
+
19
+ export { args, Query as default, description, options };
@@ -0,0 +1,74 @@
1
+ import {
2
+ IdentityRegistry_default,
3
+ SUPPORTED_CHAINS,
4
+ resolveChain
5
+ } from "../../../chunk-DXAESRZH.js";
6
+ import "../../../chunk-YZFATT7X.js";
7
+
8
+ // src/commands/registry/identity/query.tsx
9
+ import { Box, Text, useApp } from "ink";
10
+ import React from "react";
11
+ import { http, createPublicClient } from "viem";
12
+ import { z } from "zod";
13
+ var description = "Query agent identity on ERC-8004 registry";
14
+ var options = z.object({
15
+ chainName: z.enum(SUPPORTED_CHAINS).default("mainnet").describe("Chain name (e.g. mainnet, base, arbitrum, optimism)")
16
+ });
17
+ var args = z.tuple([z.string().describe("agent-id (token ID)")]);
18
+ function Query({
19
+ options: { chainName },
20
+ args: [agentId]
21
+ }) {
22
+ const { exit } = useApp();
23
+ const [state, setState] = React.useState({ status: "loading" });
24
+ React.useEffect(() => {
25
+ if (state.status === "done") exit();
26
+ else if (state.status === "error") exit(new Error(state.message));
27
+ }, [state, exit]);
28
+ React.useEffect(() => {
29
+ async function run() {
30
+ const { chain, registryAddress } = resolveChain(chainName);
31
+ try {
32
+ const client = createPublicClient({ chain, transport: http() });
33
+ const tokenId = BigInt(agentId);
34
+ const [owner, uri] = await Promise.all([
35
+ client.readContract({
36
+ address: registryAddress,
37
+ abi: IdentityRegistry_default,
38
+ functionName: "ownerOf",
39
+ args: [tokenId]
40
+ }),
41
+ client.readContract({
42
+ address: registryAddress,
43
+ abi: IdentityRegistry_default,
44
+ functionName: "tokenURI",
45
+ args: [tokenId]
46
+ })
47
+ ]);
48
+ setState({
49
+ status: "done",
50
+ identity: {
51
+ owner,
52
+ tokenId,
53
+ agentUri: uri,
54
+ chain: chainName,
55
+ registryAddress
56
+ }
57
+ });
58
+ } catch (err) {
59
+ setState({
60
+ status: "error",
61
+ message: `Registry read failed: ${err.message}`
62
+ });
63
+ }
64
+ }
65
+ run();
66
+ }, [chainName, agentId]);
67
+ return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, state.status === "loading" && /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, "Querying ERC-8004 registry\u2026"), state.status === "done" && /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(Text, { color: "green" }, "\u2705 Agent Identity (", state.identity.chain, ")"), /* @__PURE__ */ React.createElement(Text, null, " Agent URI: ", state.identity.agentUri), /* @__PURE__ */ React.createElement(Text, null, " Owner: ", state.identity.owner), /* @__PURE__ */ React.createElement(Text, null, " Token ID: ", state.identity.tokenId.toString()), /* @__PURE__ */ React.createElement(Text, null, " Registry: ", state.identity.registryAddress)), state.status === "error" && /* @__PURE__ */ React.createElement(Text, { color: "red" }, "\u274C ", state.message));
68
+ }
69
+ export {
70
+ args,
71
+ Query as default,
72
+ description,
73
+ options
74
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { z } from 'zod';
3
+
4
+ declare const description = "Register agent identity on ERC-8004 registry";
5
+ declare const options: z.ZodObject<{
6
+ chainName: z.ZodDefault<z.ZodEnum<[string, ...string[]]>>;
7
+ privateKey: z.ZodString;
8
+ broadcast: z.ZodDefault<z.ZodBoolean>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ chainName: string;
11
+ privateKey: string;
12
+ broadcast: boolean;
13
+ }, {
14
+ privateKey: string;
15
+ chainName?: string | undefined;
16
+ broadcast?: boolean | undefined;
17
+ }>;
18
+ declare const args: z.ZodTuple<[z.ZodString], null>;
19
+ type Props = {
20
+ options: z.infer<typeof options>;
21
+ args: z.infer<typeof args>;
22
+ };
23
+ declare function Register({ options: { chainName, privateKey, broadcast }, args: [agentUri], }: Props): React.JSX.Element;
24
+
25
+ export { args, Register as default, description, options };