@provablehq/wasm 0.11.4 → 0.11.6
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/mainnet/aleo_wasm.d.ts +28 -16
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +97 -79
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +97 -80
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +97 -79
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +26 -14
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +83 -65
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +83 -66
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +83 -65
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export function runRayonThread(receiver: number): void;
|
|
4
|
-
export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
5
4
|
/**
|
|
6
5
|
* Set the WASM log level from JS. Called automatically by the SDK's
|
|
7
6
|
* `setLogLevel(level)` to keep TS and WASM logging in sync.
|
|
@@ -9,18 +8,7 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
|
9
8
|
* Values above 4 are clamped to debug.
|
|
10
9
|
*/
|
|
11
10
|
export function setWasmLogLevel(level: number): void;
|
|
12
|
-
|
|
13
|
-
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
14
|
-
*
|
|
15
|
-
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
16
|
-
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
17
|
-
*
|
|
18
|
-
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
19
|
-
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
20
|
-
* @param {Proof} proof The batch proof to verify
|
|
21
|
-
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
22
|
-
*/
|
|
23
|
-
export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
11
|
+
export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
24
12
|
/**
|
|
25
13
|
* Verify a SNARK proof against a verifying key and public inputs.
|
|
26
14
|
*
|
|
@@ -47,6 +35,18 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
|
|
|
47
35
|
* @returns {boolean} True if the execution is valid, false otherwise
|
|
48
36
|
*/
|
|
49
37
|
export function verifyFunctionExecution(execution: Execution, verifying_key: VerifyingKey, program: Program, function_id: string, imports: object | null | undefined, imported_verifying_keys: object | null | undefined, block_height: number, program_imports?: ProgramImports | null): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
40
|
+
*
|
|
41
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
42
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
43
|
+
*
|
|
44
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
45
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
46
|
+
* @param {Proof} proof The batch proof to verify
|
|
47
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
48
|
+
*/
|
|
49
|
+
export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
50
50
|
/**
|
|
51
51
|
* Set test consensus version heights for testing.
|
|
52
52
|
*
|
|
@@ -56,9 +56,21 @@ export function verifyFunctionExecution(execution: Execution, verifying_key: Ver
|
|
|
56
56
|
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
57
57
|
*
|
|
58
58
|
* Set the consensus version heights.
|
|
59
|
-
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16");
|
|
59
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17");
|
|
60
60
|
*/
|
|
61
61
|
export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the maximum number of imports allowed in a program by the
|
|
64
|
+
* snarkVM network implementation this SDK was built against.
|
|
65
|
+
*
|
|
66
|
+
* @returns {number} The maximum number of program imports.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* import { getMaxProgramImports } from '@provablehq/sdk';
|
|
70
|
+
*
|
|
71
|
+
* const maxImports = getMaxProgramImports();
|
|
72
|
+
*/
|
|
73
|
+
export function getMaxProgramImports(): number;
|
|
62
74
|
export function stringToField(string: string): Field;
|
|
63
75
|
/**
|
|
64
76
|
* Public address of an Aleo account
|
|
Binary file
|
package/dist/testnet/index.cjs
CHANGED
|
@@ -292,16 +292,6 @@ function runRayonThread(receiver) {
|
|
|
292
292
|
wasm$1.runRayonThread(receiver);
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
/**
|
|
296
|
-
* @param {URL} url
|
|
297
|
-
* @param {number} num_threads
|
|
298
|
-
* @returns {Promise<void>}
|
|
299
|
-
*/
|
|
300
|
-
function initThreadPool(url, num_threads) {
|
|
301
|
-
const ret = wasm$1.initThreadPool(addHeapObject(url), num_threads);
|
|
302
|
-
return takeObject(ret);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
295
|
/**
|
|
306
296
|
* Set the WASM log level from JS. Called automatically by the SDK's
|
|
307
297
|
* `setLogLevel(level)` to keep TS and WASM logging in sync.
|
|
@@ -313,6 +303,16 @@ function setWasmLogLevel(level) {
|
|
|
313
303
|
wasm$1.setWasmLogLevel(level);
|
|
314
304
|
}
|
|
315
305
|
|
|
306
|
+
/**
|
|
307
|
+
* @param {URL} url
|
|
308
|
+
* @param {number} num_threads
|
|
309
|
+
* @returns {Promise<void>}
|
|
310
|
+
*/
|
|
311
|
+
function initThreadPool(url, num_threads) {
|
|
312
|
+
const ret = wasm$1.initThreadPool(addHeapObject(url), num_threads);
|
|
313
|
+
return takeObject(ret);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
316
|
let stack_pointer = 128;
|
|
317
317
|
|
|
318
318
|
function addBorrowedObject(obj) {
|
|
@@ -320,38 +320,6 @@ function addBorrowedObject(obj) {
|
|
|
320
320
|
heap[--stack_pointer] = obj;
|
|
321
321
|
return stack_pointer;
|
|
322
322
|
}
|
|
323
|
-
/**
|
|
324
|
-
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
325
|
-
*
|
|
326
|
-
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
327
|
-
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
328
|
-
*
|
|
329
|
-
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
330
|
-
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
331
|
-
* @param {Proof} proof The batch proof to verify
|
|
332
|
-
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
333
|
-
* @param {Array<any>} verifying_keys
|
|
334
|
-
* @param {Array<any>} inputs
|
|
335
|
-
* @param {Proof} proof
|
|
336
|
-
* @returns {boolean}
|
|
337
|
-
*/
|
|
338
|
-
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
339
|
-
try {
|
|
340
|
-
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
341
|
-
_assertClass(proof, Proof);
|
|
342
|
-
wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
343
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
344
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
345
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
346
|
-
if (r2) {
|
|
347
|
-
throw takeObject(r1);
|
|
348
|
-
}
|
|
349
|
-
return r0 !== 0;
|
|
350
|
-
} finally {
|
|
351
|
-
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
323
|
/**
|
|
356
324
|
* Verify a SNARK proof against a verifying key and public inputs.
|
|
357
325
|
*
|
|
@@ -433,6 +401,38 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
433
401
|
}
|
|
434
402
|
}
|
|
435
403
|
|
|
404
|
+
/**
|
|
405
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
406
|
+
*
|
|
407
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
408
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
409
|
+
*
|
|
410
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
411
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
412
|
+
* @param {Proof} proof The batch proof to verify
|
|
413
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
414
|
+
* @param {Array<any>} verifying_keys
|
|
415
|
+
* @param {Array<any>} inputs
|
|
416
|
+
* @param {Proof} proof
|
|
417
|
+
* @returns {boolean}
|
|
418
|
+
*/
|
|
419
|
+
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
420
|
+
try {
|
|
421
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
422
|
+
_assertClass(proof, Proof);
|
|
423
|
+
wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
424
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
425
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
426
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
427
|
+
if (r2) {
|
|
428
|
+
throw takeObject(r1);
|
|
429
|
+
}
|
|
430
|
+
return r0 !== 0;
|
|
431
|
+
} finally {
|
|
432
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
436
|
/**
|
|
437
437
|
* Set test consensus version heights for testing.
|
|
438
438
|
*
|
|
@@ -442,7 +442,7 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
442
442
|
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
443
443
|
*
|
|
444
444
|
* Set the consensus version heights.
|
|
445
|
-
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16");
|
|
445
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17");
|
|
446
446
|
* @param {string | null} [heights]
|
|
447
447
|
* @returns {Array<any>}
|
|
448
448
|
*/
|
|
@@ -453,6 +453,23 @@ function getOrInitConsensusVersionTestHeights(heights) {
|
|
|
453
453
|
return takeObject(ret);
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
+
/**
|
|
457
|
+
* Returns the maximum number of imports allowed in a program by the
|
|
458
|
+
* snarkVM network implementation this SDK was built against.
|
|
459
|
+
*
|
|
460
|
+
* @returns {number} The maximum number of program imports.
|
|
461
|
+
*
|
|
462
|
+
* @example
|
|
463
|
+
* import { getMaxProgramImports } from '@provablehq/sdk';
|
|
464
|
+
*
|
|
465
|
+
* const maxImports = getMaxProgramImports();
|
|
466
|
+
* @returns {number}
|
|
467
|
+
*/
|
|
468
|
+
function getMaxProgramImports() {
|
|
469
|
+
const ret = wasm$1.getMaxProgramImports();
|
|
470
|
+
return ret >>> 0;
|
|
471
|
+
}
|
|
472
|
+
|
|
456
473
|
/**
|
|
457
474
|
* @param {string} string
|
|
458
475
|
* @returns {Field}
|
|
@@ -494,16 +511,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
494
511
|
}
|
|
495
512
|
return result;
|
|
496
513
|
}
|
|
497
|
-
function
|
|
498
|
-
wasm$1.
|
|
514
|
+
function __wasm_bindgen_func_elem_7463(arg0, arg1) {
|
|
515
|
+
wasm$1.__wasm_bindgen_func_elem_7463(arg0, arg1);
|
|
499
516
|
}
|
|
500
517
|
|
|
501
|
-
function
|
|
502
|
-
wasm$1.
|
|
518
|
+
function __wasm_bindgen_func_elem_8910(arg0, arg1, arg2) {
|
|
519
|
+
wasm$1.__wasm_bindgen_func_elem_8910(arg0, arg1, addHeapObject(arg2));
|
|
503
520
|
}
|
|
504
521
|
|
|
505
|
-
function
|
|
506
|
-
wasm$1.
|
|
522
|
+
function __wasm_bindgen_func_elem_7736(arg0, arg1, arg2, arg3) {
|
|
523
|
+
wasm$1.__wasm_bindgen_func_elem_7736(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
507
524
|
}
|
|
508
525
|
|
|
509
526
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -19308,7 +19325,7 @@ function __wbg_get_imports(memory) {
|
|
|
19308
19325
|
const ret = getObject(arg0).length;
|
|
19309
19326
|
return ret;
|
|
19310
19327
|
};
|
|
19311
|
-
imports.wbg.
|
|
19328
|
+
imports.wbg.__wbg_log_27d73c032446232d = function(arg0, arg1) {
|
|
19312
19329
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
19313
19330
|
};
|
|
19314
19331
|
imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
|
|
@@ -19326,7 +19343,7 @@ function __wbg_get_imports(memory) {
|
|
|
19326
19343
|
const a = state0.a;
|
|
19327
19344
|
state0.a = 0;
|
|
19328
19345
|
try {
|
|
19329
|
-
return
|
|
19346
|
+
return __wasm_bindgen_func_elem_7736(a, state0.b, arg0, arg1);
|
|
19330
19347
|
} finally {
|
|
19331
19348
|
state0.a = a;
|
|
19332
19349
|
}
|
|
@@ -19498,7 +19515,7 @@ function __wbg_get_imports(memory) {
|
|
|
19498
19515
|
const ret = Signature.__wrap(arg0);
|
|
19499
19516
|
return addHeapObject(ret);
|
|
19500
19517
|
};
|
|
19501
|
-
imports.wbg.
|
|
19518
|
+
imports.wbg.__wbg_spawnWorker_e00cacfddf7ee0c0 = function(arg0, arg1, arg2, arg3) {
|
|
19502
19519
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
19503
19520
|
return addHeapObject(ret);
|
|
19504
19521
|
};
|
|
@@ -19580,21 +19597,11 @@ function __wbg_get_imports(memory) {
|
|
|
19580
19597
|
const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
|
|
19581
19598
|
return addHeapObject(ret);
|
|
19582
19599
|
};
|
|
19583
|
-
imports.wbg.__wbindgen_cast_073ddd2b87fab8ab = function(arg0, arg1) {
|
|
19584
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19585
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7391, __wasm_bindgen_func_elem_7392);
|
|
19586
|
-
return addHeapObject(ret);
|
|
19587
|
-
};
|
|
19588
19600
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
19589
19601
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
19590
19602
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
19591
19603
|
return addHeapObject(ret);
|
|
19592
19604
|
};
|
|
19593
|
-
imports.wbg.__wbindgen_cast_263b62405be3c669 = function(arg0, arg1) {
|
|
19594
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19595
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7391, __wasm_bindgen_func_elem_8765);
|
|
19596
|
-
return addHeapObject(ret);
|
|
19597
|
-
};
|
|
19598
19605
|
imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
|
|
19599
19606
|
// Cast intrinsic for `I128 -> Externref`.
|
|
19600
19607
|
const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
|
|
@@ -19605,9 +19612,9 @@ function __wbg_get_imports(memory) {
|
|
|
19605
19612
|
const ret = BigInt.asUintN(64, arg0);
|
|
19606
19613
|
return addHeapObject(ret);
|
|
19607
19614
|
};
|
|
19608
|
-
imports.wbg.
|
|
19609
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
19610
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.
|
|
19615
|
+
imports.wbg.__wbindgen_cast_69588da295a6a0d2 = function(arg0, arg1) {
|
|
19616
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 390, function: Function { arguments: [], shim_idx: 495, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19617
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7462, __wasm_bindgen_func_elem_7463);
|
|
19611
19618
|
return addHeapObject(ret);
|
|
19612
19619
|
};
|
|
19613
19620
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
@@ -19615,11 +19622,21 @@ function __wbg_get_imports(memory) {
|
|
|
19615
19622
|
const ret = arg0;
|
|
19616
19623
|
return addHeapObject(ret);
|
|
19617
19624
|
};
|
|
19625
|
+
imports.wbg.__wbindgen_cast_b5deba2f813aede2 = function(arg0, arg1) {
|
|
19626
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 390, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 391, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19627
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7462, __wasm_bindgen_func_elem_8910);
|
|
19628
|
+
return addHeapObject(ret);
|
|
19629
|
+
};
|
|
19618
19630
|
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
19619
19631
|
// Cast intrinsic for `F64 -> Externref`.
|
|
19620
19632
|
const ret = arg0;
|
|
19621
19633
|
return addHeapObject(ret);
|
|
19622
19634
|
};
|
|
19635
|
+
imports.wbg.__wbindgen_cast_e15614d8168764d1 = function(arg0, arg1) {
|
|
19636
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 390, function: Function { arguments: [Externref], shim_idx: 391, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19637
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7462, __wasm_bindgen_func_elem_8910);
|
|
19638
|
+
return addHeapObject(ret);
|
|
19639
|
+
};
|
|
19623
19640
|
imports.wbg.__wbindgen_cast_e7b45dd881f38ce3 = function(arg0, arg1) {
|
|
19624
19641
|
// Cast intrinsic for `U128 -> Externref`.
|
|
19625
19642
|
const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));
|
|
@@ -19767,6 +19784,7 @@ var exports$1$1 = /*#__PURE__*/Object.freeze({
|
|
|
19767
19784
|
VerifyingKey: VerifyingKey,
|
|
19768
19785
|
ViewKey: ViewKey,
|
|
19769
19786
|
default: __wbg_init,
|
|
19787
|
+
getMaxProgramImports: getMaxProgramImports,
|
|
19770
19788
|
getOrInitConsensusVersionTestHeights: getOrInitConsensusVersionTestHeights,
|
|
19771
19789
|
initSync: initSync$1,
|
|
19772
19790
|
initThreadPool: initThreadPool,
|