@noir-lang/noirc_abi 0.29.0 → 0.30.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.
@@ -18,12 +18,18 @@ export function abiDecode(abi: Abi, witness_map: WitnessMap): any;
18
18
  * @returns {Uint8Array}
19
19
  */
20
20
  export function serializeWitness(witness_map: WitnessMap): Uint8Array;
21
+ /**
22
+ * @param {Abi} abi
23
+ * @param {RawAssertionPayload} raw_error
24
+ * @returns {any}
25
+ */
26
+ export function abiDecodeError(abi: Abi, raw_error: RawAssertionPayload): any;
21
27
 
22
28
  export type ABIError = Error;
23
29
 
24
30
 
25
31
 
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";
32
+ import { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, Abi, WitnessMap, RawAssertionPayload } from "@noir-lang/types";
33
+ export { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, Abi, WitnessMap, RawAssertionPayload } from "@noir-lang/types";
28
34
 
29
35
 
@@ -11,18 +11,6 @@ function getObject(idx) { return heap[idx]; }
11
11
 
12
12
  let heap_next = heap.length;
13
13
 
14
- function dropObject(idx) {
15
- if (idx < 132) return;
16
- heap[idx] = heap_next;
17
- heap_next = idx;
18
- }
19
-
20
- function takeObject(idx) {
21
- const ret = getObject(idx);
22
- dropObject(idx);
23
- return ret;
24
- }
25
-
26
14
  function addHeapObject(obj) {
27
15
  if (heap_next === heap.length) heap.push(heap.length + 1);
28
16
  const idx = heap_next;
@@ -32,26 +20,16 @@ function addHeapObject(obj) {
32
20
  return idx;
33
21
  }
34
22
 
35
- function isLikeNone(x) {
36
- return x === undefined || x === null;
37
- }
38
-
39
- let cachedFloat64Memory0 = null;
40
-
41
- function getFloat64Memory0() {
42
- if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
43
- cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
44
- }
45
- return cachedFloat64Memory0;
23
+ function dropObject(idx) {
24
+ if (idx < 132) return;
25
+ heap[idx] = heap_next;
26
+ heap_next = idx;
46
27
  }
47
28
 
48
- let cachedInt32Memory0 = null;
49
-
50
- function getInt32Memory0() {
51
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
52
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
53
- }
54
- return cachedInt32Memory0;
29
+ function takeObject(idx) {
30
+ const ret = getObject(idx);
31
+ dropObject(idx);
32
+ return ret;
55
33
  }
56
34
 
57
35
  let WASM_VECTOR_LEN = 0;
@@ -118,6 +96,28 @@ function passStringToWasm0(arg, malloc, realloc) {
118
96
  return ptr;
119
97
  }
120
98
 
99
+ function isLikeNone(x) {
100
+ return x === undefined || x === null;
101
+ }
102
+
103
+ let cachedInt32Memory0 = null;
104
+
105
+ function getInt32Memory0() {
106
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
107
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
108
+ }
109
+ return cachedInt32Memory0;
110
+ }
111
+
112
+ let cachedFloat64Memory0 = null;
113
+
114
+ function getFloat64Memory0() {
115
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
116
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
117
+ }
118
+ return cachedFloat64Memory0;
119
+ }
120
+
121
121
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
122
122
 
123
123
  cachedTextDecoder.decode();
@@ -196,7 +196,28 @@ module.exports.serializeWitness = function(witness_map) {
196
196
  }
197
197
  };
198
198
 
