@provablehq/wasm 0.11.9 → 0.11.10
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 +15 -15
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +69 -69
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +69 -69
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +69 -69
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +15 -15
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +62 -62
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +62 -62
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +62 -62
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
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>;
|
|
4
5
|
/**
|
|
5
6
|
* Set the WASM log level from JS. Called automatically by the SDK's
|
|
6
7
|
* `setLogLevel(level)` to keep TS and WASM logging in sync.
|
|
@@ -8,7 +9,6 @@ export function runRayonThread(receiver: number): void;
|
|
|
8
9
|
* Values above 4 are clamped to debug.
|
|
9
10
|
*/
|
|
10
11
|
export function setWasmLogLevel(level: number): void;
|
|
11
|
-
export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
12
12
|
/**
|
|
13
13
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
14
14
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -23,18 +23,6 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
|
23
23
|
* @returns {boolean} True if the execution is valid, false otherwise
|
|
24
24
|
*/
|
|
25
25
|
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;
|
|
26
|
-
/**
|
|
27
|
-
* Verify a SNARK proof against a verifying key and public inputs.
|
|
28
|
-
*
|
|
29
|
-
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
30
|
-
* It directly invokes the Varuna proof verification from snarkVM.
|
|
31
|
-
*
|
|
32
|
-
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
33
|
-
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
34
|
-
* @param {Proof} proof The proof to verify
|
|
35
|
-
* @returns {boolean} True if the proof is valid, false otherwise
|
|
36
|
-
*/
|
|
37
|
-
export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
|
|
38
26
|
/**
|
|
39
27
|
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
40
28
|
*
|
|
@@ -47,6 +35,19 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
|
|
|
47
35
|
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
48
36
|
*/
|
|
49
37
|
export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
40
|
+
*
|
|
41
|
+
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
42
|
+
* It directly invokes the Varuna proof verification from snarkVM.
|
|
43
|
+
*
|
|
44
|
+
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
45
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
46
|
+
* @param {Proof} proof The proof to verify
|
|
47
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
48
|
+
*/
|
|
49
|
+
export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
|
|
50
|
+
export function stringToField(string: string): Field;
|
|
50
51
|
/**
|
|
51
52
|
* Set test consensus version heights for testing.
|
|
52
53
|
*
|
|
@@ -59,7 +60,6 @@ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>,
|
|
|
59
60
|
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
|
|
60
61
|
*/
|
|
61
62
|
export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
|
|
62
|
-
export function stringToField(string: string): Field;
|
|
63
63
|
/**
|
|
64
64
|
* Returns the maximum number of imports allowed in a program by the
|
|
65
65
|
* snarkVM network implementation this SDK was built against.
|
|
@@ -2447,7 +2447,7 @@ export class Pedersen64 {
|
|
|
2447
2447
|
*
|
|
2448
2448
|
* @example
|
|
2449
2449
|
* // Get the bond state of an existing address.
|
|
2450
|
-
* const bondState = await fetch(https://
|
|
2450
|
+
* const bondState = await fetch(https://edge.provable.com/api/v2/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
|
|
2451
2451
|
* // Convert the bond state to a Plaintext object.
|
|
2452
2452
|
* const bondStatePlaintext = Plaintext.fromString(bond_state);
|
|
2453
2453
|
* // Convert the Plaintext object to a JS object.
|
|
Binary file
|
package/dist/testnet/index.cjs
CHANGED
|
@@ -292,6 +292,16 @@ 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
|
+
|
|
295
305
|
/**
|
|
296
306
|
* Set the WASM log level from JS. Called automatically by the SDK's
|
|
297
307
|
* `setLogLevel(level)` to keep TS and WASM logging in sync.
|
|
@@ -303,16 +313,6 @@ function setWasmLogLevel(level) {
|
|
|
303
313
|
wasm$1.setWasmLogLevel(level);
|
|
304
314
|
}
|
|
305
315
|
|
|
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) {
|
|
@@ -368,6 +368,38 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
+
/**
|
|
372
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
373
|
+
*
|
|
374
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
375
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
376
|
+
*
|
|
377
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
378
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
379
|
+
* @param {Proof} proof The batch proof to verify
|
|
380
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
381
|
+
* @param {Array<any>} verifying_keys
|
|
382
|
+
* @param {Array<any>} inputs
|
|
383
|
+
* @param {Proof} proof
|
|
384
|
+
* @returns {boolean}
|
|
385
|
+
*/
|
|
386
|
+
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
387
|
+
try {
|
|
388
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
389
|
+
_assertClass(proof, Proof);
|
|
390
|
+
wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
391
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
392
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
393
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
394
|
+
if (r2) {
|
|
395
|
+
throw takeObject(r1);
|
|
396
|
+
}
|
|
397
|
+
return r0 !== 0;
|
|
398
|
+
} finally {
|
|
399
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
371
403
|
/**
|
|
372
404
|
* Verify a SNARK proof against a verifying key and public inputs.
|
|
373
405
|
*
|
|
@@ -402,32 +434,22 @@ function snarkVerify(verifying_key, inputs, proof) {
|
|
|
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
|
}
|
|
@@ -453,28 +475,6 @@ function getOrInitConsensusVersionTestHeights(heights) {
|
|
|
453
475
|
return takeObject(ret);
|
|
454
476
|
}
|
|
455
477
|
|
|
456
|
-
/**
|
|
457
|
-
* @param {string} string
|
|
458
|
-
* @returns {Field}
|
|
459
|
-
*/
|
|
460
|
-
function stringToField(string) {
|
|
461
|
-
try {
|
|
462
|
-
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
463
|
-
const ptr0 = passStringToWasm0(string, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
464
|
-
const len0 = WASM_VECTOR_LEN;
|
|
465
|
-
wasm$1.stringToField(retptr, ptr0, len0);
|
|
466
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
467
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
468
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
469
|
-
if (r2) {
|
|
470
|
-
throw takeObject(r1);
|
|
471
|
-
}
|
|
472
|
-
return Field.__wrap(r0);
|
|
473
|
-
} finally {
|
|
474
|
-
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
478
|
/**
|
|
479
479
|
* Returns the maximum number of imports allowed in a program by the
|
|
480
480
|
* snarkVM network implementation this SDK was built against.
|
|
@@ -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_8946(arg0, arg1, arg2) {
|
|
515
|
+
wasm$1.__wasm_bindgen_func_elem_8946(arg0, arg1, addHeapObject(arg2));
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
-
function
|
|
519
|
-
wasm$1.
|
|
518
|
+
function __wasm_bindgen_func_elem_7506(arg0, arg1) {
|
|
519
|
+
wasm$1.__wasm_bindgen_func_elem_7506(arg0, arg1);
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
-
function
|
|
523
|
-
wasm$1.
|
|
522
|
+
function __wasm_bindgen_func_elem_7778(arg0, arg1, arg2, arg3) {
|
|
523
|
+
wasm$1.__wasm_bindgen_func_elem_7778(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
524
524
|
}
|
|
525
525
|
|
|
526
526
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -8593,7 +8593,7 @@ const PlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
8593
8593
|
*
|
|
8594
8594
|
* @example
|
|
8595
8595
|
* // Get the bond state of an existing address.
|
|
8596
|
-
* const bondState = await fetch(https://
|
|
8596
|
+
* const bondState = await fetch(https://edge.provable.com/api/v2/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
|
|
8597
8597
|
* // Convert the bond state to a Plaintext object.
|
|
8598
8598
|
* const bondStatePlaintext = Plaintext.fromString(bond_state);
|
|
8599
8599
|
* // Convert the Plaintext object to a JS object.
|
|
@@ -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_6a7c7e39dc2b85ff = 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_7778(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_ea93f1cb9997e793 = 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
|
};
|
|
@@ -19599,7 +19599,7 @@ function __wbg_get_imports(memory) {
|
|
|
19599
19599
|
};
|
|
19600
19600
|
imports.wbg.__wbindgen_cast_19cdf6e41653eb6c = function(arg0, arg1) {
|
|
19601
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.
|
|
19602
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7505, __wasm_bindgen_func_elem_8946);
|
|
19603
19603
|
return addHeapObject(ret);
|
|
19604
19604
|
};
|
|
19605
19605
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
@@ -19619,7 +19619,7 @@ function __wbg_get_imports(memory) {
|
|
|
19619
19619
|
};
|
|
19620
19620
|
imports.wbg.__wbindgen_cast_601de75c058a35e1 = function(arg0, arg1) {
|
|
19621
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.
|
|
19622
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7505, __wasm_bindgen_func_elem_7506);
|
|
19623
19623
|
return addHeapObject(ret);
|
|
19624
19624
|
};
|
|
19625
19625
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
@@ -19639,7 +19639,7 @@ function __wbg_get_imports(memory) {
|
|
|
19639
19639
|
};
|
|
19640
19640
|
imports.wbg.__wbindgen_cast_eb522c22a7f98ff2 = function(arg0, arg1) {
|
|
19641
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.
|
|
19642
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7505, __wasm_bindgen_func_elem_8946);
|
|
19643
19643
|
return addHeapObject(ret);
|
|
19644
19644
|
};
|
|
19645
19645
|
imports.wbg.__wbindgen_link_b9f45ffe079ef2c1 = function(arg0) {
|