@aztec/noir-noirc_abi 0.0.1-commit.ff7989d6c → 0.0.1-commit.ffe5b04ea

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,9 +1,5 @@
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;
7
3
 
8
4
  export type ABIError = Error;
9
5
 
@@ -13,3 +9,11 @@ import { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, A
13
9
  export { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, Abi, WitnessMap, RawAssertionPayload } from "@aztec/noir-types";
14
10
 
15
11
 
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,33 +1,208 @@
1
+ /* @ts-self-types="./noirc_abi_wasm.d.ts" */
1
2
 
2
- let imports = {};
3
- imports['__wbindgen_placeholder__'] = module.exports;
4
- let wasm;
5
- const { TextDecoder, TextEncoder } = require(`util`);
6
-
7
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
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;
8
16
 
9
- cachedTextDecoder.decode();
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;
10
30
 
11
- let cachedUint8ArrayMemory0 = null;
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;
12
45
 
13
- function getUint8ArrayMemory0() {
14
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
15
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
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]);
16
54
  }
17
- return cachedUint8ArrayMemory0;
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
+ };
18
168
  }
19
169
 
20
- function getStringFromWasm0(ptr, len) {
21
- ptr = ptr >>> 0;
22
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
170
+ function wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(arg0, arg1, arg2, arg3) {
171
+ wasm.wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(arg0, arg1, arg2, arg3);
23
172
  }
24
173
 
25
174
  function addToExternrefTable0(obj) {
26
175
  const idx = wasm.__externref_table_alloc();
27
- wasm.__wbindgen_export_3.set(idx, obj);
176
+ wasm.__wbindgen_externrefs.set(idx, obj);
28
177
  return idx;
29
178
  }
30
179
 
180
+ function getArrayU8FromWasm0(ptr, len) {
181
+ ptr = ptr >>> 0;
182
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
183
+ }
184
+
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);
189
+ }
190
+ return cachedDataViewMemory0;
191
+ }
192
+
193
+ function getStringFromWasm0(ptr, len) {
194
+ ptr = ptr >>> 0;
195
+ return decodeText(ptr, len);
196
+ }
197
+
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;
204
+ }
205
+
31
206
  function handleError(f, args) {
32
207
  try {
33
208
  return f.apply(this, args);
@@ -37,25 +212,11 @@ function handleError(f, args) {
37
212
  }
38
213
  }
39
214
 
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);
215
+ function isLikeNone(x) {
216
+ return x === undefined || x === null;
47
217
  }
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
- });
56
218
 
57
219
  function passStringToWasm0(arg, malloc, realloc) {
58
-
59
220
  if (realloc === undefined) {
60
221
  const buf = cachedTextEncoder.encode(arg);
61
222
  const ptr = malloc(buf.length, 1) >>> 0;
@@ -76,14 +237,13 @@ function passStringToWasm0(arg, malloc, realloc) {
76
237
  if (code > 0x7F) break;
77
238
  mem[ptr + offset] = code;
78
239
  }
79
-
80
240
  if (offset !== len) {
81
241
  if (offset !== 0) {
82
242
  arg = arg.slice(offset);
83
243
  }
84
244
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
85
245
  const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
86
- const ret = encodeString(arg, view);
246
+ const ret = cachedTextEncoder.encodeInto(arg, view);
87
247
 
88
248
  offset += ret.written;
89
249
  ptr = realloc(ptr, len, offset, 1) >>> 0;
@@ -93,207 +253,35 @@ function passStringToWasm0(arg, malloc, realloc) {
93
253
  return ptr;
94
254
  }
95
255
 
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
-
109
256
  function takeFromExternrefTable0(idx) {
110
- const value = wasm.__wbindgen_export_3.get(idx);
257
+ const value = wasm.__wbindgen_externrefs.get(idx);
111
258
  wasm.__externref_table_dealloc(idx);
112
259
  return value;
113
260
  }
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
- };
127
-
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
261
 
141
- function getArrayU8FromWasm0(ptr, len) {
142
- ptr = ptr >>> 0;
143
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
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
- };
158
-
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
- };
171
-
172
- function __wbg_adapter_30(arg0, arg1, arg2, arg3) {
173
- wasm.closure188_externref_shim(arg0, arg1, arg2, arg3);
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));
174
266
  }
175
267
 
176
- module.exports.__wbg_constructor_ed9503ce5bc87935 = 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
- };
268
+ const cachedTextEncoder = new TextEncoder();
192
269
 
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
- }
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
204
277
  };
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_c3abe73bba3e4945 = 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);
278
+ };
279
+ }
292
280
 
