@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/LLMS.md CHANGED
@@ -2880,13 +2880,18 @@ export type SignatureScheme = "ED25519" | "Secp256k1" | "Secp256r1" | "MultiSig"
2880
2880
 
2881
2881
  The signature schemes a `Signer` built by this module can carry.
2882
2882
 
2883
- ### `Signed` (type)
2883
+ ### `Signed` (interface)
2884
2884
 
2885
2885
  ```ts
2886
- export type Signed = SignedTransaction;
2886
+ export interface Signed extends SignedTransaction {
2887
+ }
2887
2888
  ```
2888
2889
 
2889
- Signed bytes: everything `executeTransaction` needs, plus what `reconcile` needs.
2890
+ Signed bytes: everything `executeTransaction` needs, plus what `reconcile`
2891
+ needs.
2892
+
2893
+ An interface rather than a type alias so the name survives into `.d.ts`,
2894
+ editor hover and `LLMS.md`; structurally it is `SignedTransaction`.
2890
2895
 
2891
2896
  ### `Signer` (interface)
2892
2897
 
@@ -2922,16 +2927,11 @@ caller's error union does not grow a branch per credential kind.
2922
2927
  ```ts
2923
2928
  declare const SubmitConfig: Context.Reference<SubmitConfigService> & {
2924
2929
  defaults: SubmitConfigService;
2930
+ layer: (overrides: Partial<SubmitConfigService>) => Layer.Layer<never>;
2931
+ with: (overrides: Partial<SubmitConfigService>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
2925
2932
  }
2926
2933
  ```
2927
2934
 
2928
- The lifecycle settings.
2929
-
2930
- Because this is a `Context.Reference` and not a service, it never appears in
2931
- an `R`: a one-shot script gets the defaults with no wiring, and an
2932
- application overrides what it cares about with
2933
- `Effect.provideService(effect, SubmitConfig, { ...SubmitConfig.defaults, validFor: "30 seconds" })`.
2934
-
2935
2935
  ### `SubmitConfigService` (interface)
2936
2936
 
