@aztec/noir-noirc_abi 0.0.1-commit.f504929 → 0.0.1-commit.f81dbcf

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,5 +1,9 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export function abiEncode(abi: Abi, inputs: InputMap, return_value?: InputValue | null): WitnessMap;
4
+ export function abiDecode(abi: Abi, witness_map: WitnessMap): any;
5
+ export function serializeWitness(witness_map: WitnessMap): Uint8Array;
6
+ export function abiDecodeError(abi: Abi, raw_error: RawAssertionPayload): any;
3
7
 
4
8
  export type ABIError = Error;
5
9
 
@@ -9,11 +13,3 @@ import { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, A
9
13
  export { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, Abi, WitnessMap, RawAssertionPayload } from "@aztec/noir-types";
10
14
 
11
15
 
12
-
13
- export function abiDecode(abi: Abi, witness_map: WitnessMap): any;
14
-
15
- export function abiDecodeError(abi: Abi, raw_error: RawAssertionPayload): any;
16
-
17
- export function abiEncode(abi: Abi, inputs: InputMap, return_value?: InputValue | null): WitnessMap;
18
-
19
- export function serializeWitness(witness_map: WitnessMap): Uint8Array;
@@ -1,206 +1,31 @@
1
- /* @ts-self-types="./noirc_abi_wasm.d.ts" */
2
1
 
3
- /**
4
- * @param {Abi} abi
5
- * @param {WitnessMap} witness_map
6
- * @returns {any}
7
- */
8
- function abiDecode(abi, witness_map) {
9
- const ret = wasm.abiDecode(abi, witness_map);
10
- if (ret[2]) {
11
- throw takeFromExternrefTable0(ret[1]);
12
- }
13
- return takeFromExternrefTable0(ret[0]);
14
- }
15
- exports.abiDecode = abiDecode;
16
-
17
- /**
18
- * @param {Abi} abi
19
- * @param {RawAssertionPayload} raw_error
20
- * @returns {any}
21
- */
22
- function abiDecodeError(abi, raw_error) {
23
- const ret = wasm.abiDecodeError(abi, raw_error);
24
- if (ret[2]) {
25
- throw takeFromExternrefTable0(ret[1]);
26
- }
27
- return takeFromExternrefTable0(ret[0]);
28
- }
29
- exports.abiDecodeError = abiDecodeError;
30
-
31
- /**
32
- * @param {Abi} abi
33
- * @param {InputMap} inputs
34
- * @param {InputValue | null} [return_value]
35
- * @returns {WitnessMap}
36
- */
37
- function abiEncode(abi, inputs, return_value) {
38
- const ret = wasm.abiEncode(abi, inputs, isLikeNone(return_value) ? 0 : addToExternrefTable0(return_value));
39
- if (ret[2]) {
40
- throw takeFromExternrefTable0(ret[1]);
41
- }
42
- return takeFromExternrefTable0(ret[0]);
43
- }
44
- exports.abiEncode = abiEncode;
45
-
46
- /**
47
- * @param {WitnessMap} witness_map
48
- * @returns {Uint8Array}
49
- */
50
- function serializeWitness(witness_map) {
51
- const ret = wasm.serializeWitness(witness_map);
52
- if (ret[3]) {
53
- throw takeFromExternrefTable0(ret[2]);
54
- }
55
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
56
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
57
- return v1;
58
- }
59
- exports.serializeWitness = serializeWitness;
60
-
61
- function __wbg_get_imports() {
62
- const import0 = {
63
- __proto__: null,
64
- __wbg___wbindgen_is_undefined_c18285b9fc34cb7d: function(arg0) {
65
- const ret = arg0 === undefined;
66
- return ret;
67
- },
68
- __wbg___wbindgen_number_get_5854912275df1894: function(arg0, arg1) {
69
- const obj = arg1;
70
- const ret = typeof(obj) === 'number' ? obj : undefined;
71
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
72
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
73
- },
74
- __wbg___wbindgen_string_get_3e5751597f39a112: function(arg0, arg1) {
75
- const obj = arg1;
76
- const ret = typeof(obj) === 'string' ? obj : undefined;
77
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
78
- var len1 = WASM_VECTOR_LEN;
79
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
80
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
81
- },
82
- __wbg___wbindgen_throw_39bc967c0e5a9b58: function(arg0, arg1) {
83
- throw new Error(getStringFromWasm0(arg0, arg1));
84
- },
85
- __wbg_constructor_1ff9b184f5d0565b: function(arg0) {
86
- const ret = new Error(arg0);
87
- return ret;
88
- },
89
- __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
90
- let deferred0_0;
91
- let deferred0_1;
92
- try {
93
- deferred0_0 = arg0;
94
- deferred0_1 = arg1;
95
- console.error(getStringFromWasm0(arg0, arg1));
96
- } finally {
97
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
98
- }
99
- },
100
- __wbg_forEach_9694464cb60ea370: function(arg0, arg1, arg2) {
101
- try {
102
- var state0 = {a: arg1, b: arg2};
103
- var cb0 = (arg0, arg1) => {
104
- const a = state0.a;
105
- state0.a = 0;
106
- try {
107
- return wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(a, state0.b, arg0, arg1);
108
- } finally {
109
- state0.a = a;
110
- }
111
- };
112
- arg0.forEach(cb0);
113
- } finally {
114
- state0.a = state0.b = 0;
115
- }
116
- },
117
- __wbg_new_1390430ba54bf329: function() {
118
- const ret = new Map();
119
- return ret;
120
- },
121
- __wbg_new_227d7c05414eb861: function() {
122
- const ret = new Error();
123
- return ret;
124
- },
125
- __wbg_parse_6dfe891b5bafb5cd: function() { return handleError(function (arg0, arg1) {
126
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
127
- return ret;
128
- }, arguments); },
129
- __wbg_set_cfc6de03f990decf: function(arg0, arg1, arg2) {
130
- const ret = arg0.set(arg1, arg2);
131
- return ret;
132
- },
133
- __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
134
- const ret = arg1.stack;
135
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136
- const len1 = WASM_VECTOR_LEN;
137
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
138
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
139
- },
140
- __wbg_stringify_86f4ab954f88f382: function() { return handleError(function (arg0) {
141
- const ret = JSON.stringify(arg0);
142
- return ret;
143
- }, arguments); },
144
- __wbindgen_cast_0000000000000001: function(arg0) {
145
- // Cast intrinsic for `F64 -> Externref`.
146
- const ret = arg0;
147
- return ret;
148
- },
149
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
150
- // Cast intrinsic for `Ref(String) -> Externref`.
151
- const ret = getStringFromWasm0(arg0, arg1);
152
- return ret;
153
- },
154
- __wbindgen_init_externref_table: function() {
155
- const table = wasm.__wbindgen_externrefs;
156
- const offset = table.grow(4);
157
- table.set(0, undefined);
158
- table.set(offset + 0, undefined);
159
- table.set(offset + 1, null);
160
- table.set(offset + 2, true);
161
- table.set(offset + 3, false);
162
- },
163
- };
164
- return {
165
- __proto__: null,
166
- "./noirc_abi_wasm_bg.js": import0,
167
- };
168
- }
2
+ let imports = {};
3
+ imports['__wbindgen_placeholder__'] = module.exports;
4
+ let wasm;
5
+ const { TextDecoder, TextEncoder } = require(`util`);
169
6
 
