@proto-kit/protocol 0.1.1-develop.162 → 0.1.1-develop.164

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 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAW,KAAK,EAAmB,MAAM,UAAU,CAAC;AAE3D,MAAM,MAAM,UAAU,CAAC,YAAY,SAAS,QAAQ,IAAI,YAAY,SAAS,CAC3E,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,MAAM,MAAM,GACb,MAAM,GACN,GAAG,CAAC;AAER,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAEvD,MAAM,MAAM,UAAU,CAAC,KAAK,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,KAAK,CAAC;AAE9D,MAAM,MAAM,QAAQ,CAAC,KAAK,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,KAC/D,GAAG,IAAI,EAAE,GAAG,KACT,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG;KACzB,GAAG,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC;CACjC,GAAG;IAAE,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;CAAE,CAAC;AAEvC,wBAAgB,YAAY,IAAI,eAAe,CAoB9C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,UAAQ,gDAgCnE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAkB3D;AAED,wBAAgB,IAAI,IAAI,IAAI,CAAG"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,EAAmB,MAAM,UAAU,CAAC;AAE3D,MAAM,MAAM,UAAU,CAAC,YAAY,SAAS,QAAQ,IAAI,YAAY,SAAS,CAC3E,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,MAAM,MAAM,GACb,MAAM,GACN,GAAG,CAAC;AAER,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAEvD,MAAM,MAAM,UAAU,CAAC,KAAK,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,KAAK,CAAC;AAE9D,MAAM,MAAM,QAAQ,CAAC,KAAK,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,KAC/D,GAAG,IAAI,EAAE,GAAG,KACT,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG;KACzB,GAAG,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC;CACjC,GAAG;IAAE,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;CAAE,CAAC;AAEvC,wBAAgB,YAAY,IAAI,eAAe,CAoB9C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,UAAQ,gDAiCnE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAmB3D;AAED,wBAAgB,IAAI,IAAI,IAAI,CAAG"}
@@ -1,6 +1,5 @@
1
1
  // eslint-disable-next-line max-len
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/ban-types, @typescript-eslint/no-unsafe-return,@typescript-eslint/no-empty-function */
3
- import { TextEncoder, TextDecoder } from "node:util";
4
3
  import { Circuit, Field, Poseidon } from "snarkyjs";
5
4
  export function notInCircuit() {
6
5
  return function ReplacedFunction(target, propertyKey, descriptor) {
@@ -19,6 +18,7 @@ export function notInCircuit() {
19
18
  }
20
19
  export function stringToField(value, throwOnOverflow = false) {
21
20
  const fieldSize = Field.sizeInBytes();
21
+ // eslint-disable-next-line putout/putout
22
22
  const encoder = new TextEncoder();
23
23
  const stringBytes = Array.from(encoder.encode(value));
24
24
  const padding = Array.from({
@@ -57,6 +57,7 @@ export function fieldToString(value) {
57
57
  .reverse()
58
58
  .findIndex((element) => element !== 0);
59
59
  bytes = bytes.slice(0, zeroesStart);
60
+ // eslint-disable-next-line putout/putout
60
61
  const decoder = new TextDecoder();
61
62
  return decoder.decode(new Uint8Array(bytes));
62
63
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "license": "MIT",
4
4
  "private": false,
5
5
  "type": "module",
6
- "version": "0.1.1-develop.162+1fd6645",
6
+ "version": "0.1.1-develop.164+e15c6a2",
7
7
  "scripts": {
8
8
  "build": "tsc -p tsconfig.json",
9
9
  "dev": "tsc -p tsconfig.json --watch",
@@ -17,7 +17,7 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@proto-kit/common": "0.1.1-develop.162+1fd6645",
20
+ "@proto-kit/common": "0.1.1-develop.164+e15c6a2",
21
21
  "lodash": "^4.17.21",
22
22
  "loglevel": "^1.8.1",
23
23
  "reflect-metadata": "^0.1.13",
@@ -31,5 +31,5 @@
31
31
  "@jest/globals": "^29.5.0",
32
32
  "@types/lodash": "^4.14.194"
33
33
  },
34
- "gitHead": "1fd6645b60e2b4c2db2ac35b53c1c5d0b66c5b91"
34
+ "gitHead": "e15c6a27643d4edf44d69915fec222938737991f"
35
35
  }
@@ -1,8 +1,6 @@
1
1
  // eslint-disable-next-line max-len
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/ban-types, @typescript-eslint/no-unsafe-return,@typescript-eslint/no-empty-function */
3
3
 
4
- import { TextEncoder, TextDecoder } from "node:util";
5
-
6
4
  import { Circuit, Field, Poseidon, Proof } from "snarkyjs";
7
5
 
8
6
  export type ReturnType<FunctionType extends Function> = FunctionType extends (
@@ -46,6 +44,7 @@ export function notInCircuit(): MethodDecorator {
46
44
  export function stringToField(value: string, throwOnOverflow = false) {
47
45
  const fieldSize = Field.sizeInBytes();
48
46
 
47
+ // eslint-disable-next-line putout/putout
49
48
  const encoder = new TextEncoder();
50
49
 
51
50
  const stringBytes = Array.from(encoder.encode(value));
@@ -95,6 +94,7 @@ export function fieldToString(value: Field | bigint): string {
95
94
 
96
95
  bytes = bytes.slice(0, zeroesStart);
97
96
 
97
+ // eslint-disable-next-line putout/putout
98
98
  const decoder = new TextDecoder();
99
99
 
100
100
  return decoder.decode(new Uint8Array(bytes));