@unconfirmed/sui-effect 0.1.1 → 0.1.3
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/AGENTS.md +34 -11
- package/CHANGELOG.md +77 -0
- package/LLMS.md +630 -704
- package/README.md +175 -9
- package/dist/domain/bcs.d.ts.map +1 -1
- package/dist/domain/bcs.js +25 -9
- package/dist/domain/bcs.js.map +1 -1
- package/dist/domain/errors.d.ts +178 -40
- package/dist/domain/errors.d.ts.map +1 -1
- package/dist/domain/errors.js +271 -37
- package/dist/domain/errors.js.map +1 -1
- package/dist/domain/executed.d.ts +71 -2
- package/dist/domain/executed.d.ts.map +1 -1
- package/dist/domain/executed.js +210 -9
- package/dist/domain/executed.js.map +1 -1
- package/dist/domain/journal-entry.d.ts +37 -37
- package/dist/domain/journal-entry.js +1 -1
- package/dist/domain/schemas.d.ts +172 -65
- package/dist/domain/schemas.d.ts.map +1 -1
- package/dist/domain/schemas.js +131 -32
- package/dist/domain/schemas.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/script.d.ts +1 -1
- package/dist/script.d.ts.map +1 -1
- package/dist/script.js +1 -1
- package/dist/script.js.map +1 -1
- package/dist/services/Script.d.ts +42 -0
- package/dist/services/Script.d.ts.map +1 -1
- package/dist/services/Script.js +112 -77
- package/dist/services/Script.js.map +1 -1
- package/dist/services/Signer.d.ts +32 -7
- package/dist/services/Signer.d.ts.map +1 -1
- package/dist/services/Signer.js +69 -10
- package/dist/services/Signer.js.map +1 -1
- package/dist/services/SubmitConfig.d.ts +3 -22
- package/dist/services/SubmitConfig.d.ts.map +1 -1
- package/dist/services/SubmitConfig.js +54 -9
- package/dist/services/SubmitConfig.js.map +1 -1
- package/dist/services/Sui.d.ts +42 -1
- package/dist/services/Sui.d.ts.map +1 -1
- package/dist/services/Sui.js +46 -17
- package/dist/services/Sui.js.map +1 -1
- package/dist/services/SuiCore.d.ts.map +1 -1
- package/dist/services/SuiCore.js +47 -33
- package/dist/services/SuiCore.js.map +1 -1
- package/dist/services/SuiCoreFake.d.ts +47 -4
- package/dist/services/SuiCoreFake.d.ts.map +1 -1
- package/dist/services/SuiCoreFake.js +193 -22
- package/dist/services/SuiCoreFake.js.map +1 -1
- package/dist/services/Tx.d.ts +236 -402
- package/dist/services/Tx.d.ts.map +1 -1
- package/dist/services/Tx.js +205 -10
- package/dist/services/Tx.js.map +1 -1
- package/dist/testing.d.ts +1 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +9 -0
- package/dist/testing.js.map +1 -1
- package/dist/tx.d.ts +1 -1
- package/dist/tx.d.ts.map +1 -1
- package/dist/tx.js +1 -1
- package/dist/tx.js.map +1 -1
- package/docs/extensions.md +608 -19
- package/examples/extension-template/src/Escrow.ts +1 -1
- package/examples/extension-template/src/errors.ts +29 -0
- package/examples/extension-template/src/schema.ts +8 -17
- package/examples/extension-template/test/escrow.test.ts +44 -0
- package/package.json +1 -1
package/dist/domain/errors.d.ts
CHANGED
|
@@ -55,6 +55,8 @@ export declare class TransportError extends TransportError_base {
|
|
|
55
55
|
* ```
|
|
56
56
|
*/
|
|
57
57
|
static readonly fromUnknown: (method: string, cause: unknown, retryable?: boolean) => TransportError;
|
|
58
|
+
/** The one actionable line `SuiError.describe` produces for this error. */
|
|
59
|
+
get message(): string;
|
|
58
60
|
}
|
|
59
61
|
/**
|
|
60
62
|
* gRPC status names a read may be retried on, plus HTTP 5xx and 429. Timeouts
|
|
@@ -84,6 +86,17 @@ declare const ObjectNotFound_base: Schema.Class<ObjectNotFound, Schema.TaggedStr
|
|
|
84
86
|
}>, import("effect/Cause").YieldableError>;
|
|
85
87
|
/** The object does not exist, or has never existed. */
|
|
86
88
|
export declare class ObjectNotFound extends ObjectNotFound_base {
|
|
89
|
+
/**
|
|
90
|
+
* The one actionable line `SuiError.describe` produces for this error.
|
|
91
|
+
*
|
|
92
|
+
* `Schema.TaggedError` gives every class the `Error` constructor and no
|
|
93
|
+
* message of its own, so `error.message` was the empty string — and a
|
|
94
|
+
* consumer that surfaces `.message` (a log line, a UI, another library's
|
|
95
|
+
* error formatter) showed nothing at all. A getter rather than a schema
|
|
96
|
+
* field, so it is always in step with `describe`, costs nothing to
|
|
97
|
+
* construct, and stays out of `SuiError.toJson`'s encoding.
|
|
98
|
+
*/
|
|
99
|
+
get message(): string;
|
|
87
100
|
}
|
|
88
101
|
declare const ObjectDeleted_base: Schema.Class<ObjectDeleted, Schema.TaggedStruct<"ObjectDeleted", {
|
|
89
102
|
readonly objectId: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "ObjectId"> & {
|
|
@@ -93,6 +106,8 @@ declare const ObjectDeleted_base: Schema.Class<ObjectDeleted, Schema.TaggedStruc
|
|
|
93
106
|
}>, import("effect/Cause").YieldableError>;
|
|
94
107
|
/** The object existed and has been deleted or wrapped. */
|
|
95
108
|
export declare class ObjectDeleted extends ObjectDeleted_base {
|
|
109
|
+
/** The one actionable line `SuiError.describe` produces for this error. */
|
|
110
|
+
get message(): string;
|
|
96
111
|
}
|
|
97
112
|
declare const ObjectUnavailable_base: Schema.Class<ObjectUnavailable, Schema.TaggedStruct<"ObjectUnavailable", {
|
|
98
113
|
readonly objectId: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "ObjectId"> & {
|
|
@@ -102,12 +117,16 @@ declare const ObjectUnavailable_base: Schema.Class<ObjectUnavailable, Schema.Tag
|
|
|
102
117
|
}>, import("effect/Cause").YieldableError>;
|
|
103
118
|
/** The node could not say what happened to the object (`ObjectError.reason: "unknown"`). */
|
|
104
119
|
export declare class ObjectUnavailable extends ObjectUnavailable_base {
|
|
120
|
+
/** The one actionable line `SuiError.describe` produces for this error. */
|
|
121
|
+
get message(): string;
|
|
105
122
|
}
|
|
106
123
|
declare const TransactionNotFound_base: Schema.Class<TransactionNotFound, Schema.TaggedStruct<"TransactionNotFound", {
|
|
107
124
|
readonly digest: Schema.brand<Schema.String, "Digest">;
|
|
108
125
|
}>, import("effect/Cause").YieldableError>;
|
|
109
126
|
/** No transaction with this digest is known to the node. */
|
|
110
127
|
export declare class TransactionNotFound extends TransactionNotFound_base {
|
|
128
|
+
/** The one actionable line `SuiError.describe` produces for this error. */
|
|
129
|
+
get message(): string;
|
|
111
130
|
}
|
|
112
131
|
declare const NetworkMismatch_base: Schema.Class<NetworkMismatch, Schema.TaggedStruct<"NetworkMismatch", {
|
|
113
132
|
readonly expected: Schema.String;
|
|
@@ -115,17 +134,94 @@ declare const NetworkMismatch_base: Schema.Class<NetworkMismatch, Schema.TaggedS
|
|
|
115
134
|
}>, import("effect/Cause").YieldableError>;
|
|
116
135
|
/** The chain identifier the node reported is not the one the layer was built for. */
|
|
117
136
|
export declare class NetworkMismatch extends NetworkMismatch_base {
|
|
137
|
+
/** The one actionable line `SuiError.describe` produces for this error. */
|
|
138
|
+
get message(): string;
|
|
118
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Which of the three things that can go wrong at a decode boundary went wrong.
|
|
142
|
+
*
|
|
143
|
+
* - `"type"`: the object, the field or the event **is not of the expected Move
|
|
144
|
+
* type**. The bytes were never parsed. This is the one a caller answers with
|
|
145
|
+
* "that is not one of mine" — a 404 for a foreign object, a `filter` over a
|
|
146
|
+
* heterogeneous list — and the one it is safe to swallow.
|
|
147
|
+
* - `"bytes"`: the type matched and the **BCS parse failed**, or left trailing
|
|
148
|
+
* bytes. Either the layout this package was built with is not the layout the
|
|
149
|
+
* package on chain writes, or the object is corrupt. Never safe to swallow.
|
|
150
|
+
* - `"shape"`: a **domain schema** refused a value that was already parsed or
|
|
151
|
+
* that came from the node as JSON — a missing field in a node response, a
|
|
152
|
+
* number that is not a timestamp, a simulation with no such command. A bug
|
|
153
|
+
* here is in this library, the node, or the caller's expectations.
|
|
154
|
+
*
|
|
155
|
+
* Branch on this, never on {@link DecodeError}'s `issue`: `issue` is a human
|
|
156
|
+
* sentence and its wording changes between releases.
|
|
157
|
+
*
|
|
158
|
+
* @since 0.1.2
|
|
159
|
+
*/
|
|
160
|
+
export declare const DecodeKind: Schema.Literals<readonly ["type", "bytes", "shape"]>;
|
|
161
|
+
/** The three decode failures {@link DecodeKind} names. */
|
|
162
|
+
export type DecodeKind = typeof DecodeKind.Type;
|
|
119
163
|
declare const DecodeError_base: Schema.Class<DecodeError, Schema.TaggedStruct<"DecodeError", {
|
|
120
164
|
readonly objectId: Schema.optional<Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "ObjectId"> & {
|
|
121
165
|
normalize: (input: string) => string & import("effect/Brand").Brand<"ObjectId">;
|
|
122
166
|
}>;
|
|
123
167
|
readonly expectedType: Schema.optional<Schema.String>;
|
|
168
|
+
/**
|
|
169
|
+
* Which boundary failed. See {@link DecodeKind}.
|
|
170
|
+
*
|
|
171
|
+
* @since 0.1.2
|
|
172
|
+
*/
|
|
173
|
+
readonly kind: Schema.withConstructorDefault<Schema.withDecodingDefaultKey<Schema.Literals<readonly ["type", "bytes", "shape"]>, never>>;
|
|
124
174
|
readonly issue: Schema.String;
|
|
175
|
+
/**
|
|
176
|
+
* Every issue the schema reported, with its path — the structured form of
|
|
177
|
+
* {@link DecodeError.issue}, which is only the first issue's sentence.
|
|
178
|
+
*
|
|
179
|
+
* An operator debugging a relay envelope with three bad fields sees three
|
|
180
|
+
* paths rather than one line, and a UI can render a message per field. The
|
|
181
|
+
* key is absent when the producer had no structured issue to carry (a Move
|
|
182
|
+
* type mismatch, a hand-built `DecodeError`), so `SuiError.toJson` still
|
|
183
|
+
* round-trips for every error that was built without one.
|
|
184
|
+
*
|
|
185
|
+
* `kind` is still the field to branch on; this is for reading.
|
|
186
|
+
*
|
|
187
|
+
* @since 0.1.3
|
|
188
|
+
*/
|
|
189
|
+
readonly issues: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
190
|
+
/** The path into the decoded value, as the schema walked it. */
|
|
191
|
+
readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number]>>;
|
|
192
|
+
/** What the schema said about that path. */
|
|
193
|
+
readonly message: Schema.String;
|
|
194
|
+
}>>>;
|
|
125
195
|
}>, import("effect/Cause").YieldableError>;
|
|
126
|
-
/**
|
|
196
|
+
/**
|
|
197
|
+
* BCS content or a schema boundary did not decode.
|
|
198
|
+
*
|
|
199
|
+
* `kind` says which of the three (`"type"`, `"bytes"`, `"shape"`) and is what a
|
|
200
|
+
* consumer branches on; `issue` is the sentence for a human and is not stable.
|
|
201
|
+
* It defaults to `"shape"` when neither a constructor nor an encoded value
|
|
202
|
+
* carries one, so an extension that builds a `DecodeError` with no `kind` still
|
|
203
|
+
* compiles and still answers the question conservatively.
|
|
204
|
+
*/
|
|
127
205
|
export declare class DecodeError extends DecodeError_base {
|
|
206
|
+
/** The one actionable line `SuiError.describe` produces for this error. */
|
|
207
|
+
get message(): string;
|
|
128
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* The `DecodeError` payload a failed decode deserves: the first issue as the
|
|
211
|
+
* sentence `issue` has always been, and every issue as `{ path, message }`.
|
|
212
|
+
*
|
|
213
|
+
* `SchemaError.issue` is a tree; the second half is Effect's own
|
|
214
|
+
* Standard-Schema formatter over it, so the paths are the ones every other
|
|
215
|
+
* tool prints. A decode run with `{ errors: "all" }` reports every field
|
|
216
|
+
* rather than the first. Never fails.
|
|
217
|
+
*/
|
|
218
|
+
export declare const decodePayload: (error: Schema.SchemaError) => {
|
|
219
|
+
readonly issue: string;
|
|
220
|
+
readonly issues: ReadonlyArray<{
|
|
221
|
+
readonly path: ReadonlyArray<string | number>;
|
|
222
|
+
readonly message: string;
|
|
223
|
+
}>;
|
|
224
|
+
};
|
|
129
225
|
declare const SimulationFailed_base: Schema.Class<SimulationFailed, Schema.TaggedStruct<"SimulationFailed", {
|
|
130
226
|
readonly reason: Schema.toTaggedUnion<"$kind", readonly [Schema.Struct<{
|
|
131
227
|
readonly $kind: Schema.Literal<"MoveAbort">;
|
|
@@ -134,13 +230,13 @@ declare const SimulationFailed_base: Schema.Class<SimulationFailed, Schema.Tagge
|
|
|
134
230
|
readonly location: Schema.optional<Schema.Struct<{
|
|
135
231
|
readonly package: Schema.optional<Schema.String>;
|
|
136
232
|
readonly module: Schema.optional<Schema.String>;
|
|
137
|
-
readonly function: Schema.optional<Schema.
|
|
233
|
+
readonly function: Schema.optional<Schema.Finite>;
|
|
138
234
|
readonly functionName: Schema.optional<Schema.String>;
|
|
139
|
-
readonly instruction: Schema.optional<Schema.
|
|
235
|
+
readonly instruction: Schema.optional<Schema.Finite>;
|
|
140
236
|
}>>;
|
|
141
237
|
readonly cleverError: Schema.optional<Schema.Struct<{
|
|
142
|
-
readonly errorCode: Schema.optional<Schema.
|
|
143
|
-
readonly lineNumber: Schema.optional<Schema.
|
|
238
|
+
readonly errorCode: Schema.optional<Schema.Finite>;
|
|
239
|
+
readonly lineNumber: Schema.optional<Schema.Finite>;
|
|
144
240
|
readonly constantName: Schema.optional<Schema.String>;
|
|
145
241
|
readonly constantType: Schema.optional<Schema.String>;
|
|
146
242
|
readonly value: Schema.optional<Schema.String>;
|
|
@@ -150,19 +246,19 @@ declare const SimulationFailed_base: Schema.Class<SimulationFailed, Schema.Tagge
|
|
|
150
246
|
readonly $kind: Schema.Literal<"SizeError">;
|
|
151
247
|
readonly SizeError: Schema.Struct<{
|
|
152
248
|
readonly name: Schema.String;
|
|
153
|
-
readonly size: Schema.
|
|
154
|
-
readonly maxSize: Schema.
|
|
249
|
+
readonly size: Schema.Finite;
|
|
250
|
+
readonly maxSize: Schema.Finite;
|
|
155
251
|
}>;
|
|
156
252
|
}>, Schema.Struct<{
|
|
157
253
|
readonly $kind: Schema.Literal<"CommandArgumentError">;
|
|
158
254
|
readonly CommandArgumentError: Schema.Struct<{
|
|
159
|
-
readonly argument: Schema.
|
|
255
|
+
readonly argument: Schema.Finite;
|
|
160
256
|
readonly name: Schema.String;
|
|
161
257
|
}>;
|
|
162
258
|
}>, Schema.Struct<{
|
|
163
259
|
readonly $kind: Schema.Literal<"TypeArgumentError">;
|
|
164
260
|
readonly TypeArgumentError: Schema.Struct<{
|
|
165
|
-
readonly typeArgument: Schema.
|
|
261
|
+
readonly typeArgument: Schema.Finite;
|
|
166
262
|
readonly name: Schema.String;
|
|
167
263
|
}>;
|
|
168
264
|
}>, Schema.Struct<{
|
|
@@ -175,8 +271,8 @@ declare const SimulationFailed_base: Schema.Class<SimulationFailed, Schema.Tagge
|
|
|
175
271
|
}>, Schema.Struct<{
|
|
176
272
|
readonly $kind: Schema.Literal<"IndexError">;
|
|
177
273
|
readonly IndexError: Schema.Struct<{
|
|
178
|
-
readonly index: Schema.optional<Schema.
|
|
179
|
-
readonly subresult: Schema.optional<Schema.
|
|
274
|
+
readonly index: Schema.optional<Schema.Finite>;
|
|
275
|
+
readonly subresult: Schema.optional<Schema.Finite>;
|
|
180
276
|
}>;
|
|
181
277
|
}>, Schema.Struct<{
|
|
182
278
|
readonly $kind: Schema.Literal<"CoinDenyListError">;
|
|
@@ -214,13 +310,13 @@ declare const ExecutionFailed_base: Schema.Class<ExecutionFailed, Schema.TaggedS
|
|
|
214
310
|
readonly location: Schema.optional<Schema.Struct<{
|
|
215
311
|
readonly package: Schema.optional<Schema.String>;
|
|
216
312
|
readonly module: Schema.optional<Schema.String>;
|
|
217
|
-
readonly function: Schema.optional<Schema.
|
|
313
|
+
readonly function: Schema.optional<Schema.Finite>;
|
|
218
314
|
readonly functionName: Schema.optional<Schema.String>;
|
|
219
|
-
readonly instruction: Schema.optional<Schema.
|
|
315
|
+
readonly instruction: Schema.optional<Schema.Finite>;
|
|
220
316
|
}>>;
|
|
221
317
|
readonly cleverError: Schema.optional<Schema.Struct<{
|
|
222
|
-
readonly errorCode: Schema.optional<Schema.
|
|
223
|
-
readonly lineNumber: Schema.optional<Schema.
|
|
318
|
+
readonly errorCode: Schema.optional<Schema.Finite>;
|
|
319
|
+
readonly lineNumber: Schema.optional<Schema.Finite>;
|
|
224
320
|
readonly constantName: Schema.optional<Schema.String>;
|
|
225
321
|
readonly constantType: Schema.optional<Schema.String>;
|
|
226
322
|
readonly value: Schema.optional<Schema.String>;
|
|
@@ -230,19 +326,19 @@ declare const ExecutionFailed_base: Schema.Class<ExecutionFailed, Schema.TaggedS
|
|
|
230
326
|
readonly $kind: Schema.Literal<"SizeError">;
|
|
231
327
|
readonly SizeError: Schema.Struct<{
|
|
232
328
|
readonly name: Schema.String;
|
|
233
|
-
readonly size: Schema.
|
|
234
|
-
readonly maxSize: Schema.
|
|
329
|
+
readonly size: Schema.Finite;
|
|
330
|
+
readonly maxSize: Schema.Finite;
|
|
235
331
|
}>;
|
|
236
332
|
}>, Schema.Struct<{
|
|
237
333
|
readonly $kind: Schema.Literal<"CommandArgumentError">;
|
|
238
334
|
readonly CommandArgumentError: Schema.Struct<{
|
|
239
|
-
readonly argument: Schema.
|
|
335
|
+
readonly argument: Schema.Finite;
|
|
240
336
|
readonly name: Schema.String;
|
|
241
337
|
}>;
|
|
242
338
|
}>, Schema.Struct<{
|
|
243
339
|
readonly $kind: Schema.Literal<"TypeArgumentError">;
|
|
244
340
|
readonly TypeArgumentError: Schema.Struct<{
|
|
245
|
-
readonly typeArgument: Schema.
|
|
341
|
+
readonly typeArgument: Schema.Finite;
|
|
246
342
|
readonly name: Schema.String;
|
|
247
343
|
}>;
|
|
248
344
|
}>, Schema.Struct<{
|
|
@@ -255,8 +351,8 @@ declare const ExecutionFailed_base: Schema.Class<ExecutionFailed, Schema.TaggedS
|
|
|
255
351
|
}>, Schema.Struct<{
|
|
256
352
|
readonly $kind: Schema.Literal<"IndexError">;
|
|
257
353
|
readonly IndexError: Schema.Struct<{
|
|
258
|
-
readonly index: Schema.optional<Schema.
|
|
259
|
-
readonly subresult: Schema.optional<Schema.
|
|
354
|
+
readonly index: Schema.optional<Schema.Finite>;
|
|
355
|
+
readonly subresult: Schema.optional<Schema.Finite>;
|
|
260
356
|
}>;
|
|
261
357
|
}>, Schema.Struct<{
|
|
262
358
|
readonly $kind: Schema.Literal<"CoinDenyListError">;
|
|
@@ -280,9 +376,9 @@ declare const ExecutionFailed_base: Schema.Class<ExecutionFailed, Schema.TaggedS
|
|
|
280
376
|
}>, Schema.Struct<{
|
|
281
377
|
readonly $kind: Schema.Literal<"Unknown">;
|
|
282
378
|
}>]>;
|
|
283
|
-
readonly command: Schema.optional<Schema.
|
|
379
|
+
readonly command: Schema.optional<Schema.Finite>;
|
|
284
380
|
readonly effects: Schema.Struct<{
|
|
285
|
-
readonly version: Schema.
|
|
381
|
+
readonly version: Schema.Finite;
|
|
286
382
|
readonly status: Schema.Struct<{
|
|
287
383
|
readonly success: Schema.Boolean;
|
|
288
384
|
}>;
|
|
@@ -449,6 +545,8 @@ declare const ExecutionFailed_base: Schema.Class<ExecutionFailed, Schema.TaggedS
|
|
|
449
545
|
}>, import("effect/Cause").YieldableError>;
|
|
450
546
|
/** The transaction was applied on chain and failed. Gas was charged. */
|
|
451
547
|
export declare class ExecutionFailed extends ExecutionFailed_base {
|
|
548
|
+
/** The one actionable line `SuiError.describe` produces for this error. */
|
|
549
|
+
get message(): string;
|
|
452
550
|
}
|
|
453
551
|
declare const SubmissionUnknown_base: Schema.Class<SubmissionUnknown, Schema.TaggedStruct<"SubmissionUnknown", {
|
|
454
552
|
readonly digest: Schema.brand<Schema.String, "Digest">;
|
|
@@ -464,30 +562,30 @@ declare const SubmissionUnknown_base: Schema.Class<SubmissionUnknown, Schema.Tag
|
|
|
464
562
|
readonly None: Schema.Literal<true>;
|
|
465
563
|
}>, Schema.Struct<{
|
|
466
564
|
readonly $kind: Schema.Literal<"Epoch">;
|
|
467
|
-
readonly Epoch: Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.
|
|
565
|
+
readonly Epoch: Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Finite]>, never, never>;
|
|
468
566
|
}>, Schema.Struct<{
|
|
469
567
|
readonly $kind: Schema.Literal<"ValidDuring">;
|
|
470
568
|
readonly ValidDuring: Schema.Struct<{
|
|
471
|
-
readonly minEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.
|
|
472
|
-
readonly maxEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.
|
|
473
|
-
readonly minTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.
|
|
474
|
-
readonly maxTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.
|
|
569
|
+
readonly minEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Finite]>, never, never>>;
|
|
570
|
+
readonly maxEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Finite]>, never, never>>;
|
|
571
|
+
readonly minTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Finite]>, never, never>>;
|
|
572
|
+
readonly maxTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Finite]>, never, never>>;
|
|
475
573
|
readonly chain: Schema.String;
|
|
476
|
-
readonly nonce: Schema.
|
|
574
|
+
readonly nonce: Schema.Finite;
|
|
477
575
|
}>;
|
|
478
576
|
}>, Schema.Struct<{
|
|
479
577
|
readonly $kind: Schema.Literal<"Validity">;
|
|
480
578
|
readonly Validity: Schema.Struct<{
|
|
481
579
|
readonly allowedProposers: Schema.NullOr<Schema.Struct<{
|
|
482
|
-
readonly epoch: Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.
|
|
483
|
-
readonly proposers: Schema.$Array<Schema.
|
|
580
|
+
readonly epoch: Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Finite]>, never, never>;
|
|
581
|
+
readonly proposers: Schema.$Array<Schema.Finite>;
|
|
484
582
|
}>>;
|
|
485
|
-
readonly minEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.
|
|
486
|
-
readonly maxEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.
|
|
487
|
-
readonly minTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.
|
|
488
|
-
readonly maxTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.
|
|
583
|
+
readonly minEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Finite]>, never, never>>;
|
|
584
|
+
readonly maxEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Finite]>, never, never>>;
|
|
585
|
+
readonly minTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Finite]>, never, never>>;
|
|
586
|
+
readonly maxTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Finite]>, never, never>>;
|
|
489
587
|
readonly chain: Schema.String;
|
|
490
|
-
readonly nonce: Schema.
|
|
588
|
+
readonly nonce: Schema.Finite;
|
|
491
589
|
}>;
|
|
492
590
|
}>]>>;
|
|
493
591
|
readonly chain: Schema.optional<Schema.String>;
|
|
@@ -499,6 +597,8 @@ declare const SubmissionUnknown_base: Schema.Class<SubmissionUnknown, Schema.Tag
|
|
|
499
597
|
* signed transaction so an operator or a later process can reconcile it.
|
|
500
598
|
*/
|
|
501
599
|
export declare class SubmissionUnknown extends SubmissionUnknown_base {
|
|
600
|
+
/** The one actionable line `SuiError.describe` produces for this error. */
|
|
601
|
+
get message(): string;
|
|
502
602
|
}
|
|
503
603
|
declare const NotApplied_base: Schema.Class<NotApplied, Schema.TaggedStruct<"NotApplied", {
|
|
504
604
|
readonly digest: Schema.brand<Schema.String, "Digest">;
|
|
@@ -514,12 +614,16 @@ declare const NotApplied_base: Schema.Class<NotApplied, Schema.TaggedStruct<"Not
|
|
|
514
614
|
* node will not name are all `SubmissionUnknown`, not this.
|
|
515
615
|
*/
|
|
516
616
|
export declare class NotApplied extends NotApplied_base {
|
|
617
|
+
/** The one actionable line `SuiError.describe` produces for this error. */
|
|
618
|
+
get message(): string;
|
|
517
619
|
}
|
|
518
620
|
declare const SigningError_base: Schema.Class<SigningError, Schema.TaggedStruct<"SigningError", {
|
|
519
621
|
readonly cause: Schema.Defect;
|
|
520
622
|
}>, import("effect/Cause").YieldableError>;
|
|
521
623
|
/** A signer refused or failed to produce a signature. */
|
|
522
624
|
export declare class SigningError extends SigningError_base {
|
|
625
|
+
/** The one actionable line `SuiError.describe` produces for this error. */
|
|
626
|
+
get message(): string;
|
|
523
627
|
}
|
|
524
628
|
declare const BuildError_base: Schema.Class<BuildError, Schema.TaggedStruct<"BuildError", {
|
|
525
629
|
readonly message: Schema.String;
|
|
@@ -540,6 +644,8 @@ declare const JournalError_base: Schema.Class<JournalError, Schema.TaggedStruct<
|
|
|
540
644
|
}>, import("effect/Cause").YieldableError>;
|
|
541
645
|
/** The submission journal could not be read or written. */
|
|
542
646
|
export declare class JournalError extends JournalError_base {
|
|
647
|
+
/** The one actionable line `SuiError.describe` produces for this error. */
|
|
648
|
+
get message(): string;
|
|
543
649
|
}
|
|
544
650
|
declare const UnexpectedEffects_base: Schema.Class<UnexpectedEffects, Schema.TaggedStruct<"UnexpectedEffects", {
|
|
545
651
|
readonly digest: Schema.brand<Schema.String, "Digest">;
|
|
@@ -559,6 +665,8 @@ declare const UnexpectedEffects_base: Schema.Class<UnexpectedEffects, Schema.Tag
|
|
|
559
665
|
* time for a transaction that already ran.
|
|
560
666
|
*/
|
|
561
667
|
export declare class UnexpectedEffects extends UnexpectedEffects_base {
|
|
668
|
+
/** The one actionable line `SuiError.describe` produces for this error. */
|
|
669
|
+
get message(): string;
|
|
562
670
|
}
|
|
563
671
|
declare const GraphQLUnavailable_base: Schema.Class<GraphQLUnavailable, Schema.TaggedStruct<"GraphQLUnavailable", {
|
|
564
672
|
readonly method: Schema.String;
|
|
@@ -578,6 +686,8 @@ declare const GraphQLUnavailable_base: Schema.Class<GraphQLUnavailable, Schema.T
|
|
|
578
686
|
* Outcome `not_applied`: a read that did not happen changed nothing.
|
|
579
687
|
*/
|
|
580
688
|
export declare class GraphQLUnavailable extends GraphQLUnavailable_base {
|
|
689
|
+
/** The one actionable line `SuiError.describe` produces for this error. */
|
|
690
|
+
get message(): string;
|
|
581
691
|
}
|
|
582
692
|
declare const ExtensionNotReady_base: Schema.Class<ExtensionNotReady, Schema.TaggedStruct<"ExtensionNotReady", {
|
|
583
693
|
readonly extension: Schema.String;
|
|
@@ -598,6 +708,8 @@ declare const ExtensionNotReady_base: Schema.Class<ExtensionNotReady, Schema.Tag
|
|
|
598
708
|
* Outcome `not_applied`: nothing was sent.
|
|
599
709
|
*/
|
|
600
710
|
export declare class ExtensionNotReady extends ExtensionNotReady_base {
|
|
711
|
+
/** The one actionable line `SuiError.describe` produces for this error. */
|
|
712
|
+
get message(): string;
|
|
601
713
|
}
|
|
602
714
|
/** Every failure sui-effect can produce. */
|
|
603
715
|
export type SuiError = TransportError | ObjectNotFound | ObjectDeleted | ObjectUnavailable | TransactionNotFound | NetworkMismatch | DecodeError | SimulationFailed | ExecutionFailed | SubmissionUnknown | NotApplied | SigningError | BuildError | PolicyDenied | JournalError | UnexpectedEffects | GraphQLUnavailable | ExtensionNotReady;
|
|
@@ -608,6 +720,20 @@ export declare const SuiErrorSchema: Schema.Union<readonly [typeof TransportErro
|
|
|
608
720
|
* or a wrapper script acts on.
|
|
609
721
|
*/
|
|
610
722
|
export type Outcome = "applied" | "not_applied" | "unknown";
|
|
723
|
+
/**
|
|
724
|
+
* Where in the lifecycle a failure was caught, which is the only thing that
|
|
725
|
+
* can classify an error the taxonomy does not own.
|
|
726
|
+
*
|
|
727
|
+
* `"post-submit"` (the default, and the 0.1.1 behaviour) is "bytes may have
|
|
728
|
+
* gone out": a tag nobody here recognises proves nothing, so the answer is
|
|
729
|
+
* `"unknown"`. `"pre-submit"` is a failure caught while **building, simulating
|
|
730
|
+
* or signing** — an extension's own `PriceTooLow`, a validation error from the
|
|
731
|
+
* caller's code — where nothing has been sent by construction and the honest
|
|
732
|
+
* answer is `"not_applied"`.
|
|
733
|
+
*
|
|
734
|
+
* @since 0.1.2
|
|
735
|
+
*/
|
|
736
|
+
export type OutcomePhase = "pre-submit" | "post-submit";
|
|
611
737
|
/**
|
|
612
738
|
* An extension error may declare its own `outcome`, and `SuiError.outcome` and
|
|
613
739
|
* `Script.run` honour it before anything else.
|
|
@@ -621,13 +747,25 @@ export interface HasOutcome {
|
|
|
621
747
|
readonly outcome: Outcome;
|
|
622
748
|
}
|
|
623
749
|
/**
|
|
624
|
-
* The
|
|
625
|
-
* transaction land, what does an operator need to read,
|
|
750
|
+
* The helpers every repo hand-rolls: is this worth retrying, did the
|
|
751
|
+
* transaction land, is it even one of ours, what does an operator need to read,
|
|
752
|
+
* and what goes in a log.
|
|
753
|
+
*
|
|
754
|
+
* For *branching* on a failure, the taxonomy is a flat tagged union, so
|
|
755
|
+
* `Effect.catchTags({ ObjectNotFound: ..., TransportError: ... })` in the error
|
|
756
|
+
* channel and `Match.tagsExhaustive` over a `SuiError` value both work and are
|
|
757
|
+
* the two documented consumer idioms; these helpers are for the questions that
|
|
758
|
+
* are the same whatever the tag is.
|
|
626
759
|
*/
|
|
627
760
|
export declare const SuiError: {
|
|
628
761
|
readonly isRetryable: (error: SuiError) => boolean;
|
|
629
|
-
readonly
|
|
630
|
-
readonly
|
|
762
|
+
readonly isTaxonomy: (error: unknown) => error is SuiError;
|
|
763
|
+
readonly outcome: (error: SuiError | HasOutcome, options?: {
|
|
764
|
+
readonly phase?: OutcomePhase;
|
|
765
|
+
}) => Outcome;
|
|
766
|
+
readonly describe: (error: SuiError | {
|
|
767
|
+
readonly _tag: string;
|
|
768
|
+
}) => string;
|
|
631
769
|
readonly toJson: (error: SuiError | {
|
|
632
770
|
readonly _tag: string;
|
|
633
771
|
}) => Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/domain/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/domain/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAA6B,MAAM,EAAe,MAAM,QAAQ,CAAA;AACvE,OAAO,EACL,MAAM,EAOP,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;;;;;;;AAEzE;;;;;;;;GAQG;AACH,qBAAa,cAAe,SAAQ,mBAKlC;IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,MAAM,CAAC,QAAQ,CAAC,WAAW,GACzB,QAAQ,MAAM,EACd,OAAO,OAAO,EACd,YAAY,OAAO,KAClB,cAAc,CAQhB;IAED,2EAA2E;IAC3E,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAMtD,CAAA;AAIF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GACjC,OAAO,OAAO,KACb;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAkBzD,CAAA;;;;;;;AAED,uDAAuD;AACvD,qBAAa,cAAe,SAAQ,mBAGlC;IACA;;;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