@unconfirmed/sui-effect 0.1.2 → 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.
Files changed (46) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LLMS.md +101 -827
  3. package/README.md +9 -5
  4. package/dist/domain/bcs.d.ts.map +1 -1
  5. package/dist/domain/bcs.js +18 -9
  6. package/dist/domain/bcs.js.map +1 -1
  7. package/dist/domain/errors.d.ts +77 -35
  8. package/dist/domain/errors.d.ts.map +1 -1
  9. package/dist/domain/errors.js +114 -30
  10. package/dist/domain/errors.js.map +1 -1
  11. package/dist/domain/executed.d.ts +2 -2
  12. package/dist/domain/executed.d.ts.map +1 -1
  13. package/dist/domain/executed.js +21 -11
  14. package/dist/domain/executed.js.map +1 -1
  15. package/dist/domain/journal-entry.d.ts +37 -37
  16. package/dist/domain/journal-entry.js +1 -1
  17. package/dist/domain/schemas.d.ts +145 -64
  18. package/dist/domain/schemas.d.ts.map +1 -1
  19. package/dist/domain/schemas.js +111 -30
  20. package/dist/domain/schemas.js.map +1 -1
  21. package/dist/internal.d.ts +1 -1
  22. package/dist/internal.d.ts.map +1 -1
  23. package/dist/internal.js +1 -1
  24. package/dist/internal.js.map +1 -1
  25. package/dist/services/Script.d.ts.map +1 -1
  26. package/dist/services/Script.js +44 -76
  27. package/dist/services/Script.js.map +1 -1
  28. package/dist/services/SubmitConfig.d.ts +3 -22
  29. package/dist/services/SubmitConfig.d.ts.map +1 -1
  30. package/dist/services/SubmitConfig.js +54 -9
  31. package/dist/services/SubmitConfig.js.map +1 -1
  32. package/dist/services/Sui.d.ts.map +1 -1
  33. package/dist/services/Sui.js +28 -13
  34. package/dist/services/Sui.js.map +1 -1
  35. package/dist/services/SuiCore.d.ts.map +1 -1
  36. package/dist/services/SuiCore.js +47 -33
  37. package/dist/services/SuiCore.js.map +1 -1
  38. package/dist/services/Tx.d.ts +35 -817
  39. package/dist/services/Tx.d.ts.map +1 -1
  40. package/dist/services/Tx.js +18 -2
  41. package/dist/services/Tx.js.map +1 -1
  42. package/docs/extensions.md +75 -11
  43. package/examples/extension-template/src/errors.ts +29 -0
  44. package/examples/extension-template/src/schema.ts +8 -17
  45. package/examples/extension-template/test/escrow.test.ts +44 -0
  46. package/package.json +1 -1
package/README.md CHANGED
@@ -664,13 +664,17 @@ process verbatim.
664
664
  sponsor policy typically allows. Narrow it once, where the runtime is built:
665
665
 
666
666
  ```ts
667
- Effect.provideService(program, SubmitConfig, {
668
- ...SubmitConfig.defaults,
669
- maxGasBudget: 1_000_000_000n, // 1 SUI
670
- lockSender: false // see below
671
- })
667
+ program.pipe(SubmitConfig.with({
668
+ maxGasBudget: Mist.make(1_000_000_000n), // 1 SUI
669
+ lockSender: false // see below
670
+ }))
672
671
  ```
673
672
 
673
+ `SubmitConfig.with(overrides)` spreads `SubmitConfig.defaults` for you and
674
+ provides the whole value, which is what a `Context.Reference` holds;
675
+ `SubmitConfig.layer(overrides)` is the same thing as a `Layer`, for an
676
+ application that sets its policy once where the runtime is built.
677
+
674
678
  `lockSender` is the other one worth a decision. The lock exists because two
675
679
  concurrent builds from one address can pick the same gas coin; with
676
680
  `tx.setGasPayment([])` there is no coin to pick — the node pays from the address