293
- const wasmModule = new WebAssembly.Module(bytes);
294
- const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
295
- wasm = wasmInstance.exports;
296
- module.exports.__wasm = wasm;
281
+ let WASM_VECTOR_LEN = 0;
297
282
 
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;
298
287
  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;
8
11
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
9
12
  export const __wbindgen_exn_store: (a: number) => void;
10
13
  export const __externref_table_alloc: () => number;
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;
14
+ export const __wbindgen_externrefs: WebAssembly.Table;
14
15
  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.ff7989d6c",
6
+ "version": "0.0.1-commit.ffe5b04ea",
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.ff7989d6c"
39
+ "@aztec/noir-types": "0.0.1-commit.ffe5b04ea"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@esm-bundle/chai": "^4.3.4-fix.0",
43
43
  "@web/dev-server-esbuild": "^1.0.5",
44
44
  "@web/test-runner": "^0.20.2",
45
45
  "@web/test-runner-playwright": "^0.11.1",
46
- "eslint": "^10.0.0",
46
+ "eslint": "^10.0.2",
47
47
  "mocha": "^11.7.5"
48
48
  }
49
49
  }
@@ -1,9 +1,5 @@
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;
7
3
 
8
4
  export type ABIError = Error;
9
5
 
@@ -14,42 +10,51 @@ export { Field, InputValue, InputMap, Visibility, Sign, AbiType, AbiParameter, A
14
10
 
15
11
 
16
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;
20
+
17
21
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
18
22
 
19
23
  export interface InitOutput {
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;
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;
34
38
  }
35
39
 
36
40
  export type SyncInitInput = BufferSource | WebAssembly.Module;
41
+
37
42
  /**
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
- */
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
+ */
45
50
  export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
46
51
 
47
52
  /**
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
- */
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
+ */
55
60
  export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -1,29 +1,204 @@
1
- let wasm;
1
+ /* @ts-self-types="./noirc_abi_wasm.d.ts" */
2
2
 
3
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
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
+ }
4
15
 
5
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
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
+ }
6
28
 
7
- let cachedUint8ArrayMemory0 = null;
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
+ }
8
42
 
9
- function getUint8ArrayMemory0() {
10
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
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]);
12
51
  }
13
- return cachedUint8ArrayMemory0;
52
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
53
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
54
+ return v1;
14
55
  }
15
56
 
16
- function getStringFromWasm0(ptr, len) {
17
- ptr = ptr >>> 0;
18
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
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
+ };
164
+ }
165
+
166
+ function wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(arg0, arg1, arg2, arg3) {
167
+ wasm.wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(arg0, arg1, arg2, arg3);
19
168
  }
20
169
 
21
170
  function addToExternrefTable0(obj) {
22
171
  const idx = wasm.__externref_table_alloc();
23
- wasm.__wbindgen_export_3.set(idx, obj);
172
+ wasm.__wbindgen_externrefs.set(idx, obj);
24
173
  return idx;
25
174
  }
26
175
 
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
+
27
202
  function handleError(f, args) {
28
203
  try {
29
204
  return f.apply(this, args);
@@ -33,25 +208,11 @@ function handleError(f, args) {
33
208
  }
34
209
  }
35
210
 
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);
211
+ function isLikeNone(x) {
212
+ return x === undefined || x === null;
43
213
  }
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
- });
52
214
 
53
215
  function passStringToWasm0(arg, malloc, realloc) {
54
-
55
216
  if (realloc === undefined) {
56
217
  const buf = cachedTextEncoder.encode(arg);
57
218
  const ptr = malloc(buf.length, 1) >>> 0;
@@ -72,14 +233,13 @@ function passStringToWasm0(arg, malloc, realloc) {
72
233
  if (code > 0x7F) break;
73
234
  mem[ptr + offset] = code;
74
235
  }
75
-
76
236
  if (offset !== len) {
77
237
  if (offset !== 0) {
78
238
  arg = arg.slice(offset);
79
239
  }
80
240
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
81
241
  const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
82
- const ret = encodeString(arg, view);
242
+ const ret = cachedTextEncoder.encodeInto(arg, view);
83
243
 
84
244
  offset += ret.written;
85
245
  ptr = realloc(ptr, len, offset, 1) >>> 0;
@@ -89,84 +249,49 @@ function passStringToWasm0(arg, malloc, realloc) {
89
249
  return ptr;
90
250
  }
91
251
 
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
-
105
252
  function takeFromExternrefTable0(idx) {
106
- const value = wasm.__wbindgen_export_3.get(idx);
253
+ const value = wasm.__wbindgen_externrefs.get(idx);
107
254
  wasm.__externref_table_dealloc(idx);
108
255
  return value;
109
256
  }
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]);
120
- }
121
- return takeFromExternrefTable0(ret[0]);
122
- }
123
257
 
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]);
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;
133
268
  }
