@noir-lang/noir_wasm 0.18.0 → 0.19.0

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.
@@ -11,13 +11,6 @@ export function acir_read_bytes(bytes: Uint8Array): any;
11
11
  */
12
12
  export function acir_write_bytes(acir: any): Uint8Array;
13
13
  /**
14
- * @param {string} entry_point
15
- * @param {boolean | undefined} contracts
16
- * @param {DependencyGraph | undefined} dependency_graph
17
- * @returns {any}
18
- */
19
- export function compile(entry_point: string, contracts?: boolean, dependency_graph?: DependencyGraph): any;
20
- /**
21
14
  * @param {string} level
22
15
  */
23
16
  export function init_log_level(level: string): void;
@@ -25,6 +18,13 @@ export function init_log_level(level: string): void;
25
18
  * @returns {any}
26
19
  */
27
20
  export function build_info(): any;
21
+ /**
22
+ * @param {string} entry_point
23
+ * @param {boolean | undefined} contracts
24
+ * @param {DependencyGraph | undefined} dependency_graph
25
+ * @returns {CompileResult}
26
+ */
27
+ export function compile(entry_point: string, contracts?: boolean, dependency_graph?: DependencyGraph): CompileResult;
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
 
@@ -223,11 +223,28 @@ module.exports.acir_write_bytes = function(acir) {
223
223
  }
224
224
  };
225
225
 
226
+ /**
227
+ * @param {string} level
228
+ */
229
+ module.exports.init_log_level = function(level) {
230
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
231
+ const len0 = WASM_VECTOR_LEN;
232
+ wasm.init_log_level(ptr0, len0);
233
+ };
234
+
235
+ /**
236
+ * @returns {any}
237
+ */
238
+ module.exports.build_info = function() {
239
+ const ret = wasm.build_info();
240
+ return takeObject(ret);
241
+ };
242
+
226
243
  /**
227
244
  * @param {string} entry_point
228
245
  * @param {boolean | undefined} contracts
229
246
  * @param {DependencyGraph | undefined} dependency_graph
230
- * @returns {any}
247
+ * @returns {CompileResult}
231
248
  */
