sui-effect 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/AGENTS.md +209 -0
  2. package/LICENSE +21 -0
  3. package/LLMS.md +6707 -0
  4. package/README.md +300 -0
  5. package/dist/domain/bcs.d.ts +101 -0
  6. package/dist/domain/bcs.d.ts.map +1 -0
  7. package/dist/domain/bcs.js +183 -0
  8. package/dist/domain/bcs.js.map +1 -0
  9. package/dist/domain/errors.d.ts +595 -0
  10. package/dist/domain/errors.d.ts.map +1 -0
  11. package/dist/domain/errors.js +476 -0
  12. package/dist/domain/errors.js.map +1 -0
  13. package/dist/domain/executed.d.ts +325 -0
  14. package/dist/domain/executed.d.ts.map +1 -0
  15. package/dist/domain/executed.js +253 -0
  16. package/dist/domain/executed.js.map +1 -0
  17. package/dist/domain/journal-entry.d.ts +468 -0
  18. package/dist/domain/journal-entry.d.ts.map +1 -0
  19. package/dist/domain/journal-entry.js +63 -0
  20. package/dist/domain/journal-entry.js.map +1 -0
  21. package/dist/domain/schemas.d.ts +950 -0
  22. package/dist/domain/schemas.d.ts.map +1 -0
  23. package/dist/domain/schemas.js +571 -0
  24. package/dist/domain/schemas.js.map +1 -0
  25. package/dist/domain/sui-schema.d.ts +12 -0
  26. package/dist/domain/sui-schema.d.ts.map +1 -0
  27. package/dist/domain/sui-schema.js +12 -0
  28. package/dist/domain/sui-schema.js.map +1 -0
  29. package/dist/extension.d.ts +7 -0
  30. package/dist/extension.d.ts.map +1 -0
  31. package/dist/extension.js +7 -0
  32. package/dist/extension.js.map +1 -0
  33. package/dist/index.d.ts +31 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +31 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/internal.d.ts +18 -0
  38. package/dist/internal.d.ts.map +1 -0
  39. package/dist/internal.js +18 -0
  40. package/dist/internal.js.map +1 -0
  41. package/dist/journal.d.ts +51 -0
  42. package/dist/journal.d.ts.map +1 -0
  43. package/dist/journal.js +18 -0
  44. package/dist/journal.js.map +1 -0
  45. package/dist/script.d.ts +7 -0
  46. package/dist/script.d.ts.map +1 -0
  47. package/dist/script.js +7 -0
  48. package/dist/script.js.map +1 -0
  49. package/dist/services/Journal.d.ts +76 -0
  50. package/dist/services/Journal.d.ts.map +1 -0
  51. package/dist/services/Journal.js +70 -0
  52. package/dist/services/Journal.js.map +1 -0
  53. package/dist/services/JournalKeyValueStore.d.ts +73 -0
  54. package/dist/services/JournalKeyValueStore.d.ts.map +1 -0
  55. package/dist/services/JournalKeyValueStore.js +155 -0
  56. package/dist/services/JournalKeyValueStore.js.map +1 -0
  57. package/dist/services/Script.d.ts +210 -0
  58. package/dist/services/Script.d.ts.map +1 -0
  59. package/dist/services/Script.js +441 -0
  60. package/dist/services/Script.js.map +1 -0
  61. package/dist/services/Signer.d.ts +132 -0
  62. package/dist/services/Signer.d.ts.map +1 -0
  63. package/dist/services/Signer.js +158 -0
  64. package/dist/services/Signer.js.map +1 -0
  65. package/dist/services/SubmitConfig.d.ts +175 -0
  66. package/dist/services/SubmitConfig.d.ts.map +1 -0
  67. package/dist/services/SubmitConfig.js +52 -0
  68. package/dist/services/SubmitConfig.js.map +1 -0
  69. package/dist/services/Sui.d.ts +295 -0
  70. package/dist/services/Sui.d.ts.map +1 -0
  71. package/dist/services/Sui.js +414 -0
  72. package/dist/services/Sui.js.map +1 -0
  73. package/dist/services/SuiCore.d.ts +227 -0
  74. package/dist/services/SuiCore.d.ts.map +1 -0
  75. package/dist/services/SuiCore.js +400 -0
  76. package/dist/services/SuiCore.js.map +1 -0
  77. package/dist/services/SuiCoreFake.d.ts +278 -0
  78. package/dist/services/SuiCoreFake.d.ts.map +1 -0
  79. package/dist/services/SuiCoreFake.js +1003 -0
  80. package/dist/services/SuiCoreFake.js.map +1 -0
  81. package/dist/services/SuiExtension.d.ts +208 -0
  82. package/dist/services/SuiExtension.d.ts.map +1 -0
  83. package/dist/services/SuiExtension.js +355 -0
  84. package/dist/services/SuiExtension.js.map +1 -0
  85. package/dist/services/SuiGraphQL.d.ts +98 -0
  86. package/dist/services/SuiGraphQL.d.ts.map +1 -0
  87. package/dist/services/SuiGraphQL.js +118 -0
  88. package/dist/services/SuiGraphQL.js.map +1 -0
  89. package/dist/services/Tx.d.ts +687 -0
  90. package/dist/services/Tx.d.ts.map +1 -0
  91. package/dist/services/Tx.js +1224 -0
  92. package/dist/services/Tx.js.map +1 -0
  93. package/dist/testing.d.ts +88 -0
  94. package/dist/testing.d.ts.map +1 -0
  95. package/dist/testing.js +163 -0
  96. package/dist/testing.js.map +1 -0
  97. package/dist/tx.d.ts +24 -0
  98. package/dist/tx.d.ts.map +1 -0
  99. package/dist/tx.js +24 -0
  100. package/dist/tx.js.map +1 -0
  101. package/docs/extensions.md +1685 -0
  102. package/examples/extension-template/README.md +170 -0
  103. package/examples/extension-template/package.json +44 -0
  104. package/examples/extension-template/scripts/check-package.ts +145 -0
  105. package/examples/extension-template/src/Escrow.ts +445 -0
  106. package/examples/extension-template/src/Platform.ts +136 -0
  107. package/examples/extension-template/src/errors.ts +61 -0
  108. package/examples/extension-template/src/extension.ts +63 -0
  109. package/examples/extension-template/src/index.ts +34 -0
  110. package/examples/extension-template/src/schema.ts +158 -0
  111. package/examples/extension-template/src/upstream.ts +66 -0
  112. package/examples/extension-template/test/escrow.test.ts +559 -0
  113. package/examples/extension-template/tsconfig.build.json +26 -0
  114. package/examples/extension-template/tsconfig.json +35 -0
  115. package/package.json +87 -0
