@hsuite/smart-engines-cli 1.0.3 → 1.1.0

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.
@@ -0,0 +1,42 @@
1
+ /**
2
+ * `hsuite governance simulate` — dry-run a `GovernanceMolecule.validate(...)`
3
+ * against fixture data without depending on the rules-engine package.
4
+ *
5
+ * Usage:
6
+ * hsuite governance simulate --proposal <file> [--server <url>] [--format json|plain]
7
+ *
8
+ * The `<file>` is a JSON document of shape `{ config, context }` matching the
9
+ * SDK's `GovernanceSimulateRequest` type.
10
+ *
11
+ * Exit codes:
12
+ * 0 — `result.isValid === true`
13
+ * 1 — `result.isValid === false` (proposal/vote/etc. rejected by the molecule)
14
+ * 2 — input or transport error (missing file, malformed JSON, HTTP failure)
15
+ */
16
+ import { Command } from 'commander';
17
+ import { SmartEngineClient } from '@hsuite/smart-engines-sdk';
18
+ /**
19
+ * Internal SDK builder — exposed for tests to inject a stub.
20
+ *
21
+ * Each call returns a `SmartEngineClient` configured for the given server.
22
+ */
23
+ export declare function buildSdkClient(server: string): SmartEngineClient;
24
+ /**
25
+ * Pure logic separated from `commander` for testability.
26
+ *
27
+ * Returns the exit code rather than calling `process.exit`. The action
28
+ * handler wraps this and exits.
29
+ */
30
+ export declare function runGovernanceSimulate(opts: {
31
+ proposal: string;
32
+ server?: string;
33
+ format?: 'json' | 'plain';
34
+ /** Test seam — override the SDK constructor. */
35
+ clientFactory?: (server: string) => Pick<SmartEngineClient, 'governance'>;
36
+ /** Test seam — capture stdout instead of writing to process. */
37
+ out?: (line: string) => void;
38
+ /** Test seam — capture stderr instead of writing to process. */
39
+ err?: (line: string) => void;
40
+ }): Promise<number>;
41
+ export declare const governanceCommand: Command;
42
+ //# sourceMappingURL=governance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governance.d.ts","sourceRoot":"","sources":["../../src/commands/governance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAiD9D;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAKhE;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,gDAAgD;IAChD,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;IAC1E,gEAAgE;IAChE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,gEAAgE;IAChE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B,GAAG,OAAO,CAAC,MAAM,CAAC,CA+ClB;AAED,eAAO,MAAM,iBAAiB,SAiB3B,CAAC"}
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.governanceCommand = void 0;
7
+ exports.buildSdkClient = buildSdkClient;
8
+ exports.runGovernanceSimulate = runGovernanceSimulate;
9
+ /**
10
+ * `hsuite governance simulate` — dry-run a `GovernanceMolecule.validate(...)`
11
+ * against fixture data without depending on the rules-engine package.
12
+ *
13
+ * Usage:
14
+ * hsuite governance simulate --proposal <file> [--server <url>] [--format json|plain]
15
+ *
16
+ * The `<file>` is a JSON document of shape `{ config, context }` matching the
17
+ * SDK's `GovernanceSimulateRequest` type.
18
+ *
19
+ * Exit codes:
20
+ * 0 — `result.isValid === true`
21
+ * 1 — `result.isValid === false` (proposal/vote/etc. rejected by the molecule)
22
+ * 2 — input or transport error (missing file, malformed JSON, HTTP failure)
23
+ */
24
+ const commander_1 = require("commander");
25
+ const chalk_1 = __importDefault(require("chalk"));
26
+ const fs_1 = require("fs");
27
+ const path_1 = require("path");
28
+ const smart_engines_sdk_1 = require("@hsuite/smart-engines-sdk");
29
+ const DEFAULT_SERVER = 'https://v3-testnet-gateway.hsuite.network';
30
+ /** Exit-code-bearing error so the action handler can branch precisely. */
31
+ class CliExit extends Error {
32
+ code;
33
+ constructor(code, message) {
34
+ super(message);
35
+ this.code = code;
36
+ }
37
+ }
38
+ function readProposal(file) {
39
+ const path = (0, path_1.resolve)(file);
40
+ if (!(0, fs_1.existsSync)(path)) {
41
+ throw new CliExit(2, `proposal file not found: ${path}`);
42
+ }
43
+ let raw;
44
+ try {
45
+ raw = (0, fs_1.readFileSync)(path, 'utf8');
46
+ }
47
+ catch (err) {
48
+ throw new CliExit(2, `unable to read proposal file: ${err.message}`);
49
+ }
50
+ let parsed;
51
+ try {
52
+ parsed = JSON.parse(raw);
53
+ }
54
+ catch (err) {
55
+ throw new CliExit(2, `malformed JSON in proposal file: ${err.message}`);
56
+ }
57
+ if (!parsed ||
58
+ typeof parsed !== 'object' ||
59
+ !('config' in parsed) ||
60
+ !('context' in parsed)) {
61
+ throw new CliExit(2, 'proposal file must be JSON with shape { "config": {...}, "context": {...} }');
62
+ }
63
+ return parsed;
64
+ }
65
+ /**
66
+ * Internal SDK builder — exposed for tests to inject a stub.
67
+ *
68
+ * Each call returns a `SmartEngineClient` configured for the given server.
69
+ */
70
+ function buildSdkClient(server) {
71
+ return new smart_engines_sdk_1.SmartEngineClient({
72
+ baseUrl: server,
73
+ allowInsecure: server.startsWith('http://'),
74
+ });
75
+ }
76
+ /**
77
+ * Pure logic separated from `commander` for testability.
78
+ *
79
+ * Returns the exit code rather than calling `process.exit`. The action
80
+ * handler wraps this and exits.
81
+ */
82
+ async function runGovernanceSimulate(opts) {
83
+ const write = opts.out ?? ((line) => console.log(line));
84
+ const writeErr = opts.err ?? ((line) => console.error(line));
85
+ const server = opts.server ?? DEFAULT_SERVER;
86
+ const format = opts.format ?? 'plain';
87
+ let request;
88
+ try {
89
+ request = readProposal(opts.proposal);
90
+ }
91
+ catch (err) {
92
+ if (err instanceof CliExit) {
93
+ writeErr(chalk_1.default.red(` ${err.message}`));
94
+ return err.code;
95
+ }
96
+ writeErr(chalk_1.default.red(` unexpected error: ${err.message}`));
97
+ return 2;
98
+ }
99
+ const client = (opts.clientFactory ?? buildSdkClient)(server);
100
+ let result;
101
+ try {
102
+ result = await client.governance.simulate(request);
103
+ }
104
+ catch (err) {
105
+ writeErr(chalk_1.default.red(` simulate failed: ${err.message}`));
106
+ return 2;
107
+ }
108
+ if (format === 'json') {
109
+ write(JSON.stringify(result, null, 2));
110
+ }
111
+ else {
112
+ const status = result.isValid
113
+ ? chalk_1.default.bold.green('VALID')
114
+ : chalk_1.default.bold.red('INVALID');
115
+ write(` ${status}`);
116
+ if (result.reason) {
117
+ write(chalk_1.default.gray(` reason: ${result.reason}`));
118
+ }
119
+ if (result.metadata && Object.keys(result.metadata).length > 0) {
120
+ write(chalk_1.default.gray(` metadata: ${JSON.stringify(result.metadata)}`));
121
+ }
122
+ if (result.validatedAt) {
123
+ write(chalk_1.default.gray(` validated: ${result.validatedAt}`));
124
+ }
125
+ }
126
+ return result.isValid ? 0 : 1;
127
+ }
128
+ exports.governanceCommand = new commander_1.Command('governance')
129
+ .description('Governance proposal dry-run')
130
+ .addCommand(new commander_1.Command('simulate')
131
+ .description('Dry-run a GovernanceMolecule.validate(...) against a fixture file')
132
+ .requiredOption('--proposal <file>', 'JSON file with shape { config, context }')
133
+ .option('--server <url>', 'Validator base URL', DEFAULT_SERVER)
134
+ .option('--format <format>', 'Output format: json | plain', 'plain')
135
+ .action(async (opts) => {
136
+ const format = opts.format === 'json' ? 'json' : 'plain';
137
+ const code = await runGovernanceSimulate({
138
+ proposal: opts.proposal,
139
+ server: opts.server,
140
+ format,
141
+ });
142
+ process.exit(code);
143
+ }));
144
+ //# sourceMappingURL=governance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governance.js","sourceRoot":"","sources":["../../src/commands/governance.ts"],"names":[],"mappings":";;;;;;AAyEA,wCAKC;AAQD,sDAyDC;AA/ID;;;;;;;;;;;;;;GAcG;AACH,yCAAoC;AACpC,kDAA0B;AAC1B,2BAA8C;AAC9C,+BAA+B;AAC/B,iEAA8D;AAM9D,MAAM,cAAc,GAAG,2CAA2C,CAAC;AAEnE,0EAA0E;AAC1E,MAAM,OAAQ,SAAQ,KAAK;IAEP;IADlB,YACkB,IAAY,EAC5B,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,SAAI,GAAJ,IAAI,CAAQ;IAI9B,CAAC;CACF;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,MAAM,IAAI,GAAG,IAAA,cAAO,EAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,CAAC,IAAA,eAAU,EAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,OAAO,CAAC,CAAC,EAAE,4BAA4B,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,IAAA,iBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,OAAO,CAAC,CAAC,EAAE,iCAAkC,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IAClF,CAAC;IACD,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,OAAO,CAAC,CAAC,EAAE,oCAAqC,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IACrF,CAA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AAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QACvE,CAAC;QACD,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACvB,KAAK,CAAC,eAAK,CAAC,IAAI,CAAC,gBAAgB,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC;AAEY,QAAA,iBAAiB,GAAG,IAAI,mBAAO,CAAC,YAAY,CAAC;KACvD,WAAW,CAAC,6BAA6B,CAAC;KAC1C,UAAU,CACT,IAAI,mBAAO,CAAC,UAAU,CAAC;KACpB,WAAW,CAAC,mEAAmE,CAAC;KAChF,cAAc,CAAC,mBAAmB,EAAE,0CAA0C,CAAC;KAC/E,MAAM,CAAC,gBAAgB,EAAE,oBAAoB,EAAE,cAAc,CAAC;KAC9D,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,EAAE,OAAO,CAAC;KACnE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IACzD,MAAM,IAAI,GAAG,MAAM,qBAAqB,CAAC;QACvC,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,MAAM;KACP,CAAC,CAAC;IACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC,CAAC,CACL,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * `hsuite hist-balance query` — ad-hoc historical-balance query.
3
+ *
4
+ * Wraps the SDK's `HistoricalBalanceClient` so operators / smart-app devs
5
+ * can sanity-check archive reads from a terminal without writing a script:
6
+ *
7
+ * ```
8
+ * hsuite hist-balance query \
9
+ * --chain hedera \
10
+ * --entity 0.0.5555 \
11
+ * --account 0.0.1234 \
12
+ * --at 1700000000 \
13
+ * --server https://validator.example.com
14
+ * ```
15
+ *
16
+ * Exit codes:
17
+ * 0 success
18
+ * 1 input error (missing/invalid flag, unsupported chain, etc.)
19
+ * 2 transport or server error (network, 4xx, 5xx)
20
+ *
21
+ * Zero internal `@hsuite/*` deps beyond `@hsuite/smart-engines-sdk`, which
22
+ * itself is decoupled from server-side libs by design (PR-CLEANUP #576).
23
+ */
24
+ import { Command } from 'commander';
25
+ import { HistoricalBalanceClient } from '@hsuite/smart-engines-sdk';
26
+ type RunArgs = {
27
+ chain?: string;
28
+ entity?: string;
29
+ account?: string;
30
+ at?: string;
31
+ server?: string;
32
+ format?: string;
33
+ authToken?: string;
34
+ apiKey?: string;
35
+ };
36
+ /**
37
+ * Pure-function core (no `process.exit`, no `console.log`) so tests can
38
+ * exercise the full code path and assert on the returned exit code +
39
+ * captured streams.
40
+ */
41
+ export declare function runHistBalanceQuery(args: RunArgs, io: {
42
+ out: (msg: string) => void;
43
+ err: (msg: string) => void;
44
+ sdk?: (config: {
45
+ baseUrl: string;
46
+ authToken?: string;
47
+ apiKey?: string;
48
+ }) => Pick<HistoricalBalanceClient, 'getBalance'>;
49
+ }): Promise<number>;
50
+ export declare const histBalanceCommand: Command;
51
+ export {};
52
+ //# sourceMappingURL=hist-balance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hist-balance.d.ts","sourceRoot":"","sources":["../../src/commands/hist-balance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,uBAAuB,EAGxB,MAAM,2BAA2B,CAAC;AAEnC,KAAK,OAAO,GAAG;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,OAAO,EACb,EAAE,EAAE;IACF,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,KAAK,IAAI,CAAC,uBAAuB,EAAE,YAAY,CAAC,CAAC;CACnD,GACA,OAAO,CAAC,MAAM,CAAC,CA6FjB;AAED,eAAO,MAAM,kBAAkB,SAE9B,CAAC"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ /**
3
+ * `hsuite hist-balance query` — ad-hoc historical-balance query.
4
+ *
5
+ * Wraps the SDK's `HistoricalBalanceClient` so operators / smart-app devs
6
+ * can sanity-check archive reads from a terminal without writing a script:
7
+ *
8
+ * ```
9
+ * hsuite hist-balance query \
10
+ * --chain hedera \
11
+ * --entity 0.0.5555 \
12
+ * --account 0.0.1234 \
13
+ * --at 1700000000 \
14
+ * --server https://validator.example.com
15
+ * ```
16
+ *
17
+ * Exit codes:
18
+ * 0 success
19
+ * 1 input error (missing/invalid flag, unsupported chain, etc.)
20
+ * 2 transport or server error (network, 4xx, 5xx)
21
+ *
22
+ * Zero internal `@hsuite/*` deps beyond `@hsuite/smart-engines-sdk`, which
23
+ * itself is decoupled from server-side libs by design (PR-CLEANUP #576).
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.histBalanceCommand = void 0;
27
+ exports.runHistBalanceQuery = runHistBalanceQuery;
28
+ const commander_1 = require("commander");
29
+ const smart_engines_sdk_1 = require("@hsuite/smart-engines-sdk");
30
+ /**
31
+ * Pure-function core (no `process.exit`, no `console.log`) so tests can
32
+ * exercise the full code path and assert on the returned exit code +
33
+ * captured streams.
34
+ */
35
+ async function runHistBalanceQuery(args, io) {
36
+ // ── Input validation ──────────────────────────────────────────────────
37
+ const chain = args.chain;
38
+ if (chain !== 'hedera' && chain !== 'xrpl' && chain !== 'polkadot') {
39
+ io.err(`error: --chain must be one of hedera | xrpl | polkadot (received: ${chain ?? '<missing>'})`);
40
+ return 1;
41
+ }
42
+ const entity = args.entity;
43
+ if (!entity || typeof entity !== 'string') {
44
+ io.err('error: --entity is required');
45
+ return 1;
46
+ }
47
+ const account = args.account;
48
+ if (!account || typeof account !== 'string') {
49
+ io.err('error: --account is required');
50
+ return 1;
51
+ }
52
+ if (args.at === undefined || args.at === '') {
53
+ io.err('error: --at is required (unix seconds, positive integer)');
54
+ return 1;
55
+ }
56
+ const atNum = Number(args.at);
57
+ if (!Number.isInteger(atNum) || atNum <= 0) {
58
+ io.err(`error: --at must be a positive integer (received: ${args.at})`);
59
+ return 1;
60
+ }
61
+ const server = args.server ?? process.env.VALIDATOR_URL ?? process.env.SMART_HOST_URL;
62
+ if (!server) {
63
+ io.err('error: --server is required (or set VALIDATOR_URL / SMART_HOST_URL env)');
64
+ return 1;
65
+ }
66
+ const format = args.format ?? 'plain';
67
+ if (format !== 'plain' && format !== 'json') {
68
+ io.err(`error: --format must be plain | json (received: ${format})`);
69
+ return 1;
70
+ }
71
+ const authToken = args.authToken ?? process.env.VALIDATOR_AUTH_TOKEN;
72
+ const apiKey = args.apiKey ?? process.env.VALIDATOR_API_KEY;
73
+ // ── Build SDK client ──────────────────────────────────────────────────
74
+ const factory = io.sdk ??
75
+ ((cfg) => new smart_engines_sdk_1.HistoricalBalanceClient({
76
+ baseUrl: cfg.baseUrl,
77
+ authToken: cfg.authToken,
78
+ apiKey: cfg.apiKey,
79
+ }));
80
+ const client = factory({ baseUrl: server, authToken, apiKey });
81
+ // ── Call ──────────────────────────────────────────────────────────────
82
+ try {
83
+ const result = await client.getBalance({
84
+ chain: chain,
85
+ entityId: entity,
86
+ account,
87
+ atTimestamp: atNum,
88
+ });
89
+ if (format === 'json') {
90
+ io.out(JSON.stringify(result, null, 2));
91
+ }
92
+ else {
93
+ io.out(`chain: ${result.chain}`);
94
+ io.out(`entity: ${result.entityId}`);
95
+ io.out(`account: ${result.account}`);
96
+ io.out(`atTimestamp: ${result.atTimestamp}`);
97
+ io.out(`balance: ${result.balance}`);
98
+ io.out(`source: ${result.source}`);
99
+ }
100
+ return 0;
101
+ }
102
+ catch (err) {
103
+ if (err instanceof smart_engines_sdk_1.HistoricalBalanceClientError) {
104
+ // Client-side validation is also surfaced as HistoricalBalanceClientError
105
+ // with statusCode=400; treat 4xx as input errors, 5xx / 0 as transport.
106
+ const isInputError = err.statusCode >= 400 && err.statusCode < 500;
107
+ io.err(`error: ${err.message} (status=${err.statusCode})`);
108
+ return isInputError ? 1 : 2;
109
+ }
110
+ const message = err instanceof Error ? err.message : String(err);
111
+ io.err(`error: ${message}`);
112
+ return 2;
113
+ }
114
+ }
115
+ exports.histBalanceCommand = new commander_1.Command('hist-balance').description('Query historical balances against the validator archive endpoint');
116
+ exports.histBalanceCommand
117
+ .command('query')
118
+ .description('Look up a point-in-time balance for an account / entity / chain')
119
+ .requiredOption('--chain <chain>', 'Chain: hedera | xrpl | polkadot')
120
+ .requiredOption('--entity <id>', 'Chain-native token / IOU / asset id')
121
+ .requiredOption('--account <addr>', 'Chain-native holder address')
122
+ .requiredOption('--at <unixSeconds>', 'Unix timestamp in seconds (positive integer)')
123
+ .option('--server <url>', 'Validator base URL (default: $VALIDATOR_URL or $SMART_HOST_URL)')
124
+ .option('--format <format>', 'Output format: plain | json', 'plain')
125
+ .option('--auth-token <token>', 'Bearer token (default: $VALIDATOR_AUTH_TOKEN)')
126
+ .option('--api-key <key>', 'API key (default: $VALIDATOR_API_KEY)')
127
+ .action(async (opts) => {
128
+ const code = await runHistBalanceQuery(opts, {
129
+ out: (m) => console.log(m),
130
+ err: (m) => console.error(m),
131
+ });
132
+ process.exit(code);
133
+ });
134
+ //# sourceMappingURL=hist-balance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hist-balance.js","sourceRoot":"","sources":["../../src/commands/hist-balance.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AAyBH,kDAwGC;AA/HD,yCAAoC;AACpC,iEAImC;AAanC;;;;GAIG;AACI,KAAK,UAAU,mBAAmB,CACvC,IAAa,EACb,EAQC;IAED,yEAAyE;IACzE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACzB,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,UAAU,EAAE,CAAC;QACnE,EAAE,CAAC,GAAG,CACJ,qEAAqE,KAAK,IAAI,WAAW,GAAG,CAC7F,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1C,EAAE,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QACtC,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC7B,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,EAAE,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;QACvC,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;QAC5C,EAAE,CAAC,GAAG,CAAC,0D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AC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * `hsuite personhood verify` — verify a personhood proof against the cluster.
3
+ *
4
+ * Thin wrapper around the SDK's `PersonhoodClient`. Reads a JSON proof from
5
+ * disk, POSTs to the validator, and prints the resulting cert (or `null`)
6
+ * to stdout or `--out`.
7
+ *
8
+ * Exit codes:
9
+ * 0 cert issued (printed to stdout / --out)
10
+ * 0 null cert (info message printed to stderr, body printed to stdout)
11
+ * 1 input error: missing file, malformed JSON, missing --candidate
12
+ * 2 transport error: 5xx, network, timeout
13
+ *
14
+ * The 503 `personhood_verifier_not_configured` envelope is treated as a
15
+ * transport-level error (exit 2) because the hub operator must wire a
16
+ * verifier before this command can succeed.
17
+ */
18
+ import { Command } from 'commander';
19
+ import { PersonhoodClient } from '@hsuite/smart-engines-sdk';
20
+ /**
21
+ * Internal factory hook — overridable in tests to mock the SDK client.
22
+ * Production callers never set this; the CLI builds a real
23
+ * `SmartEngineClient` against `--server`.
24
+ */
25
+ export type PersonhoodClientFactory = (server: string) => PersonhoodClient;
26
+ /** @internal — for tests only. */
27
+ export declare function __setPersonhoodClientFactory(factory: PersonhoodClientFactory): void;
28
+ /** @internal — for tests only. */
29
+ export declare function __resetPersonhoodClientFactory(): void;
30
+ /**
31
+ * Build a fresh `personhood` Command tree. Commander Command instances
32
+ * accumulate state across `parseAsync` calls (parsed option values stick
33
+ * around on the same node), so tests use this factory to get an
34
+ * isolated subtree per test. The bin entrypoint calls it once at startup.
35
+ */
36
+ export declare function buildPersonhoodCommand(): Command;
37
+ /**
38
+ * Default command instance used by the bin entrypoint. Tests build their
39
+ * own via {@link buildPersonhoodCommand}.
40
+ */
41
+ export declare const personhoodCommand: Command;
42
+ //# sourceMappingURL=personhood.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personhood.d.ts","sourceRoot":"","sources":["../../src/commands/personhood.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,OAAO,EACL,gBAAgB,EAMjB,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,gBAAgB,CAAC;AAQ3E,kCAAkC;AAClC,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAEnF;AAED,kCAAkC;AAClC,wBAAgB,8BAA8B,IAAI,IAAI,CAMrD;AA0BD;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CA4EhD;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,SAA2B,CAAC"}
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.personhoodCommand = void 0;
7
+ exports.__setPersonhoodClientFactory = __setPersonhoodClientFactory;
8
+ exports.__resetPersonhoodClientFactory = __resetPersonhoodClientFactory;
9
+ exports.buildPersonhoodCommand = buildPersonhoodCommand;
10
+ /**
11
+ * `hsuite personhood verify` — verify a personhood proof against the cluster.
12
+ *
13
+ * Thin wrapper around the SDK's `PersonhoodClient`. Reads a JSON proof from
14
+ * disk, POSTs to the validator, and prints the resulting cert (or `null`)
15
+ * to stdout or `--out`.
16
+ *
17
+ * Exit codes:
18
+ * 0 cert issued (printed to stdout / --out)
19
+ * 0 null cert (info message printed to stderr, body printed to stdout)
20
+ * 1 input error: missing file, malformed JSON, missing --candidate
21
+ * 2 transport error: 5xx, network, timeout
22
+ *
23
+ * The 503 `personhood_verifier_not_configured` envelope is treated as a
24
+ * transport-level error (exit 2) because the hub operator must wire a
25
+ * verifier before this command can succeed.
26
+ */
27
+ const commander_1 = require("commander");
28
+ const chalk_1 = __importDefault(require("chalk"));
29
+ const ora_1 = __importDefault(require("ora"));
30
+ const fs_1 = require("fs");
31
+ const path_1 = require("path");
32
+ const smart_engines_sdk_1 = require("@hsuite/smart-engines-sdk");
33
+ let clientFactory = (server) => {
34
+ const allowInsecure = server.startsWith('http://');
35
+ const sdk = new smart_engines_sdk_1.SmartEngineClient({ baseUrl: server, allowInsecure });
36
+ return sdk.personhood;
37
+ };
38
+ /** @internal — for tests only. */
39
+ function __setPersonhoodClientFactory(factory) {
40
+ clientFactory = factory;
41
+ }
42
+ /** @internal — for tests only. */
43
+ function __resetPersonhoodClientFactory() {
44
+ clientFactory = (server) => {
45
+ const allowInsecure = server.startsWith('http://');
46
+ const sdk = new smart_engines_sdk_1.SmartEngineClient({ baseUrl: server, allowInsecure });
47
+ return sdk.personhood;
48
+ };
49
+ }
50
+ function loadProof(path) {
51
+ const absPath = (0, path_1.resolve)(path);
52
+ if (!(0, fs_1.existsSync)(absPath)) {
53
+ throw new Error(`proof file not found: ${absPath}`);
54
+ }
55
+ const raw = (0, fs_1.readFileSync)(absPath, 'utf8');
56
+ let parsed;
57
+ try {
58
+ parsed = JSON.parse(raw);
59
+ }
60
+ catch (err) {
61
+ throw new Error(`proof file is not valid JSON: ${err.message}`);
62
+ }
63
+ if (!parsed ||
64
+ typeof parsed !== 'object' ||
65
+ typeof parsed.attestationMethod !== 'string') {
66
+ throw new Error('proof file must be a JSON object with an `attestationMethod` string field');
67
+ }
68
+ return parsed;
69
+ }
70
+ /**
71
+ * Build a fresh `personhood` Command tree. Commander Command instances
72
+ * accumulate state across `parseAsync` calls (parsed option values stick
73
+ * around on the same node), so tests use this factory to get an
74
+ * isolated subtree per test. The bin entrypoint calls it once at startup.
75
+ */
76
+ function buildPersonhoodCommand() {
77
+ const cmd = new commander_1.Command('personhood').description('Personhood verification (HPP one-human-one-member)');
78
+ cmd
79
+ .command('verify')
80
+ .description('Verify a personhood proof against the cluster')
81
+ .requiredOption('--candidate <addr>', 'address of the human being verified')
82
+ .requiredOption('--proof <file>', 'JSON file containing the PersonhoodProof envelope')
83
+ .option('--out <file>', 'Write cert JSON to this file (default: stdout)')
84
+ .option('--server <url>', 'Validator base URL (default: $VALIDATOR_URL env)')
85
+ .action(async (opts) => {
86
+ const server = opts.server ?? process.env.VALIDATOR_URL;
87
+ if (!server) {
88
+ console.error(chalk_1.default.red(' --server is required (or set VALIDATOR_URL in the environment)\n'));
89
+ process.exit(1);
90
+ }
91
+ let proof;
92
+ try {
93
+ proof = loadProof(opts.proof);
94
+ }
95
+ catch (err) {
96
+ console.error(chalk_1.default.red(` ${err.message}\n`));
97
+ process.exit(1);
98
+ }
99
+ const spinner = (0, ora_1.default)(`POST ${server}/api/v3/personhood/verify`).start();
100
+ let cert;
101
+ try {
102
+ const client = clientFactory(server);
103
+ cert = await client.verify({ candidate: opts.candidate, proof });
104
+ }
105
+ catch (err) {
106
+ // 503 personhood_verifier_not_configured → operator must wire a
107
+ // verifier; surface as a transport-level failure.
108
+ if ((0, smart_engines_sdk_1.isPersonhoodVerifierNotConfigured)(err)) {
109
+ spinner.fail('personhood verifier is not configured on the cluster');
110
+ process.exit(2);
111
+ }
112
+ if (err instanceof smart_engines_sdk_1.SdkHttpError) {
113
+ spinner.fail(`HTTP ${err.statusCode}: ${err.message}`);
114
+ process.exit(2);
115
+ }
116
+ spinner.fail(`transport error: ${err.message}`);
117
+ process.exit(2);
118
+ }
119
+ if (cert === null) {
120
+ spinner.warn('verification did not produce a cert');
121
+ // The body is still emitted so scripts can pipe / diff a stable JSON
122
+ // shape regardless of the issued/rejected outcome.
123
+ const body = JSON.stringify(null);
124
+ if (opts.out) {
125
+ (0, fs_1.writeFileSync)((0, path_1.resolve)(opts.out), body);
126
+ }
127
+ else {
128
+ process.stdout.write(body + '\n');
129
+ }
130
+ // Exit 0: rejection is a valid outcome the caller can branch on.
131
+ return;
132
+ }
133
+ spinner.succeed(`cert issued by ${cert.issuerId}`);
134
+ const body = JSON.stringify(cert, null, 2);
135
+ if (opts.out) {
136
+ (0, fs_1.writeFileSync)((0, path_1.resolve)(opts.out), body);
137
+ console.log(chalk_1.default.gray(` wrote cert → ${opts.out}`));
138
+ }
139
+ else {
140
+ process.stdout.write(body + '\n');
141
+ }
142
+ });
143
+ return cmd;
144
+ }
145
+ /**
146
+ * Default command instance used by the bin entrypoint. Tests build their
147
+ * own via {@link buildPersonhoodCommand}.
148
+ */
149
+ exports.personhoodCommand = buildPersonhoodCommand();
150
+ //# sourceMappingURL=personhood.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personhood.js","sourceRoot":"","sources":["../../src/commands/personhood.ts"],"names":[],"mappings":";;;;;;AA6CA,oEAEC;AAGD,wEAMC;AAgCD,wDA4EC;AApKD;;;;;;;;;;;;;;;;GAgBG;AACH,yCAAoC;AACpC,kDAA0B;AAC1B,8CAAsB;AACtB,2BAA6D;AAC7D,+BAA+B;AAC/B,iEAOmC;AASnC,IAAI,aAAa,GAA4B,CAAC,MAAc,EAAE,EAAE;IAC9D,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACnD,MAAM,GAAG,GAAG,IAAI,qCAAiB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;IACtE,OAAO,GAAG,CAAC,UAAU,CAAC;AACxB,CAAC,CAAC;AAEF,kCAAkC;AAClC,SAAgB,4BAA4B,CAAC,OAAgC;IAC3E,aAAa,GAAG,OAAO,CAAC;AAC1B,CAAC;AAED,kCAAkC;AAClC,SAAgB,8BAA8B;IAC5C,aAAa,GAAG,CAAC,MAAc,EAAE,EAAE;QACjC,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QACnD,MAAM,GAAG,GAAG,IAAI,qCAAiB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;QACtE,OAAO,GAAG,CAAC,UAAU,CAAC;IACxB,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,OAAO,GAAG,IAAA,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@ const path = __importStar(require("path"));
54
54
  const init_1 = require("./commands/init");
55
55
  const subscribe_1 = require("./commands/subscribe");
56
56
  const deploy_1 = require("./commands/deploy");
57
+ const governance_1 = require("./commands/governance");
58
+ const hist_balance_1 = require("./commands/hist-balance");
59
+ const personhood_1 = require("./commands/personhood");
57
60
  dotenv.config();
58
61
  function getVersion() {
59
62
  try {
@@ -73,6 +76,9 @@ program
73
76
  program.addCommand(init_1.initCommand);
74
77
  program.addCommand(subscribe_1.subscribeCommand);
75
78
  program.addCommand(deploy_1.deployCommand);
79
+ program.addCommand(governance_1.governanceCommand);
80
+ program.addCommand(hist_balance_1.histBalanceCommand);
81
+ program.addCommand(personhood_1.personhoodCommand);
76
82
  program.parse(process.argv);
77
83
  if (!process.argv.slice(2).length) {
78
84
  program.outputHelp();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAoC;AACpC,+CAAiC;AACjC,uCAAyB;AACzB,2CAA6B;AAC7B,0CAA8C;AAC9C,oDAAwD;AACxD,8CAAkD;AAElD,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,SAAS,UAAU;IACjB,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;QAC1E,OAAO,WAAW,CAAC,OAAO,IAAI,OAAO,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI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EAAoE,CAAC;KACjF,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;AAEzB,OAAO,CAAC,UAAU,CAAC,kBAAW,CAAC,CAAC;AAChC,OAAO,CAAC,UAAU,CAAC,4BAAgB,CAAC,CAAC;AACrC,OAAO,CAAC,UAAU,CAAC,sBAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,8BAAiB,CAAC,CAAC;AACtC,OAAO,CAAC,UAAU,CAAC,iCAAkB,CAAC,CAAC;AACvC,OAAO,CAAC,UAAU,CAAC,8BAAiB,CAAC,CAAC;AAEtC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hsuite/smart-engines-cli",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "HSuite CLI for smart-app deployment and management",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",