@noir-lang/noir_wasm 0.18.0-2c9fe26.nightly → 0.18.0-3d5e43a.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.
@@ -1,22 +1,12 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * @param {Uint8Array} bytes
5
- * @returns {any}
6
- */
7
- export function acir_read_bytes(bytes: Uint8Array): any;
8
- /**
9
- * @param {any} acir
10
- * @returns {Uint8Array}
11
- */
12
- export function acir_write_bytes(acir: any): Uint8Array;
13
- /**
14
4
  * @param {string} entry_point
15
5
  * @param {boolean | undefined} contracts
16
6
  * @param {DependencyGraph | undefined} dependency_graph
17
- * @returns {any}
7
+ * @returns {CompileResult}
18
8
  */
19
- export function compile(entry_point: string, contracts?: boolean, dependency_graph?: DependencyGraph): any;
9
+ export function compile(entry_point: string, contracts?: boolean, dependency_graph?: DependencyGraph): CompileResult;
20
10
  /**
21
11
  * @param {string} level
22
12
  */
@@ -25,6 +15,16 @@ export function init_log_level(level: string): void;
25
15
  * @returns {any}
26
16
  */
27
17
  export function build_info(): any;
18
+ /**
19
+ * @param {Uint8Array} bytes
20
+ * @returns {any}
21
+ */
22
+ export function acir_read_bytes(bytes: Uint8Array): any;
23
+ /**
24
+ * @param {any} acir
25
+ * @returns {Uint8Array}
26
+ */
27
+ export function acir_write_bytes(acir: any): Uint8Array;
28
28
 
29
29
  export type Diagnostic = {
30
30
  message: string;
@@ -48,4 +48,36 @@ export type DependencyGraph = {
48
48
  library_dependencies: Readonly<Record<string, readonly string[]>>;
49
49
  }
50
50
 
51
+ export type CompiledContract = {
52
+ noir_version: string;
53
+ name: string;
54
+ backend: string;
55
+ functions: Array<any>;
56
+ events: Array<any>;
57
+ };
58
+
59
+ export type CompiledProgram = {
60
+ noir_version: string;
61
+ backend: string;
62
+ abi: any;
63
+ bytecode: string;
64
+ }
65
+
66
+ export type DebugArtifact = {
67
+ debug_symbols: Array<any>;
68
+ file_map: Record<number, any>;
69
+ warnings: Array<any>;
70
+ };
71
+
72
+ export type CompileResult = (
73
+ | {
74
+ contract: CompiledContract;
75
+ debug: DebugArtifact;
76
+ }
77
+ | {
78
+ program: CompiledProgram;
79
+ debug: DebugArtifact;
80
+ }
81
+ );
82
+
51
83
 
@@ -183,51 +183,11 @@ function debugString(val) {
183
183
  // TODO we could test for more things here, like `Set`s and `Map`s.
184
184
  return className;
185
185
  }
186
-
187
- function passArray8ToWasm0(arg, malloc) {
188
- const ptr = malloc(arg.length * 1) >>> 0;
189
- getUint8Memory0().set(arg, ptr / 1);
190
- WASM_VECTOR_LEN = arg.length;
191
- return ptr;
192
- }
193
- /**
194
- * @param {Uint8Array} bytes
195
- * @returns {any}
196
- */
197
- module.exports.acir_read_bytes = function(bytes) {
198
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_0);
199
- const len0 = WASM_VECTOR_LEN;
200
- const ret = wasm.acir_read_bytes(ptr0, len0);
201
- return takeObject(ret);
202
- };
203
-
204
- function getArrayU8FromWasm0(ptr, len) {
205
- ptr = ptr >>> 0;
206
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
207
- }
208
- /**
209
- * @param {any} acir
210
- * @returns {Uint8Array}
211
- */
212
- module.exports.acir_write_bytes = function(acir) {
213
- try {
214
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
215
- wasm.acir_write_bytes(retptr, addHeapObject(acir));
216
- var r0 = getInt32Memory0()[retptr / 4 + 0];
217
- var r1 = getInt32Memory0()[retptr / 4 + 1];
218
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
219
- wasm.__wbindgen_export_2(r0, r1 * 1);
220
- return v1;
221
- } finally {
222
- wasm.__wbindgen_add_to_stack_pointer(16);
223
- }
224
- };
225
-
226
186
  /**
227
187
  * @param {string} entry_point
228
188
  * @param {boolean | undefined} contracts
229
189
  * @param {DependencyGraph | undefined} dependency_graph
230
- * @returns {any}
190
+ * @returns {CompileResult}
231
191
  */