170
- function wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(arg0, arg1, arg2, arg3) {
171
- wasm.wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(arg0, arg1, arg2, arg3);
172
- }
7
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
173
8
 
174
- function addToExternrefTable0(obj) {
175
- const idx = wasm.__externref_table_alloc();
176
- wasm.__wbindgen_externrefs.set(idx, obj);
177
- return idx;
178
- }
9
+ cachedTextDecoder.decode();
179
10
 
180
- function getArrayU8FromWasm0(ptr, len) {
181
- ptr = ptr >>> 0;
182
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
183
- }
11
+ let cachedUint8ArrayMemory0 = null;
184
12
 
185
- let cachedDataViewMemory0 = null;
186
- function getDataViewMemory0() {
187
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
188
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
13
+ function getUint8ArrayMemory0() {
14
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
15
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
189
16
  }
190
- return cachedDataViewMemory0;
17
+ return cachedUint8ArrayMemory0;
191
18
  }
192
19
 
193
20
  function getStringFromWasm0(ptr, len) {
194
21
  ptr = ptr >>> 0;
195
- return decodeText(ptr, len);
22
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
196
23
  }
197
24
 
198
- let cachedUint8ArrayMemory0 = null;
199
- function getUint8ArrayMemory0() {
200
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
201
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
202
- }
203
- return cachedUint8ArrayMemory0;
25
+ function addToExternrefTable0(obj) {
26
+ const idx = wasm.__externref_table_alloc();
27
+ wasm.__wbindgen_export_3.set(idx, obj);
28
+ return idx;
204
29
  }
205
30
 
206
31
  function handleError(f, args) {
@@ -212,11 +37,25 @@ function handleError(f, args) {
212
37
  }
213
38
  }
214
39
 
215
- function isLikeNone(x) {
216
- return x === undefined || x === null;
40
+ let WASM_VECTOR_LEN = 0;
41
+
42
+ let cachedTextEncoder = new TextEncoder('utf-8');
43
+
44
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
45
+ ? function (arg, view) {
46
+ return cachedTextEncoder.encodeInto(arg, view);
217
47
  }
48
+ : function (arg, view) {
49
+ const buf = cachedTextEncoder.encode(arg);
50
+ view.set(buf);
51
+ return {
52
+ read: arg.length,
53
+ written: buf.length
54
+ };
55
+ });
218
56
 
