@proto-kit/module 0.1.1-develop.261 → 0.1.1-develop.267
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.
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { Runtime, RuntimeModulesRecord } from "./Runtime";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* [0
|
|
6
|
-
* ...hash(stringToField(moduleName))[0..128],
|
|
7
|
-
* ...hash(stringToField(methodName))[0..128]
|
|
8
|
-
* ]
|
|
3
|
+
* Please see `getMethodId` to learn more about
|
|
4
|
+
* methodId encoding
|
|
9
5
|
*/
|
|
10
6
|
export declare class MethodIdResolver {
|
|
11
7
|
private readonly runtime;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MethodIdResolver.d.ts","sourceRoot":"","sources":["../../src/runtime/MethodIdResolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MethodIdResolver.d.ts","sourceRoot":"","sources":["../../src/runtime/MethodIdResolver.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAE/D;;;GAGG;AACH,qBAAa,gBAAgB;IAMzB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAN1B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAEpB;gBAGY,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,EACtC,OAAO,EAAE,oBAAoB;IAkBzC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS;IAcnE,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;CAQnE"}
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { stringToField } from "@proto-kit/protocol";
|
|
2
2
|
import { Poseidon } from "snarkyjs";
|
|
3
|
-
const offset = 128n;
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
5
|
-
const modulus = 2n ** (offset - 1n);
|
|
6
3
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* [0
|
|
10
|
-
* ...hash(stringToField(moduleName))[0..128],
|
|
11
|
-
* ...hash(stringToField(methodName))[0..128]
|
|
12
|
-
* ]
|
|
4
|
+
* Please see `getMethodId` to learn more about
|
|
5
|
+
* methodId encoding
|
|
13
6
|
*/
|
|
14
7
|
export class MethodIdResolver {
|
|
15
8
|
constructor(runtime, modules) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@proto-kit/module",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.1.1-develop.
|
|
5
|
+
"version": "0.1.1-develop.267+b252853",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc -p tsconfig.json",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"snarkyjs": "0.12.0",
|
|
32
32
|
"tsyringe": "^4.7.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "b2528538c73747d000cc3ea99ee26ee415d8248d"
|
|
35
35
|
}
|
|
@@ -4,12 +4,8 @@ import { Poseidon } from "snarkyjs";
|
|
|
4
4
|
import type { Runtime, RuntimeModulesRecord } from "./Runtime";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* [0
|
|
10
|
-
* ...hash(stringToField(moduleName))[0..128],
|
|
11
|
-
* ...hash(stringToField(methodName))[0..128]
|
|
12
|
-
* ]
|
|
7
|
+
* Please see `getMethodId` to learn more about
|
|
8
|
+
* methodId encoding
|
|
13
9
|
*/
|
|
14
10
|
export class MethodIdResolver {
|
|
15
11
|
private readonly dictionary: {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
AsyncMerkleTreeStore,
|
|
3
|
+
InMemoryMerkleTreeStorage,
|
|
4
|
+
noop,
|
|
5
|
+
} from "@proto-kit/protocol";
|
|
2
6
|
|
|
3
7
|
export class MockAsyncMerkleTreeStore implements AsyncMerkleTreeStore {
|
|
4
8
|
public readonly store = new InMemoryMerkleTreeStorage();
|
|
@@ -11,18 +15,18 @@ export class MockAsyncMerkleTreeStore implements AsyncMerkleTreeStore {
|
|
|
11
15
|
noop();
|
|
12
16
|
}
|
|
13
17
|
|
|
14
|
-
public async
|
|
18
|
+
public async getNodeAsync(
|
|
15
19
|
key: bigint,
|
|
16
20
|
level: number
|
|
17
21
|
): Promise<bigint | undefined> {
|
|
18
22
|
return this.store.getNode(key, level);
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
public async
|
|
25
|
+
public async setNodeAsync(
|
|
22
26
|
key: bigint,
|
|
23
27
|
level: number,
|
|
24
28
|
value: bigint
|
|
25
29
|
): Promise<void> {
|
|
26
30
|
this.store.setNode(key, level, value);
|
|
27
31
|
}
|
|
28
|
-
}
|
|
32
|
+
}
|