232
249
  module.exports.compile = function(entry_point, contracts, dependency_graph) {
233
250
  try {
@@ -254,28 +271,12 @@ function handleError(f, args) {
254
271
  wasm.__wbindgen_export_3(addHeapObject(e));
255
272
  }
256
273
  }
257
- /**
258
- * @param {string} level
259
- */
260
- module.exports.init_log_level = function(level) {
261
- const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
262
- const len0 = WASM_VECTOR_LEN;
263
- wasm.init_log_level(ptr0, len0);
264
- };
265
-
266
- /**
267
- * @returns {any}
268
- */
269
- module.exports.build_info = function() {
270
- const ret = wasm.build_info();
271
- return takeObject(ret);
272
- };
273
274
 
274
275
  module.exports.__wbindgen_object_drop_ref = function(arg0) {
275
276
  takeObject(arg0);
276
277
  };
277
278
 
278
- module.exports.__wbg_constructor_bc58db5a3b38f16c = function(arg0) {
279
+ module.exports.__wbg_constructor_a05e4567b1c1452b = function(arg0) {
279
280
  const ret = new Error(takeObject(arg0));
280
281
  return addHeapObject(ret);
281
282
  };
@@ -285,7 +286,12 @@ module.exports.__wbindgen_is_undefined = function(arg0) {
285
286
  return ret;
286
287
  };
287
288
 
288
- module.exports.__wbg_readfile_a8c4f775fbe0578e = function() { return handleError(function (arg0, arg1, arg2) {
289
+ module.exports.__wbg_constructor_9c5f4f842ec83850 = function() {
290
+ const ret = new Object();
291
+ return addHeapObject(ret);
292
+ };
293
+
294
+ module.exports.__wbg_readfile_08e66a751b1deb08 = function() { return handleError(function (arg0, arg1, arg2) {
289
295
  const ret = read_file(getStringFromWasm0(arg1, arg2));
290
296
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
291
297
  const len1 = WASM_VECTOR_LEN;
Binary file
@@ -3,9 +3,9 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export function acir_read_bytes(a: number, b: number): number;
5
5
  export function acir_write_bytes(a: number, b: number): void;
6
- export function compile(a: number, b: number, c: number, d: number, e: number): void;
7
6
  export function init_log_level(a: number, b: number): void;
8
7
  export function build_info(): number;
8
+ export function compile(a: number, b: number, c: number, d: number, e: 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;
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",
6
+ "version": "0.19.0",
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"
34
+ "@noir-lang/source-resolver": "0.19.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@esm-bundle/chai": "^4.3.4-fix.0",
@@ -11,13 +11,6 @@ export function acir_read_bytes(bytes: Uint8Array): any;
11
11
  */
12
12
  export function acir_write_bytes(acir: any): Uint8Array;
13
13
  /**
14
- * @param {string} entry_point
15
- * @param {boolean | undefined} contracts
16
- * @param {DependencyGraph | undefined} dependency_graph
17
- * @returns {any}
18
- */
19
- export function compile(entry_point: string, contracts?: boolean, dependency_graph?: DependencyGraph): any;
20
- /**
21
14
  * @param {string} level
22
15
  */
23
16
  export function init_log_level(level: string): void;
@@ -25,6 +18,13 @@ export function init_log_level(level: string): void;
25
18
  * @returns {any}
26
19
  */
27
20
  export function build_info(): any;
21
+ /**
22
+ * @param {string} entry_point
23
+ * @param {boolean | undefined} contracts
24
+ * @param {DependencyGraph | undefined} dependency_graph
25
+ * @returns {CompileResult}
26
+ */
27
+ export function compile(entry_point: string, contracts?: boolean, dependency_graph?: DependencyGraph): CompileResult;
28
28
 
29
29
  export type Diagnostic = {
30
30
  message: string;
@@ -48,6 +48,38 @@ 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;
@@ -56,9 +88,9 @@ export interface InitOutput {
56
88
  readonly memory: WebAssembly.Memory;
57
89
  readonly acir_read_bytes: (a: number, b: number) => number;
58
90
  readonly acir_write_bytes: (a: number, b: number) => void;
59
- readonly compile: (a: number, b: number, c: number, d: number, e: number) => void;
60
91
  readonly init_log_level: (a: number, b: number) => void;
61
92
  readonly build_info: () => number;
93
+ readonly compile: (a: number, b: number, c: number, d: number, e: 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;
package/web/noir_wasm.js CHANGED
@@ -221,11 +221,28 @@ export function acir_write_bytes(acir) {
221
221
  }
222
222
  }
223
223
 
224
+ /**
225
+ * @param {string} level
226
+ */
227
+ export function init_log_level(level) {
228
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
229
+ const len0 = WASM_VECTOR_LEN;
230
+ wasm.init_log_level(ptr0, len0);
231
+ }
232
+
233
+ /**
234
+ * @returns {any}
235
+ */
236
+ export function build_info() {
237
+ const ret = wasm.build_info();
238
+ return takeObject(ret);
239
+ }
240
+
224
241
  /**
225
242
  * @param {string} entry_point
226
243
  * @param {boolean | undefined} contracts
227
244
  * @param {DependencyGraph | undefined} dependency_graph
228
- * @returns {any}
245
+ * @returns {CompileResult}
229
246
  */
230
247
  export function compile(entry_point, contracts, dependency_graph) {
231
248
  try {
@@ -252,22 +269,6 @@ function handleError(f, args) {
252
269
  wasm.__wbindgen_export_3(addHeapObject(e));
253
270
  }
254
271
  }
255
- /**
256
- * @param {string} level
257
- */
258
- export function init_log_level(level) {
259
- const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
260
- const len0 = WASM_VECTOR_LEN;
261
- wasm.init_log_level(ptr0, len0);
262
- }
263
-
264
- /**
265
- * @returns {any}
266
- */
267
- export function build_info() {
268
- const ret = wasm.build_info();
269
- return takeObject(ret);
270
- }
271
272
 
272
273
  async function __wbg_load(module, imports) {
273
274
  if (typeof Response === 'function' && module instanceof Response) {
@@ -306,7 +307,7 @@ function __wbg_get_imports() {
306
307
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
307
308
  takeObject(arg0);
308
309
  };
309
- imports.wbg.__wbg_constructor_bc58db5a3b38f16c = function(arg0) {
310
+ imports.wbg.__wbg_constructor_a05e4567b1c1452b = function(arg0) {
310
311
  const ret = new Error(takeObject(arg0));
311
312
  return addHeapObject(ret);
312
313
  };
@@ -314,7 +315,11 @@ function __wbg_get_imports() {
314
315
  const ret = getObject(arg0) === undefined;
315
316
  return ret;
316
317
  };
317
- imports.wbg.__wbg_readfile_a8c4f775fbe0578e = function() { return handleError(function (arg0, arg1, arg2) {
318
+ imports.wbg.__wbg_constructor_9c5f4f842ec83850 = function() {
319
+ const ret = new Object();
320
+ return addHeapObject(ret);
321
+ };
322
+ imports.wbg.__wbg_readfile_08e66a751b1deb08 = function() { return handleError(function (arg0, arg1, arg2) {
318
323
  const ret = read_file(getStringFromWasm0(arg1, arg2));
319
324
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
320
325
  const len1 = WASM_VECTOR_LEN;
Binary file
@@ -3,9 +3,9 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export function acir_read_bytes(a: number, b: number): number;
5
5
  export function acir_write_bytes(a: number, b: number): void;
6
- export function compile(a: number, b: number, c: number, d: number, e: number): void;
7
6
  export function init_log_level(a: number, b: number): void;
8
7
  export function build_info(): number;
8
+ export function compile(a: number, b: number, c: number, d: number, e: 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;