134
- return takeFromExternrefTable0(ret[0]);
269
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
135
270
  }
136
271
 
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;
153
- }
272
+ const cachedTextEncoder = new TextEncoder();
154
273
 
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]);
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
+ };
166
283
  }
167
284
 
168
- function __wbg_adapter_30(arg0, arg1, arg2, arg3) {
169
- wasm.closure188_externref_shim(arg0, arg1, arg2, arg3);
285
+ let WASM_VECTOR_LEN = 0;
286
+
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;
170
295
  }
171
296
 
172
297
  async function __wbg_load(module, imports) {
@@ -174,157 +299,41 @@ async function __wbg_load(module, imports) {
174
299
  if (typeof WebAssembly.instantiateStreaming === 'function') {
175
300
  try {
176
301
  return await WebAssembly.instantiateStreaming(module, imports);
177
-
178
302
  } catch (e) {
179
- if (module.headers.get('Content-Type') != 'application/wasm') {
303
+ const validResponse = module.ok && expectedResponseType(module.type);
304
+
305
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
180
306
  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);
181
307
 
182
- } else {
183
- throw e;
184
- }
308
+ } else { throw e; }
185
309
  }
186
310
  }
187
311
 
188
312
  const bytes = await module.arrayBuffer();
189
313
  return await WebAssembly.instantiate(bytes, imports);
190
-
191
314
  } else {
192
315
  const instance = await WebAssembly.instantiate(module, imports);
193
316
 
194
317
  if (instance instanceof WebAssembly.Instance) {
195
318
  return { instance, module };
196
-
197
319
  } else {
198
320
  return instance;
199
321
  }
200
322
  }
201
- }
202
323
 
203
- function __wbg_get_imports() {
204
- const imports = {};
205
- imports.wbg = {};
206
- imports.wbg.__wbg_constructor_ed9503ce5bc87935 = 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);
324
+ function expectedResponseType(type) {
325
+ switch (type) {
326
+ case 'basic': case 'cors': case 'default': return true;
219
327
  }
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_c3abe73bba3e4945 = 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;
328
+ return false;
329
+ }
321
330
  }
322
331
 
323
332
  function initSync(module) {
324
333
  if (wasm !== undefined) return wasm;
325
334
 
326
335
 
327
- if (typeof module !== 'undefined') {
336
+ if (module !== undefined) {
328
337
  if (Object.getPrototypeOf(module) === Object.prototype) {
329
338
  ({module} = module)
330
339
  } else {
@@ -333,15 +342,10 @@ function initSync(module) {
333
342
  }
334
343
 
335
344
  const imports = __wbg_get_imports();
336
-
337
- __wbg_init_memory(imports);
338
-
339
345
  if (!(module instanceof WebAssembly.Module)) {
340
346
  module = new WebAssembly.Module(module);
341
347
  }
342
-
343
348
  const instance = new WebAssembly.Instance(module, imports);
344
-
345
349
  return __wbg_finalize_init(instance, module);
346
350
  }
347
351
 
@@ -349,7 +353,7 @@ async function __wbg_init(module_or_path) {
349
353
  if (wasm !== undefined) return wasm;
350
354
 
351
355
 
352
- if (typeof module_or_path !== 'undefined') {
356
+ if (module_or_path !== undefined) {
353
357
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
354
358
  ({module_or_path} = module_or_path)
355
359
  } else {
@@ -357,7 +361,7 @@ async function __wbg_init(module_or_path) {
357
361
  }
358
362
  }
359
363
 
360
- if (typeof module_or_path === 'undefined') {
364
+ if (module_or_path === undefined) {
361
365
  module_or_path = new URL('noirc_abi_wasm_bg.wasm', import.meta.url);
362
366
  }
363
367
  const imports = __wbg_get_imports();
@@ -366,12 +370,9 @@ async function __wbg_init(module_or_path) {
366
370
  module_or_path = fetch(module_or_path);
367
371
  }
368
372
 
369
- __wbg_init_memory(imports);
370
-
371
373
  const { instance, module } = await __wbg_load(await module_or_path, imports);
372
374
 
373
375
  return __wbg_finalize_init(instance, module);
374
376
  }
375
377
 
376
- export { initSync };
377
- export default __wbg_init;
378
+ export { initSync, __wbg_init as default };
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;
8
11
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
9
12
  export const __wbindgen_exn_store: (a: number) => void;
10
13
  export const __externref_table_alloc: () => number;
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;
14
+ export const __wbindgen_externrefs: WebAssembly.Table;
14
15
  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;