@provablehq/wasm 0.11.9 → 0.11.11
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 +24 -24
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +91 -91
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +91 -91
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +91 -91
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +23 -23
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +71 -71
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +71 -71
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +71 -71
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/testnet/index.js
CHANGED
|
@@ -286,6 +286,16 @@ function runRayonThread(receiver) {
|
|
|
286
286
|
wasm.runRayonThread(receiver);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
+
/**
|
|
290
|
+
* @param {URL} url
|
|
291
|
+
* @param {number} num_threads
|
|
292
|
+
* @returns {Promise<void>}
|
|
293
|
+
*/
|
|
294
|
+
function initThreadPool$1(url, num_threads) {
|
|
295
|
+
const ret = wasm.initThreadPool(addHeapObject(url), num_threads);
|
|
296
|
+
return takeObject(ret);
|
|
297
|
+
}
|
|
298
|
+
|
|
289
299
|
/**
|
|
290
300
|
* Set the WASM log level from JS. Called automatically by the SDK's
|
|
291
301
|
* `setLogLevel(level)` to keep TS and WASM logging in sync.
|
|
@@ -297,16 +307,6 @@ function setWasmLogLevel(level) {
|
|
|
297
307
|
wasm.setWasmLogLevel(level);
|
|
298
308
|
}
|
|
299
309
|
|
|
300
|
-
/**
|
|
301
|
-
* @param {URL} url
|
|
302
|
-
* @param {number} num_threads
|
|
303
|
-
* @returns {Promise<void>}
|
|
304
|
-
*/
|
|
305
|
-
function initThreadPool$1(url, num_threads) {
|
|
306
|
-
const ret = wasm.initThreadPool(addHeapObject(url), num_threads);
|
|
307
|
-
return takeObject(ret);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
310
|
let stack_pointer = 128;
|
|
311
311
|
|
|
312
312
|
function addBorrowedObject(obj) {
|
|
@@ -314,6 +314,38 @@ function addBorrowedObject(obj) {
|
|
|
314
314
|
heap[--stack_pointer] = obj;
|
|
315
315
|
return stack_pointer;
|
|
316
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
319
|
+
*
|
|
320
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
321
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
322
|
+
*
|
|
323
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
324
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
325
|
+
* @param {Proof} proof The batch proof to verify
|
|
326
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
327
|
+
* @param {Array<any>} verifying_keys
|
|
328
|
+
* @param {Array<any>} inputs
|
|
329
|
+
* @param {Proof} proof
|
|
330
|
+
* @returns {boolean}
|
|
331
|
+
*/
|
|
332
|
+
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
333
|
+
try {
|
|
334
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
335
|
+
_assertClass(proof, Proof);
|
|
336
|
+
wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
337
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
338
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
339
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
340
|
+
if (r2) {
|
|
341
|
+
throw takeObject(r1);
|
|
342
|
+
}
|
|
343
|
+
return r0 !== 0;
|
|
344
|
+
} finally {
|
|
345
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
317
349
|
/**
|
|
318
350
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
319
351
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -396,35 +428,20 @@ function snarkVerify(verifying_key, inputs, proof) {
|
|
|
396
428
|
}
|
|
397
429
|
|
|
398
430
|
/**
|
|
399
|
-
*
|
|
431
|
+
* Returns the maximum number of imports allowed in a program by the
|
|
432
|
+
* snarkVM network implementation this SDK was built against.
|
|
400
433
|
*
|
|
401
|
-
*
|
|
402
|
-
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
434
|
+
* @returns {number} The maximum number of program imports.
|
|
403
435
|
*
|
|
404
|
-
* @
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
* @
|
|
409
|
-
* @param {Array<any>} inputs
|
|
410
|
-
* @param {Proof} proof
|
|
411
|
-
* @returns {boolean}
|
|
436
|
+
* @example
|
|
437
|
+
* import { getMaxProgramImports } from '@provablehq/sdk';
|
|
438
|
+
*
|
|
439
|
+
* const maxImports = getMaxProgramImports();
|
|
440
|
+
* @returns {number}
|
|
412
441
|
*/
|
|
413
|
-
function
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
_assertClass(proof, Proof);
|
|
417
|
-
wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
418
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
419
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
420
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
421
|
-
if (r2) {
|
|
422
|
-
throw takeObject(r1);
|
|
423
|
-
}
|
|
424
|
-
return r0 !== 0;
|
|
425
|
-
} finally {
|
|
426
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
427
|
-
}
|
|
442
|
+
function getMaxProgramImports() {
|
|
443
|
+
const ret = wasm.getMaxProgramImports();
|
|
444
|
+
return ret >>> 0;
|
|
428
445
|
}
|
|
429
446
|
|
|
430
447
|
/**
|
|
@@ -436,7 +453,7 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
|
436
453
|
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
437
454
|
*
|
|
438
455
|
* 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,18");
|
|
456
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20");
|
|
440
457
|
* @param {string | null} [heights]
|
|
441
458
|
* @returns {Array<any>}
|
|
442
459
|
*/
|
|
@@ -469,23 +486,6 @@ function stringToField(string) {
|
|
|
469
486
|
}
|
|
470
487
|
}
|
|
471
488
|
|
|
472
|
-
/**
|
|
473
|
-
* Returns the maximum number of imports allowed in a program by the
|
|
474
|
-
* snarkVM network implementation this SDK was built against.
|
|
475
|
-
*
|
|
476
|
-
* @returns {number} The maximum number of program imports.
|
|
477
|
-
*
|
|
478
|
-
* @example
|
|
479
|
-
* import { getMaxProgramImports } from '@provablehq/sdk';
|
|
480
|
-
*
|
|
481
|
-
* const maxImports = getMaxProgramImports();
|
|
482
|
-
* @returns {number}
|
|
483
|
-
*/
|
|
484
|
-
function getMaxProgramImports() {
|
|
485
|
-
const ret = wasm.getMaxProgramImports();
|
|
486
|
-
return ret >>> 0;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
489
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
490
490
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
491
491
|
const mem = getDataViewMemory0();
|
|
@@ -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_7556(arg0, arg1) {
|
|
509
|
+
wasm.__wasm_bindgen_func_elem_7556(arg0, arg1);
|
|
510
510
|
}
|
|
511
511
|
|
|
512
|
-
function
|
|
513
|
-
wasm.
|
|
512
|
+
function __wasm_bindgen_func_elem_8995(arg0, arg1, arg2) {
|
|
513
|
+
wasm.__wasm_bindgen_func_elem_8995(arg0, arg1, addHeapObject(arg2));
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
-
function
|
|
517
|
-
wasm.
|
|
516
|
+
function __wasm_bindgen_func_elem_7828(arg0, arg1, arg2, arg3) {
|
|
517
|
+
wasm.__wasm_bindgen_func_elem_7828(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -8587,7 +8587,7 @@ const PlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
8587
8587
|
*
|
|
8588
8588
|
* @example
|
|
8589
8589
|
* // Get the bond state of an existing address.
|
|
8590
|
-
* const bondState = await fetch(https://
|
|
8590
|
+
* const bondState = await fetch(https://edge.provable.com/api/v2/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
|
|
8591
8591
|
* // Convert the bond state to a Plaintext object.
|
|
8592
8592
|
* const bondStatePlaintext = Plaintext.fromString(bond_state);
|
|
8593
8593
|
* // Convert the Plaintext object to a JS object.
|
|
@@ -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_873fe7a781ebc826 = 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_7828(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_087de831e4bfd369 = 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
|
};
|
|
@@ -19593,7 +19593,7 @@ function __wbg_get_imports(memory) {
|
|
|
19593
19593
|
};
|
|
19594
19594
|
imports.wbg.__wbindgen_cast_19cdf6e41653eb6c = function(arg0, arg1) {
|
|
19595
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.
|
|
19596
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7555, __wasm_bindgen_func_elem_8995);
|
|
19597
19597
|
return addHeapObject(ret);
|
|
19598
19598
|
};
|
|
19599
19599
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
@@ -19611,11 +19611,6 @@ function __wbg_get_imports(memory) {
|
|
|
19611
19611
|
const ret = BigInt.asUintN(64, arg0);
|
|
19612
19612
|
return addHeapObject(ret);
|
|
19613
19613
|
};
|
|
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_7508, __wasm_bindgen_func_elem_7509);
|
|
19617
|
-
return addHeapObject(ret);
|
|
19618
|
-
};
|
|
19619
19614
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
19620
19615
|
// Cast intrinsic for `I64 -> Externref`.
|
|
19621
19616
|
const ret = arg0;
|
|
@@ -19626,6 +19621,11 @@ function __wbg_get_imports(memory) {
|
|
|
19626
19621
|
const ret = arg0;
|
|
19627
19622
|
return addHeapObject(ret);
|
|
19628
19623
|
};
|
|
19624
|
+
imports.wbg.__wbindgen_cast_dc45e30c78fa2793 = function(arg0, arg1) {
|
|
19625
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19626
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7555, __wasm_bindgen_func_elem_7556);
|
|
19627
|
+
return addHeapObject(ret);
|
|
19628
|
+
};
|
|
19629
19629
|
imports.wbg.__wbindgen_cast_e7b45dd881f38ce3 = function(arg0, arg1) {
|
|
19630
19630
|
// Cast intrinsic for `U128 -> Externref`.
|
|
19631
19631
|
const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));
|
|
@@ -19633,7 +19633,7 @@ function __wbg_get_imports(memory) {
|
|
|
19633
19633
|
};
|
|
19634
19634
|
imports.wbg.__wbindgen_cast_eb522c22a7f98ff2 = function(arg0, arg1) {
|
|
19635
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.
|
|
19636
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7555, __wasm_bindgen_func_elem_8995);
|
|
19637
19637
|
return addHeapObject(ret);
|
|
19638
19638
|
};
|
|
19639
19639
|
imports.wbg.__wbindgen_link_b9f45ffe079ef2c1 = function(arg0) {
|