@noir-lang/noirc_abi 0.26.0 → 0.27.0-0adeb08.nightly

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.
package/README.md CHANGED
@@ -1,17 +1,3 @@
1
1
  # Noir Lang ABI JavaScript Package
2
2
 
3
3
  This JavaScript package enables users to ABI encode inputs to a Noir program, i.e. generating an initial witness.
4
-
5
- ## Building from source
6
-
7
- Outside of the [noir repo](https://github.com/noir-lang/noir), this package can be built using the command below:
8
-
9
- ```bash
10
- nix build -L github:noir-lang/noir/master#abi_wasm
11
- ```
12
-
13
- If you are within the noir repo and would like to build local changes, you can use:
14
-
15
- ```bash
16
- nix build -L #abi_wasm
17
- ```
@@ -13,12 +13,17 @@ export function abiEncode(abi: Abi, inputs: InputMap, return_value?: InputValue)
13
13
  * @returns {any}
14
14
  */
15
15
  export function abiDecode(abi: Abi, witness_map: WitnessMap): any;
16
+ /**
17
+ * @param {WitnessMap} witness_map
18
+ * @returns {Uint8Array}
19
+ */
20
+ export function serializeWitness(witness_map: WitnessMap): Uint8Array;
16
21
 
17
- import { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, Abi, WitnessMap } from "@noir-lang/types";
18
- export { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, Abi, WitnessMap } from "@noir-lang/types";
22
+ export type ABIError = Error;
19
23
 
20
24
 
21
25
 
22
- export type ABIError = Error;
26
+ import { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, Abi, WitnessMap } from "@noir-lang/types";
27
+ export { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, Abi, WitnessMap } from "@noir-lang/types";
23
28
 
24
29
 
@@ -169,7 +169,34 @@ module.exports.abiDecode = function(abi, witness_map) {
169
169
  }
170
170
  };
171
171
 