2937
2937
  ```ts
@@ -3096,412 +3096,17 @@ declare const Tx: {
3096
3096
  readonly build: (input: Transaction | Recipe, opts: {
3097
3097
  readonly sender: SuiAddress;
3098
3098
  readonly gasOwner?: SuiAddress;
3099
- }) => Effect.Effect<{
3100
- readonly digest: Digest;
3101
- readonly sender: SuiAddress;
3102
- readonly bytes: Uint8Array<ArrayBufferLike>;
3103
- readonly chain?: string | undefined;
3104
- readonly expiration?: {
3105
- readonly $kind: "None";
3106
- readonly None: true;
3107
- } | {
3108
- readonly $kind: "Epoch";
3109
- readonly Epoch: bigint;
3110
- } | {
3111
- readonly $kind: "ValidDuring";
3112
- readonly ValidDuring: {
3113
- readonly minEpoch: bigint | null;
3114
- readonly maxEpoch: bigint | null;
3115
- readonly minTimestamp: bigint | null;
3116
- readonly maxTimestamp: bigint | null;
3117
- readonly chain: string;
3118
- readonly nonce: number;
3119
- };
3120
- } | {
3121
- readonly $kind: "Validity";
3122
- readonly Validity: {
3123
- readonly allowedProposers: {
3124
- readonly epoch: bigint;
3125
- readonly proposers: readonly number[];
3126
- } | null;
3127
- readonly minEpoch: bigint | null;
3128
- readonly maxEpoch: bigint | null;
3129
- readonly minTimestamp: bigint | null;
3130
- readonly maxTimestamp: bigint | null;
3131
- readonly chain: string;
3132
- readonly nonce: number;
3133
- };
3134
- } | undefined;
3135
- readonly gasOwner?: SuiAddress | undefined;
3136
- }, TransportError | SimulationFailed | BuildError, Sui>;
3137
- readonly sign: (built: {
3138
- readonly digest: Digest;
3139
- readonly sender: SuiAddress;
3140
- readonly bytes: Uint8Array<ArrayBufferLike>;
3141
- readonly chain?: string | undefined;
3142
- readonly expiration?: {
3143
- readonly $kind: "None";
3144
- readonly None: true;
3145
- } | {
3146
- readonly $kind: "Epoch";
3147
- readonly Epoch: bigint;
3148
- } | {
3149
- readonly $kind: "ValidDuring";
3150
- readonly ValidDuring: {
3151
- readonly minEpoch: bigint | null;
3152
- readonly maxEpoch: bigint | null;
3153
- readonly minTimestamp: bigint | null;
3154
- readonly maxTimestamp: bigint | null;
3155
- readonly chain: string;
3156
- readonly nonce: number;
3157
- };
3158
- } | {
3159
- readonly $kind: "Validity";
3160
- readonly Validity: {
3161
- readonly allowedProposers: {
3162
- readonly epoch: bigint;
3163
- readonly proposers: readonly number[];
3164
- } | null;
3165
- readonly minEpoch: bigint | null;
3166
- readonly maxEpoch: bigint | null;
3167
- readonly minTimestamp: bigint | null;
3168
- readonly maxTimestamp: bigint | null;
3169
- readonly chain: string;
3170
- readonly nonce: number;
3171
- };
3172
- } | undefined;
3173
- readonly gasOwner?: SuiAddress | undefined;
3174
- }, signer: Signer) => Effect.Effect<{
3175
- readonly digest: Digest;
3176
- readonly sender: SuiAddress;
3177
- readonly signatures: readonly Signature[];
3178
- readonly bytes: Uint8Array<ArrayBufferLike>;
3179
- readonly chain?: string | undefined;
3180
- readonly expiration?: {
3181
- readonly $kind: "None";
3182
- readonly None: true;
3183
- } | {
3184
- readonly $kind: "Epoch";
3185
- readonly Epoch: bigint;
3186
- } | {
3187
- readonly $kind: "ValidDuring";
3188
- readonly ValidDuring: {
3189
- readonly minEpoch: bigint | null;
3190
- readonly maxEpoch: bigint | null;
3191
- readonly minTimestamp: bigint | null;
3192
- readonly maxTimestamp: bigint | null;
3193
- readonly chain: string;
3194
- readonly nonce: number;
3195
- };
3196
- } | {
3197
- readonly $kind: "Validity";
3198
- readonly Validity: {
3199
- readonly allowedProposers: {
3200
- readonly epoch: bigint;
3201
- readonly proposers: readonly number[];
3202
- } | null;
3203
- readonly minEpoch: bigint | null;
3204
- readonly maxEpoch: bigint | null;
3205
- readonly minTimestamp: bigint | null;
3206
- readonly maxTimestamp: bigint | null;
3207
- readonly chain: string;
3208
- readonly nonce: number;
3209
- };
3210
- } | undefined;
3211
- }, SigningError, never>;
3212
- readonly cosign: (signed: {
3213
- readonly digest: Digest;
3214
- readonly sender: SuiAddress;
3215
- readonly signatures: readonly Signature[];
3216
- readonly bytes: Uint8Array<ArrayBufferLike>;
3217
- readonly chain?: string | undefined;
3218
- readonly expiration?: {
3219
- readonly $kind: "None";
3220
- readonly None: true;
3221
- } | {
3222
- readonly $kind: "Epoch";
3223
- readonly Epoch: bigint;
3224
- } | {
3225
- readonly $kind: "ValidDuring";
3226
- readonly ValidDuring: {
3227
- readonly minEpoch: bigint | null;
3228
- readonly maxEpoch: bigint | null;
3229
- readonly minTimestamp: bigint | null;
3230
- readonly maxTimestamp: bigint | null;
3231
- readonly chain: string;
3232
- readonly nonce: number;
3233
- };
3234
- } | {
3235
- readonly $kind: "Validity";
3236
- readonly Validity: {
3237
- readonly allowedProposers: {
3238
- readonly epoch: bigint;
3239
- readonly proposers: readonly number[];
3240
- } | null;
3241
- readonly minEpoch: bigint | null;
3242
- readonly maxEpoch: bigint | null;
3243
- readonly minTimestamp: bigint | null;
3244
- readonly maxTimestamp: bigint | null;
3245
- readonly chain: string;
3246
- readonly nonce: number;
3247
- };
3248
- } | undefined;
3249
- }, signer: Signer) => Effect.Effect<{
3250
- readonly digest: Digest;
3251
- readonly sender: SuiAddress;
3252
- readonly signatures: readonly Signature[];
3253
- readonly bytes: Uint8Array<ArrayBufferLike>;
3254
- readonly chain?: string | undefined;
3255
- readonly expiration?: {
3256
- readonly $kind: "None";
3257
- readonly None: true;
3258
- } | {
3259
- readonly $kind: "Epoch";
3260
- readonly Epoch: bigint;
3261
- } | {
3262
- readonly $kind: "ValidDuring";
3263
- readonly ValidDuring: {
3264
- readonly minEpoch: bigint | null;
3265
- readonly maxEpoch: bigint | null;
3266
- readonly minTimestamp: bigint | null;
3267
- readonly maxTimestamp: bigint | null;
3268
- readonly chain: string;
3269
- readonly nonce: number;
3270
- };
3271
- } | {
3272
- readonly $kind: "Validity";
3273
- readonly Validity: {
3274
- readonly allowedProposers: {
3275
- readonly epoch: bigint;
3276
- readonly proposers: readonly number[];
3277
- } | null;
3278
- readonly minEpoch: bigint | null;
3279
- readonly maxEpoch: bigint | null;
3280
- readonly minTimestamp: bigint | null;
3281
- readonly maxTimestamp: bigint | null;
3282
- readonly chain: string;
3283
- readonly nonce: number;
3284
- };
3285
- } | undefined;
3286
- }, SigningError, never>;
3099
+ }) => Effect.Effect<Built, TransportError | SimulationFailed | BuildError, Sui>;
3100
+ readonly sign: (built: Built, signer: Signer) => Effect.Effect<Signed, SigningError, never>;
3101
+ readonly cosign: (signed: Signed, signer: Signer) => Effect.Effect<Signed, SigningError, never>;
3287
3102
  readonly sponsored: (opts: {
3288
3103
  readonly sender: SuiAddress;
3289
3104
  readonly gasOwner: SuiAddress;
3290
3105
  }) => (recipe: Recipe) => Recipe;
3291
3106
  readonly submit: (signed: Signed) => Effect.Effect<Executed, SubmitError, Sui>;
3292
- readonly submitVia: <E, R>(signed: {
3293
- readonly digest: Digest;
3294
- readonly sender: SuiAddress;
3295
- readonly signatures: readonly Signature[];
3296
- readonly bytes: Uint8Array<ArrayBufferLike>;
3297
- readonly chain?: string | undefined;
3298
- readonly expiration?: {
3299
- readonly $kind: "None";
3300
- readonly None: true;
3301
- } | {
3302
- readonly $kind: "Epoch";
3303
- readonly Epoch: bigint;
3304
- } | {
3305
- readonly $kind: "ValidDuring";
3306
- readonly ValidDuring: {
3307
- readonly minEpoch: bigint | null;
3308
- readonly maxEpoch: bigint | null;
3309
- readonly minTimestamp: bigint | null;
3310
- readonly maxTimestamp: bigint | null;
3311
- readonly chain: string;
3312
- readonly nonce: number;
3313
- };
3314
- } | {
3315
- readonly $kind: "Validity";
3316
- readonly Validity: {
3317
- readonly allowedProposers: {
3318
- readonly epoch: bigint;
3319
- readonly proposers: readonly number[];
3320
- } | null;
3321
- readonly minEpoch: bigint | null;
3322
- readonly maxEpoch: bigint | null;
3323
- readonly minTimestamp: bigint | null;
3324
- readonly maxTimestamp: bigint | null;
3325
- readonly chain: string;
3326
- readonly nonce: number;
3327
- };
3328
- } | undefined;
3329
- }, send: (bytes: Uint8Array, signatures: ReadonlyArray<Signature>) => Effect.Effect<SubmitViaReply, E, R>) => Effect.Effect<Executed, SubmitViaError | E, Sui | R>;
3107
+ readonly submitVia: <E, R>(signed: Signed, send: (bytes: Uint8Array, signatures: ReadonlyArray<Signature>) => Effect.Effect<SubmitViaReply, E, R>) => Effect.Effect<Executed, SubmitViaError | E, Sui | R>;
3330
3108
  readonly reconcile: (input: ReconcileInput) => Effect.Effect<Executed, TransportError | ExecutionFailed | SubmissionUnknown | NotApplied, Sui>;
3331
- readonly recorded: (digest: Digest => Effect.Effect<Option.Option<{
3332
- readonly _tag: "Unknown";
3333
- readonly digest: Digest;
3334
- readonly signed: {
3335
- readonly digest: Digest;
3336
- readonly sender: SuiAddress;
3337
- readonly signatures: readonly Signature[];
3338
- readonly bytes: Uint8Array<ArrayBufferLike>;
3339
- readonly chain?: string | undefined;
3340
- readonly expiration?: {
3341
- readonly $kind: "None";
3342
- readonly None: true;
3343
- } | {
3344
- readonly $kind: "Epoch";
3345
- readonly Epoch: bigint;
3346
- } | {
3347
- readonly $kind: "ValidDuring";
3348
- readonly ValidDuring: {
3349
- readonly minEpoch: bigint | null;
3350
- readonly maxEpoch: bigint | null;
3351
- readonly minTimestamp: bigint | null;
3352
- readonly maxTimestamp: bigint | null;
3353
- readonly chain: string;
3354
- readonly nonce: number;
3355
- };
3356
- } | {
3357
- readonly $kind: "Validity";
3358
- readonly Validity: {
3359
- readonly allowedProposers: {
3360
- readonly epoch: bigint;
3361
- readonly proposers: readonly number[];
3362
- } | null;
3363
- readonly minEpoch: bigint | null;
3364
- readonly maxEpoch: bigint | null;
3365
- readonly minTimestamp: bigint | null;
3366
- readonly maxTimestamp: bigint | null;
3367
- readonly chain: string;
3368
- readonly nonce: number;
3369
- };
3370
- } | undefined;
3371
- };
3372
- readonly lastError: string;
3373
- readonly attempts: number;
3374
- readonly at: DateTime.Utc;
3375
- } | {
3376
- readonly _tag: "NotApplied";
3377
- readonly digest: Digest;
3378
- readonly evidence: "expired" | "inputConsumed";
3379
- readonly at: DateTime.Utc;
3380
- } | {
3381
- readonly _tag: "Signed";
3382
- readonly digest: Digest;
3383
- readonly signed: {
3384
- readonly digest: Digest;
3385
- readonly sender: SuiAddress;
3386
- readonly signatures: readonly Signature[];
3387
- readonly bytes: Uint8Array<ArrayBufferLike>;
3388
- readonly chain?: string | undefined;
3389
- readonly expiration?: {
3390
- readonly $kind: "None";
3391
- readonly None: true;
3392
- } | {
3393
- readonly $kind: "Epoch";
3394
- readonly Epoch: bigint;
3395
- } | {
3396
- readonly $kind: "ValidDuring";
3397
- readonly ValidDuring: {
3398
- readonly minEpoch: bigint | null;
3399
- readonly maxEpoch: bigint | null;
3400
- readonly minTimestamp: bigint | null;
3401
- readonly maxTimestamp: bigint | null;
3402
- readonly chain: string;
3403
- readonly nonce: number;
3404
- };
3405
- } | {
3406
- readonly $kind: "Validity";
3407
- readonly Validity: {
3408
- readonly allowedProposers: {
3409
- readonly epoch: bigint;
3410
- readonly proposers: readonly number[];
3411
- } | null;
3412
- readonly minEpoch: bigint | null;
3413
- readonly maxEpoch: bigint | null;
3414
- readonly minTimestamp: bigint | null;
3415
- readonly maxTimestamp: bigint | null;
3416
- readonly chain: string;
3417
- readonly nonce: number;
3418
- };
3419
- } | undefined;
3420
- };
3421
- readonly signedAt: DateTime.Utc;
3422
- } | {
3423
- readonly at: DateTime.Utc;
3424
- readonly digest: Digest;
3425
- readonly _tag: "Executed";
3426
- readonly checkpoint?: bigint | undefined;
3427
- } | {
3428
- readonly _tag: "Failed";
3429
- readonly digest: Digest;
3430
- readonly reason: {
3431
- readonly $kind: "MoveAbort";
3432
- readonly MoveAbort: {
3433
- readonly abortCode: bigint;
3434
- readonly location?: {
3435
- readonly function?: number | undefined;
3436
- readonly package?: string | undefined;
3437
- readonly module?: string | undefined;
3438
- readonly functionName?: string | undefined;
3439
- readonly instruction?: number | undefined;
3440
- } | undefined;
3441
- readonly cleverError?: {
3442
- readonly value?: string | undefined;
3443
- readonly errorCode?: number | undefined;
3444
- readonly lineNumber?: number | undefined;
3445
- readonly constantName?: string | undefined;
3446
- readonly constantType?: string | undefined;
3447
- } | undefined;
3448
- };
3449
- } | {
3450
- readonly $kind: "SizeError";
3451
- readonly SizeError: {
3452
- readonly name: string;
3453
- readonly size: number;
3454
- readonly maxSize: number;
3455
- };
3456
- } | {
3457
- readonly $kind: "CommandArgumentError";
3458
- readonly CommandArgumentError: {
3459
- readonly argument: number;
3460
- readonly name: string;
3461
- };
3462
- } | {
3463
- readonly $kind: "TypeArgumentError";
3464
- readonly TypeArgumentError: {
3465
- readonly typeArgument: number;
3466
- readonly name: string;
3467
- };
3468
- } | {
3469
- readonly $kind: "PackageUpgradeError";
3470
- readonly PackageUpgradeError: {
3471
- readonly name: string;
3472
- readonly digest?: string | undefined;
3473
- readonly packageId?: string | undefined;
3474
- };
3475
- } | {
3476
- readonly $kind: "IndexError";
3477
- readonly IndexError: {
3478
- readonly index?: number | undefined;
3479
- readonly subresult?: number | undefined;
3480
- };
3481
- } | {
3482
- readonly $kind: "CoinDenyListError";
3483
- readonly CoinDenyListError: {
3484
- readonly coinType: string;
3485
- readonly name: string;
3486
- readonly address?: string | undefined;
3487
- };
3488
- } | {
3489
- readonly $kind: "CongestedObjects";
3490
- readonly CongestedObjects: {
3491
- readonly name: string;
3492
- readonly objects: readonly string[];
3493
- };
3494
- } | {
3495
- readonly $kind: "ObjectIdError";
3496
- readonly ObjectIdError: {
3497
- readonly objectId: string;
3498
- readonly name?: string | undefined;
3499
- };
3500
- } | {
3501
- readonly $kind: "Unknown";
3502
- };
3503
- readonly at: DateTime.Utc;
3504
- }>, JournalError, never>;
3109
+ readonly recorded: (digest: Digest) => Effect.Effect<Option.Option<JournalEntry>, JournalError, never>;
3505
3110
  readonly run: (recipe: Transaction | Recipe, opts: {
3506
3111
  readonly signer: Signer;
3507
3112
  readonly gasOwner?: SuiAddress;
@@ -3567,44 +3172,7 @@ The tags whose entries still need an answer from the network.
3567
3172
  declare const build: (input: Transaction | Recipe, opts: {
3568
3173
  readonly sender: SuiAddress;
3569
3174
  readonly gasOwner?: SuiAddress;
3570
- }) => Effect.Effect<{
3571
- readonly digest: Digest;
3572
- readonly sender: SuiAddress;
3573
- readonly bytes: Uint8Array<ArrayBufferLike>;
3574
- readonly chain?: string | undefined;
3575
- readonly expiration?: {
3576
- readonly $kind: "None";
3577
- readonly None: true;
3578
- } | {
3579
- readonly $kind: "Epoch";
3580
- readonly Epoch: bigint;
3581
- } | {
3582
- readonly $kind: "ValidDuring";
3583
- readonly ValidDuring: {
3584
- readonly minEpoch: bigint | null;
3585
- readonly maxEpoch: bigint | null;
3586
- readonly minTimestamp: bigint | null;
3587
- readonly maxTimestamp: bigint | null;
3588
- readonly chain: string;
3589
- readonly nonce: number;
3590
- };
3591
- } | {
3592
- readonly $kind: "Validity";
3593
- readonly Validity: {
3594
- readonly allowedProposers: {
3595
- readonly epoch: bigint;
3596
- readonly proposers: readonly number[];
3597
- } | null;
3598
- readonly minEpoch: bigint | null;
3599
- readonly maxEpoch: bigint | null;
3600
- readonly minTimestamp: bigint | null;
3601
- readonly maxTimestamp: bigint | null;
3602
- readonly chain: string;
3603
- readonly nonce: number;
3604
- };
3605
- } | undefined;
3606
- readonly gasOwner?: SuiAddress | undefined;
3607
- }, TransportError | SimulationFailed | BuildError, Sui>
3175
+ }) => Effect.Effect<Built, TransportError | SimulationFailed | BuildError, Sui>
3608
3176
  ```
