@provablehq/wasm 0.11.6 → 0.11.7
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 +21 -21
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +87 -87
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +87 -87
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +87 -87
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +22 -22
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +77 -77
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +77 -77
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +77 -77
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -21,6 +21,18 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
|
21
21
|
* @returns {boolean} True if the proof is valid, false otherwise
|
|
22
22
|
*/
|
|
23
23
|
export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
26
|
+
*
|
|
27
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
28
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
29
|
+
*
|
|
30
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
31
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
32
|
+
* @param {Proof} proof The batch proof to verify
|
|
33
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
34
|
+
*/
|
|
35
|
+
export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
24
36
|
/**
|
|
25
37
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
26
38
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -35,18 +47,19 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
|
|
|
35
47
|
* @returns {boolean} True if the execution is valid, false otherwise
|
|
36
48
|
*/
|
|
37
49
|
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;
|
|
50
|
+
export function stringToField(string: string): Field;
|
|
38
51
|
/**
|
|
39
|
-
*
|
|
52
|
+
* Returns the maximum number of imports allowed in a program by the
|
|
53
|
+
* snarkVM network implementation this SDK was built against.
|
|
40
54
|
*
|
|
41
|
-
*
|
|
42
|
-
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
55
|
+
* @returns {number} The maximum number of program imports.
|
|
43
56
|
*
|
|
44
|
-
* @
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
57
|
+
* @example
|
|
58
|
+
* import { getMaxProgramImports } from '@provablehq/sdk';
|
|
59
|
+
*
|
|
60
|
+
* const maxImports = getMaxProgramImports();
|
|
48
61
|
*/
|
|
49
|
-
export function
|
|
62
|
+
export function getMaxProgramImports(): number;
|
|
50
63
|
/**
|
|
51
64
|
* Set test consensus version heights for testing.
|
|
52
65
|
*
|
|
@@ -56,22 +69,9 @@ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>,
|
|
|
56
69
|
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
57
70
|
*
|
|
58
71
|
* Set the consensus version heights.
|
|
59
|
-
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17");
|
|
72
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
|
|
60
73
|
*/
|
|
61
74
|
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;
|
|
74
|
-
export function stringToField(string: string): Field;
|
|
75
75
|
/**
|
|
76
76
|
* Public address of an Aleo account
|
|
77
77
|
*/
|
|
Binary file
|
package/dist/testnet/index.cjs
CHANGED
|
@@ -353,6 +353,38 @@ function snarkVerify(verifying_key, inputs, proof) {
|
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
/**
|
|
357
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
358
|
+
*
|
|
359
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
360
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
361
|
+
*
|
|
362
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
363
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
364
|
+
* @param {Proof} proof The batch proof to verify
|
|
365
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
366
|
+
* @param {Array<any>} verifying_keys
|
|
367
|
+
* @param {Array<any>} inputs
|
|
368
|
+
* @param {Proof} proof
|
|
369
|
+
* @returns {boolean}
|
|
370
|
+
*/
|
|
371
|
+
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
372
|
+
try {
|
|
373
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
374
|
+
_assertClass(proof, Proof);
|
|
375
|
+
wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
376
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
377
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
378
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
379
|
+
if (r2) {
|
|
380
|
+
throw takeObject(r1);
|
|
381
|
+
}
|
|
382
|
+
return r0 !== 0;
|
|
383
|
+
} finally {
|
|
384
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
356
388
|
/**
|
|
357
389
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
358
390
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -402,57 +434,27 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
402
434
|
}
|
|
403
435
|
|
|
404
436
|
/**
|
|
405
|
-
*
|
|
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}
|
|
437
|
+
* @param {string} string
|
|
438
|
+
* @returns {Field}
|
|
418
439
|
*/
|
|
419
|
-
function
|
|
440
|
+
function stringToField(string) {
|
|
420
441
|
try {
|
|
421
442
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
422
|
-
|
|
423
|
-
|
|
443
|
+
const ptr0 = passStringToWasm0(string, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
444
|
+
const len0 = WASM_VECTOR_LEN;
|
|
445
|
+
wasm$1.stringToField(retptr, ptr0, len0);
|
|
424
446
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
425
447
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
426
448
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
427
449
|
if (r2) {
|
|
428
450
|
throw takeObject(r1);
|
|
429
451
|
}
|
|
430
|
-
return r0
|
|
452
|
+
return Field.__wrap(r0);
|
|
431
453
|
} finally {
|
|
432
454
|
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
433
455
|
}
|
|
434
456
|
}
|
|
435
457
|
|
|
436
|
-
/**
|
|
437
|
-
* Set test consensus version heights for testing.
|
|
438
|
-
*
|
|
439
|
-
* @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
|
|
440
|
-
*
|
|
441
|
-
* @example
|
|
442
|
-
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
443
|
-
*
|
|
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,17");
|
|
446
|
-
* @param {string | null} [heights]
|
|
447
|
-
* @returns {Array<any>}
|
|
448
|
-
*/
|
|
449
|
-
function getOrInitConsensusVersionTestHeights(heights) {
|
|
450
|
-
var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
451
|
-
var len0 = WASM_VECTOR_LEN;
|
|
452
|
-
const ret = wasm$1.getOrInitConsensusVersionTestHeights(ptr0, len0);
|
|
453
|
-
return takeObject(ret);
|
|
454
|
-
}
|
|
455
|
-
|
|
456
458
|
/**
|
|
457
459
|
* Returns the maximum number of imports allowed in a program by the
|
|
458
460
|
* snarkVM network implementation this SDK was built against.
|
|
@@ -471,25 +473,23 @@ function getMaxProgramImports() {
|
|
|
471
473
|
}
|
|
472
474
|
|
|
473
475
|
/**
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
+
* Set test consensus version heights for testing.
|
|
477
|
+
*
|
|
478
|
+
* @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
|
|
479
|
+
*
|
|
480
|
+
* @example
|
|
481
|
+
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
482
|
+
*
|
|
483
|
+
* Set the consensus version heights.
|
|
484
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
|
|
485
|
+
* @param {string | null} [heights]
|
|
486
|
+
* @returns {Array<any>}
|
|
476
487
|
*/
|
|
477
|
-
function
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
wasm$1.stringToField(retptr, ptr0, len0);
|
|
483
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
484
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
485
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
486
|
-
if (r2) {
|
|
487
|
-
throw takeObject(r1);
|
|
488
|
-
}
|
|
489
|
-
return Field.__wrap(r0);
|
|
490
|
-
} finally {
|
|
491
|
-
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
492
|
-
}
|
|
488
|
+
function getOrInitConsensusVersionTestHeights(heights) {
|
|
489
|
+
var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
490
|
+
var len0 = WASM_VECTOR_LEN;
|
|
491
|
+
const ret = wasm$1.getOrInitConsensusVersionTestHeights(ptr0, len0);
|
|
492
|
+
return takeObject(ret);
|
|
493
493
|
}
|
|
494
494
|
|
|
495
495
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
@@ -511,16 +511,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
511
511
|
}
|
|
512
512
|
return result;
|
|
513
513
|
}
|
|
514
|
-
function
|
|
515
|
-
wasm$1.
|
|
514
|
+
function __wasm_bindgen_func_elem_8948(arg0, arg1, arg2) {
|
|
515
|
+
wasm$1.__wasm_bindgen_func_elem_8948(arg0, arg1, addHeapObject(arg2));
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
-
function
|
|
519
|
-
wasm$1.
|
|
518
|
+
function __wasm_bindgen_func_elem_7505(arg0, arg1) {
|
|
519
|
+
wasm$1.__wasm_bindgen_func_elem_7505(arg0, arg1);
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
-
function
|
|
523
|
-
wasm$1.
|
|
522
|
+
function __wasm_bindgen_func_elem_7777(arg0, arg1, arg2, arg3) {
|
|
523
|
+
wasm$1.__wasm_bindgen_func_elem_7777(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
524
524
|
}
|
|
525
525
|
|
|
526
526
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -19325,7 +19325,7 @@ function __wbg_get_imports(memory) {
|
|
|
19325
19325
|
const ret = getObject(arg0).length;
|
|
19326
19326
|
return ret;
|
|
19327
19327
|
};
|
|
19328
|
-
imports.wbg.
|
|
19328
|
+
imports.wbg.__wbg_log_03049fa0ffffc089 = function(arg0, arg1) {
|
|
19329
19329
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
19330
19330
|
};
|
|
19331
19331
|
imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
|
|
@@ -19343,7 +19343,7 @@ function __wbg_get_imports(memory) {
|
|
|
19343
19343
|
const a = state0.a;
|
|
19344
19344
|
state0.a = 0;
|
|
19345
19345
|
try {
|
|
19346
|
-
return
|
|
19346
|
+
return __wasm_bindgen_func_elem_7777(a, state0.b, arg0, arg1);
|
|
19347
19347
|
} finally {
|
|
19348
19348
|
state0.a = a;
|
|
19349
19349
|
}
|
|
@@ -19515,7 +19515,7 @@ function __wbg_get_imports(memory) {
|
|
|
19515
19515
|
const ret = Signature.__wrap(arg0);
|
|
19516
19516
|
return addHeapObject(ret);
|
|
19517
19517
|
};
|
|
19518
|
-
imports.wbg.
|
|
19518
|
+
imports.wbg.__wbg_spawnWorker_6984bbe776b8abdc = function(arg0, arg1, arg2, arg3) {
|
|
19519
19519
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
19520
19520
|
return addHeapObject(ret);
|
|
19521
19521
|
};
|
|
@@ -19597,6 +19597,11 @@ function __wbg_get_imports(memory) {
|
|
|
19597
19597
|
const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
|
|
19598
19598
|
return addHeapObject(ret);
|
|
19599
19599
|
};
|
|
19600
|
+
imports.wbg.__wbindgen_cast_19cdf6e41653eb6c = function(arg0, arg1) {
|
|
19601
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [Externref], shim_idx: 398, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19602
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7504, __wasm_bindgen_func_elem_8948);
|
|
19603
|
+
return addHeapObject(ret);
|
|
19604
|
+
};
|
|
19600
19605
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
19601
19606
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
19602
19607
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
@@ -19612,9 +19617,9 @@ function __wbg_get_imports(memory) {
|
|
|
19612
19617
|
const ret = BigInt.asUintN(64, arg0);
|
|
19613
19618
|
return addHeapObject(ret);
|
|
19614
19619
|
};
|
|
19615
|
-
imports.wbg.
|
|
19616
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
19617
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.
|
|
19620
|
+
imports.wbg.__wbindgen_cast_601de75c058a35e1 = function(arg0, arg1) {
|
|
19621
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [], shim_idx: 528, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19622
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7504, __wasm_bindgen_func_elem_7505);
|
|
19618
19623
|
return addHeapObject(ret);
|
|
19619
19624
|
};
|
|
19620
19625
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
@@ -19622,26 +19627,21 @@ function __wbg_get_imports(memory) {
|
|
|
19622
19627
|
const ret = arg0;
|
|
19623
19628
|
return addHeapObject(ret);
|
|
19624
19629
|
};
|
|
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
|
-
};
|
|
19630
19630
|
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
19631
19631
|
// Cast intrinsic for `F64 -> Externref`.
|
|
19632
19632
|
const ret = arg0;
|
|
19633
19633
|
return addHeapObject(ret);
|
|
19634
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
|
-
};
|
|
19640
19635
|
imports.wbg.__wbindgen_cast_e7b45dd881f38ce3 = function(arg0, arg1) {
|
|
19641
19636
|
// Cast intrinsic for `U128 -> Externref`.
|
|
19642
19637
|
const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));
|
|
19643
19638
|
return addHeapObject(ret);
|
|
19644
19639
|
};
|
|
19640
|
+
imports.wbg.__wbindgen_cast_eb522c22a7f98ff2 = function(arg0, arg1) {
|
|
19641
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 398, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19642
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7504, __wasm_bindgen_func_elem_8948);
|
|
19643
|
+
return addHeapObject(ret);
|
|
19644
|
+
};
|
|
19645
19645
|
imports.wbg.__wbindgen_link_b9f45ffe079ef2c1 = function(arg0) {
|
|
19646
19646
|
const val = `onmessage = function (ev) {
|
|
19647
19647
|
let [ia, index, value] = ev.data;
|