219
57
  function passStringToWasm0(arg, malloc, realloc) {
58
+
220
59
  if (realloc === undefined) {
221
60
  const buf = cachedTextEncoder.encode(arg);
222
61
  const ptr = malloc(buf.length, 1) >>> 0;
@@ -237,13 +76,14 @@ function passStringToWasm0(arg, malloc, realloc) {
237
76
  if (code > 0x7F) break;
238
77
  mem[ptr + offset] = code;
239
78
  }
79
+
240
80
  if (offset !== len) {
241
81
  if (offset !== 0) {
242
82
  arg = arg.slice(offset);
243
83
  }
244
84
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
245
85
  const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
246
- const ret = cachedTextEncoder.encodeInto(arg, view);
86
+ const ret = encodeString(arg, view);
247
87
 
248
88
  offset += ret.written;
249
89
  ptr = realloc(ptr, len, offset, 1) >>> 0;
@@ -253,35 +93,207 @@ function passStringToWasm0(arg, malloc, realloc) {
253
93
  return ptr;
254
94
  }
255
95
 
96
+ let cachedDataViewMemory0 = null;
97
+
98
+ function getDataViewMemory0() {
99
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
100
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
101
+ }
102
+ return cachedDataViewMemory0;
103
+ }
104
+
105
+ function isLikeNone(x) {
106
+ return x === undefined || x === null;
107
+ }
108
+
256
109
  function takeFromExternrefTable0(idx) {
257
- const value = wasm.__wbindgen_externrefs.get(idx);
110
+ const value = wasm.__wbindgen_export_3.get(idx);
258
111
  wasm.__externref_table_dealloc(idx);
259
112
  return value;
260
113
  }
114
+ /**
115
+ * @param {Abi} abi
116
+ * @param {InputMap} inputs
117
+ * @param {InputValue | null} [return_value]
118
+ * @returns {WitnessMap}
119
+ */
120
+ module.exports.abiEncode = function(abi, inputs, return_value) {
121
+ const ret = wasm.abiEncode(abi, inputs, isLikeNone(return_value) ? 0 : addToExternrefTable0(return_value));
122
+ if (ret[2]) {
123
+ throw takeFromExternrefTable0(ret[1]);
124
+ }
125
+ return takeFromExternrefTable0(ret[0]);
126
+ };
261
127
 
262
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
263
- cachedTextDecoder.decode();
264
- function decodeText(ptr, len) {
265
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
128
+ /**
129
+ * @param {Abi} abi
130
+ * @param {WitnessMap} witness_map
131
+ * @returns {any}
132
+ */
133
+ module.exports.abiDecode = function(abi, witness_map) {
134
+ const ret = wasm.abiDecode(abi, witness_map);
135
+ if (ret[2]) {
136
+ throw takeFromExternrefTable0(ret[1]);
137
+ }
138
+ return takeFromExternrefTable0(ret[0]);
139
+ };
140
+
141
+ function getArrayU8FromWasm0(ptr, len) {
142
+ ptr = ptr >>> 0;
143
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
266
144
  }
145
+ /**
146
+ * @param {WitnessMap} witness_map
147
+ * @returns {Uint8Array}
148
+ */
149
+ module.exports.serializeWitness = function(witness_map) {
150
+ const ret = wasm.serializeWitness(witness_map);
151
+ if (ret[3]) {
152
+ throw takeFromExternrefTable0(ret[2]);
153
+ }
154
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
155
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
156
+ return v1;
157
+ };
267
158
 
268
- const cachedTextEncoder = new TextEncoder();
159
+ /**
160
+ * @param {Abi} abi
161
+ * @param {RawAssertionPayload} raw_error
162
+ * @returns {any}
163
+ */
164
+ module.exports.abiDecodeError = function(abi, raw_error) {
165
+ const ret = wasm.abiDecodeError(abi, raw_error);
166
+ if (ret[2]) {
167
+ throw takeFromExternrefTable0(ret[1]);
168
+ }
169
+ return takeFromExternrefTable0(ret[0]);
170
+ };
269
171
 
270
- if (!('encodeInto' in cachedTextEncoder)) {
271
- cachedTextEncoder.encodeInto = function (arg, view) {
272
- const buf = cachedTextEncoder.encode(arg);
273
- view.set(buf);
274
- return {
275
- read: arg.length,
276
- written: buf.length
277
- };
278
- };
172
+ function __wbg_adapter_30(arg0, arg1, arg2, arg3) {
173
+ wasm.closure188_externref_shim(arg0, arg1, arg2, arg3);
279
174
  }
280
175
 
281
- let WASM_VECTOR_LEN = 0;
176
+ module.exports.__wbg_constructor_3592dabf8a4edaea = function(arg0) {
177
+ const ret = new Error(arg0);
178
+ return ret;
179
+ };
180
+
181
+ module.exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
182
+ let deferred0_0;
183
+ let deferred0_1;
184
+ try {
185
+ deferred0_0 = arg0;
186
+ deferred0_1 = arg1;
187
+ console.error(getStringFromWasm0(arg0, arg1));
188
+ } finally {
189
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
190
+ }
191
+ };
192
+
193
+ module.exports.__wbg_forEach_e1cf6f7c8ecb7dae = function(arg0, arg1, arg2) {
194
+ try {
195
+ var state0 = {a: arg1, b: arg2};
196
+ var cb0 = (arg0, arg1) => {
197
+ const a = state0.a;
198
+ state0.a = 0;
199
+ try {
200
+ return __wbg_adapter_30(a, state0.b, arg0, arg1);
201
+ } finally {
202
+ state0.a = a;
203
+ }
204
+ };
205
+ arg0.forEach(cb0);
206
+ } finally {
207
+ state0.a = state0.b = 0;
208
+ }
209
+ };
210
+
211
+ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
212
+ const ret = new Error();
213
+ return ret;
214
+ };
215
+
216
+ module.exports.__wbg_new_dc2902000358ae4d = function() {
217
+ const ret = new Map();
218
+ return ret;
219
+ };
220
+
221
+ module.exports.__wbg_parse_def2e24ef1252aff = function() { return handleError(function (arg0, arg1) {
222
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
223
+ return ret;
224
+ }, arguments) };
225
+
226
+ module.exports.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
227
+ const ret = arg0.set(arg1, arg2);
228
+ return ret;
229
+ };
230
+
231
+ module.exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
232
+ const ret = arg1.stack;
233
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
234
+ const len1 = WASM_VECTOR_LEN;
235
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
236
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
237
+ };
238
+
239
+ module.exports.__wbg_stringify_f7ed6987935b4a24 = function() { return handleError(function (arg0) {
240
+ const ret = JSON.stringify(arg0);
241
+ return ret;
242
+ }, arguments) };
243
+
244
+ module.exports.__wbindgen_init_externref_table = function() {
245
+ const table = wasm.__wbindgen_export_3;
246
+ const offset = table.grow(4);
247
+ table.set(0, undefined);
248
+ table.set(offset + 0, undefined);
249
+ table.set(offset + 1, null);
250
+ table.set(offset + 2, true);
251
+ table.set(offset + 3, false);
252
+ ;
253
+ };
254
+
255
+ module.exports.__wbindgen_is_undefined = function(arg0) {
256
+ const ret = arg0 === undefined;
257
+ return ret;
258
+ };
259
+
260
+ module.exports.__wbindgen_number_get = function(arg0, arg1) {
261
+ const obj = arg1;
262
+ const ret = typeof(obj) === 'number' ? obj : undefined;
263
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
264
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
265
+ };
266
+
267
+ module.exports.__wbindgen_number_new = function(arg0) {
268
+ const ret = arg0;
269
+ return ret;
270
+ };
271
+
272
+ module.exports.__wbindgen_string_get = function(arg0, arg1) {
273
+ const obj = arg1;
274
+ const ret = typeof(obj) === 'string' ? obj : undefined;
275
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
276
+ var len1 = WASM_VECTOR_LEN;
277
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
278
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
279
+ };
280
+
281
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
282
+ const ret = getStringFromWasm0(arg0, arg1);
283
+ return ret;
284
+ };
285
+
286
+ module.exports.__wbindgen_throw = function(arg0, arg1) {
287
+ throw new Error(getStringFromWasm0(arg0, arg1));
288
+ };
289
+
290
+ const path = require('path').join(__dirname, 'noirc_abi_wasm_bg.wasm');
291
+ const bytes = require('fs').readFileSync(path);
292
+
293
+ const wasmModule = new WebAssembly.Module(bytes);
294
+ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
295
+ wasm = wasmInstance.exports;
296
+ module.exports.__wasm = wasm;
282
297
 