3609
3177
 
3610
3178
  Builds a transaction into signable bytes.
@@ -3645,81 +3213,7 @@ Re-exported from `@unconfirmed/sui-effect`.
3645
3213
  ### `cosign` (const)
3646
3214
 
3647
3215
  ```ts
3648
- declare const cosign: (signed: {
3649
- readonly digest: Digest;
3650
- readonly sender: SuiAddress;
3651
- readonly signatures: readonly Signature[];
3652
- readonly bytes: Uint8Array<ArrayBufferLike>;
3653
- readonly chain?: string | undefined;
3654
- readonly expiration?: {
3655
- readonly $kind: "None";
3656
- readonly None: true;
3657
- } | {
3658
- readonly $kind: "Epoch";
3659
- readonly Epoch: bigint;
3660
- } | {
3661
- readonly $kind: "ValidDuring";
3662
- readonly ValidDuring: {
3663
- readonly minEpoch: bigint | null;
3664
- readonly maxEpoch: bigint | null;
3665
- readonly minTimestamp: bigint | null;
3666
- readonly maxTimestamp: bigint | null;
3667
- readonly chain: string;
3668
- readonly nonce: number;
3669
- };
3670
- } | {
3671
- readonly $kind: "Validity";
3672
- readonly Validity: {
3673
- readonly allowedProposers: {
3674
- readonly epoch: bigint;
3675
- readonly proposers: readonly number[];
3676
- } | null;
3677
- readonly minEpoch: bigint | null;
3678
- readonly maxEpoch: bigint | null;
3679
- readonly minTimestamp: bigint | null;
3680
- readonly maxTimestamp: bigint | null;
3681
- readonly chain: string;
3682
- readonly nonce: number;
3683
- };
3684
- } | undefined;
3685
- }, signer: Signer) => Effect.Effect<{
3686
- readonly digest: Digest;
3687
- readonly sender: SuiAddress;
3688
- readonly signatures: readonly Signature[];
3689
- readonly bytes: Uint8Array<ArrayBufferLike>;
3690
- readonly chain?: string | undefined;
3691
- readonly expiration?: {
3692
- readonly $kind: "None";
3693
- readonly None: true;
3694
- } | {
3695
- readonly $kind: "Epoch";
3696
- readonly Epoch: bigint;
3697
- } | {
3698
- readonly $kind: "ValidDuring";
3699
- readonly ValidDuring: {
3700
- readonly minEpoch: bigint | null;
3701
- readonly maxEpoch: bigint | null;
3702
- readonly minTimestamp: bigint | null;
3703
- readonly maxTimestamp: bigint | null;
3704
- readonly chain: string;
3705
- readonly nonce: number;
3706
- };
3707
- } | {
3708
- readonly $kind: "Validity";
3709
- readonly Validity: {
3710
- readonly allowedProposers: {
3711
- readonly epoch: bigint;
3712
- readonly proposers: readonly number[];
3713
- } | null;
3714
- readonly minEpoch: bigint | null;
3715
- readonly maxEpoch: bigint | null;
3716
- readonly minTimestamp: bigint | null;
3717
- readonly maxTimestamp: bigint | null;
3718
- readonly chain: string;
3719
- readonly nonce: number;
3720
- };
3721
- } | undefined;
3722
- }, SigningError, never>
3216
+ declare const cosign: (signed: Signed, signer: Signer) => Effect.Effect<Signed, SigningError, never>
3723
3217
  ```
