@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,112 @@
1
+ import {
2
+ estimateCost,
3
+ formatCost
4
+ } from "../../../chunk-X6M7WZJF.js";
5
+ import {
6
+ IdentityRegistry_default,
7
+ SUPPORTED_CHAINS,
8
+ resolveChain
9
+ } from "../../../chunk-DXAESRZH.js";
10
+ import "../../../chunk-YZFATT7X.js";
11
+
12
+ // src/commands/registry/identity/register.tsx
13
+ import { Box, Text, useApp } from "ink";
14
+ import React from "react";
15
+ import { encodeFunctionData, http, createPublicClient, createWalletClient } from "viem";
16
+ import { privateKeyToAccount } from "viem/accounts";
17
+ import { z } from "zod";
18
+ var description = "Register agent identity on ERC-8004 registry";
19
+ var options = z.object({
20
+ chainName: z.enum(SUPPORTED_CHAINS).default("mainnet").describe("Chain name (e.g. mainnet, base, arbitrum, optimism)"),
21
+ privateKey: z.string().describe("Private key for signing (hex, prefixed with 0x)"),
22
+ broadcast: z.boolean().default(false).describe("Broadcast the transaction on-chain (default: dry run)")
23
+ });
24
+ var args = z.tuple([z.string().describe("agent-uri (e.g. ipfs://...)")]);
25
+ function Register({
26
+ options: { chainName, privateKey, broadcast },
27
+ args: [agentUri]
28
+ }) {
29
+ const { exit } = useApp();
30
+ const [state, setState] = React.useState({ status: "idle" });
31
+ React.useEffect(() => {
32
+ if (state.status === "done") exit();
33
+ else if (state.status === "error") exit(new Error(state.message));
34
+ }, [state, exit]);
35
+ React.useEffect(() => {
36
+ async function run() {
37
+ const { chain, registryAddress } = resolveChain(chainName);
38
+ const account = privateKeyToAccount(privateKey);
39
+ if (!broadcast) {
40
+ const publicClient = createPublicClient({ chain, transport: http() });
41
+ const data = encodeFunctionData({
42
+ abi: IdentityRegistry_default,
43
+ functionName: "register",
44
+ args: [agentUri]
45
+ });
46
+ let costLine = " Est. Cost: unable to estimate";
47
+ try {
48
+ const est = await estimateCost(publicClient, {
49
+ account: account.address,
50
+ to: registryAddress,
51
+ data
52
+ });
53
+ costLine = ` Est. Cost: ${formatCost(est)}`;
54
+ } catch {
55
+ }
56
+ setState({
57
+ status: "done",
58
+ message: [
59
+ `Dry run \u2014 would call register on ${chainName}:`,
60
+ "",
61
+ ` Registry: ${registryAddress}`,
62
+ ` Agent URI: ${agentUri}`,
63
+ ` Signer: ${account.address}`,
64
+ costLine,
65
+ "",
66
+ "Run with --broadcast to submit on-chain."
67
+ ].join("\n")
68
+ });
69
+ return;
70
+ }
71
+ setState({ status: "working", message: `Registering agent on ${chainName}\u2026` });
72
+ try {
73
+ const publicClient = createPublicClient({ chain, transport: http() });
74
+ const walletClient = createWalletClient({
75
+ account,
76
+ chain,
77
+ transport: http()
78
+ });
79
+ const { request } = await publicClient.simulateContract({
80
+ account,
81
+ address: registryAddress,
82
+ abi: IdentityRegistry_default,
83
+ functionName: "register",
84
+ args: [agentUri]
85
+ });
86
+ const txHash = await walletClient.writeContract(request);
87
+ setState({
88
+ status: "done",
89
+ message: [
90
+ `\u2705 Agent registered on ${chainName}`,
91
+ ` Agent URI: ${agentUri}`,
92
+ ` Tx Hash: ${txHash}`,
93
+ ` Registry: ${registryAddress}`
94
+ ].join("\n")
95
+ });
96
+ } catch (err) {
97
+ setState({
98
+ status: "error",
99
+ message: `Registration failed: ${err.message}`
100
+ });
101
+ }
102
+ }
103
+ run();
104
+ }, [chainName, privateKey, broadcast, agentUri]);
105
+ 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));
106
+ }
107
+ export {
108
+ args,
109
+ Register as default,
110
+ description,
111
+ options
112
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { z } from 'zod';
3
+
4
+ declare const description = "Update agent URI on the 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, z.ZodString], null>;
19
+ type Props = {
20
+ options: z.infer<typeof options>;
21
+ args: z.infer<typeof args>;
22
+ };
23
+ declare function SetUri({ options: { chainName, privateKey, broadcast }, args: [agentId, newUri], }: Props): React.JSX.Element;
24
+
25
+ export { args, SetUri as default, description, options };
@@ -0,0 +1,113 @@
1
+ import {
2
+ estimateCost,
3
+ formatCost
4
+ } from "../../../chunk-X6M7WZJF.js";
5
+ import {
6
+ IdentityRegistry_default,
7
+ SUPPORTED_CHAINS,
8
+ resolveChain
9
+ } from "../../../chunk-DXAESRZH.js";
10
+ import "../../../chunk-YZFATT7X.js";
11
+
12
+ // src/commands/registry/identity/set-uri.tsx
13
+ import { Box, Text, useApp } from "ink";
14
+ import React from "react";
15
+ import { encodeFunctionData, http, createPublicClient, createWalletClient } from "viem";
16
+ import { privateKeyToAccount } from "viem/accounts";
17
+ import { z } from "zod";
18
+ var description = "Update agent URI on the ERC-8004 registry";
19
+ var options = z.object({
20
+ chainName: z.enum(SUPPORTED_CHAINS).default("mainnet").describe("Chain name (e.g. mainnet, base, arbitrum, optimism)"),
21
+ privateKey: z.string().describe("Private key for signing (hex, prefixed with 0x)"),
22
+ broadcast: z.boolean().default(false).describe("Broadcast the transaction on-chain (default: dry run)")
23
+ });
24
+ var args = z.tuple([
25
+ z.string().describe("agent-id (token ID)"),
26
+ z.string().describe("new-uri (e.g. ipfs://...)")
27
+ ]);
28
+ function SetUri({
29
+ options: { chainName, privateKey, broadcast },
30
+ args: [agentId, newUri]
31
+ }) {
32
+ const { exit } = useApp();
33
+ const [state, setState] = React.useState({ status: "idle" });
34
+ React.useEffect(() => {
35
+ if (state.status === "done") exit();
36
+ else if (state.status === "error") exit(new Error(state.message));
37
+ }, [state, exit]);
38
+ React.useEffect(() => {
39
+ async function run() {
40
+ const { chain, registryAddress } = resolveChain(chainName);
41
+ const account = privateKeyToAccount(privateKey);
42
+ const tokenId = BigInt(agentId);
43
+ if (!broadcast) {
44
+ const publicClient = createPublicClient({ chain, transport: http() });
45
+ const data = encodeFunctionData({
46
+ abi: IdentityRegistry_default,
47
+ functionName: "setAgentURI",
48
+ args: [tokenId, newUri]
49
+ });
50
+ let costLine = " Est. Cost: unable to estimate";
51
+ try {
52
+ const est = await estimateCost(publicClient, {
53
+ account: account.address,
54
+ to: registryAddress,
55
+ data
56
+ });
57
+ costLine = ` Est. Cost: ${formatCost(est)}`;
58
+ } catch {
59
+ }
60
+ setState({
61
+ status: "done",
62
+ message: [
63
+ `Dry run \u2014 would call setAgentURI on ${chainName}:`,
64
+ "",
65
+ ` Registry: ${registryAddress}`,
66
+ ` Agent ID: ${tokenId.toString()}`,
67
+ ` New URI: ${newUri}`,
68
+ ` Signer: ${account.address}`,
69
+ costLine,
70
+ "",
71
+ "Run with --broadcast to submit on-chain."
72
+ ].join("\n")
73
+ });
74
+ return;
75
+ }
76
+ setState({ status: "working", message: `Updating agent URI on ${chainName}\u2026` });
77
+ try {
78
+ const publicClient = createPublicClient({ chain, transport: http() });
79
+ const walletClient = createWalletClient({ account, chain, transport: http() });
80
+ const { request } = await publicClient.simulateContract({
81
+ account,
82
+ address: registryAddress,
83
+ abi: IdentityRegistry_default,
84
+ functionName: "setAgentURI",
85
+ args: [tokenId, newUri]
86
+ });
87
+ const txHash = await walletClient.writeContract(request);
88
+ setState({
89
+ status: "done",
90
+ message: [
91
+ `\u2705 Agent URI updated on ${chainName}`,
92
+ ` Agent ID: ${tokenId.toString()}`,
93
+ ` New URI: ${newUri}`,
94
+ ` Tx Hash: ${txHash}`
95
+ ].join("\n")
96
+ });
97
+ } catch (err) {
98
+ setState({
99
+ status: "error",
100
+ message: `setAgentURI failed: ${err.message}`
101
+ });
102
+ }
103
+ }
104
+ run();
105
+ }, [chainName, privateKey, broadcast, agentId, newUri]);
106
+ 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));
107
+ }
108
+ export {
109
+ args,
110
+ SetUri as default,
111
+ description,
112
+ options
113
+ };
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { z } from 'zod';
3
+
4
+ declare const description = "Link a verified wallet to an agent via EIP-712 signature";
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
+ deadline: z.ZodOptional<z.ZodString>;
10
+ signature: z.ZodOptional<z.ZodString>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ chainName: string;
13
+ privateKey: string;
14
+ broadcast: boolean;
15
+ deadline?: string | undefined;
16
+ signature?: string | undefined;
17
+ }, {
18
+ privateKey: string;
19
+ deadline?: string | undefined;
20
+ signature?: string | undefined;
21
+ chainName?: string | undefined;
22
+ broadcast?: boolean | undefined;
23
+ }>;
24
+ declare const args: z.ZodTuple<[z.ZodString, z.ZodString], null>;
25
+ type Props = {
26
+ options: z.infer<typeof options>;
27
+ args: z.infer<typeof args>;
28
+ };
29
+ declare function SetWallet({ options: { chainName, privateKey, broadcast, deadline: deadlineOpt, signature: signatureOpt }, args: [agentId, walletAddress], }: Props): React.JSX.Element;
30
+
31
+ export { args, SetWallet as default, description, options };
@@ -0,0 +1,191 @@
1
+ import {
2
+ estimateCost,
3
+ formatCost
4
+ } from "../../../chunk-X6M7WZJF.js";
5
+ import {
6
+ IdentityRegistry_default,
7
+ SUPPORTED_CHAINS,
8
+ resolveChain
9
+ } from "../../../chunk-DXAESRZH.js";
10
+ import "../../../chunk-YZFATT7X.js";
11
+
12
+ // src/commands/registry/identity/set-wallet.tsx
13
+ import { Box, Text, useApp } from "ink";
14
+ import React from "react";
15
+ import { encodeFunctionData, http, createPublicClient, createWalletClient, verifyTypedData } from "viem";
16
+ import { privateKeyToAccount } from "viem/accounts";
17
+ import { z } from "zod";
18
+ var description = "Link a verified wallet to an agent via EIP-712 signature";
19
+ var options = z.object({
20
+ chainName: z.enum(SUPPORTED_CHAINS).default("mainnet").describe("Chain name (e.g. mainnet, base, arbitrum, optimism)"),
21
+ privateKey: z.string().describe("Private key for signing (hex, prefixed with 0x)"),
22
+ broadcast: z.boolean().default(false).describe("Broadcast the transaction on-chain (default: dry run)"),
23
+ deadline: z.string().optional().describe("Deadline unix timestamp (auto-generated if omitted)"),
24
+ signature: z.string().optional().describe("EIP-712 signature from the wallet (auto-signed if omitted)")
25
+ });
26
+ var args = z.tuple([
27
+ z.string().describe("agent-id (token ID)"),
28
+ z.string().describe("wallet-address (0x...)")
29
+ ]);
30
+ var EIP712_TYPES = {
31
+ AgentWalletSet: [
32
+ { name: "agentId", type: "uint256" },
33
+ { name: "newWallet", type: "address" },
34
+ { name: "owner", type: "address" },
35
+ { name: "deadline", type: "uint256" }
36
+ ]
37
+ };
38
+ function SetWallet({
39
+ options: { chainName, privateKey, broadcast, deadline: deadlineOpt, signature: signatureOpt },
40
+ args: [agentId, walletAddress]
41
+ }) {
42
+ const { exit } = useApp();
43
+ const [state, setState] = React.useState({ status: "idle" });
44
+ React.useEffect(() => {
45
+ if (state.status === "done") exit();
46
+ else if (state.status === "error") exit(new Error(state.message));
47
+ }, [state, exit]);
48
+ React.useEffect(() => {
49
+ async function run() {
50
+ const { chain, registryAddress } = resolveChain(chainName);
51
+ const account = privateKeyToAccount(privateKey);
52
+ const publicClient = createPublicClient({ chain, transport: http() });
53
+ const tokenId = BigInt(agentId);
54
+ const chainId = await publicClient.getChainId();
55
+ const domain = {
56
+ name: "ERC8004IdentityRegistry",
57
+ version: "1",
58
+ chainId,
59
+ verifyingContract: registryAddress
60
+ };
61
+ let finalDeadline;
62
+ let finalSignature;
63
+ if (signatureOpt && deadlineOpt) {
64
+ finalDeadline = BigInt(deadlineOpt);
65
+ finalSignature = signatureOpt;
66
+ const valid = await verifyTypedData({
67
+ address: walletAddress,
68
+ domain,
69
+ types: EIP712_TYPES,
70
+ primaryType: "AgentWalletSet",
71
+ message: {
72
+ agentId: tokenId,
73
+ newWallet: walletAddress,
74
+ owner: account.address,
75
+ deadline: finalDeadline
76
+ },
77
+ signature: finalSignature
78
+ });
79
+ if (!valid) {
80
+ setState({
81
+ status: "error",
82
+ message: `Signature does not recover to wallet ${walletAddress}`
83
+ });
84
+ return;
85
+ }
86
+ } else {
87
+ const block = await publicClient.getBlock();
88
+ finalDeadline = block.timestamp + 240n;
89
+ const walletClient = createWalletClient({ account, chain, transport: http() });
90
+ finalSignature = await walletClient.signTypedData({
91
+ account,
92
+ domain,
93
+ types: EIP712_TYPES,
94
+ primaryType: "AgentWalletSet",
95
+ message: {
96
+ agentId: tokenId,
97
+ newWallet: walletAddress,
98
+ owner: account.address,
99
+ deadline: finalDeadline
100
+ }
101
+ });
102
+ }
103
+ if (!broadcast) {
104
+ const data = encodeFunctionData({
105
+ abi: IdentityRegistry_default,
106
+ functionName: "setAgentWallet",
107
+ args: [tokenId, walletAddress, finalDeadline, finalSignature]
108
+ });
109
+ let costLine = " Est. Cost: unable to estimate";
110
+ try {
111
+ const est = await estimateCost(publicClient, {
112
+ account: account.address,
113
+ to: registryAddress,
114
+ data
115
+ });
116
+ costLine = ` Est. Cost: ${formatCost(est)}`;
117
+ } catch {
118
+ }
119
+ const lines = [
120
+ `Dry run \u2014 would call setAgentWallet on ${chainName}:`,
121
+ "",
122
+ ` Registry: ${registryAddress}`,
123
+ ` Agent ID: ${tokenId.toString()}`,
124
+ ` Wallet: ${walletAddress}`,
125
+ ` Deadline: ${finalDeadline.toString()}`,
126
+ ` Signer: ${account.address}`,
127
+ ` Signature: ${signatureOpt ? "provided (verified)" : "auto-signed"}`,
128
+ costLine
129
+ ];
130
+ if (!signatureOpt) {
131
+ lines.push(
132
+ "",
133
+ "If the wallet is controlled by a different key, have them sign:",
134
+ "",
135
+ " EIP-712 Domain:",
136
+ ` name: ERC8004IdentityRegistry`,
137
+ ` version: 1`,
138
+ ` chainId: ${chainId}`,
139
+ ` verifyingContract: ${registryAddress}`,
140
+ "",
141
+ " Primary Type: AgentWalletSet",
142
+ " Message:",
143
+ ` agentId: ${tokenId.toString()}`,
144
+ ` newWallet: <wallet-address>`,
145
+ ` owner: ${account.address}`,
146
+ ` deadline: <unix-timestamp>`,
147
+ "",
148
+ "Then pass --signature <0x...> --deadline <timestamp>"
149
+ );
150
+ }
151
+ lines.push("", "Run with --broadcast to submit on-chain.");
152
+ setState({ status: "done", message: lines.join("\n") });
153
+ return;
154
+ }
155
+ setState({ status: "working", message: `Linking wallet on ${chainName}\u2026` });
156
+ try {
157
+ const walletClient = createWalletClient({ account, chain, transport: http() });
158
+ const { request } = await publicClient.simulateContract({
159
+ account,
160
+ address: registryAddress,
161
+ abi: IdentityRegistry_default,
162
+ functionName: "setAgentWallet",
163
+ args: [tokenId, walletAddress, finalDeadline, finalSignature]
164
+ });
165
+ const txHash = await walletClient.writeContract(request);
166
+ setState({
167
+ status: "done",
168
+ message: [
169
+ `\u2705 Wallet linked on ${chainName}`,
170
+ ` Agent ID: ${tokenId.toString()}`,
171
+ ` Wallet: ${walletAddress}`,
172
+ ` Tx Hash: ${txHash}`
173
+ ].join("\n")
174
+ });
175
+ } catch (err) {
176
+ setState({
177
+ status: "error",
178
+ message: `setAgentWallet failed: ${err.message}`
179
+ });
180
+ }
181
+ }
182
+ run();
183
+ }, [chainName, privateKey, broadcast, agentId, walletAddress, deadlineOpt, signatureOpt]);
184
+ 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));
185
+ }
186
+ export {
187
+ args,
188
+ SetWallet as default,
189
+ description,
190
+ options
191
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { z } from 'zod';
3
+
4
+ declare const description = "Clear the verified wallet from an agent";
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 UnsetWallet({ options: { chainName, privateKey, broadcast }, args: [agentId], }: Props): React.JSX.Element;
24
+
25
+ export { args, UnsetWallet as default, description, options };
@@ -0,0 +1,108 @@
1
+ import {
2
+ estimateCost,
3
+ formatCost
4
+ } from "../../../chunk-X6M7WZJF.js";
5
+ import {
6
+ IdentityRegistry_default,
7
+ SUPPORTED_CHAINS,
8
+ resolveChain
9
+ } from "../../../chunk-DXAESRZH.js";
10
+ import "../../../chunk-YZFATT7X.js";
11
+
12
+ // src/commands/registry/identity/unset-wallet.tsx
13
+ import { Box, Text, useApp } from "ink";
14
+ import React from "react";
15
+ import { encodeFunctionData, http, createPublicClient, createWalletClient } from "viem";
16
+ import { privateKeyToAccount } from "viem/accounts";
17
+ import { z } from "zod";
18
+ var description = "Clear the verified wallet from an agent";
19
+ var options = z.object({
20
+ chainName: z.enum(SUPPORTED_CHAINS).default("mainnet").describe("Chain name (e.g. mainnet, base, arbitrum, optimism)"),
21
+ privateKey: z.string().describe("Private key for signing (hex, prefixed with 0x)"),
22
+ broadcast: z.boolean().default(false).describe("Broadcast the transaction on-chain (default: dry run)")
23
+ });
24
+ var args = z.tuple([z.string().describe("agent-id (token ID)")]);
25
+ function UnsetWallet({
26
+ options: { chainName, privateKey, broadcast },
27
+ args: [agentId]
28
+ }) {
29
+ const { exit } = useApp();
30
+ const [state, setState] = React.useState({ status: "idle" });
31
+ React.useEffect(() => {
32
+ if (state.status === "done") exit();
33
+ else if (state.status === "error") exit(new Error(state.message));
34
+ }, [state, exit]);
35
+ React.useEffect(() => {
36
+ async function run() {
37
+ const { chain, registryAddress } = resolveChain(chainName);
38
+ const account = privateKeyToAccount(privateKey);
39
+ const tokenId = BigInt(agentId);
40
+ if (!broadcast) {
41
+ const publicClient = createPublicClient({ chain, transport: http() });
42
+ const data = encodeFunctionData({
43
+ abi: IdentityRegistry_default,
44
+ functionName: "unsetAgentWallet",
45
+ args: [tokenId]
46
+ });
47
+ let costLine = " Est. Cost: unable to estimate";
48
+ try {
49
+ const est = await estimateCost(publicClient, {
50
+ account: account.address,
51
+ to: registryAddress,
52
+ data
53
+ });
54
+ costLine = ` Est. Cost: ${formatCost(est)}`;
55
+ } catch {
56
+ }
57
+ setState({
58
+ status: "done",
59
+ message: [
60
+ `Dry run \u2014 would call unsetAgentWallet on ${chainName}:`,
61
+ "",
62
+ ` Registry: ${registryAddress}`,
63
+ ` Agent ID: ${tokenId.toString()}`,
64
+ ` Signer: ${account.address}`,
65
+ costLine,
66
+ "",
67
+ "Run with --broadcast to submit on-chain."
68
+ ].join("\n")
69
+ });
70
+ return;
71
+ }
72
+ setState({ status: "working", message: `Clearing wallet on ${chainName}\u2026` });
73
+ try {
74
+ const publicClient = createPublicClient({ chain, transport: http() });
75
+ const walletClient = createWalletClient({ account, chain, transport: http() });
76
+ const { request } = await publicClient.simulateContract({
77
+ account,
78
+ address: registryAddress,
79
+ abi: IdentityRegistry_default,
80
+ functionName: "unsetAgentWallet",
81
+ args: [tokenId]
82
+ });
83
+ const txHash = await walletClient.writeContract(request);
84
+ setState({
85
+ status: "done",
86
+ message: [
87
+ `\u2705 Wallet cleared on ${chainName}`,
88
+ ` Agent ID: ${tokenId.toString()}`,
89
+ ` Tx Hash: ${txHash}`
90
+ ].join("\n")
91
+ });
92
+ } catch (err) {
93
+ setState({
94
+ status: "error",
95
+ message: `unsetAgentWallet failed: ${err.message}`
96
+ });
97
+ }
98
+ }
99
+ run();
100
+ }, [chainName, privateKey, broadcast, agentId]);
101
+ 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));
102
+ }
103
+ export {
104
+ args,
105
+ UnsetWallet as default,
106
+ description,
107
+ options
108
+ };
@@ -1,3 +1,5 @@
1
+ import "../chunk-YZFATT7X.js";
2
+
1
3
  // src/commands/skill.tsx
2
4
  import { copyFileSync, existsSync, readFileSync } from "fs";
3
5
  import { dirname, join, resolve } from "path";
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ import {
2
2
  SCHEMA_8004_V2,
3
3
  validateRegistrationFile
4
4
  } from "./chunk-UDZL55XF.js";
5
+ import "./chunk-YZFATT7X.js";
5
6
  export {
6
7
  SCHEMA_8004_V2,
7
8
  validateRegistrationFile