283
- const wasmPath = `${__dirname}/noirc_abi_wasm_bg.wasm`;
284
- const wasmBytes = require('fs').readFileSync(wasmPath);
285
- const wasmModule = new WebAssembly.Module(wasmBytes);
286
- let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
287
298
  wasm.__wbindgen_start();
299
+
Binary file
@@ -5,12 +5,12 @@ export const abiEncode: (a: any, b: any, c: number) => [number, number, number];
5
5
  export const abiDecode: (a: any, b: any) => [number, number, number];
6
6
  export const serializeWitness: (a: any) => [number, number, number, number];
7
7
  export const abiDecodeError: (a: any, b: any) => [number, number, number];
8
- export const wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2: (a: number, b: number, c: any, d: any) => void;
9
- export const __wbindgen_malloc: (a: number, b: number) => number;
10
- export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
11
8
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
12
9
  export const __wbindgen_exn_store: (a: number) => void;
13
10
  export const __externref_table_alloc: () => number;
14
- export const __wbindgen_externrefs: WebAssembly.Table;
11
+ export const __wbindgen_export_3: WebAssembly.Table;
12
+ export const __wbindgen_malloc: (a: number, b: number) => number;
13
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
15
14
  export const __externref_table_dealloc: (a: number) => void;
15
+ export const closure188_externref_shim: (a: number, b: number, c: any, d: any) => void;
16
16
  export const __wbindgen_start: () => void;
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.0.1-commit.f504929",
6
+ "version": "0.0.1-commit.f81dbcf",
7
7
  "license": "(MIT OR Apache-2.0)",
8
8
  "homepage": "https://noir-lang.org/",
9
9
  "repository": {
@@ -36,14 +36,14 @@
36
36
  "lint": "NODE_NO_WARNINGS=1 eslint . --max-warnings 0"
37
37
  },
38
38
  "dependencies": {
39
- "@aztec/noir-types": "0.0.1-commit.f504929"
39
+ "@aztec/noir-types": "0.0.1-commit.f81dbcf"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@esm-bundle/chai": "^4.3.4-fix.0",
43
- "@web/dev-server-esbuild": "^1.0.5",
43
+ "@web/dev-server-esbuild": "^1.0.4",
44
44
  "@web/test-runner": "^0.20.2",
45
45
  "@web/test-runner-playwright": "^0.11.1",
46
- "eslint": "^10.0.2",
46
+ "eslint": "^9.39.2",
47
47
  "mocha": "^11.7.5"
48
48
  }
49
49
  }
@@ -1,5 +1,9 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export function abiEncode(abi: Abi, inputs: InputMap, return_value?: InputValue | null): WitnessMap;
4
+ export function abiDecode(abi: Abi, witness_map: WitnessMap): any;
5
+ export function serializeWitness(witness_map: WitnessMap): Uint8Array;
6
+ export function abiDecodeError(abi: Abi, raw_error: RawAssertionPayload): any;
3
7
 
4
8
  export type ABIError = Error;
5
9
 