3724
3218
 
3725
3219
  Adds one more signature to already signed bytes, for a sponsored or
@@ -4204,180 +3698,7 @@ the same rule `Tx.submit` follows.
4204
3698
  ### `recorded` (const)
4205
3699
 
4206
3700
  ```ts
4207
- declare const recorded: (digest: Digest => Effect.Effect<Option.Option<{
4208
- readonly _tag: "Unknown";
4209
- readonly digest: Digest;
4210
- readonly signed: {
4211
- readonly digest: Digest;
4212
- readonly sender: SuiAddress;
4213
- readonly signatures: readonly Signature[];
4214
- readonly bytes: Uint8Array<ArrayBufferLike>;
4215
- readonly chain?: string | undefined;
4216
- readonly expiration?: {
4217
- readonly $kind: "None";
4218
- readonly None: true;
4219
- } | {
4220
- readonly $kind: "Epoch";
4221
- readonly Epoch: bigint;
4222
- } | {
4223
- readonly $kind: "ValidDuring";
4224
- readonly ValidDuring: {
4225
- readonly minEpoch: bigint | null;
4226
- readonly maxEpoch: bigint | null;
4227
- readonly minTimestamp: bigint | null;
4228
- readonly maxTimestamp: bigint | null;
4229
- readonly chain: string;
4230
- readonly nonce: number;
4231
- };
4232
- } | {
4233
- readonly $kind: "Validity";
4234
- readonly Validity: {
4235
- readonly allowedProposers: {
4236
- readonly epoch: bigint;
4237
- readonly proposers: readonly number[];
4238
- } | null;
4239
- readonly minEpoch: bigint | null;
4240
- readonly maxEpoch: bigint | null;
4241
- readonly minTimestamp: bigint | null;
4242
- readonly maxTimestamp: bigint | null;
4243
- readonly chain: string;
4244
- readonly nonce: number;
4245
- };
4246
- } | undefined;
4247
- };
4248
- readonly lastError: string;
4249
- readonly attempts: number;
4250
- readonly at: DateTime.Utc;
4251
- } | {
4252
- readonly _tag: "NotApplied";
4253
- readonly digest: Digest;
4254
- readonly evidence: "expired" | "inputConsumed";
4255
- readonly at: DateTime.Utc;
4256
- } | {
4257
- readonly _tag: "Signed";
4258
- readonly digest: Digest;
4259
- readonly signed: {
4260
- readonly digest: Digest;
4261
- readonly sender: SuiAddress;
4262
- readonly signatures: readonly Signature[];
4263
- readonly bytes: Uint8Array<ArrayBufferLike>;
4264
- readonly chain?: string | undefined;
4265
- readonly expiration?: {
4266
- readonly $kind: "None";
4267
- readonly None: true;
4268
- } | {
4269
- readonly $kind: "Epoch";
4270
- readonly Epoch: bigint;
4271
- } | {
4272
- readonly $kind: "ValidDuring";
4273
- readonly ValidDuring: {
4274
- readonly minEpoch: bigint | null;
4275
- readonly maxEpoch: bigint | null;
4276
- readonly minTimestamp: bigint | null;
4277
- readonly maxTimestamp: bigint | null;
4278
- readonly chain: string;
4279
- readonly nonce: number;
4280
- };
4281
- } | {
4282
- readonly $kind: "Validity";
4283
- readonly Validity: {
4284
- readonly allowedProposers: {
4285
- readonly epoch: bigint;
4286
- readonly proposers: readonly number[];
4287
- } | null;
4288
- readonly minEpoch: bigint | null;
4289
- readonly maxEpoch: bigint | null;
4290
- readonly minTimestamp: bigint | null;
4291
- readonly maxTimestamp: bigint | null;
4292
- readonly chain: string;
4293
- readonly nonce: number;
4294
- };
4295
- } | undefined;
4296
- };
4297
- readonly signedAt: DateTime.Utc;
4298
- } | {
4299
- readonly at: DateTime.Utc;
4300
- readonly digest: Digest;
4301
- readonly _tag: "Executed";
4302
- readonly checkpoint?: bigint | undefined;
4303
- } | {
4304
- readonly _tag: "Failed";
4305
- readonly digest: Digest;
4306
- readonly reason: {
4307
- readonly $kind: "MoveAbort";
4308
- readonly MoveAbort: {
4309
- readonly abortCode: bigint;
4310
- readonly location?: {
4311
- readonly function?: number | undefined;
4312
- readonly package?: string | undefined;
4313
- readonly module?: string | undefined;
4314
- readonly functionName?: string | undefined;
4315
- readonly instruction?: number | undefined;
4316
- } | undefined;
4317
- readonly cleverError?: {
4318
- readonly value?: string | undefined;
4319
- readonly errorCode?: number | undefined;
4320
- readonly lineNumber?: number | undefined;
4321
- readonly constantName?: string | undefined;
4322
- readonly constantType?: string | undefined;
4323
- } | undefined;
4324
- };
4325
- } | {
4326
- readonly $kind: "SizeError";
4327
- readonly SizeError: {
4328
- readonly name: string;
4329
- readonly size: number;
4330
- readonly maxSize: number;
4331
- };
4332
- } | {
4333
- readonly $kind: "CommandArgumentError";
4334
- readonly CommandArgumentError: {
4335
- readonly argument: number;
4336
- readonly name: string;
4337
- };
4338
- } | {
4339
- readonly $kind: "TypeArgumentError";
4340
- readonly TypeArgumentError: {
4341
- readonly typeArgument: number;
4342
- readonly name: string;
4343
- };
4344
- } | {
4345
- readonly $kind: "PackageUpgradeError";
4346
- readonly PackageUpgradeError: {
4347
- readonly name: string;
4348
- readonly digest?: string | undefined;
4349
- readonly packageId?: string | undefined;
4350
- };
4351
- } | {
4352
- readonly $kind: "IndexError";
4353
- readonly IndexError: {
4354
- readonly index?: number | undefined;
4355
- readonly subresult?: number | undefined;
4356
- };
4357
- } | {
4358
- readonly $kind: "CoinDenyListError";
4359
- readonly CoinDenyListError: {
4360
- readonly coinType: string;
4361
- readonly name: string;
4362
- readonly address?: string | undefined;
4363
- };
4364
- } | {
4365
- readonly $kind: "CongestedObjects";
4366
- readonly CongestedObjects: {
4367
- readonly name: string;
4368
- readonly objects: readonly string[];
4369
- };
4370
- } | {
4371
- readonly $kind: "ObjectIdError";
4372
- readonly ObjectIdError: {
4373
- readonly objectId: string;
4374
- readonly name?: string | undefined;
4375
- };
4376
- } | {
4377
- readonly $kind: "Unknown";
4378
- };
4379
- readonly at: DateTime.Utc;
4380
- }>, JournalError, never>
3701
+ declare const recorded: (digest: Digest) => Effect.Effect<Option.Option<JournalEntry>, JournalError, never>
4381
3702
  ```
