@lionden/network 0.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.
Files changed (55) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +23 -0
  3. package/dist/accounts.d.ts +12 -0
  4. package/dist/accounts.d.ts.map +1 -0
  5. package/dist/accounts.js +38 -0
  6. package/dist/accounts.js.map +1 -0
  7. package/dist/connection.d.ts +121 -0
  8. package/dist/connection.d.ts.map +1 -0
  9. package/dist/connection.js +1064 -0
  10. package/dist/connection.js.map +1 -0
  11. package/dist/devnode-backend.d.ts +53 -0
  12. package/dist/devnode-backend.d.ts.map +1 -0
  13. package/dist/devnode-backend.js +121 -0
  14. package/dist/devnode-backend.js.map +1 -0
  15. package/dist/devnode-manager.d.ts +130 -0
  16. package/dist/devnode-manager.d.ts.map +1 -0
  17. package/dist/devnode-manager.js +546 -0
  18. package/dist/devnode-manager.js.map +1 -0
  19. package/dist/execution-key-cache.d.ts +71 -0
  20. package/dist/execution-key-cache.d.ts.map +1 -0
  21. package/dist/execution-key-cache.js +286 -0
  22. package/dist/execution-key-cache.js.map +1 -0
  23. package/dist/file-io.d.ts +2 -0
  24. package/dist/file-io.d.ts.map +1 -0
  25. package/dist/file-io.js +9 -0
  26. package/dist/file-io.js.map +1 -0
  27. package/dist/index.d.ts +12 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +11 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/named-account-manager.d.ts +40 -0
  32. package/dist/named-account-manager.d.ts.map +1 -0
  33. package/dist/named-account-manager.js +116 -0
  34. package/dist/named-account-manager.js.map +1 -0
  35. package/dist/network-manager.d.ts +36 -0
  36. package/dist/network-manager.d.ts.map +1 -0
  37. package/dist/network-manager.js +226 -0
  38. package/dist/network-manager.js.map +1 -0
  39. package/dist/sdk-adapter.d.ts +271 -0
  40. package/dist/sdk-adapter.d.ts.map +1 -0
  41. package/dist/sdk-adapter.js +997 -0
  42. package/dist/sdk-adapter.js.map +1 -0
  43. package/dist/sdk-diagnostics.d.ts +113 -0
  44. package/dist/sdk-diagnostics.d.ts.map +1 -0
  45. package/dist/sdk-diagnostics.js +241 -0
  46. package/dist/sdk-diagnostics.js.map +1 -0
  47. package/dist/transition-selector.d.ts +15 -0
  48. package/dist/transition-selector.d.ts.map +1 -0
  49. package/dist/transition-selector.js +45 -0
  50. package/dist/transition-selector.js.map +1 -0
  51. package/dist/types.d.ts +484 -0
  52. package/dist/types.d.ts.map +1 -0
  53. package/dist/types.js +129 -0
  54. package/dist/types.js.map +1 -0
  55. package/package.json +35 -0
