@unconfirmed/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 +147 -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,476 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The closed error taxonomy. Every failure sui-effect can produce is one of the
|
|
3
|
+
* classes in this file, every one is a `Schema.TaggedError` so it serializes,
|
|
4
|
+
* and the tags are flat: there is no error inheritance to match on.
|
|
5
|
+
*
|
|
6
|
+
* @since 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
import { Result, Schema } from "effect";
|
|
9
|
+
import { Digest, ExecutionReason, NotAppliedEvidence, ObjectId, SignedTransaction, TransactionEffects, Version } from "./schemas.js";
|
|
10
|
+
export { CleverError, ExecutionReason, MoveLocation } from "./schemas.js";
|
|
11
|
+
/**
|
|
12
|
+
* A request did not reach a usable answer. `retryable` is true for the statuses
|
|
13
|
+
* a read may be retried on: gRPC `UNAVAILABLE`, `DEADLINE_EXCEEDED`,
|
|
14
|
+
* `RESOURCE_EXHAUSTED`, `INTERNAL` and `UNKNOWN`, HTTP 5xx and 429, and
|
|
15
|
+
* timeouts. `INTERNAL` and `UNKNOWN` are in the set because the grpc-web
|
|
16
|
+
* transport reports a refused connection or a DNS failure as `INTERNAL` and an
|
|
17
|
+
* HTTP 500 as `UNKNOWN`, so without them a node that is merely down is never
|
|
18
|
+
* retried.
|
|
19
|
+
*/
|
|
20
|
+
export class TransportError extends Schema.TaggedError()("TransportError", {
|
|
21
|
+
method: Schema.String,
|
|
22
|
+
retryable: Schema.Boolean,
|
|
23
|
+
status: Schema.optional(Schema.String),
|
|
24
|
+
cause: Schema.Defect()
|
|
25
|
+
}) {
|
|
26
|
+
/**
|
|
27
|
+
* Builds a `TransportError` out of whatever a call threw, classifying the
|
|
28
|
+
* status and the retryability the way `SuiCore` does for the SDK's own
|
|
29
|
+
* failures.
|
|
30
|
+
*
|
|
31
|
+
* This is for an extension that makes its own network calls — an operator
|
|
32
|
+
* HTTP API, a GraphQL endpoint, a sidecar — and wants its failures to sit on
|
|
33
|
+
* the same axis as the library's: `retryable` read off a gRPC status name, an
|
|
34
|
+
* HTTP status number (5xx and 429), or an abort or timeout, and `status`
|
|
35
|
+
* recorded as the node or the transport spelled it. Hand-building the three
|
|
36
|
+
* fields per call site is how they drift.
|
|
37
|
+
*
|
|
38
|
+
* `retryable` may be forced when the caller knows better than the shape of
|
|
39
|
+
* the cause — an idempotent read that is always safe to repeat, a write that
|
|
40
|
+
* never is. Left out, it is inferred, and inferred conservatively: an
|
|
41
|
+
* unrecognisable cause is **not** retryable.
|
|
42
|
+
*
|
|
43
|
+
* Never fails.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { TransportError } from "@unconfirmed/sui-effect"
|
|
48
|
+
* import { Effect } from "effect"
|
|
49
|
+
*
|
|
50
|
+
* const status = Effect.tryPromise({
|
|
51
|
+
* try: (signal) => fetch("https://operator.example/status", { signal }),
|
|
52
|
+
* catch: (cause) => TransportError.fromUnknown("operator.status", cause)
|
|
53
|
+
* })
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
static fromUnknown = (method, cause, retryable) => {
|
|
57
|
+
const classified = classifyTransportCause(cause);
|
|
58
|
+
return new TransportError({
|
|
59
|
+
method,
|
|
60
|
+
retryable: retryable ?? classified.retryable,
|
|
61
|
+
...(classified.status === undefined ? {} : { status: classified.status }),
|
|
62
|
+
cause
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* gRPC status names a read may be retried on, plus HTTP 5xx and 429. Timeouts
|
|
68
|
+
* map to `DEADLINE_EXCEEDED` with `retryable: true`.
|
|
69
|
+
*
|
|
70
|
+
* `INTERNAL` and `UNKNOWN` are transport-level failures, not answers from the
|
|
71
|
+
* node: `@protobuf-ts/grpcweb-transport` turns a rejected `fetch` (connection
|
|
72
|
+
* refused, DNS failure) into an `RpcError` with code `INTERNAL`, and its
|
|
73
|
+
* grpc-web format maps HTTP 500 to `UNKNOWN` (503 to `UNAVAILABLE`, 504 to
|
|
74
|
+
* `DEADLINE_EXCEEDED`, 429 to `RESOURCE_EXHAUSTED`). Without them a read
|
|
75
|
+
* against a node that is merely down or restarting is never retried.
|
|
76
|
+
*/
|
|
77
|
+
export const RETRYABLE_GRPC_STATUSES = new Set([
|
|
78
|
+
"UNAVAILABLE",
|
|
79
|
+
"DEADLINE_EXCEEDED",
|
|
80
|
+
"RESOURCE_EXHAUSTED",
|
|
81
|
+
"INTERNAL",
|
|
82
|
+
"UNKNOWN"
|
|
83
|
+
]);
|
|
84
|
+
const isRetryableHttpStatus = (status) => status === 429 || status >= 500;
|
|
85
|
+
/**
|
|
86
|
+
* The `status` and `retryable` of a thrown value: a timeout or an abort, an
|
|
87
|
+
* HTTP status number, a gRPC status name, or nothing recognisable. Never fails.
|
|
88
|
+
*/
|
|
89
|
+
export const classifyTransportCause = (cause) => {
|
|
90
|
+
if (typeof cause !== "object" || cause === null)
|
|
91
|
+
return { retryable: false };
|
|
92
|
+
const record = cause;
|
|
93
|
+
const tag = record["_tag"];
|
|
94
|
+
const name = record["name"];
|
|
95
|
+
if (tag === "TimeoutError" || name === "TimeoutError" || name === "AbortError") {
|
|
96
|
+
return { status: "DEADLINE_EXCEEDED", retryable: true };
|
|
97
|
+
}
|
|
98
|
+
const httpStatus = record["status"];
|
|
99
|
+
if (typeof httpStatus === "number") {
|
|
100
|
+
return { status: String(httpStatus), retryable: isRetryableHttpStatus(httpStatus) };
|
|
101
|
+
}
|
|
102
|
+
const code = record["code"];
|
|
103
|
+
if (typeof code === "string") {
|
|
104
|
+
return { status: code, retryable: RETRYABLE_GRPC_STATUSES.has(code) };
|
|
105
|
+
}
|
|
106
|
+
if (typeof code === "number")
|
|
107
|
+
return { status: String(code), retryable: false };
|
|
108
|
+
return { retryable: false };
|
|
109
|
+
};
|
|
110
|
+
/** The object does not exist, or has never existed. */
|
|
111
|
+
export class ObjectNotFound extends Schema.TaggedError()("ObjectNotFound", {
|
|
112
|
+
objectId: ObjectId,
|
|
113
|
+
version: Schema.optional(Version)
|
|
114
|
+
}) {
|
|
115
|
+
}
|
|
116
|
+
/** The object existed and has been deleted or wrapped. */
|
|
117
|
+
export class ObjectDeleted extends Schema.TaggedError()("ObjectDeleted", {
|
|
118
|
+
objectId: ObjectId,
|
|
119
|
+
version: Schema.optional(Version)
|
|
120
|
+
}) {
|
|
121
|
+
}
|
|
122
|
+
/** The node could not say what happened to the object (`ObjectError.reason: "unknown"`). */
|
|
123
|
+
export class ObjectUnavailable extends Schema.TaggedError()("ObjectUnavailable", { objectId: ObjectId, version: Schema.optional(Version) }) {
|
|
124
|
+
}
|
|
125
|
+
/** No transaction with this digest is known to the node. */
|
|
126
|
+
export class TransactionNotFound extends Schema.TaggedError()("TransactionNotFound", { digest: Digest }) {
|
|
127
|
+
}
|
|
128
|
+
/** The chain identifier the node reported is not the one the layer was built for. */
|
|
129
|
+
export class NetworkMismatch extends Schema.TaggedError()("NetworkMismatch", {
|
|
130
|
+
expected: Schema.String,
|
|
131
|
+
actual: Schema.String
|
|
132
|
+
}) {
|
|
133
|
+
}
|
|
134
|
+
/** BCS content or a schema boundary did not decode. */
|
|
135
|
+
export class DecodeError extends Schema.TaggedError()("DecodeError", {
|
|
136
|
+
objectId: Schema.optional(ObjectId),
|
|
137
|
+
expectedType: Schema.optional(Schema.String),
|
|
138
|
+
issue: Schema.String
|
|
139
|
+
}) {
|
|
140
|
+
}
|
|
141
|
+
/** Simulation reported an execution failure. No gas was charged. */
|
|
142
|
+
export class SimulationFailed extends Schema.TaggedError()("SimulationFailed", {
|
|
143
|
+
reason: ExecutionReason,
|
|
144
|
+
message: Schema.String
|
|
145
|
+
}) {
|
|
146
|
+
}
|
|
147
|
+
/** The transaction was applied on chain and failed. Gas was charged. */
|
|
148
|
+
export class ExecutionFailed extends Schema.TaggedError()("ExecutionFailed", {
|
|
149
|
+
digest: Digest,
|
|
150
|
+
reason: ExecutionReason,
|
|
151
|
+
command: Schema.optional(Schema.Number),
|
|
152
|
+
effects: TransactionEffects
|
|
153
|
+
}) {
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Bytes may have reached the network and the outcome is unknown. Carries the
|
|
157
|
+
* signed transaction so an operator or a later process can reconcile it.
|
|
158
|
+
*/
|
|
159
|
+
export class SubmissionUnknown extends Schema.TaggedError()("SubmissionUnknown", { digest: Digest, signed: Schema.optional(SignedTransaction), cause: Schema.Defect() }) {
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The transaction provably cannot have been applied, and never will be.
|
|
163
|
+
*
|
|
164
|
+
* `evidence` is why. `"inputConsumed"` is only ever produced when a
|
|
165
|
+
* **different** transaction's own effects report that it took a pinned object
|
|
166
|
+
* at exactly the version these bytes pinned. An owned input that merely moved
|
|
167
|
+
* on, one whose consumer took a later version, and one whose last mutation the
|
|
168
|
+
* node will not name are all `SubmissionUnknown`, not this.
|
|
169
|
+
*/
|
|
170
|
+
export class NotApplied extends Schema.TaggedError()("NotApplied", {
|
|
171
|
+
digest: Digest,
|
|
172
|
+
evidence: NotAppliedEvidence
|
|
173
|
+
}) {
|
|
174
|
+
}
|
|
175
|
+
/** A signer refused or failed to produce a signature. */
|
|
176
|
+
export class SigningError extends Schema.TaggedError()("SigningError", {
|
|
177
|
+
cause: Schema.Defect()
|
|
178
|
+
}) {
|
|
179
|
+
}
|
|
180
|
+
/** The transaction could not be built into bytes. */
|
|
181
|
+
export class BuildError extends Schema.TaggedError()("BuildError", {
|
|
182
|
+
message: Schema.String,
|
|
183
|
+
cause: Schema.Defect()
|
|
184
|
+
}) {
|
|
185
|
+
}
|
|
186
|
+
/** A preflight policy refused the transaction before it was signed. */
|
|
187
|
+
export class PolicyDenied extends Schema.TaggedError()("PolicyDenied", {
|
|
188
|
+
rule: Schema.String,
|
|
189
|
+
message: Schema.String
|
|
190
|
+
}) {
|
|
191
|
+
}
|
|
192
|
+
/** The submission journal could not be read or written. */
|
|
193
|
+
export class JournalError extends Schema.TaggedError()("JournalError", {
|
|
194
|
+
cause: Schema.Defect()
|
|
195
|
+
}) {
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The effects of an applied transaction did not contain what the caller
|
|
199
|
+
* expected.
|
|
200
|
+
*
|
|
201
|
+
* Outcome `applied`, and exit 5: this error can only come from an `Executed`,
|
|
202
|
+
* which means the transaction reached the chain and gas was charged. What is
|
|
203
|
+
* missing is a receipt, not the transaction. Classifying it `not_applied`
|
|
204
|
+
* would tell the documented retry idiom to send the caller's intent a second
|
|
205
|
+
* time for a transaction that already ran.
|
|
206
|
+
*/
|
|
207
|
+
export class UnexpectedEffects extends Schema.TaggedError()("UnexpectedEffects", { digest: Digest, expected: Schema.String, found: Schema.Array(ObjectId) }) {
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* The GraphQL endpoint an extension needs is not usable: none was configured,
|
|
211
|
+
* or the one that was could not be reached.
|
|
212
|
+
*
|
|
213
|
+
* sui-effect does not wrap the GraphQL API — it owns the {@link SuiGraphQL}
|
|
214
|
+
* *tag*, so two extensions that both read GraphQL share one client rather than
|
|
215
|
+
* opening two. This is the failure the tag's `layerUnavailable` produces, which
|
|
216
|
+
* is what an application provides when it has no endpoint: every call rejects
|
|
217
|
+
* with this instead of the extension discovering a missing dependency at
|
|
218
|
+
* construction. An extension maps it into its own union, or lets it through.
|
|
219
|
+
*
|
|
220
|
+
* Outcome `not_applied`: a read that did not happen changed nothing.
|
|
221
|
+
*/
|
|
222
|
+
export class GraphQLUnavailable extends Schema.TaggedError()("GraphQLUnavailable", { method: Schema.String, reason: Schema.String }) {
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* A synchronous member of a Promise-faced extension was called before its
|
|
226
|
+
* runtime existed.
|
|
227
|
+
*
|
|
228
|
+
* `SuiExtension.fromService` builds its `ManagedRuntime` on first use, so until
|
|
229
|
+
* something has been awaited there is no service object and no synchronous
|
|
230
|
+
* member to read. Rather than hand back a Promise where the type says a value,
|
|
231
|
+
* the face throws this. Two cures, both in the extension's own hands:
|
|
232
|
+
* `await client.<name>.$ready()` once after registering, or register with
|
|
233
|
+
* `warm`, which builds the runtime inside `register` and makes every member
|
|
234
|
+
* real immediately.
|
|
235
|
+
*
|
|
236
|
+
* Outcome `not_applied`: nothing was sent.
|
|
237
|
+
*/
|
|
238
|
+
export class ExtensionNotReady extends Schema.TaggedError()("ExtensionNotReady", { extension: Schema.String, member: Schema.String }) {
|
|
239
|
+
}
|
|
240
|
+
/** The schema of the whole taxonomy, used for serialization. */
|
|
241
|
+
export const SuiErrorSchema = Schema.Union([
|
|
242
|
+
TransportError,
|
|
243
|
+
ObjectNotFound,
|
|
244
|
+
ObjectDeleted,
|
|
245
|
+
ObjectUnavailable,
|
|
246
|
+
TransactionNotFound,
|
|
247
|
+
NetworkMismatch,
|
|
248
|
+
DecodeError,
|
|
249
|
+
SimulationFailed,
|
|
250
|
+
ExecutionFailed,
|
|
251
|
+
SubmissionUnknown,
|
|
252
|
+
NotApplied,
|
|
253
|
+
SigningError,
|
|
254
|
+
BuildError,
|
|
255
|
+
PolicyDenied,
|
|
256
|
+
JournalError,
|
|
257
|
+
UnexpectedEffects,
|
|
258
|
+
GraphQLUnavailable,
|
|
259
|
+
ExtensionNotReady
|
|
260
|
+
]);
|
|
261
|
+
const OutcomeSchema = Schema.Literals(["applied", "not_applied", "unknown"]);
|
|
262
|
+
const isHasOutcome = Schema.is(Schema.Struct({ outcome: OutcomeSchema }));
|
|
263
|
+
const hasOutcome = (error) => isHasOutcome(error);
|
|
264
|
+
const isRetryable = (error) => error._tag === "TransportError" ? error.retryable : false;
|
|
265
|
+
/** Every tag the taxonomy owns, so a foreign tag can be told from one of ours. */
|
|
266
|
+
const TAXONOMY_TAGS = new Set([
|
|
267
|
+
"TransportError",
|
|
268
|
+
"ObjectNotFound",
|
|
269
|
+
"ObjectDeleted",
|
|
270
|
+
"ObjectUnavailable",
|
|
271
|
+
"TransactionNotFound",
|
|
272
|
+
"NetworkMismatch",
|
|
273
|
+
"DecodeError",
|
|
274
|
+
"SimulationFailed",
|
|
275
|
+
"ExecutionFailed",
|
|
276
|
+
"SubmissionUnknown",
|
|
277
|
+
"NotApplied",
|
|
278
|
+
"SigningError",
|
|
279
|
+
"BuildError",
|
|
280
|
+
"PolicyDenied",
|
|
281
|
+
"JournalError",
|
|
282
|
+
"UnexpectedEffects",
|
|
283
|
+
"GraphQLUnavailable",
|
|
284
|
+
"ExtensionNotReady"
|
|
285
|
+
]);
|
|
286
|
+
/**
|
|
287
|
+
* What a failure says about the transaction it came from.
|
|
288
|
+
*
|
|
289
|
+
* An error that declares its own `outcome` is honoured first, which is how an
|
|
290
|
+
* extension puts its failures on the same axis. Otherwise a tag the taxonomy
|
|
291
|
+
* owns gets the taxonomy's answer, and **anything else is `"unknown"`**: a tag
|
|
292
|
+
* this library has never heard of says nothing about whether a transaction
|
|
293
|
+
* applied, and answering `"not_applied"` for it would tell a retry idiom to
|
|
294
|
+
* send again on no evidence at all. `Script.exitCode` agrees by exiting 1 for
|
|
295
|
+
* an unclassified error rather than 3.
|
|
296
|
+
*/
|
|
297
|
+
const outcome = (error) => {
|
|
298
|
+
if (hasOutcome(error))
|
|
299
|
+
return error.outcome;
|
|
300
|
+
const tag = error._tag;
|
|
301
|
+
if (typeof tag !== "string" || !TAXONOMY_TAGS.has(tag))
|
|
302
|
+
return "unknown";
|
|
303
|
+
switch (tag) {
|
|
304
|
+
case "ExecutionFailed":
|
|
305
|
+
// An `UnexpectedEffects` is built from an `Executed`: the transaction
|
|
306
|
+
// applied and gas was charged, and only the receipt is missing.
|
|
307
|
+
case "UnexpectedEffects":
|
|
308
|
+
return "applied";
|
|
309
|
+
case "SubmissionUnknown":
|
|
310
|
+
return "unknown";
|
|
311
|
+
default:
|
|
312
|
+
return "not_applied";
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
const formatTarget = (reason) => {
|
|
316
|
+
if (reason.$kind !== "MoveAbort")
|
|
317
|
+
return "";
|
|
318
|
+
const location = reason.MoveAbort.location;
|
|
319
|
+
if (location === undefined)
|
|
320
|
+
return "";
|
|
321
|
+
const parts = [location.package, location.module, location.functionName].filter((part) => part !== undefined);
|
|
322
|
+
return parts.length === 0 ? "" : ` ${parts.join("::")}`;
|
|
323
|
+
};
|
|
324
|
+
const describeReason = (reason) => ExecutionReason.match(reason, {
|
|
325
|
+
MoveAbort: (value) => {
|
|
326
|
+
const clever = value.MoveAbort.cleverError?.constantName;
|
|
327
|
+
const suffix = clever === undefined ? "" : ` (${clever})`;
|
|
328
|
+
return `MoveAbort${formatTarget(value)} code ${value.MoveAbort.abortCode}${suffix}`;
|
|
329
|
+
},
|
|
330
|
+
SizeError: (value) => `SizeError ${value.SizeError.name} ${value.SizeError.size} of ${value.SizeError.maxSize}`,
|
|
331
|
+
CommandArgumentError: (value) => `CommandArgumentError ${value.CommandArgumentError.name} at argument ${value.CommandArgumentError.argument}`,
|
|
332
|
+
TypeArgumentError: (value) => `TypeArgumentError ${value.TypeArgumentError.name} at type argument ${value.TypeArgumentError.typeArgument}`,
|
|
333
|
+
PackageUpgradeError: (value) => `PackageUpgradeError ${value.PackageUpgradeError.name}`,
|
|
334
|
+
IndexError: (value) => `IndexError index ${value.IndexError.index ?? "?"}`,
|
|
335
|
+
CoinDenyListError: (value) => `CoinDenyListError ${value.CoinDenyListError.name} for ${value.CoinDenyListError.coinType}`,
|
|
336
|
+
CongestedObjects: (value) => `CongestedObjects ${value.CongestedObjects.objects.join(", ")}`,
|
|
337
|
+
ObjectIdError: (value) => `ObjectIdError ${value.ObjectIdError.name ?? ""} ${value.ObjectIdError.objectId}`.trim(),
|
|
338
|
+
Unknown: () => "Unknown"
|
|
339
|
+
});
|
|
340
|
+
/**
|
|
341
|
+
* The one line of a `cause` worth printing next to a tag: an `Error`'s message,
|
|
342
|
+
* a tagged error's own `describe` line, a string as itself. `undefined` when
|
|
343
|
+
* there is nothing readable, so `describe` prints nothing rather than
|
|
344
|
+
* `[object Object]`.
|
|
345
|
+
*/
|
|
346
|
+
const causeLine = (cause) => {
|
|
347
|
+
if (cause === undefined || cause === null)
|
|
348
|
+
return undefined;
|
|
349
|
+
if (typeof cause === "string")
|
|
350
|
+
return cause.length === 0 ? undefined : cause;
|
|
351
|
+
if (typeof cause !== "object")
|
|
352
|
+
return undefined;
|
|
353
|
+
const message = cause.message;
|
|
354
|
+
if (typeof message === "string" && message.length > 0)
|
|
355
|
+
return message;
|
|
356
|
+
const tag = cause._tag;
|
|
357
|
+
if (typeof tag === "string")
|
|
358
|
+
return tag;
|
|
359
|
+
if (cause instanceof Error && cause.name.length > 0)
|
|
360
|
+
return cause.name;
|
|
361
|
+
return undefined;
|
|
362
|
+
};
|
|
363
|
+
const describe = (error) => {
|
|
364
|
+
switch (error._tag) {
|
|
365
|
+
case "TransportError": {
|
|
366
|
+
const cause = causeLine(error.cause);
|
|
367
|
+
return `TransportError ${error.method}${error.status === undefined ? "" : ` ${error.status}`}${error.retryable ? " (retryable)" : ""}${cause === undefined ? "" : `: ${cause}`}`;
|
|
368
|
+
}
|
|
369
|
+
case "ObjectNotFound":
|
|
370
|
+
case "ObjectDeleted":
|
|
371
|
+
case "ObjectUnavailable":
|
|
372
|
+
return `${error._tag} ${error.objectId}`;
|
|
373
|
+
case "TransactionNotFound":
|
|
374
|
+
return `TransactionNotFound ${error.digest}`;
|
|
375
|
+
case "NetworkMismatch":
|
|
376
|
+
return `NetworkMismatch expected ${error.expected} but the node reported ${error.actual}`;
|
|
377
|
+
case "DecodeError":
|
|
378
|
+
return `DecodeError ${error.expectedType ?? ""} ${error.objectId ?? ""} ${error.issue}`
|
|
379
|
+
.replace(/\s+/g, " ")
|
|
380
|
+
.trim();
|
|
381
|
+
case "SimulationFailed":
|
|
382
|
+
return `SimulationFailed ${describeReason(error.reason)}`;
|
|
383
|
+
case "ExecutionFailed":
|
|
384
|
+
return `ExecutionFailed ${describeReason(error.reason)}${error.command === undefined ? "" : ` in command ${error.command}`}`;
|
|
385
|
+
case "SubmissionUnknown": {
|
|
386
|
+
const cause = causeLine(error.cause);
|
|
387
|
+
return `SubmissionUnknown ${error.digest}${cause === undefined ? "" : `: ${cause}`}`;
|
|
388
|
+
}
|
|
389
|
+
case "NotApplied":
|
|
390
|
+
return `NotApplied ${error.digest} (${error.evidence})`;
|
|
391
|
+
case "SigningError":
|
|
392
|
+
return "SigningError";
|
|
393
|
+
case "BuildError":
|
|
394
|
+
return `BuildError ${error.message}`;
|
|
395
|
+
case "PolicyDenied":
|
|
396
|
+
return `PolicyDenied ${error.rule}: ${error.message}`;
|
|
397
|
+
case "JournalError":
|
|
398
|
+
return "JournalError";
|
|
399
|
+
case "UnexpectedEffects":
|
|
400
|
+
return `UnexpectedEffects ${error.digest} expected ${error.expected} but found ${error.found.length}`;
|
|
401
|
+
case "GraphQLUnavailable":
|
|
402
|
+
return `GraphQLUnavailable ${error.method}: ${error.reason}`;
|
|
403
|
+
case "ExtensionNotReady":
|
|
404
|
+
return `ExtensionNotReady ${error.extension}.${error.member} was called before the runtime existed: await client.${error.extension}.$ready() first, or register with warm`;
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
const encode = Schema.encodeUnknownResult(SuiErrorSchema);
|
|
408
|
+
/**
|
|
409
|
+
* One error encoded through **its own** schema.
|
|
410
|
+
*
|
|
411
|
+
* Every `Schema.TaggedError` class is itself a schema, and an instance's
|
|
412
|
+
* `constructor` is that class, so an error the closed taxonomy has never heard
|
|
413
|
+
* of — an extension's `EscrowSettlementUnknown { escrowId, outcome }` — still
|
|
414
|
+
* serializes with its fields instead of collapsing to a tag and a sentence.
|
|
415
|
+
* `undefined` when the value is not a schema-backed error, or when its own
|
|
416
|
+
* schema refuses it. Never fails.
|
|
417
|
+
*/
|
|
418
|
+
const encodeThroughOwnSchema = (error) => {
|
|
419
|
+
const schema = error?.constructor;
|
|
420
|
+
if (!Schema.isSchema(schema))
|
|
421
|
+
return undefined;
|
|
422
|
+
const encoded = Schema.encodeUnknownResult(schema)(error);
|
|
423
|
+
if (!Result.isSuccess(encoded))
|
|
424
|
+
return undefined;
|
|
425
|
+
const value = encoded.success;
|
|
426
|
+
return typeof value === "object" && value !== null
|
|
427
|
+
? value
|
|
428
|
+
: undefined;
|
|
429
|
+
};
|
|
430
|
+
/**
|
|
431
|
+
* The JSON an operator or a log line gets for a failure.
|
|
432
|
+
*
|
|
433
|
+
* A tag in the taxonomy encodes through {@link SuiErrorSchema}. **Anything
|
|
434
|
+
* else that is a `Schema.TaggedError` encodes through its own schema**, which
|
|
435
|
+
* is how an extension's errors serialize with their fields — including the
|
|
436
|
+
* `outcome` a wrapper script reads — rather than arriving as a bare
|
|
437
|
+
* `{ _tag, message }`. Only a value that is neither falls back to that.
|
|
438
|
+
*
|
|
439
|
+
* Never fails.
|
|
440
|
+
*/
|
|
441
|
+
const toJson = (error) => {
|
|
442
|
+
const encoded = encode(error);
|
|
443
|
+
if (Result.isSuccess(encoded))
|
|
444
|
+
return encoded.success;
|
|
445
|
+
const own = encodeThroughOwnSchema(error);
|
|
446
|
+
if (own !== undefined)
|
|
447
|
+
return own;
|
|
448
|
+
const message = TAXONOMY_TAGS.has(error._tag)
|
|
449
|
+
? describe(error)
|
|
450
|
+
: causeLine(error) ?? error._tag;
|
|
451
|
+
return { _tag: error._tag, message };
|
|
452
|
+
};
|
|
453
|
+
/**
|
|
454
|
+
* The four helpers every repo hand-rolls: is this worth retrying, did the
|
|
455
|
+
* transaction land, what does an operator need to read, and what goes in a log.
|
|
456
|
+
*/
|
|
457
|
+
export const SuiError = {
|
|
458
|
+
isRetryable,
|
|
459
|
+
outcome,
|
|
460
|
+
describe,
|
|
461
|
+
toJson
|
|
462
|
+
};
|
|
463
|
+
/** The digest of the transaction a failure refers to, when it has one. */
|
|
464
|
+
export const digestOf = (error) => {
|
|
465
|
+
switch (error._tag) {
|
|
466
|
+
case "TransactionNotFound":
|
|
467
|
+
case "ExecutionFailed":
|
|
468
|
+
case "SubmissionUnknown":
|
|
469
|
+
case "NotApplied":
|
|
470
|
+
case "UnexpectedEffects":
|
|
471
|
+
return error.digest;
|
|
472
|
+
default:
|
|
473
|
+
return undefined;
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/domain/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EACL,MAAM,EACN,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,EAClB,OAAO,EACR,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAEzE;;;;;;;;GAQG;AACH,MAAM,OAAO,cAAe,SAAQ,MAAM,CAAC,WAAW,EAAkB,CAAC,gBAAgB,EAAE;IACzF,MAAM,EAAE,MAA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