@@ -1 +1 @@
1
- {"version":3,"file":"bcs.d.ts","sourceRoot":"","sources":["../../src/domain/bcs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAgD,MAAM,QAAQ,CAAA;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAY5C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,GAAG,GAAI,CAAC,SAAS,KAAK,EAAE,KAAK,EACxC,SAAS,OAAO,CAAC,CAAC,EAAE,KAAK,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C,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAC7B,KACA,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,CAmC9B,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { normalizeStructTag, parseStructTag } from "@mysten/sui/utils";
2
2
  import { Effect, Schema, SchemaAST, SchemaIssue, SchemaTransformation } from "effect";
3
- import { DecodeError } from "./errors.js";
3
+ import { DecodeError, decodePayload } from "./errors.js";
4
4
  const SUI_TYPE_ANNOTATION = "sui-effect/suiType";
5
5
  const normalizeSafe = (value) => {
6
6
  try {
@@ -37,7 +37,10 @@ export const bcs = (bcsType, expectedType) => {
37
37
  // A BCS layout carries no runtime type to test a decoded value against: the
38
38
  // parse below is the validation, so the target schema accepts whatever the
39
39
  // layout produced.
40
- const target = Schema.declare((_u) => true);
40
+ const target = Schema.declare((_u) => true, {
41
+ identifier: label,
42
+ description: `BCS layout ${label}`
43
+ });
41
44
  return Schema.Uint8Array.pipe(Schema.decodeTo(target, SchemaTransformation.transformOrFail({
42
45
  decode: (bytes, options) => Effect.try({
43
46
  try: () => {
@@ -57,7 +60,7 @@ export const bcs = (bcsType, expectedType) => {
57
60
  try: () => bcsType.serialize(value).toBytes(),
58
61
  catch: (cause) => new SchemaIssue.InvalidValue({ message: `Could not serialize ${label} to BCS: ${String(cause)}` }, value, options)
59
62
  })
60
- }))).annotate(normalized === undefined ? {} : { [SUI_TYPE_ANNOTATION]: normalized });
63
+ }))).annotate(normalized === undefined ? {} : { [SUI_TYPE_ANNOTATION]: normalized }).pipe(Schema.revealCodec);
61
64
  };
62
65
  /**
63
66
  * A BCS layout plus the mapping into a domain value, as one codec.
@@ -103,18 +106,22 @@ export const bcs = (bcsType, expectedType) => {
103
106
  * ```
104
107
  */
105
108
  export const decodeWith = (bcsType, expectedType, map) => {
106
- const target = Schema.declare((_u) => true);
109
+ const label = expectedType ?? bcsType.name;
110
+ const target = Schema.declare((_u) => true, {
111
+ identifier: label,
112
+ description: `BCS layout ${label}`
113
+ });
107
114
  return bcs(bcsType, expectedType).pipe(Schema.decodeTo(target, SchemaTransformation.transformOrFail({
108
115
  decode: (parsed, options) => Effect.try({
109
116
  try: () => map(parsed),
110
117
  catch: (cause) => new SchemaIssue.InvalidValue({
111
- message: `Could not map ${expectedType ?? bcsType.name} into its domain value: ${String(cause)}`
118
+ message: `Could not map ${label} into its domain value: ${String(cause)}`
112
119
  }, parsed, options)
113
120
  }),
114
121
  encode: (value, options) => Effect.fail(new SchemaIssue.Forbidden({
115
- message: `${expectedType ?? bcsType.name} was built with SuiSchema.decodeWith, which has no encoder: serialize with the BCS layout instead`
122
+ message: `${label} was built with SuiSchema.decodeWith, which has no encoder: serialize with the BCS layout instead`
116
123
  }, value, options))
117
- })));
124
+ })), Schema.revealCodec);
118
125
  };
119
126
  const MAX_ENCODING_DEPTH = 32;
