@acala-network/chopsticks-core 0.9.3 → 0.9.4-2

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.
@@ -61,11 +61,15 @@ const createProof = async (nodes, entries)=>{
61
61
  const runTask = async (task, callback)=>{
62
62
  return _chopsticksexecutor.run_task(task, callback, 'info');
63
63
  };
64
+ const testing = async (callback, key)=>{
65
+ return _chopsticksexecutor.testing(callback, key);
66
+ };
64
67
  const wasmExecutor = {
65
68
  runTask,
66
69
  getRuntimeVersion,
67
70
  calculateStateRoot,
68
71
  createProof,
69
- decodeProof
72
+ decodeProof,
73
+ testing
70
74
  };
71
75
  _comlink.expose(wasmExecutor);
@@ -30,6 +30,9 @@ _export(exports, {
30
30
  getRuntimeVersion: function() {
31
31
  return getRuntimeVersion;
32
32
  },
33
+ getWorker: function() {
34
+ return getWorker;
35
+ },
33
36
  runTask: function() {
34
37
  return runTask;
35
38
  },
@@ -68,11 +68,15 @@ const createProof = async (nodes, entries)=>{
68
68
  const runTask = async (task, callback)=>{
69
69
  return _chopsticksexecutor.run_task(task, callback, process.env.RUST_LOG);
70
70
  };
71
+ const testing = async (callback, key)=>{
72
+ return _chopsticksexecutor.testing(callback, key);
73
+ };
71
74
  const wasmExecutor = {
72
75
  runTask,
73
76
  getRuntimeVersion,
74
77
  calculateStateRoot,
75
78
  createProof,
76
- decodeProof
79
+ decodeProof,
80
+ testing
77
81
  };
78
82
  _comlink.expose(wasmExecutor, (0, _nodeadapter.default)(_nodeworker_threads.parentPort));
@@ -16,11 +16,15 @@ const createProof = async (nodes, entries)=>{
16
16
  const runTask = async (task, callback)=>{
17
17
  return pkg.run_task(task, callback, 'info');
18
18
  };
19
+ const testing = async (callback, key)=>{
20
+ return pkg.testing(callback, key);
21
+ };
19
22
  const wasmExecutor = {
20
23
  runTask,
21
24
  getRuntimeVersion,
22
25
  calculateStateRoot,
23
26
  createProof,
24
- decodeProof
27
+ decodeProof,
28
+ testing
25
29
  };
26
30
  Comlink.expose(wasmExecutor);
@@ -9,7 +9,7 @@ const logger = defaultLogger.child({
9
9
  name: 'executor'
10
10
  });
11
11
  let __executor_worker;
12
- const getWorker = async ()=>{
12
+ export const getWorker = async ()=>{
13
13
  if (__executor_worker) return __executor_worker;
14
14
  const isNode = typeof process !== 'undefined' && process?.versions?.node // true for node or bun
15
15
  ;
@@ -18,11 +18,15 @@ const createProof = async (nodes, entries)=>{
18
18
  const runTask = async (task, callback)=>{
19
19
  return pkg.run_task(task, callback, process.env.RUST_LOG);
20
20
  };
21
+ const testing = async (callback, key)=>{
22
+ return pkg.testing(callback, key);
23
+ };
21
24
  const wasmExecutor = {
22
25
  runTask,
23
26
  getRuntimeVersion,
24
27
  calculateStateRoot,
25
28
  createProof,
26
- decodeProof
29
+ decodeProof,
30
+ testing
27
31
  };
28
32
  Comlink.expose(wasmExecutor, nodeEndpoint(parentPort));
@@ -1,3 +1,4 @@
1
+ import * as Comlink from 'comlink';
1
2
  import { HexString } from '@polkadot/util/types';
2
3
  import _ from 'lodash';
3
4
  import { Block } from '../blockchain/block.js';
@@ -41,7 +42,12 @@ export interface WasmExecutor {
41
42
  allowUnresolvedImports: boolean;
42
43
  runtimeLogLevel: number;
43
44
  }, callback?: JsCallback) => Promise<TaskResponse>;
45
+ testing: (callback: JsCallback, key: any) => Promise<any>;
44
46
  }
47
+ export declare const getWorker: () => Promise<{
48
+ remote: Comlink.Remote<WasmExecutor>;
49
+ terminate: () => Promise<void>;
50
+ }>;
45
51
  export declare const getRuntimeVersion: ((code: HexString) => Promise<RuntimeVersion>) & _.MemoizedFunction;
46
52
  export declare const calculateStateRoot: (entries: [HexString, HexString][], trie_version: number) => Promise<HexString>;
47
53
  export declare const decodeProof: (trieRootHash: HexString, keys: HexString[], nodes: HexString[]) => Promise<{}>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acala-network/chopsticks-core",
3
- "version": "0.9.3",
3
+ "version": "0.9.4-2",
4
4
  "author": "Acala Developers <hello@acala.network>",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -13,7 +13,7 @@
13
13
  "docs:prep": "typedoc"
14
14
  },
15
15
  "dependencies": {
16
- "@acala-network/chopsticks-executor": "0.9.3",
16
+ "@acala-network/chopsticks-executor": "0.9.4-2",
17
17
  "@polkadot/rpc-provider": "^10.10.1",
18
18
  "@polkadot/types": "^10.10.1",
19
19
  "@polkadot/types-codec": "^10.10.1",