@@ -10,51 +14,42 @@ export { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, A
10
14
 
11
15
 
12
16
 
13
- export function abiDecode(abi: Abi, witness_map: WitnessMap): any;
14
-
15
- export function abiDecodeError(abi: Abi, raw_error: RawAssertionPayload): any;
16
-
17
- export function abiEncode(abi: Abi, inputs: InputMap, return_value?: InputValue | null): WitnessMap;
18
-
19
- export function serializeWitness(witness_map: WitnessMap): Uint8Array;
20
-
21
17
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
22
18
 
23
19
  export interface InitOutput {
24
- readonly memory: WebAssembly.Memory;
25
- readonly abiEncode: (a: any, b: any, c: number) => [number, number, number];
26
- readonly abiDecode: (a: any, b: any) => [number, number, number];
27
- readonly serializeWitness: (a: any) => [number, number, number, number];
28
- readonly abiDecodeError: (a: any, b: any) => [number, number, number];
29
- readonly wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2: (a: number, b: number, c: any, d: any) => void;
30
- readonly __wbindgen_malloc: (a: number, b: number) => number;
31
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
32
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
33
- readonly __wbindgen_exn_store: (a: number) => void;
34
- readonly __externref_table_alloc: () => number;
35
- readonly __wbindgen_externrefs: WebAssembly.Table;
36
- readonly __externref_table_dealloc: (a: number) => void;
37
- readonly __wbindgen_start: () => void;
20
+ readonly memory: WebAssembly.Memory;
21
+ readonly abiEncode: (a: any, b: any, c: number) => [number, number, number];
22
+ readonly abiDecode: (a: any, b: any) => [number, number, number];
23
+ readonly serializeWitness: (a: any) => [number, number, number, number];
24
+ readonly abiDecodeError: (a: any, b: any) => [number, number, number];
25
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
26
+ readonly __wbindgen_exn_store: (a: number) => void;
27
+ readonly __externref_table_alloc: () => number;
28
+ readonly __wbindgen_export_3: WebAssembly.Table;
29
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
30
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
31
+ readonly __externref_table_dealloc: (a: number) => void;
32
+ readonly closure188_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
+ readonly __wbindgen_start: () => void;
38
34
  }
39
35
 
40
36
  export type SyncInitInput = BufferSource | WebAssembly.Module;
41
-
42
37
  /**
43
- * Instantiates the given `module`, which can either be bytes or
44
- * a precompiled `WebAssembly.Module`.
45
- *
46
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
47
- *
48
- * @returns {InitOutput}
49
- */
38
+ * Instantiates the given `module`, which can either be bytes or
39
+ * a precompiled `WebAssembly.Module`.
40
+ *
41
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
42
+ *
43
+ * @returns {InitOutput}
44
+ */
50
45
  export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
51
46
 
52
47
  /**
53
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
54
- * for everything else, calls `WebAssembly.instantiate` directly.
55
- *
56
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
57
- *
58
- * @returns {Promise<InitOutput>}
59
- */
48
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
49
+ * for everything else, calls `WebAssembly.instantiate` directly.
50
+ *
51
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
52
+ *
53
+ * @returns {Promise<InitOutput>}
54
+ */
60
55
  export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -1,204 +1,29 @@
1
- /* @ts-self-types="./noirc_abi_wasm.d.ts" */
1
+ let wasm;
2
2
 
3
- /**
4
- * @param {Abi} abi
5
- * @param {WitnessMap} witness_map
6
- * @returns {any}
7
- */
8
- export function abiDecode(abi, witness_map) {
9
- const ret = wasm.abiDecode(abi, witness_map);
10
- if (ret[2]) {
11
- throw takeFromExternrefTable0(ret[1]);
12
- }
13
- return takeFromExternrefTable0(ret[0]);
14
- }
3
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
15
4
 
16
- /**
17
- * @param {Abi} abi
18
- * @param {RawAssertionPayload} raw_error
19
- * @returns {any}
20
- */
21
- export function abiDecodeError(abi, raw_error) {
22
- const ret = wasm.abiDecodeError(abi, raw_error);
23
- if (ret[2]) {
24
- throw takeFromExternrefTable0(ret[1]);
25
- }
26
- return takeFromExternrefTable0(ret[0]);
27
- }
5
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
28
6
 
29
- /**
30
- * @param {Abi} abi
31
- * @param {InputMap} inputs
32
- * @param {InputValue | null} [return_value]
33
- * @returns {WitnessMap}
34
- */
35
- export function abiEncode(abi, inputs, return_value) {
36
- const ret = wasm.abiEncode(abi, inputs, isLikeNone(return_value) ? 0 : addToExternrefTable0(return_value));
37
- if (ret[2]) {
38
- throw takeFromExternrefTable0(ret[1]);
39
- }
40
- return takeFromExternrefTable0(ret[0]);
41
- }
7
+ let cachedUint8ArrayMemory0 = null;
42
8
 
43
- /**
44
- * @param {WitnessMap} witness_map
45
- * @returns {Uint8Array}
46
- */
47
- export function serializeWitness(witness_map) {
48
- const ret = wasm.serializeWitness(witness_map);
49
- if (ret[3]) {
50
- throw takeFromExternrefTable0(ret[2]);
9
+ function getUint8ArrayMemory0() {
10
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
51
12
  }
52
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
53
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
54
- return v1;
55
- }
56
-
57
- function __wbg_get_imports() {
58
- const import0 = {
59
- __proto__: null,
60
- __wbg___wbindgen_is_undefined_c18285b9fc34cb7d: function(arg0) {
61
- const ret = arg0 === undefined;
62
- return ret;
63
- },
64
- __wbg___wbindgen_number_get_5854912275df1894: function(arg0, arg1) {
65
- const obj = arg1;
66
- const ret = typeof(obj) === 'number' ? obj : undefined;
67
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
68
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
69
- },
70
- __wbg___wbindgen_string_get_3e5751597f39a112: function(arg0, arg1) {
71
- const obj = arg1;
72
- const ret = typeof(obj) === 'string' ? obj : undefined;
73
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
74
- var len1 = WASM_VECTOR_LEN;
75
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
76
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
77
- },
78
- __wbg___wbindgen_throw_39bc967c0e5a9b58: function(arg0, arg1) {
79
- throw new Error(getStringFromWasm0(arg0, arg1));
80
- },
81
- __wbg_constructor_1ff9b184f5d0565b: function(arg0) {
82
- const ret = new Error(arg0);
83
- return ret;
84
- },
85
- __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
86
- let deferred0_0;
87
- let deferred0_1;
88
- try {
89
- deferred0_0 = arg0;
90
- deferred0_1 = arg1;
91
- console.error(getStringFromWasm0(arg0, arg1));
92
- } finally {
93
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
94
- }
95
- },
96
- __wbg_forEach_9694464cb60ea370: function(arg0, arg1, arg2) {
97
- try {
98
- var state0 = {a: arg1, b: arg2};
99
- var cb0 = (arg0, arg1) => {
100
- const a = state0.a;
101
- state0.a = 0;
102
- try {
103
- return wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(a, state0.b, arg0, arg1);
104
- } finally {
105
- state0.a = a;
106
- }
107
- };
108
- arg0.forEach(cb0);
109
- } finally {
110
- state0.a = state0.b = 0;
111
- }
112
- },
113
- __wbg_new_1390430ba54bf329: function() {
114
- const ret = new Map();
115
- return ret;
116
- },
117
- __wbg_new_227d7c05414eb861: function() {
118
- const ret = new Error();
119
- return ret;
120
- },
121
- __wbg_parse_6dfe891b5bafb5cd: function() { return handleError(function (arg0, arg1) {
122
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
123
- return ret;
124
- }, arguments); },
125
- __wbg_set_cfc6de03f990decf: function(arg0, arg1, arg2) {
126
- const ret = arg0.set(arg1, arg2);
127
- return ret;
128
- },
129
- __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
130
- const ret = arg1.stack;
131
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
132
- const len1 = WASM_VECTOR_LEN;
133
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
134
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
135
- },
136
- __wbg_stringify_86f4ab954f88f382: function() { return handleError(function (arg0) {
137
- const ret = JSON.stringify(arg0);
138
- return ret;
139
- }, arguments); },
140
- __wbindgen_cast_0000000000000001: function(arg0) {
141
- // Cast intrinsic for `F64 -> Externref`.
142
- const ret = arg0;
143
- return ret;
144
- },
145
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
146
- // Cast intrinsic for `Ref(String) -> Externref`.
147
- const ret = getStringFromWasm0(arg0, arg1);
148
- return ret;
149
- },
150
- __wbindgen_init_externref_table: function() {
151
- const table = wasm.__wbindgen_externrefs;
152
- const offset = table.grow(4);
153
- table.set(0, undefined);
154
- table.set(offset + 0, undefined);
155
- table.set(offset + 1, null);
156
- table.set(offset + 2, true);
157
- table.set(offset + 3, false);
158
- },
159
- };
160
- return {
161
- __proto__: null,
162
- "./noirc_abi_wasm_bg.js": import0,
163
- };
13
+ return cachedUint8ArrayMemory0;
164
14
  }
