@provablehq/wasm 0.11.8 → 0.11.9
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 +80 -80
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +80 -80
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +80 -80
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +25 -25
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +70 -70
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +70 -70
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +70 -70
- 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,21 +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
|
-
/**
|
|
13
|
-
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
14
|
-
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
15
|
-
* not verify that the state root of the execution is included in the Aleo Network ledger.
|
|
16
|
-
*
|
|
17
|
-
* @param {Execution} execution The function execution to verify
|
|
18
|
-
* @param {VerifyingKey} verifying_key The verifying key for the function
|
|
19
|
-
* @param {Program} program The program that the function execution belongs to
|
|
20
|
-
* @param {String} function_id The name of the function that was executed
|
|
21
|
-
* @param {Object} imports The imports for the program in the form of { "program_id.aleo":"source code", ... }
|
|
22
|
-
* @param {Object} import_verifying_keys The verifying keys for the imports in the form of { "program_id.aleo": [["function, "verifying_key"], ...], ...}
|
|
23
|
-
* @returns {boolean} True if the execution is valid, false otherwise
|
|
24
|
-
*/
|
|
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
12
|
/**
|
|
27
13
|
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
28
14
|
*
|
|
@@ -48,17 +34,19 @@ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>,
|
|
|
48
34
|
*/
|
|
49
35
|
export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
|
|
50
36
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* @returns {number} The maximum number of program imports.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* import { getMaxProgramImports } from '@provablehq/sdk';
|
|
37
|
+
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
38
|
+
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
39
|
+
* not verify that the state root of the execution is included in the Aleo Network ledger.
|
|
58
40
|
*
|
|
59
|
-
*
|
|
41
|
+
* @param {Execution} execution The function execution to verify
|
|
42
|
+
* @param {VerifyingKey} verifying_key The verifying key for the function
|
|
43
|
+
* @param {Program} program The program that the function execution belongs to
|
|
44
|
+
* @param {String} function_id The name of the function that was executed
|
|
45
|
+
* @param {Object} imports The imports for the program in the form of { "program_id.aleo":"source code", ... }
|
|
46
|
+
* @param {Object} import_verifying_keys The verifying keys for the imports in the form of { "program_id.aleo": [["function, "verifying_key"], ...], ...}
|
|
47
|
+
* @returns {boolean} True if the execution is valid, false otherwise
|
|
60
48
|
*/
|
|
61
|
-
export function
|
|
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;
|
|
62
50
|
/**
|
|
63
51
|
* Set test consensus version heights for testing.
|
|
64
52
|
*
|
|
@@ -72,6 +60,18 @@ export function getMaxProgramImports(): number;
|
|
|
72
60
|
*/
|
|
73
61
|
export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
|
|
74
62
|
export function stringToField(string: string): Field;
|
|
63
|
+
/**
|
|
64
|
+
* Returns the maximum number of imports allowed in a program by the
|
|
65
|
+
* snarkVM network implementation this SDK was built against.
|
|
66
|
+
*
|
|
67
|
+
* @returns {number} The maximum number of program imports.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* import { getMaxProgramImports } from '@provablehq/sdk';
|
|
71
|
+
*
|
|
72
|
+
* const maxImports = getMaxProgramImports();
|
|
73
|
+
*/
|
|
74
|
+
export function getMaxProgramImports(): number;
|
|
75
75
|
/**
|
|
76
76
|
* Public address of an Aleo account
|
|
77
77
|
*/
|
|
Binary file
|
package/dist/mainnet/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) {
|
|
@@ -320,54 +320,6 @@ function addBorrowedObject(obj) {
|
|
|
320
320
|
heap[--stack_pointer] = obj;
|
|
321
321
|
return stack_pointer;
|
|
322
322
|
}
|
|
323
|
-
/**
|
|
324
|
-
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
325
|
-
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
326
|
-
* not verify that the state root of the execution is included in the Aleo Network ledger.
|
|
327
|
-
*
|
|
328
|
-
* @param {Execution} execution The function execution to verify
|
|
329
|
-
* @param {VerifyingKey} verifying_key The verifying key for the function
|
|
330
|
-
* @param {Program} program The program that the function execution belongs to
|
|
331
|
-
* @param {String} function_id The name of the function that was executed
|
|
332
|
-
* @param {Object} imports The imports for the program in the form of { "program_id.aleo":"source code", ... }
|
|
333
|
-
* @param {Object} import_verifying_keys The verifying keys for the imports in the form of { "program_id.aleo": [["function, "verifying_key"], ...], ...}
|
|
334
|
-
* @returns {boolean} True if the execution is valid, false otherwise
|
|
335
|
-
* @param {Execution} execution
|
|
336
|
-
* @param {VerifyingKey} verifying_key
|
|
337
|
-
* @param {Program} program
|
|
338
|
-
* @param {string} function_id
|
|
339
|
-
* @param {object | null | undefined} imports
|
|
340
|
-
* @param {object | null | undefined} imported_verifying_keys
|
|
341
|
-
* @param {number} block_height
|
|
342
|
-
* @param {ProgramImports | null} [program_imports]
|
|
343
|
-
* @returns {boolean}
|
|
344
|
-
*/
|
|
345
|
-
function verifyFunctionExecution(execution, verifying_key, program, function_id, imports, imported_verifying_keys, block_height, program_imports) {
|
|
346
|
-
try {
|
|
347
|
-
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
348
|
-
_assertClass(execution, Execution);
|
|
349
|
-
_assertClass(verifying_key, VerifyingKey);
|
|
350
|
-
_assertClass(program, Program);
|
|
351
|
-
const ptr0 = passStringToWasm0(function_id, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
352
|
-
const len0 = WASM_VECTOR_LEN;
|
|
353
|
-
let ptr1 = 0;
|
|
354
|
-
if (!isLikeNone(program_imports)) {
|
|
355
|
-
_assertClass(program_imports, ProgramImports);
|
|
356
|
-
ptr1 = program_imports.__destroy_into_raw();
|
|
357
|
-
}
|
|
358
|
-
wasm$1.verifyFunctionExecution(retptr, execution.__wbg_ptr, verifying_key.__wbg_ptr, program.__wbg_ptr, ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(imported_verifying_keys) ? 0 : addHeapObject(imported_verifying_keys), block_height, ptr1);
|
|
359
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
360
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
361
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
362
|
-
if (r2) {
|
|
363
|
-
throw takeObject(r1);
|
|
364
|
-
}
|
|
365
|
-
return r0 !== 0;
|
|
366
|
-
} finally {
|
|
367
|
-
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
323
|
/**
|
|
372
324
|
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
373
325
|
*
|
|
@@ -434,20 +386,51 @@ function snarkVerify(verifying_key, inputs, proof) {
|
|
|
434
386
|
}
|
|
435
387
|
|
|
436
388
|
/**
|
|
437
|
-
*
|
|
438
|
-
*
|
|
439
|
-
*
|
|
440
|
-
* @returns {number} The maximum number of program imports.
|
|
441
|
-
*
|
|
442
|
-
* @example
|
|
443
|
-
* import { getMaxProgramImports } from '@provablehq/sdk';
|
|
389
|
+
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
390
|
+
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
391
|
+
* not verify that the state root of the execution is included in the Aleo Network ledger.
|
|
444
392
|
*
|
|
445
|
-
*
|
|
446
|
-
* @
|
|
393
|
+
* @param {Execution} execution The function execution to verify
|
|
394
|
+
* @param {VerifyingKey} verifying_key The verifying key for the function
|
|
395
|
+
* @param {Program} program The program that the function execution belongs to
|
|
396
|
+
* @param {String} function_id The name of the function that was executed
|
|
397
|
+
* @param {Object} imports The imports for the program in the form of { "program_id.aleo":"source code", ... }
|
|
398
|
+
* @param {Object} import_verifying_keys The verifying keys for the imports in the form of { "program_id.aleo": [["function, "verifying_key"], ...], ...}
|
|
399
|
+
* @returns {boolean} True if the execution is valid, false otherwise
|
|
400
|
+
* @param {Execution} execution
|
|
401
|
+
* @param {VerifyingKey} verifying_key
|
|
402
|
+
* @param {Program} program
|
|
403
|
+
* @param {string} function_id
|
|
404
|
+
* @param {object | null | undefined} imports
|
|
405
|
+
* @param {object | null | undefined} imported_verifying_keys
|
|
406
|
+
* @param {number} block_height
|
|
407
|
+
* @param {ProgramImports | null} [program_imports]
|
|
408
|
+
* @returns {boolean}
|
|
447
409
|
*/
|
|
448
|
-
function
|
|
449
|
-
|
|
450
|
-
|
|
410
|
+
function verifyFunctionExecution(execution, verifying_key, program, function_id, imports, imported_verifying_keys, block_height, program_imports) {
|
|
411
|
+
try {
|
|
412
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
413
|
+
_assertClass(execution, Execution);
|
|
414
|
+
_assertClass(verifying_key, VerifyingKey);
|
|
415
|
+
_assertClass(program, Program);
|
|
416
|
+
const ptr0 = passStringToWasm0(function_id, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
417
|
+
const len0 = WASM_VECTOR_LEN;
|
|
418
|
+
let ptr1 = 0;
|
|
419
|
+
if (!isLikeNone(program_imports)) {
|
|
420
|
+
_assertClass(program_imports, ProgramImports);
|
|
421
|
+
ptr1 = program_imports.__destroy_into_raw();
|
|
422
|
+
}
|
|
423
|
+
wasm$1.verifyFunctionExecution(retptr, execution.__wbg_ptr, verifying_key.__wbg_ptr, program.__wbg_ptr, ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(imported_verifying_keys) ? 0 : addHeapObject(imported_verifying_keys), block_height, ptr1);
|
|
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
|
+
}
|
|
451
434
|
}
|
|
452
435
|
|
|
453
436
|
/**
|
|
@@ -492,6 +475,23 @@ function stringToField(string) {
|
|
|
492
475
|
}
|
|
493
476
|
}
|
|
494
477
|
|
|
478
|
+
/**
|
|
479
|
+
* Returns the maximum number of imports allowed in a program by the
|
|
480
|
+
* snarkVM network implementation this SDK was built against.
|
|
481
|
+
*
|
|
482
|
+
* @returns {number} The maximum number of program imports.
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* import { getMaxProgramImports } from '@provablehq/sdk';
|
|
486
|
+
*
|
|
487
|
+
* const maxImports = getMaxProgramImports();
|
|
488
|
+
* @returns {number}
|
|
489
|
+
*/
|
|
490
|
+
function getMaxProgramImports() {
|
|
491
|
+
const ret = wasm$1.getMaxProgramImports();
|
|
492
|
+
return ret >>> 0;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
495
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
496
496
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
497
497
|
const mem = getDataViewMemory0();
|
|
@@ -515,12 +515,12 @@ function __wasm_bindgen_func_elem_8948(arg0, arg1, arg2) {
|
|
|
515
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_7507(arg0, arg1) {
|
|
519
|
+
wasm$1.__wasm_bindgen_func_elem_7507(arg0, arg1);
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
-
function
|
|
523
|
-
wasm$1.
|
|
522
|
+
function __wasm_bindgen_func_elem_7780(arg0, arg1, arg2, arg3) {
|
|
523
|
+
wasm$1.__wasm_bindgen_func_elem_7780(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_94d1dab6039baf0d = 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_7780(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_755c8ce6e1ead587 = 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
|
};
|
|
@@ -19604,7 +19604,7 @@ function __wbg_get_imports(memory) {
|
|
|
19604
19604
|
};
|
|
19605
19605
|
imports.wbg.__wbindgen_cast_2adca60326a83a78 = function(arg0, arg1) {
|
|
19606
19606
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [], shim_idx: 528, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19607
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.
|
|
19607
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7506, __wasm_bindgen_func_elem_7507);
|
|
19608
19608
|
return addHeapObject(ret);
|
|
19609
19609
|
};
|
|
19610
19610
|
imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
|
|
@@ -19619,7 +19619,7 @@ function __wbg_get_imports(memory) {
|
|
|
19619
19619
|
};
|
|
19620
19620
|
imports.wbg.__wbindgen_cast_805ada4c4be963fc = function(arg0, arg1) {
|
|
19621
19621
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 396, 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_7506, __wasm_bindgen_func_elem_8948);
|
|
19623
19623
|
return addHeapObject(ret);
|
|
19624
19624
|
};
|
|
19625
19625
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
@@ -19629,7 +19629,7 @@ function __wbg_get_imports(memory) {
|
|
|
19629
19629
|
};
|
|
19630
19630
|
imports.wbg.__wbindgen_cast_c048d24de4cf58bb = function(arg0, arg1) {
|
|
19631
19631
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [Externref], shim_idx: 396, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19632
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.
|
|
19632
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7506, __wasm_bindgen_func_elem_8948);
|
|
19633
19633
|
return addHeapObject(ret);
|
|
19634
19634
|
};
|
|
19635
19635
|
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|