@seljs/runtime 1.3.0-beta.1 → 1.3.0-beta.3

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.
Files changed (43) hide show
  1. package/dist/analysis/call-collector.cjs +19 -0
  2. package/dist/analysis/call-collector.mjs +19 -0
  3. package/dist/analysis/dependency-analyzer.cjs +1 -2
  4. package/dist/analysis/dependency-analyzer.mjs +1 -1
  5. package/dist/analysis/round-planner.cjs +1 -2
  6. package/dist/analysis/round-planner.mjs +1 -1
  7. package/dist/environment/builtin-contracts.cjs +22 -0
  8. package/dist/environment/builtin-contracts.mjs +22 -0
  9. package/dist/environment/client.cjs +16 -0
  10. package/dist/environment/client.d.cts +33 -0
  11. package/dist/environment/client.d.mts +33 -0
  12. package/dist/environment/client.mjs +16 -0
  13. package/dist/environment/contract-caller.cjs +13 -12
  14. package/dist/environment/contract-caller.mjs +13 -12
  15. package/dist/environment/environment.cjs +34 -10
  16. package/dist/environment/environment.d.cts +5 -0
  17. package/dist/environment/environment.d.mts +5 -0
  18. package/dist/environment/environment.mjs +34 -10
  19. package/dist/environment/index.cjs +1 -0
  20. package/dist/environment/index.d.mts +1 -0
  21. package/dist/environment/index.mjs +1 -0
  22. package/dist/environment/types.d.cts +4 -4
  23. package/dist/environment/types.d.mts +4 -4
  24. package/dist/errors/errors.cjs +7 -0
  25. package/dist/errors/errors.d.cts +7 -1
  26. package/dist/errors/errors.d.mts +7 -1
  27. package/dist/errors/errors.mjs +7 -1
  28. package/dist/errors/index.d.mts +1 -1
  29. package/dist/execution/multi-round-executor.cjs +1 -4
  30. package/dist/execution/multi-round-executor.mjs +1 -3
  31. package/dist/execution/multicall-batcher.cjs +11 -9
  32. package/dist/execution/multicall-batcher.mjs +11 -9
  33. package/dist/execution/multicall.cjs +28 -4
  34. package/dist/execution/multicall.mjs +26 -4
  35. package/dist/execution/round-executor.cjs +4 -12
  36. package/dist/execution/round-executor.mjs +4 -12
  37. package/dist/execution/types.d.cts +4 -6
  38. package/dist/execution/types.d.mts +4 -6
  39. package/dist/index.cjs +3 -0
  40. package/dist/index.d.cts +3 -2
  41. package/dist/index.d.mts +3 -2
  42. package/dist/index.mjs +3 -2
  43. package/package.json +6 -6
@@ -196,6 +196,25 @@ const collectCalls = (ast, registry) => {
196
196
  return;
197
197
  }
198
198
  if (!receiverName || !registry.get(receiverName)) {
199
+ if (method === "balance" && args.length === 0) {
200
+ const receiverNode = node.args[1];
201
+ const { arg: receiverArg, traversed } = classifyArg(receiverNode);
202
+ if (receiverArg) {
203
+ const call = {
204
+ id: generateCallId("__multicall3", "getEthBalance", [receiverArg]),
205
+ contract: "__multicall3",
206
+ method: "getEthBalance",
207
+ args: [receiverArg],
208
+ astNode: node
209
+ };
210
+ calls.push(call);
211
+ debug("found address accessor %s (id=%s)", "balance", call.id);
212
+ return call;
213
+ }
214
+ deferredNodes.add(node);
215
+ if (!traversed) traverse(receiverNode);
216
+ return;
217
+ }
199
218
  handleNonContractRCall(node, method, args);
200
219
  return;
201
220
  }
@@ -195,6 +195,25 @@ const collectCalls = (ast, registry) => {
195
195
  return;
196
196
  }
197
197
  if (!receiverName || !registry.get(receiverName)) {
198
+ if (method === "balance" && args.length === 0) {
199
+ const receiverNode = node.args[1];
200
+ const { arg: receiverArg, traversed } = classifyArg(receiverNode);
201
+ if (receiverArg) {
202
+ const call = {
203
+ id: generateCallId("__multicall3", "getEthBalance", [receiverArg]),
204
+ contract: "__multicall3",
205
+ method: "getEthBalance",
206
+ args: [receiverArg],
207
+ astNode: node
208
+ };
209
+ calls.push(call);
210
+ debug("found address accessor %s (id=%s)", "balance", call.id);
211
+ return call;
212
+ }
213
+ deferredNodes.add(node);
214
+ if (!traversed) traverse(receiverNode);
215
+ return;
216
+ }
198
217
  handleNonContractRCall(node, method, args);
199
218
  return;
200
219
  }
@@ -1,8 +1,7 @@
1
- const require_debug = require("../debug.cjs");
2
1
  const require_errors = require("../errors/errors.cjs");
3
2
  require("../errors/index.cjs");
4
3
  //#region src/analysis/dependency-analyzer.ts