165
15
 
166
- function wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(arg0, arg1, arg2, arg3) {
167
- wasm.wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(arg0, arg1, arg2, arg3);
16
+ function getStringFromWasm0(ptr, len) {
17
+ ptr = ptr >>> 0;
18
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
168
19
  }
169
20
 
170
21
  function addToExternrefTable0(obj) {
171
22
  const idx = wasm.__externref_table_alloc();
172
- wasm.__wbindgen_externrefs.set(idx, obj);
23
+ wasm.__wbindgen_export_3.set(idx, obj);
173
24
  return idx;
174
25
  }
175
26
 
176
- function getArrayU8FromWasm0(ptr, len) {
177
- ptr = ptr >>> 0;
178
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
179
- }
180
-
181
- let cachedDataViewMemory0 = null;
182
- function getDataViewMemory0() {
183
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
184
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
185
- }
186
- return cachedDataViewMemory0;
187
- }
188
-
189
- function getStringFromWasm0(ptr, len) {
190
- ptr = ptr >>> 0;
191
- return decodeText(ptr, len);
192
- }
193
-
194
- let cachedUint8ArrayMemory0 = null;
195
- function getUint8ArrayMemory0() {
196
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
197
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
198
- }
199
- return cachedUint8ArrayMemory0;
200
- }
201
-
202
27
  function handleError(f, args) {
203
28
  try {
204
29
  return f.apply(this, args);
@@ -208,11 +33,25 @@ function handleError(f, args) {
208
33
  }
209
34
  }
210
35
 
211
- function isLikeNone(x) {
212
- return x === undefined || x === null;
36
+ let WASM_VECTOR_LEN = 0;
37
+
38
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
39
+
40
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
41
+ ? function (arg, view) {
42
+ return cachedTextEncoder.encodeInto(arg, view);
213
43
  }
44
+ : function (arg, view) {
45
+ const buf = cachedTextEncoder.encode(arg);
46
+ view.set(buf);
47
+ return {
48
+ read: arg.length,
49
+ written: buf.length
50
+ };
51
+ });
214
52
 
215
53
  function passStringToWasm0(arg, malloc, realloc) {
54
+
216
55
  if (realloc === undefined) {
217
56
  const buf = cachedTextEncoder.encode(arg);
218
57
  const ptr = malloc(buf.length, 1) >>> 0;
@@ -233,13 +72,14 @@ function passStringToWasm0(arg, malloc, realloc) {
233
72
  if (code > 0x7F) break;
234
73
  mem[ptr + offset] = code;
235
74
  }
75
+
236
76
  if (offset !== len) {
237
77
  if (offset !== 0) {
238
78
  arg = arg.slice(offset);
239
79
  }
240
80
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
241
81
  const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
242
- const ret = cachedTextEncoder.encodeInto(arg, view);
82
+ const ret = encodeString(arg, view);
243
83
 
244
84
  offset += ret.written;
245
85
  ptr = realloc(ptr, len, offset, 1) >>> 0;
@@ -249,49 +89,84 @@ function passStringToWasm0(arg, malloc, realloc) {
249
89
  return ptr;
250
90
  }
251
91
 
92
+ let cachedDataViewMemory0 = null;
93
+
94
+ function getDataViewMemory0() {
95
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
96
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
97
+ }
98
+ return cachedDataViewMemory0;
99
+ }
100
+
101
+ function isLikeNone(x) {
102
+ return x === undefined || x === null;
103
+ }
104
+
252
105
  function takeFromExternrefTable0(idx) {
253
- const value = wasm.__wbindgen_externrefs.get(idx);
106
+ const value = wasm.__wbindgen_export_3.get(idx);
254
107
  wasm.__externref_table_dealloc(idx);
255
108
  return value;
256
109
  }
257
-
258
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
259
- cachedTextDecoder.decode();
260
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
261
- let numBytesDecoded = 0;
262
- function decodeText(ptr, len) {
263
- numBytesDecoded += len;
264
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
265
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
266
- cachedTextDecoder.decode();
267
- numBytesDecoded = len;
110
+ /**
111
+ * @param {Abi} abi
112
+ * @param {InputMap} inputs
113
+ * @param {InputValue | null} [return_value]
114
+ * @returns {WitnessMap}
115
+ */
116
+ export function abiEncode(abi, inputs, return_value) {
117
+ const ret = wasm.abiEncode(abi, inputs, isLikeNone(return_value) ? 0 : addToExternrefTable0(return_value));
118
+ if (ret[2]) {
119
+ throw takeFromExternrefTable0(ret[1]);
268
120
  }
269
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
121
+ return takeFromExternrefTable0(ret[0]);
270
122
  }
271
123
 
272
- const cachedTextEncoder = new TextEncoder();
124
+ /**
125
+ * @param {Abi} abi
126
+ * @param {WitnessMap} witness_map
127
+ * @returns {any}
128
+ */
129
+ export function abiDecode(abi, witness_map) {
130
+ const ret = wasm.abiDecode(abi, witness_map);
131
+ if (ret[2]) {
132
+ throw takeFromExternrefTable0(ret[1]);
133
+ }
134
+ return takeFromExternrefTable0(ret[0]);
135
+ }
273
136
 
274
- if (!('encodeInto' in cachedTextEncoder)) {
275
- cachedTextEncoder.encodeInto = function (arg, view) {
276
- const buf = cachedTextEncoder.encode(arg);
277
- view.set(buf);
278
- return {
279
- read: arg.length,
280
- written: buf.length
281
- };
282
- };
137
+ function getArrayU8FromWasm0(ptr, len) {
138
+ ptr = ptr >>> 0;
139
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
140
+ }
141
+ /**
142
+ * @param {WitnessMap} witness_map
143
+ * @returns {Uint8Array}
144
+ */
145
+ export function serializeWitness(witness_map) {
146
+ const ret = wasm.serializeWitness(witness_map);
147
+ if (ret[3]) {
148
+ throw takeFromExternrefTable0(ret[2]);
149
+ }
150
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
151
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
152
+ return v1;
283
153
  }
284
154
 
285
- let WASM_VECTOR_LEN = 0;
155
+ /**
156
+ * @param {Abi} abi
157
+ * @param {RawAssertionPayload} raw_error
158
+ * @returns {any}
159
+ */
160
+ export function abiDecodeError(abi, raw_error) {
161
+ const ret = wasm.abiDecodeError(abi, raw_error);
162
+ if (ret[2]) {
163
+ throw takeFromExternrefTable0(ret[1]);
164
+ }
165
+ return takeFromExternrefTable0(ret[0]);
166
+ }
286
167
 
287
- let wasmModule, wasm;
288
- function __wbg_finalize_init(instance, module) {
289
- wasm = instance.exports;
290
- wasmModule = module;
291
- cachedDataViewMemory0 = null;
292
- cachedUint8ArrayMemory0 = null;
293
- wasm.__wbindgen_start();
294
- return wasm;
168
+ function __wbg_adapter_30(arg0, arg1, arg2, arg3) {
169
+ wasm.closure188_externref_shim(arg0, arg1, arg2, arg3);
295
170
  }
296
171
 
297
172
  async function __wbg_load(module, imports) {
@@ -299,41 +174,157 @@ async function __wbg_load(module, imports) {
299
174
  if (typeof WebAssembly.instantiateStreaming === 'function') {
300
175
  try {
301
176
  return await WebAssembly.instantiateStreaming(module, imports);
302
- } catch (e) {
303
- const validResponse = module.ok && expectedResponseType(module.type);
304
177
 
305
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
178
+ } catch (e) {
179
+ if (module.headers.get('Content-Type') != 'application/wasm') {
306
180
  console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
307
181
 
308
- } else { throw e; }
182
+ } else {
183
+ throw e;
184
+ }
309
185
  }
310
186
  }
311
187
 
312
188
  const bytes = await module.arrayBuffer();
313
189
  return await WebAssembly.instantiate(bytes, imports);
190
+
314
191
  } else {
315
192
  const instance = await WebAssembly.instantiate(module, imports);
316
193
 
317
194
  if (instance instanceof WebAssembly.Instance) {
318
195
  return { instance, module };
196
+
319
197
  } else {
320
198
  return instance;
321
199
  }
322
200
  }
201
+ }
323
202
 
324
- function expectedResponseType(type) {
325
- switch (type) {
326
- case 'basic': case 'cors': case 'default': return true;
203
+ function __wbg_get_imports() {
204
+ const imports = {};
205
+ imports.wbg = {};
206
+ imports.wbg.__wbg_constructor_3592dabf8a4edaea = function(arg0) {
207
+ const ret = new Error(arg0);
208
+ return ret;
209
+ };
210
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
211
+ let deferred0_0;
212
+ let deferred0_1;
213
+ try {
214
+ deferred0_0 = arg0;
215
+ deferred0_1 = arg1;
216
+ console.error(getStringFromWasm0(arg0, arg1));
217
+ } finally {
218
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
327
219
  }
328
- return false;
329
- }
220
+ };
221
+ imports.wbg.__wbg_forEach_e1cf6f7c8ecb7dae = function(arg0, arg1, arg2) {
222
+ try {
223
+ var state0 = {a: arg1, b: arg2};
224
+ var cb0 = (arg0, arg1) => {
225
+ const a = state0.a;
226
+ state0.a = 0;
227
+ try {
228
+ return __wbg_adapter_30(a, state0.b, arg0, arg1);
229
+ } finally {
230
+ state0.a = a;
231
+ }
232
+ };
233
+ arg0.forEach(cb0);
234
+ } finally {
235
+ state0.a = state0.b = 0;
236
+ }
237
+ };
238
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
239
+ const ret = new Error();
240
+ return ret;
241
+ };
242
+ imports.wbg.__wbg_new_dc2902000358ae4d = function() {
243
+ const ret = new Map();
244
+ return ret;
245
+ };
246
+ imports.wbg.__wbg_parse_def2e24ef1252aff = function() { return handleError(function (arg0, arg1) {
247
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
248
+ return ret;
249
+ }, arguments) };
250
+ imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
251
+ const ret = arg0.set(arg1, arg2);
252
+ return ret;
253
+ };
254
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
255
+ const ret = arg1.stack;
256
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
257
+ const len1 = WASM_VECTOR_LEN;
258
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
259
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
260
+ };
261
+ imports.wbg.__wbg_stringify_f7ed6987935b4a24 = function() { return handleError(function (arg0) {
262
+ const ret = JSON.stringify(arg0);
263
+ return ret;
264
+ }, arguments) };
265
+ imports.wbg.__wbindgen_init_externref_table = function() {
266
+ const table = wasm.__wbindgen_export_3;
267
+ const offset = table.grow(4);
268
+ table.set(0, undefined);
269
+ table.set(offset + 0, undefined);
270
+ table.set(offset + 1, null);
271
+ table.set(offset + 2, true);
272
+ table.set(offset + 3, false);
273
+ ;
274
+ };
275
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
276
+ const ret = arg0 === undefined;
277
+ return ret;
278
+ };
279
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
280
+ const obj = arg1;
281
+ const ret = typeof(obj) === 'number' ? obj : undefined;
282
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
283
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
284
+ };
285
+ imports.wbg.__wbindgen_number_new = function(arg0) {
286
+ const ret = arg0;
287
+ return ret;
288
+ };
289
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
290
+ const obj = arg1;
291
+ const ret = typeof(obj) === 'string' ? obj : undefined;
292
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
293
+ var len1 = WASM_VECTOR_LEN;
294
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
295
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
296
+ };
297
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
298
+ const ret = getStringFromWasm0(arg0, arg1);
299
+ return ret;
300
+ };
301
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
302
+ throw new Error(getStringFromWasm0(arg0, arg1));
303
+ };
304
+
305
+ return imports;
306
+ }
307
+
308
+ function __wbg_init_memory(imports, memory) {
309
+
310
+ }
311
+
312
+ function __wbg_finalize_init(instance, module) {
313
+ wasm = instance.exports;
314
+ __wbg_init.__wbindgen_wasm_module = module;
315
+ cachedDataViewMemory0 = null;
316
+ cachedUint8ArrayMemory0 = null;
317
+
318
+
319
+ wasm.__wbindgen_start();
320
+ return wasm;
330
321
  }
