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.
- package/AGENTS.md +209 -0
- package/LICENSE +21 -0
- package/LLMS.md +6707 -0
- package/README.md +300 -0
- package/dist/domain/bcs.d.ts +101 -0
- package/dist/domain/bcs.d.ts.map +1 -0
- package/dist/domain/bcs.js +183 -0
- package/dist/domain/bcs.js.map +1 -0
- package/dist/domain/errors.d.ts +595 -0
- package/dist/domain/errors.d.ts.map +1 -0
- package/dist/domain/errors.js +476 -0
- package/dist/domain/errors.js.map +1 -0
- package/dist/domain/executed.d.ts +325 -0
- package/dist/domain/executed.d.ts.map +1 -0
- package/dist/domain/executed.js +253 -0
- package/dist/domain/executed.js.map +1 -0
- package/dist/domain/journal-entry.d.ts +468 -0
- package/dist/domain/journal-entry.d.ts.map +1 -0
- package/dist/domain/journal-entry.js +63 -0
- package/dist/domain/journal-entry.js.map +1 -0
- package/dist/domain/schemas.d.ts +950 -0
- package/dist/domain/schemas.d.ts.map +1 -0
- package/dist/domain/schemas.js +571 -0
- package/dist/domain/schemas.js.map +1 -0
- package/dist/domain/sui-schema.d.ts +12 -0
- package/dist/domain/sui-schema.d.ts.map +1 -0
- package/dist/domain/sui-schema.js +12 -0
- package/dist/domain/sui-schema.js.map +1 -0
- package/dist/extension.d.ts +7 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +7 -0
- package/dist/extension.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +18 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +18 -0
- package/dist/internal.js.map +1 -0
- package/dist/journal.d.ts +51 -0
- package/dist/journal.d.ts.map +1 -0
- package/dist/journal.js +18 -0
- package/dist/journal.js.map +1 -0
- package/dist/script.d.ts +7 -0
- package/dist/script.d.ts.map +1 -0
- package/dist/script.js +7 -0
- package/dist/script.js.map +1 -0
- package/dist/services/Journal.d.ts +76 -0
- package/dist/services/Journal.d.ts.map +1 -0
- package/dist/services/Journal.js +70 -0
- package/dist/services/Journal.js.map +1 -0
- package/dist/services/JournalKeyValueStore.d.ts +73 -0
- package/dist/services/JournalKeyValueStore.d.ts.map +1 -0
- package/dist/services/JournalKeyValueStore.js +155 -0
- package/dist/services/JournalKeyValueStore.js.map +1 -0
- package/dist/services/Script.d.ts +210 -0
- package/dist/services/Script.d.ts.map +1 -0
- package/dist/services/Script.js +441 -0
- package/dist/services/Script.js.map +1 -0
- package/dist/services/Signer.d.ts +132 -0
- package/dist/services/Signer.d.ts.map +1 -0
- package/dist/services/Signer.js +158 -0
- package/dist/services/Signer.js.map +1 -0
- package/dist/services/SubmitConfig.d.ts +175 -0
- package/dist/services/SubmitConfig.d.ts.map +1 -0
- package/dist/services/SubmitConfig.js +52 -0
- package/dist/services/SubmitConfig.js.map +1 -0
- package/dist/services/Sui.d.ts +295 -0
- package/dist/services/Sui.d.ts.map +1 -0
- package/dist/services/Sui.js +414 -0
- package/dist/services/Sui.js.map +1 -0
- package/dist/services/SuiCore.d.ts +227 -0
- package/dist/services/SuiCore.d.ts.map +1 -0
- package/dist/services/SuiCore.js +400 -0
- package/dist/services/SuiCore.js.map +1 -0
- package/dist/services/SuiCoreFake.d.ts +278 -0
- package/dist/services/SuiCoreFake.d.ts.map +1 -0
- package/dist/services/SuiCoreFake.js +1003 -0
- package/dist/services/SuiCoreFake.js.map +1 -0
- package/dist/services/SuiExtension.d.ts +208 -0
- package/dist/services/SuiExtension.d.ts.map +1 -0
- package/dist/services/SuiExtension.js +355 -0
- package/dist/services/SuiExtension.js.map +1 -0
- package/dist/services/SuiGraphQL.d.ts +98 -0
- package/dist/services/SuiGraphQL.d.ts.map +1 -0
- package/dist/services/SuiGraphQL.js +118 -0
- package/dist/services/SuiGraphQL.js.map +1 -0
- package/dist/services/Tx.d.ts +687 -0
- package/dist/services/Tx.d.ts.map +1 -0
- package/dist/services/Tx.js +1224 -0
- package/dist/services/Tx.js.map +1 -0
- package/dist/testing.d.ts +88 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +163 -0
- package/dist/testing.js.map +1 -0
- package/dist/tx.d.ts +24 -0
- package/dist/tx.d.ts.map +1 -0
- package/dist/tx.js +24 -0
- package/dist/tx.js.map +1 -0
- package/docs/extensions.md +1685 -0
- package/examples/extension-template/README.md +170 -0
- package/examples/extension-template/package.json +44 -0
- package/examples/extension-template/scripts/check-package.ts +145 -0
- package/examples/extension-template/src/Escrow.ts +445 -0
- package/examples/extension-template/src/Platform.ts +136 -0
- package/examples/extension-template/src/errors.ts +61 -0
- package/examples/extension-template/src/extension.ts +63 -0
- package/examples/extension-template/src/index.ts +34 -0
- package/examples/extension-template/src/schema.ts +158 -0
- package/examples/extension-template/src/upstream.ts +66 -0
- package/examples/extension-template/test/escrow.test.ts +559 -0
- package/examples/extension-template/tsconfig.build.json +26 -0
- package/examples/extension-template/tsconfig.json +35 -0
- package/package.json +87 -0
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `JournalEntry`: the transaction lifecycle as a serializable union.
|
|
3
|
+
*
|
|
4
|
+
* This is the only place the lifecycle appears as a union; the abstraction a
|
|
5
|
+
* program uses is the functions in `Tx`. An entry exists so that a process that
|
|
6
|
+
* dies between signing and the answer can find out, when it comes back, what it
|
|
7
|
+
* had already put on the wire.
|
|
8
|
+
*
|
|
9
|
+
* @since 0.1.0
|
|
10
|
+
*/
|
|
11
|
+
import { Schema } from "effect";
|
|
12
|
+
/**
|
|
13
|
+
* One line of the submission journal.
|
|
14
|
+
*
|
|
15
|
+
* `Signed` is written before the first `executeTransaction` and means the bytes
|
|
16
|
+
* may be on the wire. `Executed`, `Failed` and `NotApplied` are terminal:
|
|
17
|
+
* `Executed` and `Failed` because the network answered, `NotApplied` because
|
|
18
|
+
* the transaction was proven never to have applied and never will. `Unknown`
|
|
19
|
+
* means the answer never arrived and the bytes are kept so `Tx.reconcile` can
|
|
20
|
+
* settle it later.
|
|
21
|
+
*
|
|
22
|
+
* Without a terminal `NotApplied`, a durable journal would hold a proven-dead
|
|
23
|
+
* submission as `Unknown` forever and `onUnresolved: "fail"` would refuse to
|
|
24
|
+
* build for the life of the store.
|
|
25
|
+
*/
|
|
26
|
+
export declare const JournalEntry: Schema.TaggedUnion<{
|
|
27
|
+
readonly Unknown: Schema.TaggedStruct<"Unknown", {
|
|
28
|
+
readonly digest: Schema.brand<Schema.String, "Digest">;
|
|
29
|
+
readonly signed: Schema.Struct<{
|
|
30
|
+
readonly digest: Schema.brand<Schema.String, "Digest">;
|
|
31
|
+
readonly bytes: Schema.Uint8ArrayFromBase64;
|
|
32
|
+
readonly signatures: Schema.$Array<Schema.brand<Schema.String, "Signature">>;
|
|
33
|
+
readonly sender: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "SuiAddress">;
|
|
34
|
+
readonly expiration: Schema.optional<Schema.toTaggedUnion<"$kind", readonly [Schema.Struct<{
|
|
35
|
+
readonly $kind: Schema.Literal<"None">;
|
|
36
|
+
readonly None: Schema.Literal<true>;
|
|
37
|
+
}>, Schema.Struct<{
|
|
38
|
+
readonly $kind: Schema.Literal<"Epoch">;
|
|
39
|
+
readonly Epoch: Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>;
|
|
40
|
+
}>, Schema.Struct<{
|
|
41
|
+
readonly $kind: Schema.Literal<"ValidDuring">;
|
|
42
|
+
readonly ValidDuring: Schema.Struct<{
|
|
43
|
+
readonly minEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
44
|
+
readonly maxEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
45
|
+
readonly minTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
46
|
+
readonly maxTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
47
|
+
readonly chain: Schema.String;
|
|
48
|
+
readonly nonce: Schema.Number;
|
|
49
|
+
}>;
|
|
50
|
+
}>, Schema.Struct<{
|
|
51
|
+
readonly $kind: Schema.Literal<"Validity">;
|
|
52
|
+
readonly Validity: Schema.Struct<{
|
|
53
|
+
readonly allowedProposers: Schema.NullOr<Schema.Struct<{
|
|
54
|
+
readonly epoch: Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>;
|
|
55
|
+
readonly proposers: Schema.$Array<Schema.Number>;
|
|
56
|
+
}>>;
|
|
57
|
+
readonly minEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
58
|
+
readonly maxEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
59
|
+
readonly minTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
60
|
+
readonly maxTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
61
|
+
readonly chain: Schema.String;
|
|
62
|
+
readonly nonce: Schema.Number;
|
|
63
|
+
}>;
|
|
64
|
+
}>]>>;
|
|
65
|
+
readonly chain: Schema.optional<Schema.String>;
|
|
66
|
+
}>;
|
|
67
|
+
readonly lastError: Schema.String;
|
|
68
|
+
readonly attempts: Schema.Number;
|
|
69
|
+
readonly at: Schema.DateTimeUtcFromMillis;
|
|
70
|
+
}>;
|
|
71
|
+
readonly NotApplied: Schema.TaggedStruct<"NotApplied", {
|
|
72
|
+
readonly digest: Schema.brand<Schema.String, "Digest">;
|
|
73
|
+
readonly evidence: Schema.Literals<readonly ["expired", "inputConsumed"]>;
|
|
74
|
+
readonly at: Schema.DateTimeUtcFromMillis;
|
|
75
|
+
}>;
|
|
76
|
+
readonly Signed: Schema.TaggedStruct<"Signed", {
|
|
77
|
+
readonly digest: Schema.brand<Schema.String, "Digest">;
|
|
78
|
+
readonly signed: Schema.Struct<{
|
|
79
|
+
readonly digest: Schema.brand<Schema.String, "Digest">;
|
|
80
|
+
readonly bytes: Schema.Uint8ArrayFromBase64;
|
|
81
|
+
readonly signatures: Schema.$Array<Schema.brand<Schema.String, "Signature">>;
|
|
82
|
+
readonly sender: Schema.brand<Schema.decodeTo<Schema.toType<Schema.String>, Schema.String, never, never>, "SuiAddress">;
|
|
83
|
+
readonly expiration: Schema.optional<Schema.toTaggedUnion<"$kind", readonly [Schema.Struct<{
|
|
84
|
+
readonly $kind: Schema.Literal<"None">;
|
|
85
|
+
readonly None: Schema.Literal<true>;
|
|
86
|
+
}>, Schema.Struct<{
|
|
87
|
+
readonly $kind: Schema.Literal<"Epoch">;
|
|
88
|
+
readonly Epoch: Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>;
|
|
89
|
+
}>, Schema.Struct<{
|
|
90
|
+
readonly $kind: Schema.Literal<"ValidDuring">;
|
|
91
|
+
readonly ValidDuring: Schema.Struct<{
|
|
92
|
+
readonly minEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
93
|
+
readonly maxEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
94
|
+
readonly minTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
95
|
+
readonly maxTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
96
|
+
readonly chain: Schema.String;
|
|
97
|
+
readonly nonce: Schema.Number;
|
|
98
|
+
}>;
|
|
99
|
+
}>, Schema.Struct<{
|
|
100
|
+
readonly $kind: Schema.Literal<"Validity">;
|
|
101
|
+
readonly Validity: Schema.Struct<{
|
|
102
|
+
readonly allowedProposers: Schema.NullOr<Schema.Struct<{
|
|
103
|
+
readonly epoch: Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>;
|
|
104
|
+
readonly proposers: Schema.$Array<Schema.Number>;
|
|
105
|
+
}>>;
|
|
106
|
+
readonly minEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
107
|
+
readonly maxEpoch: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
108
|
+
readonly minTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
109
|
+
readonly maxTimestamp: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Union<readonly [Schema.String, Schema.Number]>, never, never>>;
|
|
110
|
+
readonly chain: Schema.String;
|
|
111
|
+
readonly nonce: Schema.Number;
|
|
112
|
+
}>;
|
|
113
|
+
}>]>>;
|
|
114
|
+
readonly chain: Schema.optional<Schema.String>;
|
|
115
|
+
}>;
|
|
116
|
+
readonly signedAt: Schema.DateTimeUtcFromMillis;
|
|
117
|
+
}>;
|
|
118
|
+
readonly Executed: Schema.TaggedStruct<"Executed", {
|
|
119
|
+
readonly digest: Schema.brand<Schema.String, "Digest">;
|
|
120
|
+
readonly checkpoint: Schema.optional<Schema.BigIntFromString>;
|
|
121
|
+
readonly at: Schema.DateTimeUtcFromMillis;
|
|
122
|
+
}>;
|
|
123
|
+
readonly Failed: Schema.TaggedStruct<"Failed", {
|
|
124
|
+
readonly digest: Schema.brand<Schema.String, "Digest">;
|
|
125
|
+
readonly reason: Schema.toTaggedUnion<"$kind", readonly [Schema.Struct<{
|
|
126
|
+
readonly $kind: Schema.Literal<"MoveAbort">;
|
|
127
|
+
readonly MoveAbort: Schema.Struct<{
|
|
128
|
+
readonly abortCode: Schema.BigIntFromString;
|
|
129
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
130
|
+
readonly package: Schema.optional<Schema.String>;
|
|
131
|
+
readonly module: Schema.optional<Schema.String>;
|
|
132
|
+
readonly function: Schema.optional<Schema.Number>;
|
|
133
|
+
readonly functionName: Schema.optional<Schema.String>;
|
|
134
|
+
readonly instruction: Schema.optional<Schema.Number>;
|
|
135
|
+
}>>;
|
|
136
|
+
readonly cleverError: Schema.optional<Schema.Struct<{
|
|
137
|
+
readonly errorCode: Schema.optional<Schema.Number>;
|
|
138
|
+
readonly lineNumber: Schema.optional<Schema.Number>;
|
|
139
|
+
readonly constantName: Schema.optional<Schema.String>;
|
|
140
|
+
readonly constantType: Schema.optional<Schema.String>;
|
|
141
|
+
readonly value: Schema.optional<Schema.String>;
|
|
142
|
+
}>>;
|
|
143
|
+
}>;
|
|
144
|
+
}>, Schema.Struct<{
|
|
145
|
+
readonly $kind: Schema.Literal<"SizeError">;
|
|
146
|
+
readonly SizeError: Schema.Struct<{
|
|
147
|
+
readonly name: Schema.String;
|
|
148
|
+
readonly size: Schema.Number;
|
|
149
|
+
readonly maxSize: Schema.Number;
|
|
150
|
+
}>;
|
|
151
|
+
}>, Schema.Struct<{
|
|
152
|
+
readonly $kind: Schema.Literal<"CommandArgumentError">;
|
|
153
|
+
readonly CommandArgumentError: Schema.Struct<{
|
|
154
|
+
readonly argument: Schema.Number;
|
|
155
|
+
readonly name: Schema.String;
|
|
156
|
+
}>;
|
|
157
|
+
}>, Schema.Struct<{
|
|
158
|
+
readonly $kind: Schema.Literal<"TypeArgumentError">;
|
|
159
|
+
readonly TypeArgumentError: Schema.Struct<{
|
|
160
|
+
readonly typeArgument: Schema.Number;
|
|
161
|
+
readonly name: Schema.String;
|
|
162
|
+
}>;
|
|
163
|
+
}>, Schema.Struct<{
|
|
164
|
+
readonly $kind: Schema.Literal<"PackageUpgradeError">;
|
|
165
|
+
readonly PackageUpgradeError: Schema.Struct<{
|
|
166
|
+
readonly name: Schema.String;
|
|
167
|
+
readonly packageId: Schema.optional<Schema.String>;
|
|
168
|
+
readonly digest: Schema.optional<Schema.String>;
|
|
169
|
+
}>;
|
|
170
|
+
}>, Schema.Struct<{
|
|
171
|
+
readonly $kind: Schema.Literal<"IndexError">;
|
|
172
|
+
readonly IndexError: Schema.Struct<{
|
|
173
|
+
readonly index: Schema.optional<Schema.Number>;
|
|
174
|
+
readonly subresult: Schema.optional<Schema.Number>;
|
|
175
|
+
}>;
|
|
176
|
+
}>, Schema.Struct<{
|
|
177
|
+
readonly $kind: Schema.Literal<"CoinDenyListError">;
|
|
178
|
+
readonly CoinDenyListError: Schema.Struct<{
|
|
179
|
+
readonly name: Schema.String;
|
|
180
|
+
readonly coinType: Schema.String;
|
|
181
|
+
readonly address: Schema.optional<Schema.String>;
|
|
182
|
+
}>;
|
|
183
|
+
}>, Schema.Struct<{
|
|
184
|
+
readonly $kind: Schema.Literal<"CongestedObjects">;
|
|
185
|
+
readonly CongestedObjects: Schema.Struct<{
|
|
186
|
+
readonly name: Schema.String;
|
|
187
|
+
readonly objects: Schema.$Array<Schema.String>;
|
|
188
|
+
}>;
|
|
189
|
+
}>, Schema.Struct<{
|
|
190
|
+
readonly $kind: Schema.Literal<"ObjectIdError">;
|
|
191
|
+
readonly ObjectIdError: Schema.Struct<{
|
|
192
|
+
readonly name: Schema.optional<Schema.String>;
|
|
193
|
+
readonly objectId: Schema.String;
|
|
194
|
+
}>;
|
|
195
|
+
}>, Schema.Struct<{
|
|
196
|
+
readonly $kind: Schema.Literal<"Unknown">;
|
|
197
|
+
}>]>;
|
|
198
|
+
readonly at: Schema.DateTimeUtcFromMillis;
|
|
199
|
+
}>;
|
|
200
|
+
}>;
|
|
201
|
+
export type JournalEntry = typeof JournalEntry.Type;
|
|
202
|
+
/** The tags whose entries still need an answer from the network. */
|
|
203
|
+
export declare const UNRESOLVED_TAGS: readonly ["Signed", "Unknown"];
|
|
204
|
+
/**
|
|
205
|
+
* Whether this entry is still waiting for an answer, and therefore something
|
|
206
|
+
* `Tx.reconcileAll` has work to do about. Never fails.
|
|
207
|
+
*/
|
|
208
|
+
export declare const isUnresolved: (value: {
|
|
209
|
+
readonly _tag: "Unknown";
|
|
210
|
+
readonly digest: string & import("effect/Brand").Brand<"Digest">;
|
|
211
|
+
readonly signed: {
|
|
212
|
+
readonly digest: string & import("effect/Brand").Brand<"Digest">;
|
|
213
|
+
readonly sender: string & import("effect/Brand").Brand<"SuiAddress">;
|
|
214
|
+
readonly signatures: readonly (string & import("effect/Brand").Brand<"Signature">)[];
|
|
215
|
+
readonly bytes: Uint8Array<ArrayBufferLike>;
|
|
216
|
+
readonly chain?: string | undefined;
|
|
217
|
+
readonly expiration?: {
|
|
218
|
+
readonly $kind: "None";
|
|
219
|
+
readonly None: true;
|
|
220
|
+
} | {
|
|
221
|
+
readonly $kind: "Epoch";
|
|
222
|
+
readonly Epoch: bigint;
|
|
223
|
+
} | {
|
|
224
|
+
readonly $kind: "ValidDuring";
|
|
225
|
+
readonly ValidDuring: {
|
|
226
|
+
readonly minEpoch: bigint | null;
|
|
227
|
+
readonly maxEpoch: bigint | null;
|
|
228
|
+
readonly minTimestamp: bigint | null;
|
|
229
|
+
readonly maxTimestamp: bigint | null;
|
|
230
|
+
readonly chain: string;
|
|
231
|
+
readonly nonce: number;
|
|
232
|
+
};
|
|
233
|
+
} | {
|
|
234
|
+
readonly $kind: "Validity";
|
|
235
|
+
readonly Validity: {
|
|
236
|
+
readonly allowedProposers: {
|
|
237
|
+
readonly epoch: bigint;
|
|
238
|
+
readonly proposers: readonly number[];
|
|
239
|
+
} | null;
|
|
240
|
+
readonly minEpoch: bigint | null;
|
|
241
|
+
readonly maxEpoch: bigint | null;
|
|
242
|
+
readonly minTimestamp: bigint | null;
|
|
243
|
+
readonly maxTimestamp: bigint | null;
|
|
244
|
+
readonly chain: string;
|
|
245
|
+
readonly nonce: number;
|
|
246
|
+
};
|
|
247
|
+
} | undefined;
|
|
248
|
+
};
|
|
249
|
+
readonly lastError: string;
|
|
250
|
+
readonly attempts: number;
|
|
251
|
+
readonly at: import("effect/DateTime").Utc;
|
|
252
|
+
} | {
|
|
253
|
+
readonly _tag: "NotApplied";
|
|
254
|
+
readonly digest: string & import("effect/Brand").Brand<"Digest">;
|
|
255
|
+
readonly evidence: "expired" | "inputConsumed";
|
|
256
|
+
readonly at: import("effect/DateTime").Utc;
|
|
257
|
+
} | {
|
|
258
|
+
readonly _tag: "Signed";
|
|
259
|
+
readonly digest: string & import("effect/Brand").Brand<"Digest">;
|
|
260
|
+
readonly signed: {
|
|
261
|
+
readonly digest: string & import("effect/Brand").Brand<"Digest">;
|
|
262
|
+
readonly sender: string & import("effect/Brand").Brand<"SuiAddress">;
|
|
263
|
+
readonly signatures: readonly (string & import("effect/Brand").Brand<"Signature">)[];
|
|
264
|
+
readonly bytes: Uint8Array<ArrayBufferLike>;
|
|
265
|
+
readonly chain?: string | undefined;
|
|
266
|
+
readonly expiration?: {
|
|
267
|
+
readonly $kind: "None";
|
|
268
|
+
readonly None: true;
|
|
269
|
+
} | {
|
|
270
|
+
readonly $kind: "Epoch";
|
|
271
|
+
readonly Epoch: bigint;
|
|
272
|
+
} | {
|
|
273
|
+
readonly $kind: "ValidDuring";
|
|
274
|
+
readonly ValidDuring: {
|
|
275
|
+
readonly minEpoch: bigint | null;
|
|
276
|
+
readonly maxEpoch: bigint | null;
|
|
277
|
+
readonly minTimestamp: bigint | null;
|
|
278
|
+
readonly maxTimestamp: bigint | null;
|
|
279
|
+
readonly chain: string;
|
|
280
|
+
readonly nonce: number;
|
|
281
|
+
};
|
|
282
|
+
} | {
|
|
283
|
+
readonly $kind: "Validity";
|
|
284
|
+
readonly Validity: {
|
|
285
|
+
readonly allowedProposers: {
|
|
286
|
+
readonly epoch: bigint;
|
|
287
|
+
readonly proposers: readonly number[];
|
|
288
|
+
} | null;
|
|
289
|
+
readonly minEpoch: bigint | null;
|
|
290
|
+
readonly maxEpoch: bigint | null;
|
|
291
|
+
readonly minTimestamp: bigint | null;
|
|
292
|
+
readonly maxTimestamp: bigint | null;
|
|
293
|
+
readonly chain: string;
|
|
294
|
+
readonly nonce: number;
|
|
295
|
+
};
|
|
296
|
+
} | undefined;
|
|
297
|
+
};
|
|
298
|
+
readonly signedAt: import("effect/DateTime").Utc;
|
|
299
|
+
} | {
|
|
300
|
+
readonly at: import("effect/DateTime").Utc;
|
|
301
|
+
readonly digest: string & import("effect/Brand").Brand<"Digest">;
|
|
302
|
+
readonly _tag: "Executed";
|
|
303
|
+
readonly checkpoint?: bigint | undefined;
|
|
304
|
+
} | {
|
|
305
|
+
readonly _tag: "Failed";
|
|
306
|
+
readonly digest: string & import("effect/Brand").Brand<"Digest">;
|
|
307
|
+
readonly reason: {
|
|
308
|
+
readonly $kind: "MoveAbort";
|
|
309
|
+
readonly MoveAbort: {
|
|
310
|
+
readonly abortCode: bigint;
|
|
311
|
+
readonly location?: {
|
|
312
|
+
readonly function?: number | undefined;
|
|
313
|
+
readonly package?: string | undefined;
|
|
314
|
+
readonly module?: string | undefined;
|
|
315
|
+
readonly functionName?: string | undefined;
|
|
316
|
+
readonly instruction?: number | undefined;
|
|
317
|
+
} | undefined;
|
|
318
|
+
readonly cleverError?: {
|
|
319
|
+
readonly value?: string | undefined;
|
|
320
|
+
readonly errorCode?: number | undefined;
|
|
321
|
+
readonly lineNumber?: number | undefined;
|
|
322
|
+
readonly constantName?: string | undefined;
|
|
323
|
+
readonly constantType?: string | undefined;
|
|
324
|
+
} | undefined;
|
|
325
|
+
};
|
|
326
|
+
} | {
|
|
327
|
+
readonly $kind: "SizeError";
|
|
328
|
+
readonly SizeError: {
|
|
329
|
+
readonly name: string;
|
|
330
|
+
readonly size: number;
|
|
331
|
+
readonly maxSize: number;
|
|
332
|
+
};
|
|
333
|
+
} | {
|
|
334
|
+
readonly $kind: "CommandArgumentError";
|
|
335
|
+
readonly CommandArgumentError: {
|
|
336
|
+
readonly argument: number;
|
|
337
|
+
readonly name: string;
|
|
338
|
+
};
|
|
339
|
+
} | {
|
|
340
|
+
readonly $kind: "TypeArgumentError";
|
|
341
|
+
readonly TypeArgumentError: {
|
|
342
|
+
readonly typeArgument: number;
|
|
343
|
+
readonly name: string;
|
|
344
|
+
};
|
|
345
|
+
} | {
|
|
346
|
+
readonly $kind: "PackageUpgradeError";
|
|
347
|
+
readonly PackageUpgradeError: {
|
|
348
|
+
readonly name: string;
|
|
349
|
+
readonly digest?: string | undefined;
|
|
350
|
+
readonly packageId?: string | undefined;
|
|
351
|
+
};
|
|
352
|
+
} | {
|
|
353
|
+
readonly $kind: "IndexError";
|
|
354
|
+
readonly IndexError: {
|
|
355
|
+
readonly index?: number | undefined;
|
|
356
|
+
readonly subresult?: number | undefined;
|
|
357
|
+
};
|
|
358
|
+
} | {
|
|
359
|
+
readonly $kind: "CoinDenyListError";
|
|
360
|
+
readonly CoinDenyListError: {
|
|
361
|
+
readonly coinType: string;
|
|
362
|
+
readonly name: string;
|
|
363
|
+
readonly address?: string | undefined;
|
|
364
|
+
};
|
|
365
|
+
} | {
|
|
366
|
+
readonly $kind: "CongestedObjects";
|
|
367
|
+
readonly CongestedObjects: {
|
|
368
|
+
readonly name: string;
|
|
369
|
+
readonly objects: readonly string[];
|
|
370
|
+
};
|
|
371
|
+
} | {
|
|
372
|
+
readonly $kind: "ObjectIdError";
|
|
373
|
+
readonly ObjectIdError: {
|
|
374
|
+
readonly objectId: string;
|
|
375
|
+
readonly name?: string | undefined;
|
|
376
|
+
};
|
|
377
|
+
} | {
|
|
378
|
+
readonly $kind: "Unknown";
|
|
379
|
+
};
|
|
380
|
+
readonly at: import("effect/DateTime").Utc;
|
|
381
|
+
}) => value is {
|
|
382
|
+
readonly _tag: "Unknown";
|
|
383
|
+
readonly digest: string & import("effect/Brand").Brand<"Digest">;
|
|
384
|
+
readonly signed: {
|
|
385
|
+
readonly digest: string & import("effect/Brand").Brand<"Digest">;
|
|
386
|
+
readonly sender: string & import("effect/Brand").Brand<"SuiAddress">;
|
|
387
|
+
readonly signatures: readonly (string & import("effect/Brand").Brand<"Signature">)[];
|
|
388
|
+
readonly bytes: Uint8Array<ArrayBufferLike>;
|
|
389
|
+
readonly chain?: string | undefined;
|
|
390
|
+
readonly expiration?: {
|
|
391
|
+
readonly $kind: "None";
|
|
392
|
+
readonly None: true;
|
|
393
|
+
} | {
|
|
394
|
+
readonly $kind: "Epoch";
|
|
395
|
+
readonly Epoch: bigint;
|
|
396
|
+
} | {
|
|
397
|
+
readonly $kind: "ValidDuring";
|
|
398
|
+
readonly ValidDuring: {
|
|
399
|
+
readonly minEpoch: bigint | null;
|
|
400
|
+
readonly maxEpoch: bigint | null;
|
|
401
|
+
readonly minTimestamp: bigint | null;
|
|
402
|
+
readonly maxTimestamp: bigint | null;
|
|
403
|
+
readonly chain: string;
|
|
404
|
+
readonly nonce: number;
|
|
405
|
+
};
|
|
406
|
+
} | {
|
|
407
|
+
readonly $kind: "Validity";
|
|
408
|
+
readonly Validity: {
|
|
409
|
+
readonly allowedProposers: {
|
|
410
|
+
readonly epoch: bigint;
|
|
411
|
+
readonly proposers: readonly number[];
|
|
412
|
+
} | null;
|
|
413
|
+
readonly minEpoch: bigint | null;
|
|
414
|
+
readonly maxEpoch: bigint | null;
|
|
415
|
+
readonly minTimestamp: bigint | null;
|
|
416
|
+
readonly maxTimestamp: bigint | null;
|
|
417
|
+
readonly chain: string;
|
|
418
|
+
readonly nonce: number;
|
|
419
|
+
};
|
|
420
|
+
} | undefined;
|
|
421
|
+
};
|
|
422
|
+
readonly lastError: string;
|
|
423
|
+
readonly attempts: number;
|
|
424
|
+
readonly at: import("effect/DateTime").Utc;
|
|
425
|
+
} | {
|
|
426
|
+
readonly _tag: "Signed";
|
|
427
|
+
readonly digest: string & import("effect/Brand").Brand<"Digest">;
|
|
428
|
+
readonly signed: {
|
|
429
|
+
readonly digest: string & import("effect/Brand").Brand<"Digest">;
|
|
430
|
+
readonly sender: string & import("effect/Brand").Brand<"SuiAddress">;
|
|
431
|
+
readonly signatures: readonly (string & import("effect/Brand").Brand<"Signature">)[];
|
|
432
|
+
readonly bytes: Uint8Array<ArrayBufferLike>;
|
|
433
|
+
readonly chain?: string | undefined;
|
|
434
|
+
readonly expiration?: {
|
|
435
|
+
readonly $kind: "None";
|
|
436
|
+
readonly None: true;
|
|
437
|
+
} | {
|
|
438
|
+
readonly $kind: "Epoch";
|
|
439
|
+
readonly Epoch: bigint;
|
|
440
|
+
} | {
|
|
441
|
+
readonly $kind: "ValidDuring";
|
|
442
|
+
readonly ValidDuring: {
|
|
443
|
+
readonly minEpoch: bigint | null;
|
|
444
|
+
readonly maxEpoch: bigint | null;
|
|
445
|
+
readonly minTimestamp: bigint | null;
|
|
446
|
+
readonly maxTimestamp: bigint | null;
|
|
447
|
+
readonly chain: string;
|
|
448
|
+
readonly nonce: number;
|
|
449
|
+
};
|
|
450
|
+
} | {
|
|
451
|
+
readonly $kind: "Validity";
|
|
452
|
+
readonly Validity: {
|
|
453
|
+
readonly allowedProposers: {
|
|
454
|
+
readonly epoch: bigint;
|
|
455
|
+
readonly proposers: readonly number[];
|
|
456
|
+
} | null;
|
|
457
|
+
readonly minEpoch: bigint | null;
|
|
458
|
+
readonly maxEpoch: bigint | null;
|
|
459
|
+
readonly minTimestamp: bigint | null;
|
|
460
|
+
readonly maxTimestamp: bigint | null;
|
|
461
|
+
readonly chain: string;
|
|
462
|
+
readonly nonce: number;
|
|
463
|
+
};
|
|
464
|
+
} | undefined;
|
|
465
|
+
};
|
|
466
|
+
readonly signedAt: import("effect/DateTime").Utc;
|
|
467
|
+
};
|
|
468
|
+
//# sourceMappingURL=journal-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journal-entry.d.ts","sourceRoot":"","sources":["../../src/domain/journal-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAG/B;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BvB,CAAA;AACF,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA;AAEnD,oEAAoE;AACpE,eAAO,MAAM,eAAe,gCAAiC,CAAA;AAE7D;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAwC,CAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `JournalEntry`: the transaction lifecycle as a serializable union.
|
|
3
|
+
*
|
|
4
|
+
* This is the only place the lifecycle appears as a union; the abstraction a
|
|
5
|
+
* program uses is the functions in `Tx`. An entry exists so that a process that
|
|
6
|
+
* dies between signing and the answer can find out, when it comes back, what it
|
|
7
|
+
* had already put on the wire.
|
|
8
|
+
*
|
|
9
|
+
* @since 0.1.0
|
|
10
|
+
*/
|
|
11
|
+
import { Schema } from "effect";
|
|
12
|
+
import { Digest, ExecutionReason, NotAppliedEvidence, SignedTransaction } from "./schemas.js";
|
|
13
|
+
/**
|
|
14
|
+
* One line of the submission journal.
|
|
15
|
+
*
|
|
16
|
+
* `Signed` is written before the first `executeTransaction` and means the bytes
|
|
17
|
+
* may be on the wire. `Executed`, `Failed` and `NotApplied` are terminal:
|
|
18
|
+
* `Executed` and `Failed` because the network answered, `NotApplied` because
|
|
19
|
+
* the transaction was proven never to have applied and never will. `Unknown`
|
|
20
|
+
* means the answer never arrived and the bytes are kept so `Tx.reconcile` can
|
|
21
|
+
* settle it later.
|
|
22
|
+
*
|
|
23
|
+
* Without a terminal `NotApplied`, a durable journal would hold a proven-dead
|
|
24
|
+
* submission as `Unknown` forever and `onUnresolved: "fail"` would refuse to
|
|
25
|
+
* build for the life of the store.
|
|
26
|
+
*/
|
|
27
|
+
export const JournalEntry = Schema.TaggedUnion({
|
|
28
|
+
Signed: {
|
|
29
|
+
digest: Digest,
|
|
30
|
+
signed: SignedTransaction,
|
|
31
|
+
signedAt: Schema.DateTimeUtcFromMillis
|
|
32
|
+
},
|
|
33
|
+
Executed: {
|
|
34
|
+
digest: Digest,
|
|
35
|
+
checkpoint: Schema.optional(Schema.BigIntFromString),
|
|
36
|
+
at: Schema.DateTimeUtcFromMillis
|
|
37
|
+
},
|
|
38
|
+
Failed: {
|
|
39
|
+
digest: Digest,
|
|
40
|
+
reason: ExecutionReason,
|
|
41
|
+
at: Schema.DateTimeUtcFromMillis
|
|
42
|
+
},
|
|
43
|
+
Unknown: {
|
|
44
|
+
digest: Digest,
|
|
45
|
+
signed: SignedTransaction,
|
|
46
|
+
lastError: Schema.String,
|
|
47
|
+
attempts: Schema.Number,
|
|
48
|
+
at: Schema.DateTimeUtcFromMillis
|
|
49
|
+
},
|
|
50
|
+
NotApplied: {
|
|
51
|
+
digest: Digest,
|
|
52
|
+
evidence: NotAppliedEvidence,
|
|
53
|
+
at: Schema.DateTimeUtcFromMillis
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
/** The tags whose entries still need an answer from the network. */
|
|
57
|
+
export const UNRESOLVED_TAGS = ["Signed", "Unknown"];
|
|
58
|
+
/**
|
|
59
|
+
* Whether this entry is still waiting for an answer, and therefore something
|
|
60
|
+
* `Tx.reconcileAll` has work to do about. Never fails.
|
|
61
|
+
*/
|
|
62
|
+
export const isUnresolved = JournalEntry.isAnyOf(UNRESOLVED_TAGS);
|
|
63
|
+
//# sourceMappingURL=journal-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journal-entry.js","sourceRoot":"","sources":["../../src/domain/journal-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAE7F;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC;IAC7C,MAAM,EAAE;QACN,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,iBAAiB;QACzB,QAAQ,EAAE,MAAM,CAAC,qBAAqB;KACvC;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC;QACpD,EAAE,EAAE,MAAM,CAAC,qBAAqB;KACjC;IACD,MAAM,EAAE;QACN,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,eAAe;QACvB,EAAE,EAAE,MAAM,CAAC,qBAAqB;KACjC;IACD,OAAO,EAAE;QACP,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,iBAAiB;QACzB,SAAS,EAAE,MAAM,CAAC,MAAM;QACxB,QAAQ,EAAE,MAAM,CAAC,MAAM;QACvB,EAAE,EAAE,MAAM,CAAC,qBAAqB;KACjC;IACD,UAAU,EAAE;QACV,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,kBAAkB;QAC5B,EAAE,EAAE,MAAM,CAAC,qBAAqB;KACjC;CACF,CAAC,CAAA;AAGF,oEAAoE;AACpE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAU,CAAA;AAE7D;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA"}
|