@seljs/runtime 1.3.0-beta.28 → 1.3.0-beta.32

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.
@@ -2,32 +2,108 @@ require("../_virtual/_rolldown/runtime.cjs");
2
2
  let _seljs_common = require("@seljs/common");
3
3
  //#region src/errors/errors.ts
4
4
  /**
5
- * Thrown when contract validation or execution fails.
6
- * Includes optional contract name and method name for context.
7
- * When the failure is a contract revert, the decoded revert reason and raw
8
- * revert data are exposed on `revertReason` / `revertData`, and `decodedError`
9
- * carries any matched custom-error name + args from the contract's ABI.
5
+ * Thrown when a contract-layer call fails after execution reached the
6
+ * chain (unknown method, ABI decode mismatch, etc.). Reverts are reported
7
+ * as {@link SELContractRevertError}, a subclass; batch-level Multicall3
8
+ * failures as {@link SELMulticallBatchError}.
10
9
  */
11
- var SELContractError = class extends _seljs_common.SELError {
10
+ var SELContractError = class extends _seljs_common.SELRuntimeError {
12
11
  contractName;
13
12
  methodName;
14
- revertReason;
15
- revertData;
16
- decodedError;
17
13
  constructor(message, options) {
18
14
  super(message, { cause: options?.cause });
19
15
  this.contractName = options?.contractName;
20
16
  this.methodName = options?.methodName;
17
+ }
18
+ };
19
+ /**
20
+ * Thrown when a contract call reverted. Carries the decoded revert
21
+ * reason, raw revert data, and — when the selector matched a custom
22
+ * error in the contract's ABI — the decoded custom-error name and args.
23
+ */
24
+ var SELContractRevertError = class extends SELContractError {
25
+ revertReason;
26
+ revertData;
27
+ decodedError;
28
+ constructor(message, options) {
29
+ super(message, {
30
+ cause: options?.cause,
31
+ contractName: options?.contractName,
32
+ methodName: options?.methodName
33
+ });
21
34
  this.revertReason = options?.revertReason;
22
35
  this.revertData = options?.revertData;
23
36
  this.decodedError = options?.decodedError;
24
37
  }
25
38
  };
26
39
  /**
27
- * Thrown when a circular dependency is detected in the call dependency graph.
28
- * Indicates that call A depends on call B which depends on call A (directly or transitively).
40
+ * Thrown when a Multicall3 batch fails at the batch level — the aggregate
41
+ * call itself reverted, or individual calls could not be encoded/decoded.
42
+ * Individual sub-call reverts surface as {@link SELContractRevertError},
43
+ * not as this class.
44
+ */
45
+ var SELMulticallBatchError = class extends SELContractError {
46
+ failedCallIndex;
47
+ constructor(message, options) {
48
+ super(message, {
49
+ cause: options?.cause,
50
+ contractName: options?.contractName,
51
+ methodName: options?.methodName
52
+ });
53
+ this.failedCallIndex = options?.failedCallIndex;
54
+ }
55
+ };
56
+ /**
57
+ * Base for failures from the JSON-RPC transport or node — the call never
58
+ * reached the contract. Transport errors (HTTP, WebSocket, timeout) use
59
+ * {@link SELProviderTransportError}; node-reported JSON-RPC errors use
60
+ * {@link SELProviderRpcError}. Catch the base to retry safely against an
61
+ * alternate RPC.
62
+ */
63
+ var SELProviderError = class extends _seljs_common.SELRuntimeError {};
64
+ /**
65
+ * Thrown when the transport layer (HTTP, WebSocket) or a timeout
66
+ * prevented the request from reaching the node.
67
+ */
68
+ var SELProviderTransportError = class extends SELProviderError {
69
+ httpStatus;
70
+ url;
71
+ body;
72
+ constructor(message, options) {
73
+ super(message, { cause: options?.cause });
74
+ this.httpStatus = options?.httpStatus;
75
+ this.url = options?.url;
76
+ this.body = options?.body;
77
+ }
78
+ };
79
+ /**
80
+ * Thrown when the node returned a JSON-RPC error response (rate limit,
81
+ * invalid params, unsupported method, user rejection, etc.).
29
82
  */
30
- var CircularDependencyError = class extends _seljs_common.SELError {
83
+ var SELProviderRpcError = class extends SELProviderError {
84
+ rpcCode;
85
+ rpcData;
86
+ method;
87
+ constructor(message, options) {
88
+ super(message, { cause: options?.cause });
89
+ this.rpcCode = options?.rpcCode;
90
+ this.rpcData = options?.rpcData;
91
+ this.method = options?.method;
92
+ }
93
+ };
94
+ /**
95
+ * Base for failures from the execution-framework layer that sits between
96
+ * parsed expressions and contract calls (dependency analysis, round
97
+ * planning). Concrete subclasses: {@link SELExecutionLimitError},
98
+ * {@link SELCircularDependencyError}.
99
+ */
100
+ var SELExecutionError = class extends _seljs_common.SELRuntimeError {};
101
+ /**
102
+ * Thrown when a circular dependency is detected in the call dependency
103
+ * graph. Indicates that call A depends on call B which depends on call A
104
+ * (directly or transitively).
105
+ */
106
+ var SELCircularDependencyError = class extends SELExecutionError {
31
107
  callIds;
32
108
  constructor(message, options) {
33
109
  super(message, { cause: options?.cause });
@@ -38,7 +114,7 @@ var CircularDependencyError = class extends _seljs_common.SELError {
38
114
  * Thrown when execution limits are exceeded (maxRounds or maxCalls).
39
115
  * Prevents infinite loops and runaway execution.
40
116
  */
41
- var ExecutionLimitError = class extends _seljs_common.SELError {
117
+ var SELExecutionLimitError = class extends SELExecutionError {
42
118
  limitType;
43
119
  limit;
44
120
  actual;
@@ -50,40 +126,16 @@ var ExecutionLimitError = class extends _seljs_common.SELError {
50
126
  }
51
127
  };
52
128
  /**
53
- * Thrown when a Multicall3 batch execution fails.
54
- * Includes the failed call index and optional contract name/method name for context.
55
- * When an individual sub-call reverts, `revertReason` / `revertData` carry the
56
- * decoded reason text and raw return data, and `decodedError` carries any
57
- * matched custom-error name + args from the contract's ABI.
58
- */
59
- var MulticallBatchError = class extends _seljs_common.SELError {
60
- failedCallIndex;
61
- contractName;
62
- methodName;
63
- revertReason;
64
- revertData;
65
- decodedError;
66
- constructor(message, options) {
67
- super(message, { cause: options?.cause });
68
- this.failedCallIndex = options?.failedCallIndex;
69
- this.contractName = options?.contractName;
70
- this.methodName = options?.methodName;
71
- this.revertReason = options?.revertReason;
72
- this.revertData = options?.revertData;
73
- this.decodedError = options?.decodedError;
74
- }
75
- };
76
- /**
77
129
  * Thrown when the provided client fails validation or is misconfigured.
78
130
  */
79
- var SELClientError = class extends _seljs_common.SELError {
131
+ var SELClientError = class extends _seljs_common.SELStaticError {
80
132
  name = "SELClientError";
81
133
  };
82
134
  /**
83
135
  * Thrown when lint rules with error severity detect violations.
84
136
  * Contains the diagnostics that caused the failure.
85
137
  */
86
- var SELLintError = class extends _seljs_common.SELError {
138
+ var SELLintError = class extends _seljs_common.SELStaticError {
87
139
  diagnostics;
88
140
  constructor(diagnostics, options) {
89
141
  const messages = diagnostics.map((d) => d.message).join("; ");
@@ -92,9 +144,14 @@ var SELLintError = class extends _seljs_common.SELError {
92
144
  }
93
145
  };
94
146
  //#endregion
95
- exports.CircularDependencyError = CircularDependencyError;
96
- exports.ExecutionLimitError = ExecutionLimitError;
97
- exports.MulticallBatchError = MulticallBatchError;
147
+ exports.SELCircularDependencyError = SELCircularDependencyError;
98
148
  exports.SELClientError = SELClientError;
99
149
  exports.SELContractError = SELContractError;
150
+ exports.SELContractRevertError = SELContractRevertError;
151
+ exports.SELExecutionError = SELExecutionError;
152
+ exports.SELExecutionLimitError = SELExecutionLimitError;
100
153
  exports.SELLintError = SELLintError;
154
+ exports.SELMulticallBatchError = SELMulticallBatchError;
155
+ exports.SELProviderError = SELProviderError;
156
+ exports.SELProviderRpcError = SELProviderRpcError;
157
+ exports.SELProviderTransportError = SELProviderTransportError;
@@ -1,17 +1,28 @@
1
1
  import { SELDiagnostic } from "@seljs/checker";
2
- import { SELError, SELEvaluationError } from "@seljs/common";
2
+ import { SELError, SELEvaluationError, SELRuntimeError, SELStaticError } from "@seljs/common";
3
3
 
4
4
  //#region src/errors/errors.d.ts
5
5
  /**
6
- * Thrown when contract validation or execution fails.
7
- * Includes optional contract name and method name for context.
8
- * When the failure is a contract revert, the decoded revert reason and raw
9
- * revert data are exposed on `revertReason` / `revertData`, and `decodedError`
10
- * carries any matched custom-error name + args from the contract's ABI.
6
+ * Thrown when a contract-layer call fails after execution reached the
7
+ * chain (unknown method, ABI decode mismatch, etc.). Reverts are reported
8
+ * as {@link SELContractRevertError}, a subclass; batch-level Multicall3
9
+ * failures as {@link SELMulticallBatchError}.
11
10
  */
12
- declare class SELContractError extends SELError {
11
+ declare class SELContractError extends SELRuntimeError {
13
12
  readonly contractName?: string;
14
13
  readonly methodName?: string;
14
+ constructor(message: string, options?: {
15
+ cause?: unknown;
16
+ contractName?: string;
17
+ methodName?: string;
18
+ });
19
+ }
20
+ /**
21
+ * Thrown when a contract call reverted. Carries the decoded revert
22
+ * reason, raw revert data, and — when the selector matched a custom
23
+ * error in the contract's ABI — the decoded custom-error name and args.
24
+ */
25
+ declare class SELContractRevertError extends SELContractError {
15
26
  readonly revertReason?: string;
16
27
  readonly revertData?: `0x${string}`;
17
28
  readonly decodedError?: {
@@ -31,10 +42,71 @@ declare class SELContractError extends SELError {
31
42
  });
32
43
  }
33
44
  /**
34
- * Thrown when a circular dependency is detected in the call dependency graph.
35
- * Indicates that call A depends on call B which depends on call A (directly or transitively).
45
+ * Thrown when a Multicall3 batch fails at the batch level — the aggregate
46
+ * call itself reverted, or individual calls could not be encoded/decoded.
47
+ * Individual sub-call reverts surface as {@link SELContractRevertError},
48
+ * not as this class.
49
+ */
50
+ declare class SELMulticallBatchError extends SELContractError {
51
+ readonly failedCallIndex?: number;
52
+ constructor(message: string, options?: {
53
+ cause?: unknown;
54
+ failedCallIndex?: number;
55
+ contractName?: string;
56
+ methodName?: string;
57
+ });
58
+ }
59
+ /**
60
+ * Base for failures from the JSON-RPC transport or node — the call never
61
+ * reached the contract. Transport errors (HTTP, WebSocket, timeout) use
62
+ * {@link SELProviderTransportError}; node-reported JSON-RPC errors use
63
+ * {@link SELProviderRpcError}. Catch the base to retry safely against an
64
+ * alternate RPC.
65
+ */
66
+ declare class SELProviderError extends SELRuntimeError {}
67
+ /**
68
+ * Thrown when the transport layer (HTTP, WebSocket) or a timeout
69
+ * prevented the request from reaching the node.
70
+ */
71
+ declare class SELProviderTransportError extends SELProviderError {
72
+ readonly httpStatus?: number;
73
+ readonly url?: string;
74
+ readonly body?: string;
75
+ constructor(message: string, options?: {
76
+ cause?: unknown;
77
+ httpStatus?: number;
78
+ url?: string;
79
+ body?: string;
80
+ });
81
+ }
82
+ /**
83
+ * Thrown when the node returned a JSON-RPC error response (rate limit,
84
+ * invalid params, unsupported method, user rejection, etc.).
85
+ */
86
+ declare class SELProviderRpcError extends SELProviderError {
87
+ readonly rpcCode?: number;
88
+ readonly rpcData?: unknown;
89
+ readonly method?: string;
90
+ constructor(message: string, options?: {
91
+ cause?: unknown;
92
+ rpcCode?: number;
93
+ rpcData?: unknown;
94
+ method?: string;
95
+ });
96
+ }
97
+ /**
98
+ * Base for failures from the execution-framework layer that sits between
99
+ * parsed expressions and contract calls (dependency analysis, round
100
+ * planning). Concrete subclasses: {@link SELExecutionLimitError},
101
+ * {@link SELCircularDependencyError}.
102
+ */
103
+ declare class SELExecutionError extends SELRuntimeError {}
104
+ /**
105
+ * Thrown when a circular dependency is detected in the call dependency
106
+ * graph. Indicates that call A depends on call B which depends on call A
107
+ * (directly or transitively).
36
108
  */
37
- declare class CircularDependencyError extends SELError {
109
+ declare class SELCircularDependencyError extends SELExecutionError {
38
110
  readonly callIds: string[];
39
111
  constructor(message: string, options?: {
40
112
  cause?: unknown;
@@ -45,7 +117,7 @@ declare class CircularDependencyError extends SELError {
45
117
  * Thrown when execution limits are exceeded (maxRounds or maxCalls).
46
118
  * Prevents infinite loops and runaway execution.
47
119
  */
48
- declare class ExecutionLimitError extends SELError {
120
+ declare class SELExecutionLimitError extends SELExecutionError {
49
121
  readonly limitType: "maxRounds" | "maxCalls";
50
122
  readonly limit: number;
51
123
  readonly actual: number;
@@ -56,51 +128,21 @@ declare class ExecutionLimitError extends SELError {
56
128
  actual?: number;
57
129
  });
58
130
  }
59
- /**
60
- * Thrown when a Multicall3 batch execution fails.
61
- * Includes the failed call index and optional contract name/method name for context.
62
- * When an individual sub-call reverts, `revertReason` / `revertData` carry the
63
- * decoded reason text and raw return data, and `decodedError` carries any
64
- * matched custom-error name + args from the contract's ABI.
65
- */
66
- declare class MulticallBatchError extends SELError {
67
- readonly failedCallIndex?: number;
68
- readonly contractName?: string;
69
- readonly methodName?: string;
70
- readonly revertReason?: string;
71
- readonly revertData?: `0x${string}`;
72
- readonly decodedError?: {
73
- name: string;
74
- args: readonly unknown[];
75
- };
76
- constructor(message: string, options?: {
77
- cause?: unknown;
78
- failedCallIndex?: number;
79
- contractName?: string;
80
- methodName?: string;
81
- revertReason?: string;
82
- revertData?: `0x${string}`;
83
- decodedError?: {
84
- name: string;
85
- args: readonly unknown[];
86
- };
87
- });
88
- }
89
131
  /**
90
132
  * Thrown when the provided client fails validation or is misconfigured.
91
133
  */
92
- declare class SELClientError extends SELError {
134
+ declare class SELClientError extends SELStaticError {
93
135
  readonly name = "SELClientError";
94
136
  }
95
137
  /**
96
138
  * Thrown when lint rules with error severity detect violations.
97
139
  * Contains the diagnostics that caused the failure.
98
140
  */
99
- declare class SELLintError extends SELError {
141
+ declare class SELLintError extends SELStaticError {
100
142
  readonly diagnostics: SELDiagnostic[];
101
143
  constructor(diagnostics: SELDiagnostic[], options?: {
102
144
  cause?: unknown;
103
145
  });
104
146
  }
105
147
  //#endregion
106
- export { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELClientError, SELContractError, SELError, SELEvaluationError, SELLintError };
148
+ export { SELCircularDependencyError, SELClientError, SELContractError, SELContractRevertError, SELError, SELEvaluationError, SELExecutionError, SELExecutionLimitError, SELLintError, SELMulticallBatchError, SELProviderError, SELProviderRpcError, SELProviderTransportError, SELRuntimeError, SELStaticError };
@@ -1,17 +1,28 @@
1
1
  import { SELDiagnostic } from "@seljs/checker";
2
- import { SELError as SELError$1, SELEvaluationError } from "@seljs/common";
2
+ import { SELError as SELError$1, SELEvaluationError as SELEvaluationError$1, SELRuntimeError, SELStaticError } from "@seljs/common";
3
3
 
4
4
  //#region src/errors/errors.d.ts
5
5
  /**
6
- * Thrown when contract validation or execution fails.
7
- * Includes optional contract name and method name for context.
8
- * When the failure is a contract revert, the decoded revert reason and raw
9
- * revert data are exposed on `revertReason` / `revertData`, and `decodedError`
10
- * carries any matched custom-error name + args from the contract's ABI.
6
+ * Thrown when a contract-layer call fails after execution reached the
7
+ * chain (unknown method, ABI decode mismatch, etc.). Reverts are reported
8
+ * as {@link SELContractRevertError}, a subclass; batch-level Multicall3
9
+ * failures as {@link SELMulticallBatchError}.
11
10
  */
12
- declare class SELContractError extends SELError$1 {
11
+ declare class SELContractError extends SELRuntimeError {
13
12
  readonly contractName?: string;
14
13
  readonly methodName?: string;
14
+ constructor(message: string, options?: {
15
+ cause?: unknown;
16
+ contractName?: string;
17
+ methodName?: string;
18
+ });
19
+ }
20
+ /**
21
+ * Thrown when a contract call reverted. Carries the decoded revert
22
+ * reason, raw revert data, and — when the selector matched a custom
23
+ * error in the contract's ABI — the decoded custom-error name and args.
24
+ */
25
+ declare class SELContractRevertError extends SELContractError {
15
26
  readonly revertReason?: string;
16
27
  readonly revertData?: `0x${string}`;
17
28
  readonly decodedError?: {
@@ -31,10 +42,71 @@ declare class SELContractError extends SELError$1 {
31
42
  });
32
43
  }
33
44
  /**
34
- * Thrown when a circular dependency is detected in the call dependency graph.
35
- * Indicates that call A depends on call B which depends on call A (directly or transitively).
45
+ * Thrown when a Multicall3 batch fails at the batch level — the aggregate
46
+ * call itself reverted, or individual calls could not be encoded/decoded.
47
+ * Individual sub-call reverts surface as {@link SELContractRevertError},
48
+ * not as this class.
49
+ */
50
+ declare class SELMulticallBatchError extends SELContractError {
51
+ readonly failedCallIndex?: number;
52
+ constructor(message: string, options?: {
53
+ cause?: unknown;
54
+ failedCallIndex?: number;
55
+ contractName?: string;
56
+ methodName?: string;
57
+ });
58
+ }
59
+ /**
60
+ * Base for failures from the JSON-RPC transport or node — the call never
61
+ * reached the contract. Transport errors (HTTP, WebSocket, timeout) use
62
+ * {@link SELProviderTransportError}; node-reported JSON-RPC errors use
63
+ * {@link SELProviderRpcError}. Catch the base to retry safely against an
64
+ * alternate RPC.
65
+ */
66
+ declare class SELProviderError extends SELRuntimeError {}
67
+ /**
68
+ * Thrown when the transport layer (HTTP, WebSocket) or a timeout
69
+ * prevented the request from reaching the node.
70
+ */
71
+ declare class SELProviderTransportError extends SELProviderError {
72
+ readonly httpStatus?: number;
73
+ readonly url?: string;
74
+ readonly body?: string;
75
+ constructor(message: string, options?: {
76
+ cause?: unknown;
77
+ httpStatus?: number;
78
+ url?: string;
79
+ body?: string;
80
+ });
81
+ }
82
+ /**
83
+ * Thrown when the node returned a JSON-RPC error response (rate limit,
84
+ * invalid params, unsupported method, user rejection, etc.).
85
+ */
86
+ declare class SELProviderRpcError extends SELProviderError {
87
+ readonly rpcCode?: number;
88
+ readonly rpcData?: unknown;
89
+ readonly method?: string;
90
+ constructor(message: string, options?: {
91
+ cause?: unknown;
92
+ rpcCode?: number;
93
+ rpcData?: unknown;
94
+ method?: string;
95
+ });
96
+ }
97
+ /**
98
+ * Base for failures from the execution-framework layer that sits between
99
+ * parsed expressions and contract calls (dependency analysis, round
100
+ * planning). Concrete subclasses: {@link SELExecutionLimitError},
101
+ * {@link SELCircularDependencyError}.
102
+ */
103
+ declare class SELExecutionError extends SELRuntimeError {}
104
+ /**
105
+ * Thrown when a circular dependency is detected in the call dependency
106
+ * graph. Indicates that call A depends on call B which depends on call A
107
+ * (directly or transitively).
36
108
  */
37
- declare class CircularDependencyError extends SELError$1 {
109
+ declare class SELCircularDependencyError extends SELExecutionError {
38
110
  readonly callIds: string[];
39
111
  constructor(message: string, options?: {
40
112
  cause?: unknown;
@@ -45,7 +117,7 @@ declare class CircularDependencyError extends SELError$1 {
45
117
  * Thrown when execution limits are exceeded (maxRounds or maxCalls).
46
118
  * Prevents infinite loops and runaway execution.
47
119
  */
48
- declare class ExecutionLimitError extends SELError$1 {
120
+ declare class SELExecutionLimitError extends SELExecutionError {
49
121
  readonly limitType: "maxRounds" | "maxCalls";
50
122
  readonly limit: number;
51
123
  readonly actual: number;
@@ -56,51 +128,21 @@ declare class ExecutionLimitError extends SELError$1 {
56
128
  actual?: number;
57
129
  });
58
130
  }
59
- /**
60
- * Thrown when a Multicall3 batch execution fails.
61
- * Includes the failed call index and optional contract name/method name for context.
62
- * When an individual sub-call reverts, `revertReason` / `revertData` carry the
63
- * decoded reason text and raw return data, and `decodedError` carries any
64
- * matched custom-error name + args from the contract's ABI.
65
- */
66
- declare class MulticallBatchError extends SELError$1 {
67
- readonly failedCallIndex?: number;
68
- readonly contractName?: string;
69
- readonly methodName?: string;
70
- readonly revertReason?: string;
71
- readonly revertData?: `0x${string}`;
72
- readonly decodedError?: {
73
- name: string;
74
- args: readonly unknown[];
75
- };
76
- constructor(message: string, options?: {
77
- cause?: unknown;
78
- failedCallIndex?: number;
79
- contractName?: string;
80
- methodName?: string;
81
- revertReason?: string;
82
- revertData?: `0x${string}`;
83
- decodedError?: {
84
- name: string;
85
- args: readonly unknown[];
86
- };
87
- });
88
- }
89
131
  /**
90
132
  * Thrown when the provided client fails validation or is misconfigured.
91
133
  */
92
- declare class SELClientError extends SELError$1 {
134
+ declare class SELClientError extends SELStaticError {
93
135
  readonly name = "SELClientError";
94
136
  }
95
137
  /**
96
138
  * Thrown when lint rules with error severity detect violations.
97
139
  * Contains the diagnostics that caused the failure.
98
140
  */
99
- declare class SELLintError extends SELError$1 {
141
+ declare class SELLintError extends SELStaticError {
100
142
  readonly diagnostics: SELDiagnostic[];
101
143
  constructor(diagnostics: SELDiagnostic[], options?: {
102
144
  cause?: unknown;
103
145
  });
104
146
  }
105
147
  //#endregion
106
- export { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELClientError, SELContractError, SELError$1 as SELError, SELEvaluationError, SELLintError };
148
+ export { SELCircularDependencyError, SELClientError, SELContractError, SELContractRevertError, SELError$1 as SELError, SELEvaluationError$1 as SELEvaluationError, SELExecutionError, SELExecutionLimitError, SELLintError, SELMulticallBatchError, SELProviderError, SELProviderRpcError, SELProviderTransportError, SELRuntimeError, SELStaticError };