@aztec/noir-acvm_js 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.
- package/nodejs/acvm_js.d.ts +120 -102
- package/nodejs/acvm_js.js +664 -705
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +12 -11
- package/package.json +2 -2
- package/web/acvm_js.d.ts +167 -147
- package/web/acvm_js.js +682 -682
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +12 -11
package/nodejs/acvm_js.js
CHANGED
|
@@ -1,224 +1,49 @@
|
|
|
1
|
+
/* @ts-self-types="./acvm_js.d.ts" */
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
wasm.
|
|
10
|
-
return
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function handleError(f, args) {
|
|
14
|
-
try {
|
|
15
|
-
return f.apply(this, args);
|
|
16
|
-
} catch (e) {
|
|
17
|
-
const idx = addToExternrefTable0(e);
|
|
18
|
-
wasm.__wbindgen_exn_store(idx);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
23
|
-
|
|
24
|
-
cachedTextDecoder.decode();
|
|
25
|
-
|
|
26
|
-
let cachedUint8ArrayMemory0 = null;
|
|
27
|
-
|
|
28
|
-
function getUint8ArrayMemory0() {
|
|
29
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
30
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
31
|
-
}
|
|
32
|
-
return cachedUint8ArrayMemory0;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function getStringFromWasm0(ptr, len) {
|
|
36
|
-
ptr = ptr >>> 0;
|
|
37
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
38
|
-
}
|
|
39
|
-
|
|
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);
|
|
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
|
-
});
|
|
56
|
-
|
|
57
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
58
|
-
|
|
59
|
-
if (realloc === undefined) {
|
|
60
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
61
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
62
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
63
|
-
WASM_VECTOR_LEN = buf.length;
|
|
64
|
-
return ptr;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
let len = arg.length;
|
|
68
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
69
|
-
|
|
70
|
-
const mem = getUint8ArrayMemory0();
|
|
71
|
-
|
|
72
|
-
let offset = 0;
|
|
73
|
-
|
|
74
|
-
for (; offset < len; offset++) {
|
|
75
|
-
const code = arg.charCodeAt(offset);
|
|
76
|
-
if (code > 0x7F) break;
|
|
77
|
-
mem[ptr + offset] = code;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (offset !== len) {
|
|
81
|
-
if (offset !== 0) {
|
|
82
|
-
arg = arg.slice(offset);
|
|
83
|
-
}
|
|
84
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
85
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
86
|
-
const ret = encodeString(arg, view);
|
|
87
|
-
|
|
88
|
-
offset += ret.written;
|
|
89
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
WASM_VECTOR_LEN = offset;
|
|
93
|
-
return ptr;
|
|
94
|
-
}
|
|
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
|
-
|
|
109
|
-
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
110
|
-
? { register: () => {}, unregister: () => {} }
|
|
111
|
-
: new FinalizationRegistry(state => {
|
|
112
|
-
wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b)
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
116
|
-
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
117
|
-
const real = (...args) => {
|
|
118
|
-
// First up with a closure we increment the internal reference
|
|
119
|
-
// count. This ensures that the Rust closure environment won't
|
|
120
|
-
// be deallocated while we're invoking it.
|
|
121
|
-
state.cnt++;
|
|
122
|
-
const a = state.a;
|
|
123
|
-
state.a = 0;
|
|
124
|
-
try {
|
|
125
|
-
return f(a, state.b, ...args);
|
|
126
|
-
} finally {
|
|
127
|
-
if (--state.cnt === 0) {
|
|
128
|
-
wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
|
|
129
|
-
CLOSURE_DTORS.unregister(state);
|
|
130
|
-
} else {
|
|
131
|
-
state.a = a;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
real.original = state;
|
|
136
|
-
CLOSURE_DTORS.register(real, state, state);
|
|
137
|
-
return real;
|
|
3
|
+
/**
|
|
4
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
5
|
+
* @param {string} lhs
|
|
6
|
+
* @param {string} rhs
|
|
7
|
+
* @returns {string}
|
|
8
|
+
*/
|
|
9
|
+
function and(lhs, rhs) {
|
|
10
|
+
const ret = wasm.and(lhs, rhs);
|
|
11
|
+
return ret;
|
|
138
12
|
}
|
|
13
|
+
exports.and = and;
|
|
139
14
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return 'Symbol';
|
|
153
|
-
} else {
|
|
154
|
-
return `Symbol(${description})`;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (type == 'function') {
|
|
158
|
-
const name = val.name;
|
|
159
|
-
if (typeof name == 'string' && name.length > 0) {
|
|
160
|
-
return `Function(${name})`;
|
|
161
|
-
} else {
|
|
162
|
-
return 'Function';
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
// objects
|
|
166
|
-
if (Array.isArray(val)) {
|
|
167
|
-
const length = val.length;
|
|
168
|
-
let debug = '[';
|
|
169
|
-
if (length > 0) {
|
|
170
|
-
debug += debugString(val[0]);
|
|
171
|
-
}
|
|
172
|
-
for(let i = 1; i < length; i++) {
|
|
173
|
-
debug += ', ' + debugString(val[i]);
|
|
174
|
-
}
|
|
175
|
-
debug += ']';
|
|
176
|
-
return debug;
|
|
177
|
-
}
|
|
178
|
-
// Test for built-in
|
|
179
|
-
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
180
|
-
let className;
|
|
181
|
-
if (builtInMatches && builtInMatches.length > 1) {
|
|
182
|
-
className = builtInMatches[1];
|
|
183
|
-
} else {
|
|
184
|
-
// Failed to match the standard '[object ClassName]'
|
|
185
|
-
return toString.call(val);
|
|
186
|
-
}
|
|
187
|
-
if (className == 'Object') {
|
|
188
|
-
// we're a user defined class or Object
|
|
189
|
-
// JSON.stringify avoids problems with cycles, and is generally much
|
|
190
|
-
// easier than looping through ownProperties of `val`.
|
|
191
|
-
try {
|
|
192
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
193
|
-
} catch (_) {
|
|
194
|
-
return 'Object';
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
// errors
|
|
198
|
-
if (val instanceof Error) {
|
|
199
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
200
|
-
}
|
|
201
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
202
|
-
return className;
|
|
15
|
+
/**
|
|
16
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
17
|
+
* @param {Uint8Array} inputs
|
|
18
|
+
* @returns {Uint8Array}
|
|
19
|
+
*/
|
|
20
|
+
function blake2s256(inputs) {
|
|
21
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
22
|
+
const len0 = WASM_VECTOR_LEN;
|
|
23
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
24
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
25
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
26
|
+
return v2;
|
|
203
27
|
}
|
|
28
|
+
exports.blake2s256 = blake2s256;
|
|
204
29
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
32
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
33
|
+
*/
|
|
34
|
+
function buildInfo() {
|
|
35
|
+
const ret = wasm.buildInfo();
|
|
36
|
+
return ret;
|
|
209
37
|
}
|
|
38
|
+
exports.buildInfo = buildInfo;
|
|
210
39
|
|
|
211
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
212
|
-
ptr = ptr >>> 0;
|
|
213
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
214
|
-
}
|
|
215
40
|
/**
|
|
216
41
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
217
42
|
*
|
|
218
43
|
* @param {WitnessMap} witness_map - A witness map.
|
|
219
44
|
* @returns {Uint8Array} A compressed witness map
|
|
220
45
|
*/
|
|
221
|
-
|
|
46
|
+
function compressWitness(witness_map) {
|
|
222
47
|
const ret = wasm.compressWitness(witness_map);
|
|
223
48
|
if (ret[3]) {
|
|
224
49
|
throw takeFromExternrefTable0(ret[2]);
|
|
@@ -226,14 +51,26 @@ module.exports.compressWitness = function(witness_map) {
|
|
|
226
51
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
227
52
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
228
53
|
return v1;
|
|
229
|
-
}
|
|
54
|
+
}
|
|
55
|
+
exports.compressWitness = compressWitness;
|
|
230
56
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
59
|
+
*
|
|
60
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
61
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
62
|
+
*/
|
|
63
|
+
function compressWitnessStack(witness_stack) {
|
|
64
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
65
|
+
if (ret[3]) {
|
|
66
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
67
|
+
}
|
|
68
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
69
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
70
|
+
return v1;
|
|
236
71
|
}
|
|
72
|
+
exports.compressWitnessStack = compressWitnessStack;
|
|
73
|
+
|
|
237
74
|
/**
|
|
238
75
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
239
76
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -241,7 +78,7 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
241
78
|
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
242
79
|
* @returns {WitnessMap} The decompressed witness map.
|
|
243
80
|
*/
|
|
244
|
-
|
|
81
|
+
function decompressWitness(compressed_witness) {
|
|
245
82
|
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
246
83
|
const len0 = WASM_VECTOR_LEN;
|
|
247
84
|
const ret = wasm.decompressWitness(ptr0, len0);
|
|
@@ -249,23 +86,8 @@ module.exports.decompressWitness = function(compressed_witness) {
|
|
|
249
86
|
throw takeFromExternrefTable0(ret[1]);
|
|
250
87
|
}
|
|
251
88
|
return takeFromExternrefTable0(ret[0]);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
256
|
-
*
|
|
257
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
258
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
259
|
-
*/
|
|
260
|
-
module.exports.compressWitnessStack = function(witness_stack) {
|
|
261
|
-
const ret = wasm.compressWitnessStack(witness_stack);
|
|
262
|
-
if (ret[3]) {
|
|
263
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
264
|
-
}
|
|
265
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
266
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
267
|
-
return v1;
|
|
268
|
-
};
|
|
89
|
+
}
|
|
90
|
+
exports.decompressWitness = decompressWitness;
|
|
269
91
|
|
|
270
92
|
/**
|
|
271
93
|
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
@@ -273,7 +95,7 @@ module.exports.compressWitnessStack = function(witness_stack) {
|
|
|
273
95
|
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
274
96
|
* @returns {WitnessStack} The decompressed witness stack.
|
|
275
97
|
*/
|
|
276
|
-
|
|
98
|
+
function decompressWitnessStack(compressed_witness) {
|
|
277
99
|
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
278
100
|
const len0 = WASM_VECTOR_LEN;
|
|
279
101
|
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
@@ -281,22 +103,68 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
281
103
|
throw takeFromExternrefTable0(ret[1]);
|
|
282
104
|
}
|
|
283
105
|
return takeFromExternrefTable0(ret[0]);
|
|
284
|
-
}
|
|
106
|
+
}
|
|
107
|
+
exports.decompressWitnessStack = decompressWitnessStack;
|
|
285
108
|
|
|
286
109
|
/**
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
* @param {Uint8Array}
|
|
290
|
-
* @param {
|
|
291
|
-
* @param {
|
|
292
|
-
* @returns {
|
|
110
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
111
|
+
* @param {Uint8Array} hashed_msg
|
|
112
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
113
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
114
|
+
* @param {Uint8Array} signature
|
|
115
|
+
* @returns {boolean}
|
|
293
116
|
*/
|
|
294
|
-
|
|
295
|
-
const ptr0 = passArray8ToWasm0(
|
|
117
|
+
function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
118
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
119
|
+
const len0 = WASM_VECTOR_LEN;
|
|
120
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
121
|
+
const len1 = WASM_VECTOR_LEN;
|
|
122
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
123
|
+
const len2 = WASM_VECTOR_LEN;
|
|
124
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
125
|
+
const len3 = WASM_VECTOR_LEN;
|
|
126
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
127
|
+
return ret !== 0;
|
|
128
|
+
}
|
|
129
|
+
exports.ecdsa_secp256k1_verify = ecdsa_secp256k1_verify;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
133
|
+
* @param {Uint8Array} hashed_msg
|
|
134
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
135
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
136
|
+
* @param {Uint8Array} signature
|
|
137
|
+
* @returns {boolean}
|
|
138
|
+
*/
|
|
139
|
+
function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
140
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
141
|
+
const len0 = WASM_VECTOR_LEN;
|
|
142
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
143
|
+
const len1 = WASM_VECTOR_LEN;
|
|
144
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
145
|
+
const len2 = WASM_VECTOR_LEN;
|
|
146
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
147
|
+
const len3 = WASM_VECTOR_LEN;
|
|
148
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
149
|
+
return ret !== 0;
|
|
150
|
+
}
|
|
151
|
+
exports.ecdsa_secp256r1_verify = ecdsa_secp256r1_verify;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
155
|
+
*
|
|
156
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
157
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
158
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
159
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
160
|
+
*/
|
|
161
|
+
function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
162
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
296
163
|
const len0 = WASM_VECTOR_LEN;
|
|
297
164
|
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
298
165
|
return ret;
|
|
299
|
-
}
|
|
166
|
+
}
|
|
167
|
+
exports.executeCircuit = executeCircuit;
|
|
300
168
|
|
|
301
169
|
/**
|
|
302
170
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
@@ -307,12 +175,13 @@ module.exports.executeCircuit = function(program, initial_witness, foreign_call_
|
|
|
307
175
|
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
308
176
|
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
309
177
|
*/
|
|
310
|
-
|
|
178
|
+
function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
311
179
|
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
312
180
|
const len0 = WASM_VECTOR_LEN;
|
|
313
181
|
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
314
182
|
return ret;
|
|
315
|
-
}
|
|
183
|
+
}
|
|
184
|
+
exports.executeCircuitWithReturnWitness = executeCircuitWithReturnWitness;
|
|
316
185
|
|
|
317
186
|
/**
|
|
318
187
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
@@ -322,122 +191,99 @@ module.exports.executeCircuitWithReturnWitness = function(program, initial_witne
|
|
|
322
191
|
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
323
192
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
324
193
|
*/
|
|
325
|
-
|
|
194
|
+
function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
326
195
|
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
327
196
|
const len0 = WASM_VECTOR_LEN;
|
|
328
197
|
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
329
198
|
return ret;
|
|
330
|
-
}
|
|
199
|
+
}
|
|
200
|
+
exports.executeProgram = executeProgram;
|
|
331
201
|
|
|
332
202
|
/**
|
|
333
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's
|
|
203
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
334
204
|
*
|
|
335
205
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
336
206
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
337
|
-
* @returns {WitnessMap} A witness map containing the circuit's
|
|
207
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
338
208
|
* @param {Uint8Array} program
|
|
339
|
-
* @param {WitnessMap}
|
|
209
|
+
* @param {WitnessMap} solved_witness
|
|
340
210
|
* @returns {WitnessMap}
|
|
341
211
|
*/
|
|
342
|
-
|
|
212
|
+
function getPublicParametersWitness(program, solved_witness) {
|
|
343
213
|
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
344
214
|
const len0 = WASM_VECTOR_LEN;
|
|
345
|
-
const ret = wasm.
|
|
215
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
346
216
|
if (ret[2]) {
|
|
347
217
|
throw takeFromExternrefTable0(ret[1]);
|
|
348
218
|
}
|
|
349
219
|
return takeFromExternrefTable0(ret[0]);
|
|
350
|
-
}
|
|
220
|
+
}
|
|
221
|
+
exports.getPublicParametersWitness = getPublicParametersWitness;
|
|
351
222
|
|
|
352
223
|
/**
|
|
353
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public
|
|
224
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
354
225
|
*
|
|
355
226
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
356
227
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
357
|
-
* @returns {WitnessMap} A witness map containing the circuit's public
|
|
228
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
358
229
|
* @param {Uint8Array} program
|
|
359
230
|
* @param {WitnessMap} solved_witness
|
|
360
231
|
* @returns {WitnessMap}
|
|
361
232
|
*/
|
|
362
|
-
|
|
233
|
+
function getPublicWitness(program, solved_witness) {
|
|
363
234
|
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
364
235
|
const len0 = WASM_VECTOR_LEN;
|
|
365
|
-
const ret = wasm.
|
|
236
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
366
237
|
if (ret[2]) {
|
|
367
238
|
throw takeFromExternrefTable0(ret[1]);
|
|
368
239
|
}
|
|
369
240
|
return takeFromExternrefTable0(ret[0]);
|
|
370
|
-
}
|
|
241
|
+
}
|
|
242
|
+
exports.getPublicWitness = getPublicWitness;
|
|
371
243
|
|
|
372
244
|
/**
|
|
373
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's
|
|
245
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
374
246
|
*
|
|
375
247
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
376
248
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
377
|
-
* @returns {WitnessMap} A witness map containing the circuit's
|
|
249
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
378
250
|
* @param {Uint8Array} program
|
|
379
|
-
* @param {WitnessMap}
|
|
251
|
+
* @param {WitnessMap} witness_map
|
|
380
252
|
* @returns {WitnessMap}
|
|
381
253
|
*/
|
|
382
|
-
|
|
254
|
+
function getReturnWitness(program, witness_map) {
|
|
383
255
|
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
384
256
|
const len0 = WASM_VECTOR_LEN;
|
|
385
|
-
const ret = wasm.
|
|
257
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
386
258
|
if (ret[2]) {
|
|
387
259
|
throw takeFromExternrefTable0(ret[1]);
|
|
388
260
|
}
|
|
389
261
|
return takeFromExternrefTable0(ret[0]);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
394
|
-
* @param {string} lhs
|
|
395
|
-
* @param {string} rhs
|
|
396
|
-
* @returns {string}
|
|
397
|
-
*/
|
|
398
|
-
module.exports.and = function(lhs, rhs) {
|
|
399
|
-
const ret = wasm.and(lhs, rhs);
|
|
400
|
-
return ret;
|
|
401
|
-
};
|
|
262
|
+
}
|
|
263
|
+
exports.getReturnWitness = getReturnWitness;
|
|
402
264
|
|
|
403
265
|
/**
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
* @param {
|
|
407
|
-
* @returns {string}
|
|
266
|
+
* Sets the package's logging level.
|
|
267
|
+
*
|
|
268
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
408
269
|
*/
|
|
409
|
-
|
|
410
|
-
const
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
function getUint32ArrayMemory0() {
|
|
417
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
418
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
270
|
+
function initLogLevel(filter) {
|
|
271
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
272
|
+
const len0 = WASM_VECTOR_LEN;
|
|
273
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
274
|
+
if (ret[1]) {
|
|
275
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
419
276
|
}
|
|
420
|
-
return cachedUint32ArrayMemory0;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
function passArray32ToWasm0(arg, malloc) {
|
|
424
|
-
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
425
|
-
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
426
|
-
WASM_VECTOR_LEN = arg.length;
|
|
427
|
-
return ptr;
|
|
428
277
|
}
|
|
278
|
+
exports.initLogLevel = initLogLevel;
|
|
429
279
|
|
|
430
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
431
|
-
ptr = ptr >>> 0;
|
|
432
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
433
|
-
}
|
|
434
280
|
/**
|
|
435
281
|
* Sha256 compression function
|
|
436
282
|
* @param {Uint32Array} inputs
|
|
437
283
|
* @param {Uint32Array} state
|
|
438
284
|
* @returns {Uint32Array}
|
|
439
285
|
*/
|
|
440
|
-
|
|
286
|
+
function sha256_compression(inputs, state) {
|
|
441
287
|
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
442
288
|
const len0 = WASM_VECTOR_LEN;
|
|
443
289
|
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
@@ -446,455 +292,568 @@ module.exports.sha256_compression = function(inputs, state) {
|
|
|
446
292
|
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
447
293
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
448
294
|
return v3;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
453
|
-
* @param {Uint8Array} inputs
|
|
454
|
-
* @returns {Uint8Array}
|
|
455
|
-
*/
|
|
456
|
-
module.exports.blake2s256 = function(inputs) {
|
|
457
|
-
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
458
|
-
const len0 = WASM_VECTOR_LEN;
|
|
459
|
-
const ret = wasm.blake2s256(ptr0, len0);
|
|
460
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
461
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
462
|
-
return v2;
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
467
|
-
* @param {Uint8Array} hashed_msg
|
|
468
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
469
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
470
|
-
* @param {Uint8Array} signature
|
|
471
|
-
* @returns {boolean}
|
|
472
|
-
*/
|
|
473
|
-
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
474
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
475
|
-
const len0 = WASM_VECTOR_LEN;
|
|
476
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
477
|
-
const len1 = WASM_VECTOR_LEN;
|
|
478
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
479
|
-
const len2 = WASM_VECTOR_LEN;
|
|
480
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
481
|
-
const len3 = WASM_VECTOR_LEN;
|
|
482
|
-
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
483
|
-
return ret !== 0;
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
488
|
-
* @param {Uint8Array} hashed_msg
|
|
489
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
490
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
491
|
-
* @param {Uint8Array} signature
|
|
492
|
-
* @returns {boolean}
|
|
493
|
-
*/
|
|
494
|
-
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
495
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
496
|
-
const len0 = WASM_VECTOR_LEN;
|
|
497
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
498
|
-
const len1 = WASM_VECTOR_LEN;
|
|
499
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
500
|
-
const len2 = WASM_VECTOR_LEN;
|
|
501
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
502
|
-
const len3 = WASM_VECTOR_LEN;
|
|
503
|
-
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
504
|
-
return ret !== 0;
|
|
505
|
-
};
|
|
295
|
+
}
|
|
296
|
+
exports.sha256_compression = sha256_compression;
|
|
506
297
|
|
|
507
298
|
/**
|
|
508
|
-
*
|
|
509
|
-
* @
|
|
299
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
300
|
+
* @param {string} lhs
|
|
301
|
+
* @param {string} rhs
|
|
302
|
+
* @returns {string}
|
|
510
303
|
*/
|
|
511
|
-
|
|
512
|
-
const ret = wasm.
|
|
304
|
+
function xor(lhs, rhs) {
|
|
305
|
+
const ret = wasm.xor(lhs, rhs);
|
|
513
306
|
return ret;
|
|
514
|
-
}
|
|
307
|
+
}
|
|
308
|
+
exports.xor = xor;
|
|
309
|
+
|
|
310
|
+
function __wbg_get_imports() {
|
|
311
|
+
const import0 = {
|
|
312
|
+
__proto__: null,
|
|
313
|
+
__wbg___wbindgen_debug_string_ddde1867f49c2442: function(arg0, arg1) {
|
|
314
|
+
const ret = debugString(arg1);
|
|
315
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
316
|
+
const len1 = WASM_VECTOR_LEN;
|
|
317
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
318
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
319
|
+
},
|
|
320
|
+
__wbg___wbindgen_is_function_d633e708baf0d146: function(arg0) {
|
|
321
|
+
const ret = typeof(arg0) === 'function';
|
|
322
|
+
return ret;
|
|
323
|
+
},
|
|
324
|
+
__wbg___wbindgen_is_string_7debe47dc1e045c2: function(arg0) {
|
|
325
|
+
const ret = typeof(arg0) === 'string';
|
|
326
|
+
return ret;
|
|
327
|
+
},
|
|
328
|
+
__wbg___wbindgen_is_undefined_c18285b9fc34cb7d: function(arg0) {
|
|
329
|
+
const ret = arg0 === undefined;
|
|
330
|
+
return ret;
|
|
331
|
+
},
|
|
332
|
+
__wbg___wbindgen_number_get_5854912275df1894: function(arg0, arg1) {
|
|
333
|
+
const obj = arg1;
|
|
334
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
335
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
336
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
337
|
+
},
|
|
338
|
+
__wbg___wbindgen_string_get_3e5751597f39a112: function(arg0, arg1) {
|
|
339
|
+
const obj = arg1;
|
|
340
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
341
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
342
|
+
var len1 = WASM_VECTOR_LEN;
|
|
343
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
344
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
345
|
+
},
|
|
346
|
+
__wbg___wbindgen_throw_39bc967c0e5a9b58: function(arg0, arg1) {
|
|
347
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
348
|
+
},
|
|
349
|
+
__wbg__wbg_cb_unref_b6d832240a919168: function(arg0) {
|
|
350
|
+
arg0._wbg_cb_unref();
|
|
351
|
+
},
|
|
352
|
+
__wbg_call_08ad0d89caa7cb79: function() { return handleError(function (arg0, arg1, arg2) {
|
|
353
|
+
const ret = arg0.call(arg1, arg2);
|
|
354
|
+
return ret;
|
|
355
|
+
}, arguments); },
|
|
356
|
+
__wbg_call_c974f0bf2231552e: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
357
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
358
|
+
return ret;
|
|
359
|
+
}, arguments); },
|
|
360
|
+
__wbg_constructor_78e91522c0c3d715: function(arg0) {
|
|
361
|
+
const ret = new Error(arg0);
|
|
362
|
+
return ret;
|
|
363
|
+
},
|
|
364
|
+
__wbg_constructor_d2b676f9277a8e3c: function(arg0) {
|
|
365
|
+
const ret = new Error(arg0);
|
|
366
|
+
return ret;
|
|
367
|
+
},
|
|
368
|
+
__wbg_debug_8804c16f548276da: function(arg0, arg1, arg2, arg3) {
|
|
369
|
+
console.debug(arg0, arg1, arg2, arg3);
|
|
370
|
+
},
|
|
371
|
+
__wbg_debug_e69ad32e6af73f94: function(arg0) {
|
|
372
|
+
console.debug(arg0);
|
|
373
|
+
},
|
|
374
|
+
__wbg_error_91d10625a3b36a08: function(arg0, arg1, arg2, arg3) {
|
|
375
|
+
console.error(arg0, arg1, arg2, arg3);
|
|
376
|
+
},
|
|
377
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
378
|
+
let deferred0_0;
|
|
379
|
+
let deferred0_1;
|
|
380
|
+
try {
|
|
381
|
+
deferred0_0 = arg0;
|
|
382
|
+
deferred0_1 = arg1;
|
|
383
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
384
|
+
} finally {
|
|
385
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
__wbg_error_ad28debb48b5c6bb: function(arg0) {
|
|
389
|
+
console.error(arg0);
|
|
390
|
+
},
|
|
391
|
+
__wbg_forEach_9694464cb60ea370: function(arg0, arg1, arg2) {
|
|
392
|
+
try {
|
|
393
|
+
var state0 = {a: arg1, b: arg2};
|
|
394
|
+
var cb0 = (arg0, arg1) => {
|
|
395
|
+
const a = state0.a;
|
|
396
|
+
state0.a = 0;
|
|
397
|
+
try {
|
|
398
|
+
return wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(a, state0.b, arg0, arg1);
|
|
399
|
+
} finally {
|
|
400
|
+
state0.a = a;
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
arg0.forEach(cb0);
|
|
404
|
+
} finally {
|
|
405
|
+
state0.a = state0.b = 0;
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
__wbg_forEach_f33e388a24ae7d4f: function(arg0, arg1, arg2) {
|
|
409
|
+
try {
|
|
410
|
+
var state0 = {a: arg1, b: arg2};
|
|
411
|
+
var cb0 = (arg0, arg1, arg2) => {
|
|
412
|
+
const a = state0.a;
|
|
413
|
+
state0.a = 0;
|
|
414
|
+
try {
|
|
415
|
+
return wasm_bindgen__convert__closures_____invoke__h149dcfc5e545a40e(a, state0.b, arg0, arg1, arg2);
|
|
416
|
+
} finally {
|
|
417
|
+
state0.a = a;
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
arg0.forEach(cb0);
|
|
421
|
+
} finally {
|
|
422
|
+
state0.a = state0.b = 0;
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
__wbg_fromEntries_2f51c4024e2a7aa3: function() { return handleError(function (arg0) {
|
|
426
|
+
const ret = Object.fromEntries(arg0);
|
|
427
|
+
return ret;
|
|
428
|
+
}, arguments); },
|
|
429
|
+
__wbg_from_d7e888a2e9063b32: function(arg0) {
|
|
430
|
+
const ret = Array.from(arg0);
|
|
431
|
+
return ret;
|
|
432
|
+
},
|
|
433
|
+
__wbg_get_f09c3a16f8848381: function(arg0, arg1) {
|
|
434
|
+
const ret = arg0[arg1 >>> 0];
|
|
435
|
+
return ret;
|
|
436
|
+
},
|
|
437
|
+
__wbg_get_unchecked_3d0f4b91c8eca4f0: function(arg0, arg1) {
|
|
438
|
+
const ret = arg0[arg1 >>> 0];
|
|
439
|
+
return ret;
|
|
440
|
+
},
|
|
441
|
+
__wbg_info_28d530adaabdab8c: function(arg0, arg1, arg2, arg3) {
|
|
442
|
+
console.info(arg0, arg1, arg2, arg3);
|
|
443
|
+
},
|
|
444
|
+
__wbg_info_72e7e65fa3fc8b25: function(arg0) {
|
|
445
|
+
console.info(arg0);
|
|
446
|
+
},
|
|
447
|
+
__wbg_isArray_581b02d0060c9728: function(arg0) {
|
|
448
|
+
const ret = Array.isArray(arg0);
|
|
449
|
+
return ret;
|
|
450
|
+
},
|
|
451
|
+
__wbg_length_a31e05262e09b7f8: function(arg0) {
|
|
452
|
+
const ret = arg0.length;
|
|
453
|
+
return ret;
|
|
454
|
+
},
|
|
455
|
+
__wbg_new_1213b57bccbdbb66: function(arg0, arg1) {
|
|
456
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
457
|
+
return ret;
|
|
458
|
+
},
|
|
459
|
+
__wbg_new_1faa82fcea3a8b7d: function() {
|
|
460
|
+
const ret = new Map();
|
|
461
|
+
return ret;
|
|
462
|
+
},
|
|
463
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
464
|
+
const ret = new Error();
|
|
465
|
+
return ret;
|
|
466
|
+
},
|
|
467
|
+
__wbg_new_92df58a8ec3bfb6b: function() {
|
|
468
|
+
const ret = new Map();
|
|
469
|
+
return ret;
|
|
470
|
+
},
|
|
471
|
+
__wbg_new_cb7a57a3ce49e647: function() {
|
|
472
|
+
const ret = new Array();
|
|
473
|
+
return ret;
|
|
474
|
+
},
|
|
475
|
+
__wbg_new_cbee8c0d5c479eac: function() {
|
|
476
|
+
const ret = new Array();
|
|
477
|
+
return ret;
|
|
478
|
+
},
|
|
479
|
+
__wbg_new_typed_8258a0d8488ef2a2: function(arg0, arg1) {
|
|
480
|
+
try {
|
|
481
|
+
var state0 = {a: arg0, b: arg1};
|
|
482
|
+
var cb0 = (arg0, arg1) => {
|
|
483
|
+
const a = state0.a;
|
|
484
|
+
state0.a = 0;
|
|
485
|
+
try {
|
|
486
|
+
return wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2_21(a, state0.b, arg0, arg1);
|
|
487
|
+
} finally {
|
|
488
|
+
state0.a = a;
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
const ret = new Promise(cb0);
|
|
492
|
+
return ret;
|
|
493
|
+
} finally {
|
|
494
|
+
state0.a = state0.b = 0;
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
__wbg_parse_6dfe891b5bafb5cd: function() { return handleError(function (arg0, arg1) {
|
|
498
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
499
|
+
return ret;
|
|
500
|
+
}, arguments); },
|
|
501
|
+
__wbg_push_a6f9488ffd3fae3b: function(arg0, arg1) {
|
|
502
|
+
const ret = arg0.push(arg1);
|
|
503
|
+
return ret;
|
|
504
|
+
},
|
|
505
|
+
__wbg_queueMicrotask_2c8dfd1056f24fdc: function(arg0) {
|
|
506
|
+
const ret = arg0.queueMicrotask;
|
|
507
|
+
return ret;
|
|
508
|
+
},
|
|
509
|
+
__wbg_queueMicrotask_8985ad63815852e7: function(arg0) {
|
|
510
|
+
queueMicrotask(arg0);
|
|
511
|
+
},
|
|
512
|
+
__wbg_resolve_5d61e0d10c14730a: function(arg0) {
|
|
513
|
+
const ret = Promise.resolve(arg0);
|
|
514
|
+
return ret;
|
|
515
|
+
},
|
|
516
|
+
__wbg_reverse_fcf59127ee940f96: function(arg0) {
|
|
517
|
+
const ret = arg0.reverse();
|
|
518
|
+
return ret;
|
|
519
|
+
},
|
|
520
|
+
__wbg_set_bad5c505cc70b5f8: function() { return handleError(function (arg0, arg1, arg2) {
|
|
521
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
522
|
+
return ret;
|
|
523
|
+
}, arguments); },
|
|
524
|
+
__wbg_set_cause_7f44b7881bde2bb6: function(arg0, arg1) {
|
|
525
|
+
arg0.cause = arg1;
|
|
526
|
+
},
|
|
527
|
+
__wbg_set_cfc6de03f990decf: function(arg0, arg1, arg2) {
|
|
528
|
+
const ret = arg0.set(arg1, arg2);
|
|
529
|
+
return ret;
|
|
530
|
+
},
|
|
531
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
532
|
+
const ret = arg1.stack;
|
|
533
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
534
|
+
const len1 = WASM_VECTOR_LEN;
|
|
535
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
536
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
537
|
+
},
|
|
538
|
+
__wbg_static_accessor_GLOBAL_THIS_14325d8cca34bb77: function() {
|
|
539
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
540
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
541
|
+
},
|
|
542
|
+
__wbg_static_accessor_GLOBAL_f3a1e69f9c5a7e8e: function() {
|
|
543
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
544
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
545
|
+
},
|
|
546
|
+
__wbg_static_accessor_SELF_50cdb5b517789aca: function() {
|
|
547
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
548
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
549
|
+
},
|
|
550
|
+
__wbg_static_accessor_WINDOW_d6c4126e4c244380: function() {
|
|
551
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
552
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
553
|
+
},
|
|
554
|
+
__wbg_then_d4163530723f56f4: function(arg0, arg1, arg2) {
|
|
555
|
+
const ret = arg0.then(arg1, arg2);
|
|
556
|
+
return ret;
|
|
557
|
+
},
|
|
558
|
+
__wbg_then_f1c954fe00733701: function(arg0, arg1) {
|
|
559
|
+
const ret = arg0.then(arg1);
|
|
560
|
+
return ret;
|
|
561
|
+
},
|
|
562
|
+
__wbg_values_623449cff68c6e40: function(arg0) {
|
|
563
|
+
const ret = Object.values(arg0);
|
|
564
|
+
return ret;
|
|
565
|
+
},
|
|
566
|
+
__wbg_warn_2540fe736f19ad5c: function(arg0, arg1, arg2, arg3) {
|
|
567
|
+
console.warn(arg0, arg1, arg2, arg3);
|
|
568
|
+
},
|
|
569
|
+
__wbg_warn_3310c7343993c074: function(arg0) {
|
|
570
|
+
console.warn(arg0);
|
|
571
|
+
},
|
|
572
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
573
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 464, function: Function { arguments: [Externref], shim_idx: 465, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
574
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h589cd82bcdcce84d, wasm_bindgen__convert__closures_____invoke__hd0bc2cf4f980f051);
|
|
575
|
+
return ret;
|
|
576
|
+
},
|
|
577
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
578
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
579
|
+
const ret = arg0;
|
|
580
|
+
return ret;
|
|
581
|
+
},
|
|
582
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
583
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
584
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
585
|
+
return ret;
|
|
586
|
+
},
|
|
587
|
+
__wbindgen_init_externref_table: function() {
|
|
588
|
+
const table = wasm.__wbindgen_externrefs;
|
|
589
|
+
const offset = table.grow(4);
|
|
590
|
+
table.set(0, undefined);
|
|
591
|
+
table.set(offset + 0, undefined);
|
|
592
|
+
table.set(offset + 1, null);
|
|
593
|
+
table.set(offset + 2, true);
|
|
594
|
+
table.set(offset + 3, false);
|
|
595
|
+
},
|
|
596
|
+
};
|
|
597
|
+
return {
|
|
598
|
+
__proto__: null,
|
|
599
|
+
"./acvm_js_bg.js": import0,
|
|
600
|
+
};
|
|
601
|
+
}
|
|
515
602
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
*
|
|
519
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
520
|
-
*/
|
|
521
|
-
module.exports.initLogLevel = function(filter) {
|
|
522
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
523
|
-
const len0 = WASM_VECTOR_LEN;
|
|
524
|
-
const ret = wasm.initLogLevel(ptr0, len0);
|
|
603
|
+
function wasm_bindgen__convert__closures_____invoke__hd0bc2cf4f980f051(arg0, arg1, arg2) {
|
|
604
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__hd0bc2cf4f980f051(arg0, arg1, arg2);
|
|
525
605
|
if (ret[1]) {
|
|
526
606
|
throw takeFromExternrefTable0(ret[0]);
|
|
527
607
|
}
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
531
|
-
wasm.closure445_externref_shim(arg0, arg1, arg2);
|
|
532
608
|
}
|
|
533
609
|
|
|
534
|
-
function
|
|
535
|
-
wasm.
|
|
610
|
+
function wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(arg0, arg1, arg2, arg3) {
|
|
611
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(arg0, arg1, arg2, arg3);
|
|
536
612
|
}
|
|
537
613
|
|
|
538
|
-
function
|
|
539
|
-
wasm.
|
|
614
|
+
function wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2_21(arg0, arg1, arg2, arg3) {
|
|
615
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2_21(arg0, arg1, arg2, arg3);
|
|
540
616
|
}
|
|
541
617
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
}, arguments) };
|
|
546
|
-
|
|
547
|
-
module.exports.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
548
|
-
const ret = arg0.call(arg1, arg2);
|
|
549
|
-
return ret;
|
|
550
|
-
}, arguments) };
|
|
551
|
-
|
|
552
|
-
module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
553
|
-
const ret = arg0.call(arg1, arg2, arg3);
|
|
554
|
-
return ret;
|
|
555
|
-
}, arguments) };
|
|
556
|
-
|
|
557
|
-
module.exports.__wbg_constructor_2b49e4454d172081 = function(arg0) {
|
|
558
|
-
const ret = new Error(arg0);
|
|
559
|
-
return ret;
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
module.exports.__wbg_constructor_dddf0209b25406fd = function(arg0) {
|
|
563
|
-
const ret = new Error(arg0);
|
|
564
|
-
return ret;
|
|
565
|
-
};
|
|
566
|
-
|
|
567
|
-
module.exports.__wbg_debug_3cb59063b29f58c1 = function(arg0) {
|
|
568
|
-
console.debug(arg0);
|
|
569
|
-
};
|
|
618
|
+
function wasm_bindgen__convert__closures_____invoke__h149dcfc5e545a40e(arg0, arg1, arg2, arg3, arg4) {
|
|
619
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h149dcfc5e545a40e(arg0, arg1, arg2, arg3, arg4);
|
|
620
|
+
}
|
|
570
621
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
622
|
+
function addToExternrefTable0(obj) {
|
|
623
|
+
const idx = wasm.__externref_table_alloc();
|
|
624
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
625
|
+
return idx;
|
|
626
|
+
}
|
|
574
627
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
628
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
629
|
+
? { register: () => {}, unregister: () => {} }
|
|
630
|
+
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
|
|
578
631
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
deferred0_1 = arg1;
|
|
585
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
586
|
-
} finally {
|
|
587
|
-
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
632
|
+
function debugString(val) {
|
|
633
|
+
// primitive types
|
|
634
|
+
const type = typeof val;
|
|
635
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
636
|
+
return `${val}`;
|
|
588
637
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
module.exports.__wbg_error_80de38b3f7cc3c3c = function(arg0, arg1, arg2, arg3) {
|
|
592
|
-
console.error(arg0, arg1, arg2, arg3);
|
|
593
|
-
};
|
|
594
|
-
|
|
595
|
-
module.exports.__wbg_forEach_d6a05ca96422eff9 = function(arg0, arg1, arg2) {
|
|
596
|
-
try {
|
|
597
|
-
var state0 = {a: arg1, b: arg2};
|
|
598
|
-
var cb0 = (arg0, arg1, arg2) => {
|
|
599
|
-
const a = state0.a;
|
|
600
|
-
state0.a = 0;
|
|
601
|
-
try {
|
|
602
|
-
return __wbg_adapter_89(a, state0.b, arg0, arg1, arg2);
|
|
603
|
-
} finally {
|
|
604
|
-
state0.a = a;
|
|
605
|
-
}
|
|
606
|
-
};
|
|
607
|
-
arg0.forEach(cb0);
|
|
608
|
-
} finally {
|
|
609
|
-
state0.a = state0.b = 0;
|
|
638
|
+
if (type == 'string') {
|
|
639
|
+
return `"${val}"`;
|
|
610
640
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
state0.a = 0;
|
|
619
|
-
try {
|
|
620
|
-
return __wbg_adapter_110(a, state0.b, arg0, arg1);
|
|
621
|
-
} finally {
|
|
622
|
-
state0.a = a;
|
|
623
|
-
}
|
|
624
|
-
};
|
|
625
|
-
arg0.forEach(cb0);
|
|
626
|
-
} finally {
|
|
627
|
-
state0.a = state0.b = 0;
|
|
641
|
+
if (type == 'symbol') {
|
|
642
|
+
const description = val.description;
|
|
643
|
+
if (description == null) {
|
|
644
|
+
return 'Symbol';
|
|
645
|
+
} else {
|
|
646
|
+
return `Symbol(${description})`;
|
|
647
|
+
}
|
|
628
648
|
}
|
|
629
|
-
|
|
649
|
+
if (type == 'function') {
|
|
650
|
+
const name = val.name;
|
|
651
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
652
|
+
return `Function(${name})`;
|
|
653
|
+
} else {
|
|
654
|
+
return 'Function';
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
// objects
|
|
658
|
+
if (Array.isArray(val)) {
|
|
659
|
+
const length = val.length;
|
|
660
|
+
let debug = '[';
|
|
661
|
+
if (length > 0) {
|
|
662
|
+
debug += debugString(val[0]);
|
|
663
|
+
}
|
|
664
|
+
for(let i = 1; i < length; i++) {
|
|
665
|
+
debug += ', ' + debugString(val[i]);
|
|
666
|
+
}
|
|
667
|
+
debug += ']';
|
|
668
|
+
return debug;
|
|
669
|
+
}
|
|
670
|
+
// Test for built-in
|
|
671
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
672
|
+
let className;
|
|
673
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
674
|
+
className = builtInMatches[1];
|
|
675
|
+
} else {
|
|
676
|
+
// Failed to match the standard '[object ClassName]'
|
|
677
|
+
return toString.call(val);
|
|
678
|
+
}
|
|
679
|
+
if (className == 'Object') {
|
|
680
|
+
// we're a user defined class or Object
|
|
681
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
682
|
+
// easier than looping through ownProperties of `val`.
|
|
683
|
+
try {
|
|
684
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
685
|
+
} catch (_) {
|
|
686
|
+
return 'Object';
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
// errors
|
|
690
|
+
if (val instanceof Error) {
|
|
691
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
692
|
+
}
|
|
693
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
694
|
+
return className;
|
|
695
|
+
}
|
|
630
696
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
return
|
|
634
|
-
}
|
|
697
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
698
|
+
ptr = ptr >>> 0;
|
|
699
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
700
|
+
}
|
|
635
701
|
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
return
|
|
639
|
-
}
|
|
702
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
703
|
+
ptr = ptr >>> 0;
|
|
704
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
705
|
+
}
|
|
640
706
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
707
|
+
let cachedDataViewMemory0 = null;
|
|
708
|
+
function getDataViewMemory0() {
|
|
709
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
710
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
711
|
+
}
|
|
712
|
+
return cachedDataViewMemory0;
|
|
713
|
+
}
|
|
645
714
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
715
|
+
function getStringFromWasm0(ptr, len) {
|
|
716
|
+
ptr = ptr >>> 0;
|
|
717
|
+
return decodeText(ptr, len);
|
|
718
|
+
}
|
|
649
719
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
720
|
+
let cachedUint32ArrayMemory0 = null;
|
|
721
|
+
function getUint32ArrayMemory0() {
|
|
722
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
723
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
724
|
+
}
|
|
725
|
+
return cachedUint32ArrayMemory0;
|
|
726
|
+
}
|
|
653
727
|
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
728
|
+
let cachedUint8ArrayMemory0 = null;
|
|
729
|
+
function getUint8ArrayMemory0() {
|
|
730
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
731
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
732
|
+
}
|
|
733
|
+
return cachedUint8ArrayMemory0;
|
|
734
|
+
}
|
|
658
735
|
|
|
659
|
-
|
|
736
|
+
function handleError(f, args) {
|
|
660
737
|
try {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
try {
|
|
666
|
-
return __wbg_adapter_110(a, state0.b, arg0, arg1);
|
|
667
|
-
} finally {
|
|
668
|
-
state0.a = a;
|
|
669
|
-
}
|
|
670
|
-
};
|
|
671
|
-
const ret = new Promise(cb0);
|
|
672
|
-
return ret;
|
|
673
|
-
} finally {
|
|
674
|
-
state0.a = state0.b = 0;
|
|
738
|
+
return f.apply(this, args);
|
|
739
|
+
} catch (e) {
|
|
740
|
+
const idx = addToExternrefTable0(e);
|
|
741
|
+
wasm.__wbindgen_exn_store(idx);
|
|
675
742
|
}
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
module.exports.__wbg_new_2812f5f6a6bd8bcf = function() {
|
|
679
|
-
const ret = new Array();
|
|
680
|
-
return ret;
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
module.exports.__wbg_new_5e0be73521bc8c17 = function() {
|
|
684
|
-
const ret = new Map();
|
|
685
|
-
return ret;
|
|
686
|
-
};
|
|
687
|
-
|
|
688
|
-
module.exports.__wbg_new_78feb108b6472713 = function() {
|
|
689
|
-
const ret = new Array();
|
|
690
|
-
return ret;
|
|
691
|
-
};
|
|
692
|
-
|
|
693
|
-
module.exports.__wbg_new_8a6f238a6ece86ea = function() {
|
|
694
|
-
const ret = new Error();
|
|
695
|
-
return ret;
|
|
696
|
-
};
|
|
697
|
-
|
|
698
|
-
module.exports.__wbg_new_b110592360513189 = function() {
|
|
699
|
-
const ret = new Map();
|
|
700
|
-
return ret;
|
|
701
|
-
};
|
|
702
|
-
|
|
703
|
-
module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
|
|
704
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
705
|
-
return ret;
|
|
706
|
-
};
|
|
707
|
-
|
|
708
|
-
module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
709
|
-
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
710
|
-
return ret;
|
|
711
|
-
};
|
|
712
|
-
|
|
713
|
-
module.exports.__wbg_parse_def2e24ef1252aff = function() { return handleError(function (arg0, arg1) {
|
|
714
|
-
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
715
|
-
return ret;
|
|
716
|
-
}, arguments) };
|
|
717
|
-
|
|
718
|
-
module.exports.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
|
|
719
|
-
const ret = arg0.push(arg1);
|
|
720
|
-
return ret;
|
|
721
|
-
};
|
|
722
|
-
|
|
723
|
-
module.exports.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) {
|
|
724
|
-
queueMicrotask(arg0);
|
|
725
|
-
};
|
|
726
|
-
|
|
727
|
-
module.exports.__wbg_queueMicrotask_d3219def82552485 = function(arg0) {
|
|
728
|
-
const ret = arg0.queueMicrotask;
|
|
729
|
-
return ret;
|
|
730
|
-
};
|
|
731
|
-
|
|
732
|
-
module.exports.__wbg_resolve_4851785c9c5f573d = function(arg0) {
|
|
733
|
-
const ret = Promise.resolve(arg0);
|
|
734
|
-
return ret;
|
|
735
|
-
};
|
|
743
|
+
}
|
|
736
744
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
};
|
|
745
|
+
function isLikeNone(x) {
|
|
746
|
+
return x === undefined || x === null;
|
|
747
|
+
}
|
|
741
748
|
|
|
742
|
-
|
|
743
|
-
const
|
|
744
|
-
|
|
745
|
-
};
|
|
749
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
750
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
751
|
+
const real = (...args) => {
|
|
746
752
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
753
|
+
// First up with a closure we increment the internal reference
|
|
754
|
+
// count. This ensures that the Rust closure environment won't
|
|
755
|
+
// be deallocated while we're invoking it.
|
|
756
|
+
state.cnt++;
|
|
757
|
+
const a = state.a;
|
|
758
|
+
state.a = 0;
|
|
759
|
+
try {
|
|
760
|
+
return f(a, state.b, ...args);
|
|
761
|
+
} finally {
|
|
762
|
+
state.a = a;
|
|
763
|
+
real._wbg_cb_unref();
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
real._wbg_cb_unref = () => {
|
|
767
|
+
if (--state.cnt === 0) {
|
|
768
|
+
state.dtor(state.a, state.b);
|
|
769
|
+
state.a = 0;
|
|
770
|
+
CLOSURE_DTORS.unregister(state);
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
774
|
+
return real;
|
|
775
|
+
}
|
|
751
776
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
777
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
778
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
779
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
780
|
+
WASM_VECTOR_LEN = arg.length;
|
|
781
|
+
return ptr;
|
|
782
|
+
}
|
|
755
783
|
|
|
756
|
-
|
|
757
|
-
const
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
};
|
|
763
|
-
|
|
764
|
-
module.exports.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
|
|
765
|
-
const ret = typeof global === 'undefined' ? null : global;
|
|
766
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
767
|
-
};
|
|
768
|
-
|
|
769
|
-
module.exports.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
|
|
770
|
-
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
771
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
772
|
-
};
|
|
773
|
-
|
|
774
|
-
module.exports.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
|
|
775
|
-
const ret = typeof self === 'undefined' ? null : self;
|
|
776
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
777
|
-
};
|
|
778
|
-
|
|
779
|
-
module.exports.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
|
|
780
|
-
const ret = typeof window === 'undefined' ? null : window;
|
|
781
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
782
|
-
};
|
|
783
|
-
|
|
784
|
-
module.exports.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) {
|
|
785
|
-
const ret = arg0.then(arg1);
|
|
786
|
-
return ret;
|
|
787
|
-
};
|
|
784
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
785
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
786
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
787
|
+
WASM_VECTOR_LEN = arg.length;
|
|
788
|
+
return ptr;
|
|
789
|
+
}
|
|
788
790
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
791
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
792
|
+
if (realloc === undefined) {
|
|
793
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
794
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
795
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
796
|
+
WASM_VECTOR_LEN = buf.length;
|
|
797
|
+
return ptr;
|
|
798
|
+
}
|
|
793
799
|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
return ret;
|
|
797
|
-
};
|
|
800
|
+
let len = arg.length;
|
|
801
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
798
802
|
|
|
799
|
-
|
|
800
|
-
console.warn(arg0);
|
|
801
|
-
};
|
|
803
|
+
const mem = getUint8ArrayMemory0();
|
|
802
804
|
|
|
803
|
-
|
|
804
|
-
console.warn(arg0, arg1, arg2, arg3);
|
|
805
|
-
};
|
|
805
|
+
let offset = 0;
|
|
806
806
|
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
return true;
|
|
807
|
+
for (; offset < len; offset++) {
|
|
808
|
+
const code = arg.charCodeAt(offset);
|
|
809
|
+
if (code > 0x7F) break;
|
|
810
|
+
mem[ptr + offset] = code;
|
|
812
811
|
}
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
};
|
|
821
|
-
|
|
822
|
-
module.exports.__wbindgen_debug_string = function(arg0, arg1) {
|
|
823
|
-
const ret = debugString(arg1);
|
|
824
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
825
|
-
const len1 = WASM_VECTOR_LEN;
|
|
826
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
827
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
828
|
-
};
|
|
829
|
-
|
|
830
|
-
module.exports.__wbindgen_init_externref_table = function() {
|
|
831
|
-
const table = wasm.__wbindgen_export_2;
|
|
832
|
-
const offset = table.grow(4);
|
|
833
|
-
table.set(0, undefined);
|
|
834
|
-
table.set(offset + 0, undefined);
|
|
835
|
-
table.set(offset + 1, null);
|
|
836
|
-
table.set(offset + 2, true);
|
|
837
|
-
table.set(offset + 3, false);
|
|
838
|
-
;
|
|
839
|
-
};
|
|
840
|
-
|
|
841
|
-
module.exports.__wbindgen_is_array = function(arg0) {
|
|
842
|
-
const ret = Array.isArray(arg0);
|
|
843
|
-
return ret;
|
|
844
|
-
};
|
|
845
|
-
|
|
846
|
-
module.exports.__wbindgen_is_function = function(arg0) {
|
|
847
|
-
const ret = typeof(arg0) === 'function';
|
|
848
|
-
return ret;
|
|
849
|
-
};
|
|
812
|
+
if (offset !== len) {
|
|
813
|
+
if (offset !== 0) {
|
|
814
|
+
arg = arg.slice(offset);
|
|
815
|
+
}
|
|
816
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
817
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
818
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
850
819
|
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
};
|
|
820
|
+
offset += ret.written;
|
|
821
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
822
|
+
}
|
|
855
823
|
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
};
|
|
824
|
+
WASM_VECTOR_LEN = offset;
|
|
825
|
+
return ptr;
|
|
826
|
+
}
|
|
860
827
|
|
|
861
|
-
|
|
862
|
-
const
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
};
|
|
828
|
+
function takeFromExternrefTable0(idx) {
|
|
829
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
830
|
+
wasm.__externref_table_dealloc(idx);
|
|
831
|
+
return value;
|
|
832
|
+
}
|
|
867
833
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
874
|
-
const obj = arg1;
|
|
875
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
876
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
877
|
-
var len1 = WASM_VECTOR_LEN;
|
|
878
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
879
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
880
|
-
};
|
|
881
|
-
|
|
882
|
-
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
883
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
884
|
-
return ret;
|
|
885
|
-
};
|
|
834
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
835
|
+
cachedTextDecoder.decode();
|
|
836
|
+
function decodeText(ptr, len) {
|
|
837
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
838
|
+
}
|
|
886
839
|
|
|
887
|
-
|
|
888
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
889
|
-
};
|
|
840
|
+
const cachedTextEncoder = new TextEncoder();
|
|
890
841
|
|
|
891
|
-
|
|
892
|
-
|
|
842
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
843
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
844
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
845
|
+
view.set(buf);
|
|
846
|
+
return {
|
|
847
|
+
read: arg.length,
|
|
848
|
+
written: buf.length
|
|
849
|
+
};
|
|
850
|
+
};
|
|
851
|
+
}
|
|
893
852
|
|
|
894
|
-
|
|
895
|
-
const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
896
|
-
wasm = wasmInstance.exports;
|
|
897
|
-
module.exports.__wasm = wasm;
|
|
853
|
+
let WASM_VECTOR_LEN = 0;
|
|
898
854
|
|
|
855
|
+
const wasmPath = `${__dirname}/acvm_js_bg.wasm`;
|
|
856
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
857
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
858
|
+
let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
|
|
899
859
|
wasm.__wbindgen_start();
|
|
900
|
-
|