331
322
 
332
323
  function initSync(module) {
333
324
  if (wasm !== undefined) return wasm;
334
325
 
335
326
 
336
- if (module !== undefined) {
327
+ if (typeof module !== 'undefined') {
337
328
  if (Object.getPrototypeOf(module) === Object.prototype) {
338
329
  ({module} = module)
339
330
  } else {
@@ -342,10 +333,15 @@ function initSync(module) {
342
333
  }
343
334
 
344
335
  const imports = __wbg_get_imports();
336
+
337
+ __wbg_init_memory(imports);
338
+
345
339
  if (!(module instanceof WebAssembly.Module)) {
346
340
  module = new WebAssembly.Module(module);
347
341
  }
342
+
348
343
  const instance = new WebAssembly.Instance(module, imports);
344
+
349
345
  return __wbg_finalize_init(instance, module);
350
346
  }
351
347
 
@@ -353,7 +349,7 @@ async function __wbg_init(module_or_path) {
353
349
  if (wasm !== undefined) return wasm;
354
350
 
355
351
 
356
- if (module_or_path !== undefined) {
352
+ if (typeof module_or_path !== 'undefined') {
357
353
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
358
354
  ({module_or_path} = module_or_path)
359
355
  } else {
@@ -361,7 +357,7 @@ async function __wbg_init(module_or_path) {
361
357
  }
362
358
  }
363
359
 
364
- if (module_or_path === undefined) {
360
+ if (typeof module_or_path === 'undefined') {
365
361
  module_or_path = new URL('noirc_abi_wasm_bg.wasm', import.meta.url);
366
362
  }
367
363
  const imports = __wbg_get_imports();
@@ -370,9 +366,12 @@ async function __wbg_init(module_or_path) {
370
366
  module_or_path = fetch(module_or_path);
371
367
  }
372
368
 
369
+ __wbg_init_memory(imports);
370
+
373
371
  const { instance, module } = await __wbg_load(await module_or_path, imports);
374
372
 
375
373
  return __wbg_finalize_init(instance, module);
376
374
  }
377
375
 
378
- export { initSync, __wbg_init as default };
376
+ export { initSync };
377
+ export default __wbg_init;
Binary file
@@ -5,12 +5,12 @@ export const abiEncode: (a: any, b: any, c: number) => [number, number, number];
5
5
  export const abiDecode: (a: any, b: any) => [number, number, number];
6
6
  export const serializeWitness: (a: any) => [number, number, number, number];
7
7
  export const abiDecodeError: (a: any, b: any) => [number, number, number];
8
- export const wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2: (a: number, b: number, c: any, d: any) => void;
9
- export const __wbindgen_malloc: (a: number, b: number) => number;
10
- export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
11
8
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
12
9
  export const __wbindgen_exn_store: (a: number) => void;
13
10
  export const __externref_table_alloc: () => number;
14
- export const __wbindgen_externrefs: WebAssembly.Table;
11
+ export const __wbindgen_export_3: WebAssembly.Table;
12
+ export const __wbindgen_malloc: (a: number, b: number) => number;
13
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
15
14
  export const __externref_table_dealloc: (a: number) => void;
15
+ export const closure188_externref_shim: (a: number, b: number, c: any, d: any) => void;
16
16
  export const __wbindgen_start: () => void;