120
127
  /**
@@ -234,14 +241,16 @@ export const decodeContent = (schema, content, context) => {
234
241
  issue: `${context?.objectId === undefined ? "the bytes have" : `object ${context.objectId} has`} type ${actual}`
235
242
  }));
236
243
  }
237
- return Schema.decodeUnknownEffect(schema)(content).pipe(Effect.mapError((error) => new DecodeError({
244
+ // `{ errors: "all" }` so a value that is wrong in three places reports three
245
+ // paths on `DecodeError.issues`, not just the first sentence.
246
+ return Schema.decodeUnknownEffect(schema)(content, { errors: "all" }).pipe(Effect.mapError((error) => new DecodeError({
238
247
  ...withObject,
239
248
  ...withExpected,
240
249
  // The tag matched (or there was none to check) and the bytes
241
250
  // themselves did not parse: a layout mismatch or a corrupt object,
242
251
  // never something to swallow.
243
252
  kind: "bytes",
244
- issue: error.message
253
+ ...decodePayload(error)
245
254
  })));
246
255
  };
247
256
  //# sourceMappingURL=bcs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bcs.js","sourceRoot":"","sources":["../../src/domain/bcs.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EA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Q,MACjF,SAAS,MAAM,EAAE;SAClB,CAAC,CACH,CAAA;IACH,CAAC;IACD,6EAA6E;IAC7E,8DAA8D;IAC9D,OAAO,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,CACxE,MAAM,CAAC,QAAQ,CACb,CAAC,KAAK,EAAE,EAAE,CACR,IAAI,WAAW,CAAC;QACd,GAAG,UAAU;QACb,GAAG,YAAY;QACf,6DAA6D;QAC7D,mEAAmE;QACnE,8BAA8B;QAC9B,IAAI,EAAE,OAAO;QACb,GAAG,aAAa,CAAC,KAAK,CAAC;KACxB,CAAC,CACL,CACF,CAAA;AACH,CAAC,CAAA"}
@@ -172,6 +172,26 @@ declare const DecodeError_base: Schema.Class<DecodeError, Schema.TaggedStruct<"D
172
172
  */
173
173
  readonly kind: Schema.withConstructorDefault<Schema.withDecodingDefaultKey<Schema.Literals<readonly ["type", "bytes", "shape"]>, never>>;
174
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
+ }>>>;
175
195
  }>, import("effect/Cause").YieldableError>;
176
196
  /**
177
197
  * BCS content or a schema boundary did not decode.
@@ -186,6 +206,22 @@ export declare class DecodeError extends DecodeError_base {
186
206
  /** The one actionable line `SuiError.describe` produces for this error. */
187
207
  get message(): string;
