@midnightntwrk/midnight-js-protocol 0.0.0-stage → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +291 -2
- package/dist/compact-js-v8-effect.d.ts +1 -0
- package/dist/compact-js-v8-effect.js +2 -0
- package/dist/compact-js-v8-effect.js.map +1 -0
- package/dist/engine.d.ts +420 -0
- package/dist/engine.js +832 -0
- package/dist/engine.js.map +1 -0
- package/dist/errors.d.ts +601 -0
- package/dist/errors.js +810 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +1471 -0
- package/dist/index.js +799 -0
- package/dist/index.js.map +1 -0
- package/dist/platform-effect-configuration.d.ts +1 -0
- package/dist/platform-effect-configuration.js +2 -0
- package/dist/platform-effect-configuration.js.map +1 -0
- package/dist/platform-effect-contract-address.d.ts +1 -0
- package/dist/platform-effect-contract-address.js +2 -0
- package/dist/platform-effect-contract-address.js.map +1 -0
- package/dist/platform.d.ts +1 -0
- package/dist/platform.js +2 -0
- package/dist/platform.js.map +1 -0
- package/dist/prove.d.ts +45 -0
- package/dist/prove.js +61 -0
- package/dist/prove.js.map +1 -0
- package/dist/shared/compose-options-BFA09u9q.js +468 -0
- package/dist/shared/compose-options-BFA09u9q.js.map +1 -0
- package/dist/shared/ledger-transaction-DQP8J8tv.js +134 -0
- package/dist/shared/ledger-transaction-DQP8J8tv.js.map +1 -0
- package/dist/shared/load-BMVWoBo6.js +49 -0
- package/dist/shared/load-BMVWoBo6.js.map +1 -0
- package/dist/shared/transaction-tags-I3J_Hh8r.js +82 -0
- package/dist/shared/transaction-tags-I3J_Hh8r.js.map +1 -0
- package/dist/transaction.d.ts +92 -0
- package/dist/transaction.js +6 -0
- package/dist/transaction.js.map +1 -0
- package/dist/v8.d.ts +1 -0
- package/dist/v8.js +3 -0
- package/dist/v8.js.map +1 -0
- package/dist/v9-compact-js-effect-contract.d.ts +1 -0
- package/dist/v9-compact-js-effect-contract.js +2 -0
- package/dist/v9-compact-js-effect-contract.js.map +1 -0
- package/dist/v9-compact-js-effect.d.ts +1 -0
- package/dist/v9-compact-js-effect.js +2 -0
- package/dist/v9-compact-js-effect.js.map +1 -0
- package/dist/v9-compact-js.d.ts +1 -0
- package/dist/v9-compact-js.js +2 -0
- package/dist/v9-compact-js.js.map +1 -0
- package/dist/v9-compact-runtime.d.ts +1 -0
- package/dist/v9-compact-runtime.js +2 -0
- package/dist/v9-compact-runtime.js.map +1 -0
- package/dist/v9-onchain-runtime.d.ts +1 -0
- package/dist/v9-onchain-runtime.js +2 -0
- package/dist/v9-onchain-runtime.js.map +1 -0
- package/dist/v9.d.ts +1 -0
- package/dist/v9.js +2 -0
- package/dist/v9.js.map +1 -0
- package/dist/version.d.ts +173 -0
- package/dist/version.js +125 -0
- package/dist/version.js.map +1 -0
- package/package.json +122 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sources":["../src/lib/v9/operations.ts","../src/lib/v9/wrap.ts","../src/lib/v8/executable.ts","../src/lib/v8/maintenance.ts","../src/lib/v8/engine.ts"],"sourcesContent":[null,null,null,null,null],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;AAaG;AAOH;;;;;;;;;;;;;AAaG;AACI,MAAM,6BAA6B,GAAG,CAAC,WAA8C,KAAgB;AAC1G,IAAA,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,aAAa,EAAE;IAC1C,IAAI,UAAU,GAAG,CAAC;AAElB,IAAA,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;;;;;AAKpC,QAAA,IAAI,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE;YACxC;QACF;AACA,QAAA,MAAM,SAAS,GAAG,IAAI,QAAQ,CAAC,iBAAiB,EAAE;AAClD,QAAA,SAAS,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW;QAC9C,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,EAAE,SAAS,CAAC;QAC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MAAM,CAAC,EAAE,KAAK;UAC3E,KAAK,CACV,EACD,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,UAAU,CAAC,EAAE,oBAAoB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAClH,CACF;AAED,IAAA,IAAI;AACF,QAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;AAC3F,QAAA,OAAO,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,SAAS,EAAE;IAC1F;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,MAAM,IAAI,kBAAkB,CAAC,IAAI,EAAE,oBAAoB,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC;IACpF;AACF,CAAC;;ACnND;;;;;;;;;;;;;AAaG;AAoHH;;;;;;;;;;;;;;;;;;;;;AAqBG;AACI,MAAM,mBAAmB,GAAG,YACjC,OAAO,CAAC,OAAO,CAAC;AACd,IAAA,cAAc,EAAE,iBAAiB;AACjC,IAAA,kBAAkB,EAAE,qBAAqB;AACzC,IAAA,oBAAoB,EAAE,2BAA2B;IACjD,iBAAiB;IACjB;AACD,CAAA;;"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two ledger runtimes midnight-js can talk to. `v8` backs the node 1.x
|
|
3
|
+
* line; `v9` backs the 2.x line. This is a closed, exhaustive set — see
|
|
4
|
+
* `protocolVersionToLedger` (`../version.ts`) for how a raw `protocolVersion`
|
|
5
|
+
* integer maps onto it.
|
|
6
|
+
*
|
|
7
|
+
* compact-js names the same era by number: its `Ledger.Era['ledger']` (for
|
|
8
|
+
* example `executable.era.ledger`) is `8` for `'v8'` and `9` for `'v9'`.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link SharedTableDiscipline} for why the array is frozen.
|
|
11
|
+
* @see {@link ModuleGraphAndLazyLoading} for why the constant is declared in
|
|
12
|
+
* this leaf module and re-exported by `../version.ts`.
|
|
13
|
+
*/
|
|
14
|
+
declare const LEDGER_ERAS: readonly ["v8", "v9"];
|
|
15
|
+
type LedgerEra = (typeof LEDGER_ERAS)[number];
|
|
16
|
+
|
|
17
|
+
/** Every transaction stage, in the order a transaction goes through them. */
|
|
18
|
+
declare const TRANSACTION_STAGES: readonly ["Unproven", "Unbound", "Finalized"];
|
|
19
|
+
/** The point in its life a transaction has reached: before proving, after proving, after binding. */
|
|
20
|
+
type TransactionStage = (typeof TRANSACTION_STAGES)[number];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Stable error-code strings for this package. Every error class in this module
|
|
24
|
+
* carries one of these on its `code` field, which is the field a consumer
|
|
25
|
+
* switches on to tell one failure from another.
|
|
26
|
+
*
|
|
27
|
+
* @see {@link SharedTableDiscipline}
|
|
28
|
+
*/
|
|
29
|
+
declare const PROTOCOL_ERROR_CODES: Readonly<{
|
|
30
|
+
readonly UNKNOWN_PROTOCOL_VERSION_READ: "MIDNIGHT_JS_P_UNKNOWN_PROTOCOL_VERSION_READ";
|
|
31
|
+
readonly UNKNOWN_PROTOCOL_VERSION_CONSTRUCT: "MIDNIGHT_JS_P_UNKNOWN_PROTOCOL_VERSION_CONSTRUCT";
|
|
32
|
+
readonly LEDGER8_RUNTIME_MISSING: "MIDNIGHT_JS_P_LEDGER8_RUNTIME_MISSING";
|
|
33
|
+
readonly STATE_CONVERSION_FAILED: "MIDNIGHT_JS_P_STATE_CONVERSION_FAILED";
|
|
34
|
+
readonly COMPOSE_FAILED: "MIDNIGHT_JS_P_COMPOSE_FAILED";
|
|
35
|
+
readonly COMPOSE_OPTION_INVALID: "MIDNIGHT_JS_P_COMPOSE_OPTION_INVALID";
|
|
36
|
+
readonly STATE_DECODE_FAILED: "MIDNIGHT_JS_P_STATE_DECODE_FAILED";
|
|
37
|
+
readonly STATE_INCONSISTENT: "MIDNIGHT_JS_P_STATE_INCONSISTENT";
|
|
38
|
+
readonly UNKNOWN_LEDGER_ERA: "MIDNIGHT_JS_P_UNKNOWN_LEDGER_ERA";
|
|
39
|
+
readonly LEDGER8_RUNTIME_INVALID: "MIDNIGHT_JS_P_LEDGER8_RUNTIME_INVALID";
|
|
40
|
+
readonly PAYLOAD_NOT_A_TRANSACTION: "MIDNIGHT_JS_P_PAYLOAD_NOT_A_TRANSACTION";
|
|
41
|
+
readonly CONTRACT_EXECUTION_FAILED: "MIDNIGHT_JS_P_CONTRACT_EXECUTION_FAILED";
|
|
42
|
+
readonly MAINTENANCE_AUTHORITY_MISMATCH: "MIDNIGHT_JS_P_MAINTENANCE_AUTHORITY_MISMATCH";
|
|
43
|
+
}>;
|
|
44
|
+
/** The union of every value in {@link PROTOCOL_ERROR_CODES}; the type of every error class's `code` field. */
|
|
45
|
+
type ProtocolErrorCode = (typeof PROTOCOL_ERROR_CODES)[keyof typeof PROTOCOL_ERROR_CODES];
|
|
46
|
+
declare const MIDNIGHT_JS_ERROR_CATEGORIES: Readonly<{
|
|
47
|
+
readonly USAGE: "USAGE";
|
|
48
|
+
readonly ENVIRONMENT: "ENVIRONMENT";
|
|
49
|
+
readonly TRANSIENT: "TRANSIENT";
|
|
50
|
+
readonly REJECTED: "REJECTED";
|
|
51
|
+
readonly UNCERTAIN: "UNCERTAIN";
|
|
52
|
+
readonly INTEGRITY: "INTEGRITY";
|
|
53
|
+
readonly INTERNAL: "INTERNAL";
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* What the caller should do about an error: fix its own code (`USAGE`), fix the installation or
|
|
57
|
+
* infrastructure (`ENVIRONMENT`), retry (`TRANSIENT`), handle a refusal by contract or network rules
|
|
58
|
+
* (`REJECTED`), check on chain whether a submitted transaction landed before doing anything else
|
|
59
|
+
* (`UNCERTAIN`), stop and alert on bad data (`INTEGRITY`), or report a midnight-js bug (`INTERNAL`).
|
|
60
|
+
*/
|
|
61
|
+
type MidnightJsErrorCategory = (typeof MIDNIGHT_JS_ERROR_CATEGORIES)[keyof typeof MIDNIGHT_JS_ERROR_CATEGORIES];
|
|
62
|
+
type MidnightJsErrorCodeFormat = `MIDNIGHT_JS_${string}`;
|
|
63
|
+
/**
|
|
64
|
+
* Base class of every error midnight-js raises itself. An error without a registered code came from a
|
|
65
|
+
* dependency, the platform or user code, and midnight-js passed it through unchanged. Recognise one with
|
|
66
|
+
* `hasErrorCode`, `isMidnightJsError` or `errorCategory` from the `midnight-js-utils` package: they read
|
|
67
|
+
* `code`, so they also work when two copies of a package are installed, where `instanceof` does not.
|
|
68
|
+
*/
|
|
69
|
+
declare abstract class MidnightJsError extends Error {
|
|
70
|
+
abstract readonly code: MidnightJsErrorCodeFormat;
|
|
71
|
+
abstract readonly category: MidnightJsErrorCategory;
|
|
72
|
+
}
|
|
73
|
+
declare const PROTOCOL_ERROR_CATEGORIES: Readonly<Record<ProtocolErrorCode, MidnightJsErrorCategory>>;
|
|
74
|
+
declare const COMMON_ERROR_CODES: Readonly<{
|
|
75
|
+
readonly INVALID_ARGUMENT: "MIDNIGHT_JS_G_INVALID_ARGUMENT";
|
|
76
|
+
readonly CONFIGURATION_MISSING: "MIDNIGHT_JS_G_CONFIGURATION_MISSING";
|
|
77
|
+
readonly ENVIRONMENT_UNSUPPORTED: "MIDNIGHT_JS_G_ENVIRONMENT_UNSUPPORTED";
|
|
78
|
+
readonly INVARIANT_VIOLATED: "MIDNIGHT_JS_G_INVARIANT_VIOLATED";
|
|
79
|
+
}>;
|
|
80
|
+
type CommonErrorCode = (typeof COMMON_ERROR_CODES)[keyof typeof COMMON_ERROR_CODES];
|
|
81
|
+
declare const COMMON_ERROR_CATEGORIES: Readonly<Record<CommonErrorCode, MidnightJsErrorCategory>>;
|
|
82
|
+
/** A value passed to a midnight-js function is not acceptable. Fix the call. */
|
|
83
|
+
declare class InvalidArgumentError extends MidnightJsError {
|
|
84
|
+
readonly code: "MIDNIGHT_JS_G_INVALID_ARGUMENT";
|
|
85
|
+
readonly category: MidnightJsErrorCategory;
|
|
86
|
+
constructor(message: string, options?: ErrorOptions);
|
|
87
|
+
}
|
|
88
|
+
/** Required setup is missing or was done in the wrong order. */
|
|
89
|
+
declare class ConfigurationError extends MidnightJsError {
|
|
90
|
+
readonly code: "MIDNIGHT_JS_G_CONFIGURATION_MISSING";
|
|
91
|
+
readonly category: MidnightJsErrorCategory;
|
|
92
|
+
constructor(message: string, options?: ErrorOptions);
|
|
93
|
+
}
|
|
94
|
+
/** The JavaScript runtime lacks an API midnight-js needs. */
|
|
95
|
+
declare class EnvironmentUnsupportedError extends MidnightJsError {
|
|
96
|
+
readonly code: "MIDNIGHT_JS_G_ENVIRONMENT_UNSUPPORTED";
|
|
97
|
+
readonly category: MidnightJsErrorCategory;
|
|
98
|
+
constructor(message: string, options?: ErrorOptions);
|
|
99
|
+
}
|
|
100
|
+
/** A condition midnight-js guarantees did not hold. This is a midnight-js bug; report it. */
|
|
101
|
+
declare class InvariantViolationError extends MidnightJsError {
|
|
102
|
+
readonly code: "MIDNIGHT_JS_G_INVARIANT_VIOLATED";
|
|
103
|
+
readonly category: MidnightJsErrorCategory;
|
|
104
|
+
constructor(message: string, options?: ErrorOptions);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Which call path asked for a ledger era:
|
|
108
|
+
* - `'read'` — the version was taken off an existing record.
|
|
109
|
+
* - `'construct'` — the version was chosen to build something new against the
|
|
110
|
+
* network's latest block.
|
|
111
|
+
*/
|
|
112
|
+
type VersionResolutionPath = 'read' | 'construct';
|
|
113
|
+
/**
|
|
114
|
+
* Why `protocolVersionToLedger` could not resolve a ledger era:
|
|
115
|
+
* - `'malformed'` — the input was not even a well-formed protocolVersion
|
|
116
|
+
* value (not a non-negative integer).
|
|
117
|
+
* - `'unknown'` — the input was a well-formed integer, but outside every
|
|
118
|
+
* range this framework version knows how to map.
|
|
119
|
+
*/
|
|
120
|
+
type ProtocolVersionUnknownReason = 'unknown' | 'malformed';
|
|
121
|
+
/**
|
|
122
|
+
* Thrown by `protocolVersionToLedger` (and, transitively, `versionOfRecord` /
|
|
123
|
+
* `latestNetworkLedgerVersion`) when a raw `protocolVersion` integer cannot be
|
|
124
|
+
* resolved to a `LedgerEra`. Those live in `./version`, which imports this
|
|
125
|
+
* module -- the dependency stays one-way, so they are named here rather than
|
|
126
|
+
* linked.
|
|
127
|
+
*
|
|
128
|
+
* `code` is the field to switch on to tell all four cases apart: it splits
|
|
129
|
+
* `reason` by the `path` that produced it.
|
|
130
|
+
*
|
|
131
|
+
* @param protocolVersion The raw `protocolVersion` value that could not be
|
|
132
|
+
* resolved. Carried for programmatic use, and rendered in the message.
|
|
133
|
+
* @param path Which call path asked for the version — see
|
|
134
|
+
* {@link VersionResolutionPath}.
|
|
135
|
+
* @param reason A malformed input (wrong shape or type, not a
|
|
136
|
+
* protocol-version problem at all) or a well-formed but genuinely unknown
|
|
137
|
+
* version (a real protocol version this framework build does not support
|
|
138
|
+
* yet) — see {@link ProtocolVersionUnknownReason}.
|
|
139
|
+
*/
|
|
140
|
+
declare class UnknownProtocolVersionError extends MidnightJsError {
|
|
141
|
+
readonly protocolVersion: number;
|
|
142
|
+
readonly path: VersionResolutionPath;
|
|
143
|
+
readonly reason: ProtocolVersionUnknownReason;
|
|
144
|
+
readonly code: typeof PROTOCOL_ERROR_CODES.UNKNOWN_PROTOCOL_VERSION_READ | typeof PROTOCOL_ERROR_CODES.UNKNOWN_PROTOCOL_VERSION_CONSTRUCT;
|
|
145
|
+
readonly category: MidnightJsErrorCategory;
|
|
146
|
+
constructor(protocolVersion: number, path: VersionResolutionPath, reason: ProtocolVersionUnknownReason);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Which lazily-loaded subpath export {@link Ledger8RuntimeMissingError} failed
|
|
150
|
+
* to acquire. Each chunk pulls a different set of ledger 8 dependencies, so
|
|
151
|
+
* naming the wrong one sends an operator to an entry point that loaded fine.
|
|
152
|
+
*
|
|
153
|
+
* @see {@link ModuleGraphAndLazyLoading}
|
|
154
|
+
*/
|
|
155
|
+
type Ledger8Subpath = '/v8' | '/v8/engine';
|
|
156
|
+
/**
|
|
157
|
+
* Thrown when a lazily-loaded subpath export carrying the retained pre-fork
|
|
158
|
+
* runtime could not be acquired at all. Raised by `loadLedger8Protocol`
|
|
159
|
+
* (`lib/v8/load.ts`) and `loadLedger8Engine` (`lib/v8/load-engine.ts`), and
|
|
160
|
+
* surfaced through `createLedger8Engine` and `loadLedgerEra('v8')`.
|
|
161
|
+
*
|
|
162
|
+
* A failed acquisition is not memoised: the next call retries the import.
|
|
163
|
+
* Distinct from {@link Ledger8RuntimeInvalidError}, which reports a runtime
|
|
164
|
+
* that WAS acquired and then handed over incomplete.
|
|
165
|
+
*
|
|
166
|
+
* @param subpath Which chunk failed to load — see {@link Ledger8Subpath}.
|
|
167
|
+
* @param cause The underlying module-resolution or initialisation failure,
|
|
168
|
+
* preserved unchanged. Read it for which module actually failed.
|
|
169
|
+
* @see {@link ModuleGraphAndLazyLoading}
|
|
170
|
+
* @see {@link EraBoundary}
|
|
171
|
+
*/
|
|
172
|
+
declare class Ledger8RuntimeMissingError extends MidnightJsError {
|
|
173
|
+
readonly subpath: Ledger8Subpath;
|
|
174
|
+
readonly code: "MIDNIGHT_JS_P_LEDGER8_RUNTIME_MISSING";
|
|
175
|
+
readonly category: MidnightJsErrorCategory;
|
|
176
|
+
constructor(subpath: Ledger8Subpath, cause: unknown);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Which step a {@link StateConversionFailedError} came from. A closed union,
|
|
180
|
+
* so a consumer can `switch` on `stage` exhaustively.
|
|
181
|
+
*
|
|
182
|
+
* `'state conversion'` is the structural round trip `lib/v8/executable.ts`
|
|
183
|
+
* runs before a circuit executes; the other two decode a serialized contract state
|
|
184
|
+
* written by that ledger era, in `lib/era/envelope.ts`.
|
|
185
|
+
*
|
|
186
|
+
* @see {@link FailClosedDecoding}
|
|
187
|
+
*/
|
|
188
|
+
type StateConversionStage = 'v8 state read' | 'v9 state read' | 'state conversion';
|
|
189
|
+
/**
|
|
190
|
+
* Thrown when a serialized contract state, or an already-extracted
|
|
191
|
+
* `EncodedStateValue`, cannot be turned into a state a circuit can execute
|
|
192
|
+
* against. Raised by `extractLedger9EncodedStateValue` (`lib/era/envelope.ts`)
|
|
193
|
+
* and by `decodeExecutableStateValue` (`lib/v8/executable.ts`), which refuses a
|
|
194
|
+
* state that decodes but does not re-encode to the bytes it came from.
|
|
195
|
+
*
|
|
196
|
+
* Renders no raw hex and no decoded state contents — only the stage name and
|
|
197
|
+
* the wrapped `cause`.
|
|
198
|
+
*
|
|
199
|
+
* @param stage Which step failed — see {@link StateConversionStage}.
|
|
200
|
+
* @param cause The runtime's own failure, preserved unchanged. It is what
|
|
201
|
+
* distinguishes a tag mismatch from truncated, trailing, or empty input.
|
|
202
|
+
* @see {@link FailClosedDecoding}
|
|
203
|
+
*/
|
|
204
|
+
declare class StateConversionFailedError extends MidnightJsError {
|
|
205
|
+
readonly stage: StateConversionStage;
|
|
206
|
+
readonly code: "MIDNIGHT_JS_P_STATE_CONVERSION_FAILED";
|
|
207
|
+
readonly category: MidnightJsErrorCategory;
|
|
208
|
+
constructor(stage: StateConversionStage, cause: unknown);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* What `circuitId` a {@link ComposeFailedError} names when the failure happened
|
|
212
|
+
* before any circuit was looked up — only `'call-empty'` reaches this today.
|
|
213
|
+
*
|
|
214
|
+
* Exported, and one literal rather than a per-module copy, so a consumer
|
|
215
|
+
* reading `circuitId` off a caught error can compare against it instead of
|
|
216
|
+
* matching a string this package could change, and so it can never be mistaken
|
|
217
|
+
* for a real entry point a caller might try to resolve.
|
|
218
|
+
*
|
|
219
|
+
* @see {@link ComposeRefusalOrder}
|
|
220
|
+
*/
|
|
221
|
+
declare const NO_CIRCUIT = "(none)";
|
|
222
|
+
/**
|
|
223
|
+
* Which composition step {@link ComposeFailedError} failed at.
|
|
224
|
+
*
|
|
225
|
+
* Call stages:
|
|
226
|
+
* - `'call-empty'` — a call transaction was requested with no calls in it.
|
|
227
|
+
* The one stage that names no circuit: it is raised before any circuit is
|
|
228
|
+
* looked up, so it names {@link NO_CIRCUIT}.
|
|
229
|
+
* - `'call-operation'` — a call leg could not resolve a registered operation
|
|
230
|
+
* for the call's circuit on the given contract state.
|
|
231
|
+
* - `'call-verifier-key'` — a call leg resolved a registered operation for the
|
|
232
|
+
* call's circuit, but that operation carries no verifier key, so no ledger
|
|
233
|
+
* could verify a call against it.
|
|
234
|
+
* - `'call-contract-state'` — the call's pre-call state could not be bridged
|
|
235
|
+
* into the target era's own state algebra. Carries the decoder's failure on
|
|
236
|
+
* `cause`.
|
|
237
|
+
* - `'call-transcript-empty'` — a caller-supplied partitioned transcript
|
|
238
|
+
* carried neither a guaranteed nor a fallible half, so the call would record
|
|
239
|
+
* no operations at all.
|
|
240
|
+
* - `'call-partition-context'` — the era rejected the query-context state the
|
|
241
|
+
* call recorded (its block, its starting effects, or one of the commitment
|
|
242
|
+
* indices it registered for a coin received in-contract) while bridging it
|
|
243
|
+
* onto the context the transcript is partitioned against. Carries the
|
|
244
|
+
* runtime's own failure on `cause`.
|
|
245
|
+
* - `'call-partition'` — the ledger rejected the public transcript supplied
|
|
246
|
+
* for a call while splitting it into its guaranteed and fallible halves.
|
|
247
|
+
* Carries the runtime's own failure on `cause`.
|
|
248
|
+
* - `'call-prototype'` — the ledger rejected the call's own inputs while
|
|
249
|
+
* constructing the call prototype. Carries the runtime's failure on `cause`.
|
|
250
|
+
* - `'call-dust-payout'` — a transcript claimed an unshielded spend to a user
|
|
251
|
+
* address in DUST, which has no raw token type to be paid out in.
|
|
252
|
+
* - `'call-unsupported-payout'` — a transcript claimed an unshielded spend to
|
|
253
|
+
* a user address in a token type that cannot be paid out as an unshielded
|
|
254
|
+
* UTXO at all (a shielded token type today).
|
|
255
|
+
*
|
|
256
|
+
* Deploy stages:
|
|
257
|
+
* - `'deploy-verifier-key'` — a deploy leg was given no verifier key for a
|
|
258
|
+
* circuit the contract state declares.
|
|
259
|
+
* - `'deploy-unknown-circuit'` — the verifier-key map handed to a deploy leg
|
|
260
|
+
* names a circuit the contract state does not declare. Registering it would
|
|
261
|
+
* add an entry point the compiled contract never had, and silently change
|
|
262
|
+
* the deployed contract's address.
|
|
263
|
+
* - `'deploy-ambiguous-circuit'` — two entry points the contract state
|
|
264
|
+
* declares resolve to the same name, so the verifier-key map (keyed by
|
|
265
|
+
* name) cannot address them apart. Registering under the shared name would
|
|
266
|
+
* key one slot and leave the other blank.
|
|
267
|
+
* - `'deploy-verifier-key-blob'` — the ledger rejected the verifier-key bytes
|
|
268
|
+
* supplied for a circuit.
|
|
269
|
+
*
|
|
270
|
+
* Maintenance stage:
|
|
271
|
+
* - `'maintenance-update'` — the maintenance update could not be built,
|
|
272
|
+
* signed, or wrapped into a transaction: platform-js refused the contract
|
|
273
|
+
* address, compact-js refused one of its own steps (building the update,
|
|
274
|
+
* creating it with the address and counter, reading the data to sign,
|
|
275
|
+
* signing, attaching the signature), or the ledger refused the signed update
|
|
276
|
+
* when it was wrapped into the transaction. Names the circuit for a
|
|
277
|
+
* verifier-key update and {@link NO_CIRCUIT} for an authority replacement.
|
|
278
|
+
* Carries the refusing library's own failure on `cause`.
|
|
279
|
+
*
|
|
280
|
+
* Keep-state stage:
|
|
281
|
+
* - `'wrap-call'` — the keep-state leg could not resolve a registered
|
|
282
|
+
* operation for the transcript's circuit on the given contract state.
|
|
283
|
+
*
|
|
284
|
+
* Which ledger era the failure happened on is carried separately, on the
|
|
285
|
+
* error's `version` field. Every stage but `'wrap-call'` and
|
|
286
|
+
* `'maintenance-update'` is reachable on both eras; `'wrap-call'` is only ever
|
|
287
|
+
* raised for `'v9'`, and `'maintenance-update'` only for `'v8'`.
|
|
288
|
+
*
|
|
289
|
+
* @see {@link ComposeRefusalOrder}
|
|
290
|
+
* @see {@link VerifierKeys}
|
|
291
|
+
*/
|
|
292
|
+
type ComposeStage = 'wrap-call' | 'call-empty' | 'call-transcript-empty' | 'call-partition-context' | 'call-partition' | 'call-prototype' | 'call-dust-payout' | 'call-unsupported-payout' | 'call-operation' | 'call-contract-state' | 'call-verifier-key' | 'deploy-verifier-key' | 'deploy-unknown-circuit' | 'deploy-ambiguous-circuit' | 'deploy-verifier-key-blob' | 'maintenance-update';
|
|
293
|
+
/**
|
|
294
|
+
* Thrown when a transaction cannot be composed because a circuit's operation
|
|
295
|
+
* is missing, under-registered, or names a circuit the contract does not have.
|
|
296
|
+
* `stage` (see {@link ComposeStage}) names which composition step failed and is
|
|
297
|
+
* a closed union, so a consumer can `switch` on it exhaustively; `version`
|
|
298
|
+
* names the ledger era the composition was running against.
|
|
299
|
+
*
|
|
300
|
+
* Most stages carry no `cause`. The exceptions are the stages where a runtime
|
|
301
|
+
* library rejected what it was handed, enumerated under `cause` below.
|
|
302
|
+
*
|
|
303
|
+
* `circuitId` names the entry point, never its raw contents: this class renders
|
|
304
|
+
* no hex and no byte-array dump.
|
|
305
|
+
*
|
|
306
|
+
* @param version The ledger era the composition was running against.
|
|
307
|
+
* @param stage Which composition step failed — see {@link ComposeStage}. A
|
|
308
|
+
* closed union, so a consumer can `switch` on it exhaustively.
|
|
309
|
+
* @param circuitId The entry-point name, already decoded. {@link NO_CIRCUIT}
|
|
310
|
+
* for `'call-empty'`, the one stage raised before any circuit is looked up.
|
|
311
|
+
* @param cause The runtime's own failure, present only for the stages where
|
|
312
|
+
* the ledger rejected caller-supplied bytes — `'call-contract-state'`,
|
|
313
|
+
* `'call-partition-context'`, `'call-partition'`, `'call-prototype'`,
|
|
314
|
+
* `'deploy-verifier-key-blob'` — and for `'maintenance-update'`, where it is
|
|
315
|
+
* the failure of platform-js, compact-js or the ledger, whichever refused.
|
|
316
|
+
* @see {@link ComposeRefusalOrder}
|
|
317
|
+
* @see {@link VerifierKeys}
|
|
318
|
+
*/
|
|
319
|
+
declare class ComposeFailedError extends MidnightJsError {
|
|
320
|
+
readonly version: LedgerEra;
|
|
321
|
+
readonly stage: ComposeStage;
|
|
322
|
+
readonly circuitId: string;
|
|
323
|
+
readonly code: "MIDNIGHT_JS_P_COMPOSE_FAILED";
|
|
324
|
+
readonly category: MidnightJsErrorCategory;
|
|
325
|
+
constructor(version: LedgerEra, stage: ComposeStage, circuitId: string, cause?: unknown);
|
|
326
|
+
private static readonly MESSAGES;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Which option handed to a composition leg was unusable:
|
|
330
|
+
* - `'contractStateBytes'` — the state could not be bridged into the target
|
|
331
|
+
* ledger era (the era's decoder rejected its bytes).
|
|
332
|
+
* - `'guaranteedZswapOfferBytes'` — the offer bytes supplied to a deploy were
|
|
333
|
+
* rejected by the target era's decoder.
|
|
334
|
+
* - `'ledgerParametersBytes'` — the supplied ledger parameters could not be
|
|
335
|
+
* read by the target era.
|
|
336
|
+
* - `'networkId'` — the network id was empty. The ledger accepts an empty
|
|
337
|
+
* string and bakes it into the transaction, so a caller that forgot to
|
|
338
|
+
* resolve one would only find out at submission.
|
|
339
|
+
* - `'ttl'` — the time-to-live was not a valid instant. `new Date('...')` on
|
|
340
|
+
* an unparseable value yields an Invalid Date, which the ledger silently
|
|
341
|
+
* records as the Unix epoch: a transaction that is already expired when it
|
|
342
|
+
* is composed.
|
|
343
|
+
* - `'calls'` — the call list is not one the target era can compose. The
|
|
344
|
+
* retained pre-fork era composes exactly one call: a cross-contract call is a
|
|
345
|
+
* ledger-9-only feature that a pre-fork contract cannot emit, so that era has
|
|
346
|
+
* no call tree to express.
|
|
347
|
+
* - `'verifierKeys'` — a deploy was requested with no verifier-key map, and the
|
|
348
|
+
* state it was given needs one. Raised on BOTH eras, for two different
|
|
349
|
+
* reasons: the retained era's deploy leg has to register the compiled
|
|
350
|
+
* contract's keys itself and so always needs the map, while the current era
|
|
351
|
+
* accepts its omission for a state that already carries its keys and refuses
|
|
352
|
+
* it only for a state still declaring a blank-keyed entry point.
|
|
353
|
+
* - `'signingKey'` — a signing key is not the 32 bytes of hex the era's runtime
|
|
354
|
+
* reads: the key a constructor builds the maintenance authority from, or the
|
|
355
|
+
* key a maintenance update is signed with.
|
|
356
|
+
* - `'newSigningKey'` — the key a maintenance update would make the new
|
|
357
|
+
* authority is not the 32 bytes of hex the era's runtime reads.
|
|
358
|
+
* - `'zswapOffer'` — the offer bytes a call's offer factory returned were
|
|
359
|
+
* rejected by the target era's decoder. Raised on BOTH eras, for the same reason and with the same
|
|
360
|
+
* remediation: pass the bytes that era's own offer serialization produced.
|
|
361
|
+
*
|
|
362
|
+
* @see {@link ComposeRefusalOrder}
|
|
363
|
+
* @see {@link VerifierKeys}
|
|
364
|
+
*/
|
|
365
|
+
type ComposeOption = 'calls' | 'contractStateBytes' | 'guaranteedZswapOfferBytes' | 'ledgerParametersBytes' | 'networkId' | 'newSigningKey' | 'signingKey' | 'ttl' | 'verifierKeys' | 'zswapOffer';
|
|
366
|
+
/**
|
|
367
|
+
* Thrown by the composition legs when one of their options cannot be used at
|
|
368
|
+
* all, as opposed to {@link ComposeFailedError}, which reports a circuit whose
|
|
369
|
+
* operation is missing or under-registered.
|
|
370
|
+
*
|
|
371
|
+
* These are the well-formedness checks the ledger itself does not make.
|
|
372
|
+
*
|
|
373
|
+
* Like {@link StateConversionFailedError}, this class renders no input contents of
|
|
374
|
+
* its own.
|
|
375
|
+
*
|
|
376
|
+
* @param version The ledger era the option was being used against.
|
|
377
|
+
* @param option Which option was unusable — see {@link ComposeOption}. A
|
|
378
|
+
* closed union, so a consumer can `switch` on it exhaustively.
|
|
379
|
+
* @param cause The decoder's own failure, present where caller-supplied bytes
|
|
380
|
+
* were rejected.
|
|
381
|
+
* @see {@link ComposeRefusalOrder}
|
|
382
|
+
* @see {@link VerifierKeys}
|
|
383
|
+
*/
|
|
384
|
+
declare class ComposeOptionError extends MidnightJsError {
|
|
385
|
+
readonly version: LedgerEra;
|
|
386
|
+
readonly option: ComposeOption;
|
|
387
|
+
readonly code: "MIDNIGHT_JS_P_COMPOSE_OPTION_INVALID";
|
|
388
|
+
readonly category: MidnightJsErrorCategory;
|
|
389
|
+
constructor(version: LedgerEra, option: ComposeOption, cause?: unknown);
|
|
390
|
+
private static readonly MESSAGES;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Why a maintenance update cannot be signed by the key held for a contract:
|
|
394
|
+
* - `'not-first-member'` — the key's verifying key is not the first member of
|
|
395
|
+
* the contract's maintenance authority committee, the member every update is
|
|
396
|
+
* signed for.
|
|
397
|
+
* - `'empty-committee'` — the authority has no committee, so no key can sign
|
|
398
|
+
* for it.
|
|
399
|
+
* - `'threshold-above-one'` — the authority needs more signatures than the one
|
|
400
|
+
* every update carries.
|
|
401
|
+
*/
|
|
402
|
+
type MaintenanceAuthorityMismatchReason = 'not-first-member' | 'empty-committee' | 'threshold-above-one';
|
|
403
|
+
/**
|
|
404
|
+
* Thrown when a maintenance update cannot be signed so that the ledger accepts
|
|
405
|
+
* it with the key held for the contract — see
|
|
406
|
+
* {@link MaintenanceAuthorityMismatchReason} for the three ways.
|
|
407
|
+
*
|
|
408
|
+
* Raised BEFORE anything is signed or proven: the ledger would accept the
|
|
409
|
+
* signature into the transaction and refuse the update only at submission,
|
|
410
|
+
* after a proof has been paid for.
|
|
411
|
+
*
|
|
412
|
+
* Renders the contract address and no key material: neither the signing key
|
|
413
|
+
* nor any verifying key appears in the message.
|
|
414
|
+
*
|
|
415
|
+
* @param version The ledger era the update was being composed on.
|
|
416
|
+
* @param contractAddress The contract whose authority was checked.
|
|
417
|
+
* @param reason Which check refused it.
|
|
418
|
+
* @see {@link RetainedEraExecution}
|
|
419
|
+
*/
|
|
420
|
+
declare class MaintenanceAuthorityMismatchError extends MidnightJsError {
|
|
421
|
+
readonly version: LedgerEra;
|
|
422
|
+
readonly contractAddress: string;
|
|
423
|
+
readonly reason: MaintenanceAuthorityMismatchReason;
|
|
424
|
+
readonly code: "MIDNIGHT_JS_P_MAINTENANCE_AUTHORITY_MISMATCH";
|
|
425
|
+
readonly category: MidnightJsErrorCategory;
|
|
426
|
+
constructor(version: LedgerEra, contractAddress: string, reason: MaintenanceAuthorityMismatchReason);
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Thrown when a raw, serialized contract state could not be read by
|
|
430
|
+
* the ledger era it was requested for. Raised by both of the facade's read
|
|
431
|
+
* paths, `extractState` and `decodeContractState`
|
|
432
|
+
* (`lib/shared/contract-state.ts`), so a caller writes one handler for both.
|
|
433
|
+
*
|
|
434
|
+
* Renders no hex and no byte dump of its own.
|
|
435
|
+
*
|
|
436
|
+
* @param version The era whose decoder rejected the bytes.
|
|
437
|
+
* @param cause The decoder's own diagnosis, preserved unchanged. It is what
|
|
438
|
+
* distinguishes a tag mismatch from truncated, trailing or empty input.
|
|
439
|
+
* @see {@link FailClosedDecoding}
|
|
440
|
+
*/
|
|
441
|
+
declare class StateDecodeFailedError extends MidnightJsError {
|
|
442
|
+
readonly version: LedgerEra;
|
|
443
|
+
readonly code: "MIDNIGHT_JS_P_STATE_DECODE_FAILED";
|
|
444
|
+
readonly category: MidnightJsErrorCategory;
|
|
445
|
+
constructor(version: LedgerEra, cause: unknown);
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Thrown by `decodeContractState` (`lib/shared/contract-state.ts`) when the
|
|
449
|
+
* era's decoder read the bytes but the state it produced is internally
|
|
450
|
+
* inconsistent: it declares an entry point it resolves no operation for, holds
|
|
451
|
+
* a verifier key that will not hash, or resolves no usable balance.
|
|
452
|
+
*
|
|
453
|
+
* Distinct from {@link StateDecodeFailedError}: the bytes were readable by the
|
|
454
|
+
* requested era, so decoding them as the other era cannot help. A caller that
|
|
455
|
+
* retries on `STATE_DECODE_FAILED` must not retry on this one.
|
|
456
|
+
*
|
|
457
|
+
* Renders no hex and no decoded state contents of its own.
|
|
458
|
+
*
|
|
459
|
+
* @param version The era whose decoder produced the state.
|
|
460
|
+
* @param cause The diagnosis of what was inconsistent, preserved unchanged.
|
|
461
|
+
* @see {@link FailClosedDecoding}
|
|
462
|
+
*/
|
|
463
|
+
declare class StateInconsistentError extends MidnightJsError {
|
|
464
|
+
readonly version: LedgerEra;
|
|
465
|
+
readonly code: "MIDNIGHT_JS_P_STATE_INCONSISTENT";
|
|
466
|
+
readonly category: MidnightJsErrorCategory;
|
|
467
|
+
constructor(version: LedgerEra, cause: unknown);
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Thrown by `extractEncodedStateValue` (`lib/era/envelope.ts`) when the
|
|
471
|
+
* injected pre-fork runtime cannot be used — it was not passed at all, or the
|
|
472
|
+
* binding the decoder needs is absent from it.
|
|
473
|
+
*
|
|
474
|
+
* `downConvertForExecution` and the shared-instance guard used to raise it too;
|
|
475
|
+
* both are gone with the hand-maintained execution layer, so the contract-state
|
|
476
|
+
* decoder is now its only source.
|
|
477
|
+
*
|
|
478
|
+
* Nothing is wrong with the caller's input here. Distinct from
|
|
479
|
+
* {@link Ledger8RuntimeMissingError}, which reports the v8 chunk failing to
|
|
480
|
+
* load at all, and from {@link StateConversionFailedError}, which reports a
|
|
481
|
+
* serialized state that could not be turned into an executable pre-fork
|
|
482
|
+
* state.
|
|
483
|
+
*
|
|
484
|
+
* @param missingMember Which binding was absent. One of this module's own
|
|
485
|
+
* literals, never caller-supplied text, so it is safe to log.
|
|
486
|
+
* @see {@link FailClosedDecoding}
|
|
487
|
+
* @see {@link DualInstantiationGuard}
|
|
488
|
+
*/
|
|
489
|
+
declare class Ledger8RuntimeInvalidError extends MidnightJsError {
|
|
490
|
+
readonly missingMember: string;
|
|
491
|
+
readonly code: "MIDNIGHT_JS_P_LEDGER8_RUNTIME_INVALID";
|
|
492
|
+
readonly category: MidnightJsErrorCategory;
|
|
493
|
+
constructor(missingMember: string);
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Thrown when a ledger era was requested by a value that is not a member of
|
|
497
|
+
* `LEDGER_ERAS`. Raised by `loadLedgerEra` (`lib/era/load-era.ts`) and by
|
|
498
|
+
* `extractEncodedStateValue` (`lib/era/envelope.ts`).
|
|
499
|
+
*
|
|
500
|
+
* Two sources: an untyped JavaScript caller passing a value that is not a
|
|
501
|
+
* `LedgerEra`, and a provider returning a value with no era or an unknown
|
|
502
|
+
* one. The second is named by `context`.
|
|
503
|
+
*
|
|
504
|
+
* Carries no `version` field, unlike every other era-aware error here — there
|
|
505
|
+
* is no valid era to name.
|
|
506
|
+
*
|
|
507
|
+
* @param requestedVersion The offending value. Kept as `undefined` when the
|
|
508
|
+
* value carried no era, as the kind (`'object'`, `'function'`) for a value
|
|
509
|
+
* that is not a scalar, and as its string form otherwise. Carried for
|
|
510
|
+
* programmatic use only; it is deliberately kept out of the message.
|
|
511
|
+
* @param context The call that read the era off a value it was handed,
|
|
512
|
+
* for example the provider method that returned a record. Named in the
|
|
513
|
+
* message, so a caller can tell which provider produced the value.
|
|
514
|
+
* @see {@link SharedTableDiscipline}
|
|
515
|
+
* @see {@link FailClosedDecoding}
|
|
516
|
+
*/
|
|
517
|
+
declare class UnknownLedgerEraError extends MidnightJsError {
|
|
518
|
+
readonly context?: string | undefined;
|
|
519
|
+
readonly code: "MIDNIGHT_JS_P_UNKNOWN_LEDGER_ERA";
|
|
520
|
+
readonly category: MidnightJsErrorCategory;
|
|
521
|
+
readonly requestedVersion: string | undefined;
|
|
522
|
+
constructor(requestedVersion: unknown, context?: string | undefined);
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* The opening of the tag every serialized ledger transaction carries, on both
|
|
526
|
+
* eras.
|
|
527
|
+
*
|
|
528
|
+
* Stops before the bracketed version deliberately: a `[vN]` is the wire-schema
|
|
529
|
+
* version of the serialized OBJECT and never a ledger era — the retained era's
|
|
530
|
+
* transactions are tagged `transaction[v9]`.
|
|
531
|
+
*
|
|
532
|
+
* @see packages/contracts/docs/verification-path.md for the same rule stated
|
|
533
|
+
* about verifier-key tags.
|
|
534
|
+
*/
|
|
535
|
+
declare const TRANSACTION_TAG_PREFIX = "midnight:transaction[";
|
|
536
|
+
/**
|
|
537
|
+
* Thrown when a payload handed to `deserializeTransactionAtStage` is not a
|
|
538
|
+
* serialized transaction of the requested era and stage.
|
|
539
|
+
*
|
|
540
|
+
* It covers four ways that can happen: a value that is not a byte string, a
|
|
541
|
+
* byte string shorter than the tag prefix, one that does not open with the
|
|
542
|
+
* prefix, and one the era's runtime refuses to read at the requested stage.
|
|
543
|
+
* The first three are refused before any runtime reads the bytes. The last
|
|
544
|
+
* carries the runtime's refusal on `cause`.
|
|
545
|
+
*
|
|
546
|
+
* @remarks Match it with `hasErrorCode` against
|
|
547
|
+
* `PROTOCOL_ERROR_CODES.PAYLOAD_NOT_A_TRANSACTION` rather than constructing it.
|
|
548
|
+
*/
|
|
549
|
+
declare class PayloadNotATransactionError extends MidnightJsError {
|
|
550
|
+
readonly code: "MIDNIGHT_JS_P_PAYLOAD_NOT_A_TRANSACTION";
|
|
551
|
+
readonly category: MidnightJsErrorCategory;
|
|
552
|
+
private constructor();
|
|
553
|
+
/**
|
|
554
|
+
* The payload was not a `Uint8Array`. Reachable from JavaScript or across an
|
|
555
|
+
* untyped boundary, so it is refused with a code rather than left to become
|
|
556
|
+
* a bare `TypeError`.
|
|
557
|
+
*/
|
|
558
|
+
static notBytes(received: unknown): PayloadNotATransactionError;
|
|
559
|
+
/** The payload is a byte string, but does not open with a transaction's tag. */
|
|
560
|
+
static wrongTag(byteLength: number): PayloadNotATransactionError;
|
|
561
|
+
/** The era's runtime refused to read the payload at the requested stage; its refusal is on `cause`. */
|
|
562
|
+
static undecodable(version: LedgerEra, stage: TransactionStage, byteLength: number, cause: unknown): PayloadNotATransactionError;
|
|
563
|
+
}
|
|
564
|
+
/** A midnight-js error recognised by its fields, which also matches one built by another installed copy. */
|
|
565
|
+
type CodedMidnightJsError = Error & {
|
|
566
|
+
readonly code: MidnightJsErrorCodeFormat;
|
|
567
|
+
readonly category: MidnightJsErrorCategory;
|
|
568
|
+
};
|
|
569
|
+
/**
|
|
570
|
+
* The midnight-js error a failure is or carries: the failure itself when it is one, otherwise the first
|
|
571
|
+
* one on its `cause` chain, at most eight links down. Use it when a dependency wraps a midnight-js error
|
|
572
|
+
* and hides its `code` and `category`.
|
|
573
|
+
*/
|
|
574
|
+
declare const findCodedCause: (failure: unknown) => CodedMidnightJsError | undefined;
|
|
575
|
+
/**
|
|
576
|
+
* What a retained-era circuit or constructor execution fails with. A Compact `assert` refusal is the usual
|
|
577
|
+
* cause, but a key or config read failure or a runtime fault can also arrive this way, so `cause` is the
|
|
578
|
+
* source of truth. A failure that is, or carries on its `cause` chain, a midnight-js coded error is not
|
|
579
|
+
* wrapped in this class: that coded error surfaces directly.
|
|
580
|
+
*/
|
|
581
|
+
declare class ContractExecutionError extends MidnightJsError {
|
|
582
|
+
readonly code: "MIDNIGHT_JS_P_CONTRACT_EXECUTION_FAILED";
|
|
583
|
+
readonly category: MidnightJsErrorCategory;
|
|
584
|
+
/**
|
|
585
|
+
* Every failure the execution reported, as the original objects, in the order they arrived. Filled by
|
|
586
|
+
* {@link ContractExecutionError.fromFailures}; empty when the error was built without a list.
|
|
587
|
+
*/
|
|
588
|
+
readonly errors: readonly unknown[];
|
|
589
|
+
constructor(message: string, options?: ErrorOptions & {
|
|
590
|
+
readonly errors?: readonly unknown[];
|
|
591
|
+
});
|
|
592
|
+
/**
|
|
593
|
+
* Reports every failure of an execution, each with its whole cause chain, separated by `; `.
|
|
594
|
+
* `cause` is the first coded error found on any failure's chain, or the first failure when none is coded.
|
|
595
|
+
* `errors` holds every failure as the original object, so no stack is lost.
|
|
596
|
+
*/
|
|
597
|
+
static fromFailures(failures: readonly unknown[]): ContractExecutionError;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
export { COMMON_ERROR_CATEGORIES, COMMON_ERROR_CODES, ComposeFailedError, ComposeOptionError, ConfigurationError, ContractExecutionError, EnvironmentUnsupportedError, InvalidArgumentError, InvariantViolationError, Ledger8RuntimeInvalidError, Ledger8RuntimeMissingError, MIDNIGHT_JS_ERROR_CATEGORIES, MaintenanceAuthorityMismatchError, MidnightJsError, NO_CIRCUIT, PROTOCOL_ERROR_CATEGORIES, PROTOCOL_ERROR_CODES, PayloadNotATransactionError, StateConversionFailedError, StateDecodeFailedError, StateInconsistentError, TRANSACTION_TAG_PREFIX, UnknownLedgerEraError, UnknownProtocolVersionError, findCodedCause };
|
|
601
|
+
export type { CodedMidnightJsError, CommonErrorCode, ComposeOption, ComposeStage, Ledger8Subpath, MaintenanceAuthorityMismatchReason, MidnightJsErrorCategory, MidnightJsErrorCodeFormat, ProtocolErrorCode, ProtocolVersionUnknownReason, StateConversionStage, VersionResolutionPath };
|