@attestify/cli 0.1.2 → 0.1.5
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 +304 -29
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +14 -12
package/README.md
CHANGED
|
@@ -1,74 +1,341 @@
|
|
|
1
1
|
# @attestify/cli
|
|
2
2
|
|
|
3
|
-
Command-line tool for
|
|
3
|
+
Command-line tool for the Attestify protocol on Hedera — 40+ commands covering schemas, attestations, authorities, delegation, resolvers, HCS audit log, scheduled revocations, multi-sig, staking, file service, and AI-powered natural language mode.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@attestify/cli)
|
|
6
|
+
[](LICENSE)
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
# From hedera/ root
|
|
9
|
-
pnpm install
|
|
8
|
+
## Installation
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
```bash
|
|
11
|
+
npm install -g @attestify/cli
|
|
12
|
+
# or
|
|
13
|
+
pnpm add -g @attestify/cli
|
|
13
14
|
```
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
## Configuration
|
|
17
|
+
|
|
18
|
+
Set credentials via environment variables or a `.env` file:
|
|
16
19
|
|
|
17
20
|
```bash
|
|
18
|
-
|
|
19
|
-
export
|
|
21
|
+
# Required
|
|
22
|
+
export HEDERA_ACCOUNT_ID="0.0.XXXXX"
|
|
23
|
+
export HEDERA_PRIVATE_KEY="your-ecdsa-private-key-hex"
|
|
24
|
+
|
|
25
|
+
# Optional
|
|
26
|
+
export INDEXER_URL="http://localhost:3001/api"
|
|
27
|
+
export HCS_TOPIC_SCHEMAS="0.0.8221945"
|
|
28
|
+
export HCS_TOPIC_ATTESTATIONS="0.0.8221946"
|
|
29
|
+
export HCS_TOPIC_AUTHORITIES="0.0.8221947"
|
|
20
30
|
```
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
All commands target Hedera testnet. Append `--json` to any command for machine-readable JSON output.
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
---
|
|
25
35
|
|
|
26
|
-
|
|
36
|
+
## Schema Commands
|
|
27
37
|
|
|
28
38
|
```bash
|
|
29
|
-
# Register a schema
|
|
30
|
-
attestify schema create
|
|
39
|
+
# Register a schema (inline)
|
|
40
|
+
attestify schema create \
|
|
41
|
+
--definition "string name, uint256 age, bool verified" \
|
|
42
|
+
--revocable \
|
|
43
|
+
--resolver 0x461349A8aEfB220A48b61923095DfF237465c27A
|
|
31
44
|
|
|
32
|
-
# Register from
|
|
45
|
+
# Register from JSON file
|
|
33
46
|
attestify schema create --file schema.json
|
|
34
47
|
|
|
35
48
|
# Fetch a schema by UID
|
|
36
|
-
attestify schema fetch --uid
|
|
49
|
+
attestify schema fetch --uid 0x7408a93fa658b219...
|
|
50
|
+
|
|
51
|
+
# List all schemas
|
|
52
|
+
attestify schema list
|
|
53
|
+
|
|
54
|
+
# Filter by authority
|
|
55
|
+
attestify schema list --authority 0x9Bf9a686... --limit 10
|
|
37
56
|
```
|
|
38
57
|
|
|
39
|
-
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Attestation Commands
|
|
40
61
|
|
|
41
62
|
```bash
|
|
42
63
|
# Create an attestation
|
|
43
64
|
attestify attestation create \
|
|
44
|
-
--schema-uid
|
|
45
|
-
--subject
|
|
46
|
-
--data
|
|
47
|
-
--expiration
|
|
65
|
+
--schema-uid 0x7408a93f... \
|
|
66
|
+
--subject 0x0F1A0cb4... \
|
|
67
|
+
--data 0x00000000... \
|
|
68
|
+
--expiration 1735689600
|
|
48
69
|
|
|
49
|
-
# Create from
|
|
70
|
+
# Create from file
|
|
50
71
|
attestify attestation create --file attestation.json
|
|
51
72
|
|
|
52
73
|
# Fetch an attestation
|
|
53
|
-
attestify attestation fetch --uid
|
|
74
|
+
attestify attestation fetch --uid 0xbc72d396...
|
|
75
|
+
|
|
76
|
+
# List by attester
|
|
77
|
+
attestify attestation list --attester 0x9Bf9a686...
|
|
78
|
+
|
|
79
|
+
# List by subject
|
|
80
|
+
attestify attestation list --subject 0x0F1A0cb4...
|
|
81
|
+
|
|
82
|
+
# List by schema + limit
|
|
83
|
+
attestify attestation list --schema-uid 0x7408a93f... --limit 10
|
|
54
84
|
|
|
55
85
|
# Revoke an attestation
|
|
56
|
-
attestify attestation revoke --uid
|
|
86
|
+
attestify attestation revoke --uid 0xbc72d396...
|
|
57
87
|
```
|
|
58
88
|
|
|
59
|
-
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Authority Commands
|
|
60
92
|
|
|
61
93
|
```bash
|
|
62
94
|
# Register as an authority
|
|
63
|
-
attestify authority register --metadata "
|
|
95
|
+
attestify authority register --metadata "Acme KYC Services"
|
|
64
96
|
|
|
65
97
|
# Fetch authority info
|
|
66
|
-
attestify authority fetch --address
|
|
98
|
+
attestify authority fetch --address 0x9Bf9a686...
|
|
99
|
+
|
|
100
|
+
# Verify an authority (admin only)
|
|
101
|
+
attestify authority verify --address 0x9Bf9a686...
|
|
102
|
+
|
|
103
|
+
# Unverify an authority
|
|
104
|
+
attestify authority verify --address 0x9Bf9a686... --revoke
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Profile
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
attestify profile --address 0x9Bf9a686...
|
|
113
|
+
|
|
114
|
+
# JSON output
|
|
115
|
+
attestify --json profile --address 0x9Bf9a686...
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Delegation Commands
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Add a delegate
|
|
124
|
+
attestify delegate add --address 0xDelegateAddress...
|
|
125
|
+
|
|
126
|
+
# Remove a delegate
|
|
127
|
+
attestify delegate remove --address 0xDelegateAddress...
|
|
128
|
+
|
|
129
|
+
# Check delegation status
|
|
130
|
+
attestify delegate check --authority 0xAuthority... --delegate 0xDelegate...
|
|
131
|
+
|
|
132
|
+
# List all delegates for an authority
|
|
133
|
+
attestify delegate list --authority 0xAuthority...
|
|
134
|
+
|
|
135
|
+
# Attest on behalf of an authority
|
|
136
|
+
attestify delegate attest \
|
|
137
|
+
--authority 0xAuthorityAddress... \
|
|
138
|
+
--schema-uid 0x7408a93f... \
|
|
139
|
+
--subject 0x0F1A0cb4... \
|
|
140
|
+
--data 0x...
|
|
141
|
+
|
|
142
|
+
# Revoke on behalf
|
|
143
|
+
attestify delegate revoke --uid 0xbc72d396...
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Resolver Commands
|
|
149
|
+
|
|
150
|
+
### Whitelist Resolver
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
attestify whitelist add --account 0x0F1A0cb4...
|
|
154
|
+
attestify whitelist remove --account 0x0F1A0cb4...
|
|
155
|
+
attestify whitelist check --account 0x0F1A0cb4...
|
|
156
|
+
attestify whitelist owner
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Fee Resolver
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
attestify fee deposit --amount 10
|
|
163
|
+
attestify fee set-fee --amount 1000000000
|
|
164
|
+
attestify fee withdraw
|
|
165
|
+
attestify fee get-fee
|
|
166
|
+
attestify fee balance --account 0x9Bf9a686...
|
|
167
|
+
attestify fee owner
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Token-Gated Resolver
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
attestify token-gated set-config \
|
|
174
|
+
--token 0xTokenAddress... \
|
|
175
|
+
--min-balance 1
|
|
176
|
+
attestify token-gated get-config
|
|
177
|
+
attestify token-gated owner
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Token Reward Commands
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
attestify token-reward set-config \
|
|
186
|
+
--resolver 0xResolverAddress... \
|
|
187
|
+
--token 0xTokenAddress... \
|
|
188
|
+
--amount 100
|
|
189
|
+
|
|
190
|
+
attestify token-reward get-config --resolver 0xResolverAddress...
|
|
191
|
+
|
|
192
|
+
attestify token-reward distributed \
|
|
193
|
+
--resolver 0xResolverAddress... \
|
|
194
|
+
--subject 0xSubjectAddress...
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Cross-Contract Resolver Commands
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
attestify cross-contract set-pipeline \
|
|
203
|
+
--resolver 0xResolverAddress... \
|
|
204
|
+
--resolvers 0xWhitelist...,0xFee...,0xTokenGated...
|
|
205
|
+
|
|
206
|
+
attestify cross-contract get-pipeline --resolver 0xResolverAddress...
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## NFT Minting
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
attestify nft-mint \
|
|
215
|
+
--subject 0x0F1A0cb4... \
|
|
216
|
+
--attestation-uid 0xbc72d396... \
|
|
217
|
+
--token-id 0.0.12345
|
|
67
218
|
```
|
|
68
219
|
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## HCS Audit Trail
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# List HCS topic IDs
|
|
226
|
+
attestify hcs topics
|
|
227
|
+
|
|
228
|
+
# Latest 25 messages from a topic
|
|
229
|
+
attestify hcs messages --topic 0.0.8221946
|
|
230
|
+
|
|
231
|
+
# Oldest first, limit 10
|
|
232
|
+
attestify hcs messages --topic 0.0.8221946 --limit 10 --order asc
|
|
233
|
+
|
|
234
|
+
# Per-schema topic
|
|
235
|
+
attestify hcs messages --topic 0.0.8225001 --limit 50
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Hedera Native Features
|
|
241
|
+
|
|
242
|
+
### Scheduled Revocation
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
attestify schedule revoke \
|
|
246
|
+
--uid 0xbc72d396... \
|
|
247
|
+
--execute-at 1735689600
|
|
248
|
+
|
|
249
|
+
attestify schedule status --schedule-id 0.0.12345
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Multi-Sig Authority
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
attestify multisig create \
|
|
256
|
+
--keys 302a300506...,302a300506...,302a300506... \
|
|
257
|
+
--threshold 2 \
|
|
258
|
+
--initial-balance 10
|
|
259
|
+
|
|
260
|
+
attestify multisig info --account 0.0.12345
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Token Staking
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
attestify staking stake --token 0xTokenAddr... --amount 1000
|
|
267
|
+
attestify staking unstake --token 0xTokenAddr... --amount 500
|
|
268
|
+
attestify staking balance --token 0xTokenAddr... --authority 0.0.12345
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### File Service Schema
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# Upload a schema definition to Hedera File Service
|
|
275
|
+
attestify file-schema upload \
|
|
276
|
+
--definition "string name, uint256 age, bool verified" \
|
|
277
|
+
--memo "KYC schema v2"
|
|
278
|
+
|
|
279
|
+
# Read a schema from File Service
|
|
280
|
+
attestify file-schema read --file-id 0.0.12345
|
|
281
|
+
|
|
282
|
+
# Register a schema from a File Service file
|
|
283
|
+
attestify file-schema register \
|
|
284
|
+
--file-id 0.0.12345 \
|
|
285
|
+
--revocable \
|
|
286
|
+
--resolver 0x461349...
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## AI Mode (`attestify ai`)
|
|
292
|
+
|
|
293
|
+
Natural language interface to the protocol — same 17 tools as `@attestify/sdk/ai`, powered by OpenAI.
|
|
294
|
+
|
|
295
|
+
Requires `OPENAI_API_KEY` environment variable.
|
|
296
|
+
|
|
297
|
+
### One-Shot Mode
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
attestify ai "List all schemas"
|
|
301
|
+
attestify ai "Register a schema with fields: string name, uint256 age, bool verified"
|
|
302
|
+
attestify ai "Create an attestation for 0x0F1A... using schema 0x7408..."
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Interactive REPL Mode
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Omit the message argument to enter interactive mode
|
|
309
|
+
attestify ai
|
|
310
|
+
|
|
311
|
+
# [Attestify AI] Agent initialized with 17 tools
|
|
312
|
+
# Interactive mode — type your message and press Enter. Type "exit" to quit.
|
|
313
|
+
#
|
|
314
|
+
# You: What schemas are registered?
|
|
315
|
+
# Agent: Found 3 schema(s):
|
|
316
|
+
# 0x7408a93f... — string name, uint256 age, bool verified
|
|
317
|
+
# 0xbc72d396... — string documentType, address issuer
|
|
318
|
+
# ...
|
|
319
|
+
#
|
|
320
|
+
# You: exit
|
|
321
|
+
# Goodbye!
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### AI Options
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
# Use a different model
|
|
328
|
+
attestify ai --model gpt-4o "Explain the attestation with UID 0xbc72d396..."
|
|
329
|
+
|
|
330
|
+
# JSON output (one-shot only)
|
|
331
|
+
attestify --json ai "List all authorities"
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
69
336
|
## JSON Output
|
|
70
337
|
|
|
71
|
-
Use `--json` for machine-readable output:
|
|
338
|
+
Use `--json` for machine-readable output on any command:
|
|
72
339
|
|
|
73
340
|
```bash
|
|
74
341
|
attestify schema fetch --uid 0xabc123... --json
|
|
@@ -76,6 +343,14 @@ attestify schema fetch --uid 0xabc123... --json
|
|
|
76
343
|
|
|
77
344
|
Success responses return the data object. Error responses include `type` and `message` fields.
|
|
78
345
|
|
|
346
|
+
## Published on npm
|
|
347
|
+
|
|
348
|
+
[@attestify/cli](https://www.npmjs.com/package/@attestify/cli)
|
|
349
|
+
|
|
350
|
+
## GitHub
|
|
351
|
+
|
|
352
|
+
[github.com/Aliyaan-Nasir/Attestify](https://github.com/Aliyaan-Nasir/Attestify)
|
|
353
|
+
|
|
79
354
|
## License
|
|
80
355
|
|
|
81
356
|
MIT
|
package/dist/index.js
CHANGED
|
@@ -1173,6 +1173,7 @@ Error: ${err.message}
|
|
|
1173
1173
|
});
|
|
1174
1174
|
};
|
|
1175
1175
|
ask();
|
|
1176
|
+
program.__replActive = true;
|
|
1176
1177
|
return;
|
|
1177
1178
|
}
|
|
1178
1179
|
} catch (err) {
|
|
@@ -1180,5 +1181,8 @@ Error: ${err.message}
|
|
|
1180
1181
|
process.exitCode = 1;
|
|
1181
1182
|
}
|
|
1182
1183
|
});
|
|
1183
|
-
program.
|
|
1184
|
+
program.parseAsync().then(() => {
|
|
1185
|
+
if (program.__replActive) return;
|
|
1186
|
+
setTimeout(() => process.exit(process.exitCode ?? 0), 100);
|
|
1187
|
+
});
|
|
1184
1188
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/config.ts","../src/output.ts"],"sourcesContent":["/**\n * Attestify CLI\n * Command-line tool for the Hedera attestation protocol\n */\nimport { Command } from 'commander';\nimport { readFileSync } from 'fs';\nimport { loadConfig } from './config';\nimport { formatOutput, formatError } from './output';\n\nasync function createService(): Promise<import('@attestify/sdk').HederaAttestService> {\n const config = loadConfig();\n const { HederaAttestService } = await import('@attestify/sdk');\n return new HederaAttestService(config);\n}\n\nfunction readJsonFile(filePath: string): unknown {\n return JSON.parse(readFileSync(filePath, 'utf-8'));\n}\n\nconst program = new Command();\nprogram\n .name('attestify')\n .description('Attestify CLI — interact with the Hedera attestation protocol')\n .version('0.1.0')\n .option('--json', 'Output results as JSON');\n\n// ─── Schema Commands ──────────────────────────────────────────────────────────\n\nconst schema = program.command('schema').description('Manage attestation schemas');\n\nschema.command('create')\n .description('Register a new schema')\n .option('--definition <definition>', 'Schema definition string')\n .option('--revocable', 'Whether attestations can be revoked', false)\n .option('--resolver <resolver>', 'Resolver contract address')\n .option('--file <file>', 'Path to JSON file with schema parameters')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n let definition: string;\n let revocable: boolean;\n let resolver: string | undefined;\n if (opts.file) {\n const d = readJsonFile(opts.file) as Record<string, unknown>;\n definition = d.definition as string;\n revocable = (d.revocable as boolean) ?? false;\n resolver = d.resolver as string | undefined;\n } else {\n if (!opts.definition) throw new Error('Either --definition or --file is required');\n definition = opts.definition;\n revocable = opts.revocable;\n resolver = opts.resolver;\n }\n const service = await createService();\n const result = await service.registerSchema({ definition, revocable, resolver });\n if (result.success) {\n console.log(formatOutput({ schemaUid: result.data!.schemaUid }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nschema.command('fetch')\n .description('Get schema by UID')\n .requiredOption('--uid <uid>', 'Schema UID to fetch')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getSchema(opts.uid);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nschema.command('list')\n .description('List schemas (optionally filter by authority address)')\n .option('--authority <address>', 'Filter by authority address')\n .option('--limit <limit>', 'Max results', '25')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.listSchemas({\n authority: opts.authority,\n limit: parseInt(opts.limit, 10) || 25,\n });\n if (result.success) {\n const schemas = result.data!;\n if (jsonFlag) {\n console.log(JSON.stringify({ success: true, count: schemas.length, data: schemas }, null, 2));\n } else {\n console.log(`Found ${schemas.length} schema(s)\\n`);\n for (const s of schemas) {\n console.log(` UID: ${s.uid}`);\n console.log(` Definition: ${s.definition}`);\n console.log(` Authority: ${s.authorityAddress}`);\n console.log(` Revocable: ${s.revocable}`);\n console.log(` HCS Topic: ${s.hcsTopicId || 'N/A'}`);\n console.log(` Created: ${s.createdAt}`);\n console.log('');\n }\n }\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Attestation Commands ─────────────────────────────────────────────────────\n\nconst attestation = program.command('attestation').description('Manage attestations');\n\nattestation.command('create')\n .description('Create a new attestation')\n .requiredOption('--schema-uid <uid>', 'Schema UID to attest against')\n .requiredOption('--subject <address>', 'Subject address')\n .requiredOption('--data <data>', 'ABI-encoded attestation data (hex)')\n .option('--expiration <timestamp>', 'Expiration timestamp (0 = no expiration)')\n .option('--file <file>', 'Path to JSON file with attestation parameters')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n let schemaUid: string;\n let subject: string;\n let data: string;\n let expirationTime: number | undefined;\n if (opts.file) {\n const d = readJsonFile(opts.file) as Record<string, unknown>;\n schemaUid = d.schemaUid as string;\n subject = d.subject as string;\n data = d.data as string;\n expirationTime = d.expirationTime as number | undefined;\n } else {\n schemaUid = opts.schemaUid;\n subject = opts.subject;\n data = opts.data;\n expirationTime = opts.expiration ? parseInt(opts.expiration, 10) : undefined;\n }\n const service = await createService();\n const result = await service.createAttestation({ schemaUid, subject, data, expirationTime });\n if (result.success) {\n console.log(formatOutput({ attestationUid: result.data!.attestationUid }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nattestation.command('fetch')\n .description('Get attestation by UID')\n .requiredOption('--uid <uid>', 'Attestation UID to fetch')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getAttestation(opts.uid);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nattestation.command('list')\n .description('List attestations (filter by attester, subject, or schema)')\n .option('--attester <address>', 'Filter by attester address')\n .option('--subject <address>', 'Filter by subject address')\n .option('--schema-uid <uid>', 'Filter by schema UID')\n .option('--limit <limit>', 'Max results', '25')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.listAttestations({\n attester: opts.attester,\n subject: opts.subject,\n schemaUid: opts.schemaUid,\n limit: parseInt(opts.limit, 10) || 25,\n });\n if (result.success) {\n const attestations = result.data!;\n if (jsonFlag) {\n console.log(JSON.stringify({ success: true, count: attestations.length, data: attestations }, null, 2));\n } else {\n console.log(`Found ${attestations.length} attestation(s)\\n`);\n for (const a of attestations) {\n const status = a.revoked ? 'Revoked' : (a.expirationTime && new Date(a.expirationTime) < new Date() ? 'Expired' : 'Active');\n console.log(` UID: ${a.uid}`);\n console.log(` Schema: ${a.schemaUid}`);\n console.log(` Attester: ${a.attesterAddress}`);\n console.log(` Subject: ${a.subjectAddress}`);\n console.log(` Status: ${status}`);\n console.log(` Created: ${a.createdAt}`);\n console.log('');\n }\n }\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nattestation.command('revoke')\n .description('Revoke an attestation')\n .requiredOption('--uid <uid>', 'Attestation UID to revoke')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.revokeAttestation(opts.uid);\n if (result.success) {\n console.log(formatOutput({ revoked: true, uid: opts.uid }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Authority Commands ───────────────────────────────────────────────────────\n\nconst authority = program.command('authority').description('Manage authorities');\n\nauthority.command('register')\n .description('Register as an authority')\n .requiredOption('--metadata <metadata>', 'Authority metadata string')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.registerAuthority(opts.metadata);\n if (result.success) {\n console.log(formatOutput({ registered: true }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nauthority.command('fetch')\n .description('Get authority info by address')\n .requiredOption('--address <address>', 'Authority address to fetch')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getAuthority(opts.address);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nauthority.command('verify')\n .description('Verify or unverify an authority (admin only — contract owner)')\n .requiredOption('--address <address>', 'Authority address to verify/unverify')\n .option('--revoke', 'Unverify the authority instead of verifying', false)\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const verified = !opts.revoke;\n const result = await service.setAuthorityVerification(opts.address, verified);\n if (result.success) {\n console.log(formatOutput({ address: opts.address, verified }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Profile Command ─────────────────────────────────────────────────────────\n\nprogram.command('profile')\n .description('View full profile for an address (authority, schemas, attestations)')\n .requiredOption('--address <address>', 'Wallet address to look up')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getProfile(opts.address);\n if (result.success) {\n const p = result.data!;\n if (jsonFlag) {\n console.log(JSON.stringify({ success: true, data: p }, null, 2));\n } else {\n console.log(`Profile: ${p.address}\\n`);\n\n // Authority\n if (p.authority) {\n console.log('── Authority ──');\n console.log(` Status: ${p.authority.isVerified ? 'Verified ✓' : 'Unverified'}`);\n console.log(` Metadata: ${p.authority.metadata || '—'}`);\n console.log(` Since: ${p.authority.createdAt}`);\n console.log('');\n } else {\n console.log('── Authority ──');\n console.log(' Not registered as an authority\\n');\n }\n\n // Schemas\n console.log(`── Schemas (${p.schemas.length}) ──`);\n if (p.schemas.length === 0) {\n console.log(' No schemas created\\n');\n } else {\n for (const s of p.schemas) {\n console.log(` ${s.uid}`);\n console.log(` ${s.definition}`);\n console.log(` Revocable: ${s.revocable} | HCS: ${s.hcsTopicId || 'N/A'} | ${s.createdAt}`);\n }\n console.log('');\n }\n\n // Attestations issued\n console.log(`── Attestations Issued (${p.attestationsIssued.length}) ──`);\n if (p.attestationsIssued.length === 0) {\n console.log(' No attestations issued\\n');\n } else {\n for (const a of p.attestationsIssued) {\n console.log(` ${a.uid}`);\n console.log(` Subject: ${a.subjectAddress} | ${a.revoked ? 'Revoked' : 'Active'} | ${a.createdAt}`);\n }\n console.log('');\n }\n\n // Attestations received\n console.log(`── Attestations Received (${p.attestationsReceived.length}) ──`);\n if (p.attestationsReceived.length === 0) {\n console.log(' No attestations about this address\\n');\n } else {\n for (const a of p.attestationsReceived) {\n console.log(` ${a.uid}`);\n console.log(` Attester: ${a.attesterAddress} | ${a.revoked ? 'Revoked' : 'Active'} | ${a.createdAt}`);\n }\n console.log('');\n }\n }\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── HCS Audit Log Commands ─────────────────────────────────────────────────\n\nconst hcs = program.command('hcs').description('HCS audit log operations');\n\nhcs.command('topics')\n .description('List configured HCS topic IDs')\n .action(async () => {\n const jsonFlag = program.opts().json;\n try {\n const config = loadConfig();\n const topics: Record<string, string> = {};\n if (config.hcsTopicIds?.schemas) topics.schemas = config.hcsTopicIds.schemas;\n if (config.hcsTopicIds?.attestations) topics.attestations = config.hcsTopicIds.attestations;\n if (config.hcsTopicIds?.authorities) topics.authorities = config.hcsTopicIds.authorities;\n if (config.hcsTopicId && Object.keys(topics).length === 0) topics.default = config.hcsTopicId;\n\n if (Object.keys(topics).length === 0) {\n console.log(formatError('CONFIGURATION_ERROR', 'No HCS topics configured. Set HCS_TOPIC_SCHEMAS, HCS_TOPIC_ATTESTATIONS, HCS_TOPIC_AUTHORITIES env vars.', jsonFlag));\n return;\n }\n\n const data: Record<string, unknown> = {};\n for (const [name, id] of Object.entries(topics)) {\n data[name] = { topicId: id, hashscanUrl: `https://hashscan.io/testnet/topic/${id}` };\n }\n console.log(formatOutput(data, jsonFlag));\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nhcs.command('messages')\n .description('Fetch HCS audit messages from a topic')\n .requiredOption('--topic <topicId>', 'HCS topic ID (e.g. 0.0.12345)')\n .option('--limit <limit>', 'Number of messages to fetch', '25')\n .option('--order <order>', 'Sort order: asc or desc', 'desc')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const limit = Math.min(parseInt(opts.limit, 10) || 25, 100);\n const order = opts.order === 'asc' ? 'asc' : 'desc';\n const mirrorUrl = 'https://testnet.mirrornode.hedera.com';\n const url = `${mirrorUrl}/api/v1/topics/${opts.topic}/messages?limit=${limit}&order=${order}`;\n\n const response = await fetch(url);\n if (!response.ok) {\n console.error(formatError('NETWORK_ERROR', `Mirror node returned ${response.status}`, jsonFlag));\n process.exitCode = 1;\n return;\n }\n\n const raw = await response.json() as { messages?: Array<{ consensus_timestamp: string; sequence_number: number; message: string; payer_account_id: string }> };\n const messages = (raw.messages || []).map((msg) => {\n let decoded: unknown = null;\n try {\n const buf = Buffer.from(msg.message, 'base64');\n decoded = JSON.parse(buf.toString('utf-8'));\n } catch {\n decoded = msg.message;\n }\n return {\n sequenceNumber: msg.sequence_number,\n consensusTimestamp: msg.consensus_timestamp,\n payer: msg.payer_account_id,\n content: decoded,\n };\n });\n\n const data: Record<string, unknown> = {\n topicId: opts.topic,\n hashscanUrl: `https://hashscan.io/testnet/topic/${opts.topic}`,\n messageCount: messages.length,\n messages,\n };\n\n console.log(formatOutput(data, jsonFlag));\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Whitelist Resolver Commands ─────────────────────────────────────────────\n\nconst whitelist = program.command('whitelist').description('WhitelistResolver operations');\n\nwhitelist.command('add')\n .description('Add an address to the whitelist (admin only)')\n .requiredOption('--account <address>', 'Address to whitelist')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.whitelistAdd(opts.account);\n if (result.success) {\n console.log(formatOutput({ added: true, account: opts.account }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nwhitelist.command('remove')\n .description('Remove an address from the whitelist (admin only)')\n .requiredOption('--account <address>', 'Address to remove')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.whitelistRemove(opts.account);\n if (result.success) {\n console.log(formatOutput({ removed: true, account: opts.account }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nwhitelist.command('check')\n .description('Check if an address is whitelisted')\n .requiredOption('--account <address>', 'Address to check')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.whitelistCheck(opts.account);\n if (result.success) {\n console.log(formatOutput({ account: opts.account, whitelisted: result.data!.whitelisted }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nwhitelist.command('owner')\n .description('Get the whitelist resolver owner address')\n .action(async () => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.whitelistOwner();\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Fee Resolver Commands ──────────────────────────────────────────────────\n\nconst fee = program.command('fee').description('FeeResolver operations');\n\nfee.command('deposit')\n .description('Deposit HBAR into the fee resolver')\n .requiredOption('--amount <hbar>', 'Amount of HBAR to deposit')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.feeDeposit(opts.amount);\n if (result.success) {\n console.log(formatOutput({ deposited: true, amount: opts.amount }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nfee.command('set-fee')\n .description('Set the attestation fee amount (admin only)')\n .requiredOption('--amount <wei>', 'Fee amount in wei (tinybar)')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.feeSetFee(opts.amount);\n if (result.success) {\n console.log(formatOutput({ feeSet: true, amount: opts.amount }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nfee.command('withdraw')\n .description('Withdraw collected fees (admin only)')\n .action(async () => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.feeWithdraw();\n if (result.success) {\n console.log(formatOutput({ withdrawn: true }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nfee.command('get-fee')\n .description('Get the current attestation fee')\n .action(async () => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.feeGetFee();\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nfee.command('balance')\n .description('Check deposited balance for an address')\n .requiredOption('--account <address>', 'Address to check')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.feeGetBalance(opts.account);\n if (result.success) {\n console.log(formatOutput({ account: opts.account, ...result.data! }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nfee.command('owner')\n .description('Get the fee resolver owner address')\n .action(async () => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.feeOwner();\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Token Gated Resolver Commands ──────────────────────────────────────────\n\nconst tokenGated = program.command('token-gated').description('TokenGatedResolver operations');\n\ntokenGated.command('set-config')\n .description('Set token address and minimum balance (admin only)')\n .requiredOption('--token <address>', 'HTS token address')\n .requiredOption('--min-balance <amount>', 'Minimum token balance required')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.tokenGatedSetConfig(opts.token, opts.minBalance);\n if (result.success) {\n console.log(formatOutput({ configured: true, token: opts.token, minBalance: opts.minBalance }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ntokenGated.command('get-config')\n .description('Get current token gate configuration')\n .action(async () => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.tokenGatedGetConfig();\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ntokenGated.command('owner')\n .description('Get the token gated resolver owner address')\n .action(async () => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.tokenGatedOwner();\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── NFT Minting Command ───────────────────────────────────────────────────\n\nprogram.command('nft-mint')\n .description('Mint an HTS NFT credential for an attestation')\n .requiredOption('--subject <address>', 'Subject address to receive the NFT')\n .requiredOption('--attestation-uid <uid>', 'Attestation UID to embed in metadata')\n .requiredOption('--token-id <tokenId>', 'HTS token ID for the NFT collection')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.mintNFT({\n subject: opts.subject,\n attestationUid: opts.attestationUid,\n tokenId: opts.tokenId,\n });\n if (result.success) {\n console.log(formatOutput({ minted: true, serialNumber: result.data!.serialNumber }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Delegation Commands ────────────────────────────────────────────────────\n\nconst delegate = program.command('delegate').description('Delegation operations');\n\ndelegate.command('add')\n .description('Add a delegate who can attest/revoke on your behalf')\n .requiredOption('--address <address>', 'Delegate address to authorize')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.addDelegate(opts.address);\n if (result.success) {\n console.log(formatOutput({ added: true, delegate: opts.address }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ndelegate.command('remove')\n .description('Remove a delegate')\n .requiredOption('--address <address>', 'Delegate address to remove')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.removeDelegate(opts.address);\n if (result.success) {\n console.log(formatOutput({ removed: true, delegate: opts.address }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ndelegate.command('check')\n .description('Check if an address is a delegate of an authority')\n .requiredOption('--authority <address>', 'Authority address')\n .requiredOption('--delegate <address>', 'Delegate address to check')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.isDelegate(opts.authority, opts.delegate);\n if (result.success) {\n console.log(formatOutput({ authority: opts.authority, delegate: opts.delegate, isDelegate: result.data!.isDelegate }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ndelegate.command('list')\n .description('List all delegates for an authority')\n .requiredOption('--authority <address>', 'Authority address')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getDelegates(opts.authority);\n if (result.success) {\n if (jsonFlag) {\n console.log(JSON.stringify({ success: true, data: result.data!.delegates }, null, 2));\n } else {\n const delegates = result.data!.delegates;\n console.log(`Delegates for ${opts.authority}: ${delegates.length}\\n`);\n for (const d of delegates) {\n console.log(` ${d}`);\n }\n }\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ndelegate.command('attest')\n .description('Create an attestation on behalf of an authority (delegated)')\n .requiredOption('--authority <address>', 'Authority address you are delegating for')\n .requiredOption('--schema-uid <uid>', 'Schema UID')\n .requiredOption('--subject <address>', 'Subject address')\n .requiredOption('--data <data>', 'ABI-encoded attestation data (hex)')\n .option('--expiration <timestamp>', 'Expiration timestamp')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.attestOnBehalf({\n authority: opts.authority,\n schemaUid: opts.schemaUid,\n subject: opts.subject,\n data: opts.data,\n expirationTime: opts.expiration ? parseInt(opts.expiration, 10) : undefined,\n });\n if (result.success) {\n console.log(formatOutput({ attestationUid: result.data!.attestationUid }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ndelegate.command('revoke')\n .description('Revoke an attestation on behalf of the original attester (delegated)')\n .requiredOption('--uid <uid>', 'Attestation UID to revoke')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.revokeOnBehalf(opts.uid);\n if (result.success) {\n console.log(formatOutput({ revoked: true, uid: opts.uid }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Token Reward Resolver Commands ─────────────────────────────────────────\n\nconst tokenReward = program.command('token-reward').description('TokenRewardResolver operations');\n\ntokenReward.command('set-config')\n .description('Set reward token and amount (admin only)')\n .requiredOption('--resolver <address>', 'TokenRewardResolver contract address')\n .requiredOption('--token <address>', 'HTS reward token address')\n .requiredOption('--amount <amount>', 'Reward amount per attestation')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.tokenRewardSetConfig(opts.resolver, opts.token, opts.amount);\n if (result.success) {\n console.log(formatOutput({ configured: true, token: opts.token, amount: opts.amount }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ntokenReward.command('get-config')\n .description('Get current reward configuration')\n .requiredOption('--resolver <address>', 'TokenRewardResolver contract address')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.tokenRewardGetConfig(opts.resolver);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ntokenReward.command('distributed')\n .description('Check total rewards distributed to a subject')\n .requiredOption('--resolver <address>', 'TokenRewardResolver contract address')\n .requiredOption('--subject <address>', 'Subject address to check')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.tokenRewardGetDistributed(opts.resolver, opts.subject);\n if (result.success) {\n console.log(formatOutput({ subject: opts.subject, ...result.data! }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ntokenReward.command('owner')\n .description('Get the token reward resolver owner')\n .requiredOption('--resolver <address>', 'TokenRewardResolver contract address')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.tokenRewardOwner(opts.resolver);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Cross-Contract Resolver Commands ───────────────────────────────────────\n\nconst crossContract = program.command('cross-contract').description('CrossContractResolver operations');\n\ncrossContract.command('set-pipeline')\n .description('Set the resolver pipeline (admin only)')\n .requiredOption('--resolver <address>', 'CrossContractResolver contract address')\n .requiredOption('--resolvers <addresses>', 'Comma-separated list of resolver addresses')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const resolvers = opts.resolvers.split(',').map((a: string) => a.trim());\n const service = await createService();\n const result = await service.crossContractSetPipeline(opts.resolver, resolvers);\n if (result.success) {\n console.log(formatOutput({ configured: true, pipeline: resolvers }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ncrossContract.command('get-pipeline')\n .description('Get the current resolver pipeline')\n .requiredOption('--resolver <address>', 'CrossContractResolver contract address')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.crossContractGetPipeline(opts.resolver);\n if (result.success) {\n if (jsonFlag) {\n console.log(JSON.stringify({ success: true, data: result.data!.pipeline }, null, 2));\n } else {\n const pipeline = result.data!.pipeline;\n console.log(`Pipeline (${pipeline.length} resolvers):\\n`);\n pipeline.forEach((addr: string, i: number) => {\n console.log(` ${i + 1}. ${addr}`);\n });\n }\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ncrossContract.command('owner')\n .description('Get the cross-contract resolver owner')\n .requiredOption('--resolver <address>', 'CrossContractResolver contract address')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.crossContractOwner(opts.resolver);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Schedule Commands ────────────────────────────────────────────────────────\n\nconst schedule = program.command('schedule').description('Hedera Scheduled Transactions');\n\nschedule.command('revoke')\n .description('Schedule an automatic revocation at a future time')\n .requiredOption('--uid <uid>', 'Attestation UID to revoke')\n .requiredOption('--execute-at <timestamp>', 'Unix timestamp (seconds) when revocation should execute')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.scheduleRevocation({\n attestationUid: opts.uid,\n executeAt: parseInt(opts.executeAt, 10),\n });\n if (result.success) {\n console.log(formatOutput({\n scheduled: true,\n scheduleId: result.data!.scheduleId,\n transactionId: result.data!.transactionId,\n executeAt: new Date(parseInt(opts.executeAt, 10) * 1000).toISOString(),\n }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nschedule.command('status')\n .description('Check the status of a scheduled revocation')\n .requiredOption('--schedule-id <id>', 'Hedera Schedule ID (e.g. 0.0.12345)')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getScheduledRevocation(opts.scheduleId);\n if (result.success) {\n console.log(formatOutput({\n scheduleId: result.data!.scheduleId,\n executed: result.data!.executed,\n deleted: result.data!.deleted,\n expirationTime: result.data!.expirationTime,\n }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Multi-Sig Authority Commands (Feature 5) ──────────────────────────────\n\nconst multisig = program.command('multisig').description('Multi-sig authority operations');\n\nmultisig.command('create')\n .description('Create a multi-sig authority account with threshold keys')\n .requiredOption('--keys <keys>', 'Comma-separated ECDSA public keys (hex or DER)')\n .requiredOption('--threshold <threshold>', 'Number of required signatures')\n .option('--initial-balance <hbar>', 'Initial HBAR balance', '10')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const publicKeys = opts.keys.split(',').map((k: string) => k.trim());\n const threshold = parseInt(opts.threshold, 10);\n const service = await createService();\n const result = await service.createMultiSigAuthority({\n publicKeys,\n threshold,\n initialBalance: opts.initialBalance,\n });\n if (result.success) {\n console.log(formatOutput({\n created: true,\n accountId: result.data!.accountId,\n threshold: result.data!.threshold,\n totalKeys: result.data!.totalKeys,\n }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nmultisig.command('info')\n .description('Get key structure info for a Hedera account')\n .requiredOption('--account <accountId>', 'Hedera account ID (e.g. 0.0.12345)')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getAccountKeyInfo(opts.account);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Staking Commands (Feature 6) ──────────────────────────────────────────\n\nconst staking = program.command('staking').description('HTS token staking for authorities');\n\nstaking.command('stake')\n .description('Stake HTS tokens as an authority')\n .requiredOption('--token <address>', 'HTS token address')\n .requiredOption('--amount <amount>', 'Amount to stake')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.stakeTokens(opts.token, opts.amount);\n if (result.success) {\n console.log(formatOutput({ staked: true, token: opts.token, amount: opts.amount }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nstaking.command('unstake')\n .description('Unstake HTS tokens')\n .requiredOption('--token <address>', 'HTS token address')\n .requiredOption('--amount <amount>', 'Amount to unstake')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.unstakeTokens(opts.token, opts.amount);\n if (result.success) {\n console.log(formatOutput({ unstaked: true, token: opts.token, amount: opts.amount }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nstaking.command('balance')\n .description('Check staked token balance for an authority')\n .requiredOption('--token <address>', 'HTS token address')\n .requiredOption('--authority <address>', 'Authority address or account ID')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getStake(opts.token, opts.authority);\n if (result.success) {\n console.log(formatOutput({ authority: opts.authority, ...result.data! }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── File Service Commands (Feature 7) ─────────────────────────────────────\n\nconst fileService = program.command('file-schema').description('Hedera File Service schema storage');\n\nfileService.command('upload')\n .description('Upload a schema definition to Hedera File Service')\n .requiredOption('--definition <definition>', 'Schema definition string')\n .option('--memo <memo>', 'File memo')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.uploadSchemaFile(opts.definition, opts.memo);\n if (result.success) {\n console.log(formatOutput({\n uploaded: true,\n fileId: result.data!.fileId,\n definition: result.data!.definition,\n }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nfileService.command('read')\n .description('Read a schema definition from Hedera File Service')\n .requiredOption('--file-id <fileId>', 'Hedera File ID (e.g. 0.0.12345)')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.readSchemaFile(opts.fileId);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nfileService.command('register')\n .description('Register a schema from a Hedera File ID (reads definition from File Service)')\n .requiredOption('--file-id <fileId>', 'Hedera File ID containing the schema definition')\n .option('--revocable', 'Whether attestations can be revoked', false)\n .option('--resolver <resolver>', 'Resolver contract address')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.registerSchemaFromFile({\n fileId: opts.fileId,\n revocable: opts.revocable,\n resolver: opts.resolver,\n });\n if (result.success) {\n console.log(formatOutput({ schemaUid: result.data!.schemaUid, fileId: opts.fileId }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── AI Chat Command ────────────────────────────────────────────────────────\n\nconst ai = program.command('ai')\n .description('Chat with the Attestify AI Agent — natural language interface to the protocol')\n .argument('[message]', 'Message to send (omit for interactive mode)')\n .option('--model <model>', 'OpenAI model name', 'gpt-4o-mini')\n .action(async (message: string | undefined, opts: { model: string }) => {\n const jsonFlag = program.opts().json;\n try {\n const openAIApiKey = process.env.OPENAI_API_KEY;\n if (!openAIApiKey) {\n console.error(formatError('CONFIGURATION_ERROR', 'Missing OPENAI_API_KEY environment variable.', jsonFlag));\n process.exitCode = 1;\n return;\n }\n\n const config = loadConfig();\n const { createAttestifyAgent } = await import('@attestify/sdk/ai');\n const { processMessage } = await createAttestifyAgent({\n accountId: config.operatorAccountId,\n privateKey: config.operatorPrivateKey,\n indexerUrl: config.indexerUrl,\n openAIApiKey,\n modelName: opts.model,\n });\n\n console.log('[Attestify AI] Agent initialized with 17 tools\\n');\n\n if (message) {\n // One-shot mode\n const response = await processMessage(message);\n if (jsonFlag) {\n console.log(JSON.stringify({ success: true, response }, null, 2));\n } else {\n console.log(response);\n }\n } else {\n // Interactive REPL mode\n const readline = await import('readline');\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n\n console.log('Interactive mode — type your message and press Enter. Type \"exit\" to quit.\\n');\n\n const ask = () => {\n rl.question('You: ', async (input: string) => {\n const trimmed = input.trim();\n if (!trimmed || trimmed.toLowerCase() === 'exit') {\n console.log('\\nGoodbye!');\n rl.close();\n return;\n }\n try {\n const response = await processMessage(trimmed);\n console.log(`\\nAgent: ${response}\\n`);\n } catch (err: any) {\n console.error(`\\nError: ${err.message}\\n`);\n }\n ask();\n });\n };\n ask();\n // Keep process alive for REPL\n return;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nprogram.parse();","/**\n * CLI Configuration — loads credentials from env vars or config file\n */\n\nimport { config as loadDotenv } from 'dotenv';\nimport { DEFAULT_CONFIG, TESTNET_RESOLVER_ADDRESSES } from '@attestify/sdk';\nimport type { HederaAttestServiceConfig } from '@attestify/sdk';\n\n// Load .env file if present\nloadDotenv();\n\n/**\n * Loads CLI configuration from environment variables.\n * Requires HEDERA_ACCOUNT_ID and HEDERA_PRIVATE_KEY.\n * Defaults to Hedera testnet with standard contract addresses and RPC URL.\n */\nexport function loadConfig(): HederaAttestServiceConfig {\n const accountId = process.env.HEDERA_ACCOUNT_ID;\n const privateKey = process.env.HEDERA_PRIVATE_KEY;\n\n if (!accountId) {\n throw new Error(\n 'Missing HEDERA_ACCOUNT_ID environment variable. ' +\n 'Set it in your environment or in a .env file.',\n );\n }\n\n if (!privateKey) {\n throw new Error(\n 'Missing HEDERA_PRIVATE_KEY environment variable. ' +\n 'Set it in your environment or in a .env file.',\n );\n }\n\n // Build HCS topic config from env vars\n const hcsTopicSchemas = process.env.HCS_TOPIC_SCHEMAS;\n const hcsTopicAttestations = process.env.HCS_TOPIC_ATTESTATIONS;\n const hcsTopicAuthorities = process.env.HCS_TOPIC_AUTHORITIES;\n const hcsTopicId = process.env.HCS_TOPIC_ID; // legacy single topic\n\n const hcsTopicIds = (hcsTopicSchemas || hcsTopicAttestations || hcsTopicAuthorities)\n ? {\n schemas: hcsTopicSchemas,\n attestations: hcsTopicAttestations,\n authorities: hcsTopicAuthorities,\n }\n : undefined;\n\n return {\n ...DEFAULT_CONFIG,\n operatorAccountId: accountId,\n operatorPrivateKey: privateKey,\n indexerUrl: process.env.INDEXER_URL || undefined,\n resolverAddresses: TESTNET_RESOLVER_ADDRESSES,\n ...(hcsTopicIds ? { hcsTopicIds } : {}),\n ...(hcsTopicId && !hcsTopicIds ? { hcsTopicId } : {}),\n };\n}\n","/**\n * CLI Output Formatting — handles --json flag and human-readable output\n */\n\n/**\n * Formats a successful result for CLI output.\n * With --json flag: outputs valid parseable JSON.\n * Without: outputs human-readable key-value pairs.\n */\nexport function formatOutput(data: Record<string, unknown>, json?: boolean): string {\n if (json) {\n return JSON.stringify({ success: true, data }, null, 2);\n }\n\n const lines: string[] = [];\n for (const [key, value] of Object.entries(data)) {\n if (typeof value === 'object' && value !== null) {\n lines.push(`${key}: ${JSON.stringify(value)}`);\n } else {\n lines.push(`${key}: ${value}`);\n }\n }\n return lines.join('\\n');\n}\n\n/**\n * Formats an error for CLI output.\n * With --json flag: outputs valid parseable JSON with error type and message.\n * Without: outputs human-readable error with type and description.\n */\nexport function formatError(type: string, message: string, json?: boolean): string {\n if (json) {\n return JSON.stringify({ success: false, error: { type, message } }, null, 2);\n }\n\n return `Error [${type}]: ${message}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,uBAAwB;AACxB,gBAA6B;;;ACD7B,oBAAqC;AACrC,iBAA2D;AAAA,IAI3D,cAAAA,QAAW;AAOJ,SAAS,aAAwC;AACtD,QAAM,YAAY,QAAQ,IAAI;AAC9B,QAAM,aAAa,QAAQ,IAAI;AAE/B,MAAI,CAAC,WAAW;AACd,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AAEA,MAAI,CAAC,YAAY;AACf,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AAGA,QAAM,kBAAkB,QAAQ,IAAI;AACpC,QAAM,uBAAuB,QAAQ,IAAI;AACzC,QAAM,sBAAsB,QAAQ,IAAI;AACxC,QAAM,aAAa,QAAQ,IAAI;AAE/B,QAAM,cAAe,mBAAmB,wBAAwB,sBAC5D;AAAA,IACE,SAAS;AAAA,IACT,cAAc;AAAA,IACd,aAAa;AAAA,EACf,IACA;AAEJ,SAAO;AAAA,IACL,GAAG;AAAA,IACH,mBAAmB;AAAA,IACnB,oBAAoB;AAAA,IACpB,YAAY,QAAQ,IAAI,eAAe;AAAA,IACvC,mBAAmB;AAAA,IACnB,GAAI,cAAc,EAAE,YAAY,IAAI,CAAC;AAAA,IACrC,GAAI,cAAc,CAAC,cAAc,EAAE,WAAW,IAAI,CAAC;AAAA,EACrD;AACF;;;AChDO,SAAS,aAAa,MAA+B,MAAwB;AAClF,MAAI,MAAM;AACR,WAAO,KAAK,UAAU,EAAE,SAAS,MAAM,KAAK,GAAG,MAAM,CAAC;AAAA,EACxD;AAEA,QAAM,QAAkB,CAAC;AACzB,aAAW,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,SAAS,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC;AAAA,MAClE,OAAO;AACL,gBAAQ,IAAI,QAAQ;AAAA,MACtB;AAAA,IACF,OAAO;AAEL,YAAM,WAAW,MAAM,OAAO,UAAU;AACxC,YAAM,KAAK,SAAS,gBAAgB,EAAE,OAAO,QAAQ,OAAO,QAAQ,QAAQ,OAAO,CAAC;AAEpF,cAAQ,IAAI,mFAA8E;AAE1F,YAAM,MAAM,MAAM;AAChB,WAAG,SAAS,SAAS,OAAO,UAAkB;AAC5C,gBAAM,UAAU,MAAM,KAAK;AAC3B,cAAI,CAAC,WAAW,QAAQ,YAAY,MAAM,QAAQ;AAChD,oBAAQ,IAAI,YAAY;AACxB,eAAG,MAAM;AACT;AAAA,UACF;AACA,cAAI;AACF,kBAAM,WAAW,MAAM,eAAe,OAAO;AAC7C,oBAAQ,IAAI;AAAA,SAAY,QAAQ;AAAA,CAAI;AAAA,UACtC,SAAS,KAAU;AACjB,oBAAQ,MAAM;AAAA,SAAY,IAAI,OAAO;AAAA,CAAI;AAAA,UAC3C;AACA,cAAI;AAAA,QACN,CAAC;AAAA,MACH;AACA,UAAI;AAEJ;AAAA,IACF;AAAA,EACF,SAAS,KAAU;AACjB,YAAQ,MAAM,YAAY,iBAAiB,IAAI,SAAS,QAAQ,CAAC;AACjE,YAAQ,WAAW;AAAA,EACrB;AACF,CAAC;AAEH,QAAQ,MAAM;","names":["loadDotenv"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/config.ts","../src/output.ts"],"sourcesContent":["/**\n * Attestify CLI\n * Command-line tool for the Hedera attestation protocol\n */\nimport { Command } from 'commander';\nimport { readFileSync } from 'fs';\nimport { loadConfig } from './config';\nimport { formatOutput, formatError } from './output';\n\nasync function createService(): Promise<import('@attestify/sdk').HederaAttestService> {\n const config = loadConfig();\n const { HederaAttestService } = await import('@attestify/sdk');\n return new HederaAttestService(config);\n}\n\nfunction readJsonFile(filePath: string): unknown {\n return JSON.parse(readFileSync(filePath, 'utf-8'));\n}\n\nconst program = new Command();\nprogram\n .name('attestify')\n .description('Attestify CLI — interact with the Hedera attestation protocol')\n .version('0.1.0')\n .option('--json', 'Output results as JSON');\n\n// ─── Schema Commands ──────────────────────────────────────────────────────────\n\nconst schema = program.command('schema').description('Manage attestation schemas');\n\nschema.command('create')\n .description('Register a new schema')\n .option('--definition <definition>', 'Schema definition string')\n .option('--revocable', 'Whether attestations can be revoked', false)\n .option('--resolver <resolver>', 'Resolver contract address')\n .option('--file <file>', 'Path to JSON file with schema parameters')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n let definition: string;\n let revocable: boolean;\n let resolver: string | undefined;\n if (opts.file) {\n const d = readJsonFile(opts.file) as Record<string, unknown>;\n definition = d.definition as string;\n revocable = (d.revocable as boolean) ?? false;\n resolver = d.resolver as string | undefined;\n } else {\n if (!opts.definition) throw new Error('Either --definition or --file is required');\n definition = opts.definition;\n revocable = opts.revocable;\n resolver = opts.resolver;\n }\n const service = await createService();\n const result = await service.registerSchema({ definition, revocable, resolver });\n if (result.success) {\n console.log(formatOutput({ schemaUid: result.data!.schemaUid }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nschema.command('fetch')\n .description('Get schema by UID')\n .requiredOption('--uid <uid>', 'Schema UID to fetch')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getSchema(opts.uid);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nschema.command('list')\n .description('List schemas (optionally filter by authority address)')\n .option('--authority <address>', 'Filter by authority address')\n .option('--limit <limit>', 'Max results', '25')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.listSchemas({\n authority: opts.authority,\n limit: parseInt(opts.limit, 10) || 25,\n });\n if (result.success) {\n const schemas = result.data!;\n if (jsonFlag) {\n console.log(JSON.stringify({ success: true, count: schemas.length, data: schemas }, null, 2));\n } else {\n console.log(`Found ${schemas.length} schema(s)\\n`);\n for (const s of schemas) {\n console.log(` UID: ${s.uid}`);\n console.log(` Definition: ${s.definition}`);\n console.log(` Authority: ${s.authorityAddress}`);\n console.log(` Revocable: ${s.revocable}`);\n console.log(` HCS Topic: ${s.hcsTopicId || 'N/A'}`);\n console.log(` Created: ${s.createdAt}`);\n console.log('');\n }\n }\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Attestation Commands ─────────────────────────────────────────────────────\n\nconst attestation = program.command('attestation').description('Manage attestations');\n\nattestation.command('create')\n .description('Create a new attestation')\n .requiredOption('--schema-uid <uid>', 'Schema UID to attest against')\n .requiredOption('--subject <address>', 'Subject address')\n .requiredOption('--data <data>', 'ABI-encoded attestation data (hex)')\n .option('--expiration <timestamp>', 'Expiration timestamp (0 = no expiration)')\n .option('--file <file>', 'Path to JSON file with attestation parameters')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n let schemaUid: string;\n let subject: string;\n let data: string;\n let expirationTime: number | undefined;\n if (opts.file) {\n const d = readJsonFile(opts.file) as Record<string, unknown>;\n schemaUid = d.schemaUid as string;\n subject = d.subject as string;\n data = d.data as string;\n expirationTime = d.expirationTime as number | undefined;\n } else {\n schemaUid = opts.schemaUid;\n subject = opts.subject;\n data = opts.data;\n expirationTime = opts.expiration ? parseInt(opts.expiration, 10) : undefined;\n }\n const service = await createService();\n const result = await service.createAttestation({ schemaUid, subject, data, expirationTime });\n if (result.success) {\n console.log(formatOutput({ attestationUid: result.data!.attestationUid }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nattestation.command('fetch')\n .description('Get attestation by UID')\n .requiredOption('--uid <uid>', 'Attestation UID to fetch')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getAttestation(opts.uid);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nattestation.command('list')\n .description('List attestations (filter by attester, subject, or schema)')\n .option('--attester <address>', 'Filter by attester address')\n .option('--subject <address>', 'Filter by subject address')\n .option('--schema-uid <uid>', 'Filter by schema UID')\n .option('--limit <limit>', 'Max results', '25')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.listAttestations({\n attester: opts.attester,\n subject: opts.subject,\n schemaUid: opts.schemaUid,\n limit: parseInt(opts.limit, 10) || 25,\n });\n if (result.success) {\n const attestations = result.data!;\n if (jsonFlag) {\n console.log(JSON.stringify({ success: true, count: attestations.length, data: attestations }, null, 2));\n } else {\n console.log(`Found ${attestations.length} attestation(s)\\n`);\n for (const a of attestations) {\n const status = a.revoked ? 'Revoked' : (a.expirationTime && new Date(a.expirationTime) < new Date() ? 'Expired' : 'Active');\n console.log(` UID: ${a.uid}`);\n console.log(` Schema: ${a.schemaUid}`);\n console.log(` Attester: ${a.attesterAddress}`);\n console.log(` Subject: ${a.subjectAddress}`);\n console.log(` Status: ${status}`);\n console.log(` Created: ${a.createdAt}`);\n console.log('');\n }\n }\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nattestation.command('revoke')\n .description('Revoke an attestation')\n .requiredOption('--uid <uid>', 'Attestation UID to revoke')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.revokeAttestation(opts.uid);\n if (result.success) {\n console.log(formatOutput({ revoked: true, uid: opts.uid }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Authority Commands ───────────────────────────────────────────────────────\n\nconst authority = program.command('authority').description('Manage authorities');\n\nauthority.command('register')\n .description('Register as an authority')\n .requiredOption('--metadata <metadata>', 'Authority metadata string')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.registerAuthority(opts.metadata);\n if (result.success) {\n console.log(formatOutput({ registered: true }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nauthority.command('fetch')\n .description('Get authority info by address')\n .requiredOption('--address <address>', 'Authority address to fetch')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getAuthority(opts.address);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nauthority.command('verify')\n .description('Verify or unverify an authority (admin only — contract owner)')\n .requiredOption('--address <address>', 'Authority address to verify/unverify')\n .option('--revoke', 'Unverify the authority instead of verifying', false)\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const verified = !opts.revoke;\n const result = await service.setAuthorityVerification(opts.address, verified);\n if (result.success) {\n console.log(formatOutput({ address: opts.address, verified }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Profile Command ─────────────────────────────────────────────────────────\n\nprogram.command('profile')\n .description('View full profile for an address (authority, schemas, attestations)')\n .requiredOption('--address <address>', 'Wallet address to look up')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getProfile(opts.address);\n if (result.success) {\n const p = result.data!;\n if (jsonFlag) {\n console.log(JSON.stringify({ success: true, data: p }, null, 2));\n } else {\n console.log(`Profile: ${p.address}\\n`);\n\n // Authority\n if (p.authority) {\n console.log('── Authority ──');\n console.log(` Status: ${p.authority.isVerified ? 'Verified ✓' : 'Unverified'}`);\n console.log(` Metadata: ${p.authority.metadata || '—'}`);\n console.log(` Since: ${p.authority.createdAt}`);\n console.log('');\n } else {\n console.log('── Authority ──');\n console.log(' Not registered as an authority\\n');\n }\n\n // Schemas\n console.log(`── Schemas (${p.schemas.length}) ──`);\n if (p.schemas.length === 0) {\n console.log(' No schemas created\\n');\n } else {\n for (const s of p.schemas) {\n console.log(` ${s.uid}`);\n console.log(` ${s.definition}`);\n console.log(` Revocable: ${s.revocable} | HCS: ${s.hcsTopicId || 'N/A'} | ${s.createdAt}`);\n }\n console.log('');\n }\n\n // Attestations issued\n console.log(`── Attestations Issued (${p.attestationsIssued.length}) ──`);\n if (p.attestationsIssued.length === 0) {\n console.log(' No attestations issued\\n');\n } else {\n for (const a of p.attestationsIssued) {\n console.log(` ${a.uid}`);\n console.log(` Subject: ${a.subjectAddress} | ${a.revoked ? 'Revoked' : 'Active'} | ${a.createdAt}`);\n }\n console.log('');\n }\n\n // Attestations received\n console.log(`── Attestations Received (${p.attestationsReceived.length}) ──`);\n if (p.attestationsReceived.length === 0) {\n console.log(' No attestations about this address\\n');\n } else {\n for (const a of p.attestationsReceived) {\n console.log(` ${a.uid}`);\n console.log(` Attester: ${a.attesterAddress} | ${a.revoked ? 'Revoked' : 'Active'} | ${a.createdAt}`);\n }\n console.log('');\n }\n }\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── HCS Audit Log Commands ─────────────────────────────────────────────────\n\nconst hcs = program.command('hcs').description('HCS audit log operations');\n\nhcs.command('topics')\n .description('List configured HCS topic IDs')\n .action(async () => {\n const jsonFlag = program.opts().json;\n try {\n const config = loadConfig();\n const topics: Record<string, string> = {};\n if (config.hcsTopicIds?.schemas) topics.schemas = config.hcsTopicIds.schemas;\n if (config.hcsTopicIds?.attestations) topics.attestations = config.hcsTopicIds.attestations;\n if (config.hcsTopicIds?.authorities) topics.authorities = config.hcsTopicIds.authorities;\n if (config.hcsTopicId && Object.keys(topics).length === 0) topics.default = config.hcsTopicId;\n\n if (Object.keys(topics).length === 0) {\n console.log(formatError('CONFIGURATION_ERROR', 'No HCS topics configured. Set HCS_TOPIC_SCHEMAS, HCS_TOPIC_ATTESTATIONS, HCS_TOPIC_AUTHORITIES env vars.', jsonFlag));\n return;\n }\n\n const data: Record<string, unknown> = {};\n for (const [name, id] of Object.entries(topics)) {\n data[name] = { topicId: id, hashscanUrl: `https://hashscan.io/testnet/topic/${id}` };\n }\n console.log(formatOutput(data, jsonFlag));\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nhcs.command('messages')\n .description('Fetch HCS audit messages from a topic')\n .requiredOption('--topic <topicId>', 'HCS topic ID (e.g. 0.0.12345)')\n .option('--limit <limit>', 'Number of messages to fetch', '25')\n .option('--order <order>', 'Sort order: asc or desc', 'desc')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const limit = Math.min(parseInt(opts.limit, 10) || 25, 100);\n const order = opts.order === 'asc' ? 'asc' : 'desc';\n const mirrorUrl = 'https://testnet.mirrornode.hedera.com';\n const url = `${mirrorUrl}/api/v1/topics/${opts.topic}/messages?limit=${limit}&order=${order}`;\n\n const response = await fetch(url);\n if (!response.ok) {\n console.error(formatError('NETWORK_ERROR', `Mirror node returned ${response.status}`, jsonFlag));\n process.exitCode = 1;\n return;\n }\n\n const raw = await response.json() as { messages?: Array<{ consensus_timestamp: string; sequence_number: number; message: string; payer_account_id: string }> };\n const messages = (raw.messages || []).map((msg) => {\n let decoded: unknown = null;\n try {\n const buf = Buffer.from(msg.message, 'base64');\n decoded = JSON.parse(buf.toString('utf-8'));\n } catch {\n decoded = msg.message;\n }\n return {\n sequenceNumber: msg.sequence_number,\n consensusTimestamp: msg.consensus_timestamp,\n payer: msg.payer_account_id,\n content: decoded,\n };\n });\n\n const data: Record<string, unknown> = {\n topicId: opts.topic,\n hashscanUrl: `https://hashscan.io/testnet/topic/${opts.topic}`,\n messageCount: messages.length,\n messages,\n };\n\n console.log(formatOutput(data, jsonFlag));\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Whitelist Resolver Commands ─────────────────────────────────────────────\n\nconst whitelist = program.command('whitelist').description('WhitelistResolver operations');\n\nwhitelist.command('add')\n .description('Add an address to the whitelist (admin only)')\n .requiredOption('--account <address>', 'Address to whitelist')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.whitelistAdd(opts.account);\n if (result.success) {\n console.log(formatOutput({ added: true, account: opts.account }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nwhitelist.command('remove')\n .description('Remove an address from the whitelist (admin only)')\n .requiredOption('--account <address>', 'Address to remove')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.whitelistRemove(opts.account);\n if (result.success) {\n console.log(formatOutput({ removed: true, account: opts.account }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nwhitelist.command('check')\n .description('Check if an address is whitelisted')\n .requiredOption('--account <address>', 'Address to check')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.whitelistCheck(opts.account);\n if (result.success) {\n console.log(formatOutput({ account: opts.account, whitelisted: result.data!.whitelisted }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nwhitelist.command('owner')\n .description('Get the whitelist resolver owner address')\n .action(async () => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.whitelistOwner();\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Fee Resolver Commands ──────────────────────────────────────────────────\n\nconst fee = program.command('fee').description('FeeResolver operations');\n\nfee.command('deposit')\n .description('Deposit HBAR into the fee resolver')\n .requiredOption('--amount <hbar>', 'Amount of HBAR to deposit')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.feeDeposit(opts.amount);\n if (result.success) {\n console.log(formatOutput({ deposited: true, amount: opts.amount }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nfee.command('set-fee')\n .description('Set the attestation fee amount (admin only)')\n .requiredOption('--amount <wei>', 'Fee amount in wei (tinybar)')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.feeSetFee(opts.amount);\n if (result.success) {\n console.log(formatOutput({ feeSet: true, amount: opts.amount }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nfee.command('withdraw')\n .description('Withdraw collected fees (admin only)')\n .action(async () => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.feeWithdraw();\n if (result.success) {\n console.log(formatOutput({ withdrawn: true }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nfee.command('get-fee')\n .description('Get the current attestation fee')\n .action(async () => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.feeGetFee();\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nfee.command('balance')\n .description('Check deposited balance for an address')\n .requiredOption('--account <address>', 'Address to check')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.feeGetBalance(opts.account);\n if (result.success) {\n console.log(formatOutput({ account: opts.account, ...result.data! }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nfee.command('owner')\n .description('Get the fee resolver owner address')\n .action(async () => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.feeOwner();\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Token Gated Resolver Commands ──────────────────────────────────────────\n\nconst tokenGated = program.command('token-gated').description('TokenGatedResolver operations');\n\ntokenGated.command('set-config')\n .description('Set token address and minimum balance (admin only)')\n .requiredOption('--token <address>', 'HTS token address')\n .requiredOption('--min-balance <amount>', 'Minimum token balance required')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.tokenGatedSetConfig(opts.token, opts.minBalance);\n if (result.success) {\n console.log(formatOutput({ configured: true, token: opts.token, minBalance: opts.minBalance }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ntokenGated.command('get-config')\n .description('Get current token gate configuration')\n .action(async () => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.tokenGatedGetConfig();\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ntokenGated.command('owner')\n .description('Get the token gated resolver owner address')\n .action(async () => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.tokenGatedOwner();\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── NFT Minting Command ───────────────────────────────────────────────────\n\nprogram.command('nft-mint')\n .description('Mint an HTS NFT credential for an attestation')\n .requiredOption('--subject <address>', 'Subject address to receive the NFT')\n .requiredOption('--attestation-uid <uid>', 'Attestation UID to embed in metadata')\n .requiredOption('--token-id <tokenId>', 'HTS token ID for the NFT collection')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.mintNFT({\n subject: opts.subject,\n attestationUid: opts.attestationUid,\n tokenId: opts.tokenId,\n });\n if (result.success) {\n console.log(formatOutput({ minted: true, serialNumber: result.data!.serialNumber }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Delegation Commands ────────────────────────────────────────────────────\n\nconst delegate = program.command('delegate').description('Delegation operations');\n\ndelegate.command('add')\n .description('Add a delegate who can attest/revoke on your behalf')\n .requiredOption('--address <address>', 'Delegate address to authorize')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.addDelegate(opts.address);\n if (result.success) {\n console.log(formatOutput({ added: true, delegate: opts.address }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ndelegate.command('remove')\n .description('Remove a delegate')\n .requiredOption('--address <address>', 'Delegate address to remove')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.removeDelegate(opts.address);\n if (result.success) {\n console.log(formatOutput({ removed: true, delegate: opts.address }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ndelegate.command('check')\n .description('Check if an address is a delegate of an authority')\n .requiredOption('--authority <address>', 'Authority address')\n .requiredOption('--delegate <address>', 'Delegate address to check')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.isDelegate(opts.authority, opts.delegate);\n if (result.success) {\n console.log(formatOutput({ authority: opts.authority, delegate: opts.delegate, isDelegate: result.data!.isDelegate }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ndelegate.command('list')\n .description('List all delegates for an authority')\n .requiredOption('--authority <address>', 'Authority address')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getDelegates(opts.authority);\n if (result.success) {\n if (jsonFlag) {\n console.log(JSON.stringify({ success: true, data: result.data!.delegates }, null, 2));\n } else {\n const delegates = result.data!.delegates;\n console.log(`Delegates for ${opts.authority}: ${delegates.length}\\n`);\n for (const d of delegates) {\n console.log(` ${d}`);\n }\n }\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ndelegate.command('attest')\n .description('Create an attestation on behalf of an authority (delegated)')\n .requiredOption('--authority <address>', 'Authority address you are delegating for')\n .requiredOption('--schema-uid <uid>', 'Schema UID')\n .requiredOption('--subject <address>', 'Subject address')\n .requiredOption('--data <data>', 'ABI-encoded attestation data (hex)')\n .option('--expiration <timestamp>', 'Expiration timestamp')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.attestOnBehalf({\n authority: opts.authority,\n schemaUid: opts.schemaUid,\n subject: opts.subject,\n data: opts.data,\n expirationTime: opts.expiration ? parseInt(opts.expiration, 10) : undefined,\n });\n if (result.success) {\n console.log(formatOutput({ attestationUid: result.data!.attestationUid }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ndelegate.command('revoke')\n .description('Revoke an attestation on behalf of the original attester (delegated)')\n .requiredOption('--uid <uid>', 'Attestation UID to revoke')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.revokeOnBehalf(opts.uid);\n if (result.success) {\n console.log(formatOutput({ revoked: true, uid: opts.uid }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Token Reward Resolver Commands ─────────────────────────────────────────\n\nconst tokenReward = program.command('token-reward').description('TokenRewardResolver operations');\n\ntokenReward.command('set-config')\n .description('Set reward token and amount (admin only)')\n .requiredOption('--resolver <address>', 'TokenRewardResolver contract address')\n .requiredOption('--token <address>', 'HTS reward token address')\n .requiredOption('--amount <amount>', 'Reward amount per attestation')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.tokenRewardSetConfig(opts.resolver, opts.token, opts.amount);\n if (result.success) {\n console.log(formatOutput({ configured: true, token: opts.token, amount: opts.amount }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ntokenReward.command('get-config')\n .description('Get current reward configuration')\n .requiredOption('--resolver <address>', 'TokenRewardResolver contract address')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.tokenRewardGetConfig(opts.resolver);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ntokenReward.command('distributed')\n .description('Check total rewards distributed to a subject')\n .requiredOption('--resolver <address>', 'TokenRewardResolver contract address')\n .requiredOption('--subject <address>', 'Subject address to check')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.tokenRewardGetDistributed(opts.resolver, opts.subject);\n if (result.success) {\n console.log(formatOutput({ subject: opts.subject, ...result.data! }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ntokenReward.command('owner')\n .description('Get the token reward resolver owner')\n .requiredOption('--resolver <address>', 'TokenRewardResolver contract address')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.tokenRewardOwner(opts.resolver);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Cross-Contract Resolver Commands ───────────────────────────────────────\n\nconst crossContract = program.command('cross-contract').description('CrossContractResolver operations');\n\ncrossContract.command('set-pipeline')\n .description('Set the resolver pipeline (admin only)')\n .requiredOption('--resolver <address>', 'CrossContractResolver contract address')\n .requiredOption('--resolvers <addresses>', 'Comma-separated list of resolver addresses')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const resolvers = opts.resolvers.split(',').map((a: string) => a.trim());\n const service = await createService();\n const result = await service.crossContractSetPipeline(opts.resolver, resolvers);\n if (result.success) {\n console.log(formatOutput({ configured: true, pipeline: resolvers }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ncrossContract.command('get-pipeline')\n .description('Get the current resolver pipeline')\n .requiredOption('--resolver <address>', 'CrossContractResolver contract address')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.crossContractGetPipeline(opts.resolver);\n if (result.success) {\n if (jsonFlag) {\n console.log(JSON.stringify({ success: true, data: result.data!.pipeline }, null, 2));\n } else {\n const pipeline = result.data!.pipeline;\n console.log(`Pipeline (${pipeline.length} resolvers):\\n`);\n pipeline.forEach((addr: string, i: number) => {\n console.log(` ${i + 1}. ${addr}`);\n });\n }\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\ncrossContract.command('owner')\n .description('Get the cross-contract resolver owner')\n .requiredOption('--resolver <address>', 'CrossContractResolver contract address')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.crossContractOwner(opts.resolver);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Schedule Commands ────────────────────────────────────────────────────────\n\nconst schedule = program.command('schedule').description('Hedera Scheduled Transactions');\n\nschedule.command('revoke')\n .description('Schedule an automatic revocation at a future time')\n .requiredOption('--uid <uid>', 'Attestation UID to revoke')\n .requiredOption('--execute-at <timestamp>', 'Unix timestamp (seconds) when revocation should execute')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.scheduleRevocation({\n attestationUid: opts.uid,\n executeAt: parseInt(opts.executeAt, 10),\n });\n if (result.success) {\n console.log(formatOutput({\n scheduled: true,\n scheduleId: result.data!.scheduleId,\n transactionId: result.data!.transactionId,\n executeAt: new Date(parseInt(opts.executeAt, 10) * 1000).toISOString(),\n }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nschedule.command('status')\n .description('Check the status of a scheduled revocation')\n .requiredOption('--schedule-id <id>', 'Hedera Schedule ID (e.g. 0.0.12345)')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getScheduledRevocation(opts.scheduleId);\n if (result.success) {\n console.log(formatOutput({\n scheduleId: result.data!.scheduleId,\n executed: result.data!.executed,\n deleted: result.data!.deleted,\n expirationTime: result.data!.expirationTime,\n }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Multi-Sig Authority Commands (Feature 5) ──────────────────────────────\n\nconst multisig = program.command('multisig').description('Multi-sig authority operations');\n\nmultisig.command('create')\n .description('Create a multi-sig authority account with threshold keys')\n .requiredOption('--keys <keys>', 'Comma-separated ECDSA public keys (hex or DER)')\n .requiredOption('--threshold <threshold>', 'Number of required signatures')\n .option('--initial-balance <hbar>', 'Initial HBAR balance', '10')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const publicKeys = opts.keys.split(',').map((k: string) => k.trim());\n const threshold = parseInt(opts.threshold, 10);\n const service = await createService();\n const result = await service.createMultiSigAuthority({\n publicKeys,\n threshold,\n initialBalance: opts.initialBalance,\n });\n if (result.success) {\n console.log(formatOutput({\n created: true,\n accountId: result.data!.accountId,\n threshold: result.data!.threshold,\n totalKeys: result.data!.totalKeys,\n }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nmultisig.command('info')\n .description('Get key structure info for a Hedera account')\n .requiredOption('--account <accountId>', 'Hedera account ID (e.g. 0.0.12345)')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getAccountKeyInfo(opts.account);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── Staking Commands (Feature 6) ──────────────────────────────────────────\n\nconst staking = program.command('staking').description('HTS token staking for authorities');\n\nstaking.command('stake')\n .description('Stake HTS tokens as an authority')\n .requiredOption('--token <address>', 'HTS token address')\n .requiredOption('--amount <amount>', 'Amount to stake')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.stakeTokens(opts.token, opts.amount);\n if (result.success) {\n console.log(formatOutput({ staked: true, token: opts.token, amount: opts.amount }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nstaking.command('unstake')\n .description('Unstake HTS tokens')\n .requiredOption('--token <address>', 'HTS token address')\n .requiredOption('--amount <amount>', 'Amount to unstake')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.unstakeTokens(opts.token, opts.amount);\n if (result.success) {\n console.log(formatOutput({ unstaked: true, token: opts.token, amount: opts.amount }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nstaking.command('balance')\n .description('Check staked token balance for an authority')\n .requiredOption('--token <address>', 'HTS token address')\n .requiredOption('--authority <address>', 'Authority address or account ID')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.getStake(opts.token, opts.authority);\n if (result.success) {\n console.log(formatOutput({ authority: opts.authority, ...result.data! }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── File Service Commands (Feature 7) ─────────────────────────────────────\n\nconst fileService = program.command('file-schema').description('Hedera File Service schema storage');\n\nfileService.command('upload')\n .description('Upload a schema definition to Hedera File Service')\n .requiredOption('--definition <definition>', 'Schema definition string')\n .option('--memo <memo>', 'File memo')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.uploadSchemaFile(opts.definition, opts.memo);\n if (result.success) {\n console.log(formatOutput({\n uploaded: true,\n fileId: result.data!.fileId,\n definition: result.data!.definition,\n }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nfileService.command('read')\n .description('Read a schema definition from Hedera File Service')\n .requiredOption('--file-id <fileId>', 'Hedera File ID (e.g. 0.0.12345)')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.readSchemaFile(opts.fileId);\n if (result.success) {\n console.log(formatOutput(result.data! as unknown as Record<string, unknown>, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nfileService.command('register')\n .description('Register a schema from a Hedera File ID (reads definition from File Service)')\n .requiredOption('--file-id <fileId>', 'Hedera File ID containing the schema definition')\n .option('--revocable', 'Whether attestations can be revoked', false)\n .option('--resolver <resolver>', 'Resolver contract address')\n .action(async (opts) => {\n const jsonFlag = program.opts().json;\n try {\n const service = await createService();\n const result = await service.registerSchemaFromFile({\n fileId: opts.fileId,\n revocable: opts.revocable,\n resolver: opts.resolver,\n });\n if (result.success) {\n console.log(formatOutput({ schemaUid: result.data!.schemaUid, fileId: opts.fileId }, jsonFlag));\n } else {\n console.error(formatError(result.error!.type, result.error!.message, jsonFlag));\n process.exitCode = 1;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\n// ─── AI Chat Command ────────────────────────────────────────────────────────\n\nconst ai = program.command('ai')\n .description('Chat with the Attestify AI Agent — natural language interface to the protocol')\n .argument('[message]', 'Message to send (omit for interactive mode)')\n .option('--model <model>', 'OpenAI model name', 'gpt-4o-mini')\n .action(async (message: string | undefined, opts: { model: string }) => {\n const jsonFlag = program.opts().json;\n try {\n const openAIApiKey = process.env.OPENAI_API_KEY;\n if (!openAIApiKey) {\n console.error(formatError('CONFIGURATION_ERROR', 'Missing OPENAI_API_KEY environment variable.', jsonFlag));\n process.exitCode = 1;\n return;\n }\n\n const config = loadConfig();\n const { createAttestifyAgent } = await import('@attestify/sdk/ai');\n const { processMessage } = await createAttestifyAgent({\n accountId: config.operatorAccountId,\n privateKey: config.operatorPrivateKey,\n indexerUrl: config.indexerUrl,\n openAIApiKey,\n modelName: opts.model,\n });\n\n console.log('[Attestify AI] Agent initialized with 17 tools\\n');\n\n if (message) {\n // One-shot mode\n const response = await processMessage(message);\n if (jsonFlag) {\n console.log(JSON.stringify({ success: true, response }, null, 2));\n } else {\n console.log(response);\n }\n } else {\n // Interactive REPL mode\n const readline = await import('readline');\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n\n console.log('Interactive mode — type your message and press Enter. Type \"exit\" to quit.\\n');\n\n const ask = () => {\n rl.question('You: ', async (input: string) => {\n const trimmed = input.trim();\n if (!trimmed || trimmed.toLowerCase() === 'exit') {\n console.log('\\nGoodbye!');\n rl.close();\n return;\n }\n try {\n const response = await processMessage(trimmed);\n console.log(`\\nAgent: ${response}\\n`);\n } catch (err: any) {\n console.error(`\\nError: ${err.message}\\n`);\n }\n ask();\n });\n };\n ask();\n // Keep process alive for REPL — prevent auto-exit\n (program as any).__replActive = true;\n return;\n }\n } catch (err: any) {\n console.error(formatError('UNKNOWN_ERROR', err.message, jsonFlag));\n process.exitCode = 1;\n }\n });\n\nprogram.parseAsync().then(() => {\n // In REPL mode, don't auto-exit — the readline keeps the process alive.\n if ((program as any).__replActive) return;\n // For all other commands, exit cleanly after output flushes.\n // Without this, the Hedera SDK gRPC client keeps the process alive.\n setTimeout(() => process.exit(process.exitCode ?? 0), 100);\n});","/**\n * CLI Configuration — loads credentials from env vars or config file\n */\n\nimport { config as loadDotenv } from 'dotenv';\nimport { DEFAULT_CONFIG, TESTNET_RESOLVER_ADDRESSES } from '@attestify/sdk';\nimport type { HederaAttestServiceConfig } from '@attestify/sdk';\n\n// Load .env file if present\nloadDotenv();\n\n/**\n * Loads CLI configuration from environment variables.\n * Requires HEDERA_ACCOUNT_ID and HEDERA_PRIVATE_KEY.\n * Defaults to Hedera testnet with standard contract addresses and RPC URL.\n */\nexport function loadConfig(): HederaAttestServiceConfig {\n const accountId = process.env.HEDERA_ACCOUNT_ID;\n const privateKey = process.env.HEDERA_PRIVATE_KEY;\n\n if (!accountId) {\n throw new Error(\n 'Missing HEDERA_ACCOUNT_ID environment variable. ' +\n 'Set it in your environment or in a .env file.',\n );\n }\n\n if (!privateKey) {\n throw new Error(\n 'Missing HEDERA_PRIVATE_KEY environment variable. ' +\n 'Set it in your environment or in a .env file.',\n );\n }\n\n // Build HCS topic config from env vars\n const hcsTopicSchemas = process.env.HCS_TOPIC_SCHEMAS;\n const hcsTopicAttestations = process.env.HCS_TOPIC_ATTESTATIONS;\n const hcsTopicAuthorities = process.env.HCS_TOPIC_AUTHORITIES;\n const hcsTopicId = process.env.HCS_TOPIC_ID; // legacy single topic\n\n const hcsTopicIds = (hcsTopicSchemas || hcsTopicAttestations || hcsTopicAuthorities)\n ? {\n schemas: hcsTopicSchemas,\n attestations: hcsTopicAttestations,\n authorities: hcsTopicAuthorities,\n }\n : undefined;\n\n return {\n ...DEFAULT_CONFIG,\n operatorAccountId: accountId,\n operatorPrivateKey: privateKey,\n indexerUrl: process.env.INDEXER_URL || undefined,\n resolverAddresses: TESTNET_RESOLVER_ADDRESSES,\n ...(hcsTopicIds ? { hcsTopicIds } : {}),\n ...(hcsTopicId && !hcsTopicIds ? { hcsTopicId } : {}),\n };\n}\n","/**\n * CLI Output Formatting — handles --json flag and human-readable output\n */\n\n/**\n * Formats a successful result for CLI output.\n * With --json flag: outputs valid parseable JSON.\n * Without: outputs human-readable key-value pairs.\n */\nexport function formatOutput(data: Record<string, unknown>, json?: boolean): string {\n if (json) {\n return JSON.stringify({ success: true, data }, null, 2);\n }\n\n const lines: string[] = [];\n for (const [key, value] of Object.entries(data)) {\n if (typeof value === 'object' && value !== null) {\n lines.push(`${key}: ${JSON.stringify(value)}`);\n } else {\n lines.push(`${key}: ${value}`);\n }\n }\n return lines.join('\\n');\n}\n\n/**\n * Formats an error for CLI output.\n * With --json flag: outputs valid parseable JSON with error type and message.\n * Without: outputs human-readable error with type and description.\n */\nexport function formatError(type: string, message: string, json?: boolean): string {\n if (json) {\n return JSON.stringify({ success: false, error: { type, message } }, null, 2);\n }\n\n return `Error [${type}]: ${message}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,uBAAwB;AACxB,gBAA6B;;;ACD7B,oBAAqC;AACrC,iBAA2D;AAAA,IAI3D,cAAAA,QAAW;AAOJ,SAAS,aAAwC;AACtD,QAAM,YAAY,QAAQ,IAAI;AAC9B,QAAM,aAAa,QAAQ,IAAI;AAE/B,MAAI,CAAC,WAAW;AACd,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AAEA,MAAI,CAAC,YAAY;AACf,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AAGA,QAAM,kBAAkB,QAAQ,IAAI;AACpC,QAAM,uBAAuB,QAAQ,IAAI;AACzC,QAAM,sBAAsB,QAAQ,IAAI;AACxC,QAAM,aAAa,QAAQ,IAAI;AAE/B,QAAM,cAAe,mBAAmB,wBAAwB,sBAC5D;AAAA,IACE,SAAS;AAAA,IACT,cAAc;AAAA,IACd,aAAa;AAAA,EACf,IACA;AAEJ,SAAO;AAAA,IACL,GAAG;AAAA,IACH,mBAAmB;AAAA,IACnB,oBAA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AAC;AAEH,QAAQ,WAAW,EAAE,KAAK,MAAM;AAE9B,MAAK,QAAgB,aAAc;AAGnC,aAAW,MAAM,QAAQ,KAAK,QAAQ,YAAY,CAAC,GAAG,GAAG;AAC3D,CAAC;","names":["loadDotenv"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@attestify/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Attestify CLI — command-line tool for the Hedera attestation protocol",
|
|
5
5
|
"bin": {
|
|
6
6
|
"attestify": "./dist/index.js"
|
|
@@ -10,22 +10,14 @@
|
|
|
10
10
|
"dist",
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "tsup",
|
|
15
|
-
"clean": "rimraf dist",
|
|
16
|
-
"dev": "tsup --watch",
|
|
17
|
-
"lint:ts": "tsc --noEmit --pretty",
|
|
18
|
-
"test": "vitest run",
|
|
19
|
-
"test:watch": "vitest"
|
|
20
|
-
},
|
|
21
13
|
"dependencies": {
|
|
22
|
-
"@attestify/sdk": "^0.1.0",
|
|
23
14
|
"commander": "^12.1.0",
|
|
24
15
|
"dotenv": "^16.4.5",
|
|
25
16
|
"@langchain/core": "^0.3.0",
|
|
26
17
|
"@langchain/openai": "^0.4.0",
|
|
27
18
|
"langchain": "^0.3.0",
|
|
28
|
-
"zod": "^3.23.0"
|
|
19
|
+
"zod": "^3.23.0",
|
|
20
|
+
"@attestify/sdk": "0.1.3"
|
|
29
21
|
},
|
|
30
22
|
"devDependencies": {
|
|
31
23
|
"@types/node": "^22.10.0",
|
|
@@ -43,5 +35,15 @@
|
|
|
43
35
|
"license": "MIT",
|
|
44
36
|
"publishConfig": {
|
|
45
37
|
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsup",
|
|
41
|
+
"clean": "rimraf dist",
|
|
42
|
+
"dev": "tsup --watch",
|
|
43
|
+
"lint:ts": "tsc --noEmit --pretty",
|
|
44
|
+
"test": "vitest run",
|
|
45
|
+
"test:watch": "vitest",
|
|
46
|
+
"demo:setup": "tsx src/demos/setup-tokens.ts",
|
|
47
|
+
"demo:native": "tsx src/demos/demo-hedera-native.ts"
|
|
46
48
|
}
|
|
47
|
-
}
|
|
49
|
+
}
|