@seljs/runtime 1.3.0-beta.33 → 1.4.0-beta.24
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/CHANGELOG.md +20 -0
- package/dist/environment/contract-caller.cjs +25 -1
- package/dist/environment/contract-caller.mjs +26 -2
- package/dist/environment/environment.cjs +2 -1
- package/dist/environment/environment.mjs +2 -1
- package/dist/environment/error-wrapper.cjs +1 -1
- package/dist/environment/error-wrapper.mjs +1 -1
- package/dist/execution/decode-revert.cjs +4 -1
- package/dist/execution/decode-revert.mjs +4 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.3.0](https://github.com/abinnovision/seljs/compare/runtime-v1.2.0...runtime-v1.3.0) (2026-04-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add balance() address accessor and integrate with Multicall3 ([#45](https://github.com/abinnovision/seljs/issues/45)) ([1c64d7c](https://github.com/abinnovision/seljs/commit/1c64d7ca1fdf32f9b9a909710b8131e46b3ee884))
|
|
9
|
+
* add type information to evaluation results ([#53](https://github.com/abinnovision/seljs/issues/53)) ([b1cd09f](https://github.com/abinnovision/seljs/commit/b1cd09f94b23c2841332b9ccc6c931ea6f88db32))
|
|
10
|
+
* decode multicall revert reasons onto SELContractError ([#85](https://github.com/abinnovision/seljs/issues/85)) ([2cc6745](https://github.com/abinnovision/seljs/commit/2cc6745634660de812092fcf63c6a8e383edf40b))
|
|
11
|
+
* implement SELClient interface and validation logic ([#44](https://github.com/abinnovision/seljs/issues/44)) ([2a57c1d](https://github.com/abinnovision/seljs/commit/2a57c1df8f0b5285e165a8cd56fc7a2fdca1c0b2))
|
|
12
|
+
* list<sol_int>.sum() / min() / max() receiver builtins ([#84](https://github.com/abinnovision/seljs/issues/84)) ([f76fe6a](https://github.com/abinnovision/seljs/commit/f76fe6a1f9883dc0010756890dca461e3f2ed463))
|
|
13
|
+
* make SELChecker the single validation gate in evaluate ([#69](https://github.com/abinnovision/seljs/issues/69)) ([b279a19](https://github.com/abinnovision/seljs/commit/b279a1971ff8dc64799c231aa41392619dbadacb))
|
|
14
|
+
* structured SEL error hierarchy with static/runtime split ([#86](https://github.com/abinnovision/seljs/issues/86)) ([ab88b2c](https://github.com/abinnovision/seljs/commit/ab88b2cbf52fe5d236fd2ae099030d8558783eec))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* adjust type definition for promise return value ([#54](https://github.com/abinnovision/seljs/issues/54)) ([009d456](https://github.com/abinnovision/seljs/commit/009d4560d3d1eae62851c7ab287166ec048d23c8))
|
|
20
|
+
* decode revert reasons on direct-call path and surface cause ([#88](https://github.com/abinnovision/seljs/issues/88)) ([fc356b6](https://github.com/abinnovision/seljs/commit/fc356b66c861817cc481d45ac34e50b83e3d0d1c))
|
|
21
|
+
* throw SELEvaluationError from CEL builtins instead of plain Error ([#83](https://github.com/abinnovision/seljs/issues/83)) ([0a981af](https://github.com/abinnovision/seljs/commit/0a981af4479a1007fa34cd42f87a742f6646df6e))
|
|
22
|
+
|
|
3
23
|
## [1.2.0](https://github.com/abinnovision/seljs/compare/runtime-v1.1.0...runtime-v1.2.0) (2026-03-21)
|
|
4
24
|
|
|
5
25
|
|
|
@@ -3,8 +3,18 @@ const require_errors = require("../errors/errors.cjs");
|
|
|
3
3
|
require("../errors/index.cjs");
|
|
4
4
|
const require_replay_cache = require("./replay-cache.cjs");
|
|
5
5
|
const require_debug = require("../debug.cjs");
|
|
6
|
+
const require_decode_revert = require("../execution/decode-revert.cjs");
|
|
6
7
|
let ox = require("ox");
|
|
8
|
+
let viem = require("viem");
|
|
7
9
|
//#region src/environment/contract-caller.ts
|
|
10
|
+
const extractRevertData = (error) => {
|
|
11
|
+
if (!(error instanceof viem.BaseError)) return;
|
|
12
|
+
return error.walk((e) => {
|
|
13
|
+
if (typeof e !== "object" || e === null) return false;
|
|
14
|
+
const data = e.data;
|
|
15
|
+
return typeof data === "string" && data.startsWith("0x");
|
|
16
|
+
})?.data;
|
|
17
|
+
};
|
|
8
18
|
const debug = require_debug.createLogger("contract-caller");
|
|
9
19
|
/**
|
|
10
20
|
* Tracks total RPC calls (pre-executed + live) across a single evaluation.
|
|
@@ -54,7 +64,21 @@ const executeContractCall = async (contract, method, args, options) => {
|
|
|
54
64
|
return ox.AbiFunction.decodeResult([method.abi], method.name, result.data);
|
|
55
65
|
} catch (error) {
|
|
56
66
|
if (error instanceof require_errors.SELContractError) throw error;
|
|
57
|
-
|
|
67
|
+
const revertData = extractRevertData(error);
|
|
68
|
+
if (revertData !== void 0) {
|
|
69
|
+
const decoded = require_decode_revert.decodeRevertData(revertData, [method.abi]);
|
|
70
|
+
const suffix = decoded.reason ? ` — ${decoded.reason}` : "";
|
|
71
|
+
throw new require_errors.SELContractRevertError(`Call reverted: ${contract.name}.${method.name}${suffix}`, {
|
|
72
|
+
cause: error,
|
|
73
|
+
contractName: contract.name,
|
|
74
|
+
methodName: method.name,
|
|
75
|
+
revertReason: decoded.reason,
|
|
76
|
+
revertData: decoded.data,
|
|
77
|
+
decodedError: decoded.decodedError
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
81
|
+
throw new require_errors.SELContractError(`Contract call failed: ${contract.name}.${method.name}: ${detail}`, {
|
|
58
82
|
cause: error,
|
|
59
83
|
contractName: contract.name,
|
|
60
84
|
methodName: method.name
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import { SELContractError, SELExecutionLimitError } from "../errors/errors.mjs";
|
|
1
|
+
import { SELContractError, SELContractRevertError, SELExecutionLimitError } from "../errors/errors.mjs";
|
|
2
2
|
import "../errors/index.mjs";
|
|
3
3
|
import { createReplayCallId } from "./replay-cache.mjs";
|
|
4
4
|
import { createLogger } from "../debug.mjs";
|
|
5
|
+
import { decodeRevertData } from "../execution/decode-revert.mjs";
|
|
5
6
|
import { AbiFunction } from "ox";
|
|
7
|
+
import { BaseError } from "viem";
|
|
6
8
|
//#region src/environment/contract-caller.ts
|
|
9
|
+
const extractRevertData = (error) => {
|
|
10
|
+
if (!(error instanceof BaseError)) return;
|
|
11
|
+
return error.walk((e) => {
|
|
12
|
+
if (typeof e !== "object" || e === null) return false;
|
|
13
|
+
const data = e.data;
|
|
14
|
+
return typeof data === "string" && data.startsWith("0x");
|
|
15
|
+
})?.data;
|
|
16
|
+
};
|
|
7
17
|
const debug = createLogger("contract-caller");
|
|
8
18
|
/**
|
|
9
19
|
* Tracks total RPC calls (pre-executed + live) across a single evaluation.
|
|
@@ -53,7 +63,21 @@ const executeContractCall = async (contract, method, args, options) => {
|
|
|
53
63
|
return AbiFunction.decodeResult([method.abi], method.name, result.data);
|
|
54
64
|
} catch (error) {
|
|
55
65
|
if (error instanceof SELContractError) throw error;
|
|
56
|
-
|
|
66
|
+
const revertData = extractRevertData(error);
|
|
67
|
+
if (revertData !== void 0) {
|
|
68
|
+
const decoded = decodeRevertData(revertData, [method.abi]);
|
|
69
|
+
const suffix = decoded.reason ? ` — ${decoded.reason}` : "";
|
|
70
|
+
throw new SELContractRevertError(`Call reverted: ${contract.name}.${method.name}${suffix}`, {
|
|
71
|
+
cause: error,
|
|
72
|
+
contractName: contract.name,
|
|
73
|
+
methodName: method.name,
|
|
74
|
+
revertReason: decoded.reason,
|
|
75
|
+
revertData: decoded.data,
|
|
76
|
+
decodedError: decoded.decodedError
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
80
|
+
throw new SELContractError(`Contract call failed: ${contract.name}.${method.name}: ${detail}`, {
|
|
57
81
|
cause: error,
|
|
58
82
|
contractName: contract.name,
|
|
59
83
|
methodName: method.name
|
|
@@ -207,7 +207,8 @@ var SELRuntime = class {
|
|
|
207
207
|
} else if (typeof error.failedCallIndex === "number") failedCall = collectedCalls[error.failedCallIndex] ?? failedCall;
|
|
208
208
|
}
|
|
209
209
|
if (!failedCall) throw error;
|
|
210
|
-
|
|
210
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
211
|
+
throw new require_errors.SELContractError(`Contract call failed: ${failedCall.contract}.${failedCall.method}: ${detail}`, {
|
|
211
212
|
cause: error,
|
|
212
213
|
contractName: failedCall.contract,
|
|
213
214
|
methodName: failedCall.method
|
|
@@ -206,7 +206,8 @@ var SELRuntime = class {
|
|
|
206
206
|
} else if (typeof error.failedCallIndex === "number") failedCall = collectedCalls[error.failedCallIndex] ?? failedCall;
|
|
207
207
|
}
|
|
208
208
|
if (!failedCall) throw error;
|
|
209
|
-
|
|
209
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
210
|
+
throw new SELContractError(`Contract call failed: ${failedCall.contract}.${failedCall.method}: ${detail}`, {
|
|
210
211
|
cause: error,
|
|
211
212
|
contractName: failedCall.contract,
|
|
212
213
|
methodName: failedCall.method
|
|
@@ -2,8 +2,8 @@ require("../_virtual/_rolldown/runtime.cjs");
|
|
|
2
2
|
const require_errors = require("../errors/errors.cjs");
|
|
3
3
|
require("../errors/index.cjs");
|
|
4
4
|
let _seljs_common = require("@seljs/common");
|
|
5
|
-
let _marcbachmann_cel_js = require("@marcbachmann/cel-js");
|
|
6
5
|
let viem = require("viem");
|
|
6
|
+
let _marcbachmann_cel_js = require("@marcbachmann/cel-js");
|
|
7
7
|
//#region src/environment/error-wrapper.ts
|
|
8
8
|
/**
|
|
9
9
|
* Compose a human-readable message from a viem error. Uses `shortMessage`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SELContractError, SELContractRevertError, SELProviderError, SELProviderRpcError, SELProviderTransportError } from "../errors/errors.mjs";
|
|
2
2
|
import "../errors/index.mjs";
|
|
3
3
|
import { SELError, SELEvaluationError, SELParseError, SELTypeCheckError } from "@seljs/common";
|
|
4
|
-
import { EvaluationError, ParseError, TypeError } from "@marcbachmann/cel-js";
|
|
5
4
|
import { AbiDecodingDataSizeInvalidError, AbiDecodingZeroDataError, AbiErrorSignatureNotFoundError, BaseError, ContractFunctionExecutionError, ContractFunctionRevertedError, HttpRequestError, RpcError, TimeoutError, WebSocketRequestError } from "viem";
|
|
5
|
+
import { EvaluationError, ParseError, TypeError } from "@marcbachmann/cel-js";
|
|
6
6
|
//#region src/environment/error-wrapper.ts
|
|
7
7
|
/**
|
|
8
8
|
* Compose a human-readable message from a viem error. Uses `shortMessage`
|
|
@@ -18,7 +18,10 @@ const PANIC_CODES = {
|
|
|
18
18
|
const errorStringAbi = ox.AbiError.from("error Error(string reason)");
|
|
19
19
|
const panicAbi = ox.AbiError.from("error Panic(uint256 code)");
|
|
20
20
|
function decodeRevertData(data, abi) {
|
|
21
|
-
if (data === "0x" || data.length < 10) return {
|
|
21
|
+
if (data === "0x" || data.length < 10) return {
|
|
22
|
+
data,
|
|
23
|
+
reason: "reverted without data"
|
|
24
|
+
};
|
|
22
25
|
const selector = data.slice(0, 10).toLowerCase();
|
|
23
26
|
if (selector === ERROR_STRING_SELECTOR) try {
|
|
24
27
|
return {
|
|
@@ -17,7 +17,10 @@ const PANIC_CODES = {
|
|
|
17
17
|
const errorStringAbi = AbiError.from("error Error(string reason)");
|
|
18
18
|
const panicAbi = AbiError.from("error Panic(uint256 code)");
|
|
19
19
|
function decodeRevertData(data, abi) {
|
|
20
|
-
if (data === "0x" || data.length < 10) return {
|
|
20
|
+
if (data === "0x" || data.length < 10) return {
|
|
21
|
+
data,
|
|
22
|
+
reason: "reverted without data"
|
|
23
|
+
};
|
|
21
24
|
const selector = data.slice(0, 10).toLowerCase();
|
|
22
25
|
if (selector === ERROR_STRING_SELECTOR) try {
|
|
23
26
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seljs/runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0-beta.24",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "https://github.com/abinnovision/seljs"
|
|
6
6
|
},
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@marcbachmann/cel-js": "^7.5.3",
|
|
53
|
-
"@seljs/checker": "1.
|
|
54
|
-
"@seljs/common": "1.3.0
|
|
55
|
-
"@seljs/env": "1.3.0
|
|
56
|
-
"@seljs/schema": "1.
|
|
57
|
-
"@seljs/types": "1.3.0
|
|
53
|
+
"@seljs/checker": "1.4.0-beta.24",
|
|
54
|
+
"@seljs/common": "1.3.0",
|
|
55
|
+
"@seljs/env": "1.3.0",
|
|
56
|
+
"@seljs/schema": "1.3.0",
|
|
57
|
+
"@seljs/types": "1.3.0",
|
|
58
58
|
"debug": "^4.4.3",
|
|
59
59
|
"ox": "^0.14.10",
|
|
60
60
|
"viem": "^2.47.6"
|