232
192
  module.exports.compile = function(entry_point, contracts, dependency_graph) {
233
193
  try {
@@ -251,7 +211,7 @@ function handleError(f, args) {
251
211
  try {
252
212
  return f.apply(this, args);
253
213
  } catch (e) {
254
- wasm.__wbindgen_export_3(addHeapObject(e));
214
+ wasm.__wbindgen_export_2(addHeapObject(e));
255
215
  }
256
216
  }
257
217
  /**
@@ -271,6 +231,50 @@ module.exports.build_info = function() {
271
231
  return takeObject(ret);
272
232
  };
273
233
 
234
+ function passArray8ToWasm0(arg, malloc) {
235
+ const ptr = malloc(arg.length * 1) >>> 0;
236
+ getUint8Memory0().set(arg, ptr / 1);
237
+ WASM_VECTOR_LEN = arg.length;
238
+ return ptr;
239
+ }
240
+ /**
241
+ * @param {Uint8Array} bytes
242
+ * @returns {any}
243
+ */
244
+ module.exports.acir_read_bytes = function(bytes) {
245
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_0);
246
+ const len0 = WASM_VECTOR_LEN;
247
+ const ret = wasm.acir_read_bytes(ptr0, len0);
248
+ return takeObject(ret);
249
+ };
250
+
251
+ function getArrayU8FromWasm0(ptr, len) {
252
+ ptr = ptr >>> 0;
253
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
254
+ }
255
+ /**
256
+ * @param {any} acir
257
+ * @returns {Uint8Array}
258
+ */
259
+ module.exports.acir_write_bytes = function(acir) {
260
+ try {
261
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
262
+ wasm.acir_write_bytes(retptr, addHeapObject(acir));
263
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
264
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
265
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
266
+ wasm.__wbindgen_export_3(r0, r1 * 1);
267
+ return v1;
268
+ } finally {
269
+ wasm.__wbindgen_add_to_stack_pointer(16);
270
+ }
271
+ };
272
+
273
+ module.exports.__wbindgen_is_undefined = function(arg0) {
274
+ const ret = getObject(arg0) === undefined;
275
+ return ret;
276
+ };
277
+
274
278
  module.exports.__wbindgen_object_drop_ref = function(arg0) {
275
279
  takeObject(arg0);
276
280
  };
@@ -280,9 +284,9 @@ module.exports.__wbg_constructor_bc58db5a3b38f16c = function(arg0) {
280
284
  return addHeapObject(ret);
281
285
  };
282
286
 
283
- module.exports.__wbindgen_is_undefined = function(arg0) {
284
- const ret = getObject(arg0) === undefined;
285
- return ret;
287
+ module.exports.__wbg_constructor_e29c95824faa216c = function() {
288
+ const ret = new Object();
289
+ return addHeapObject(ret);
286
290
  };
287
291
 
288
292
  module.exports.__wbg_readfile_a8c4f775fbe0578e = function() { return handleError(function (arg0, arg1, arg2) {
@@ -319,7 +323,7 @@ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
319
323
  deferred0_1 = arg1;
320
324
  console.error(getStringFromWasm0(arg0, arg1));
321
325
  } finally {
322
- wasm.__wbindgen_export_2(deferred0_0, deferred0_1);
326
+ wasm.__wbindgen_export_3(deferred0_0, deferred0_1);
323
327
  }
324
328
  };
325
329
 
Binary file
@@ -1,13 +1,13 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function acir_read_bytes(a: number, b: number): number;
5
- export function acir_write_bytes(a: number, b: number): void;
6
4
  export function compile(a: number, b: number, c: number, d: number, e: number): void;
7
5
  export function init_log_level(a: number, b: number): void;
8
6
  export function build_info(): number;
7
+ export function acir_read_bytes(a: number, b: number): number;
8
+ export function acir_write_bytes(a: number, b: number): void;
9
9
  export function __wbindgen_export_0(a: number): number;
10
10
  export function __wbindgen_export_1(a: number, b: number, c: number): number;
11
11
  export function __wbindgen_add_to_stack_pointer(a: number): number;
12
- export function __wbindgen_export_2(a: number, b: number): void;
13
- export function __wbindgen_export_3(a: number): void;
12
+ export function __wbindgen_export_2(a: number): void;
13
+ export function __wbindgen_export_3(a: number, b: number): void;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "The Noir Team <team@noir-lang.org>"
5
5
  ],
6
- "version": "0.18.0-2c9fe26.nightly",
6
+ "version": "0.18.0-3d5e43a.nightly",
7
7
  "license": "(MIT OR Apache-2.0)",
8
8
  "main": "./nodejs/noir_wasm.js",
9
9
  "types": "./web/noir_wasm.d.ts",
@@ -31,7 +31,7 @@
31
31
  "install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/noir_wasm/nodejs ./ && cp -rL ./result/noir_wasm/web ./"
32
32
  },
33
33
  "peerDependencies": {
34
- "@noir-lang/source-resolver": "0.18.0-2c9fe26.nightly"
34
+ "@noir-lang/source-resolver": "0.18.0-3d5e43a.nightly"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@esm-bundle/chai": "^4.3.4-fix.0",
@@ -1,22 +1,12 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * @param {Uint8Array} bytes
5
- * @returns {any}
6
- */
7
- export function acir_read_bytes(bytes: Uint8Array): any;
8
- /**
9
- * @param {any} acir
10
- * @returns {Uint8Array}
11
- */
12
- export function acir_write_bytes(acir: any): Uint8Array;
13
- /**
14
4
  * @param {string} entry_point
15
5
  * @param {boolean | undefined} contracts
16
6
  * @param {DependencyGraph | undefined} dependency_graph
17
- * @returns {any}
7
+ * @returns {CompileResult}
18
8
  */
19
- export function compile(entry_point: string, contracts?: boolean, dependency_graph?: DependencyGraph): any;
9
+ export function compile(entry_point: string, contracts?: boolean, dependency_graph?: DependencyGraph): CompileResult;
20
10
  /**
21
11
  * @param {string} level
22
12
  */
@@ -25,6 +15,16 @@ export function init_log_level(level: string): void;
25
15
  * @returns {any}
26
16
  */
27
17
  export function build_info(): any;
18
+ /**
19
+ * @param {Uint8Array} bytes
20
+ * @returns {any}
21
+ */
22
+ export function acir_read_bytes(bytes: Uint8Array): any;
23
+ /**
24
+ * @param {any} acir
25
+ * @returns {Uint8Array}
26
+ */
27
+ export function acir_write_bytes(acir: any): Uint8Array;
28
28
 
29
29
  export type Diagnostic = {
30
30
  message: string;
@@ -48,22 +48,54 @@ export type DependencyGraph = {
48
48
  library_dependencies: Readonly<Record<string, readonly string[]>>;
49
49
  }
50
50
 
51
+ export type CompiledContract = {
52
+ noir_version: string;
53
+ name: string;
54
+ backend: string;
55
+ functions: Array<any>;
56
+ events: Array<any>;
57
+ };
58
+
59
+ export type CompiledProgram = {
60
+ noir_version: string;
61
+ backend: string;
62
+ abi: any;
63
+ bytecode: string;
64
+ }
65
+
66
+ export type DebugArtifact = {
67
+ debug_symbols: Array<any>;
68
+ file_map: Record<number, any>;
69
+ warnings: Array<any>;
70
+ };
71
+
72
+ export type CompileResult = (
73
+ | {
74
+ contract: CompiledContract;
75
+ debug: DebugArtifact;
76
+ }
77
+ | {
78
+ program: CompiledProgram;
79
+ debug: DebugArtifact;
80
+ }
81
+ );
82
+
51
83
 
52
84
 
53
85
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
54
86
 
55
87
  export interface InitOutput {
56
88
  readonly memory: WebAssembly.Memory;
57
- readonly acir_read_bytes: (a: number, b: number) => number;
58
- readonly acir_write_bytes: (a: number, b: number) => void;
59
89
  readonly compile: (a: number, b: number, c: number, d: number, e: number) => void;
60
90
  readonly init_log_level: (a: number, b: number) => void;
61
91
  readonly build_info: () => number;
92
+ readonly acir_read_bytes: (a: number, b: number) => number;
93
+ readonly acir_write_bytes: (a: number, b: number) => void;
62
94
  readonly __wbindgen_export_0: (a: number) => number;
63
95
  readonly __wbindgen_export_1: (a: number, b: number, c: number) => number;
64
96
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
65
- readonly __wbindgen_export_2: (a: number, b: number) => void;
66
- readonly __wbindgen_export_3: (a: number) => void;
97
+ readonly __wbindgen_export_2: (a: number) => void;
98
+ readonly __wbindgen_export_3: (a: number, b: number) => void;
67
99
  }
68
100
 
69
101
  export type SyncInitInput = BufferSource | WebAssembly.Module;
package/web/noir_wasm.js CHANGED
@@ -181,51 +181,11 @@ function debugString(val) {
181
181
  // TODO we could test for more things here, like `Set`s and `Map`s.
182
182
  return className;
183
183
  }
184
-
185
- function passArray8ToWasm0(arg, malloc) {
186
- const ptr = malloc(arg.length * 1) >>> 0;
187
- getUint8Memory0().set(arg, ptr / 1);
188
- WASM_VECTOR_LEN = arg.length;
189
- return ptr;
190
- }
191
- /**
192
- * @param {Uint8Array} bytes
193
- * @returns {any}
194
- */
195
- export function acir_read_bytes(bytes) {
196
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_0);
197
- const len0 = WASM_VECTOR_LEN;
198
- const ret = wasm.acir_read_bytes(ptr0, len0);
199
- return takeObject(ret);
200
- }
201
-
202
- function getArrayU8FromWasm0(ptr, len) {
203
- ptr = ptr >>> 0;
204
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
205
- }
206
- /**
207
- * @param {any} acir
208
- * @returns {Uint8Array}
209
- */
210
- export function acir_write_bytes(acir) {
211
- try {
212
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
213
- wasm.acir_write_bytes(retptr, addHeapObject(acir));
214
- var r0 = getInt32Memory0()[retptr / 4 + 0];
215
- var r1 = getInt32Memory0()[retptr / 4 + 1];
216
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
217
- wasm.__wbindgen_export_2(r0, r1 * 1);
218
- return v1;
219
- } finally {
220
- wasm.__wbindgen_add_to_stack_pointer(16);
221
- }
222
- }
223
-
224
184
  /**
225
185
  * @param {string} entry_point
226
186
  * @param {boolean | undefined} contracts
227
187
  * @param {DependencyGraph | undefined} dependency_graph
228
- * @returns {any}
188
+ * @returns {CompileResult}
229
189
  */
230
190
  export function compile(entry_point, contracts, dependency_graph) {
231
191
  try {
@@ -249,7 +209,7 @@ function handleError(f, args) {
249
209
  try {
250
210
  return f.apply(this, args);
251
211
  } catch (e) {
252
- wasm.__wbindgen_export_3(addHeapObject(e));
212
+ wasm.__wbindgen_export_2(addHeapObject(e));
253
213
  }
254
214
  }
255
215
  /**
@@ -269,6 +229,45 @@ export function build_info() {
269
229
  return takeObject(ret);
270
230
  }
271
231
 
232
+ function passArray8ToWasm0(arg, malloc) {
233
+ const ptr = malloc(arg.length * 1) >>> 0;
234
+ getUint8Memory0().set(arg, ptr / 1);
235
+ WASM_VECTOR_LEN = arg.length;
236
+ return ptr;
237
+ }
238
+ /**
239
+ * @param {Uint8Array} bytes
240
+ * @returns {any}
241
+ */
242
+ export function acir_read_bytes(bytes) {
243
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_0);
244
+ const len0 = WASM_VECTOR_LEN;
245
+ const ret = wasm.acir_read_bytes(ptr0, len0);
246
+ return takeObject(ret);
247
+ }
248
+
249
+ function getArrayU8FromWasm0(ptr, len) {
250
+ ptr = ptr >>> 0;
251
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
252
+ }
253
+ /**
254
+ * @param {any} acir
255
+ * @returns {Uint8Array}
256
+ */
257
+ export function acir_write_bytes(acir) {
258
+ try {
259
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
260
+ wasm.acir_write_bytes(retptr, addHeapObject(acir));
261
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
262
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
263
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
264
+ wasm.__wbindgen_export_3(r0, r1 * 1);
265
+ return v1;
266
+ } finally {
267
+ wasm.__wbindgen_add_to_stack_pointer(16);
268
+ }
269
+ }
270
+
272
271
  async function __wbg_load(module, imports) {
273
272
  if (typeof Response === 'function' && module instanceof Response) {
274
273
  if (typeof WebAssembly.instantiateStreaming === 'function') {
@@ -303,6 +302,10 @@ async function __wbg_load(module, imports) {
303
302
  function __wbg_get_imports() {
304
303
  const imports = {};
305
304
  imports.wbg = {};
305
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
306
+ const ret = getObject(arg0) === undefined;
307
+ return ret;
308
+ };
306
309
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
307
310
  takeObject(arg0);
308
311
  };
@@ -310,9 +313,9 @@ function __wbg_get_imports() {
310
313
  const ret = new Error(takeObject(arg0));
311
314
  return addHeapObject(ret);
312
315
  };
313
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
314
- const ret = getObject(arg0) === undefined;
315
- return ret;
316
+ imports.wbg.__wbg_constructor_e29c95824faa216c = function() {
317
+ const ret = new Object();
318
+ return addHeapObject(ret);
316
319
  };
317
320
  imports.wbg.__wbg_readfile_a8c4f775fbe0578e = function() { return handleError(function (arg0, arg1, arg2) {
318
321
  const ret = read_file(getStringFromWasm0(arg1, arg2));
@@ -344,7 +347,7 @@ function __wbg_get_imports() {
344
347
  deferred0_1 = arg1;
345
348
  console.error(getStringFromWasm0(arg0, arg1));
346
349
  } finally {
347
- wasm.__wbindgen_export_2(deferred0_0, deferred0_1);
350
+ wasm.__wbindgen_export_3(deferred0_0, deferred0_1);
348
351
  }
349
352
  };
350
353
  imports.wbg.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
Binary file
@@ -1,13 +1,13 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function acir_read_bytes(a: number, b: number): number;
5
- export function acir_write_bytes(a: number, b: number): void;
6
4
  export function compile(a: number, b: number, c: number, d: number, e: number): void;
7
5
  export function init_log_level(a: number, b: number): void;
8
6
  export function build_info(): number;
7
+ export function acir_read_bytes(a: number, b: number): number;
8
+ export function acir_write_bytes(a: number, b: number): void;
9
9
  export function __wbindgen_export_0(a: number): number;
10
10
  export function __wbindgen_export_1(a: number, b: number, c: number): number;
11
11
  export function __wbindgen_add_to_stack_pointer(a: number): number;
12
- export function __wbindgen_export_2(a: number, b: number): void;
13
- export function __wbindgen_export_3(a: number): void;
12
+ export function __wbindgen_export_2(a: number): void;
13
+ export function __wbindgen_export_3(a: number, b: number): void;