172
- function __wbg_adapter_26(arg0, arg1, arg2, arg3) {
172
+ function getArrayU8FromWasm0(ptr, len) {
173
+ ptr = ptr >>> 0;
174
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
175
+ }
176
+ /**
177
+ * @param {WitnessMap} witness_map
178
+ * @returns {Uint8Array}
179
+ */
180
+ module.exports.serializeWitness = function(witness_map) {
181
+ try {
182
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
183
+ wasm.serializeWitness(retptr, addHeapObject(witness_map));
184
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
185
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
186
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
187
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
188
+ if (r3) {
189
+ throw takeObject(r2);
190
+ }
191
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
192
+ wasm.__wbindgen_free(r0, r1 * 1);
193
+ return v1;
194
+ } finally {
195
+ wasm.__wbindgen_add_to_stack_pointer(16);
196
+ }
197
+ };
198
+
199
+ function __wbg_adapter_27(arg0, arg1, arg2, arg3) {
173
200
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h6cdb28bf0237c46b(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
174
201
  }
175
202
 
@@ -181,21 +208,21 @@ function handleError(f, args) {
181
208
  }
182
209
  }
183
210
 
184
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
185
- takeObject(arg0);
211
+ module.exports.__wbindgen_is_undefined = function(arg0) {
212
+ const ret = getObject(arg0) === undefined;
213
+ return ret;
186
214
  };
187
215
 
188
- module.exports.__wbg_constructor_869f10b3cfa30892 = function(arg0) {
216
+ module.exports.__wbg_constructor_311fc8beeab98bd6 = function(arg0) {
189
217
  const ret = new Error(takeObject(arg0));
190
218
  return addHeapObject(ret);
191
219
  };
192
220
 
193
- module.exports.__wbindgen_is_undefined = function(arg0) {
194
- const ret = getObject(arg0) === undefined;
195
- return ret;
221
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
222
+ takeObject(arg0);
196
223
  };
197
224
 
198
- module.exports.__wbg_new_eef865990b0d3287 = function() {
225
+ module.exports.__wbg_new_6699176386b67a04 = function() {
199
226
  const ret = new Map();
200
227
  return addHeapObject(ret);
201
228
  };
@@ -258,7 +285,7 @@ module.exports.__wbg_forEach_942772130a8d06a6 = function(arg0, arg1, arg2) {
258
285
  const a = state0.a;
259
286
  state0.a = 0;
260
287
  try {
261
- return __wbg_adapter_26(a, state0.b, arg0, arg1);
288
+ return __wbg_adapter_27(a, state0.b, arg0, arg1);
262
289
  } finally {
263
290
  state0.a = a;
264
291
  }
Binary file
@@ -3,6 +3,7 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export function abiEncode(a: number, b: number, c: number, d: number): void;
5
5
  export function abiDecode(a: number, b: number, c: number): void;
6
+ export function serializeWitness(a: number, b: number): void;
6
7
  export function __wbindgen_malloc(a: number): number;
7
8
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
8
9
  export function __wbindgen_add_to_stack_pointer(a: number): number;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "contributors": [
4
4
  "The Noir Team <team@noir-lang.org>"
5
5
  ],
6
- "version": "0.26.0",
6
+ "version": "0.27.0-0adeb08.nightly",
7
7
  "license": "(MIT OR Apache-2.0)",
8
8
  "homepage": "https://noir-lang.org/",
9
9
  "repository": {
@@ -33,12 +33,10 @@
33
33
  "clean": "chmod u+w web nodejs || true && rm -rf ./nodejs ./web ./target ./result",
34
34
  "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json",
35
35
  "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
36
- "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0",
37
- "build:nix": "nix build -L .#noirc_abi_wasm",
38
- "install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/noirc_abi_wasm/nodejs ./ && cp -rL ./result/noirc_abi_wasm/web ./"
36
+ "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0"
39
37
  },
40
38
  "dependencies": {
41
- "@noir-lang/types": "0.26.0"
39
+ "@noir-lang/types": "0.27.0-0adeb08.nightly"
42
40
  },
43
41
  "devDependencies": {
44
42
  "@esm-bundle/chai": "^4.3.4-fix.0",
@@ -13,13 +13,18 @@ export function abiEncode(abi: Abi, inputs: InputMap, return_value?: InputValue)
13
13
  * @returns {any}
14
14
  */
15
15
  export function abiDecode(abi: Abi, witness_map: WitnessMap): any;
16
+ /**
17
+ * @param {WitnessMap} witness_map
18
+ * @returns {Uint8Array}
19
+ */
20
+ export function serializeWitness(witness_map: WitnessMap): Uint8Array;
16
21
 
17
- import { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, Abi, WitnessMap } from "@noir-lang/types";
18
- export { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, Abi, WitnessMap } from "@noir-lang/types";
22
+ export type ABIError = Error;
19
23
 
20
24
 
21
25
 
22
- export type ABIError = Error;
26
+ import { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, Abi, WitnessMap } from "@noir-lang/types";
27
+ export { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, Abi, WitnessMap } from "@noir-lang/types";
23
28
 
24
29
 
25
30
 
@@ -29,6 +34,7 @@ export interface InitOutput {
29
34
  readonly memory: WebAssembly.Memory;
30
35
  readonly abiEncode: (a: number, b: number, c: number, d: number) => void;
31
36
  readonly abiDecode: (a: number, b: number, c: number) => void;
37
+ readonly serializeWitness: (a: number, b: number) => void;
32
38
  readonly __wbindgen_malloc: (a: number) => number;
33
39
  readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
34
40
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
@@ -166,7 +166,34 @@ export function abiDecode(abi, witness_map) {
166
166
  }
167
167
  }
168
168
 
169
- function __wbg_adapter_26(arg0, arg1, arg2, arg3) {
169
+ function getArrayU8FromWasm0(ptr, len) {
170
+ ptr = ptr >>> 0;
171
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
172
+ }
173
+ /**
174
+ * @param {WitnessMap} witness_map
175
+ * @returns {Uint8Array}
176
+ */
177
+ export function serializeWitness(witness_map) {
178
+ try {
179
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
180
+ wasm.serializeWitness(retptr, addHeapObject(witness_map));
181
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
182
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
183
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
184
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
185
+ if (r3) {
186
+ throw takeObject(r2);
187
+ }
188
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
189
+ wasm.__wbindgen_free(r0, r1 * 1);
190
+ return v1;
191
+ } finally {
192
+ wasm.__wbindgen_add_to_stack_pointer(16);
193
+ }
194
+ }
195
+
196
+ function __wbg_adapter_27(arg0, arg1, arg2, arg3) {
170
197
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h6cdb28bf0237c46b(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
171
198
  }
172
199
 
@@ -212,18 +239,18 @@ async function __wbg_load(module, imports) {
212
239
  function __wbg_get_imports() {
213
240
  const imports = {};
214
241
  imports.wbg = {};
215
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
216
- takeObject(arg0);
242
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
243
+ const ret = getObject(arg0) === undefined;
244
+ return ret;
217
245
  };
218
- imports.wbg.__wbg_constructor_869f10b3cfa30892 = function(arg0) {
246
+ imports.wbg.__wbg_constructor_311fc8beeab98bd6 = function(arg0) {
219
247
  const ret = new Error(takeObject(arg0));
220
248
  return addHeapObject(ret);
221
249
  };
222
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
223
- const ret = getObject(arg0) === undefined;
224
- return ret;
250
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
251
+ takeObject(arg0);
225
252
  };
226
- imports.wbg.__wbg_new_eef865990b0d3287 = function() {
253
+ imports.wbg.__wbg_new_6699176386b67a04 = function() {
227
254
  const ret = new Map();
228
255
  return addHeapObject(ret);
229
256
  };
@@ -278,7 +305,7 @@ function __wbg_get_imports() {
278
305
  const a = state0.a;
279
306
  state0.a = 0;
280
307
  try {
281
- return __wbg_adapter_26(a, state0.b, arg0, arg1);
308
+ return __wbg_adapter_27(a, state0.b, arg0, arg1);
282
309
  } finally {
283
310
  state0.a = a;
284
311
  }
Binary file
@@ -3,6 +3,7 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export function abiEncode(a: number, b: number, c: number, d: number): void;
5
5
  export function abiDecode(a: number, b: number, c: number): void;
6
+ export function serializeWitness(a: number, b: number): void;
6
7
  export function __wbindgen_malloc(a: number): number;
7
8
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
8
9
  export function __wbindgen_add_to_stack_pointer(a: number): number;