188
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
+ };
189
225
  declare const SimulationFailed_base: Schema.Class<SimulationFailed, Schema.TaggedStruct<"SimulationFailed", {
190
226
  readonly reason: Schema.toTaggedUnion<"$kind", readonly [Schema.Struct<{
191
227
  readonly $kind: Schema.Literal<"MoveAbort">;
@@ -194,13 +230,13 @@ declare const SimulationFailed_base: Schema.Class<SimulationFailed, Schema.Tagge
194
230
  readonly location: Schema.optional<Schema.Struct<{
195
231
  readonly package: Schema.optional<Schema.String>;
196
232
  readonly module: Schema.optional<Schema.String>;
197
- readonly function: Schema.optional<Schema.Number>;
233
+ readonly function: Schema.optional<Schema.Finite>;
198
234
  readonly functionName: Schema.optional<Schema.String>;
199
- readonly instruction: Schema.optional<Schema.Number>;
235
+ readonly instruction: Schema.optional<Schema.Finite>;
200
236
  }>>;
201
237
  readonly cleverError: Schema.optional<Schema.Struct<{
202
- readonly errorCode: Schema.optional<Schema.Number>;
203
- readonly lineNumber: Schema.optional<Schema.Number>;
238
+ readonly errorCode: Schema.optional<Schema.Finite>;
239
+ readonly lineNumber: Schema.optional<Schema.Finite>;
204
240
  readonly constantName: Schema.optional<Schema.String>;
205
241
  readonly constantType: Schema.optional<Schema.String>;
206
242
  readonly value: Schema.optional<Schema.String>;
@@ -210,19 +246,19 @@ declare const SimulationFailed_base: Schema.Class<SimulationFailed, Schema.Tagge
210
246
  readonly $kind: Schema.Literal<"SizeError">;
211
247
  readonly SizeError: Schema.Struct<{
212
248
  readonly name: Schema.String;
213
- readonly size: Schema.Number;
214
- readonly maxSize: Schema.Number;
249
+ readonly size: Schema.Finite;
250
+ readonly maxSize: Schema.Finite;
215
251
  }>;
216
252
  }>, Schema.Struct<{
217
253
  readonly $kind: Schema.Literal<"CommandArgumentError">;
218
254
  readonly CommandArgumentError: Schema.Struct<{
219
- readonly argument: Schema.Number;
255
+ readonly argument: Schema.Finite;
220
256
  readonly name: Schema.String;
221
257
  }>;
222
258
  }>, Schema.Struct<{
223
259
  readonly $kind: Schema.Literal<"TypeArgumentError">;
224
260
  readonly TypeArgumentError: Schema.Struct<{
225
- readonly typeArgument: Schema.Number;
261
+ readonly typeArgument: Schema.Finite;
226
262
  readonly name: Schema.String;
227
263
  }>;
228
264
  }>, Schema.Struct<{
@@ -235,8 +271,8 @@ declare const SimulationFailed_base: Schema.Class<SimulationFailed, Schema.Tagge
235
271
  }>, Schema.Struct<{
236
272
  readonly $kind: Schema.Literal<"IndexError">;
237
273
  readonly IndexError: Schema.Struct<{
238
- readonly index: Schema.optional<Schema.Number>;
239
- readonly subresult: Schema.optional<Schema.Number>;
274
+ readonly index: Schema.optional<Schema.Finite>;
275
+ readonly subresult: Schema.optional<Schema.Finite>;
240
276
  }>;
241
277
  }>, Schema.Struct<{
242
278
  readonly $kind: Schema.Literal<"CoinDenyListError">;
@@ -274,13 +310,13 @@ declare const ExecutionFailed_base: Schema.Class<ExecutionFailed, Schema.TaggedS
274
310
  readonly location: Schema.optional<Schema.Struct<{
275
311
  readonly package: Schema.optional<Schema.String>;
276
312
  readonly module: Schema.optional<Schema.String>;
277
- readonly function: Schema.optional<Schema.Number>;
313
+ readonly function: Schema.optional<Schema.Finite>;
278
314
  readonly functionName: Schema.optional<Schema.String>;
279
- readonly instruction: Schema.optional<Schema.Number>;
315
+ readonly instruction: Schema.optional<Schema.Finite>;
280
316
  }>>;
281
317
  readonly cleverError: Schema.optional<Schema.Struct<{
282
- readonly errorCode: Schema.optional<Schema.Number>;
283
- readonly lineNumber: Schema.optional<Schema.Number>;
318
+ readonly errorCode: Schema.optional<Schema.Finite>;
319
+ readonly lineNumber: Schema.optional<Schema.Finite>;
284
320
  readonly constantName: Schema.optional<Schema.String>;
285
321
  readonly constantType: Schema.optional<Schema.String>;
286
322
  readonly value: Schema.optional<Schema.String>;
@@ -290,19 +326,19 @@ declare const ExecutionFailed_base: Schema.Class<ExecutionFailed, Schema.TaggedS
290
326
  readonly $kind: Schema.Literal<"SizeError">;
291
327
  readonly SizeError: Schema.Struct<{
292
328
  readonly name: Schema.String;
293
- readonly size: Schema.Number;
294
- readonly maxSize: Schema.Number;
329
+ readonly size: Schema.Finite;
330
+ readonly maxSize: Schema.Finite;
295
331
  }>;
296
332
  }>, Schema.Struct<{
297
333
  readonly $kind: Schema.Literal<"CommandArgumentError">;
298
334
  readonly CommandArgumentError: Schema.Struct<{
299
- readonly argument: Schema.Number;
335
+ readonly argument: Schema.Finite;
300
336
  readonly name: Schema.String;
301
337
  }>;
302
338
  }>, Schema.Struct<{
303
339
  readonly $kind: Schema.Literal<"TypeArgumentError">;
304
340
  readonly TypeArgumentError: Schema.Struct<{
305
- readonly typeArgument: Schema.Number;
341
+ readonly typeArgument: Schema.Finite;
306
342
  readonly name: Schema.String;
307
343
  }>;
308
344
  }>, Schema.Struct<{
@@ -315,8 +351,8 @@ declare const ExecutionFailed_base: Schema.Class<ExecutionFailed, Schema.TaggedS
315
351
  }>, Schema.Struct<{
316
352
  readonly $kind: Schema.Literal<"IndexError">;
317
353
  readonly IndexError: Schema.Struct<{
318
- readonly index: Schema.optional<Schema.Number>;
319
- readonly subresult: Schema.optional<Schema.Number>;
354
+ readonly index: Schema.optional<Schema.Finite>;
355
+ readonly subresult: Schema.optional<Schema.Finite>;
320
356
  }>;
321
357
  }>, Schema.Struct<{
322
358
  readonly $kind: Schema.Literal<"CoinDenyListError">;
@@ -340,9 +376,9 @@ declare const ExecutionFailed_base: Schema.Class<ExecutionFailed, Schema.TaggedS
340
376
  }>, Schema.Struct<{
341
377
  readonly $kind: Schema.Literal<"Unknown">;
342
378
  }>]>;
343
- readonly command: Schema.optional<Schema.Number>;
379
+ readonly command: Schema.optional<Schema.Finite>;
344
380
  readonly effects: Schema.Struct<{
345
- readonly version: Schema.Number;
381
+ readonly version: Schema.Finite;
346
382
  readonly status: Schema.Struct<{
347
383
  readonly success: Schema.Boolean;
348
384
  }>;
@@ -526,30 +562,30 @@ declare const SubmissionUnknown_base: Schema.Class<SubmissionUnknown, Schema.Tag
526
562
  readonly None: Schema.Literal<true>;
527
563
  }>, Schema.Struct<{
528
564
  readonly $kind: Schema.Literal<"Epoch">;
529
- readonly Epoch: Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>;
565
+ readonly Epoch: Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Finite]>, never, never>;
530
566
  }>, Schema.Struct<{
531
567
  readonly $kind: Schema.Literal<"ValidDuring">;
532
568
  readonly ValidDuring: Schema.Struct<{
533
- readonly minEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
534
- readonly maxEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
535
- readonly minTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
536
- readonly maxTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
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>>;
537
573
  readonly chain: Schema.String;
538
- readonly nonce: Schema.Number;
574
+ readonly nonce: Schema.Finite;
539
575
  }>;
540
576
  }>, Schema.Struct<{
541
577
  readonly $kind: Schema.Literal<"Validity">;
542
578
  readonly Validity: Schema.Struct<{
543
579
  readonly allowedProposers: Schema.NullOr<Schema.Struct<{
544
- readonly epoch: Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>;
545
- readonly proposers: Schema.$Array<Schema.Number>;
580
+ readonly epoch: Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Finite]>, never, never>;
581
+ readonly proposers: Schema.$Array<Schema.Finite>;
546
582
  }>>;
547
- readonly minEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
548
- readonly maxEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
549
- readonly minTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
550
- readonly maxTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
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>>;
551
587
  readonly chain: Schema.String;
552
- readonly nonce: Schema.Number;
588
+ readonly nonce: Schema.Finite;
553
589
  }>;
554
590
  }>]>>;