5
- const debug = require_debug.createLogger("analysis:dependency");
4
+ const debug = require("../debug.cjs").createLogger("analysis:dependency");
6
5
  /**
7
6
  * Detects circular dependencies in the graph using DFS with a recursion stack.
8
7
  *
@@ -1,6 +1,6 @@
1
- import { createLogger } from "../debug.mjs";
2
1
  import { CircularDependencyError } from "../errors/errors.mjs";
3
2
  import "../errors/index.mjs";
3
+ import { createLogger } from "../debug.mjs";
4
4
  //#region src/analysis/dependency-analyzer.ts
5
5
  const debug = createLogger("analysis:dependency");
6
6
  /**
@@ -1,8 +1,7 @@
1
- const require_debug = require("../debug.cjs");
2
1
  const require_errors = require("../errors/errors.cjs");
3
2
  require("../errors/index.cjs");
4
3
  //#region src/analysis/round-planner.ts
5
- const debug = require_debug.createLogger("analysis:plan");
4
+ const debug = require("../debug.cjs").createLogger("analysis:plan");
6
5
  /**
7
6
  * Plans execution rounds from a dependency graph using topological sorting.
8
7
  *
@@ -1,6 +1,6 @@
1
- import { createLogger } from "../debug.mjs";
2
1
  import { ExecutionLimitError } from "../errors/errors.mjs";
3
2
  import "../errors/index.mjs";
3
+ import { createLogger } from "../debug.mjs";
4
4
  //#region src/analysis/round-planner.ts
5
5
  const debug = createLogger("analysis:plan");
6
6
  /**
@@ -0,0 +1,22 @@
1
+ const require_multicall = require("../execution/multicall.cjs");
2
+ //#region src/environment/builtin-contracts.ts
3
+ /**
4
+ * Returns built-in contract schemas that are always available in the runtime.
5
+ * These are internal contracts not defined by the user schema but required
6
+ * for built-in features like address accessors.
7
+ */
8
+ const getBuiltinContracts = (multicall) => [{
9
+ name: "__multicall3",
10
+ address: multicall?.address ?? "0xcA11bde05977b3631167028862bE2a173976CA11",
11
+ methods: [{
12
+ name: "getEthBalance",
13
+ params: [{
14
+ name: "addr",
15
+ type: "sol_address"
16
+ }],
17
+ returns: "sol_int",
18
+ abi: require_multicall.getEthBalanceAbi
19
+ }]
20
+ }];
21
+ //#endregion
22
+ exports.getBuiltinContracts = getBuiltinContracts;
@@ -0,0 +1,22 @@
1
+ import { getEthBalanceAbi } from "../execution/multicall.mjs";
2
+ //#region src/environment/builtin-contracts.ts
3
+ /**
4
+ * Returns built-in contract schemas that are always available in the runtime.
5
+ * These are internal contracts not defined by the user schema but required
6
+ * for built-in features like address accessors.
7
+ */
8
+ const getBuiltinContracts = (multicall) => [{
9
+ name: "__multicall3",
10
+ address: multicall?.address ?? "0xcA11bde05977b3631167028862bE2a173976CA11",
11
+ methods: [{
12
+ name: "getEthBalance",
13
+ params: [{
14
+ name: "addr",
15
+ type: "sol_address"
16
+ }],
17
+ returns: "sol_int",
18
+ abi: getEthBalanceAbi
19
+ }]
20
+ }];
21
+ //#endregion
22
+ export { getBuiltinContracts };
@@ -0,0 +1,16 @@
1
+ const require_errors = require("../errors/errors.cjs");
2
+ require("../errors/index.cjs");
3
+ //#region src/environment/client.ts
4
+ /**
5
+ * Validates that an object satisfies the SELClient interface.
6
+ * Throws SELClientError if validation fails.
7
+ * Called at construction time for fail-fast behavior.
8
+ */
9
+ function validateClient(client) {
10
+ if (!client || typeof client !== "object") throw new require_errors.SELClientError("Client must be an object");
11
+ const c = client;
12
+ if (typeof c["call"] !== "function") throw new require_errors.SELClientError("Client must implement call({ to, data, blockNumber? }). ");
13
+ if (typeof c["getBlockNumber"] !== "function") throw new require_errors.SELClientError("Client must implement getBlockNumber(). ");
14
+ }
15
+ //#endregion
16
+ exports.validateClient = validateClient;
@@ -0,0 +1,33 @@
1
+ //#region src/environment/client.d.ts
2
+ /**
3
+ * Minimal client interface for SEL runtime contract execution.
4
+ *
5
+ * Framework-agnostic: works with viem PublicClient, ethers.js Provider,
6
+ * web3.js, or any object that can make eth_call and eth_blockNumber requests.
7
+ *
8
+ * A viem PublicClient structurally satisfies this interface.
9
+ */
10
+ interface SELClient {
11
+ /**
12
+ * Execute an eth_call against a contract
13
+ */
14
+ call: (params: {
15
+ to: `0x${string}`;
16
+ data: `0x${string}`;
17
+ blockNumber?: bigint;
18
+ }) => Promise<{
19
+ data?: `0x${string}`;
20
+ }>;
21
+ /**
22
+ * Get the current block number (eth_blockNumber) for pinning reads
23
+ */
24
+ getBlockNumber: () => Promise<bigint>;
25
+ }
26
+ /**
27
+ * Validates that an object satisfies the SELClient interface.
28
+ * Throws SELClientError if validation fails.
29
+ * Called at construction time for fail-fast behavior.
30
+ */
31
+ declare function validateClient(client: unknown): asserts client is SELClient;
32
+ //#endregion
33
+ export { SELClient, validateClient };
@@ -0,0 +1,33 @@
1
+ //#region src/environment/client.d.ts
2
+ /**
3
+ * Minimal client interface for SEL runtime contract execution.
4
+ *
5
+ * Framework-agnostic: works with viem PublicClient, ethers.js Provider,
6
+ * web3.js, or any object that can make eth_call and eth_blockNumber requests.
7
+ *
8
+ * A viem PublicClient structurally satisfies this interface.
9
+ */
10
+ interface SELClient {
11
+ /**
12
+ * Execute an eth_call against a contract
13
+ */
14
+ call: (params: {
15
+ to: `0x${string}`;
16
+ data: `0x${string}`;
17
+ blockNumber?: bigint;
18
+ }) => Promise<{
19
+ data?: `0x${string}`;
20
+ }>;
21
+ /**
22
+ * Get the current block number (eth_blockNumber) for pinning reads
23
+ */
24
+ getBlockNumber: () => Promise<bigint>;
25
+ }
26
+ /**
27
+ * Validates that an object satisfies the SELClient interface.
28
+ * Throws SELClientError if validation fails.
29
+ * Called at construction time for fail-fast behavior.
30
+ */
31
+ declare function validateClient(client: unknown): asserts client is SELClient;
32
+ //#endregion
33
+ export { SELClient, validateClient };
@@ -0,0 +1,16 @@
1
+ import { SELClientError } from "../errors/errors.mjs";
2
+ import "../errors/index.mjs";
3
+ //#region src/environment/client.ts
4
+ /**
5
+ * Validates that an object satisfies the SELClient interface.
6
+ * Throws SELClientError if validation fails.
7
+ * Called at construction time for fail-fast behavior.
8
+ */
9
+ function validateClient(client) {
10
+ if (!client || typeof client !== "object") throw new SELClientError("Client must be an object");
11
+ const c = client;
12
+ if (typeof c["call"] !== "function") throw new SELClientError("Client must implement call({ to, data, blockNumber? }). ");
13
+ if (typeof c["getBlockNumber"] !== "function") throw new SELClientError("Client must implement getBlockNumber(). ");
14
+ }
15
+ //#endregion
16
+ export { validateClient };
@@ -1,9 +1,9 @@
1
1
  require("../_virtual/_rolldown/runtime.cjs");
2
- const require_replay_cache = require("./replay-cache.cjs");
3
- const require_debug = require("../debug.cjs");
4
2
  const require_errors = require("../errors/errors.cjs");
5
3
  require("../errors/index.cjs");
6
- let viem_actions = require("viem/actions");
4
+ const require_replay_cache = require("./replay-cache.cjs");
5
+ const require_debug = require("../debug.cjs");
6
+ let ox = require("ox");
7
7
  //#region src/environment/contract-caller.ts
8
8
  const debug = require_debug.createLogger("contract-caller");