4382
3703
 
4383
3704
  What the journal recorded for one digest, if anything.
@@ -4490,81 +3811,7 @@ fails the run with nothing sent.
4490
3811
  ### `sign` (const)
4491
3812
 
4492
3813
  ```ts
4493
- declare const sign: (built: {
4494
- readonly digest: Digest;
4495
- readonly sender: SuiAddress;
4496
- readonly bytes: Uint8Array<ArrayBufferLike>;
4497
- readonly chain?: string | undefined;
4498
- readonly expiration?: {
4499
- readonly $kind: "None";
4500
- readonly None: true;
4501
- } | {
4502
- readonly $kind: "Epoch";
4503
- readonly Epoch: bigint;
4504
- } | {
4505
- readonly $kind: "ValidDuring";
4506
- readonly ValidDuring: {
4507
- readonly minEpoch: bigint | null;
4508
- readonly maxEpoch: bigint | null;
4509
- readonly minTimestamp: bigint | null;
4510
- readonly maxTimestamp: bigint | null;
4511
- readonly chain: string;
4512
- readonly nonce: number;
4513
- };
4514
- } | {
4515
- readonly $kind: "Validity";
4516
- readonly Validity: {
4517
- readonly allowedProposers: {
4518
- readonly epoch: bigint;
4519
- readonly proposers: readonly number[];
4520
- } | null;
4521
- readonly minEpoch: bigint | null;
4522
- readonly maxEpoch: bigint | null;
4523
- readonly minTimestamp: bigint | null;
4524
- readonly maxTimestamp: bigint | null;
4525
- readonly chain: string;
4526
- readonly nonce: number;
4527
- };
4528
- } | undefined;
4529
- readonly gasOwner?: SuiAddress | undefined;
4530
- }, signer: Signer) => Effect.Effect<{
4531
- readonly digest: Digest;
4532
- readonly sender: SuiAddress;
4533
- readonly signatures: readonly Signature[];
4534
- readonly bytes: Uint8Array<ArrayBufferLike>;
4535
- readonly chain?: string | undefined;
4536
- readonly expiration?: {
4537
- readonly $kind: "None";
4538
- readonly None: true;
4539
- } | {
4540
- readonly $kind: "Epoch";
4541
- readonly Epoch: bigint;
4542
- } | {
4543
- readonly $kind: "ValidDuring";
4544
- readonly ValidDuring: {
4545
- readonly minEpoch: bigint | null;
4546
- readonly maxEpoch: bigint | null;
4547
- readonly minTimestamp: bigint | null;
4548
- readonly maxTimestamp: bigint | null;
4549
- readonly chain: string;
4550
- readonly nonce: number;
4551
- };
4552
- } | {
4553
- readonly $kind: "Validity";
4554
- readonly Validity: {
4555
- readonly allowedProposers: {
4556
- readonly epoch: bigint;
4557
- readonly proposers: readonly number[];
4558
- } | null;
4559
- readonly minEpoch: bigint | null;
4560
- readonly maxEpoch: bigint | null;
4561
- readonly minTimestamp: bigint | null;
4562
- readonly maxTimestamp: bigint | null;
4563
- readonly chain: string;
4564
- readonly nonce: number;
4565
- };
4566
- } | undefined;
4567
- }, SigningError, never>
3814
+ declare const sign: (built: Built, signer: Signer) => Effect.Effect<Signed, SigningError, never>
4568
3815
  ```