555
591
  readonly chain: Schema.optional<Schema.String>;
@@ -714,6 +750,12 @@ export interface HasOutcome {
714
750
  * The helpers every repo hand-rolls: is this worth retrying, did the
715
751
  * transaction land, is it even one of ours, what does an operator need to read,
716
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.
717
759
  */
718
760
  export declare const SuiError: {
719
761
  readonly isRetryable: (error: SuiError) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/domain/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAkB,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/C,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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,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,CAAA;AAErB,gEAAgE;AAChE,eAAO,MAAM,cAAc,8bAmBzB,CAAA;AAWF;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAA;AAE3D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,aAAa,CAAA;AAEvD;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AAuTD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ;kCA1TO,QAAQ,KAAG,OAAO;iCA0SnB,OAAO,KAAG,KAAK,IAAI,QAAQ;8BAtQ7C,QAAQ,GAAG,UAAU,YAClB;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAA;KAAE,KAC1C,OAAO;+BAqFe,QAAQ,GAAG;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAG,MAAM;6BAiJ/C,QAAQ,GAAG;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAoD3E,CAAA;AAEV,0EAA0E;AAC1E,eAAO,MAAM,QAAQ,GAAI,OAAO,QAAQ,KAAG,MAAM,GAAG,SAWnD,CAAA"}
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @since 0.1.0
7
7
  */
8
- import { Effect, Result, Schema } from "effect";
8
+ import { Effect, Predicate, Result, Schema, SchemaIssue } from "effect";
9
9
  import { Digest, ExecutionReason, NotAppliedEvidence, ObjectId, SignedTransaction, TransactionEffects, Version } from "./schemas.js";
10
10
  export { CleverError, ExecutionReason, MoveLocation } from "./schemas.js";
11
11
  /**
@@ -203,13 +203,70 @@ export class DecodeError extends Schema.TaggedError()("DecodeError", {
203
203
  * @since 0.1.2
204
204
  */
205
205
  kind: DecodeKind.pipe(Schema.withDecodingDefaultKey(Effect.succeed("shape")), Schema.withConstructorDefault(Effect.succeed("shape"))),
206
- issue: Schema.String
206
+ issue: Schema.String,
207
+ /**
208
+ * Every issue the schema reported, with its path — the structured form of
209
+ * {@link DecodeError.issue}, which is only the first issue's sentence.
210
+ *
211
+ * An operator debugging a relay envelope with three bad fields sees three
212
+ * paths rather than one line, and a UI can render a message per field. The
213
+ * key is absent when the producer had no structured issue to carry (a Move
214
+ * type mismatch, a hand-built `DecodeError`), so `SuiError.toJson` still
215
+ * round-trips for every error that was built without one.
216
+ *
217
+ * `kind` is still the field to branch on; this is for reading.
218
+ *
219
+ * @since 0.1.3
220
+ */
221
+ issues: Schema.optionalKey(Schema.Array(Schema.Struct({
222
+ /** The path into the decoded value, as the schema walked it. */
223
+ path: Schema.Array(Schema.Union([Schema.String, Schema.Number])),
224
+ /** What the schema said about that path. */
225
+ message: Schema.String
226
+ })))
207
227
  }) {
208
228
  /** The one actionable line `SuiError.describe` produces for this error. */
209
229
  get message() {
210
230
  return describe(this);
211
231
  }
212
232
  }
