@zkclaw/sdk 2.0.0 → 2.0.1
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/dist/chunk-4VNS5WPM.js +42 -0
- package/dist/chunk-N437WADL.js +350 -0
- package/dist/chunk-UAQRGX32.mjs +350 -0
- package/dist/chunk-XGB3TDIC.mjs +42 -0
- package/dist/cli.js +4 -365
- package/dist/cli.mjs +2 -1
- package/dist/index.js +6 -380
- package/dist/index.mjs +2 -1
- package/dist/lib-CPBB5OQK.mjs +1218 -0
- package/dist/lib-JSNNQLU5.js +1218 -0
- package/dist/node-SQKRJHE6.mjs +3378 -0
- package/dist/node-WBCAXFAK.js +3378 -0
- package/dist/src-LRWQJPJO.mjs +476 -0
- package/dist/src-RO47KUEP.js +476 -0
- package/package.json +5 -6
|
@@ -0,0 +1,1218 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-XGB3TDIC.mjs";
|
|
4
|
+
|
|
5
|
+
// ../../node_modules/@noir-lang/acvm_js/web/acvm_js.js
|
|
6
|
+
var acvm_js_exports = {};
|
|
7
|
+
__export(acvm_js_exports, {
|
|
8
|
+
and: () => and,
|
|
9
|
+
blake2s256: () => blake2s256,
|
|
10
|
+
buildInfo: () => buildInfo,
|
|
11
|
+
compressWitness: () => compressWitness,
|
|
12
|
+
compressWitnessStack: () => compressWitnessStack,
|
|
13
|
+
decompressWitness: () => decompressWitness,
|
|
14
|
+
decompressWitnessStack: () => decompressWitnessStack,
|
|
15
|
+
default: () => acvm_js_default,
|
|
16
|
+
ecdsa_secp256k1_verify: () => ecdsa_secp256k1_verify,
|
|
17
|
+
ecdsa_secp256r1_verify: () => ecdsa_secp256r1_verify,
|
|
18
|
+
executeCircuit: () => executeCircuit,
|
|
19
|
+
executeCircuitWithReturnWitness: () => executeCircuitWithReturnWitness,
|
|
20
|
+
executeProgram: () => executeProgram,
|
|
21
|
+
getPublicParametersWitness: () => getPublicParametersWitness,
|
|
22
|
+
getPublicWitness: () => getPublicWitness,
|
|
23
|
+
getReturnWitness: () => getReturnWitness,
|
|
24
|
+
initLogLevel: () => initLogLevel,
|
|
25
|
+
initSync: () => initSync,
|
|
26
|
+
sha256_compression: () => sha256_compression,
|
|
27
|
+
xor: () => xor
|
|
28
|
+
});
|
|
29
|
+
var wasm;
|
|
30
|
+
var heap = new Array(128).fill(void 0);
|
|
31
|
+
heap.push(void 0, null, true, false);
|
|
32
|
+
function getObject(idx) {
|
|
33
|
+
return heap[idx];
|
|
34
|
+
}
|
|
35
|
+
var heap_next = heap.length;
|
|
36
|
+
function dropObject(idx) {
|
|
37
|
+
if (idx < 132) return;
|
|
38
|
+
heap[idx] = heap_next;
|
|
39
|
+
heap_next = idx;
|
|
40
|
+
}
|
|
41
|
+
function takeObject(idx) {
|
|
42
|
+
const ret = getObject(idx);
|
|
43
|
+
dropObject(idx);
|
|
44
|
+
return ret;
|
|
45
|
+
}
|
|
46
|
+
var cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
|
|
47
|
+
throw Error("TextDecoder not available");
|
|
48
|
+
} };
|
|
49
|
+
if (typeof TextDecoder !== "undefined") {
|
|
50
|
+
cachedTextDecoder.decode();
|
|
51
|
+
}
|
|
52
|
+
var cachedUint8Memory0 = null;
|
|
53
|
+
function getUint8Memory0() {
|
|
54
|
+
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
55
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
56
|
+
}
|
|
57
|
+
return cachedUint8Memory0;
|
|
58
|
+
}
|
|
59
|
+
function getStringFromWasm0(ptr, len) {
|
|
60
|
+
ptr = ptr >>> 0;
|
|
61
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
62
|
+
}
|
|
63
|
+
function addHeapObject(obj) {
|
|
64
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
65
|
+
const idx = heap_next;
|
|
66
|
+
heap_next = heap[idx];
|
|
67
|
+
heap[idx] = obj;
|
|
68
|
+
return idx;
|
|
69
|
+
}
|
|
70
|
+
function isLikeNone(x) {
|
|
71
|
+
return x === void 0 || x === null;
|
|
72
|
+
}
|
|
73
|
+
var cachedFloat64Memory0 = null;
|
|
74
|
+
function getFloat64Memory0() {
|
|
75
|
+
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
76
|
+
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
77
|
+
}
|
|
78
|
+
return cachedFloat64Memory0;
|
|
79
|
+
}
|
|
80
|
+
var cachedInt32Memory0 = null;
|
|
81
|
+
function getInt32Memory0() {
|
|
82
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
83
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
84
|
+
}
|
|
85
|
+
return cachedInt32Memory0;
|
|
86
|
+
}
|
|
87
|
+
var WASM_VECTOR_LEN = 0;
|
|
88
|
+
var cachedTextEncoder = typeof TextEncoder !== "undefined" ? new TextEncoder("utf-8") : { encode: () => {
|
|
89
|
+
throw Error("TextEncoder not available");
|
|
90
|
+
} };
|
|
91
|
+
var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
|
|
92
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
93
|
+
} : function(arg, view) {
|
|
94
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
95
|
+
view.set(buf);
|
|
96
|
+
return {
|
|
97
|
+
read: arg.length,
|
|
98
|
+
written: buf.length
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
102
|
+
if (realloc === void 0) {
|
|
103
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
104
|
+
const ptr2 = malloc(buf.length) >>> 0;
|
|
105
|
+
getUint8Memory0().subarray(ptr2, ptr2 + buf.length).set(buf);
|
|
106
|
+
WASM_VECTOR_LEN = buf.length;
|
|
107
|
+
return ptr2;
|
|
108
|
+
}
|
|
109
|
+
let len = arg.length;
|
|
110
|
+
let ptr = malloc(len) >>> 0;
|
|
111
|
+
const mem = getUint8Memory0();
|
|
112
|
+
let offset = 0;
|
|
113
|
+
for (; offset < len; offset++) {
|
|
114
|
+
const code = arg.charCodeAt(offset);
|
|
115
|
+
if (code > 127) break;
|
|
116
|
+
mem[ptr + offset] = code;
|
|
117
|
+
}
|
|
118
|
+
if (offset !== len) {
|
|
119
|
+
if (offset !== 0) {
|
|
120
|
+
arg = arg.slice(offset);
|
|
121
|
+
}
|
|
122
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
|
|
123
|
+
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
124
|
+
const ret = encodeString(arg, view);
|
|
125
|
+
offset += ret.written;
|
|
126
|
+
}
|
|
127
|
+
WASM_VECTOR_LEN = offset;
|
|
128
|
+
return ptr;
|
|
129
|
+
}
|
|
130
|
+
function debugString(val) {
|
|
131
|
+
const type = typeof val;
|
|
132
|
+
if (type == "number" || type == "boolean" || val == null) {
|
|
133
|
+
return `${val}`;
|
|
134
|
+
}
|
|
135
|
+
if (type == "string") {
|
|
136
|
+
return `"${val}"`;
|
|
137
|
+
}
|
|
138
|
+
if (type == "symbol") {
|
|
139
|
+
const description = val.description;
|
|
140
|
+
if (description == null) {
|
|
141
|
+
return "Symbol";
|
|
142
|
+
} else {
|
|
143
|
+
return `Symbol(${description})`;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (type == "function") {
|
|
147
|
+
const name = val.name;
|
|
148
|
+
if (typeof name == "string" && name.length > 0) {
|
|
149
|
+
return `Function(${name})`;
|
|
150
|
+
} else {
|
|
151
|
+
return "Function";
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (Array.isArray(val)) {
|
|
155
|
+
const length = val.length;
|
|
156
|
+
let debug = "[";
|
|
157
|
+
if (length > 0) {
|
|
158
|
+
debug += debugString(val[0]);
|
|
159
|
+
}
|
|
160
|
+
for (let i = 1; i < length; i++) {
|
|
161
|
+
debug += ", " + debugString(val[i]);
|
|
162
|
+
}
|
|
163
|
+
debug += "]";
|
|
164
|
+
return debug;
|
|
165
|
+
}
|
|
166
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
167
|
+
let className;
|
|
168
|
+
if (builtInMatches.length > 1) {
|
|
169
|
+
className = builtInMatches[1];
|
|
170
|
+
} else {
|
|
171
|
+
return toString.call(val);
|
|
172
|
+
}
|
|
173
|
+
if (className == "Object") {
|
|
174
|
+
try {
|
|
175
|
+
return "Object(" + JSON.stringify(val) + ")";
|
|
176
|
+
} catch (_) {
|
|
177
|
+
return "Object";
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (val instanceof Error) {
|
|
181
|
+
return `${val.name}: ${val.message}
|
|
182
|
+
${val.stack}`;
|
|
183
|
+
}
|
|
184
|
+
return className;
|
|
185
|
+
}
|
|
186
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
187
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
188
|
+
const real = (...args) => {
|
|
189
|
+
state.cnt++;
|
|
190
|
+
const a = state.a;
|
|
191
|
+
state.a = 0;
|
|
192
|
+
try {
|
|
193
|
+
return f(a, state.b, ...args);
|
|
194
|
+
} finally {
|
|
195
|
+
if (--state.cnt === 0) {
|
|
196
|
+
wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
|
|
197
|
+
} else {
|
|
198
|
+
state.a = a;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
real.original = state;
|
|
203
|
+
return real;
|
|
204
|
+
}
|
|
205
|
+
function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
206
|
+
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h21c8ca3eb6ab9385(arg0, arg1, addHeapObject(arg2));
|
|
207
|
+
}
|
|
208
|
+
function initLogLevel(filter) {
|
|
209
|
+
try {
|
|
210
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
211
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
212
|
+
const len0 = WASM_VECTOR_LEN;
|
|
213
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
214
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
215
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
216
|
+
if (r1) {
|
|
217
|
+
throw takeObject(r0);
|
|
218
|
+
}
|
|
219
|
+
} finally {
|
|
220
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
224
|
+
const ptr = malloc(arg.length * 1) >>> 0;
|
|
225
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
226
|
+
WASM_VECTOR_LEN = arg.length;
|
|
227
|
+
return ptr;
|
|
228
|
+
}
|
|
229
|
+
function getReturnWitness(program, witness_map) {
|
|
230
|
+
try {
|
|
231
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
232
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
233
|
+
const len0 = WASM_VECTOR_LEN;
|
|
234
|
+
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
235
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
236
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
237
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
238
|
+
if (r2) {
|
|
239
|
+
throw takeObject(r1);
|
|
240
|
+
}
|
|
241
|
+
return takeObject(r0);
|
|
242
|
+
} finally {
|
|
243
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function getPublicParametersWitness(program, solved_witness) {
|
|
247
|
+
try {
|
|
248
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
249
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
250
|
+
const len0 = WASM_VECTOR_LEN;
|
|
251
|
+
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
252
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
253
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
254
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
255
|
+
if (r2) {
|
|
256
|
+
throw takeObject(r1);
|
|
257
|
+
}
|
|
258
|
+
return takeObject(r0);
|
|
259
|
+
} finally {
|
|
260
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
function getPublicWitness(program, solved_witness) {
|
|
264
|
+
try {
|
|
265
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
266
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
267
|
+
const len0 = WASM_VECTOR_LEN;
|
|
268
|
+
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
269
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
270
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
271
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
272
|
+
if (r2) {
|
|
273
|
+
throw takeObject(r1);
|
|
274
|
+
}
|
|
275
|
+
return takeObject(r0);
|
|
276
|
+
} finally {
|
|
277
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
function and(lhs, rhs) {
|
|
281
|
+
const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs));
|
|
282
|
+
return takeObject(ret);
|
|
283
|
+
}
|
|
284
|
+
function xor(lhs, rhs) {
|
|
285
|
+
const ret = wasm.xor(addHeapObject(lhs), addHeapObject(rhs));
|
|
286
|
+
return takeObject(ret);
|
|
287
|
+
}
|
|
288
|
+
var cachedUint32Memory0 = null;
|
|
289
|
+
function getUint32Memory0() {
|
|
290
|
+
if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
|
|
291
|
+
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
|
|
292
|
+
}
|
|
293
|
+
return cachedUint32Memory0;
|
|
294
|
+
}
|
|
295
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
296
|
+
const ptr = malloc(arg.length * 4) >>> 0;
|
|
297
|
+
getUint32Memory0().set(arg, ptr / 4);
|
|
298
|
+
WASM_VECTOR_LEN = arg.length;
|
|
299
|
+
return ptr;
|
|
300
|
+
}
|
|
301
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
302
|
+
ptr = ptr >>> 0;
|
|
303
|
+
return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
|
|
304
|
+
}
|
|
305
|
+
function sha256_compression(inputs, state) {
|
|
306
|
+
try {
|
|
307
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
308
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
309
|
+
const len0 = WASM_VECTOR_LEN;
|
|
310
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
311
|
+
const len1 = WASM_VECTOR_LEN;
|
|
312
|
+
wasm.sha256_compression(retptr, ptr0, len0, ptr1, len1);
|
|
313
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
314
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
315
|
+
var v3 = getArrayU32FromWasm0(r0, r1).slice();
|
|
316
|
+
wasm.__wbindgen_free(r0, r1 * 4);
|
|
317
|
+
return v3;
|
|
318
|
+
} finally {
|
|
319
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
323
|
+
ptr = ptr >>> 0;
|
|
324
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
325
|
+
}
|
|
326
|
+
function blake2s256(inputs) {
|
|
327
|
+
try {
|
|
328
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
329
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
330
|
+
const len0 = WASM_VECTOR_LEN;
|
|
331
|
+
wasm.blake2s256(retptr, ptr0, len0);
|
|
332
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
333
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
334
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
335
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
336
|
+
return v2;
|
|
337
|
+
} finally {
|
|
338
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
342
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
343
|
+
const len0 = WASM_VECTOR_LEN;
|
|
344
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
345
|
+
const len1 = WASM_VECTOR_LEN;
|
|
346
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
347
|
+
const len2 = WASM_VECTOR_LEN;
|
|
348
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
349
|
+
const len3 = WASM_VECTOR_LEN;
|
|
350
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
351
|
+
return ret !== 0;
|
|
352
|
+
}
|
|
353
|
+
function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
354
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
355
|
+
const len0 = WASM_VECTOR_LEN;
|
|
356
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
357
|
+
const len1 = WASM_VECTOR_LEN;
|
|
358
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
359
|
+
const len2 = WASM_VECTOR_LEN;
|
|
360
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
361
|
+
const len3 = WASM_VECTOR_LEN;
|
|
362
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
363
|
+
return ret !== 0;
|
|
364
|
+
}
|
|
365
|
+
function buildInfo() {
|
|
366
|
+
const ret = wasm.buildInfo();
|
|
367
|
+
return takeObject(ret);
|
|
368
|
+
}
|
|
369
|
+
function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
370
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
371
|
+
const len0 = WASM_VECTOR_LEN;
|
|
372
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
373
|
+
return takeObject(ret);
|
|
374
|
+
}
|
|
375
|
+
function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
376
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
377
|
+
const len0 = WASM_VECTOR_LEN;
|
|
378
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
379
|
+
return takeObject(ret);
|
|
380
|
+
}
|
|
381
|
+
function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
382
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
383
|
+
const len0 = WASM_VECTOR_LEN;
|
|
384
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
385
|
+
return takeObject(ret);
|
|
386
|
+
}
|
|
387
|
+
function compressWitness(witness_map) {
|
|
388
|
+
try {
|
|
389
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
390
|
+
wasm.compressWitness(retptr, addHeapObject(witness_map));
|
|
391
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
392
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
393
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
394
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
395
|
+
if (r3) {
|
|
396
|
+
throw takeObject(r2);
|
|
397
|
+
}
|
|
398
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
399
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
400
|
+
return v1;
|
|
401
|
+
} finally {
|
|
402
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
function decompressWitness(compressed_witness) {
|
|
406
|
+
try {
|
|
407
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
408
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
409
|
+
const len0 = WASM_VECTOR_LEN;
|
|
410
|
+
wasm.decompressWitness(retptr, ptr0, len0);
|
|
411
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
412
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
413
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
414
|
+
if (r2) {
|
|
415
|
+
throw takeObject(r1);
|
|
416
|
+
}
|
|
417
|
+
return takeObject(r0);
|
|
418
|
+
} finally {
|
|
419
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
function compressWitnessStack(witness_stack) {
|
|
423
|
+
try {
|
|
424
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
425
|
+
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
|
|
426
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
427
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
428
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
429
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
430
|
+
if (r3) {
|
|
431
|
+
throw takeObject(r2);
|
|
432
|
+
}
|
|
433
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
434
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
435
|
+
return v1;
|
|
436
|
+
} finally {
|
|
437
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
function decompressWitnessStack(compressed_witness) {
|
|
441
|
+
try {
|
|
442
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
443
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
444
|
+
const len0 = WASM_VECTOR_LEN;
|
|
445
|
+
wasm.decompressWitnessStack(retptr, ptr0, len0);
|
|
446
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
447
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
448
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
449
|
+
if (r2) {
|
|
450
|
+
throw takeObject(r1);
|
|
451
|
+
}
|
|
452
|
+
return takeObject(r0);
|
|
453
|
+
} finally {
|
|
454
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
|
|
458
|
+
wasm.wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
459
|
+
}
|
|
460
|
+
function handleError(f, args) {
|
|
461
|
+
try {
|
|
462
|
+
return f.apply(this, args);
|
|
463
|
+
} catch (e) {
|
|
464
|
+
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
|
|
468
|
+
wasm.wasm_bindgen__convert__closures__invoke2_mut__h0d187b0f08495587(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
469
|
+
}
|
|
470
|
+
async function __wbg_load(module, imports) {
|
|
471
|
+
if (typeof Response === "function" && module instanceof Response) {
|
|
472
|
+
if (typeof WebAssembly.instantiateStreaming === "function") {
|
|
473
|
+
try {
|
|
474
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
475
|
+
} catch (e) {
|
|
476
|
+
if (module.headers.get("Content-Type") != "application/wasm") {
|
|
477
|
+
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);
|
|
478
|
+
} else {
|
|
479
|
+
throw e;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
const bytes = await module.arrayBuffer();
|
|
484
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
485
|
+
} else {
|
|
486
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
487
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
488
|
+
return { instance, module };
|
|
489
|
+
} else {
|
|
490
|
+
return instance;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
function __wbg_get_imports() {
|
|
495
|
+
const imports = {};
|
|
496
|
+
imports.wbg = {};
|
|
497
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
498
|
+
takeObject(arg0);
|
|
499
|
+
};
|
|
500
|
+
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
501
|
+
const obj = takeObject(arg0).original;
|
|
502
|
+
if (obj.cnt-- == 1) {
|
|
503
|
+
obj.a = 0;
|
|
504
|
+
return true;
|
|
505
|
+
}
|
|
506
|
+
const ret = false;
|
|
507
|
+
return ret;
|
|
508
|
+
};
|
|
509
|
+
imports.wbg.__wbg_constructor_79bab16c42849d1b = function(arg0) {
|
|
510
|
+
const ret = new Error(takeObject(arg0));
|
|
511
|
+
return addHeapObject(ret);
|
|
512
|
+
};
|
|
513
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
514
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
515
|
+
return addHeapObject(ret);
|
|
516
|
+
};
|
|
517
|
+
imports.wbg.__wbg_new_610492d70b2d4e55 = function() {
|
|
518
|
+
const ret = new Array();
|
|
519
|
+
return addHeapObject(ret);
|
|
520
|
+
};
|
|
521
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
522
|
+
const ret = arg0;
|
|
523
|
+
return addHeapObject(ret);
|
|
524
|
+
};
|
|
525
|
+
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
526
|
+
const obj = getObject(arg1);
|
|
527
|
+
const ret = typeof obj === "number" ? obj : void 0;
|
|
528
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
529
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
530
|
+
};
|
|
531
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
532
|
+
const ret = typeof getObject(arg0) === "string";
|
|
533
|
+
return ret;
|
|
534
|
+
};
|
|
535
|
+
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
536
|
+
const ret = Array.isArray(getObject(arg0));
|
|
537
|
+
return ret;
|
|
538
|
+
};
|
|
539
|
+
imports.wbg.__wbg_new_7b5514a697f386eb = function() {
|
|
540
|
+
const ret = /* @__PURE__ */ new Map();
|
|
541
|
+
return addHeapObject(ret);
|
|
542
|
+
};
|
|
543
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
544
|
+
const obj = getObject(arg1);
|
|
545
|
+
const ret = typeof obj === "string" ? obj : void 0;
|
|
546
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
547
|
+
var len1 = WASM_VECTOR_LEN;
|
|
548
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
549
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
550
|
+
};
|
|
551
|
+
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
552
|
+
const ret = new Error();
|
|
553
|
+
return addHeapObject(ret);
|
|
554
|
+
};
|
|
555
|
+
imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
|
|
556
|
+
const ret = getObject(arg1).stack;
|
|
557
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
558
|
+
const len1 = WASM_VECTOR_LEN;
|
|
559
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
560
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
561
|
+
};
|
|
562
|
+
imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
563
|
+
let deferred0_0;
|
|
564
|
+
let deferred0_1;
|
|
565
|
+
try {
|
|
566
|
+
deferred0_0 = arg0;
|
|
567
|
+
deferred0_1 = arg1;
|
|
568
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
569
|
+
} finally {
|
|
570
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1);
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
imports.wbg.__wbg_debug_e3f6a1578e6d45ca = function(arg0) {
|
|
574
|
+
console.debug(getObject(arg0));
|
|
575
|
+
};
|
|
576
|
+
imports.wbg.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
|
|
577
|
+
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
578
|
+
};
|
|
579
|
+
imports.wbg.__wbg_error_a7e23606158b68b9 = function(arg0) {
|
|
580
|
+
console.error(getObject(arg0));
|
|
581
|
+
};
|
|
582
|
+
imports.wbg.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) {
|
|
583
|
+
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
584
|
+
};
|
|
585
|
+
imports.wbg.__wbg_info_05db236d79f1b785 = function(arg0) {
|
|
586
|
+
console.info(getObject(arg0));
|
|
587
|
+
};
|
|
588
|
+
imports.wbg.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) {
|
|
589
|
+
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
590
|
+
};
|
|
591
|
+
imports.wbg.__wbg_warn_9bdd743e9f5fe1e0 = function(arg0) {
|
|
592
|
+
console.warn(getObject(arg0));
|
|
593
|
+
};
|
|
594
|
+
imports.wbg.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
|
|
595
|
+
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
596
|
+
};
|
|
597
|
+
imports.wbg.__wbg_get_7303ed2ef026b2f5 = function(arg0, arg1) {
|
|
598
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
599
|
+
return addHeapObject(ret);
|
|
600
|
+
};
|
|
601
|
+
imports.wbg.__wbg_length_820c786973abdd8a = function(arg0) {
|
|
602
|
+
const ret = getObject(arg0).length;
|
|
603
|
+
return ret;
|
|
604
|
+
};
|
|
605
|
+
imports.wbg.__wbg_new_0394642eae39db16 = function() {
|
|
606
|
+
const ret = new Array();
|
|
607
|
+
return addHeapObject(ret);
|
|
608
|
+
};
|
|
609
|
+
imports.wbg.__wbg_new_0f2b71ca2f2a6029 = function() {
|
|
610
|
+
const ret = /* @__PURE__ */ new Map();
|
|
611
|
+
return addHeapObject(ret);
|
|
612
|
+
};
|
|
613
|
+
imports.wbg.__wbg_from_6bc98a09a0b58bb1 = function(arg0) {
|
|
614
|
+
const ret = Array.from(getObject(arg0));
|
|
615
|
+
return addHeapObject(ret);
|
|
616
|
+
};
|
|
617
|
+
imports.wbg.__wbg_forEach_5ae261259d7517c8 = function(arg0, arg1, arg2) {
|
|
618
|
+
try {
|
|
619
|
+
var state0 = { a: arg1, b: arg2 };
|
|
620
|
+
var cb0 = (arg02, arg12, arg22) => {
|
|
621
|
+
const a = state0.a;
|
|
622
|
+
state0.a = 0;
|
|
623
|
+
try {
|
|
624
|
+
return __wbg_adapter_75(a, state0.b, arg02, arg12, arg22);
|
|
625
|
+
} finally {
|
|
626
|
+
state0.a = a;
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
getObject(arg0).forEach(cb0);
|
|
630
|
+
} finally {
|
|
631
|
+
state0.a = state0.b = 0;
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
imports.wbg.__wbg_push_109cfc26d02582dd = function(arg0, arg1) {
|
|
635
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
|
636
|
+
return ret;
|
|
637
|
+
};
|
|
638
|
+
imports.wbg.__wbg_reverse_a322332d916e2705 = function(arg0) {
|
|
639
|
+
const ret = getObject(arg0).reverse();
|
|
640
|
+
return addHeapObject(ret);
|
|
641
|
+
};
|
|
642
|
+
imports.wbg.__wbg_new_87297f22973157c8 = function(arg0, arg1) {
|
|
643
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
644
|
+
return addHeapObject(ret);
|
|
645
|
+
};
|
|
646
|
+
imports.wbg.__wbg_setcause_394738aae0ce9341 = function(arg0, arg1) {
|
|
647
|
+
getObject(arg0).cause = getObject(arg1);
|
|
648
|
+
};
|
|
649
|
+
imports.wbg.__wbg_call_587b30eea3e09332 = function() {
|
|
650
|
+
return handleError(function(arg0, arg1, arg2) {
|
|
651
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
652
|
+
return addHeapObject(ret);
|
|
653
|
+
}, arguments);
|
|
654
|
+
};
|
|
655
|
+
imports.wbg.__wbg_call_4c73e4aecced6a7d = function() {
|
|
656
|
+
return handleError(function(arg0, arg1, arg2, arg3) {
|
|
657
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
|
|
658
|
+
return addHeapObject(ret);
|
|
659
|
+
}, arguments);
|
|
660
|
+
};
|
|
661
|
+
imports.wbg.__wbg_forEach_942772130a8d06a6 = function(arg0, arg1, arg2) {
|
|
662
|
+
try {
|
|
663
|
+
var state0 = { a: arg1, b: arg2 };
|
|
664
|
+
var cb0 = (arg02, arg12) => {
|
|
665
|
+
const a = state0.a;
|
|
666
|
+
state0.a = 0;
|
|
667
|
+
try {
|
|
668
|
+
return __wbg_adapter_92(a, state0.b, arg02, arg12);
|
|
669
|
+
} finally {
|
|
670
|
+
state0.a = a;
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
getObject(arg0).forEach(cb0);
|
|
674
|
+
} finally {
|
|
675
|
+
state0.a = state0.b = 0;
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
imports.wbg.__wbg_set_da7be7bf0e037b14 = function(arg0, arg1, arg2) {
|
|
679
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
680
|
+
return addHeapObject(ret);
|
|
681
|
+
};
|
|
682
|
+
imports.wbg.__wbg_fromEntries_d1b310956d20d858 = function() {
|
|
683
|
+
return handleError(function(arg0) {
|
|
684
|
+
const ret = Object.fromEntries(getObject(arg0));
|
|
685
|
+
return addHeapObject(ret);
|
|
686
|
+
}, arguments);
|
|
687
|
+
};
|
|
688
|
+
imports.wbg.__wbg_values_099fd000c271c313 = function(arg0) {
|
|
689
|
+
const ret = Object.values(getObject(arg0));
|
|
690
|
+
return addHeapObject(ret);
|
|
691
|
+
};
|
|
692
|
+
imports.wbg.__wbg_new_2b55e405e4af4986 = function(arg0, arg1) {
|
|
693
|
+
try {
|
|
694
|
+
var state0 = { a: arg0, b: arg1 };
|
|
695
|
+
var cb0 = (arg02, arg12) => {
|
|
696
|
+
const a = state0.a;
|
|
697
|
+
state0.a = 0;
|
|
698
|
+
try {
|
|
699
|
+
return __wbg_adapter_92(a, state0.b, arg02, arg12);
|
|
700
|
+
} finally {
|
|
701
|
+
state0.a = a;
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
const ret = new Promise(cb0);
|
|
705
|
+
return addHeapObject(ret);
|
|
706
|
+
} finally {
|
|
707
|
+
state0.a = state0.b = 0;
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
imports.wbg.__wbg_resolve_ae38ad63c43ff98b = function(arg0) {
|
|
711
|
+
const ret = Promise.resolve(getObject(arg0));
|
|
712
|
+
return addHeapObject(ret);
|
|
713
|
+
};
|
|
714
|
+
imports.wbg.__wbg_then_8df675b8bb5d5e3c = function(arg0, arg1) {
|
|
715
|
+
const ret = getObject(arg0).then(getObject(arg1));
|
|
716
|
+
return addHeapObject(ret);
|
|
717
|
+
};
|
|
718
|
+
imports.wbg.__wbg_then_835b073a479138e5 = function(arg0, arg1, arg2) {
|
|
719
|
+
const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
|
|
720
|
+
return addHeapObject(ret);
|
|
721
|
+
};
|
|
722
|
+
imports.wbg.__wbg_parse_76a8a18ca3f8730b = function() {
|
|
723
|
+
return handleError(function(arg0, arg1) {
|
|
724
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
725
|
+
return addHeapObject(ret);
|
|
726
|
+
}, arguments);
|
|
727
|
+
};
|
|
728
|
+
imports.wbg.__wbg_set_07da13cc24b69217 = function() {
|
|
729
|
+
return handleError(function(arg0, arg1, arg2) {
|
|
730
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
731
|
+
return ret;
|
|
732
|
+
}, arguments);
|
|
733
|
+
};
|
|
734
|
+
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
735
|
+
const ret = debugString(getObject(arg1));
|
|
736
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
737
|
+
const len1 = WASM_VECTOR_LEN;
|
|
738
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
739
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
740
|
+
};
|
|
741
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
742
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
743
|
+
};
|
|
744
|
+
imports.wbg.__wbindgen_closure_wrapper734 = function(arg0, arg1, arg2) {
|
|
745
|
+
const ret = makeMutClosure(arg0, arg1, 268, __wbg_adapter_22);
|
|
746
|
+
return addHeapObject(ret);
|
|
747
|
+
};
|
|
748
|
+
return imports;
|
|
749
|
+
}
|
|
750
|
+
function __wbg_init_memory(imports, maybe_memory) {
|
|
751
|
+
}
|
|
752
|
+
function __wbg_finalize_init(instance, module) {
|
|
753
|
+
wasm = instance.exports;
|
|
754
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
755
|
+
cachedFloat64Memory0 = null;
|
|
756
|
+
cachedInt32Memory0 = null;
|
|
757
|
+
cachedUint32Memory0 = null;
|
|
758
|
+
cachedUint8Memory0 = null;
|
|
759
|
+
return wasm;
|
|
760
|
+
}
|
|
761
|
+
function initSync(module) {
|
|
762
|
+
if (wasm !== void 0) return wasm;
|
|
763
|
+
const imports = __wbg_get_imports();
|
|
764
|
+
__wbg_init_memory(imports);
|
|
765
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
766
|
+
module = new WebAssembly.Module(module);
|
|
767
|
+
}
|
|
768
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
769
|
+
return __wbg_finalize_init(instance, module);
|
|
770
|
+
}
|
|
771
|
+
async function __wbg_init(input) {
|
|
772
|
+
if (wasm !== void 0) return wasm;
|
|
773
|
+
if (typeof input === "undefined") {
|
|
774
|
+
input = new URL("acvm_js_bg.wasm", import.meta.url);
|
|
775
|
+
}
|
|
776
|
+
const imports = __wbg_get_imports();
|
|
777
|
+
if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
|
|
778
|
+
input = fetch(input);
|
|
779
|
+
}
|
|
780
|
+
__wbg_init_memory(imports);
|
|
781
|
+
const { instance, module } = await __wbg_load(await input, imports);
|
|
782
|
+
return __wbg_finalize_init(instance, module);
|
|
783
|
+
}
|
|
784
|
+
var acvm_js_default = __wbg_init;
|
|
785
|
+
|
|
786
|
+
// ../../node_modules/@noir-lang/noirc_abi/web/noirc_abi_wasm.js
|
|
787
|
+
var noirc_abi_wasm_exports = {};
|
|
788
|
+
__export(noirc_abi_wasm_exports, {
|
|
789
|
+
abiDecode: () => abiDecode,
|
|
790
|
+
abiDecodeError: () => abiDecodeError,
|
|
791
|
+
abiEncode: () => abiEncode,
|
|
792
|
+
default: () => noirc_abi_wasm_default,
|
|
793
|
+
initSync: () => initSync2,
|
|
794
|
+
serializeWitness: () => serializeWitness
|
|
795
|
+
});
|
|
796
|
+
var wasm2;
|
|
797
|
+
var heap2 = new Array(128).fill(void 0);
|
|
798
|
+
heap2.push(void 0, null, true, false);
|
|
799
|
+
function getObject2(idx) {
|
|
800
|
+
return heap2[idx];
|
|
801
|
+
}
|
|
802
|
+
function isLikeNone2(x) {
|
|
803
|
+
return x === void 0 || x === null;
|
|
804
|
+
}
|
|
805
|
+
var cachedFloat64Memory02 = null;
|
|
806
|
+
function getFloat64Memory02() {
|
|
807
|
+
if (cachedFloat64Memory02 === null || cachedFloat64Memory02.byteLength === 0) {
|
|
808
|
+
cachedFloat64Memory02 = new Float64Array(wasm2.memory.buffer);
|
|
809
|
+
}
|
|
810
|
+
return cachedFloat64Memory02;
|
|
811
|
+
}
|
|
812
|
+
var cachedInt32Memory02 = null;
|
|
813
|
+
function getInt32Memory02() {
|
|
814
|
+
if (cachedInt32Memory02 === null || cachedInt32Memory02.byteLength === 0) {
|
|
815
|
+
cachedInt32Memory02 = new Int32Array(wasm2.memory.buffer);
|
|
816
|
+
}
|
|
817
|
+
return cachedInt32Memory02;
|
|
818
|
+
}
|
|
819
|
+
var heap_next2 = heap2.length;
|
|
820
|
+
function dropObject2(idx) {
|
|
821
|
+
if (idx < 132) return;
|
|
822
|
+
heap2[idx] = heap_next2;
|
|
823
|
+
heap_next2 = idx;
|
|
824
|
+
}
|
|
825
|
+
function takeObject2(idx) {
|
|
826
|
+
const ret = getObject2(idx);
|
|
827
|
+
dropObject2(idx);
|
|
828
|
+
return ret;
|
|
829
|
+
}
|
|
830
|
+
var WASM_VECTOR_LEN2 = 0;
|
|
831
|
+
var cachedUint8Memory02 = null;
|
|
832
|
+
function getUint8Memory02() {
|
|
833
|
+
if (cachedUint8Memory02 === null || cachedUint8Memory02.byteLength === 0) {
|
|
834
|
+
cachedUint8Memory02 = new Uint8Array(wasm2.memory.buffer);
|
|
835
|
+
}
|
|
836
|
+
return cachedUint8Memory02;
|
|
837
|
+
}
|
|
838
|
+
var cachedTextEncoder2 = typeof TextEncoder !== "undefined" ? new TextEncoder("utf-8") : { encode: () => {
|
|
839
|
+
throw Error("TextEncoder not available");
|
|
840
|
+
} };
|
|
841
|
+
var encodeString2 = typeof cachedTextEncoder2.encodeInto === "function" ? function(arg, view) {
|
|
842
|
+
return cachedTextEncoder2.encodeInto(arg, view);
|
|
843
|
+
} : function(arg, view) {
|
|
844
|
+
const buf = cachedTextEncoder2.encode(arg);
|
|
845
|
+
view.set(buf);
|
|
846
|
+
return {
|
|
847
|
+
read: arg.length,
|
|
848
|
+
written: buf.length
|
|
849
|
+
};
|
|
850
|
+
};
|
|
851
|
+
function passStringToWasm02(arg, malloc, realloc) {
|
|
852
|
+
if (realloc === void 0) {
|
|
853
|
+
const buf = cachedTextEncoder2.encode(arg);
|
|
854
|
+
const ptr2 = malloc(buf.length) >>> 0;
|
|
855
|
+
getUint8Memory02().subarray(ptr2, ptr2 + buf.length).set(buf);
|
|
856
|
+
WASM_VECTOR_LEN2 = buf.length;
|
|
857
|
+
return ptr2;
|
|
858
|
+
}
|
|
859
|
+
let len = arg.length;
|
|
860
|
+
let ptr = malloc(len) >>> 0;
|
|
861
|
+
const mem = getUint8Memory02();
|
|
862
|
+
let offset = 0;
|
|
863
|
+
for (; offset < len; offset++) {
|
|
864
|
+
const code = arg.charCodeAt(offset);
|
|
865
|
+
if (code > 127) break;
|
|
866
|
+
mem[ptr + offset] = code;
|
|
867
|
+
}
|
|
868
|
+
if (offset !== len) {
|
|
869
|
+
if (offset !== 0) {
|
|
870
|
+
arg = arg.slice(offset);
|
|
871
|
+
}
|
|
872
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
|
|
873
|
+
const view = getUint8Memory02().subarray(ptr + offset, ptr + len);
|
|
874
|
+
const ret = encodeString2(arg, view);
|
|
875
|
+
offset += ret.written;
|
|
876
|
+
}
|
|
877
|
+
WASM_VECTOR_LEN2 = offset;
|
|
878
|
+
return ptr;
|
|
879
|
+
}
|
|
880
|
+
function addHeapObject2(obj) {
|
|
881
|
+
if (heap_next2 === heap2.length) heap2.push(heap2.length + 1);
|
|
882
|
+
const idx = heap_next2;
|
|
883
|
+
heap_next2 = heap2[idx];
|
|
884
|
+
heap2[idx] = obj;
|
|
885
|
+
return idx;
|
|
886
|
+
}
|
|
887
|
+
var cachedTextDecoder2 = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
|
|
888
|
+
throw Error("TextDecoder not available");
|
|
889
|
+
} };
|
|
890
|
+
if (typeof TextDecoder !== "undefined") {
|
|
891
|
+
cachedTextDecoder2.decode();
|
|
892
|
+
}
|
|
893
|
+
function getStringFromWasm02(ptr, len) {
|
|
894
|
+
ptr = ptr >>> 0;
|
|
895
|
+
return cachedTextDecoder2.decode(getUint8Memory02().subarray(ptr, ptr + len));
|
|
896
|
+
}
|
|
897
|
+
function abiEncode(abi, inputs, return_value) {
|
|
898
|
+
try {
|
|
899
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
900
|
+
wasm2.abiEncode(retptr, addHeapObject2(abi), addHeapObject2(inputs), isLikeNone2(return_value) ? 0 : addHeapObject2(return_value));
|
|
901
|
+
var r0 = getInt32Memory02()[retptr / 4 + 0];
|
|
902
|
+
var r1 = getInt32Memory02()[retptr / 4 + 1];
|
|
903
|
+
var r2 = getInt32Memory02()[retptr / 4 + 2];
|
|
904
|
+
if (r2) {
|
|
905
|
+
throw takeObject2(r1);
|
|
906
|
+
}
|
|
907
|
+
return takeObject2(r0);
|
|
908
|
+
} finally {
|
|
909
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
function abiDecode(abi, witness_map) {
|
|
913
|
+
try {
|
|
914
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
915
|
+
wasm2.abiDecode(retptr, addHeapObject2(abi), addHeapObject2(witness_map));
|
|
916
|
+
var r0 = getInt32Memory02()[retptr / 4 + 0];
|
|
917
|
+
var r1 = getInt32Memory02()[retptr / 4 + 1];
|
|
918
|
+
var r2 = getInt32Memory02()[retptr / 4 + 2];
|
|
919
|
+
if (r2) {
|
|
920
|
+
throw takeObject2(r1);
|
|
921
|
+
}
|
|
922
|
+
return takeObject2(r0);
|
|
923
|
+
} finally {
|
|
924
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
function getArrayU8FromWasm02(ptr, len) {
|
|
928
|
+
ptr = ptr >>> 0;
|
|
929
|
+
return getUint8Memory02().subarray(ptr / 1, ptr / 1 + len);
|
|
930
|
+
}
|
|
931
|
+
function serializeWitness(witness_map) {
|
|
932
|
+
try {
|
|
933
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
934
|
+
wasm2.serializeWitness(retptr, addHeapObject2(witness_map));
|
|
935
|
+
var r0 = getInt32Memory02()[retptr / 4 + 0];
|
|
936
|
+
var r1 = getInt32Memory02()[retptr / 4 + 1];
|
|
937
|
+
var r2 = getInt32Memory02()[retptr / 4 + 2];
|
|
938
|
+
var r3 = getInt32Memory02()[retptr / 4 + 3];
|
|
939
|
+
if (r3) {
|
|
940
|
+
throw takeObject2(r2);
|
|
941
|
+
}
|
|
942
|
+
var v1 = getArrayU8FromWasm02(r0, r1).slice();
|
|
943
|
+
wasm2.__wbindgen_free(r0, r1 * 1);
|
|
944
|
+
return v1;
|
|
945
|
+
} finally {
|
|
946
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
function abiDecodeError(abi, raw_error) {
|
|
950
|
+
try {
|
|
951
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
952
|
+
wasm2.abiDecodeError(retptr, addHeapObject2(abi), addHeapObject2(raw_error));
|
|
953
|
+
var r0 = getInt32Memory02()[retptr / 4 + 0];
|
|
954
|
+
var r1 = getInt32Memory02()[retptr / 4 + 1];
|
|
955
|
+
var r2 = getInt32Memory02()[retptr / 4 + 2];
|
|
956
|
+
if (r2) {
|
|
957
|
+
throw takeObject2(r1);
|
|
958
|
+
}
|
|
959
|
+
return takeObject2(r0);
|
|
960
|
+
} finally {
|
|
961
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
function __wbg_adapter_28(arg0, arg1, arg2, arg3) {
|
|
965
|
+
wasm2.wasm_bindgen__convert__closures__invoke2_mut__h72e05530f9fe91f9(arg0, arg1, addHeapObject2(arg2), addHeapObject2(arg3));
|
|
966
|
+
}
|
|
967
|
+
function handleError2(f, args) {
|
|
968
|
+
try {
|
|
969
|
+
return f.apply(this, args);
|
|
970
|
+
} catch (e) {
|
|
971
|
+
wasm2.__wbindgen_exn_store(addHeapObject2(e));
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
async function __wbg_load2(module, imports) {
|
|
975
|
+
if (typeof Response === "function" && module instanceof Response) {
|
|
976
|
+
if (typeof WebAssembly.instantiateStreaming === "function") {
|
|
977
|
+
try {
|
|
978
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
979
|
+
} catch (e) {
|
|
980
|
+
if (module.headers.get("Content-Type") != "application/wasm") {
|
|
981
|
+
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);
|
|
982
|
+
} else {
|
|
983
|
+
throw e;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
const bytes = await module.arrayBuffer();
|
|
988
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
989
|
+
} else {
|
|
990
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
991
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
992
|
+
return { instance, module };
|
|
993
|
+
} else {
|
|
994
|
+
return instance;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
function __wbg_get_imports2() {
|
|
999
|
+
const imports = {};
|
|
1000
|
+
imports.wbg = {};
|
|
1001
|
+
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
1002
|
+
const obj = getObject2(arg1);
|
|
1003
|
+
const ret = typeof obj === "number" ? obj : void 0;
|
|
1004
|
+
getFloat64Memory02()[arg0 / 8 + 1] = isLikeNone2(ret) ? 0 : ret;
|
|
1005
|
+
getInt32Memory02()[arg0 / 4 + 0] = !isLikeNone2(ret);
|
|
1006
|
+
};
|
|
1007
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
1008
|
+
takeObject2(arg0);
|
|
1009
|
+
};
|
|
1010
|
+
imports.wbg.__wbg_constructor_11f6668362419067 = function(arg0) {
|
|
1011
|
+
const ret = new Error(takeObject2(arg0));
|
|
1012
|
+
return addHeapObject2(ret);
|
|
1013
|
+
};
|
|
1014
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
1015
|
+
const obj = getObject2(arg1);
|
|
1016
|
+
const ret = typeof obj === "string" ? obj : void 0;
|
|
1017
|
+
var ptr1 = isLikeNone2(ret) ? 0 : passStringToWasm02(ret, wasm2.__wbindgen_malloc, wasm2.__wbindgen_realloc);
|
|
1018
|
+
var len1 = WASM_VECTOR_LEN2;
|
|
1019
|
+
getInt32Memory02()[arg0 / 4 + 1] = len1;
|
|
1020
|
+
getInt32Memory02()[arg0 / 4 + 0] = ptr1;
|
|
1021
|
+
};
|
|
1022
|
+
imports.wbg.__wbg_new_f38811e0454e36b1 = function() {
|
|
1023
|
+
const ret = /* @__PURE__ */ new Map();
|
|
1024
|
+
return addHeapObject2(ret);
|
|
1025
|
+
};
|
|
1026
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
1027
|
+
const ret = arg0;
|
|
1028
|
+
return addHeapObject2(ret);
|
|
1029
|
+
};
|
|
1030
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
1031
|
+
const ret = getStringFromWasm02(arg0, arg1);
|
|
1032
|
+
return addHeapObject2(ret);
|
|
1033
|
+
};
|
|
1034
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
1035
|
+
const ret = getObject2(arg0) === void 0;
|
|
1036
|
+
return ret;
|
|
1037
|
+
};
|
|
1038
|
+
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
1039
|
+
const ret = new Error();
|
|
1040
|
+
return addHeapObject2(ret);
|
|
1041
|
+
};
|
|
1042
|
+
imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
|
|
1043
|
+
const ret = getObject2(arg1).stack;
|
|
1044
|
+
const ptr1 = passStringToWasm02(ret, wasm2.__wbindgen_malloc, wasm2.__wbindgen_realloc);
|
|
1045
|
+
const len1 = WASM_VECTOR_LEN2;
|
|
1046
|
+
getInt32Memory02()[arg0 / 4 + 1] = len1;
|
|
1047
|
+
getInt32Memory02()[arg0 / 4 + 0] = ptr1;
|
|
1048
|
+
};
|
|
1049
|
+
imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
1050
|
+
let deferred0_0;
|
|
1051
|
+
let deferred0_1;
|
|
1052
|
+
try {
|
|
1053
|
+
deferred0_0 = arg0;
|
|
1054
|
+
deferred0_1 = arg1;
|
|
1055
|
+
console.error(getStringFromWasm02(arg0, arg1));
|
|
1056
|
+
} finally {
|
|
1057
|
+
wasm2.__wbindgen_free(deferred0_0, deferred0_1);
|
|
1058
|
+
}
|
|
1059
|
+
};
|
|
1060
|
+
imports.wbg.__wbg_forEach_942772130a8d06a6 = function(arg0, arg1, arg2) {
|
|
1061
|
+
try {
|
|
1062
|
+
var state0 = { a: arg1, b: arg2 };
|
|
1063
|
+
var cb0 = (arg02, arg12) => {
|
|
1064
|
+
const a = state0.a;
|
|
1065
|
+
state0.a = 0;
|
|
1066
|
+
try {
|
|
1067
|
+
return __wbg_adapter_28(a, state0.b, arg02, arg12);
|
|
1068
|
+
} finally {
|
|
1069
|
+
state0.a = a;
|
|
1070
|
+
}
|
|
1071
|
+
};
|
|
1072
|
+
getObject2(arg0).forEach(cb0);
|
|
1073
|
+
} finally {
|
|
1074
|
+
state0.a = state0.b = 0;
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1077
|
+
imports.wbg.__wbg_set_da7be7bf0e037b14 = function(arg0, arg1, arg2) {
|
|
1078
|
+
const ret = getObject2(arg0).set(getObject2(arg1), getObject2(arg2));
|
|
1079
|
+
return addHeapObject2(ret);
|
|
1080
|
+
};
|
|
1081
|
+
imports.wbg.__wbg_parse_76a8a18ca3f8730b = function() {
|
|
1082
|
+
return handleError2(function(arg0, arg1) {
|
|
1083
|
+
const ret = JSON.parse(getStringFromWasm02(arg0, arg1));
|
|
1084
|
+
return addHeapObject2(ret);
|
|
1085
|
+
}, arguments);
|
|
1086
|
+
};
|
|
1087
|
+
imports.wbg.__wbg_stringify_d06ad2addc54d51e = function() {
|
|
1088
|
+
return handleError2(function(arg0) {
|
|
1089
|
+
const ret = JSON.stringify(getObject2(arg0));
|
|
1090
|
+
return addHeapObject2(ret);
|
|
1091
|
+
}, arguments);
|
|
1092
|
+
};
|
|
1093
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
1094
|
+
throw new Error(getStringFromWasm02(arg0, arg1));
|
|
1095
|
+
};
|
|
1096
|
+
return imports;
|
|
1097
|
+
}
|
|
1098
|
+
function __wbg_init_memory2(imports, maybe_memory) {
|
|
1099
|
+
}
|
|
1100
|
+
function __wbg_finalize_init2(instance, module) {
|
|
1101
|
+
wasm2 = instance.exports;
|
|
1102
|
+
__wbg_init2.__wbindgen_wasm_module = module;
|
|
1103
|
+
cachedFloat64Memory02 = null;
|
|
1104
|
+
cachedInt32Memory02 = null;
|
|
1105
|
+
cachedUint8Memory02 = null;
|
|
1106
|
+
return wasm2;
|
|
1107
|
+
}
|
|
1108
|
+
function initSync2(module) {
|
|
1109
|
+
if (wasm2 !== void 0) return wasm2;
|
|
1110
|
+
const imports = __wbg_get_imports2();
|
|
1111
|
+
__wbg_init_memory2(imports);
|
|
1112
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1113
|
+
module = new WebAssembly.Module(module);
|
|
1114
|
+
}
|
|
1115
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
1116
|
+
return __wbg_finalize_init2(instance, module);
|
|
1117
|
+
}
|
|
1118
|
+
async function __wbg_init2(input) {
|
|
1119
|
+
if (wasm2 !== void 0) return wasm2;
|
|
1120
|
+
if (typeof input === "undefined") {
|
|
1121
|
+
input = new URL("noirc_abi_wasm_bg.wasm", import.meta.url);
|
|
1122
|
+
}
|
|
1123
|
+
const imports = __wbg_get_imports2();
|
|
1124
|
+
if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
|
|
1125
|
+
input = fetch(input);
|
|
1126
|
+
}
|
|
1127
|
+
__wbg_init_memory2(imports);
|
|
1128
|
+
const { instance, module } = await __wbg_load2(await input, imports);
|
|
1129
|
+
return __wbg_finalize_init2(instance, module);
|
|
1130
|
+
}
|
|
1131
|
+
var noirc_abi_wasm_default = __wbg_init2;
|
|
1132
|
+
|
|
1133
|
+
// ../../node_modules/@noir-lang/noir_js/lib/base64_decode.mjs
|
|
1134
|
+
function base64Decode(input) {
|
|
1135
|
+
if (typeof Buffer !== "undefined") {
|
|
1136
|
+
return Buffer.from(input, "base64");
|
|
1137
|
+
} else if (typeof atob === "function") {
|
|
1138
|
+
return Uint8Array.from(atob(input), (c) => c.charCodeAt(0));
|
|
1139
|
+
} else {
|
|
1140
|
+
throw new Error("No implementation found for base64 decoding.");
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
// ../../node_modules/@noir-lang/noir_js/lib/witness_generation.mjs
|
|
1145
|
+
var defaultForeignCallHandler = async (name, args) => {
|
|
1146
|
+
if (name == "print") {
|
|
1147
|
+
return [];
|
|
1148
|
+
}
|
|
1149
|
+
throw Error(`Unexpected oracle during execution: ${name}(${args.join(", ")})`);
|
|
1150
|
+
};
|
|
1151
|
+
function parseErrorPayload(abi, originalError) {
|
|
1152
|
+
const payload = originalError.rawAssertionPayload;
|
|
1153
|
+
if (!payload)
|
|
1154
|
+
return originalError;
|
|
1155
|
+
const enrichedError = originalError;
|
|
1156
|
+
try {
|
|
1157
|
+
const decodedPayload = abiDecodeError(abi, payload);
|
|
1158
|
+
if (typeof decodedPayload === "string") {
|
|
1159
|
+
enrichedError.message = `Circuit execution failed: ${decodedPayload}`;
|
|
1160
|
+
} else {
|
|
1161
|
+
enrichedError.decodedAssertionPayload = decodedPayload;
|
|
1162
|
+
}
|
|
1163
|
+
} catch (_errorDecoding) {
|
|
1164
|
+
}
|
|
1165
|
+
return enrichedError;
|
|
1166
|
+
}
|
|
1167
|
+
async function generateWitness(compiledProgram, inputs, foreignCallHandler = defaultForeignCallHandler) {
|
|
1168
|
+
const witnessMap = abiEncode(compiledProgram.abi, inputs);
|
|
1169
|
+
try {
|
|
1170
|
+
const solvedWitness = await executeProgram(base64Decode(compiledProgram.bytecode), witnessMap, foreignCallHandler);
|
|
1171
|
+
return solvedWitness;
|
|
1172
|
+
} catch (err) {
|
|
1173
|
+
if (typeof err === "object" && err !== null && "rawAssertionPayload" in err) {
|
|
1174
|
+
throw parseErrorPayload(compiledProgram.abi, err);
|
|
1175
|
+
}
|
|
1176
|
+
throw new Error(`Circuit execution failed: ${err}`);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
// ../../node_modules/@noir-lang/noir_js/lib/program.mjs
|
|
1181
|
+
var Noir = class {
|
|
1182
|
+
circuit;
|
|
1183
|
+
constructor(circuit) {
|
|
1184
|
+
this.circuit = circuit;
|
|
1185
|
+
}
|
|
1186
|
+
/** @ignore */
|
|
1187
|
+
async init() {
|
|
1188
|
+
if (typeof noirc_abi_wasm_default === "function") {
|
|
1189
|
+
await Promise.all([noirc_abi_wasm_default(), acvm_js_default()]);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* @description
|
|
1194
|
+
* Allows to execute a circuit to get its witness and return value.
|
|
1195
|
+
*
|
|
1196
|
+
* @example
|
|
1197
|
+
* ```typescript
|
|
1198
|
+
* async execute(inputs)
|
|
1199
|
+
* ```
|
|
1200
|
+
*/
|
|
1201
|
+
async execute(inputs, foreignCallHandler) {
|
|
1202
|
+
await this.init();
|
|
1203
|
+
const witness_stack = await generateWitness(this.circuit, inputs, foreignCallHandler);
|
|
1204
|
+
const main_witness = witness_stack[0].witness;
|
|
1205
|
+
const { return_value: returnValue } = abiDecode(this.circuit.abi, main_witness);
|
|
1206
|
+
return { witness: compressWitnessStack(witness_stack), returnValue };
|
|
1207
|
+
}
|
|
1208
|
+
};
|
|
1209
|
+
export {
|
|
1210
|
+
Noir,
|
|
1211
|
+
noirc_abi_wasm_exports as abi,
|
|
1212
|
+
acvm_js_exports as acvm,
|
|
1213
|
+
and,
|
|
1214
|
+
blake2s256,
|
|
1215
|
+
ecdsa_secp256k1_verify,
|
|
1216
|
+
ecdsa_secp256r1_verify,
|
|
1217
|
+
xor
|
|
1218
|
+
};
|