4569
3816
 
4570
3817
  Signs built bytes.
@@ -4631,44 +3878,7 @@ charged `ExecutionFailed` would invite a second submission.
4631
3878
  ### `submitVia` (const)
4632
3879
 
4633
3880
  ```ts
4634
- declare const submitVia: <E, R>(signed: {
4635
- readonly digest: Digest;
4636
- readonly sender: SuiAddress;
4637
- readonly signatures: readonly Signature[];
4638
- readonly bytes: Uint8Array<ArrayBufferLike>;
4639
- readonly chain?: string | undefined;
4640
- readonly expiration?: {
4641
- readonly $kind: "None";
4642
- readonly None: true;
4643
- } | {
4644
- readonly $kind: "Epoch";
4645
- readonly Epoch: bigint;
4646
- } | {
4647
- readonly $kind: "ValidDuring";
4648
- readonly ValidDuring: {
4649
- readonly minEpoch: bigint | null;
4650
- readonly maxEpoch: bigint | null;
4651
- readonly minTimestamp: bigint | null;
4652
- readonly maxTimestamp: bigint | null;
4653
- readonly chain: string;
4654
- readonly nonce: number;
4655
- };
4656
- } | {
4657
- readonly $kind: "Validity";
4658
- readonly Validity: {
4659
- readonly allowedProposers: {
4660
- readonly epoch: bigint;
4661
- readonly proposers: readonly number[];
4662
- } | null;
4663
- readonly minEpoch: bigint | null;
4664
- readonly maxEpoch: bigint | null;
4665
- readonly minTimestamp: bigint | null;
4666
- readonly maxTimestamp: bigint | null;
4667
- readonly chain: string;
4668
- readonly nonce: number;
4669
- };
4670
- } | undefined;
4671
- }, send: (bytes: Uint8Array, signatures: ReadonlyArray<Signature>) => Effect.Effect<SubmitViaReply, E, R>) => Effect.Effect<Executed, SubmitViaError | E, Sui | R>
3881
+ declare const submitVia: <E, R>(signed: Signed, send: (bytes: Uint8Array, signatures: ReadonlyArray<Signature>) => Effect.Effect<SubmitViaReply, E, R>) => Effect.Effect<Executed, SubmitViaError | E, Sui | R>
4672
3882
  ```