@@ -0,0 +1,484 @@
1
+ import type { AleoNetwork, NamedAccounts } from "@lionden/config";
2
+ import type { SdkEgressPolicy } from "./sdk-adapter.js";
3
+ import type { SdkTransportFailure } from "./sdk-diagnostics.js";
4
+ /**
5
+ * Result from executing a program transition at the network layer.
6
+ *
7
+ * - `outputs` is always present. In local mode it carries the SDK's local
8
+ * execution outputs. In on-chain mode it is `[]` unless the caller opted
9
+ * in to awaiting confirmation (`ExecuteOptions.awaitConfirmation === true`
10
+ * or `getTransitionOutputs(...)` was called), in which case it carries the
11
+ * matching transition's `rawOutputs` flattened to strings (id-only entries
12
+ * are serialized to their `id` so the common case stays `string[]`).
13
+ * - `rawOutputs` is present only on the awaited on-chain path. It preserves
14
+ * the faithful on-chain shape, including the `idOnly` discriminator for
15
+ * dynamic-record outputs.
16
+ *
17
+ * Generated typechain wrappers consume this result (via `executeRaw`) but
18
+ * surface their own typed output shape on top of `rawOutputs`; their public
19
+ * return type is not this interface.
20
+ */
21
+ export interface TransitionCallResult {
22
+ readonly outputs: string[];
23
+ readonly rawOutputs?: readonly RawTransitionOutput[];
24
+ readonly txId?: string;
25
+ }
26
+ export interface IdOnlyTransitionOutput {
27
+ readonly kind: "idOnly";
28
+ readonly type: string;
29
+ readonly id: string;
30
+ }
31
+ export type RawTransitionOutput = string | IdOnlyTransitionOutput;
32
+ /** One confirmed transition within a confirmed transaction. */
33
+ export interface ConfirmedTransitionRecord {
34
+ /** Program id, e.g. "token.aleo". */
35
+ readonly programId: string;
36
+ /** Transition name, e.g. "mint_private". */
37
+ readonly transitionName: string;
38
+ /**
39
+ * Raw outputs for this transition, in declaration order. Record outputs are
40
+ * record ciphertexts (`record1...`) when the node exposes a value. Id-only
41
+ * dynamic-record outputs are represented as `{ kind: "idOnly", ... }` so
42
+ * ABI positions remain stable for generated projectors. Plaintext outputs
43
+ * are Leo literals (`123u32`, `aleo1...`, `{ ... }`, etc.) only when
44
+ * declared `public`; private and default-private plaintext outputs are Aleo
45
+ * value ciphertexts (`ciphertext1...`) that callers must decrypt using the
46
+ * transition's `transitionPublicKey` and the recipient's view key (see the
47
+ * generated typechain's `EncryptedValue<T>` handles).
48
+ */
49
+ readonly rawOutputs: readonly RawTransitionOutput[];
50
+ /**
51
+ * Transition public key (`tpk`) carried by the on-chain transition. Required
52
+ * input to `Ciphertext.decryptWithTransitionInfo(...)` when decrypting
53
+ * private input or output ciphertexts produced by this transition.
54
+ */
55
+ readonly transitionPublicKey: string;
56
+ }
57
+ /** Confirmed transaction details. */
58
+ export interface ConfirmedTransaction {
59
+ readonly txId: string;
60
+ readonly blockHeight: number;
61
+ readonly status: "accepted" | "rejected";
62
+ /**
63
+ * All execute transitions in the confirmed transaction.
64
+ * For fee-only rejected transactions (Aleo converts rejected executes to
65
+ * fee-only on inclusion), this is `[]` — the original execute transitions
66
+ * are not carried by the chain.
67
+ */
68
+ readonly transitions: readonly ConfirmedTransitionRecord[];
69
+ }
70
+ export type ConfirmationTimeoutStage = "confirmed" | "blockHash" | "blockHeight";
71
+ export interface NetworkConfirmationTimeoutContext {
72
+ readonly txId: string;
73
+ readonly timeout: number;
74
+ readonly stage: ConfirmationTimeoutStage;
75
+ readonly cause?: unknown;
76
+ }
77
+ export declare class NetworkConfirmationTimeoutError extends Error {
78
+ readonly kind: "NetworkConfirmationTimeoutError";
79
+ readonly txId: string;
80
+ readonly timeout: number;
81
+ readonly stage: ConfirmationTimeoutStage;
82
+ constructor(message: string, context: NetworkConfirmationTimeoutContext);
83
+ }
84
+ export interface TransitionRejectedContext {
85
+ readonly txId: string;
86
+ readonly programId: string;
87
+ readonly transitionName: string;
88
+ readonly blockHeight: number;
89
+ }
90
+ /**
91
+ * Thrown by `connection.getTransitionOutputs(...)` (and by `execute(...)`
92
+ * when `awaitConfirmation: true`) if the confirmed transaction landed with
93
+ * `status: "rejected"`. Rejected execute transactions are converted to
94
+ * fee-only on inclusion, so the original transition outputs are not
95
+ * recoverable from the chain.
96
+ */
97
+ export declare class TransitionRejectedError extends Error {
98
+ readonly kind: "TransitionRejectedError";
99
+ readonly txId: string;
100
+ readonly programId: string;
101
+ readonly transitionName: string;
102
+ readonly blockHeight: number;
103
+ constructor(message: string, context: TransitionRejectedContext);
104
+ }
105
+ export interface LocalVmExecutionContext {
106
+ readonly programId: string;
107
+ readonly transitionName: string;
108
+ readonly cause?: unknown;
109
+ }
110
+ /**
111
+ * Thrown by the network layer when a local VM authorization check reaches a
112
+ * catchable transition/runtime failure. Infrastructure, configuration, SDK
113
+ * egress, and source-resolution failures are deliberately not wrapped in this
114
+ * class so generated failure helpers can rethrow them unchanged.
115
+ */
116
+ export declare class LocalVmExecutionError extends Error {
117
+ readonly kind: "LocalVmExecutionError";
118
+ readonly programId: string;
119
+ readonly transitionName: string;
120
+ constructor(message: string, context: LocalVmExecutionContext);
121
+ }
122
+ export interface SdkExecutionContext {
123
+ readonly operation: "execute" | "local" | "deploy" | "upgrade";
124
+ readonly programId: string;
125
+ readonly transitionName?: string;
126
+ /** Transport failures captured during the failed SDK build/prove call. */
127
+ readonly diagnostics: readonly SdkTransportFailure[];
128
+ readonly cause?: unknown;
129
+ }
130
+ /**
131
+ * Thrown by `captureSdkCall(...)` when an SDK build/prove call fails and either
132
+ * a transport-level state-query failure was captured or the thrown value is an
133
+ * opaque WASM abort. The `message` surfaces the underlying HTTP state-query
134
+ * failure (endpoint + status + body); the original opaque error is preserved at
135
+ * `.cause`, and the full transport-failure snapshot at `.diagnostics`.
136
+ *
137
+ * Generated typechain wraps this into `TransitionSubmissionError` using its
138
+ * `.message`, so the descriptive cause flows through automatically (reachable
139
+ * at `.cause.cause`). Already-descriptive errors are never wrapped in this
140
+ * class — see `captureSdkCall`.
141
+ */
142
+ export declare class SdkExecutionError extends Error {
143
+ readonly kind: "SdkExecutionError";
144
+ readonly operation: "execute" | "local" | "deploy" | "upgrade";
145
+ readonly programId: string;
146
+ readonly transitionName?: string;
147
+ readonly diagnostics: readonly SdkTransportFailure[];
148
+ constructor(message: string, context: SdkExecutionContext);
149
+ }
150
+ /**
151
+ * Thrown by the network layer's local-WASM trap capture when the Provable WASM
152
+ * runtime reports a Leo runtime panic (integer under/overflow, division by zero)
153
+ * as a process-level `RuntimeError: unreachable` trap that escapes the SDK call
154
+ * promise (`pm.run`, `pm.execute`, `buildDevnodeExecutionTransaction`, or
155
+ * `buildAuthorizationUnchecked`), leaving it pending. The original trap is
156
+ * preserved at `.cause`. (An explicit `assert` failure is a *catchable*
157
+ * `Stack …` rejection, not this trap.)
158
+ *
159
+ * The trap carries only the generic `unreachable` message; the descriptive
160
+ * snarkVM panic text is written to stderr by the panic hook and is not
161
+ * recoverable here, so this error cannot surface the underlying failure reason.
162
+ *
163
+ * Defined in this module (rather than connection.ts) so `captureSdkCall`
164
+ * (sdk-diagnostics.ts) can pass it through without re-wrapping it into a
165
+ * generic `SdkExecutionError`, and without introducing a
166
+ * connection.ts -> sdk-diagnostics.ts import cycle.
167
+ */
168
+ export declare class LocalExecutionWasmTrapError extends Error {
169
+ readonly kind: "LocalExecutionWasmTrapError";
170
+ constructor(cause: unknown);
171
+ }
172
+ export interface TransitionSelectionContext {
173
+ readonly programId: string;
174
+ readonly transitionName: string;
175
+ readonly matchCount: number;
176
+ readonly availableTransitions: readonly string[];
177
+ /**
178
+ * Present when the selector is invoked downstream of a successful broadcast
179
+ * (e.g. via `connection.execute({ awaitConfirmation: true })` or
180
+ * `connection.getTransitionOutputs(...)`). Callers that hit the reentrant
181
+ * multi-match case need this id to look up the full confirmed transaction.
182
+ */
183
+ readonly txId?: string;
184
+ }
185
+ /**
186
+ * Thrown by `selectMatchingTransition(...)` when the confirmed transaction
187
+ * does not contain exactly one transition matching `(programId, transitionName)`.
188
+ * Reentrant and recursive flows hit the multi-match case — opt out of the
189
+ * default await via `{ awaitConfirmation: false }` and inspect
190
+ * `connection.waitForConfirmation(txId).transitions` directly.
191
+ */
192
+ export declare class TransitionSelectionError extends Error {
193
+ readonly kind: "TransitionSelectionError";
194
+ readonly programId: string;
195
+ readonly transitionName: string;
196
+ readonly matchCount: number;
197
+ readonly availableTransitions: readonly string[];
198
+ readonly txId?: string;
199
+ constructor(message: string, context: TransitionSelectionContext);
200
+ }
201
+ /**
202
+ * A signer that can authorize transactions.
203
+ * DevnodeAccount satisfies this interface structurally.
204
+ */
205
+ export interface Signer {
206
+ readonly privateKey: string;
207
+ readonly address: string;
208
+ }
209
+ /** Options for transition execution. */
210
+ export interface ExecuteOptions {
211
+ mode?: "local" | "onchain";
212
+ fee?: number;
213
+ privateFee?: boolean;
214
+ /** Override the signer for this execution. */
215
+ signer?: Signer;
216
+ /**
217
+ * Generate real proofs during on-chain execution.
218
+ * When false (default), devnode connections use the fast-path builder
219
+ * (`buildDevnodeExecutionTransaction`) which skips proof generation.
220
+ * When true, the standard `pm.execute()` path is used even on devnode,
221
+ * producing real proofs (significantly slower).
222
+ * Has no effect on non-devnode connections (proofs are always generated)
223
+ * or in `"local"` mode.
224
+ */
225
+ prove?: boolean;
226
+ /**
227
+ * Additional programs to load into the VM at execute time. Each entry is
228
+ * a Leo program id (bare `voting_power` or `voting_power.aleo`) or a path
229
+ * to a local `.aleo` file (relative paths anchor to project root).
230
+ * Merged with config-level `execution.imports[programId]` for this call.
231
+ * Required when the program performs dynamic dispatch and the targets
232
+ * cannot be discovered from static `import` statements.
233
+ */
234
+ imports?: readonly string[];
235
+ /**
236
+ * On-chain mode only. When `true`, `execute()` awaits confirmation and
237
+ * returns the matching transition's parsed outputs. When `false` or
238
+ * omitted, `execute()` returns immediately after broadcast with
239
+ * `outputs: []`; callers can fetch outputs later via
240
+ * `connection.getTransitionOutputs(txId, programId, transitionName)`.
241
+ *
242
+ * Defaults to `false` at this layer to preserve fire-and-forget semantics
243
+ * for generated typechain `submitTransition()`, which calls
244
+ * `network.execute(...)` and runs its own `waitForConfirmation` for
245
+ * `.accepted()` / `.settled()`. The user-facing wrappers
246
+ * (`ctx.execute`, `ctx.raw.execute`, recipe `execute`) flip the default
247
+ * to `true` at their layer.
248
+ *
249
+ * No effect in `mode: "local"` (local mode returns outputs synchronously).
250
+ */
251
+ awaitConfirmation?: boolean;
252
+ }
253
+ /**
254
+ * A connection to an Aleo network node.
255
+ * Provides typed methods for querying state and executing transitions.
256
+ */
257
+ export interface NetworkConnection {
258
+ /** Connection type */
259
+ readonly type: "devnode" | "http";
260
+ /** Name from config (e.g., "devnode", "testnet") */
261
+ readonly name: string;
262
+ /** REST API endpoint URL (e.g., "http://127.0.0.1:3030") */
263
+ readonly endpoint: string;
264
+ /** Aleo network ID */
265
+ readonly networkId: AleoNetwork;
266
+ /** Private key for signing, if configured. */
267
+ readonly privateKey?: string;
268
+ /** API key for explorer/node authentication. */
269
+ readonly apiKey?: string;
270
+ /**
271
+ * SDK egress policy resolved for this connection. Plugins that build
272
+ * their own SDK objects (deploy / upgrade / preflight) must forward
273
+ * this into `createSdkObjects` so the same transports are installed.
274
+ */
275
+ readonly egressPolicy: SdkEgressPolicy;
276
+ /** Get account balance in microcredits. Uses configured default account if none specified. */
277
+ getBalance(address?: string): Promise<bigint>;
278
+ /** Query a mapping value. Returns null if the key has no entry. */
279
+ getMappingValue(programId: string, mappingName: string, key: string): Promise<string | null>;
280
+ /** Query a storage variable value. Returns null if the value has no entry. */
281
+ getStorageValue(programId: string, variableName: string): Promise<string | null>;
282
+ /** Query a vector storage variable length. Returns 0 if the length entry is absent. */
283
+ getStorageVectorLength(programId: string, variableName: string): Promise<number>;
284
+ /**
285
+ * Query a vector storage variable element. Returns null if the indexed entry
286
+ * is absent.
287
+ *
288
+ * This is a raw read: it returns whatever is stored at the indexed key,
289
+ * including stale entries left behind by `pop`/`clear` (which only decrement
290
+ * the length mapping and never delete element entries). Callers that want a
291
+ * logical-length-bounded read should use the generated `BaseContract` storage
292
+ * accessor, which checks the length first.
293
+ */
294
+ getStorageVectorValue(programId: string, variableName: string, index: number): Promise<string | null>;
295
+ /** Execute a program transition. */
296
+ execute(programId: string, transitionName: string, args: string[], options?: ExecuteOptions): Promise<TransitionCallResult>;
297
+ /** Wait for a transaction to be confirmed on-chain. */
298
+ waitForConfirmation(txId: string, timeout?: number): Promise<ConfirmedTransaction>;
299
+ /**
300
+ * Await confirmation of `txId` and return the parsed outputs for the
301
+ * matching `(programId, transitionName)` transition.
302
+ *
303
+ * Throws `TransitionRejectedError` if the confirmed transaction has
304
+ * `status: "rejected"` (fee-only on inclusion; outputs are not recoverable).
305
+ * Throws `TransitionSelectionError` if the confirmed transaction does not
306
+ * contain exactly one matching transition — see the error message for the
307
+ * reentrant escape hatch (`awaitConfirmation: false` + manual
308
+ * `waitForConfirmation(txId)`).
309
+ */
310
+ getTransitionOutputs(txId: string, programId: string, transitionName: string, timeout?: number): Promise<TransitionCallResult>;
311
+ /** Advance blocks on devnode. Only available on devnode connections. */
312
+ advanceBlocks?(count: number): Promise<void>;
313
+ /** Get the current block height. */
314
+ getBlockHeight(): Promise<number>;
315
+ /**
316
+ * Fetch the compiled Aleo source for a deployed program.
317
+ * Returns null if the program does not exist on-chain (404 / not found).
318
+ */
319
+ getProgramSource(programId: string): Promise<string | null>;
320
+ /**
321
+ * Fetch the current on-chain edition for a deployed program.
322
+ * Returns null when the network/SDK cannot provide it or the program is absent.
323
+ */
324
+ getProgramEdition(programId: string): Promise<number | null>;
325
+ /**
326
+ * Fetch the current on-chain checksum for a deployed program.
327
+ * Returns the SDK's raw checksum bytes.
328
+ * Returns null when the network/SDK cannot provide it or the program is absent.
329
+ */
330
+ getProgramChecksum(programId: string): Promise<Uint8Array | null>;
331
+ /** Broadcast a serialized transaction to the network. Returns the transaction ID. */
332
+ broadcastTransaction(transaction: unknown): Promise<string>;
333
+ /** Whether this connection has been permanently closed. */
334
+ readonly closed: boolean;
335
+ /** Close this connection and release resources. */
336
+ close(): Promise<void>;
337
+ }
338
+ /**
339
+ * Manages network connections for the LionDen runtime.
340
+ * Created by plugin-network and injected into lre.network.
341
+ */
342
+ export interface NetworkManager {
343
+ /** Connect to a named network (or the default). */
344
+ connect(name?: string): Promise<NetworkConnection>;
345
+ /** Get the current active connection, or null if not connected. */
346
+ getConnection(): NetworkConnection | null;
347
+ /** Disconnect all active connections. */
348
+ disconnectAll(): Promise<void>;
349
+ /** Get well-known devnode accounts. */
350
+ getAccounts(): DevnodeAccount[];
351
+ /**
352
+ * Get resolved named accounts for the currently active network.
353
+ * Returns a shallow copy — mutating the returned object has no effect.
354
+ * Returns {} before connect() or when no namedAccounts are configured.
355
+ */
356
+ getNamedAccounts(): NamedAccounts;
357
+ /**
358
+ * Execute a transition on the active connection.
359
+ * Convenience method — delegates to getConnection().execute().
360
+ */
361
+ execute(programId: string, transitionName: string, args: string[], options?: ExecuteOptions): Promise<TransitionCallResult>;
362
+ /**
363
+ * Query a mapping value on the active connection.
364
+ * Convenience method — delegates to getConnection().getMappingValue().
365
+ */
366
+ getMappingValue(programId: string, mappingName: string, key: string): Promise<string | null>;
367
+ /**
368
+ * Query a storage variable value on the active connection.
369
+ * Convenience method — delegates to getConnection().getStorageValue().
370
+ */
371
+ getStorageValue(programId: string, variableName: string): Promise<string | null>;
372
+ /**
373
+ * Query a vector storage variable length on the active connection.
374
+ * Convenience method — delegates to getConnection().getStorageVectorLength().
375
+ */
376
+ getStorageVectorLength(programId: string, variableName: string): Promise<number>;
377
+ /**
378
+ * Query a vector storage variable element on the active connection.
379
+ * Convenience method — delegates to getConnection().getStorageVectorValue().
380
+ *
381
+ * This is a raw read: it returns whatever is stored at the indexed key,
382
+ * including stale entries left behind by `pop`/`clear` (which only decrement
383
+ * the length mapping and never delete element entries). Callers that want a
384
+ * logical-length-bounded read should use the generated `BaseContract` storage
385
+ * accessor, which checks the length first.
386
+ */
387
+ getStorageVectorValue(programId: string, variableName: string, index: number): Promise<string | null>;
388
+ /**
389
+ * Wait for a transaction on the active connection.
390
+ * Convenience method — delegates to getConnection().waitForConfirmation().
391
+ */
392
+ waitForConfirmation(txId: string, timeout?: number): Promise<ConfirmedTransaction>;
393
+ /**
394
+ * Fetch parsed outputs for a confirmed transition on the active connection.
395
+ * Convenience method — delegates to getConnection().getTransitionOutputs().
396
+ */
397
+ getTransitionOutputs(txId: string, programId: string, transitionName: string, timeout?: number): Promise<TransitionCallResult>;
398
+ }
399
+ export interface DevnodeAccount {
400
+ readonly name: string;
401
+ readonly privateKey: string;
402
+ readonly address: string;
403
+ /** Initial balance in microcredits on devnode genesis (~23.4T) */
404
+ readonly initialBalance: bigint;
405
+ }
406
+ /**
407
+ * How `DevnodeManager` handles the devnode subprocess's stdout/stderr.
408
+ *
409
+ * - `"quiet-buffered"` (default): drain both streams, retain the last ~64 KiB
410
+ * per stream in an internal ring buffer. The buffered tail is surfaced in
411
+ * error messages on health-check timeout / unexpected exit and is readable
412
+ * via `getLogTail()`.
413
+ * - `"inherit"`: pass stdout/stderr straight through to the parent process.
414
+ * No JS-side capture; `getLogTail()` returns empty strings.
415
+ * - `"forward"`: drain in JS, invoke `onStdout` / `onStderr` per chunk, AND
416
+ * retain the same 64 KiB ring buffer.
417
+ */
418
+ export type DevnodeLogMode = "quiet-buffered" | "inherit" | "forward";
419
+ /** Which devnode backend to drive. */
420
+ export type DevnodeProvider = "leo" | "standalone";
421
+ export interface DevnodeStartOptions {
422
+ /** REST API socket address. Default: "127.0.0.1:3030" */
423
+ socketAddr?: string;
424
+ /** Auto-create blocks on transaction broadcast. Default: true */
425
+ autoBlock?: boolean;
426
+ /** Verbosity level (0-2). Default: 0 */
427
+ verbosity?: number;
428
+ /** Path to custom genesis block. */
429
+ genesisPath?: string;
430
+ /** Aleo network. Default: "testnet" */
431
+ network?: AleoNetwork;
432
+ /** Private key for the devnode validator. Default: well-known test key */
433
+ privateKey?: string;
434
+ /**
435
+ * Path to the Leo CLI binary. Default: "leo".
436
+ * Allows using a version-specific binary (e.g., "~/.leo/bin/leo-3.5").
437
+ */
438
+ leoBinary?: string;
439
+ /**
440
+ * Configured Leo compatibility line (e.g. "4.3.2"). Used to version-gate the
441
+ * `leo devnode start` argument surface: `--consensus-heights` and `--network`
442
+ * are only emitted for Leo < 4.3. Leo 4.3+ removed both from `devnode start`
443
+ * (the devnode is TestnetV0-only and auto-activates the latest consensus
444
+ * version, incl. V16/V17). Unknown/unset is treated as modern (>= 4.3).
445
+ */
446
+ leoVersion?: string;
447
+ /**
448
+ * Consensus heights for devnode startup (e.g., "0,1,2,3,4,5,6,7,8").
449
+ * **Leo < 4.3 only.** Required for V9/constructor support on older Leo
450
+ * backends. Not emitted on Leo 4.3+ (the devnode auto-activates the latest
451
+ * consensus version). Rejected on the standalone backend (consensus heights
452
+ * are compiled into `aleo-devnode`).
453
+ */
454
+ consensusHeights?: string;
455
+ /**
456
+ * Devnode backend. `"leo"` spawns `leo devnode start`; `"standalone"` spawns
457
+ * Provable's `aleo-devnode start`. Default: `"leo"` (backward compatible).
458
+ * Callers typically resolve this via `resolveDevnodeBackend` before start.
459
+ */
460
+ provider?: DevnodeProvider;
461
+ /**
462
+ * Path to the standalone `aleo-devnode` binary. Default: `"aleo-devnode"`.
463
+ * Only used when `provider === "standalone"`.
464
+ */
465
+ devnodeBinary?: string;
466
+ /**
467
+ * Persistent ledger directory for the standalone backend (`--storage`).
468
+ * Required for snapshot/restore. Standalone-only.
469
+ */
470
+ storagePath?: string;
471
+ /** Clear `storagePath` before starting (`--clear-storage`). Standalone-only. */
472
+ clearStorage?: boolean;
473
+ /**
474
+ * How to handle the devnode subprocess's stdout/stderr. Default:
475
+ * `"quiet-buffered"`. The `LIONDEN_DEVNODE_LOGS` env var overrides the
476
+ * default but never overrides an explicit caller-supplied value.
477
+ */
478
+ logMode?: DevnodeLogMode;
479
+ /** Per-chunk stdout callback. Invoked only when `logMode === "forward"`. */
480
+ onStdout?: (chunk: Buffer) => void;
481
+ /** Per-chunk stderr callback. Invoked only when `logMode === "forward"`. */
482
+ onStderr?: (chunk: Buffer) => void;
483
+ }
484
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAMhE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACrD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,sBAAsB,CAAC;AAElE,+DAA+D;AAC/D,MAAM,WAAW,yBAAyB;IACxC,qCAAqC;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,4CAA4C;IAC5C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,UAAU,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACpD;;;;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B;;;;OAIG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC"}
package/dist/types.js ADDED
@@ -0,0 +1,129 @@
1
+ export class NetworkConfirmationTimeoutError extends Error {
2
+ kind = "NetworkConfirmationTimeoutError";
3
+ txId;
4
+ timeout;
5
+ stage;
6
+ constructor(message, context) {
7
+ super(message, context.cause === undefined ? undefined : { cause: context.cause });
8
+ this.name = "NetworkConfirmationTimeoutError";
9
+ this.txId = context.txId;
10
+ this.timeout = context.timeout;
11
+ this.stage = context.stage;
12
+ }
13
+ }
14
+ /**
15
+ * Thrown by `connection.getTransitionOutputs(...)` (and by `execute(...)`
16
+ * when `awaitConfirmation: true`) if the confirmed transaction landed with
17
+ * `status: "rejected"`. Rejected execute transactions are converted to
18
+ * fee-only on inclusion, so the original transition outputs are not
19
+ * recoverable from the chain.
20
+ */
21
+ export class TransitionRejectedError extends Error {
22
+ kind = "TransitionRejectedError";
23
+ txId;
24
+ programId;
25
+ transitionName;
26
+ blockHeight;
27
+ constructor(message, context) {
28
+ super(message);
29
+ this.name = "TransitionRejectedError";
30
+ this.txId = context.txId;
31
+ this.programId = context.programId;
32
+ this.transitionName = context.transitionName;
33
+ this.blockHeight = context.blockHeight;
34
+ }
35
+ }
36
+ /**
37
+ * Thrown by the network layer when a local VM authorization check reaches a
38
+ * catchable transition/runtime failure. Infrastructure, configuration, SDK
39
+ * egress, and source-resolution failures are deliberately not wrapped in this
40
+ * class so generated failure helpers can rethrow them unchanged.
41
+ */
42
+ export class LocalVmExecutionError extends Error {
43
+ kind = "LocalVmExecutionError";
44
+ programId;
45
+ transitionName;
46
+ constructor(message, context) {
47
+ super(message, context.cause === undefined ? undefined : { cause: context.cause });
48
+ this.name = "LocalVmExecutionError";
49
+ this.programId = context.programId;
50
+ this.transitionName = context.transitionName;
51
+ }
52
+ }
53
+ /**
54
+ * Thrown by `captureSdkCall(...)` when an SDK build/prove call fails and either
55
+ * a transport-level state-query failure was captured or the thrown value is an
56
+ * opaque WASM abort. The `message` surfaces the underlying HTTP state-query
57
+ * failure (endpoint + status + body); the original opaque error is preserved at
58
+ * `.cause`, and the full transport-failure snapshot at `.diagnostics`.
59
+ *
60
+ * Generated typechain wraps this into `TransitionSubmissionError` using its
61
+ * `.message`, so the descriptive cause flows through automatically (reachable
62
+ * at `.cause.cause`). Already-descriptive errors are never wrapped in this
63
+ * class — see `captureSdkCall`.
64
+ */
65
+ export class SdkExecutionError extends Error {
66
+ kind = "SdkExecutionError";
67
+ operation;
68
+ programId;
69
+ transitionName;
70
+ diagnostics;
71
+ constructor(message, context) {
72
+ super(message, context.cause === undefined ? undefined : { cause: context.cause });
73
+ this.name = "SdkExecutionError";
74
+ this.operation = context.operation;
75
+ this.programId = context.programId;
76
+ this.transitionName = context.transitionName;
77
+ this.diagnostics = context.diagnostics;
78
+ }
79
+ }
80
+ /**
81
+ * Thrown by the network layer's local-WASM trap capture when the Provable WASM
82
+ * runtime reports a Leo runtime panic (integer under/overflow, division by zero)
83
+ * as a process-level `RuntimeError: unreachable` trap that escapes the SDK call
84
+ * promise (`pm.run`, `pm.execute`, `buildDevnodeExecutionTransaction`, or
85
+ * `buildAuthorizationUnchecked`), leaving it pending. The original trap is
86
+ * preserved at `.cause`. (An explicit `assert` failure is a *catchable*
87
+ * `Stack …` rejection, not this trap.)
88
+ *
89
+ * The trap carries only the generic `unreachable` message; the descriptive
90
+ * snarkVM panic text is written to stderr by the panic hook and is not
91
+ * recoverable here, so this error cannot surface the underlying failure reason.
92
+ *
93
+ * Defined in this module (rather than connection.ts) so `captureSdkCall`
94
+ * (sdk-diagnostics.ts) can pass it through without re-wrapping it into a
95
+ * generic `SdkExecutionError`, and without introducing a
96
+ * connection.ts -> sdk-diagnostics.ts import cycle.
97
+ */
98
+ export class LocalExecutionWasmTrapError extends Error {
99
+ kind = "LocalExecutionWasmTrapError";
100
+ constructor(cause) {
101
+ super(`Provable SDK local-WASM execution trapped outside the SDK call promise: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
102
+ this.name = "LocalExecutionWasmTrapError";
103
+ }
104
+ }
105
+ /**
106
+ * Thrown by `selectMatchingTransition(...)` when the confirmed transaction
107
+ * does not contain exactly one transition matching `(programId, transitionName)`.
108
+ * Reentrant and recursive flows hit the multi-match case — opt out of the
109
+ * default await via `{ awaitConfirmation: false }` and inspect
110
+ * `connection.waitForConfirmation(txId).transitions` directly.
111
+ */
112
+ export class TransitionSelectionError extends Error {
113
+ kind = "TransitionSelectionError";
114
+ programId;
115
+ transitionName;
116
+ matchCount;
117
+ availableTransitions;
118
+ txId;
119
+ constructor(message, context) {
120
+ super(message);
121
+ this.name = "TransitionSelectionError";
122
+ this.programId = context.programId;
123
+ this.transitionName = context.transitionName;
124
+ this.matchCount = context.matchCount;
125
+ this.availableTransitions = context.availableTransitions;
126
+ this.txId = context.txId;
127
+ }
128
+ }
129
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAwFA,MAAM,OAAO,+BAAgC,SAAQ,KAAK;IAC/C,IAAI,GAAG,iCAA0C,CAAC;IAClD,IAAI,CAAS;IACb,OAAO,CAAS;IAChB,KAAK,CAA2B;IAEzC,YAAY,OAAe,EAAE,OAA0C;QACrE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACnF,IAAI,CAAC,IAAI,GAAG,iCAAiC,CAAC;QAC9C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,OAA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O,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QACzD,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@lionden/network",
3
+ "version": "0.1.0",
4
+ "license": "Apache-2.0",
5
+ "type": "module",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/sealance-io/lionden.git",
9
+ "directory": "packages/network"
10
+ },
11
+ "engines": {
12
+ "node": "^20.19.0 || >=22.12.0"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "!dist/**/*.test.*"
23
+ ],
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "scripts": {
28
+ "build": "tsc --build"
29
+ },
30
+ "dependencies": {
31
+ "@lionden/config": "^0.1.0",
32
+ "@lionden/core": "^0.1.0",
33
+ "@provablehq/sdk": "^0.11.3"
34
+ }
35
+ }