@seljs/checker 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.
|
@@ -50,7 +50,7 @@ const hydrateEnvironment = (env, schema, handler) => {
|
|
|
50
50
|
const returnType = method.returns || "dyn";
|
|
51
51
|
const methodHandler = handler !== void 0 ? async (...args) => {
|
|
52
52
|
const raw = await handler(contract.name, method.name, args.slice(1));
|
|
53
|
-
if (!codecRegistry) throw new
|
|
53
|
+
if (!codecRegistry) throw new _seljs_common.SELConfigError("codecRegistry is required when handler is provided", { setting: "codecRegistry" });
|
|
54
54
|
return codecRegistry.resolve(returnType).parse(raw);
|
|
55
55
|
} : () => void 0;
|
|
56
56
|
try {
|
|
@@ -93,7 +93,7 @@ const hydrateEnvironment = (env, schema, handler) => {
|
|
|
93
93
|
if (!fn.receiverType) continue;
|
|
94
94
|
const fnHandler = handler !== void 0 ? async (...args) => {
|
|
95
95
|
const raw = await handler(fn.receiverType, fn.name, args);
|
|
96
|
-
if (!codecRegistry) throw new
|
|
96
|
+
if (!codecRegistry) throw new _seljs_common.SELConfigError("codecRegistry is required when handler is provided", { setting: "codecRegistry" });
|
|
97
97
|
return codecRegistry.resolve(fn.returns).parse(raw);
|
|
98
98
|
} : () => void 0;
|
|
99
99
|
try {
|
|
@@ -155,7 +155,7 @@ const createRuntimeEnvironment = (schema, handler, options) => {
|
|
|
155
155
|
});
|
|
156
156
|
require_register_types.registerSolidityTypes(env);
|
|
157
157
|
const result = hydrateEnvironment(env, schema, handler);
|
|
158
|
-
if (!result.codecRegistry) throw new
|
|
158
|
+
if (!result.codecRegistry) throw new _seljs_common.SELConfigError("codecRegistry is required when handler is provided", { setting: "codecRegistry" });
|
|
159
159
|
return {
|
|
160
160
|
env,
|
|
161
161
|
contractBindings: result.contractBindings,
|
|
@@ -2,7 +2,7 @@ import { createLogger } from "../debug.mjs";
|
|
|
2
2
|
import { CelCodecRegistry } from "./codec-registry.mjs";
|
|
3
3
|
import { registerSolidityTypes } from "./register-types.mjs";
|
|
4
4
|
import { toCelLiteralType } from "./value-wrappers.mjs";
|
|
5
|
-
import { contractTypeName } from "@seljs/common";
|
|
5
|
+
import { SELConfigError, contractTypeName } from "@seljs/common";
|
|
6
6
|
import { Environment } from "@marcbachmann/cel-js";
|
|
7
7
|
//#region src/environment/hydrate.ts
|
|
8
8
|
const debug = createLogger("hydrate");
|
|
@@ -49,7 +49,7 @@ const hydrateEnvironment = (env, schema, handler) => {
|
|
|
49
49
|
const returnType = method.returns || "dyn";
|
|
50
50
|
const methodHandler = handler !== void 0 ? async (...args) => {
|
|
51
51
|
const raw = await handler(contract.name, method.name, args.slice(1));
|
|
52
|
-
if (!codecRegistry) throw new
|
|
52
|
+
if (!codecRegistry) throw new SELConfigError("codecRegistry is required when handler is provided", { setting: "codecRegistry" });
|
|
53
53
|
return codecRegistry.resolve(returnType).parse(raw);
|
|
54
54
|
} : () => void 0;
|
|
55
55
|
try {
|
|
@@ -92,7 +92,7 @@ const hydrateEnvironment = (env, schema, handler) => {
|
|
|
92
92
|
if (!fn.receiverType) continue;
|
|
93
93
|
const fnHandler = handler !== void 0 ? async (...args) => {
|
|
94
94
|
const raw = await handler(fn.receiverType, fn.name, args);
|
|
95
|
-
if (!codecRegistry) throw new
|
|
95
|
+
if (!codecRegistry) throw new SELConfigError("codecRegistry is required when handler is provided", { setting: "codecRegistry" });
|
|
96
96
|
return codecRegistry.resolve(fn.returns).parse(raw);
|
|
97
97
|
} : () => void 0;
|
|
98
98
|
try {
|
|
@@ -154,7 +154,7 @@ const createRuntimeEnvironment = (schema, handler, options) => {
|
|
|
154
154
|
});
|
|
155
155
|
registerSolidityTypes(env);
|
|
156
156
|
const result = hydrateEnvironment(env, schema, handler);
|
|
157
|
-
if (!result.codecRegistry) throw new
|
|
157
|
+
if (!result.codecRegistry) throw new SELConfigError("codecRegistry is required when handler is provided", { setting: "codecRegistry" });
|
|
158
158
|
return {
|
|
159
159
|
env,
|
|
160
160
|
contractBindings: result.contractBindings,
|
|
@@ -135,7 +135,7 @@ const registerSolidityTypes = (env) => {
|
|
|
135
135
|
});
|
|
136
136
|
registerListSolIntReducer("min", (list) => {
|
|
137
137
|
const items = list;
|
|
138
|
-
if (items.length === 0) throw new
|
|
138
|
+
if (items.length === 0) throw new _seljs_common.SELEvaluationError("list<sol_int>.min(): list is empty");
|
|
139
139
|
let smallest = (0, _seljs_types.toBigInt)(items[0]);
|
|
140
140
|
for (let i = 1; i < items.length; i++) {
|
|
141
141
|
const v = (0, _seljs_types.toBigInt)(items[i]);
|
|
@@ -145,7 +145,7 @@ const registerSolidityTypes = (env) => {
|
|
|
145
145
|
});
|
|
146
146
|
registerListSolIntReducer("max", (list) => {
|
|
147
147
|
const items = list;
|
|
148
|
-
if (items.length === 0) throw new
|
|
148
|
+
if (items.length === 0) throw new _seljs_common.SELEvaluationError("list<sol_int>.max(): list is empty");
|
|
149
149
|
let largest = (0, _seljs_types.toBigInt)(items[0]);
|
|
150
150
|
for (let i = 1; i < items.length; i++) {
|
|
151
151
|
const v = (0, _seljs_types.toBigInt)(items[i]);
|
|
@@ -134,7 +134,7 @@ const registerSolidityTypes = (env) => {
|
|
|
134
134
|
});
|
|
135
135
|
registerListSolIntReducer("min", (list) => {
|
|
136
136
|
const items = list;
|
|
137
|
-
if (items.length === 0) throw new
|
|
137
|
+
if (items.length === 0) throw new SELEvaluationError("list<sol_int>.min(): list is empty");
|
|
138
138
|
let smallest = toBigInt(items[0]);
|
|
139
139
|
for (let i = 1; i < items.length; i++) {
|
|
140
140
|
const v = toBigInt(items[i]);
|
|
@@ -144,7 +144,7 @@ const registerSolidityTypes = (env) => {
|
|
|
144
144
|
});
|
|
145
145
|
registerListSolIntReducer("max", (list) => {
|
|
146
146
|
const items = list;
|
|
147
|
-
if (items.length === 0) throw new
|
|
147
|
+
if (items.length === 0) throw new SELEvaluationError("list<sol_int>.max(): list is empty");
|
|
148
148
|
let largest = toBigInt(items[0]);
|
|
149
149
|
for (let i = 1; i < items.length; i++) {
|
|
150
150
|
const v = toBigInt(items[i]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seljs/checker",
|
|
3
|
-
"version": "1.3.0-beta.
|
|
3
|
+
"version": "1.3.0-beta.32",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "https://github.com/abinnovision/seljs"
|
|
6
6
|
},
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@marcbachmann/cel-js": "^7.5.3",
|
|
53
|
-
"@seljs/common": "1.3.0-beta.
|
|
53
|
+
"@seljs/common": "1.3.0-beta.32",
|
|
54
54
|
"@seljs/schema": "1.2.0",
|
|
55
|
-
"@seljs/types": "1.3.0-beta.
|
|
55
|
+
"@seljs/types": "1.3.0-beta.32",
|
|
56
56
|
"debug": "^4.4.3",
|
|
57
57
|
"viem": "^2.47.6"
|
|
58
58
|
},
|