4673
3883
 
4674
3884
  Submits through **someone else** — a relay, a sponsorship service, a backend
@@ -6426,22 +5636,12 @@ const SettlementBcs = bcs.struct("Settlement", {
6426
5636
  * needs a real `BcsType` so it can re-serialize what it parsed and reject
6427
5637
  * trailing bytes, and a domain type is not a BCS layout.
6428
5638
  */
6429
- export class Settlement extends Schema.Class<Settlement>("Settlement")({
5639
+ export class Settlement extends Schema.Class<Settlement>("escrow/Settlement")({
6430
5640
  escrowId: ObjectId,
6431
5641
  settledAt: Schema.DateTimeUtc,
6432
5642
  claimedBy: SuiAddress
6433
5643
  }) {}
6434
5644
 
6435
- /**
6436
- * The halfway shape the transformation produces: the domain field names, before
6437
- * `Settlement`'s own schema brands the ids.
6438
- */
6439
- interface SettlementParts {
6440
- readonly escrowId: string
6441
- readonly settledAt: DateTime.Utc
6442
- readonly claimedBy: string
6443
- }
6444
-
6445
5645
  /**
6446
5646
  * The composed codec: BCS bytes to `Settlement`, and back.
6447
5647
  *
@@ -6455,10 +5655,11 @@ interface SettlementParts {
6455
5655
  *
6456
5656
  * Two details worth copying:
6457
5657
  *
6458
- * - **`decode` produces the target's field shape, not an instance.** `decodeTo`
6459
- * sits between the source type and the target schema, which is what lets the
6460
- * target's own checks the `ObjectId` and `SuiAddress` brands here — run
6461
- * afterwards.
5658
+ * - **`decode` produces the target's `Encoded` side, not an instance.**
5659
+ * `typeof Settlement.Encoded` is exactly that shape, so nothing has to be
5660
+ * written out by hand and nothing can drift. `decodeTo` sits between the
5661
+ * source type and the target schema, which is what lets the target's own
5662
+ * checks — the `ObjectId` and `SuiAddress` brands here — run afterwards.
6462
5663
  * - **`encode` is the inverse mapper and is not optional.** A codec that cannot
6463
5664
  * encode is one `Schema.encodeUnknownEffect` fails on, and the compiler asks
6464
5665
  * for it here rather than at the call site.
@@ -6478,7 +5679,7 @@ export const SettlementContent = (typeOrigin: string) =>
6478
5679
  ).pipe(
6479
5680
  Schema.decodeTo(
6480
5681
  Settlement,
6481
- SchemaTransformation.transformOrFail<SettlementParts, typeof SettlementBcs.$inferType>({
5682
+ SchemaTransformation.transformOrFail<typeof Settlement.Encoded, typeof SettlementBcs.$inferType>({
6482
5683
  decode: (fields, options) =>
6483
5684
  // `transformOrFail`, not `transform`, because one of these mappings can
6484
5685
  // fail: a `u64` of milliseconds is not necessarily a time. A `transform`
@@ -6495,7 +5696,7 @@ export const SettlementContent = (typeOrigin: string) =>
6495
5696
  options
6496
5697
  )
6497
5698
  ),
6498
- (settledAt): SettlementParts => ({
5699
+ (settledAt): typeof Settlement.Encoded => ({
6499
5700
  escrowId: fields.escrow_id,
6500
5701
  settledAt,
6501
5702
  claimedBy: fields.claimed_by
@@ -6527,6 +5728,14 @@ export const SettlementContent = (typeOrigin: string) =>
6527
5728
  *
6528
5729
  * The tags are prefixed with the package name because `EscrowNotFound` is a
6529
5730
  * name two packages could plausibly both want.
5731
+ *
5732
+ * And every one of them has a real `.message`. `Schema.TaggedError` leaves it
5733
+ * empty, so an error that supplies neither an `override get message()` nor a
5734
+ * `message` schema field surfaces an empty string everywhere a consumer
5735
+ * catches it, and `SuiError.toJson` emits no `message` key at all. The getter
5736
+ * is the usual answer — it stays out of the encoding, so it costs nothing at
5737
+ * the constructor — and a `message` schema field is for the case where the
5738
+ * sentence comes from somewhere else, as `EscrowSettlementUnknown`'s does.
6530
5739
  */
6531
5740
  import { Schema } from "effect"
6532
5741
  import { Digest, type Outcome, ObjectId } from "@unconfirmed/sui-effect"
@@ -6542,6 +5751,18 @@ export class EscrowNotFound extends Schema.TaggedError<EscrowNotFound>()(
6542
5751
  { escrowId: ObjectId }
6543
5752
  ) {
6544
5753
  readonly outcome: Outcome = "not_applied"
5754
+
5755
+ /**
5756
+ * `Schema.TaggedError` leaves `.message` empty, so anything surfacing
5757
+ * `error.message` — a log line, a `catch` in a consumer's UI,
5758
+ * `SuiError.toJson` — shows nothing unless the class supplies one. This is
5759
+ * the idiom sui-effect's own errors use, and the reason every error here has
5760
+ * one: define a getter over the fields, never a `message` schema field you
5761
+ * then have to pass to every constructor.
5762
+ */
5763
+ override get message(): string {
5764
+ return `no escrow ${this.escrowId}`
5765
+ }
6545
5766
  }
6546
5767
 
6547
5768
  /**
@@ -6551,6 +5772,10 @@ export class EscrowNotFound extends Schema.TaggedError<EscrowNotFound>()(
6551
5772
  * This is the case the `outcome` field exists for: the transaction applied, the
6552
5773
  * operation as a whole did not finish, and the only safe next step is to
6553
5774
  * reconcile rather than to retry. A script that fails with this exits 3.
5775
+ *
5776
+ * Its `message` is a **schema field** rather than a getter, because the
5777
+ * sentence comes from the settlement service rather than from these fields.
5778
+ * Either way `.message` is a real string and `SuiError.toJson` carries it.
6554
5779
  */
6555
5780
  export class EscrowSettlementUnknown extends Schema.TaggedError<EscrowSettlementUnknown>()(
6556
5781
  "escrow/EscrowSettlementUnknown",
@@ -6575,6 +5800,11 @@ export class EscrowUnsupportedNetwork extends Schema.TaggedError<EscrowUnsupport
6575
5800
  { network: Schema.String }
6576
5801
  ) {
6577
5802
  readonly outcome: Outcome = "not_applied"
5803
+
5804
+ /** See {@link EscrowNotFound.message}: a getter, not a schema field. */
5805
+ override get message(): string {
5806
+ return `this release bundles no escrow deployment for ${this.network}`
5807
+ }
6578
5808
  }
6579
5809
  ```
6580
5810
 
@@ -7440,6 +6670,15 @@ describe("Settlement: a domain class over the BCS bridge", () => {
7440
6670
  claimed_by: bcs.Address
7441
6671
  })
7442
6672
 
6673
+ // The identifier is the class's stable runtime marker and its JSON-Schema
6674
+ // `$ref` key, so it follows the guide's `"<package>/<Name>"` rule: two
6675
+ // extensions with a `Settlement` class must not collide in one document.
6676
+ test("the class identifier is scoped to the package", () => {
6677
+ expect(JSON.stringify(Schema.toJsonSchemaDocument(Settlement))).toContain(
6678
+ "escrow/Settlement"
6679
+ )
6680
+ })
6681
+
7443
6682
  test("snake_case Move fields decode into the camelCase domain class", async () => {
7444
6683
  const bytes = SettlementBcs.serialize({
7445
6684
  escrow_id: ESCROW_ID,
@@ -7817,6 +7056,41 @@ describe("the errors", () => {
7817
7056
  expect(json["outcome"]).toBe("unknown")
7818
7057
  expect(json["outcome"]).toBe(SuiError.outcome(error))
7819
7058
  })
7059
+
7060
+ /**
7061
+ * `Schema.TaggedError` leaves `.message` empty, so an error that defines
7062
+ * neither a getter nor a `message` schema field logs as an empty string and
7063
+ * `SuiError.toJson` emits no `message` key at all. Every error here defines
7064
+ * one, and the guide promises a reader that they will.
7065
+ */
7066
+ test("every error has a real message, and toJson carries it", () => {
7067
+ const errors = [
7068
+ new EscrowNotFound({ escrowId: ESCROW_ID }),
7069
+ new EscrowSettlementUnknown({
7070
+ escrowId: ESCROW_ID,
7071
+ digest: "1".repeat(32) as never,
7072
+ message: "the operator never confirmed"
7073
+ }),
7074
+ new EscrowUnsupportedNetwork({ network: "devnet" })
7075
+ ]
7076
+ for (const error of errors) {
7077
+ expect([error._tag, error.message.length > 0]).toEqual([error._tag, true])
7078
+ expect([error._tag, SuiError.toJson(error)["message"]]).toEqual([
7079
+ error._tag,
7080
+ error.message
7081
+ ])
7082
+ }
7083
+ // The getter reads the error's own fields, so the sentence names the thing
7084
+ // that failed rather than repeating the tag.
7085
+ expect(new EscrowNotFound({ escrowId: ESCROW_ID }).message).toBe(`no escrow ${ESCROW_ID}`)
7086
+ expect(new EscrowUnsupportedNetwork({ network: "devnet" }).message).toBe(
7087
+ "this release bundles no escrow deployment for devnet"
7088
+ )
7089
+ // And a getter stays out of the encoding, so it is not a constructor
7090
+ // argument: only `EscrowSettlementUnknown` takes a `message`.
7091
+ expect(Object.keys(SuiError.toJson(new EscrowUnsupportedNetwork({ network: "devnet" }))))
7092
+ .toEqual(["_tag", "network", "outcome", "message"])
7093
+ })
7820
7094
  })
7821
7095
  ```
7822
7096