@@ -0,0 +1,325 @@
1
+ /**
2
+ * `Executed`: a transaction that reached the chain, with accessors that answer
3
+ * the questions the next transaction needs answered.
4
+ *
5
+ * Every accessor returns {@link ChangedRef}s — the object's id plus whatever
6
+ * else the effects actually carried — and ignores accumulator writes
7
+ * (`outputState: "AccumulatorWriteV1"`), which are balance bookkeeping rather
8
+ * than objects. Use {@link objectRefOf} to turn one into the full `ObjectRef`
9
+ * the transaction builder wants, which succeeds exactly when the node reported
10
+ * every field it needs.
11
+ *
12
+ * @since 0.1.0
13
+ */
14
+ import type { SuiClientTypes } from "@mysten/sui/client";
15
+ import { Effect, Schema } from "effect";
16
+ import { DecodeError, ExecutionFailed, UnexpectedEffects } from "./errors.ts";
17
+ import { CoinType, ObjectId, ObjectRef, ObjectType, Owner, SuiAddress, Version } from "./schemas.ts";
18
+ /**
19
+ * What the effects say about one object a transaction touched.
20
+ *
21
+ * `id` is always there. Everything else is present only when the node reported
22
+ * it: `type` comes from the `objectTypes` join, and the version, digest and
23
+ * owner from the side of the change being read (a deleted object has no output
24
+ * version, and a created one has no input version). Nothing is defaulted, so a
25
+ * caller that needs a full `ObjectRef` for the builder can see what is missing
26
+ * rather than being handed a fabricated version 0.
27
+ */
28
+ export interface ChangedRef {
29
+ readonly id: ObjectId;
30
+ readonly type?: ObjectType;
31
+ readonly version?: Version;
32
+ readonly digest?: string;
33
+ readonly owner?: Owner;
34
+ }
35
+ /**
36
+ * The full builder reference of a changed object, when the effects carried
37
+ * every field the builder needs. Never fails.
38
+ */
39
+ export declare const objectRefOf: (ref: ChangedRef) => ObjectRef | undefined;
40
+ /**
41
+ * The shape `Transaction#objectRef` and `Inputs.ObjectRef` want: `objectId`
42
+ * rather than `id`, and a decimal **string** version rather than a `bigint`.
43
+ *
44
+ * sui-effect's own `ObjectRef` carries the branded `id` and a `bigint`
45
+ * `version`, because that is what a domain model wants and what a `Version`
46
+ * check can be run on; the SDK builder wants neither. This is the one
47
+ * conversion, so nobody writes `{ objectId: ref.id, version: String(ref.version) }`
48
+ * by hand and gets the field name wrong.
49
+ *
50
+ * **Only for an address-owned (or immutable) object.** `tx.objectRef` pins a
51
+ * version, which is exactly right for an owned input and exactly wrong for a
52
+ * **shared** object: a shared object is passed with `tx.sharedObjectRef({
53
+ * objectId, initialSharedVersion, mutable })` (the initial shared version lives
54
+ * on `ref.owner.Shared.initialSharedVersion`), and a **receiving** object with
55
+ * `tx.receivingRef(...)`, which takes the same three fields this returns.
56
+ * Passing a shared object by `objectRef` produces bytes a validator rejects.
57
+ *
58
+ * `undefined` when the effects did not carry a version or a digest — a deleted
59
+ * object has no output version, and nothing can be consumed without both.
60
+ * Never fails.
61
+ */
62
+ export declare const sdkRefOf: (ref: ChangedRef | ObjectRef) => SdkObjectRef | undefined;
63
+ /** The SDK's own object reference shape, as `Transaction#objectRef` takes it. */
64
+ export interface SdkObjectRef {
65
+ readonly objectId: string;
66
+ readonly version: string;
67
+ readonly digest: string;
68
+ }
69
+ declare const Executed_base: Schema.Class<Executed, Schema.Struct<{
70
+ readonly digest: Schema.brand<Schema.String, "Digest">;
71
+ readonly effects: Schema.Struct<{
72
+ readonly version: Schema.Number;
73
+ readonly status: Schema.Struct<{
74
+ readonly success: Schema.Boolean;
75
+ }>;
76
+ readonly gasUsed: Schema.Struct<{
77
+ readonly computationCost: Schema.brand<Schema.BigIntFromString, "Mist">;
78
+ readonly storageCost: Schema.brand<Schema.BigIntFromString, "Mist">;
79
+ readonly storageRebate: Schema.brand<Schema.BigIntFromString, "Mist">;
80
+ readonly nonRefundableStorageFee: Schema.brand<Schema.BigIntFromString, "Mist">;
81
+ }>;
82
+ readonly transactionDigest: Schema.brand<Schema.String, "Digest">;
83
+ readonly gasObject: Schema.NullOr<Schema.Struct<{
84
+ readonly objectId: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "ObjectId">;
85
+ readonly inputState: Schema.Literals<readonly ["Unknown", "DoesNotExist", "Exists"]>;
86
+ readonly inputVersion: Schema.NullOr<Schema.brand<Schema.BigIntFromString, "Version">>;
87
+ readonly inputDigest: Schema.NullOr<Schema.String>;
88
+ readonly inputOwner: Schema.NullOr<Schema.toTaggedUnion<"$kind", readonly [Schema.Struct<{
89
+ readonly $kind: Schema.Literal<"AddressOwner">;
90
+ readonly AddressOwner: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "SuiAddress">;
91
+ }>, Schema.Struct<{
92
+ readonly $kind: Schema.Literal<"ObjectOwner">;
93
+ readonly ObjectOwner: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "ObjectId">;
94
+ }>, Schema.Struct<{
95
+ readonly $kind: Schema.Literal<"Shared">;
96
+ readonly Shared: Schema.Struct<{
97
+ readonly initialSharedVersion: Schema.brand<Schema.BigIntFromString, "Version">;
98
+ }>;
99
+ }>, Schema.Struct<{
100
+ readonly $kind: Schema.Literal<"Immutable">;
101
+ readonly Immutable: Schema.Literal<true>;
102
+ }>, Schema.Struct<{
103
+ readonly $kind: Schema.Literal<"ConsensusAddressOwner">;
104
+ readonly ConsensusAddressOwner: Schema.Struct<{
105
+ readonly startVersion: Schema.brand<Schema.BigIntFromString, "Version">;
106
+ readonly owner: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "SuiAddress">;
107
+ }>;
108
+ }>, Schema.Struct<{
109
+ readonly $kind: Schema.Literal<"Unknown">;
110
+ }>]>>;
111
+ readonly outputState: Schema.Literals<readonly ["Unknown", "DoesNotExist", "ObjectWrite", "PackageWrite", "AccumulatorWriteV1"]>;
112
+ readonly outputVersion: Schema.NullOr<Schema.brand<Schema.BigIntFromString, "Version">>;
113
+ readonly outputDigest: Schema.NullOr<Schema.String>;
114
+ readonly outputOwner: Schema.NullOr<Schema.toTaggedUnion<"$kind", readonly [Schema.Struct<{
115
+ readonly $kind: Schema.Literal<"AddressOwner">;
116
+ readonly AddressOwner: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "SuiAddress">;
117
+ }>, Schema.Struct<{
118
+ readonly $kind: Schema.Literal<"ObjectOwner">;
119
+ readonly ObjectOwner: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "ObjectId">;
120
+ }>, Schema.Struct<{
121
+ readonly $kind: Schema.Literal<"Shared">;
122
+ readonly Shared: Schema.Struct<{
123
+ readonly initialSharedVersion: Schema.brand<Schema.BigIntFromString, "Version">;
124
+ }>;
125
+ }>, Schema.Struct<{
126
+ readonly $kind: Schema.Literal<"Immutable">;
127
+ readonly Immutable: Schema.Literal<true>;
128
+ }>, Schema.Struct<{
129
+ readonly $kind: Schema.Literal<"ConsensusAddressOwner">;
130
+ readonly ConsensusAddressOwner: Schema.Struct<{
131
+ readonly startVersion: Schema.brand<Schema.BigIntFromString, "Version">;
132
+ readonly owner: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "SuiAddress">;
133
+ }>;
134
+ }>, Schema.Struct<{
135
+ readonly $kind: Schema.Literal<"Unknown">;
136
+ }>]>>;
137
+ readonly idOperation: Schema.Literals<readonly ["Unknown", "None", "Created", "Deleted"]>;
138
+ }>>;
139
+ readonly eventsDigest: Schema.NullOr<Schema.String>;
140
+ readonly dependencies: Schema.$Array<Schema.String>;
141
+ readonly lamportVersion: Schema.NullOr<Schema.brand<Schema.BigIntFromString, "Version">>;
142
+ readonly changedObjects: Schema.$Array<Schema.Struct<{
143
+ readonly objectId: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "ObjectId">;
144
+ readonly inputState: Schema.Literals<readonly ["Unknown", "DoesNotExist", "Exists"]>;
145
+ readonly inputVersion: Schema.NullOr<Schema.brand<Schema.BigIntFromString, "Version">>;
146
+ readonly inputDigest: Schema.NullOr<Schema.String>;
147
+ readonly inputOwner: Schema.NullOr<Schema.toTaggedUnion<"$kind", readonly [Schema.Struct<{
148
+ readonly $kind: Schema.Literal<"AddressOwner">;
149
+ readonly AddressOwner: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "SuiAddress">;
150
+ }>, Schema.Struct<{
151
+ readonly $kind: Schema.Literal<"ObjectOwner">;
152
+ readonly ObjectOwner: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "ObjectId">;
153
+ }>, Schema.Struct<{
154
+ readonly $kind: Schema.Literal<"Shared">;
155
+ readonly Shared: Schema.Struct<{
156
+ readonly initialSharedVersion: Schema.brand<Schema.BigIntFromString, "Version">;
157
+ }>;
158
+ }>, Schema.Struct<{
159
+ readonly $kind: Schema.Literal<"Immutable">;
160
+ readonly Immutable: Schema.Literal<true>;
161
+ }>, Schema.Struct<{
162
+ readonly $kind: Schema.Literal<"ConsensusAddressOwner">;
163
+ readonly ConsensusAddressOwner: Schema.Struct<{
164
+ readonly startVersion: Schema.brand<Schema.BigIntFromString, "Version">;
165
+ readonly owner: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "SuiAddress">;
166
+ }>;
167
+ }>, Schema.Struct<{
168
+ readonly $kind: Schema.Literal<"Unknown">;
169
+ }>]>>;
170
+ readonly outputState: Schema.Literals<readonly ["Unknown", "DoesNotExist", "ObjectWrite", "PackageWrite", "AccumulatorWriteV1"]>;
171
+ readonly outputVersion: Schema.NullOr<Schema.brand<Schema.BigIntFromString, "Version">>;
172
+ readonly outputDigest: Schema.NullOr<Schema.String>;
173
+ readonly outputOwner: Schema.NullOr<Schema.toTaggedUnion<"$kind", readonly [Schema.Struct<{
174
+ readonly $kind: Schema.Literal<"AddressOwner">;
175
+ readonly AddressOwner: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "SuiAddress">;
176
+ }>, Schema.Struct<{
177
+ readonly $kind: Schema.Literal<"ObjectOwner">;
178
+ readonly ObjectOwner: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "ObjectId">;
179
+ }>, Schema.Struct<{
180
+ readonly $kind: Schema.Literal<"Shared">;
181
+ readonly Shared: Schema.Struct<{
182
+ readonly initialSharedVersion: Schema.brand<Schema.BigIntFromString, "Version">;
183
+ }>;
184
+ }>, Schema.Struct<{
185
+ readonly $kind: Schema.Literal<"Immutable">;
186
+ readonly Immutable: Schema.Literal<true>;
187
+ }>, Schema.Struct<{
188
+ readonly $kind: Schema.Literal<"ConsensusAddressOwner">;
189
+ readonly ConsensusAddressOwner: Schema.Struct<{
190
+ readonly startVersion: Schema.brand<Schema.BigIntFromString, "Version">;
191
+ readonly owner: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "SuiAddress">;
192
+ }>;
193
+ }>, Schema.Struct<{
194
+ readonly $kind: Schema.Literal<"Unknown">;
195
+ }>]>>;
196
+ readonly idOperation: Schema.Literals<readonly ["Unknown", "None", "Created", "Deleted"]>;
197
+ }>>;
198
+ readonly unchangedConsensusObjects: Schema.$Array<Schema.Struct<{
199
+ readonly kind: Schema.Literals<readonly ["Unknown", "ReadOnlyRoot", "MutateConsensusStreamEnded", "ReadConsensusStreamEnded", "Cancelled", "PerEpochConfig"]>;
200
+ readonly objectId: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "ObjectId">;
201
+ readonly version: Schema.NullOr<Schema.brand<Schema.BigIntFromString, "Version">>;
202
+ readonly digest: Schema.NullOr<Schema.String>;
203
+ }>>;
204
+ readonly auxiliaryDataDigest: Schema.NullOr<Schema.String>;
205
+ }>;
206
+ readonly events: Schema.$Array<Schema.Struct<{
207
+ readonly packageId: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "ObjectId">;
208
+ readonly module: Schema.String;
209
+ readonly sender: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "SuiAddress">;
210
+ readonly eventType: Schema.String;
211
+ readonly bcs: Schema.Uint8Array;
212
+ }>>;
213
+ readonly balanceChanges: Schema.$Array<Schema.Struct<{
214
+ readonly coinType: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "CoinType">;
215
+ readonly address: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "SuiAddress">;
216
+ readonly amount: Schema.BigIntFromString;
217
+ }>>;
218
+ readonly objectTypes: Schema.$Record<Schema.String, Schema.String>;
219
+ readonly checkpoint: Schema.NullOr<Schema.BigIntFromString>;
220
+ readonly timestampMs: Schema.NullOr<Schema.Number>;
221
+ }>, {}>;
222
+ /**
223
+ * A transaction the network executed, built from the fixed execute include set:
224
+ * effects, events, balance changes and object types.
225
+ */
226
+ export declare class Executed extends Executed_base {
227
+ /**
228
+ * The type of a changed object, from the `objectTypes` join. A published
229
+ * package reports the literal `package` rather than a struct tag, so the
230
+ * decode goes through {@link ObjectType}.
231
+ */
232
+ private typeOf;
233
+ /**
234
+ * Everything the effects actually say about one changed object. Nothing is
235
+ * invented: a field the node did not report stays `undefined`, so a caller
236
+ * that needs a full builder reference can tell the difference between
237
+ * "version 0" and "the node did not say".
238
+ */
239
+ private refOf;
240
+ private select;
241
+ private static byType;
242
+ /**
243
+ * Objects this transaction created, optionally filtered by Move type
244
+ * (compared with `normalizeStructTag`). Never fails.
245
+ */
246
+ created(type?: string): ReadonlyArray<ChangedRef>;
247
+ /**
248
+ * Objects this transaction created whose reference satisfies a predicate.
249
+ *
250
+ * The direct replacement for the substring matching every repo hand-rolls
251
+ * (`createdByType("::Receipt")`), without making substring matching the
252
+ * default: `created(type)` still compares normalized struct tags.
253
+ * Never fails.
254
+ */
255
+ createdWhere(predicate: (ref: ChangedRef) => boolean): ReadonlyArray<ChangedRef>;
256
+ /** Objects this transaction mutated in place, optionally filtered by type. Never fails. */
257
+ mutated(type?: string): ReadonlyArray<ChangedRef>;
258
+ /**
259
+ * Objects this transaction deleted or wrapped. The refs carry the versions the
260
+ * objects had going in, since they have no output version.
261
+ *
262
+ * Two effect shapes land here, because from a caller's side both mean "this
263
+ * object is gone from where it was":
264
+ *
265
+ * - a **delete**, which the node reports as `idOperation: "Deleted"`;
266
+ * - a **wrap**, which has no id operation at all (`"None"`) and shows up only
267
+ * as an input that existed and an output that does not. {@link wrapped}
268
+ * returns just those, for a caller that has to tell the two apart — a
269
+ * wrapped object still exists inside its wrapper and can come back.
270
+ *
271
+ * Never fails.
272
+ */
273
+ deleted(): ReadonlyArray<ChangedRef>;
274
+ /**
275
+ * Objects this transaction wrapped: they went in existing and came out
276
+ * nonexistent without their id being deleted, which is how the SDK's effects
277
+ * converter represents wrapping. They are a subset of {@link deleted}.
278
+ * Never fails.
279
+ */
280
+ wrapped(): ReadonlyArray<ChangedRef>;
281
+ private static isDeleted;
282
+ private static isWrapped;
283
+ /**
284
+ * Packages this transaction published (`PackageWrite` plus `Created`), as
285
+ * full refs like every other accessor. A package's `type` is the literal
286
+ * `package` when the node reports one, and the ref falls back to it when the
287
+ * `objectTypes` join has no entry, so a publish is never silently dropped.
288
+ * Never fails.
289
+ */
290
+ packagesPublished(): ReadonlyArray<ChangedRef>;
291
+ /** The net balance change for one address and coin type, in MIST. Never fails. */
292
+ balanceChange(address: SuiAddress, coinType: CoinType): bigint;
293
+ /** Computation plus storage less the storage rebate, in MIST. Can be negative. Never fails. */
294
+ get gasUsedTotal(): bigint;
295
+ /**
296
+ * The single object of this type the transaction created.
297
+ *
298
+ * Fails with: `UnexpectedEffects` when the transaction created no object of
299
+ * that type, or more than one.
300
+ */
301
+ expectCreated(type: string): Effect.Effect<ChangedRef, UnexpectedEffects>;
302
+ }
303
+ /** The `include` set every execute, simulate and transaction read asks for. */
304
+ export declare const EXECUTE_INCLUDE: {
305
+ readonly effects: true;
306
+ readonly events: true;
307
+ readonly balanceChanges: true;
308
+ readonly objectTypes: true;
309
+ };
310
+ /**
311
+ * Turns an SDK `TransactionResult` read with {@link EXECUTE_INCLUDE} into an
312
+ * `Executed`, or into the one representation of an on-chain failure.
313
+ *
314
+ * Fails with: `ExecutionFailed` when the transaction was applied and failed,
315
+ * and `DecodeError` when the response does not carry the include set that was
316
+ * asked for.
317
+ */
318
+ export declare const fromTransactionResult: (result: SuiClientTypes.TransactionResult<{
319
+ readonly effects: true;
320
+ readonly events: true;
321
+ readonly balanceChanges: true;
322
+ readonly objectTypes: true;
323
+ }>) => Effect.Effect<Executed, DecodeError | ExecutionFailed, never>;
324
+ export {};
325
+ //# sourceMappingURL=executed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executed.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js";
3
+ import { BalanceChange, ChangedObject, CoinType, Digest, Event, executionReasonOf, ObjectId, ObjectRef, ObjectType, Owner, SuiAddress, TransactionEffects, Version } from "./schemas.js";
4
+ import { typeMatches } from "./bcs.js";
5
+ const isAccumulatorWrite = (change) => change.outputState === "AccumulatorWriteV1";
6
+ /**
7
+ * The full builder reference of a changed object, when the effects carried
8
+ * every field the builder needs. Never fails.
9
+ */
10
+ export const objectRefOf = (ref) => ref.type === undefined || ref.version === undefined || ref.digest === undefined ||
11
+ ref.owner === undefined
12
+ ? undefined
13
+ : { id: ref.id, type: ref.type, version: ref.version, digest: ref.digest, owner: ref.owner };
14
+ /**
15
+ * The shape `Transaction#objectRef` and `Inputs.ObjectRef` want: `objectId`
16
+ * rather than `id`, and a decimal **string** version rather than a `bigint`.
17
+ *
18
+ * sui-effect's own `ObjectRef` carries the branded `id` and a `bigint`
19
+ * `version`, because that is what a domain model wants and what a `Version`
20
+ * check can be run on; the SDK builder wants neither. This is the one
21
+ * conversion, so nobody writes `{ objectId: ref.id, version: String(ref.version) }`
22
+ * by hand and gets the field name wrong.
23
+ *
24
+ * **Only for an address-owned (or immutable) object.** `tx.objectRef` pins a
25
+ * version, which is exactly right for an owned input and exactly wrong for a
26
+ * **shared** object: a shared object is passed with `tx.sharedObjectRef({
27
+ * objectId, initialSharedVersion, mutable })` (the initial shared version lives
28
+ * on `ref.owner.Shared.initialSharedVersion`), and a **receiving** object with
29
+ * `tx.receivingRef(...)`, which takes the same three fields this returns.
30
+ * Passing a shared object by `objectRef` produces bytes a validator rejects.
31
+ *
32
+ * `undefined` when the effects did not carry a version or a digest — a deleted
33
+ * object has no output version, and nothing can be consumed without both.
34
+ * Never fails.
35
+ */
36
+ export const sdkRefOf = (ref) => ref.version === undefined || ref.digest === undefined
37
+ ? undefined
38
+ : { objectId: ref.id, version: ref.version.toString(), digest: ref.digest };
39
+ /**
40
+ * A transaction the network executed, built from the fixed execute include set:
41
+ * effects, events, balance changes and object types.
42
+ */
43
+ export class Executed extends Schema.Class("sui-effect/Executed")({
44
+ digest: Digest,
45
+ effects: TransactionEffects,
46
+ events: Schema.Array(Event),
47
+ balanceChanges: Schema.Array(BalanceChange),
48
+ objectTypes: Schema.Record(Schema.String, Schema.String),
49
+ checkpoint: Schema.NullOr(Schema.BigIntFromString),
50
+ timestampMs: Schema.NullOr(Schema.Number)
51
+ }) {
52
+ /**
53
+ * The type of a changed object, from the `objectTypes` join. A published
54
+ * package reports the literal `package` rather than a struct tag, so the
55
+ * decode goes through {@link ObjectType}.
56
+ */
57
+ typeOf(objectId) {
58
+ const type = this.objectTypes[objectId];
59
+ if (type === undefined)
60
+ return undefined;
61
+ const decoded = Schema.decodeUnknownOption(ObjectType)(type);
62
+ return decoded._tag === "Some" ? decoded.value : undefined;
63
+ }
64
+ /**
65
+ * Everything the effects actually say about one changed object. Nothing is
66
+ * invented: a field the node did not report stays `undefined`, so a caller
67
+ * that needs a full builder reference can tell the difference between
68
+ * "version 0" and "the node did not say".
69
+ */
70
+ refOf(change, side) {
71
+ const version = side === "output" ? change.outputVersion : change.inputVersion;
72
+ const digest = side === "output" ? change.outputDigest : change.inputDigest;
73
+ const owner = side === "output" ? change.outputOwner : change.inputOwner;
74
+ const type = this.typeOf(change.objectId);
75
+ return {
76
+ id: change.objectId,
77
+ ...(type === undefined ? {} : { type }),
78
+ ...(version === null ? {} : { version }),
79
+ ...(digest === null ? {} : { digest }),
80
+ ...(owner === null ? {} : { owner })
81
+ };
82
+ }
83
+ select(predicate, side, filter) {
84
+ const refs = [];
85
+ for (const change of this.effects.changedObjects) {
86
+ if (isAccumulatorWrite(change))
87
+ continue;
88
+ if (!predicate(change))
89
+ continue;
90
+ const ref = this.refOf(change, side);
91
+ if (filter !== undefined && !filter(ref))
92
+ continue;
93
+ refs.push(ref);
94
+ }
95
+ return refs;
96
+ }
97
+ static byType(type) {
98
+ if (type === undefined)
99
+ return undefined;
100
+ return (ref) => ref.type !== undefined && typeMatches(type, ref.type);
101
+ }
102
+ /**
103
+ * Objects this transaction created, optionally filtered by Move type
104
+ * (compared with `normalizeStructTag`). Never fails.
105
+ */
106
+ created(type) {
107
+ return this.select((change) => change.idOperation === "Created" && change.outputState === "ObjectWrite", "output", Executed.byType(type));
108
+ }
109
+ /**
110
+ * Objects this transaction created whose reference satisfies a predicate.
111
+ *
112
+ * The direct replacement for the substring matching every repo hand-rolls
113
+ * (`createdByType("::Receipt")`), without making substring matching the
114
+ * default: `created(type)` still compares normalized struct tags.
115
+ * Never fails.
116
+ */
117
+ createdWhere(predicate) {
118
+ return this.select((change) => change.idOperation === "Created" && change.outputState === "ObjectWrite", "output", predicate);
119
+ }
120
+ /** Objects this transaction mutated in place, optionally filtered by type. Never fails. */
121
+ mutated(type) {
122
+ return this.select((change) => change.idOperation === "None" &&
123
+ change.outputState === "ObjectWrite" &&
124
+ change.inputState === "Exists", "output", Executed.byType(type));
125
+ }
126
+ /**
127
+ * Objects this transaction deleted or wrapped. The refs carry the versions the
128
+ * objects had going in, since they have no output version.
129
+ *
130
+ * Two effect shapes land here, because from a caller's side both mean "this
131
+ * object is gone from where it was":
132
+ *
133
+ * - a **delete**, which the node reports as `idOperation: "Deleted"`;
134
+ * - a **wrap**, which has no id operation at all (`"None"`) and shows up only
135
+ * as an input that existed and an output that does not. {@link wrapped}
136
+ * returns just those, for a caller that has to tell the two apart — a
137
+ * wrapped object still exists inside its wrapper and can come back.
138
+ *
139
+ * Never fails.
140
+ */
141
+ deleted() {
142
+ return this.select((change) => Executed.isDeleted(change) || Executed.isWrapped(change), "input");
143
+ }
144
+ /**
145
+ * Objects this transaction wrapped: they went in existing and came out
146
+ * nonexistent without their id being deleted, which is how the SDK's effects
147
+ * converter represents wrapping. They are a subset of {@link deleted}.
148
+ * Never fails.
149
+ */
150
+ wrapped() {
151
+ return this.select(Executed.isWrapped, "input");
152
+ }
153
+ static isDeleted(change) {
154
+ return change.idOperation === "Deleted";
155
+ }
156
+ static isWrapped(change) {
157
+ return change.idOperation === "None" && change.inputState === "Exists" &&
158
+ change.outputState === "DoesNotExist";
159
+ }
160
+ /**
161
+ * Packages this transaction published (`PackageWrite` plus `Created`), as
162
+ * full refs like every other accessor. A package's `type` is the literal
163
+ * `package` when the node reports one, and the ref falls back to it when the
164
+ * `objectTypes` join has no entry, so a publish is never silently dropped.
165
+ * Never fails.
166
+ */
167
+ packagesPublished() {
168
+ const refs = [];
169
+ for (const change of this.effects.changedObjects) {
170
+ if (change.outputState !== "PackageWrite" || change.idOperation !== "Created")
171
+ continue;
172
+ const ref = this.refOf(change, "output");
173
+ // gRPC reports the literal `package` as a published package's type, and
174
+ // some nodes omit it from `objectTypes` entirely; a `PackageWrite` is a
175
+ // package either way.
176
+ refs.push(ref.type === undefined ? { ...ref, type: "package" } : ref);
177
+ }
178
+ return refs;
179
+ }
180
+ /** The net balance change for one address and coin type, in MIST. Never fails. */
181
+ balanceChange(address, coinType) {
182
+ let total = 0n;
183
+ for (const change of this.balanceChanges) {
184
+ if (change.address === address && typeMatches(coinType, change.coinType)) {
185
+ total += change.amount;
186
+ }
187
+ }
188
+ return total;
189
+ }
190
+ /** Computation plus storage less the storage rebate, in MIST. Can be negative. Never fails. */
191
+ get gasUsedTotal() {
192
+ const gas = this.effects.gasUsed;
193
+ return gas.computationCost + gas.storageCost - gas.storageRebate;
194
+ }
195
+ /**
196
+ * The single object of this type the transaction created.
197
+ *
198
+ * Fails with: `UnexpectedEffects` when the transaction created no object of
199
+ * that type, or more than one.
200
+ */
201
+ expectCreated(type) {
202
+ const created = this.created(type);
203
+ const only = created[0];
204
+ if (created.length === 1 && only !== undefined)
205
+ return Effect.succeed(only);
206
+ return Effect.fail(new UnexpectedEffects({
207
+ digest: this.digest,
208
+ expected: type,
209
+ found: created.map((ref) => ref.id)
210
+ }));
211
+ }
212
+ }
213
+ /** The `include` set every execute, simulate and transaction read asks for. */
214
+ export const EXECUTE_INCLUDE = {
215
+ effects: true,
216
+ events: true,
217
+ balanceChanges: true,
218
+ objectTypes: true
219
+ };
220
+ const decodeExecuted = Schema.decodeUnknownEffect(Executed);
221
+ /**
222
+ * Turns an SDK `TransactionResult` read with {@link EXECUTE_INCLUDE} into an
223
+ * `Executed`, or into the one representation of an on-chain failure.
224
+ *
225
+ * Fails with: `ExecutionFailed` when the transaction was applied and failed,
226
+ * and `DecodeError` when the response does not carry the include set that was
227
+ * asked for.
228
+ */
229
+ export const fromTransactionResult = Effect.fn("Executed.fromTransactionResult")(function* (result) {
230
+ const transaction = result.$kind === "Transaction" ? result.Transaction : result.FailedTransaction;
231
+ const encoded = {
232
+ digest: transaction.digest,
233
+ effects: transaction.effects,
234
+ events: transaction.events,
235
+ balanceChanges: transaction.balanceChanges,
236
+ objectTypes: transaction.objectTypes,
237
+ checkpoint: transaction.checkpoint,
238
+ timestampMs: transaction.timestampMs
239
+ };
240
+ const executed = yield* decodeExecuted(encoded).pipe(Effect.mapError((error) => new DecodeError({ issue: error.message })));
241
+ if (!transaction.status.success) {
242
+ return yield* new ExecutionFailed({
243
+ digest: executed.digest,
244
+ reason: executionReasonOf(transaction.status.error),
245
+ ...(transaction.status.error.command === undefined
246
+ ? {}
247
+ : { command: transaction.status.error.command }),
248
+ effects: executed.effects
249
+ });
250
+ }
251
+ return executed;
252
+ });
253
+ //# sourceMappingURL=executed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executed.js","sourceRoot":"","sources":["../../src/domain/executed.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC7E,OAAO,EACL,aAAa,EACb,aAAa,EACb,QAAQ,EACR,MAAM,EACN,KAAK,EACL,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,UAAU,EACV,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,OAAO,EACR,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,WAAW,EAAE,MA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