9
9
  /**
@@ -42,12 +42,16 @@ const executeContractCall = async (contract, method, args, options) => {
42
42
  });
43
43
  options.callCounter?.increment(contract.name, method.name);
44
44
  try {
45
- return await (0, viem_actions.readContract)(options.client, {
46
- address: contract.address,
47
- abi: [method.abi],
48
- functionName: method.name,
49
- args: normalizedArgs
45
+ const data = ox.AbiFunction.encodeData([method.abi], method.name, normalizedArgs);
46
+ const result = await options.client.call({
47
+ to: contract.address,
48
+ data
49
+ });
50
+ if (!result.data) throw new require_errors.SELContractError(`Contract call returned no data: ${contract.name}.${method.name}`, {
51
+ contractName: contract.name,
52
+ methodName: method.name
50
53
  });
54
+ return ox.AbiFunction.decodeResult([method.abi], method.name, result.data);
51
55
  } catch (error) {
52
56
  if (error instanceof require_errors.SELContractError) throw error;
53
57
  throw new require_errors.SELContractError(`Contract call failed: ${contract.name}.${method.name}`, {
@@ -58,10 +62,7 @@ const executeContractCall = async (contract, method, args, options) => {
58
62
  }
59
63
  };
60
64
  const resolveExecutionBlockNumber = async (client) => {
61
- const clientWithGetBlockNumber = client;
62
- if (typeof clientWithGetBlockNumber.getBlockNumber === "function") return await clientWithGetBlockNumber.getBlockNumber();
63
- if (typeof clientWithGetBlockNumber.request === "function") return;
64
- return 0n;
65
+ return await client.getBlockNumber();
65
66
  };
66
67
  const buildContractInfoMap = (contracts) => {
67
68
  const map = /* @__PURE__ */ new Map();
@@ -1,8 +1,8 @@
1
- import { createReplayCallId } from "./replay-cache.mjs";
2
- import { createLogger } from "../debug.mjs";
3
1
  import { ExecutionLimitError, SELContractError } from "../errors/errors.mjs";
4
2
  import "../errors/index.mjs";
5
- import { readContract } from "viem/actions";
3
+ import { createReplayCallId } from "./replay-cache.mjs";
4
+ import { createLogger } from "../debug.mjs";
5
+ import { AbiFunction } from "ox";
6
6
  //#region src/environment/contract-caller.ts
7
7
  const debug = createLogger("contract-caller");
8
8
  /**
@@ -41,12 +41,16 @@ const executeContractCall = async (contract, method, args, options) => {
41
41
  });
42
42
  options.callCounter?.increment(contract.name, method.name);
43
43
  try {
44
- return await readContract(options.client, {
45
- address: contract.address,
46
- abi: [method.abi],
47
- functionName: method.name,
48
- args: normalizedArgs
44
+ const data = AbiFunction.encodeData([method.abi], method.name, normalizedArgs);
45
+ const result = await options.client.call({
46
+ to: contract.address,
47
+ data
48
+ });
49
+ if (!result.data) throw new SELContractError(`Contract call returned no data: ${contract.name}.${method.name}`, {
50
+ contractName: contract.name,
51
+ methodName: method.name
49
52
  });
53
+ return AbiFunction.decodeResult([method.abi], method.name, result.data);
50
54
  } catch (error) {
51
55
  if (error instanceof SELContractError) throw error;
52
56
  throw new SELContractError(`Contract call failed: ${contract.name}.${method.name}`, {
@@ -57,10 +61,7 @@ const executeContractCall = async (contract, method, args, options) => {
57
61
  }
58
62
  };
59
63
  const resolveExecutionBlockNumber = async (client) => {
60
- const clientWithGetBlockNumber = client;
61
- if (typeof clientWithGetBlockNumber.getBlockNumber === "function") return await clientWithGetBlockNumber.getBlockNumber();
62
- if (typeof clientWithGetBlockNumber.request === "function") return;
63
- return 0n;
64
+ return await client.getBlockNumber();
64
65
  };
65
66
  const buildContractInfoMap = (contracts) => {
66
67
  const map = /* @__PURE__ */ new Map();
@@ -1,9 +1,11 @@
1
1
  require("../_virtual/_rolldown/runtime.cjs");
2
+ const require_builtin_contracts = require("./builtin-contracts.cjs");
3
+ const require_errors = require("../errors/errors.cjs");
4
+ require("../errors/index.cjs");
5
+ const require_client = require("./client.cjs");
2
6
  const require_context = require("./context.cjs");
3
7
  const require_replay_cache = require("./replay-cache.cjs");
4
8
  const require_debug = require("../debug.cjs");
5
- const require_errors = require("../errors/errors.cjs");
6
- require("../errors/index.cjs");
7
9
  const require_contract_caller = require("./contract-caller.cjs");
8
10
  const require_error_wrapper = require("./error-wrapper.cjs");
9
11
  const require_call_collector = require("../analysis/call-collector.cjs");