233
+ const standardIssues = SchemaIssue.makeFormatterStandardSchemaV1();
234
+ /**
235
+ * The **first** issue of a `SchemaError`'s formatted message, which is what
236
+ * {@link DecodeError}'s `issue` has always carried.
237
+ *
238
+ * The producers decode with `{ errors: "all" }` so `issues` can carry every
239
+ * path, and the formatter joins those issues with a newline — which turned
240
+ * `error.message` into a paragraph. `issue` is one sentence for a human and
241
+ * its shape is part of what 0.1.2 shipped, so it is cut back to the first
242
+ * issue's block: the message plus the indented `at [...]` line the formatter
243
+ * puts under it. A single-issue failure has no second block, so it comes
244
+ * through byte for byte. Never fails.
245
+ */
246
+ const firstIssue = (message) => {
247
+ const lines = message.split("\n");
248
+ // A continuation line of the same issue is indented; the next issue starts
249
+ // at column zero.
250
+ const next = lines.findIndex((line, index) => index > 0 && !line.startsWith(" "));
251
+ return next === -1 ? message : lines.slice(0, next).join("\n");
252
+ };
253
+ /**
254
+ * The `DecodeError` payload a failed decode deserves: the first issue as the
255
+ * sentence `issue` has always been, and every issue as `{ path, message }`.
256
+ *
257
+ * `SchemaError.issue` is a tree; the second half is Effect's own
258
+ * Standard-Schema formatter over it, so the paths are the ones every other
259
+ * tool prints. A decode run with `{ errors: "all" }` reports every field
260
+ * rather than the first. Never fails.
261
+ */
262
+ export const decodePayload = (error) => ({ issue: firstIssue(error.message), issues: decodeIssues(error) });
263
+ const decodeIssues = (error) => standardIssues(error.issue).issues.map((issue) => ({
264
+ path: (issue.path ?? []).map((segment) => {
265
+ const key = Predicate.isObject(segment) ? segment["key"] : segment;
266
+ return typeof key === "number" ? key : String(key);
267
+ }),
268
+ message: issue.message
269
+ }));
213
270
  /** Simulation reported an execution failure. No gas was charged. */