199
- function __wbg_adapter_27(arg0, arg1, arg2, arg3) {
199
+ /**
200
+ * @param {Abi} abi
201
+ * @param {RawAssertionPayload} raw_error
202
+ * @returns {any}
203
+ */
204
+ module.exports.abiDecodeError = function(abi, raw_error) {
205
+ try {
206
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
207
+ wasm.abiDecodeError(retptr, addHeapObject(abi), addHeapObject(raw_error));
208
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
209
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
210
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
211
+ if (r2) {
212
+ throw takeObject(r1);
213
+ }
214
+ return takeObject(r0);
215
+ } finally {
216
+ wasm.__wbindgen_add_to_stack_pointer(16);
217
+ }
218
+ };
219
+
220
+ function __wbg_adapter_28(arg0, arg1, arg2, arg3) {
200
221
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h4cc254837aac6d0e(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
201
222
  }
202
223
 
@@ -213,16 +234,12 @@ module.exports.__wbindgen_is_undefined = function(arg0) {
213
234
  return ret;
214
235
  };
215
236
 
216
- module.exports.__wbg_constructor_31b8021c87529775 = function(arg0) {
237
+ module.exports.__wbg_constructor_f316a911c89e6ad1 = function(arg0) {
217
238
  const ret = new Error(takeObject(arg0));
218
239
  return addHeapObject(ret);
219
240
  };
220
241
 
221
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
222
- takeObject(arg0);
223
- };
224
-
225
- module.exports.__wbg_new_28eb792b86f6c6a5 = function() {
242
+ module.exports.__wbg_new_c532f61074fa67e0 = function() {
226
243
  const ret = new Map();
227
244
  return addHeapObject(ret);
228
245
  };
@@ -232,11 +249,8 @@ module.exports.__wbindgen_number_new = function(arg0) {
232
249
  return addHeapObject(ret);
233
250
  };
234
251
 
235
- module.exports.__wbindgen_number_get = function(arg0, arg1) {
236
- const obj = getObject(arg1);
237
- const ret = typeof(obj) === 'number' ? obj : undefined;
238
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
239
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
252
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
253
+ takeObject(arg0);
240
254
  };
241
255
 
242
256
  module.exports.__wbindgen_string_get = function(arg0, arg1) {
@@ -248,6 +262,18 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
248
262
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
249
263
  };
250
264
 
265
+ module.exports.__wbindgen_number_get = function(arg0, arg1) {
266
+ const obj = getObject(arg1);
267
+ const ret = typeof(obj) === 'number' ? obj : undefined;
268
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
269
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
270
+ };
271
+
272
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
273
+ const ret = getStringFromWasm0(arg0, arg1);
274
+ return addHeapObject(ret);
275
+ };
276
+
251
277
  module.exports.__wbg_new_abda76e883ba8a5f = function() {
252
278
  const ret = new Error();
253
279
  return addHeapObject(ret);
@@ -273,11 +299,6 @@ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
273
299
  }
274
300
  };
275
301
 
276
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
277
- const ret = getStringFromWasm0(arg0, arg1);
278
- return addHeapObject(ret);
279
- };
280
-
281
302
  module.exports.__wbg_forEach_942772130a8d06a6 = function(arg0, arg1, arg2) {
282
303
  try {
283
304
  var state0 = {a: arg1, b: arg2};
@@ -285,7 +306,7 @@ module.exports.__wbg_forEach_942772130a8d06a6 = function(arg0, arg1, arg2) {
285
306
  const a = state0.a;
286
307
  state0.a = 0;
287
308
  try {
288
- return __wbg_adapter_27(a, state0.b, arg0, arg1);
309
+ return __wbg_adapter_28(a, state0.b, arg0, arg1);
289
310
  } finally {
290
311
  state0.a = a;
291
312
  }
Binary file
@@ -4,6 +4,7 @@ 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
6
  export function serializeWitness(a: number, b: number): void;
7
+ export function abiDecodeError(a: number, b: number, c: number): void;
7
8
  export function __wbindgen_malloc(a: number): number;
8
9
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
9
10
  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.29.0",
6
+ "version": "0.30.0",
7
7
  "license": "(MIT OR Apache-2.0)",
8
8
  "homepage": "https://noir-lang.org/",
9
9
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0"
37
37
  },
38
38
  "dependencies": {
39
- "@noir-lang/types": "0.29.0"
39
+ "@noir-lang/types": "0.30.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@esm-bundle/chai": "^4.3.4-fix.0",
@@ -18,13 +18,19 @@ export function abiDecode(abi: Abi, witness_map: WitnessMap): any;
18
18
  * @returns {Uint8Array}
19
19
  */
20
20
  export function serializeWitness(witness_map: WitnessMap): Uint8Array;
21
+ /**
22
+ * @param {Abi} abi
23
+ * @param {RawAssertionPayload} raw_error
24
+ * @returns {any}
25
+ */
26
+ export function abiDecodeError(abi: Abi, raw_error: RawAssertionPayload): any;
21
27
 
22
28
  export type ABIError = Error;
23
29
 
24
30
 
25
31
 
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";
32
+ import { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, Abi, WitnessMap, RawAssertionPayload } from "@noir-lang/types";
33
+ export { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, Abi, WitnessMap, RawAssertionPayload } from "@noir-lang/types";
28
34
 
29
35
 
30
36
 
@@ -35,6 +41,7 @@ export interface InitOutput {
35
41
  readonly abiEncode: (a: number, b: number, c: number, d: number) => void;
36
42
  readonly abiDecode: (a: number, b: number, c: number) => void;
37
43
  readonly serializeWitness: (a: number, b: number) => void;
44
+ readonly abiDecodeError: (a: number, b: number, c: number) => void;
38
45
  readonly __wbindgen_malloc: (a: number) => number;
39
46
  readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
40
47
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
@@ -8,18 +8,6 @@ function getObject(idx) { return heap[idx]; }
8
8
 
9
9
  let heap_next = heap.length;
10
10
 
11
- function dropObject(idx) {
12
- if (idx < 132) return;
13
- heap[idx] = heap_next;
14
- heap_next = idx;
15
- }
16
-
17
- function takeObject(idx) {
18
- const ret = getObject(idx);
19
- dropObject(idx);
20
- return ret;
21
- }
22
-
23
11
  function addHeapObject(obj) {
24
12
  if (heap_next === heap.length) heap.push(heap.length + 1);
25
13
  const idx = heap_next;
@@ -29,26 +17,16 @@ function addHeapObject(obj) {
29
17
  return idx;
30
18
  }
31
19
 
32
- function isLikeNone(x) {
33
- return x === undefined || x === null;
34
- }
35
-
36
- let cachedFloat64Memory0 = null;
37
-
38
- function getFloat64Memory0() {
39
- if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
40
- cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
41
- }
42
- return cachedFloat64Memory0;
20
+ function dropObject(idx) {
21
+ if (idx < 132) return;
22
+ heap[idx] = heap_next;
23
+ heap_next = idx;
43
24
  }
44
25
 
45
- let cachedInt32Memory0 = null;
46
-
47
- function getInt32Memory0() {
48
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
49
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
50
- }
51
- return cachedInt32Memory0;
26
+ function takeObject(idx) {
27
+ const ret = getObject(idx);
28
+ dropObject(idx);
29
+ return ret;
52
30
  }
53
31
 
54
32
  let WASM_VECTOR_LEN = 0;
@@ -115,6 +93,28 @@ function passStringToWasm0(arg, malloc, realloc) {
115
93
  return ptr;
116
94
  }
117
95
 
96
+ function isLikeNone(x) {
97
+ return x === undefined || x === null;
98
+ }
99
+
100
+ let cachedInt32Memory0 = null;
101
+
102
+ function getInt32Memory0() {
103
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
104
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
105
+ }
106
+ return cachedInt32Memory0;
107
+ }
108
+
109
+ let cachedFloat64Memory0 = null;
110
+
111
+ function getFloat64Memory0() {
112
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
113
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
114
+ }
115
+ return cachedFloat64Memory0;
116
+ }
117
+
118
118
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
119
119
 
120
120
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@@ -193,7 +193,28 @@ export function serializeWitness(witness_map) {
193
193
  }
194
194
  }
195
195
 
196
- function __wbg_adapter_27(arg0, arg1, arg2, arg3) {
196
+ /**
197
+ * @param {Abi} abi
198
+ * @param {RawAssertionPayload} raw_error
199
+ * @returns {any}
200
+ */
201
+ export function abiDecodeError(abi, raw_error) {
202
+ try {
203
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
204
+ wasm.abiDecodeError(retptr, addHeapObject(abi), addHeapObject(raw_error));
205
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
206
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
207
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
208
+ if (r2) {
209
+ throw takeObject(r1);
210
+ }
211
+ return takeObject(r0);
212
+ } finally {
213
+ wasm.__wbindgen_add_to_stack_pointer(16);
214
+ }
215
+ }
216
+
217
+ function __wbg_adapter_28(arg0, arg1, arg2, arg3) {
197
218
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h4cc254837aac6d0e(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
198
219
  }
199
220
 
@@ -243,14 +264,11 @@ function __wbg_get_imports() {
243
264
  const ret = getObject(arg0) === undefined;
244
265
  return ret;
245
266
  };
246
- imports.wbg.__wbg_constructor_31b8021c87529775 = function(arg0) {
267
+ imports.wbg.__wbg_constructor_f316a911c89e6ad1 = function(arg0) {
247
268
  const ret = new Error(takeObject(arg0));
248
269
  return addHeapObject(ret);
249
270
  };
250
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
251
- takeObject(arg0);
252
- };
253
- imports.wbg.__wbg_new_28eb792b86f6c6a5 = function() {
271
+ imports.wbg.__wbg_new_c532f61074fa67e0 = function() {
254
272
  const ret = new Map();
255
273
  return addHeapObject(ret);
256
274
  };
@@ -258,11 +276,8 @@ function __wbg_get_imports() {
258
276
  const ret = arg0;
259
277
  return addHeapObject(ret);
260
278
  };
261
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
262
- const obj = getObject(arg1);
263
- const ret = typeof(obj) === 'number' ? obj : undefined;
264
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
265
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
279
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
280
+ takeObject(arg0);
266
281
  };
267
282
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
268
283
  const obj = getObject(arg1);
@@ -272,6 +287,16 @@ function __wbg_get_imports() {
272
287
  getInt32Memory0()[arg0 / 4 + 1] = len1;
273
288
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
274
289
  };
290
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
291
+ const obj = getObject(arg1);
292
+ const ret = typeof(obj) === 'number' ? obj : undefined;
293
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
294
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
295
+ };
296
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
297
+ const ret = getStringFromWasm0(arg0, arg1);
298
+ return addHeapObject(ret);
299
+ };
275
300
  imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
276
301
  const ret = new Error();
277
302
  return addHeapObject(ret);
@@ -294,10 +319,6 @@ function __wbg_get_imports() {
294
319
  wasm.__wbindgen_free(deferred0_0, deferred0_1);
295
320
  }
296
321
  };
297
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
298
- const ret = getStringFromWasm0(arg0, arg1);
299
- return addHeapObject(ret);
300
- };
301
322
  imports.wbg.__wbg_forEach_942772130a8d06a6 = function(arg0, arg1, arg2) {
302
323
  try {
303
324
  var state0 = {a: arg1, b: arg2};
@@ -305,7 +326,7 @@ function __wbg_get_imports() {
305
326
  const a = state0.a;
306
327
  state0.a = 0;
307
328
  try {
308
- return __wbg_adapter_27(a, state0.b, arg0, arg1);
329
+ return __wbg_adapter_28(a, state0.b, arg0, arg1);
309
330
  } finally {
310
331
  state0.a = a;
311
332
  }
Binary file
@@ -4,6 +4,7 @@ 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
6
  export function serializeWitness(a: number, b: number): void;
7
+ export function abiDecodeError(a: number, b: number, c: number): void;
7
8
  export function __wbindgen_malloc(a: number): number;
8
9
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
9
10
  export function __wbindgen_add_to_stack_pointer(a: number): number;