@@ -70,17 +72,22 @@ var SELRuntime = class {
70
72
  this.maxRounds = limits?.maxRounds ?? 10;
71
73
  this.maxCalls = limits?.maxCalls ?? 100;
72
74
  this.multicallOptions = config.multicall;
75
+ if (config.client) require_client.validateClient(config.client);
73
76
  this.client = config.client;
74
- this.schema = config.schema;
77
+ this.schema = {
78
+ ...config.schema,
79
+ contracts: [...config.schema.contracts, ...require_builtin_contracts.getBuiltinContracts(config.multicall)]
80
+ };
75
81
  const handler = (contractName, methodName, args) => {
76
- const contract = this.findContract(contractName);
77
- if (!contract) throw new require_errors.SELContractError(`Unknown contract "${contractName}"`, { contractName });
78
- const method = contract.methods.find((m) => m.name === methodName);
79
- if (!method) throw new require_errors.SELContractError(`Unknown method "${contractName}.${methodName}"`, {
80
- contractName,
81
- methodName
82
+ const resolved = this.resolveCall(contractName, methodName, args);
83
+ const contract = this.findContract(resolved.contractName);
84
+ if (!contract) throw new require_errors.SELContractError(`Unknown contract "${resolved.contractName}"`, { contractName: resolved.contractName });
85
+ const method = contract.methods.find((m) => m.name === resolved.methodName);
86
+ if (!method) throw new require_errors.SELContractError(`Unknown method "${resolved.contractName}.${resolved.methodName}"`, {
87
+ contractName: resolved.contractName,
88
+ methodName: resolved.methodName
82
89
  });
83
- return require_contract_caller.executeContractCall(contract, method, args, {
90
+ return require_contract_caller.executeContractCall(contract, method, resolved.args, {
84
91
  executionCache: this.currentCache,
85
92
  client: this.currentClient ?? this.client,
86
93
  codecRegistry: this.codecRegistry,
@@ -207,6 +214,7 @@ var SELRuntime = class {
207
214
  async doEvaluate(expression, context, options) {
208
215
  debug("evaluate: %s", expression);
209
216
  const resolvedClient = options?.client ?? this.client;
217
+ if (resolvedClient && resolvedClient !== this.client) require_client.validateClient(resolvedClient);
210
218
  try {
211
219
  const { parseResult, collectedCalls, normalizedContext, executionVariables, typeCheckResult, diagnostics } = this.planExecution(expression, context ?? {});
212
220
  let executionMeta;
@@ -244,6 +252,22 @@ var SELRuntime = class {
244
252
  throw require_error_wrapper.wrapError(error);
245
253
  }
246
254
  }
255
+ /**
256
+ * Remaps receiver method calls to their underlying contract calls.
257
+ * e.g., sol_address.balance() → __multicall3.getEthBalance(addr)
258
+ */
259
+ resolveCall(contractName, methodName, args) {
260
+ if (contractName === "sol_address" && methodName === "balance") return {
261
+ contractName: "__multicall3",
262
+ methodName: "getEthBalance",
263
+ args
264
+ };
265
+ return {
266
+ contractName,
267
+ methodName,
268
+ args
269
+ };
270
+ }
247
271
  findContract(name) {
248
272
  return this.schema.contracts.find((c) => c.name === name);
249
273
  }
@@ -79,6 +79,11 @@ declare class SELRuntime {
79
79
  private planExecution;
80
80
  private executeContractCalls;
81
81
  private doEvaluate;
82
+ /**
83
+ * Remaps receiver method calls to their underlying contract calls.
84
+ * e.g., sol_address.balance() → __multicall3.getEthBalance(addr)
85
+ */
86
+ private resolveCall;
82
87
  private findContract;
83
88
  }
84
89
  //#endregion
@@ -79,6 +79,11 @@ declare class SELRuntime {
79
79
  private planExecution;
80
80
  private executeContractCalls;
81
81
  private doEvaluate;
82
+ /**
83
+ * Remaps receiver method calls to their underlying contract calls.
84
+ * e.g., sol_address.balance() → __multicall3.getEthBalance(addr)
85
+ */
86
+ private resolveCall;
82
87
  private findContract;
83
88
  }
84
89
  //#endregion
@@ -1,8 +1,10 @@
1
+ import { getBuiltinContracts } from "./builtin-contracts.mjs";
2
+ import { MulticallBatchError, SELContractError, SELLintError, SELTypeError } from "../errors/errors.mjs";
3
+ import "../errors/index.mjs";
4
+ import { validateClient } from "./client.mjs";
1
5
  import { normalizeContextForEvaluation } from "./context.mjs";
2
6
  import { buildExecutionReplayCache } from "./replay-cache.mjs";
3
7
  import { createLogger } from "../debug.mjs";
4
- import { MulticallBatchError, SELContractError, SELLintError, SELTypeError } from "../errors/errors.mjs";
5
- import "../errors/index.mjs";
6
8
  import { CallCounter, buildContractInfoMap, executeContractCall, resolveExecutionBlockNumber } from "./contract-caller.mjs";
7
9
  import { wrapError } from "./error-wrapper.mjs";
8
10
  import { collectCalls } from "../analysis/call-collector.mjs";
@@ -68,17 +70,22 @@ var SELRuntime = class {
68
70
  this.maxRounds = limits?.maxRounds ?? 10;
69
71
  this.maxCalls = limits?.maxCalls ?? 100;
70
72
  this.multicallOptions = config.multicall;
73
+ if (config.client) validateClient(config.client);
71
74
  this.client = config.client;
72
- this.schema = config.schema;
75
+ this.schema = {
76
+ ...config.schema,
77
+ contracts: [...config.schema.contracts, ...getBuiltinContracts(config.multicall)]
78
+ };
73
79
  const handler = (contractName, methodName, args) => {
74
- const contract = this.findContract(contractName);
75
- if (!contract) throw new SELContractError(`Unknown contract "${contractName}"`, { contractName });
76
- const method = contract.methods.find((m) => m.name === methodName);
77
- if (!method) throw new SELContractError(`Unknown method "${contractName}.${methodName}"`, {
78
- contractName,
79
- methodName
80
+ const resolved = this.resolveCall(contractName, methodName, args);
81
+ const contract = this.findContract(resolved.contractName);
82
+ if (!contract) throw new SELContractError(`Unknown contract "${resolved.contractName}"`, { contractName: resolved.contractName });
83
+ const method = contract.methods.find((m) => m.name === resolved.methodName);
84
+ if (!method) throw new SELContractError(`Unknown method "${resolved.contractName}.${resolved.methodName}"`, {
85
+ contractName: resolved.contractName,
86
+ methodName: resolved.methodName
80
87
  });
81
- return executeContractCall(contract, method, args, {
88
+ return executeContractCall(contract, method, resolved.args, {
82
89
  executionCache: this.currentCache,
83
90
  client: this.currentClient ?? this.client,
84
91
  codecRegistry: this.codecRegistry,
@@ -205,6 +212,7 @@ var SELRuntime = class {
205
212
  async doEvaluate(expression, context, options) {
206
213
  debug("evaluate: %s", expression);
207
214
  const resolvedClient = options?.client ?? this.client;
215
+ if (resolvedClient && resolvedClient !== this.client) validateClient(resolvedClient);
208
216
  try {
209
217
  const { parseResult, collectedCalls, normalizedContext, executionVariables, typeCheckResult, diagnostics } = this.planExecution(expression, context ?? {});
210
218
  let executionMeta;
@@ -242,6 +250,22 @@ var SELRuntime = class {
242
250
  throw wrapError(error);
243
251
  }
244
252
  }
253
+ /**
254
+ * Remaps receiver method calls to their underlying contract calls.
255
+ * e.g., sol_address.balance() → __multicall3.getEthBalance(addr)
256
+ */
257
+ resolveCall(contractName, methodName, args) {
258
+ if (contractName === "sol_address" && methodName === "balance") return {
259
+ contractName: "__multicall3",
260
+ methodName: "getEthBalance",
261
+ args
262
+ };
263
+ return {
264
+ contractName,
265
+ methodName,
266
+ args
267
+ };
268
+ }
245
269
  findContract(name) {
246
270
  return this.schema.contracts.find((c) => c.name === name);
247
271
  }
@@ -1 +1,2 @@
1
+ require("./client.cjs");
1
2
  require("./environment.cjs");
@@ -1,2 +1,3 @@
1
+ import { SELClient, validateClient } from "./client.mjs";
1
2
  import { MulticallOptions, SELLimits, SELRuntimeConfig } from "./types.mjs";
2
3
  import { SELRuntime } from "./environment.mjs";
@@ -1,2 +1,3 @@
1
+ import "./client.mjs";
1
2
  import "./environment.mjs";
2
3
  export {};
@@ -1,6 +1,6 @@
1
+ import { SELClient } from "./client.cjs";
1
2
  import { SELCheckerOptions } from "@seljs/checker";
2
3
  import { SELSchema } from "@seljs/schema";
3
- import { Address, PublicClient } from "viem";
4
4
 
5
5
  //#region src/environment/types.d.ts
6
6
  /**
@@ -13,7 +13,7 @@ interface MulticallOptions {
13
13
  /** Maximum number of calls per multicall3 batch. Unbounded if omitted. */
14
14
  batchSize?: number;
15
15
  /** Custom multicall3 contract address. Defaults to the canonical deployment. */
16
- address?: Address;
16
+ address?: `0x${string}`;
17
17
  }
18
18
  /**
19
19
  * Limits for contract call execution.
@@ -36,8 +36,8 @@ interface SELLimits {
36
36
  interface SELRuntimeConfig extends SELCheckerOptions {
37
37
  /** SEL schema describing contracts, variables, types, functions, and macros */
38
38
  schema: SELSchema;
39
- /** Viem public client for executing on-chain contract reads */
40
- client?: PublicClient;
39
+ /** Client for on-chain reads. Any viem PublicClient or SELClient-compatible object. */
40
+ client?: SELClient;
41
41
  /** Multicall3 batching options for contract call execution */
42
42
  multicall?: MulticallOptions;
43
43
  /** Execution limits for contract call rounds and total calls */
@@ -1,5 +1,5 @@
1
+ import { SELClient } from "./client.mjs";
1
2
  import { SELCheckerOptions } from "@seljs/checker";
2
- import { Address, PublicClient } from "viem";
3
3
  import { SELSchema } from "@seljs/schema";
4
4
 
5
5
  //#region src/environment/types.d.ts
@@ -13,7 +13,7 @@ interface MulticallOptions {
13
13
  /** Maximum number of calls per multicall3 batch. Unbounded if omitted. */
14
14
  batchSize?: number;
15
15
  /** Custom multicall3 contract address. Defaults to the canonical deployment. */
16
- address?: Address;
16
+ address?: `0x${string}`;
17
17
  }
18
18
  /**
19
19
  * Limits for contract call execution.
@@ -36,8 +36,8 @@ interface SELLimits {
36
36
  interface SELRuntimeConfig extends SELCheckerOptions {
37
37
  /** SEL schema describing contracts, variables, types, functions, and macros */
38
38
  schema: SELSchema;
39
- /** Viem public client for executing on-chain contract reads */
40
- client?: PublicClient;
39
+ /** Client for on-chain reads. Any viem PublicClient or SELClient-compatible object. */
40
+ client?: SELClient;
41
41
  /** Multicall3 batching options for contract call execution */
42
42
  multicall?: MulticallOptions;
43
43
  /** Execution limits for contract call rounds and total calls */
@@ -61,6 +61,12 @@ var MulticallBatchError = class extends _seljs_common.SELError {
61
61
  }
62
62
  };
63
63
  /**
64
+ * Thrown when the provided client fails validation or is misconfigured.
65
+ */
66
+ var SELClientError = class extends _seljs_common.SELError {
67
+ name = "SELClientError";
68
+ };
69
+ /**
64
70
  * Thrown when lint rules with error severity detect violations.
65
71
  * Contains the diagnostics that caused the failure.
66
72
  */
@@ -76,6 +82,7 @@ var SELLintError = class extends _seljs_common.SELError {
76
82
  exports.CircularDependencyError = CircularDependencyError;
77
83
  exports.ExecutionLimitError = ExecutionLimitError;
78
84
  exports.MulticallBatchError = MulticallBatchError;
85
+ exports.SELClientError = SELClientError;
79
86
  exports.SELContractError = SELContractError;
80
87
  exports.SELEvaluationError = SELEvaluationError;
81
88
  exports.SELLintError = SELLintError;
@@ -61,6 +61,12 @@ declare class MulticallBatchError extends SELError {
61
61
  methodName?: string;
62
62
  });
63
63
  }
64
+ /**
65
+ * Thrown when the provided client fails validation or is misconfigured.
66
+ */
67
+ declare class SELClientError extends SELError {
68
+ readonly name = "SELClientError";
69
+ }
64
70
  /**
65
71
  * Thrown when lint rules with error severity detect violations.
66
72
  * Contains the diagnostics that caused the failure.
@@ -72,4 +78,4 @@ declare class SELLintError extends SELError {
72
78
  });
73
79
  }
74
80
  //#endregion
75
- export { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELTypeError };
81
+ export { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELClientError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELTypeError };
@@ -61,6 +61,12 @@ declare class MulticallBatchError extends SELError {
61
61
  methodName?: string;
62
62
  });
63
63
  }
64
+ /**
65
+ * Thrown when the provided client fails validation or is misconfigured.
66
+ */
67
+ declare class SELClientError extends SELError {
68
+ readonly name = "SELClientError";
69
+ }
64
70
  /**
65
71
  * Thrown when lint rules with error severity detect violations.
66
72
  * Contains the diagnostics that caused the failure.
@@ -72,4 +78,4 @@ declare class SELLintError extends SELError {
72
78
  });
73
79
  }
74
80
  //#endregion
75
- export { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELTypeError };
81
+ export { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELClientError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELTypeError };
@@ -60,6 +60,12 @@ var MulticallBatchError = class extends SELError {
60
60
  }
61
61
  };
62
62
  /**
63
+ * Thrown when the provided client fails validation or is misconfigured.
64
+ */
65
+ var SELClientError = class extends SELError {
66
+ name = "SELClientError";
67
+ };
68
+ /**
63
69
  * Thrown when lint rules with error severity detect violations.
64
70
  * Contains the diagnostics that caused the failure.
65
71
  */
@@ -72,4 +78,4 @@ var SELLintError = class extends SELError {
72
78
  }
73
79
  };
74
80
  //#endregion
75
- export { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELTypeError };
81
+ export { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELClientError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELTypeError };
@@ -1 +1 @@
1
- import { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELTypeError } from "./errors.mjs";
1
+ import { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELClientError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELTypeError } from "./errors.mjs";
@@ -1,9 +1,7 @@
1
- require("../_virtual/_rolldown/runtime.cjs");
2
1
  const require_debug = require("../debug.cjs");
3
2
  const require_multicall_batcher = require("./multicall-batcher.cjs");
4
3
  const require_result_cache = require("./result-cache.cjs");
5
4
  const require_round_executor = require("./round-executor.cjs");
6
- let viem_actions = require("viem/actions");
7
5
  //#region src/execution/multi-round-executor.ts
8
6
  const debug = require_debug.createLogger("execute");
9
7
  var MultiRoundExecutor = class {
@@ -14,13 +12,12 @@ var MultiRoundExecutor = class {
14
12
  this.contracts = contracts;
15
13
  }
16
14
  async execute(plan, variables = {}, blockNumber) {
17
- const lockedBlockNumber = blockNumber ?? await (0, viem_actions.getBlockNumber)(this.client);
15
+ const lockedBlockNumber = blockNumber ?? await this.client.getBlockNumber();
18
16
  debug("start: %d rounds, %d calls, block=%s", plan.rounds.length, plan.totalCalls, String(lockedBlockNumber));
19
17
  const cache = new require_result_cache.ResultCache();
20
18
  const batcher = new require_multicall_batcher.MulticallBatcher(this.client, this.multicallOptions);
21
19
  const executor = new require_round_executor.RoundExecutor(this.contracts, cache, batcher);
22
20
  const context = {
23
- client: this.client,
24
21
  blockNumber: lockedBlockNumber,
25
22
  variables
26
23
  };
@@ -2,7 +2,6 @@ import { createLogger } from "../debug.mjs";
2
2
  import { MulticallBatcher } from "./multicall-batcher.mjs";
3
3
  import { ResultCache } from "./result-cache.mjs";
4
4
  import { RoundExecutor } from "./round-executor.mjs";
5
- import { getBlockNumber } from "viem/actions";
6
5
  //#region src/execution/multi-round-executor.ts
7
6
  const debug = createLogger("execute");
8
7
  var MultiRoundExecutor = class {
@@ -13,13 +12,12 @@ var MultiRoundExecutor = class {
13
12
  this.contracts = contracts;
14
13
  }
15
14
  async execute(plan, variables = {}, blockNumber) {
16
- const lockedBlockNumber = blockNumber ?? await getBlockNumber(this.client);
15
+ const lockedBlockNumber = blockNumber ?? await this.client.getBlockNumber();
17
16
  debug("start: %d rounds, %d calls, block=%s", plan.rounds.length, plan.totalCalls, String(lockedBlockNumber));
18
17
  const cache = new ResultCache();
19
18
  const batcher = new MulticallBatcher(this.client, this.multicallOptions);
20
19
  const executor = new RoundExecutor(this.contracts, cache, batcher);
21
20
  const context = {
22
- client: this.client,
23
21
  blockNumber: lockedBlockNumber,
24
22
  variables
25
23
  };
@@ -1,9 +1,9 @@
1
1
  require("../_virtual/_rolldown/runtime.cjs");
2
- const require_debug = require("../debug.cjs");
2
+ const require_multicall = require("./multicall.cjs");
3
3
  const require_errors = require("../errors/errors.cjs");
4
4
  require("../errors/index.cjs");
5
- const require_multicall = require("./multicall.cjs");
6
- let viem_actions = require("viem/actions");
5
+ const require_debug = require("../debug.cjs");
6
+ let ox = require("ox");
7
7
  //#region src/execution/multicall-batcher.ts
8
8
  const debug = require_debug.createLogger("execute:multicall");
9
9
  var MulticallBatcher = class {
@@ -32,17 +32,19 @@ var MulticallBatcher = class {
32
32
  }
33
33
  async executeChunk(calls, blockNumber) {
34
34
  try {
35
- return (await (0, viem_actions.readContract)(this.client, {
36
- address: this.address,
37
- abi: require_multicall.multicall3Abi,
38
- functionName: "aggregate3",
39
- args: [calls],
35
+ const data = ox.AbiFunction.encodeData(require_multicall.multicall3Function, [calls]);
36
+ const response = await this.client.call({
37
+ to: this.address,
38
+ data,
40
39
  blockNumber
41
- })).map((r) => ({
40
+ });
41
+ if (!response.data) throw new require_errors.MulticallBatchError("Multicall3 aggregate3 returned no data");
42
+ return ox.AbiFunction.decodeResult(require_multicall.multicall3Function, response.data).map((r) => ({
42
43
  success: r.success,
43
44
  returnData: r.returnData
44
45
  }));
45
46
  } catch (error) {
47
+ if (error instanceof require_errors.MulticallBatchError) throw error;
46
48
  throw new require_errors.MulticallBatchError("Multicall3 aggregate3 call failed", { cause: error });
47
49
  }
48
50
  }
@@ -1,8 +1,8 @@
1
- import { createLogger } from "../debug.mjs";
1
+ import { multicall3Function } from "./multicall.mjs";
2
2
  import { MulticallBatchError } from "../errors/errors.mjs";
3
3
  import "../errors/index.mjs";
4
- import { multicall3Abi } from "./multicall.mjs";
5
- import { readContract } from "viem/actions";
4
+ import { createLogger } from "../debug.mjs";
5
+ import { AbiFunction } from "ox";
6
6
  //#region src/execution/multicall-batcher.ts
7
7
  const debug = createLogger("execute:multicall");
8
8
  var MulticallBatcher = class {
@@ -31,17 +31,19 @@ var MulticallBatcher = class {
31
31
  }
32
32
  async executeChunk(calls, blockNumber) {
33
33
  try {
34
- return (await readContract(this.client, {
35
- address: this.address,
36
- abi: multicall3Abi,
37
- functionName: "aggregate3",
38
- args: [calls],
34
+ const data = AbiFunction.encodeData(multicall3Function, [calls]);
35
+ const response = await this.client.call({
36
+ to: this.address,
37
+ data,
39
38
  blockNumber
40
- })).map((r) => ({
39
+ });
40
+ if (!response.data) throw new MulticallBatchError("Multicall3 aggregate3 returned no data");
41
+ return AbiFunction.decodeResult(multicall3Function, response.data).map((r) => ({
41
42
  success: r.success,
42
43
  returnData: r.returnData
43
44
  }));
44
45
  } catch (error) {
46
+ if (error instanceof MulticallBatchError) throw error;
45
47
  throw new MulticallBatchError("Multicall3 aggregate3 call failed", { cause: error });
46
48
  }
47
49
  }
@@ -1,6 +1,7 @@
1
+ require("../_virtual/_rolldown/runtime.cjs");
2
+ let ox = require("ox");
1
3
  //#region src/execution/multicall.ts
2
- const MULTICALL3_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11";
3
- const multicall3Abi = [{
4
+ const aggregate3Abi = {
4
5
  name: "aggregate3",
5
6
  type: "function",
6
7
  stateMutability: "payable",
@@ -33,7 +34,30 @@ const multicall3Abi = [{
33
34
  type: "bytes"
34
35
  }]
35
36
  }]
36
- }];
37
+ };
38
+ const MULTICALL3_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11";
39
+ /**
40
+ * Pre-parsed Multicall3 aggregate3 ABI function for ox encoding/decoding.
41
+ */
42
+ const multicall3Function = ox.AbiFunction.from(aggregate3Abi);
43
+ /**
44
+ * Multicall3 getEthBalance ABI — returns native ETH balance for an address.
45
+ * Used by the sol_address.balance() accessor.
46
+ */
47
+ const getEthBalanceAbi = {
48
+ name: "getEthBalance",
49
+ type: "function",
50
+ stateMutability: "view",
51
+ inputs: [{
52
+ name: "addr",
53
+ type: "address"
54
+ }],
55
+ outputs: [{
56
+ name: "balance",
57
+ type: "uint256"
58
+ }]
59
+ };
37
60
  //#endregion
38
61
  exports.MULTICALL3_ADDRESS = MULTICALL3_ADDRESS;
39
- exports.multicall3Abi = multicall3Abi;
62
+ exports.getEthBalanceAbi = getEthBalanceAbi;
63
+ exports.multicall3Function = multicall3Function;
@@ -1,6 +1,6 @@
1
+ import { AbiFunction } from "ox";
1
2
  //#region src/execution/multicall.ts
2
- const MULTICALL3_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11";
3
- const multicall3Abi = [{
3
+ const aggregate3Abi = {
4
4
  name: "aggregate3",
5
5
  type: "function",
6
6
  stateMutability: "payable",
@@ -33,6 +33,28 @@ const multicall3Abi = [{
33
33
  type: "bytes"
34
34
  }]
35
35
  }]
36
- }];
36
+ };
37
+ const MULTICALL3_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11";
38
+ /**
39
+ * Pre-parsed Multicall3 aggregate3 ABI function for ox encoding/decoding.
40
+ */
41
+ const multicall3Function = AbiFunction.from(aggregate3Abi);
42
+ /**
43
+ * Multicall3 getEthBalance ABI — returns native ETH balance for an address.
44
+ * Used by the sol_address.balance() accessor.
45
+ */
46
+ const getEthBalanceAbi = {
47
+ name: "getEthBalance",
48
+ type: "function",
49
+ stateMutability: "view",
50
+ inputs: [{
51
+ name: "addr",
52
+ type: "address"
53
+ }],
54
+ outputs: [{
55
+ name: "balance",
56
+ type: "uint256"
57
+ }]
58
+ };
37
59
  //#endregion
38
- export { MULTICALL3_ADDRESS, multicall3Abi };
60
+ export { MULTICALL3_ADDRESS, getEthBalanceAbi, multicall3Function };
@@ -1,8 +1,8 @@
1
1
  require("../_virtual/_rolldown/runtime.cjs");
2
- const require_debug = require("../debug.cjs");
3
2
  const require_errors = require("../errors/errors.cjs");
4
3
  require("../errors/index.cjs");
5
- let viem = require("viem");
4
+ const require_debug = require("../debug.cjs");
5
+ let ox = require("ox");
6
6
  //#region src/execution/round-executor.ts
7
7
  const debug = require_debug.createLogger("execute:round");
8
8
  var RoundExecutor = class {
@@ -27,11 +27,7 @@ var RoundExecutor = class {
27
27
  encodedCalls.push({
28
28
  target: contract.address,
29
29
  allowFailure: false,
30
- callData: (0, viem.encodeFunctionData)({
31
- abi: contract.abi,
32
- functionName: call.method,
33
- args: resolvedArgs
34
- })
30
+ callData: ox.AbiFunction.encodeData(contract.abi, call.method, resolvedArgs)
35
31
  });
36
32
  }
37
33
  } catch (error) {
@@ -54,11 +50,7 @@ var RoundExecutor = class {
54
50
  contractName: call.contract,
55
51
  methodName: call.method
56
52
  });
57
- const decoded = (0, viem.decodeFunctionResult)({
58
- abi: contract.abi,
59
- functionName: call.method,
60
- data: result.returnData
61
- });
53
+ const decoded = ox.AbiFunction.decodeResult(contract.abi, call.method, result.returnData);
62
54
  debug("decoded %s.%s -> %o", call.contract, call.method, decoded);
63
55
  this.cache.set(call.id, decoded);
64
56
  }
@@ -1,7 +1,7 @@
1
- import { createLogger } from "../debug.mjs";
2
1
  import { MulticallBatchError } from "../errors/errors.mjs";
3
2
  import "../errors/index.mjs";
4
- import { decodeFunctionResult, encodeFunctionData } from "viem";
3
+ import { createLogger } from "../debug.mjs";
4
+ import { AbiFunction } from "ox";
5
5
  //#region src/execution/round-executor.ts
6
6
  const debug = createLogger("execute:round");
7
7
  var RoundExecutor = class {
@@ -26,11 +26,7 @@ var RoundExecutor = class {
26
26
  encodedCalls.push({
27
27
  target: contract.address,
28
28
  allowFailure: false,
29
- callData: encodeFunctionData({
30
- abi: contract.abi,
31
- functionName: call.method,
32
- args: resolvedArgs
33
- })
29
+ callData: AbiFunction.encodeData(contract.abi, call.method, resolvedArgs)
34
30
  });
35
31
  }
36
32
  } catch (error) {
@@ -53,11 +49,7 @@ var RoundExecutor = class {
53
49
  contractName: call.contract,
54
50
  methodName: call.method
55
51
  });
56
- const decoded = decodeFunctionResult({
57
- abi: contract.abi,
58
- functionName: call.method,
59
- data: result.returnData
60
- });
52
+ const decoded = AbiFunction.decodeResult(contract.abi, call.method, result.returnData);
61
53
  debug("decoded %s.%s -> %o", call.contract, call.method, decoded);
62
54
  this.cache.set(call.id, decoded);
63
55
  }
@@ -1,5 +1,5 @@
1
+ import { SELClient } from "../environment/client.cjs";
1
2
  import { SELDiagnostic } from "@seljs/checker";
2
- import { PublicClient } from "viem";
3
3
 
4
4
  //#region src/execution/types.d.ts
5
5
  /**
@@ -26,11 +26,9 @@ interface ExecutionResult {
26
26
  }
27
27
  /**
28
28
  * Context passed to the executor for running contract calls.
29
- * Contains the client, block number, and variable bindings.
29
+ * Contains the block number and variable bindings.
30
30
  */
31
31
  interface ExecutionContext {
32
- /** Viem public client for making contract calls */
33
- client: PublicClient;
34
32
  /** Block number for consistent reads across all calls */
35
33
  blockNumber: bigint;
36
34
  /** Variable name to value mapping from evaluate() context */
@@ -40,8 +38,8 @@ interface ExecutionContext {
40
38
  * Options for the evaluate() call.
41
39
  */
42
40
  interface EvaluateOptions {
43
- /** Override viem client for this evaluation */
44
- client?: PublicClient;
41
+ /** Override client for this evaluation */
42
+ client?: SELClient;
45
43
  }
46
44
  /**
47
45
  * Result of evaluating a SEL expression.
@@ -1,5 +1,5 @@
1
+ import { SELClient } from "../environment/client.mjs";
1
2
  import { SELDiagnostic } from "@seljs/checker";
2
- import { PublicClient } from "viem";
3
3
 
4
4
  //#region src/execution/types.d.ts
5
5
  /**
@@ -26,11 +26,9 @@ interface ExecutionResult {
26
26
  }
27
27
  /**
28
28
  * Context passed to the executor for running contract calls.
29
- * Contains the client, block number, and variable bindings.
29
+ * Contains the block number and variable bindings.
30
30
  */
31
31
  interface ExecutionContext {
32
- /** Viem public client for making contract calls */
33
- client: PublicClient;
34
32
  /** Block number for consistent reads across all calls */
35
33
  blockNumber: bigint;
36
34
  /** Variable name to value mapping from evaluate() context */
@@ -40,8 +38,8 @@ interface ExecutionContext {
40
38
  * Options for the evaluate() call.
41
39
  */
42
40
  interface EvaluateOptions {
43
- /** Override viem client for this evaluation */
44
- client?: PublicClient;
41
+ /** Override client for this evaluation */
42
+ client?: SELClient;
45
43
  }
46
44
  /**
47
45
  * Result of evaluating a SEL expression.
package/dist/index.cjs CHANGED
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./_virtual/_rolldown/runtime.cjs");
3
3
  const require_errors = require("./errors/errors.cjs");
4
4
  require("./errors/index.cjs");
5
+ const require_client = require("./environment/client.cjs");
5
6
  const require_environment = require("./environment/environment.cjs");
6
7
  require("./environment/index.cjs");
7
8
  const require_factory = require("./factory.cjs");
@@ -9,6 +10,7 @@ let _seljs_common = require("@seljs/common");
9
10
  exports.CircularDependencyError = require_errors.CircularDependencyError;
10
11
  exports.ExecutionLimitError = require_errors.ExecutionLimitError;
11
12
  exports.MulticallBatchError = require_errors.MulticallBatchError;
13
+ exports.SELClientError = require_errors.SELClientError;
12
14
  exports.SELContractError = require_errors.SELContractError;
13
15
  exports.SELError = _seljs_common.SELError;
14
16
  exports.SELEvaluationError = require_errors.SELEvaluationError;
@@ -17,3 +19,4 @@ exports.SELParseError = _seljs_common.SELParseError;
17
19
  exports.SELRuntime = require_environment.SELRuntime;
18
20
  exports.SELTypeError = _seljs_common.SELTypeError;
19
21
  exports.createSEL = require_factory.createSEL;
22
+ exports.validateClient = require_client.validateClient;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,8 @@
1
+ import { SELClient, validateClient } from "./environment/client.cjs";
1
2
  import { MulticallOptions, SELLimits, SELRuntimeConfig } from "./environment/types.cjs";
2
3
  import { EvaluateOptions, EvaluateResult, ExecutionContext, ExecutionMeta, ExecutionResult } from "./execution/types.cjs";
3
4
  import { SELRuntime } from "./environment/environment.cjs";
4
- import { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELTypeError } from "./errors/errors.cjs";
5
+ import { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELClientError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELTypeError } from "./errors/errors.cjs";
5
6
  import { createSEL } from "./factory.cjs";
6
7
  import { CallArgument, CollectedCall, DependencyGraph, ExecutionPlan, ExecutionRound, GraphNode } from "./analysis/types.cjs";
7
- export { CallArgument, CircularDependencyError, CollectedCall, DependencyGraph, EvaluateOptions, EvaluateResult, ExecutionContext, ExecutionLimitError, ExecutionMeta, ExecutionPlan, ExecutionResult, ExecutionRound, GraphNode, MulticallBatchError, MulticallOptions, SELContractError, SELError, SELEvaluationError, SELLimits, SELLintError, SELParseError, SELRuntime, SELRuntimeConfig, SELTypeError, createSEL };
8
+ export { CallArgument, CircularDependencyError, CollectedCall, DependencyGraph, EvaluateOptions, EvaluateResult, ExecutionContext, ExecutionLimitError, ExecutionMeta, ExecutionPlan, ExecutionResult, ExecutionRound, GraphNode, MulticallBatchError, MulticallOptions, SELClient, SELClientError, SELContractError, SELError, SELEvaluationError, SELLimits, SELLintError, SELParseError, SELRuntime, SELRuntimeConfig, SELTypeError, createSEL, validateClient };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,8 @@
1
+ import { SELClient, validateClient } from "./environment/client.mjs";
1
2
  import { MulticallOptions, SELLimits, SELRuntimeConfig } from "./environment/types.mjs";
2
3
  import { EvaluateOptions, EvaluateResult, ExecutionContext, ExecutionMeta, ExecutionResult } from "./execution/types.mjs";
3
4
  import { SELRuntime } from "./environment/environment.mjs";
4
- import { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELTypeError } from "./errors/errors.mjs";
5
+ import { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELClientError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELTypeError } from "./errors/errors.mjs";
5
6
  import { createSEL } from "./factory.mjs";
6
7
  import { CallArgument, CollectedCall, DependencyGraph, ExecutionPlan, ExecutionRound, GraphNode } from "./analysis/types.mjs";
7
- export { CallArgument, CircularDependencyError, CollectedCall, DependencyGraph, EvaluateOptions, EvaluateResult, ExecutionContext, ExecutionLimitError, ExecutionMeta, ExecutionPlan, ExecutionResult, ExecutionRound, GraphNode, MulticallBatchError, MulticallOptions, SELContractError, SELError, SELEvaluationError, SELLimits, SELLintError, SELParseError, SELRuntime, SELRuntimeConfig, SELTypeError, createSEL };
8
+ export { CallArgument, CircularDependencyError, CollectedCall, DependencyGraph, EvaluateOptions, EvaluateResult, ExecutionContext, ExecutionLimitError, ExecutionMeta, ExecutionPlan, ExecutionResult, ExecutionRound, GraphNode, MulticallBatchError, MulticallOptions, SELClient, SELClientError, SELContractError, SELError, SELEvaluationError, SELLimits, SELLintError, SELParseError, SELRuntime, SELRuntimeConfig, SELTypeError, createSEL, validateClient };
package/dist/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
- import { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELTypeError } from "./errors/errors.mjs";
1
+ import { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELClientError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELTypeError } from "./errors/errors.mjs";
2
2
  import "./errors/index.mjs";
3
+ import { validateClient } from "./environment/client.mjs";
3
4
  import { SELRuntime } from "./environment/environment.mjs";
4
5
  import "./environment/index.mjs";
5
6
  import { createSEL } from "./factory.mjs";
6
- export { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELRuntime, SELTypeError, createSEL };
7
+ export { CircularDependencyError, ExecutionLimitError, MulticallBatchError, SELClientError, SELContractError, SELError, SELEvaluationError, SELLintError, SELParseError, SELRuntime, SELTypeError, createSEL, validateClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seljs/runtime",
3
- "version": "1.3.0-beta.1",
3
+ "version": "1.3.0-beta.3",
4
4
  "repository": {
5
5
  "url": "https://github.com/abinnovision/seljs"
6
6
  },
@@ -50,13 +50,13 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@marcbachmann/cel-js": "^7.5.3",
53
- "@seljs/checker": "1.3.0-beta.1",
54
- "@seljs/common": "1.3.0-beta.1",
55
- "@seljs/env": "1.3.0-beta.1",
53
+ "@seljs/checker": "1.3.0-beta.3",
54
+ "@seljs/common": "1.3.0-beta.3",
55
+ "@seljs/env": "1.3.0-beta.3",
56
56
  "@seljs/schema": "1.2.0",
57
- "@seljs/types": "1.3.0-beta.1",
57
+ "@seljs/types": "1.3.0-beta.3",
58
58
  "debug": "^4.4.3",
59
- "viem": "^2.47.2"
59
+ "ox": "^0.14.7"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@abinnovision/eslint-config-base": "^3.2.0",