214
271
  export class SimulationFailed extends Schema.TaggedError()("SimulationFailed", {
215
272
  reason: ExecutionReason,
@@ -220,7 +277,7 @@ export class SimulationFailed extends Schema.TaggedError()("SimulationFailed", {
220
277
  export class ExecutionFailed extends Schema.TaggedError()("ExecutionFailed", {
221
278
  digest: Digest,
222
279
  reason: ExecutionReason,
223
- command: Schema.optional(Schema.Number),
280
+ command: Schema.optional(Schema.Finite),
224
281
  effects: TransactionEffects
225
282
  }) {
226
283
  /** The one actionable line `SuiError.describe` produces for this error. */
@@ -362,31 +419,27 @@ export const SuiErrorSchema = Schema.Union([
362
419
  GraphQLUnavailable,
363
420
  ExtensionNotReady
364
421
  ]);
422
+ /**
423
+ * {@link SuiErrorSchema} as a tagged union, which is what makes the tag list
424
+ * derivable: `.cases` is keyed by `_tag`, so nothing has to repeat it.
425
+ *
426
+ * Not exported — `SuiErrorSchema` is the published shape and this is how the
427
+ * library reads its own keys.
428
+ */
429
+ const SuiErrorTagged = SuiErrorSchema.pipe(Schema.toTaggedUnion("_tag"));
365
430
  const OutcomeSchema = Schema.Literals(["applied", "not_applied", "unknown"]);
366
431
  const isHasOutcome = Schema.is(Schema.Struct({ outcome: OutcomeSchema }));
367
432
  const hasOutcome = (error) => isHasOutcome(error);
368
433
  const isRetryable = (error) => error._tag === "TransportError" ? error.retryable : false;
369
- /** Every tag the taxonomy owns, so a foreign tag can be told from one of ours. */
370
- const TAXONOMY_TAGS = new Set([
371
- "TransportError",
372
- "ObjectNotFound",
373
- "ObjectDeleted",
374
- "ObjectUnavailable",
375
- "TransactionNotFound",
376
- "NetworkMismatch",
377
- "DecodeError",
378
- "SimulationFailed",
379
- "ExecutionFailed",
380
- "SubmissionUnknown",
381
- "NotApplied",
382
- "SigningError",
383
- "BuildError",
384
- "PolicyDenied",
385
- "JournalError",
386
- "UnexpectedEffects",
387
- "GraphQLUnavailable",
388
- "ExtensionNotReady"
389
- ]);
434
+ /**
435
+ * Every tag the taxonomy owns, so a foreign tag can be told from one of ours.
436
+ *
437
+ * Derived from {@link SuiErrorSchema} rather than written out: a hand-kept copy
438
+ * of the tag list is one edit that can be forgotten, and forgetting it here
439
+ * used to mean an error the library defines being classified as somebody
440
+ * else's. Adding a class to the union adds its tag here.
441
+ */
442
+ const TAXONOMY_TAGS = new Set(Object.keys(SuiErrorTagged.cases));
390
443
  /**
391
444
  * What a failure says about the transaction it came from.
392
445
  *
@@ -558,9 +611,7 @@ const encodeThroughOwnSchema = (error) => {
558
611
  if (!Result.isSuccess(encoded))
559
612
  return undefined;
560
613
  const value = encoded.success;
561
- return typeof value === "object" && value !== null
562
- ? value
563
- : undefined;
614
+ return Predicate.isObject(value) ? value : undefined;
564
615
  };
565
616
  /**
566
617
  * The `outcome` of an error that declares one, when the encoded JSON has lost
@@ -583,6 +634,22 @@ const withOutcome = (error, json) => {
583
634
  ? { ...json, outcome: value }
584
635
  : json;
585
636
  };
637
+ /**
638
+ * The human sentence, in the same key for every error.
639
+ *
640
+ * Fifteen of the eighteen taxonomy classes carry `message` as an
641
+ * `override get message()` rather than as a schema field, and a getter stays
642
+ * out of the encoding — so a JSON log line had a sentence for three tags and
643
+ * none for the rest, and an operator had to special-case them. This adds it
644
+ * when the encoding did not produce one. Additive: a decoder ignores the
645
+ * excess key, so every round trip still holds. Never fails.
646
+ */
647
+ const withMessage = (json, sentence) => {
648
+ if (typeof json["message"] === "string" && json["message"].length > 0)
649
+ return json;
650
+ const value = sentence();
651
+ return value === undefined || value.length === 0 ? json : { ...json, message: value };
652
+ };
586
653
  /**
587
654
  * The JSON an operator or a log line gets for a failure.
588
655
  *
@@ -598,16 +665,27 @@ const withOutcome = (error, json) => {
598
665
  * wrapper script acts on, and losing it in the log while `Script.exitCode` saw
599
666
  * it was the one inconsistency in the serialization.
600
667
  *
668
+ * **`message` is always there too**, for the same reason: fifteen of the
669
+ * eighteen taxonomy classes carry it as a getter, which stays out of the
670
+ * encoding, so a log line had a sentence for three tags and nothing for the
671
+ * rest. A taxonomy error gets {@link describe}; an extension error gets its own
672
+ * `.message` when it is a non-empty string. Added only when the encoding
673
+ * produced none, and ignored on decode, so nothing round-trips differently.
674
+ *
601
675
  * Never fails.
602
676
  */
603
677
  const toJson = (error) => {
604
678
  const encoded = encode(error);
605
679
  if (Result.isSuccess(encoded)) {
606
- return withOutcome(error, encoded.success);
680
+ return withMessage(withOutcome(error, encoded.success), () => describe(error));
607
681
  }
608
682
  const own = encodeThroughOwnSchema(error);
609
- if (own !== undefined)
610
- return withOutcome(error, own);
683
+ if (own !== undefined) {
684
+ return withMessage(withOutcome(error, own), () => {
685
+ const value = error.message;
686
+ return typeof value === "string" && value.length > 0 ? value : undefined;
687
+ });
688
+ }
611
689
  const message = TAXONOMY_TAGS.has(error._tag)
612
690
  ? describe(error)
613
691
  : causeLine(error) ?? error._tag;
@@ -630,6 +708,12 @@ const isTaxonomy = (error) => {
630
708
  * The helpers every repo hand-rolls: is this worth retrying, did the
631
709
  * transaction land, is it even one of ours, what does an operator need to read,
632
710
  * and what goes in a log.
711
+ *
712
+ * For *branching* on a failure, the taxonomy is a flat tagged union, so
713
+ * `Effect.catchTags({ ObjectNotFound: ..., TransportError: ... })` in the error
714
+ * channel and `Match.tagsExhaustive` over a `SuiError` value both work and are
715
+ * the two documented consumer idioms; these helpers are for the questions that
716
+ * are the same whatever the tag is.
633
717
  */
634
718
  export const SuiError = {
635
719
  isRetryable,