@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
package/dist/testnet/index.js
CHANGED
|
@@ -347,6 +347,38 @@ function snarkVerify(verifying_key, inputs, proof) {
|
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
+
/**
|
|
351
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
352
|
+
*
|
|
353
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
354
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
355
|
+
*
|
|
356
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
357
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
358
|
+
* @param {Proof} proof The batch proof to verify
|
|
359
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
360
|
+
* @param {Array<any>} verifying_keys
|
|
361
|
+
* @param {Array<any>} inputs
|
|
362
|
+
* @param {Proof} proof
|
|
363
|
+
* @returns {boolean}
|
|
364
|
+
*/
|
|
365
|
+
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
366
|
+
try {
|
|
367
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
368
|
+
_assertClass(proof, Proof);
|
|
369
|
+
wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
370
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
371
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
372
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
373
|
+
if (r2) {
|
|
374
|
+
throw takeObject(r1);
|
|
375
|
+
}
|
|
376
|
+
return r0 !== 0;
|
|
377
|
+
} finally {
|
|
378
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
350
382
|
/**
|
|
351
383
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
352
384
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -396,57 +428,27 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
396
428
|
}
|
|
397
429
|
|
|
398
430
|
/**
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
402
|
-
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
403
|
-
*
|
|
404
|
-
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
405
|
-
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
406
|
-
* @param {Proof} proof The batch proof to verify
|
|
407
|
-
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
408
|
-
* @param {Array<any>} verifying_keys
|
|
409
|
-
* @param {Array<any>} inputs
|
|
410
|
-
* @param {Proof} proof
|
|
411
|
-
* @returns {boolean}
|
|
431
|
+
* @param {string} string
|
|
432
|
+
* @returns {Field}
|
|
412
433
|
*/
|
|
413
|
-
function
|
|
434
|
+
function stringToField(string) {
|
|
414
435
|
try {
|
|
415
436
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
416
|
-
|
|
417
|
-
|
|
437
|
+
const ptr0 = passStringToWasm0(string, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
438
|
+
const len0 = WASM_VECTOR_LEN;
|
|
439
|
+
wasm.stringToField(retptr, ptr0, len0);
|
|
418
440
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
419
441
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
420
442
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
421
443
|
if (r2) {
|
|
422
444
|
throw takeObject(r1);
|
|
423
445
|
}
|
|
424
|
-
return r0
|
|
446
|
+
return Field.__wrap(r0);
|
|
425
447
|
} finally {
|
|
426
448
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
427
449
|
}
|
|
428
450
|
}
|
|
429
451
|
|
|
430
|
-
/**
|
|
431
|
-
* Set test consensus version heights for testing.
|
|
432
|
-
*
|
|
433
|
-
* @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.
|
|
434
|
-
*
|
|
435
|
-
* @example
|
|
436
|
-
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
437
|
-
*
|
|
438
|
-
* Set the consensus version heights.
|
|
439
|
-
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17");
|
|
440
|
-
* @param {string | null} [heights]
|
|
441
|
-
* @returns {Array<any>}
|
|
442
|
-
*/
|
|
443
|
-
function getOrInitConsensusVersionTestHeights(heights) {
|
|
444
|
-
var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
445
|
-
var len0 = WASM_VECTOR_LEN;
|
|
446
|
-
const ret = wasm.getOrInitConsensusVersionTestHeights(ptr0, len0);
|
|
447
|
-
return takeObject(ret);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
452
|
/**
|
|
451
453
|
* Returns the maximum number of imports allowed in a program by the
|
|
452
454
|
* snarkVM network implementation this SDK was built against.
|
|
@@ -465,25 +467,23 @@ function getMaxProgramImports() {
|
|
|
465
467
|
}
|
|
466
468
|
|
|
467
469
|
/**
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
+
* Set test consensus version heights for testing.
|
|
471
|
+
*
|
|
472
|
+
* @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.
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
476
|
+
*
|
|
477
|
+
* Set the consensus version heights.
|
|
478
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
|
|
479
|
+
* @param {string | null} [heights]
|
|
480
|
+
* @returns {Array<any>}
|
|
470
481
|
*/
|
|
471
|
-
function
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
wasm.stringToField(retptr, ptr0, len0);
|
|
477
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
478
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
479
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
480
|
-
if (r2) {
|
|
481
|
-
throw takeObject(r1);
|
|
482
|
-
}
|
|
483
|
-
return Field.__wrap(r0);
|
|
484
|
-
} finally {
|
|
485
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
486
|
-
}
|
|
482
|
+
function getOrInitConsensusVersionTestHeights(heights) {
|
|
483
|
+
var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
484
|
+
var len0 = WASM_VECTOR_LEN;
|
|
485
|
+
const ret = wasm.getOrInitConsensusVersionTestHeights(ptr0, len0);
|
|
486
|
+
return takeObject(ret);
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
@@ -505,16 +505,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
505
505
|
}
|
|
506
506
|
return result;
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
wasm.
|
|
508
|
+
function __wasm_bindgen_func_elem_8948(arg0, arg1, arg2) {
|
|
509
|
+
wasm.__wasm_bindgen_func_elem_8948(arg0, arg1, addHeapObject(arg2));
|
|
510
510
|
}
|
|
511
511
|
|
|
512
|
-
function
|
|
513
|
-
wasm.
|
|
512
|
+
function __wasm_bindgen_func_elem_7505(arg0, arg1) {
|
|
513
|
+
wasm.__wasm_bindgen_func_elem_7505(arg0, arg1);
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
-
function
|
|
517
|
-
wasm.
|
|
516
|
+
function __wasm_bindgen_func_elem_7777(arg0, arg1, arg2, arg3) {
|
|
517
|
+
wasm.__wasm_bindgen_func_elem_7777(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -19319,7 +19319,7 @@ function __wbg_get_imports(memory) {
|
|
|
19319
19319
|
const ret = getObject(arg0).length;
|
|
19320
19320
|
return ret;
|
|
19321
19321
|
};
|
|
19322
|
-
imports.wbg.
|
|
19322
|
+
imports.wbg.__wbg_log_03049fa0ffffc089 = function(arg0, arg1) {
|
|
19323
19323
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
19324
19324
|
};
|
|
19325
19325
|
imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
|
|
@@ -19337,7 +19337,7 @@ function __wbg_get_imports(memory) {
|
|
|
19337
19337
|
const a = state0.a;
|
|
19338
19338
|
state0.a = 0;
|
|
19339
19339
|
try {
|
|
19340
|
-
return
|
|
19340
|
+
return __wasm_bindgen_func_elem_7777(a, state0.b, arg0, arg1);
|
|
19341
19341
|
} finally {
|
|
19342
19342
|
state0.a = a;
|
|
19343
19343
|
}
|
|
@@ -19509,7 +19509,7 @@ function __wbg_get_imports(memory) {
|
|
|
19509
19509
|
const ret = Signature.__wrap(arg0);
|
|
19510
19510
|
return addHeapObject(ret);
|
|
19511
19511
|
};
|
|
19512
|
-
imports.wbg.
|
|
19512
|
+
imports.wbg.__wbg_spawnWorker_6984bbe776b8abdc = function(arg0, arg1, arg2, arg3) {
|
|
19513
19513
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
19514
19514
|
return addHeapObject(ret);
|
|
19515
19515
|
};
|
|
@@ -19591,6 +19591,11 @@ function __wbg_get_imports(memory) {
|
|
|
19591
19591
|
const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
|
|
19592
19592
|
return addHeapObject(ret);
|
|
19593
19593
|
};
|
|
19594
|
+
imports.wbg.__wbindgen_cast_19cdf6e41653eb6c = function(arg0, arg1) {
|
|
19595
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [Externref], shim_idx: 398, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19596
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7504, __wasm_bindgen_func_elem_8948);
|
|
19597
|
+
return addHeapObject(ret);
|
|
19598
|
+
};
|
|
19594
19599
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
19595
19600
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
19596
19601
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
@@ -19606,9 +19611,9 @@ function __wbg_get_imports(memory) {
|
|
|
19606
19611
|
const ret = BigInt.asUintN(64, arg0);
|
|
19607
19612
|
return addHeapObject(ret);
|
|
19608
19613
|
};
|
|
19609
|
-
imports.wbg.
|
|
19610
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
19611
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
19614
|
+
imports.wbg.__wbindgen_cast_601de75c058a35e1 = function(arg0, arg1) {
|
|
19615
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [], shim_idx: 528, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19616
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7504, __wasm_bindgen_func_elem_7505);
|
|
19612
19617
|
return addHeapObject(ret);
|
|
19613
19618
|
};
|
|
19614
19619
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
@@ -19616,26 +19621,21 @@ function __wbg_get_imports(memory) {
|
|
|
19616
19621
|
const ret = arg0;
|
|
19617
19622
|
return addHeapObject(ret);
|
|
19618
19623
|
};
|
|
19619
|
-
imports.wbg.__wbindgen_cast_b5deba2f813aede2 = function(arg0, arg1) {
|
|
19620
|
-
// 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`.
|
|
19621
|
-
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7462, __wasm_bindgen_func_elem_8910);
|
|
19622
|
-
return addHeapObject(ret);
|
|
19623
|
-
};
|
|
19624
19624
|
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
19625
19625
|
// Cast intrinsic for `F64 -> Externref`.
|
|
19626
19626
|
const ret = arg0;
|
|
19627
19627
|
return addHeapObject(ret);
|
|
19628
19628
|
};
|
|
19629
|
-
imports.wbg.__wbindgen_cast_e15614d8168764d1 = function(arg0, arg1) {
|
|
19630
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 390, function: Function { arguments: [Externref], shim_idx: 391, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19631
|
-
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7462, __wasm_bindgen_func_elem_8910);
|
|
19632
|
-
return addHeapObject(ret);
|
|
19633
|
-
};
|
|
19634
19629
|
imports.wbg.__wbindgen_cast_e7b45dd881f38ce3 = function(arg0, arg1) {
|
|
19635
19630
|
// Cast intrinsic for `U128 -> Externref`.
|
|
19636
19631
|
const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));
|
|
19637
19632
|
return addHeapObject(ret);
|
|
19638
19633
|
};
|
|
19634
|
+
imports.wbg.__wbindgen_cast_eb522c22a7f98ff2 = function(arg0, arg1) {
|
|
19635
|
+
// 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`.
|
|
19636
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7504, __wasm_bindgen_func_elem_8948);
|
|
19637
|
+
return addHeapObject(ret);
|
|
19638
|
+
};
|
|
19639
19639
|
imports.wbg.__wbindgen_link_b9f45ffe079ef2c1 = function(arg0) {
|
|
19640
19640
|
const val = `onmessage = function (ev) {
|
|
19641
19641
|
let [ia, index, value] = ev.data;
|