@provablehq/veil-leo 0.4.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Provable Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # @provablehq/veil-leo
2
+
3
+ Wraps the Leo CLI in a typed TS/JS client. The client shells out to the `leo`
4
+ binary and exposes its `build`, `abi`, `deploy`, and `synthesize` commands as
5
+ async methods, with the CLI flags surfaced as typed options objects instead of
6
+ string arguments.
7
+
8
+ Reach for it when a script, test, or tool needs to compile, deploy, or generate
9
+ an ABI for a Leo program without hand-assembling `leo` command lines. It composes
10
+ onto any veil client through `.extend()`, so a test client can compile a program
11
+ and mine a block from one call site.
12
+
13
+ ## Installation
14
+
15
+ ```sh
16
+ pnpm add @provablehq/veil-leo
17
+ ```
18
+
19
+ This package spawns the `leo` binary — it does not vendor the Leo toolchain. The
20
+ `leo` CLI MUST be installed and on `PATH` (or given explicitly via `leoPath`).
21
+ See the [Leo installation guide](https://developer.aleo.org/leo/installation).
22
+
23
+ ## Usage
24
+
25
+ `leoActions` attaches a `LeoClient` under the `.leo` property of any veil client.
26
+ The extension ignores the host client — Leo operations run locally and need no
27
+ transport — so it works on a public, wallet, or test client alike.
28
+
29
+ ```ts
30
+ import { createTestClient } from '@provablehq/veil-core'
31
+ import { leoActions } from '@provablehq/veil-leo'
32
+
33
+ const client = createTestClient({ transport }).extend(
34
+ leoActions({ cwd: './my-program', network: 'testnet' }),
35
+ )
36
+
37
+ // Compile the package at cwd.
38
+ await client.leo.build()
39
+
40
+ // Deploy it, broadcasting the transaction and skipping the prompt.
41
+ await client.leo.deploy({ broadcast: true, yes: true })
42
+
43
+ // Generate an ABI from a compiled .aleo bytecode file.
44
+ const abi = await client.leo.abi({ file: 'build/main.aleo' })
45
+ ```
46
+
47
+ Config passed to `leoActions` (or `createLeoClient`) sets defaults for every
48
+ command — `cwd`, `network`, `endpoint`, `privateKey`, `leoPath`, and the global
49
+ flags. Any option passed to an individual method overrides that default for the
50
+ call.
51
+
52
+ For a standalone client with no host to extend, call `createLeoClient` directly:
53
+
54
+ ```ts
55
+ import { createLeoClient } from '@provablehq/veil-leo'
56
+
57
+ const leo = createLeoClient({ cwd: './my-program' })
58
+ await leo.build()
59
+ ```
60
+
61
+ ## Methods
62
+
63
+ - **`build(options?)`** — `leo build`. Compiles the package at `cwd`.
64
+ - **`deploy(options?)`** — `leo deploy`. Compiles and deploys; `broadcast` sends
65
+ the transaction to the network and costs a fee. Set `yes` to skip the prompt.
66
+ - **`abi(options)`** — `leo abi`. Reads a `.aleo` bytecode file and returns the
67
+ ABI as a string. Pass `output` to write it to a path instead (returns `""`).
68
+ - **`synthesize(options)`** — `leo synthesize`. Synthesizes proving and verifying
69
+ keys for the named program.
70
+
71
+ Standalone functions cover the rest of the toolchain without a client:
72
+ `build`, `buildBatch` (compile several project directories in sequence), `abi`
73
+ (`leo abi` a compiled `.aleo` file, returning the ABI JSON), `run` (`leo run`
74
+ a function with inputs), and `clean` (`leo clean`).
75
+
76
+ ## Errors
77
+
78
+ Every method rejects if `leo` exits non-zero, with the failing subcommand and exit
79
+ code in the message. If the binary cannot be spawned at all — not installed, not
80
+ on `PATH` — the error names the missing `leo` and links the installation guide.
@@ -0,0 +1,297 @@
1
+ /**
2
+ * Defaults applied to every command a {@link LeoClient} runs.
3
+ *
4
+ * Each field maps to a global `leo` CLI flag and is forwarded on every
5
+ * invocation. Any command can override a field per-call by passing the same
6
+ * key in its options.
7
+ */
8
+ type LeoClientConfig = {
9
+ /**
10
+ * Default project root (equivalent to `--path`). Commands can still override
11
+ * per-call via their `cwd` option.
12
+ */
13
+ cwd?: string;
14
+ /** Path to the leo binary. Defaults to `'leo'` (resolved on PATH). */
15
+ leoPath?: string;
16
+ /** Default `--network`. */
17
+ network?: 'mainnet' | 'testnet' | 'canary';
18
+ /** Default `--endpoint` URL. */
19
+ endpoint?: string;
20
+ /** Default `--private-key`. */
21
+ privateKey?: string;
22
+ /** Default `--devnet` (mark target as a devnet). */
23
+ devnet?: boolean;
24
+ /** Default `--home` (path to the Aleo program registry). */
25
+ home?: string;
26
+ /** Default `-q`. Suppress leo CLI output. */
27
+ quiet?: boolean;
28
+ /** Default `-d`. Print additional debug info. */
29
+ debug?: boolean;
30
+ /** Default `--disable-update-check`. */
31
+ disableUpdateCheck?: boolean;
32
+ /** Default `--network-retries`. */
33
+ networkRetries?: number;
34
+ /** Default `--consensus-heights`. */
35
+ consensusHeights?: string;
36
+ /** Default `--offline`. */
37
+ offline?: boolean;
38
+ };
39
+ /**
40
+ * Compiler-phase options shared by build/deploy/synthesize.
41
+ *
42
+ * Each field maps to the `leo` CLI flag of the same (kebab-case) name.
43
+ *
44
+ * @property enableAstSpans `--enable-ast-spans`. Include source spans in AST snapshots.
45
+ * @property enableDce `--enable-dce`. Enable dead-code elimination.
46
+ * @property conditionalBlockMaxDepth `--conditional-block-max-depth`. Maximum nesting depth the compiler type-checks in conditional blocks.
47
+ * @property disableConditionalBranchTypeChecking `--disable-conditional-branch-type-checking`.
48
+ * @property enableInitialAstSnapshot `--enable-initial-ast-snapshot`. Write the pre-pass AST snapshot.
49
+ * @property enableAllAstSnapshots `--enable-all-ast-snapshots`. Write a snapshot after every compiler pass.
50
+ * @property astSnapshots `--ast-snapshots`. Names of individual compiler passes to snapshot.
51
+ * @property buildTests `--build-tests`. Also compile the package's tests.
52
+ * @property noCache `--no-cache`. Recompile instead of reusing cached build artifacts.
53
+ * @property noLocal `--no-local`. Resolve dependencies from the network instead of local paths.
54
+ */
55
+ type LeoCompilerOptions = {
56
+ enableAstSpans?: boolean;
57
+ enableDce?: boolean;
58
+ conditionalBlockMaxDepth?: number;
59
+ disableConditionalBranchTypeChecking?: boolean;
60
+ enableInitialAstSnapshot?: boolean;
61
+ enableAllAstSnapshots?: boolean;
62
+ astSnapshots?: string[];
63
+ buildTests?: boolean;
64
+ noCache?: boolean;
65
+ noLocal?: boolean;
66
+ };
67
+ /** Transaction-shape options shared by deploy/synthesize. */
68
+ type LeoTransactionOptions = {
69
+ /** `--priority-fees` (microcredit amounts delimited by `|`). */
70
+ priorityFees?: string;
71
+ /** `-f, --fee-records`. */
72
+ feeRecords?: string;
73
+ /** `--print` the transaction. */
74
+ print?: boolean;
75
+ /** `--broadcast` the transaction to the network. */
76
+ broadcast?: boolean;
77
+ /** `--save` the transaction to the given directory. */
78
+ save?: string;
79
+ /** `-y, --yes`. Skip confirmation prompts. */
80
+ yes?: boolean;
81
+ /** `--consensus-version`. */
82
+ consensusVersion?: string;
83
+ /** `--max-wait` seconds when searching for the tx. */
84
+ maxWait?: number;
85
+ /** `--blocks-to-check` window when searching for the tx. */
86
+ blocksToCheck?: number;
87
+ };
88
+ /**
89
+ * Options for {@link LeoClient.build} (`leo build`).
90
+ *
91
+ * Combines the compiler flags with per-call overrides of any
92
+ * {@link LeoClientConfig} default.
93
+ */
94
+ type LeoBuildOptions = LeoCompilerOptions & Partial<LeoClientConfig>;
95
+ /**
96
+ * Options for {@link LeoClient.abi} (`leo abi`).
97
+ *
98
+ * Also accepts per-call overrides of any {@link LeoClientConfig} default
99
+ * except `network`, which is redefined here for the parsing context.
100
+ */
101
+ type LeoAbiOptions = {
102
+ /** Path to the `.aleo` bytecode file (required positional). */
103
+ file: string;
104
+ /** Network context for parsing. Defaults server-side to `'testnet'`. */
105
+ network?: 'mainnet' | 'testnet' | 'canary';
106
+ /** `-o, --output`. Write to path instead of returning stdout. */
107
+ output?: string;
108
+ } & Partial<Omit<LeoClientConfig, 'network'>>;
109
+ /**
110
+ * Options for {@link LeoClient.deploy} (`leo deploy`).
111
+ *
112
+ * Combines compiler flags, transaction-shape flags, and per-call overrides of
113
+ * any {@link LeoClientConfig} default.
114
+ */
115
+ type LeoDeployOptions = {
116
+ /** `--skip` deployment of any program whose name contains these substrings. */
117
+ skip?: string[];
118
+ } & LeoCompilerOptions & LeoTransactionOptions & Partial<LeoClientConfig>;
119
+ /**
120
+ * Options for {@link LeoClient.synthesize} (`leo synthesize`).
121
+ *
122
+ * Combines compiler flags, transaction-shape flags, and per-call overrides of
123
+ * any {@link LeoClientConfig} default.
124
+ */
125
+ type LeoSynthesizeOptions = {
126
+ /** Program name (required positional), e.g. `'helloworld.aleo'`. */
127
+ name: string;
128
+ /** `-l, --local`. Use the local Leo project. */
129
+ local?: boolean;
130
+ /** `-s, --skip` functions whose names contain these substrings. */
131
+ skip?: string[];
132
+ } & LeoCompilerOptions & LeoTransactionOptions & Partial<LeoClientConfig>;
133
+ /**
134
+ * Programmatic wrapper around the `leo` CLI.
135
+ *
136
+ * Every method spawns the `leo` binary as a child process, so the Leo CLI
137
+ * MUST be installed and on PATH (or located via `leoPath`). Create one with
138
+ * {@link createLeoClient}, or attach one to an existing veil client with
139
+ * {@link leoActions}.
140
+ */
141
+ type LeoClient = {
142
+ /** Config the client was constructed with. */
143
+ readonly config: LeoClientConfig;
144
+ /** `leo build` — compile the current package. */
145
+ build: (options?: LeoBuildOptions) => Promise<void>;
146
+ /** `leo abi` — generate ABI from a `.aleo` bytecode file. Returns the ABI as a string (or empty string if `output` was given). */
147
+ abi: (options: LeoAbiOptions) => Promise<string>;
148
+ /** `leo deploy` — deploy the current package. */
149
+ deploy: (options?: LeoDeployOptions) => Promise<void>;
150
+ /** `leo synthesize` — synthesize individual proving/verifying keys for a program. */
151
+ synthesize: (options: LeoSynthesizeOptions) => Promise<void>;
152
+ };
153
+ /**
154
+ * Extension helper that attaches a {@link LeoClient} to any veil client under
155
+ * the `.leo` property. Pass to `.extend()`:
156
+ *
157
+ * ```ts
158
+ * const testClient = createTestClient({ transport }).extend(leoActions({ cwd }))
159
+ * await testClient.leo.build()
160
+ * await testClient.advanceBlock()
161
+ * ```
162
+ *
163
+ * The extension ignores the host client — leo operations don't need a transport —
164
+ * so this works equally well on publicClient, walletClient, or testClient.
165
+ *
166
+ * @param config Defaults forwarded to every `leo` invocation. Defaults to `{}`.
167
+ * @returns An extension object exposing the client at `.leo`.
168
+ */
169
+ declare function leoActions(config?: LeoClientConfig): (_client: unknown) => {
170
+ leo: LeoClient;
171
+ };
172
+ /**
173
+ * Creates a {@link LeoClient} whose commands shell out to the `leo` CLI.
174
+ *
175
+ * Construction is cheap and does nothing on its own; each method call spawns
176
+ * a `leo` child process, so the Leo CLI MUST be installed
177
+ * (https://developer.aleo.org/leo/installation). Applies when a script
178
+ * or test needs to compile, deploy, or synthesize keys for a Leo project;
179
+ * prefer {@link leoActions} when a veil client is already in hand.
180
+ *
181
+ * @param config Defaults forwarded to every command. Defaults to `{}` — the
182
+ * `leo` binary is resolved on PATH and runs in the current working directory.
183
+ * @returns A client whose methods reject if the binary is missing or a
184
+ * command exits non-zero.
185
+ *
186
+ * @example
187
+ * import { createLeoClient } from '@provablehq/veil-leo'
188
+ *
189
+ * const leo = createLeoClient({ cwd: './programs/token', network: 'testnet' })
190
+ * await leo.build()
191
+ * const abi = await leo.abi({ file: './build/token/token.aleo' })
192
+ */
193
+ declare function createLeoClient(config?: LeoClientConfig): LeoClient;
194
+ /**
195
+ * Compiles a Leo project by spawning `leo build` as a child process.
196
+ *
197
+ * Requires the Leo CLI on PATH. This is the zero-config path for scripts;
198
+ * use {@link createLeoClient} when compiler flags or shared defaults are needed.
199
+ *
200
+ * @param options.cwd Project directory to build. Defaults to the current
201
+ * working directory.
202
+ * @throws If the `leo` binary is missing or the build exits non-zero.
203
+ *
204
+ * @example
205
+ * import { build } from '@provablehq/veil-leo'
206
+ * await build({ cwd: './programs/token' })
207
+ */
208
+ declare function build(options?: {
209
+ cwd?: string;
210
+ }): Promise<void>;
211
+ /**
212
+ * Compiles several Leo projects sequentially by spawning `leo build` once per
213
+ * project.
214
+ *
215
+ * Requires the Leo CLI on PATH. Builds run in order, so list dependencies
216
+ * before the projects that import them.
217
+ *
218
+ * @param projects Project directories, each given as a path string or a
219
+ * `{ cwd }` object.
220
+ * @throws On the first project whose build exits non-zero; later projects are
221
+ * not built.
222
+ *
223
+ * @example
224
+ * import { buildBatch } from '@provablehq/veil-leo'
225
+ * await buildBatch(['./programs/token', './programs/market'])
226
+ */
227
+ declare function buildBatch(projects: Array<string | {
228
+ cwd?: string;
229
+ }>): Promise<void>;
230
+ /**
231
+ * Generates the ABI of a compiled `.aleo` file by spawning `leo abi <file>`
232
+ * and capturing its output.
233
+ *
234
+ * Requires the Leo CLI on PATH. This is the zero-config path for scripts;
235
+ * use {@link createLeoClient} when network or output flags and shared
236
+ * defaults are needed. The file MUST already exist — call {@link build}
237
+ * first when generating from source.
238
+ *
239
+ * @param options.file Path to the compiled `.aleo` bytecode file, relative
240
+ * to `cwd`.
241
+ * @param options.cwd Project directory. Defaults to the current working
242
+ * directory.
243
+ * @returns The ABI JSON captured from stdout, raw — a trailing newline may be
244
+ * present. `JSON.parse` tolerates it.
245
+ * @throws If the `leo` binary is missing or the command exits non-zero.
246
+ *
247
+ * @example
248
+ * import { abi } from '@provablehq/veil-leo'
249
+ * const json = await abi({ file: 'build/token/token.aleo', cwd: './programs/token' })
250
+ */
251
+ declare function abi(options: {
252
+ file: string;
253
+ cwd?: string;
254
+ }): Promise<string>;
255
+ /** Options for {@link run}. */
256
+ type LeoRunOptions = {
257
+ /** Function name to call. `leo run` resolves the program from the project at `cwd`. */
258
+ function: string;
259
+ /** Inputs to pass to the function. */
260
+ inputs?: string[];
261
+ /** Path to the Leo project directory. Defaults to the current working directory. */
262
+ cwd?: string;
263
+ };
264
+ /**
265
+ * Executes a function of the local Leo project by spawning
266
+ * `leo run <function> [inputs...]`.
267
+ *
268
+ * Requires the Leo CLI on PATH. Runs the transition locally against the
269
+ * project at `cwd` — nothing is broadcast to a network.
270
+ *
271
+ * @param options Function name, its inputs, and the project directory.
272
+ * @throws If the `leo` binary is missing or the run exits non-zero (for
273
+ * example on a type error or failing assertion).
274
+ *
275
+ * @example
276
+ * import { run } from '@provablehq/veil-leo'
277
+ * await run({ function: 'mint', inputs: ['1000u64'], cwd: './programs/token' })
278
+ */
279
+ declare function run(options: LeoRunOptions): Promise<void>;
280
+ /** Options for {@link clean}. */
281
+ type LeoCleanOptions = {
282
+ /** Path to the Leo project directory. Defaults to the current working directory. */
283
+ cwd?: string;
284
+ };
285
+ /**
286
+ * Deletes a Leo project's build artifacts by spawning `leo clean`.
287
+ *
288
+ * Requires the Leo CLI on PATH. Use before a build when cached artifacts are
289
+ * suspect.
290
+ *
291
+ * @param options.cwd Project directory to clean. Defaults to the current
292
+ * working directory.
293
+ * @throws If the `leo` binary is missing or the command exits non-zero.
294
+ */
295
+ declare function clean(options?: LeoCleanOptions): Promise<void>;
296
+
297
+ export { type LeoAbiOptions, type LeoBuildOptions, type LeoCleanOptions, type LeoClient, type LeoClientConfig, type LeoCompilerOptions, type LeoDeployOptions, type LeoRunOptions, type LeoSynthesizeOptions, type LeoTransactionOptions, abi, build, buildBatch, clean, createLeoClient, leoActions, run };
package/dist/index.js ADDED
@@ -0,0 +1,179 @@
1
+ // src/index.ts
2
+ import { spawn } from "child_process";
3
+ function leoActions(config = {}) {
4
+ return (_client) => ({
5
+ leo: createLeoClient(config)
6
+ });
7
+ }
8
+ function createLeoClient(config = {}) {
9
+ const merge = (opts) => ({
10
+ ...config,
11
+ ...opts
12
+ });
13
+ return {
14
+ config,
15
+ build: async (options = {}) => {
16
+ const m = merge(options);
17
+ const args = [
18
+ "build",
19
+ ...buildGlobalFlags(m),
20
+ ...buildNetworkFlags(m),
21
+ ...buildCompilerFlags(options)
22
+ ];
23
+ await runLeo(args, m.cwd, m.leoPath);
24
+ },
25
+ abi: async (options) => {
26
+ const m = merge(options);
27
+ const args = ["abi", options.file];
28
+ if (options.network) args.push("--network", options.network);
29
+ if (options.output) args.push("--output", options.output);
30
+ args.push(...buildGlobalFlags(m));
31
+ return runLeoCapture(args, m.cwd, m.leoPath);
32
+ },
33
+ deploy: async (options = {}) => {
34
+ const m = merge(options);
35
+ const args = [
36
+ "deploy",
37
+ ...buildGlobalFlags(m),
38
+ ...buildNetworkFlags(m),
39
+ ...buildCompilerFlags(options),
40
+ ...buildTransactionFlags(options)
41
+ ];
42
+ if (options.skip) for (const s of options.skip) args.push("--skip", s);
43
+ await runLeo(args, m.cwd, m.leoPath);
44
+ },
45
+ synthesize: async (options) => {
46
+ const m = merge(options);
47
+ const args = ["synthesize", options.name];
48
+ if (options.local) args.push("--local");
49
+ if (options.skip) for (const s of options.skip) args.push("--skip", s);
50
+ args.push(
51
+ ...buildGlobalFlags(m),
52
+ ...buildNetworkFlags(m),
53
+ ...buildCompilerFlags(options),
54
+ ...buildTransactionFlags(options)
55
+ );
56
+ await runLeo(args, m.cwd, m.leoPath);
57
+ }
58
+ };
59
+ }
60
+ function buildGlobalFlags(c) {
61
+ const a = [];
62
+ if (c.debug) a.push("-d");
63
+ if (c.quiet) a.push("-q");
64
+ if (c.disableUpdateCheck) a.push("--disable-update-check");
65
+ if (c.cwd) a.push("--path", c.cwd);
66
+ if (c.home) a.push("--home", c.home);
67
+ return a;
68
+ }
69
+ function buildNetworkFlags(c) {
70
+ const a = [];
71
+ if (c.privateKey) a.push("--private-key", c.privateKey);
72
+ if (c.network) a.push("--network", c.network);
73
+ if (c.endpoint) a.push("--endpoint", c.endpoint);
74
+ if (c.devnet) a.push("--devnet");
75
+ if (c.consensusHeights) a.push("--consensus-heights", c.consensusHeights);
76
+ if (c.networkRetries !== void 0) a.push("--network-retries", String(c.networkRetries));
77
+ if (c.offline) a.push("--offline");
78
+ return a;
79
+ }
80
+ function buildCompilerFlags(o) {
81
+ const a = [];
82
+ if (o.enableAstSpans) a.push("--enable-ast-spans");
83
+ if (o.enableDce) a.push("--enable-dce");
84
+ if (o.conditionalBlockMaxDepth !== void 0) {
85
+ a.push("--conditional-block-max-depth", String(o.conditionalBlockMaxDepth));
86
+ }
87
+ if (o.disableConditionalBranchTypeChecking) {
88
+ a.push("--disable-conditional-branch-type-checking");
89
+ }
90
+ if (o.enableInitialAstSnapshot) a.push("--enable-initial-ast-snapshot");
91
+ if (o.enableAllAstSnapshots) a.push("--enable-all-ast-snapshots");
92
+ if (o.astSnapshots && o.astSnapshots.length) {
93
+ a.push("--ast-snapshots", o.astSnapshots.join(","));
94
+ }
95
+ if (o.buildTests) a.push("--build-tests");
96
+ if (o.noCache) a.push("--no-cache");
97
+ if (o.noLocal) a.push("--no-local");
98
+ return a;
99
+ }
100
+ function buildTransactionFlags(o) {
101
+ const a = [];
102
+ if (o.priorityFees) a.push("--priority-fees", o.priorityFees);
103
+ if (o.feeRecords) a.push("--fee-records", o.feeRecords);
104
+ if (o.print) a.push("--print");
105
+ if (o.broadcast) a.push("--broadcast");
106
+ if (o.save) a.push("--save", o.save);
107
+ if (o.yes) a.push("-y");
108
+ if (o.consensusVersion) a.push("--consensus-version", o.consensusVersion);
109
+ if (o.maxWait !== void 0) a.push("--max-wait", String(o.maxWait));
110
+ if (o.blocksToCheck !== void 0) a.push("--blocks-to-check", String(o.blocksToCheck));
111
+ return a;
112
+ }
113
+ function runLeo(args, cwd, leoPath = "leo") {
114
+ return new Promise((resolve, reject) => {
115
+ const proc = spawn(leoPath, args, { stdio: "inherit", cwd });
116
+ proc.on(
117
+ "error",
118
+ (err) => reject(
119
+ new Error(
120
+ `Failed to run ${leoPath}: ${err.message}. Ensure the Leo CLI is installed: https://developer.aleo.org/leo/installation`
121
+ )
122
+ )
123
+ );
124
+ proc.on("exit", (code) => {
125
+ if (code === 0) resolve();
126
+ else reject(new Error(`${leoPath} ${args[0]} exited with code ${code}`));
127
+ });
128
+ });
129
+ }
130
+ function runLeoCapture(args, cwd, leoPath = "leo") {
131
+ return new Promise((resolve, reject) => {
132
+ const proc = spawn(leoPath, args, { stdio: ["ignore", "pipe", "inherit"], cwd });
133
+ let stdout = "";
134
+ proc.stdout?.on("data", (chunk) => {
135
+ stdout += chunk.toString();
136
+ });
137
+ proc.on(
138
+ "error",
139
+ (err) => reject(
140
+ new Error(
141
+ `Failed to run ${leoPath}: ${err.message}. Ensure the Leo CLI is installed: https://developer.aleo.org/leo/installation`
142
+ )
143
+ )
144
+ );
145
+ proc.on("exit", (code) => {
146
+ if (code === 0) resolve(stdout);
147
+ else reject(new Error(`${leoPath} ${args[0]} exited with code ${code}`));
148
+ });
149
+ });
150
+ }
151
+ async function build(options) {
152
+ await runLeo(["build"], options?.cwd);
153
+ }
154
+ async function buildBatch(projects) {
155
+ for (const project of projects) {
156
+ const cwd = typeof project === "string" ? project : project.cwd;
157
+ await runLeo(["build"], cwd);
158
+ }
159
+ }
160
+ async function abi(options) {
161
+ return runLeoCapture(["abi", options.file], options.cwd);
162
+ }
163
+ async function run(options) {
164
+ const args = ["run", options.function, ...options.inputs ?? []];
165
+ await runLeo(args, options.cwd);
166
+ }
167
+ async function clean(options) {
168
+ await runLeo(["clean"], options?.cwd);
169
+ }
170
+ export {
171
+ abi,
172
+ build,
173
+ buildBatch,
174
+ clean,
175
+ createLeoClient,
176
+ leoActions,
177
+ run
178
+ };
179
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { spawn } from 'node:child_process'\n\n// =============================================================================\n// Client-level config (defaults shared across every command)\n// =============================================================================\n\n/**\n * Defaults applied to every command a {@link LeoClient} runs.\n *\n * Each field maps to a global `leo` CLI flag and is forwarded on every\n * invocation. Any command can override a field per-call by passing the same\n * key in its options.\n */\nexport type LeoClientConfig = {\n /**\n * Default project root (equivalent to `--path`). Commands can still override\n * per-call via their `cwd` option.\n */\n cwd?: string\n /** Path to the leo binary. Defaults to `'leo'` (resolved on PATH). */\n leoPath?: string\n /** Default `--network`. */\n network?: 'mainnet' | 'testnet' | 'canary'\n /** Default `--endpoint` URL. */\n endpoint?: string\n /** Default `--private-key`. */\n privateKey?: string\n /** Default `--devnet` (mark target as a devnet). */\n devnet?: boolean\n /** Default `--home` (path to the Aleo program registry). */\n home?: string\n /** Default `-q`. Suppress leo CLI output. */\n quiet?: boolean\n /** Default `-d`. Print additional debug info. */\n debug?: boolean\n /** Default `--disable-update-check`. */\n disableUpdateCheck?: boolean\n /** Default `--network-retries`. */\n networkRetries?: number\n /** Default `--consensus-heights`. */\n consensusHeights?: string\n /** Default `--offline`. */\n offline?: boolean\n}\n\n// =============================================================================\n// Shared option mixins\n// =============================================================================\n\n/**\n * Compiler-phase options shared by build/deploy/synthesize.\n *\n * Each field maps to the `leo` CLI flag of the same (kebab-case) name.\n *\n * @property enableAstSpans `--enable-ast-spans`. Include source spans in AST snapshots.\n * @property enableDce `--enable-dce`. Enable dead-code elimination.\n * @property conditionalBlockMaxDepth `--conditional-block-max-depth`. Maximum nesting depth the compiler type-checks in conditional blocks.\n * @property disableConditionalBranchTypeChecking `--disable-conditional-branch-type-checking`.\n * @property enableInitialAstSnapshot `--enable-initial-ast-snapshot`. Write the pre-pass AST snapshot.\n * @property enableAllAstSnapshots `--enable-all-ast-snapshots`. Write a snapshot after every compiler pass.\n * @property astSnapshots `--ast-snapshots`. Names of individual compiler passes to snapshot.\n * @property buildTests `--build-tests`. Also compile the package's tests.\n * @property noCache `--no-cache`. Recompile instead of reusing cached build artifacts.\n * @property noLocal `--no-local`. Resolve dependencies from the network instead of local paths.\n */\nexport type LeoCompilerOptions = {\n enableAstSpans?: boolean\n enableDce?: boolean\n conditionalBlockMaxDepth?: number\n disableConditionalBranchTypeChecking?: boolean\n enableInitialAstSnapshot?: boolean\n enableAllAstSnapshots?: boolean\n astSnapshots?: string[]\n buildTests?: boolean\n noCache?: boolean\n noLocal?: boolean\n}\n\n/** Transaction-shape options shared by deploy/synthesize. */\nexport type LeoTransactionOptions = {\n /** `--priority-fees` (microcredit amounts delimited by `|`). */\n priorityFees?: string\n /** `-f, --fee-records`. */\n feeRecords?: string\n /** `--print` the transaction. */\n print?: boolean\n /** `--broadcast` the transaction to the network. */\n broadcast?: boolean\n /** `--save` the transaction to the given directory. */\n save?: string\n /** `-y, --yes`. Skip confirmation prompts. */\n yes?: boolean\n /** `--consensus-version`. */\n consensusVersion?: string\n /** `--max-wait` seconds when searching for the tx. */\n maxWait?: number\n /** `--blocks-to-check` window when searching for the tx. */\n blocksToCheck?: number\n}\n\n// =============================================================================\n// Per-command option types\n// =============================================================================\n\n/**\n * Options for {@link LeoClient.build} (`leo build`).\n *\n * Combines the compiler flags with per-call overrides of any\n * {@link LeoClientConfig} default.\n */\nexport type LeoBuildOptions = LeoCompilerOptions & Partial<LeoClientConfig>\n\n/**\n * Options for {@link LeoClient.abi} (`leo abi`).\n *\n * Also accepts per-call overrides of any {@link LeoClientConfig} default\n * except `network`, which is redefined here for the parsing context.\n */\nexport type LeoAbiOptions = {\n /** Path to the `.aleo` bytecode file (required positional). */\n file: string\n /** Network context for parsing. Defaults server-side to `'testnet'`. */\n network?: 'mainnet' | 'testnet' | 'canary'\n /** `-o, --output`. Write to path instead of returning stdout. */\n output?: string\n} & Partial<Omit<LeoClientConfig, 'network'>>\n\n/**\n * Options for {@link LeoClient.deploy} (`leo deploy`).\n *\n * Combines compiler flags, transaction-shape flags, and per-call overrides of\n * any {@link LeoClientConfig} default.\n */\nexport type LeoDeployOptions = {\n /** `--skip` deployment of any program whose name contains these substrings. */\n skip?: string[]\n} & LeoCompilerOptions &\n LeoTransactionOptions &\n Partial<LeoClientConfig>\n\n/**\n * Options for {@link LeoClient.synthesize} (`leo synthesize`).\n *\n * Combines compiler flags, transaction-shape flags, and per-call overrides of\n * any {@link LeoClientConfig} default.\n */\nexport type LeoSynthesizeOptions = {\n /** Program name (required positional), e.g. `'helloworld.aleo'`. */\n name: string\n /** `-l, --local`. Use the local Leo project. */\n local?: boolean\n /** `-s, --skip` functions whose names contain these substrings. */\n skip?: string[]\n} & LeoCompilerOptions &\n LeoTransactionOptions &\n Partial<LeoClientConfig>\n\n// =============================================================================\n// Client\n// =============================================================================\n\n/**\n * Programmatic wrapper around the `leo` CLI.\n *\n * Every method spawns the `leo` binary as a child process, so the Leo CLI\n * MUST be installed and on PATH (or located via `leoPath`). Create one with\n * {@link createLeoClient}, or attach one to an existing veil client with\n * {@link leoActions}.\n */\nexport type LeoClient = {\n /** Config the client was constructed with. */\n readonly config: LeoClientConfig\n /** `leo build` — compile the current package. */\n build: (options?: LeoBuildOptions) => Promise<void>\n /** `leo abi` — generate ABI from a `.aleo` bytecode file. Returns the ABI as a string (or empty string if `output` was given). */\n abi: (options: LeoAbiOptions) => Promise<string>\n /** `leo deploy` — deploy the current package. */\n deploy: (options?: LeoDeployOptions) => Promise<void>\n /** `leo synthesize` — synthesize individual proving/verifying keys for a program. */\n synthesize: (options: LeoSynthesizeOptions) => Promise<void>\n}\n\n/**\n * Extension helper that attaches a {@link LeoClient} to any veil client under\n * the `.leo` property. Pass to `.extend()`:\n *\n * ```ts\n * const testClient = createTestClient({ transport }).extend(leoActions({ cwd }))\n * await testClient.leo.build()\n * await testClient.advanceBlock()\n * ```\n *\n * The extension ignores the host client — leo operations don't need a transport —\n * so this works equally well on publicClient, walletClient, or testClient.\n *\n * @param config Defaults forwarded to every `leo` invocation. Defaults to `{}`.\n * @returns An extension object exposing the client at `.leo`.\n */\nexport function leoActions(config: LeoClientConfig = {}) {\n return (_client: unknown): { leo: LeoClient } => ({\n leo: createLeoClient(config),\n })\n}\n\n/**\n * Creates a {@link LeoClient} whose commands shell out to the `leo` CLI.\n *\n * Construction is cheap and does nothing on its own; each method call spawns\n * a `leo` child process, so the Leo CLI MUST be installed\n * (https://developer.aleo.org/leo/installation). Applies when a script\n * or test needs to compile, deploy, or synthesize keys for a Leo project;\n * prefer {@link leoActions} when a veil client is already in hand.\n *\n * @param config Defaults forwarded to every command. Defaults to `{}` — the\n * `leo` binary is resolved on PATH and runs in the current working directory.\n * @returns A client whose methods reject if the binary is missing or a\n * command exits non-zero.\n *\n * @example\n * import { createLeoClient } from '@provablehq/veil-leo'\n *\n * const leo = createLeoClient({ cwd: './programs/token', network: 'testnet' })\n * await leo.build()\n * const abi = await leo.abi({ file: './build/token/token.aleo' })\n */\nexport function createLeoClient(config: LeoClientConfig = {}): LeoClient {\n const merge = <T extends Partial<LeoClientConfig>>(opts: T): T & LeoClientConfig => ({\n ...config,\n ...opts,\n })\n\n return {\n config,\n\n build: async (options = {}) => {\n const m = merge(options)\n const args = [\n 'build',\n ...buildGlobalFlags(m),\n ...buildNetworkFlags(m),\n ...buildCompilerFlags(options),\n ]\n await runLeo(args, m.cwd, m.leoPath)\n },\n\n abi: async (options) => {\n const m = merge(options)\n const args = ['abi', options.file]\n if (options.network) args.push('--network', options.network)\n if (options.output) args.push('--output', options.output)\n args.push(...buildGlobalFlags(m))\n return runLeoCapture(args, m.cwd, m.leoPath)\n },\n\n deploy: async (options = {}) => {\n const m = merge(options)\n const args = [\n 'deploy',\n ...buildGlobalFlags(m),\n ...buildNetworkFlags(m),\n ...buildCompilerFlags(options),\n ...buildTransactionFlags(options),\n ]\n if (options.skip) for (const s of options.skip) args.push('--skip', s)\n await runLeo(args, m.cwd, m.leoPath)\n },\n\n synthesize: async (options) => {\n const m = merge(options)\n const args = ['synthesize', options.name]\n if (options.local) args.push('--local')\n if (options.skip) for (const s of options.skip) args.push('--skip', s)\n args.push(\n ...buildGlobalFlags(m),\n ...buildNetworkFlags(m),\n ...buildCompilerFlags(options),\n ...buildTransactionFlags(options),\n )\n await runLeo(args, m.cwd, m.leoPath)\n },\n }\n}\n\n// =============================================================================\n// Flag builders\n// =============================================================================\n\nfunction buildGlobalFlags(c: LeoClientConfig): string[] {\n const a: string[] = []\n if (c.debug) a.push('-d')\n if (c.quiet) a.push('-q')\n if (c.disableUpdateCheck) a.push('--disable-update-check')\n if (c.cwd) a.push('--path', c.cwd)\n if (c.home) a.push('--home', c.home)\n return a\n}\n\nfunction buildNetworkFlags(c: LeoClientConfig): string[] {\n const a: string[] = []\n if (c.privateKey) a.push('--private-key', c.privateKey)\n if (c.network) a.push('--network', c.network)\n if (c.endpoint) a.push('--endpoint', c.endpoint)\n if (c.devnet) a.push('--devnet')\n if (c.consensusHeights) a.push('--consensus-heights', c.consensusHeights)\n if (c.networkRetries !== undefined) a.push('--network-retries', String(c.networkRetries))\n if (c.offline) a.push('--offline')\n return a\n}\n\nfunction buildCompilerFlags(o: LeoCompilerOptions): string[] {\n const a: string[] = []\n if (o.enableAstSpans) a.push('--enable-ast-spans')\n if (o.enableDce) a.push('--enable-dce')\n if (o.conditionalBlockMaxDepth !== undefined) {\n a.push('--conditional-block-max-depth', String(o.conditionalBlockMaxDepth))\n }\n if (o.disableConditionalBranchTypeChecking) {\n a.push('--disable-conditional-branch-type-checking')\n }\n if (o.enableInitialAstSnapshot) a.push('--enable-initial-ast-snapshot')\n if (o.enableAllAstSnapshots) a.push('--enable-all-ast-snapshots')\n if (o.astSnapshots && o.astSnapshots.length) {\n a.push('--ast-snapshots', o.astSnapshots.join(','))\n }\n if (o.buildTests) a.push('--build-tests')\n if (o.noCache) a.push('--no-cache')\n if (o.noLocal) a.push('--no-local')\n return a\n}\n\nfunction buildTransactionFlags(o: LeoTransactionOptions): string[] {\n const a: string[] = []\n if (o.priorityFees) a.push('--priority-fees', o.priorityFees)\n if (o.feeRecords) a.push('--fee-records', o.feeRecords)\n if (o.print) a.push('--print')\n if (o.broadcast) a.push('--broadcast')\n if (o.save) a.push('--save', o.save)\n if (o.yes) a.push('-y')\n if (o.consensusVersion) a.push('--consensus-version', o.consensusVersion)\n if (o.maxWait !== undefined) a.push('--max-wait', String(o.maxWait))\n if (o.blocksToCheck !== undefined) a.push('--blocks-to-check', String(o.blocksToCheck))\n return a\n}\n\n// =============================================================================\n// Subprocess helpers\n// =============================================================================\n\nfunction runLeo(args: string[], cwd?: string, leoPath = 'leo'): Promise<void> {\n return new Promise((resolve, reject) => {\n const proc = spawn(leoPath, args, { stdio: 'inherit', cwd })\n proc.on('error', (err) =>\n reject(\n new Error(\n `Failed to run ${leoPath}: ${err.message}. Ensure the Leo CLI is installed: https://developer.aleo.org/leo/installation`,\n ),\n ),\n )\n proc.on('exit', (code) => {\n if (code === 0) resolve()\n else reject(new Error(`${leoPath} ${args[0]} exited with code ${code}`))\n })\n })\n}\n\nfunction runLeoCapture(args: string[], cwd?: string, leoPath = 'leo'): Promise<string> {\n return new Promise((resolve, reject) => {\n const proc = spawn(leoPath, args, { stdio: ['ignore', 'pipe', 'inherit'], cwd })\n let stdout = ''\n proc.stdout?.on('data', (chunk: Buffer) => {\n stdout += chunk.toString()\n })\n proc.on('error', (err) =>\n reject(\n new Error(\n `Failed to run ${leoPath}: ${err.message}. Ensure the Leo CLI is installed: https://developer.aleo.org/leo/installation`,\n ),\n ),\n )\n proc.on('exit', (code) => {\n if (code === 0) resolve(stdout)\n else reject(new Error(`${leoPath} ${args[0]} exited with code ${code}`))\n })\n })\n}\n\n// =============================================================================\n// Standalone API\n// =============================================================================\n\n/**\n * Compiles a Leo project by spawning `leo build` as a child process.\n *\n * Requires the Leo CLI on PATH. This is the zero-config path for scripts;\n * use {@link createLeoClient} when compiler flags or shared defaults are needed.\n *\n * @param options.cwd Project directory to build. Defaults to the current\n * working directory.\n * @throws If the `leo` binary is missing or the build exits non-zero.\n *\n * @example\n * import { build } from '@provablehq/veil-leo'\n * await build({ cwd: './programs/token' })\n */\nexport async function build(options?: { cwd?: string }): Promise<void> {\n await runLeo(['build'], options?.cwd)\n}\n\n/**\n * Compiles several Leo projects sequentially by spawning `leo build` once per\n * project.\n *\n * Requires the Leo CLI on PATH. Builds run in order, so list dependencies\n * before the projects that import them.\n *\n * @param projects Project directories, each given as a path string or a\n * `{ cwd }` object.\n * @throws On the first project whose build exits non-zero; later projects are\n * not built.\n *\n * @example\n * import { buildBatch } from '@provablehq/veil-leo'\n * await buildBatch(['./programs/token', './programs/market'])\n */\nexport async function buildBatch(projects: Array<string | { cwd?: string }>): Promise<void> {\n for (const project of projects) {\n const cwd = typeof project === 'string' ? project : project.cwd\n await runLeo(['build'], cwd)\n }\n}\n\n/**\n * Generates the ABI of a compiled `.aleo` file by spawning `leo abi <file>`\n * and capturing its output.\n *\n * Requires the Leo CLI on PATH. This is the zero-config path for scripts;\n * use {@link createLeoClient} when network or output flags and shared\n * defaults are needed. The file MUST already exist — call {@link build}\n * first when generating from source.\n *\n * @param options.file Path to the compiled `.aleo` bytecode file, relative\n * to `cwd`.\n * @param options.cwd Project directory. Defaults to the current working\n * directory.\n * @returns The ABI JSON captured from stdout, raw — a trailing newline may be\n * present. `JSON.parse` tolerates it.\n * @throws If the `leo` binary is missing or the command exits non-zero.\n *\n * @example\n * import { abi } from '@provablehq/veil-leo'\n * const json = await abi({ file: 'build/token/token.aleo', cwd: './programs/token' })\n */\nexport async function abi(options: { file: string; cwd?: string }): Promise<string> {\n return runLeoCapture(['abi', options.file], options.cwd)\n}\n\n/** Options for {@link run}. */\nexport type LeoRunOptions = {\n /** Function name to call. `leo run` resolves the program from the project at `cwd`. */\n function: string\n /** Inputs to pass to the function. */\n inputs?: string[]\n /** Path to the Leo project directory. Defaults to the current working directory. */\n cwd?: string\n}\n\n/**\n * Executes a function of the local Leo project by spawning\n * `leo run <function> [inputs...]`.\n *\n * Requires the Leo CLI on PATH. Runs the transition locally against the\n * project at `cwd` — nothing is broadcast to a network.\n *\n * @param options Function name, its inputs, and the project directory.\n * @throws If the `leo` binary is missing or the run exits non-zero (for\n * example on a type error or failing assertion).\n *\n * @example\n * import { run } from '@provablehq/veil-leo'\n * await run({ function: 'mint', inputs: ['1000u64'], cwd: './programs/token' })\n */\nexport async function run(options: LeoRunOptions): Promise<void> {\n const args = ['run', options.function, ...(options.inputs ?? [])]\n await runLeo(args, options.cwd)\n}\n\n/** Options for {@link clean}. */\nexport type LeoCleanOptions = {\n /** Path to the Leo project directory. Defaults to the current working directory. */\n cwd?: string\n}\n\n/**\n * Deletes a Leo project's build artifacts by spawning `leo clean`.\n *\n * Requires the Leo CLI on PATH. Use before a build when cached artifacts are\n * suspect.\n *\n * @param options.cwd Project directory to clean. Defaults to the current\n * working directory.\n * @throws If the `leo` binary is missing or the command exits non-zero.\n */\nexport async function clean(options?: LeoCleanOptions): Promise<void> {\n await runLeo(['clean'], options?.cwd)\n}\n"],"mappings":";AAAA,SAAS,aAAa;AAsMf,SAAS,WAAW,SAA0B,CAAC,GAAG;AACvD,SAAO,CAAC,aAA0C;AAAA,IAChD,KAAK,gBAAgB,MAAM;AAAA,EAC7B;AACF;AAuBO,SAAS,gBAAgB,SAA0B,CAAC,GAAc;AACvE,QAAM,QAAQ,CAAqC,UAAkC;AAAA,IACnF,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,SAAO;AAAA,IACL;AAAA,IAEA,OAAO,OAAO,UAAU,CAAC,MAAM;AAC7B,YAAM,IAAI,MAAM,OAAO;AACvB,YAAM,OAAO;AAAA,QACX;AAAA,QACA,GAAG,iBAAiB,CAAC;AAAA,QACrB,GAAG,kBAAkB,CAAC;AAAA,QACtB,GAAG,mBAAmB,OAAO;AAAA,MAC/B;AACA,YAAM,OAAO,MAAM,EAAE,KAAK,EAAE,OAAO;AAAA,IACrC;AAAA,IAEA,KAAK,OAAO,YAAY;AACtB,YAAM,I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using the Leo CLI from TS/JS.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/ProvableHQ/veil.git",
9
+ "directory": "packages/leo"
10
+ },
11
+ "homepage": "https://github.com/ProvableHQ/veil#readme",
12
+ "type": "module",
13
+ "main": "dist/index.js",
14
+ "types": "dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js"
19
+ }
20
+ },
21
+ "sideEffects": false,
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "scripts": {
32
+ "build": "tsup",
33
+ "test": "vitest run",
34
+ "typecheck": "tsc --noEmit"
35
+ }
36
+ }