@provablehq/wasm 0.11.3 → 0.11.4
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 +61 -14
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +129 -59
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +129 -59
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +129 -59
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +60 -13
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +104 -34
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +104 -34
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +104 -34
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/testnet/index.js
CHANGED
|
@@ -315,26 +315,25 @@ function addBorrowedObject(obj) {
|
|
|
315
315
|
return stack_pointer;
|
|
316
316
|
}
|
|
317
317
|
/**
|
|
318
|
-
* Verify a SNARK proof against
|
|
318
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
319
319
|
*
|
|
320
|
-
* This function verifies a proof produced by
|
|
321
|
-
*
|
|
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
322
|
*
|
|
323
|
-
* @param {
|
|
324
|
-
* @param {Array<string
|
|
325
|
-
* @param {Proof} proof The proof to verify
|
|
326
|
-
* @returns {boolean} True if the proof is valid, false otherwise
|
|
327
|
-
* @param {
|
|
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
328
|
* @param {Array<any>} inputs
|
|
329
329
|
* @param {Proof} proof
|
|
330
330
|
* @returns {boolean}
|
|
331
331
|
*/
|
|
332
|
-
function
|
|
332
|
+
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
333
333
|
try {
|
|
334
334
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
335
|
-
_assertClass(verifying_key, VerifyingKey);
|
|
336
335
|
_assertClass(proof, Proof);
|
|
337
|
-
wasm.
|
|
336
|
+
wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
338
337
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
339
338
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
340
339
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -348,25 +347,26 @@ function snarkVerify(verifying_key, inputs, proof) {
|
|
|
348
347
|
}
|
|
349
348
|
|
|
350
349
|
/**
|
|
351
|
-
* Verify a
|
|
350
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
352
351
|
*
|
|
353
|
-
* This function verifies a
|
|
354
|
-
*
|
|
352
|
+
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
353
|
+
* It directly invokes the Varuna proof verification from snarkVM.
|
|
355
354
|
*
|
|
356
|
-
* @param {
|
|
357
|
-
* @param {Array<
|
|
358
|
-
* @param {Proof} proof The
|
|
359
|
-
* @returns {boolean} True if the
|
|
360
|
-
* @param {
|
|
355
|
+
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
356
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
357
|
+
* @param {Proof} proof The proof to verify
|
|
358
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
359
|
+
* @param {VerifyingKey} verifying_key
|
|
361
360
|
* @param {Array<any>} inputs
|
|
362
361
|
* @param {Proof} proof
|
|
363
362
|
* @returns {boolean}
|
|
364
363
|
*/
|
|
365
|
-
function
|
|
364
|
+
function snarkVerify(verifying_key, inputs, proof) {
|
|
366
365
|
try {
|
|
367
366
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
367
|
+
_assertClass(verifying_key, VerifyingKey);
|
|
368
368
|
_assertClass(proof, Proof);
|
|
369
|
-
wasm.
|
|
369
|
+
wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
|
|
370
370
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
371
371
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
372
372
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -436,7 +436,7 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
436
436
|
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
437
437
|
*
|
|
438
438
|
* Set the consensus version heights.
|
|
439
|
-
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
|
|
439
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16");
|
|
440
440
|
* @param {string | null} [heights]
|
|
441
441
|
* @returns {Array<any>}
|
|
442
442
|
*/
|
|
@@ -488,16 +488,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
488
488
|
}
|
|
489
489
|
return result;
|
|
490
490
|
}
|
|
491
|
-
function
|
|
492
|
-
wasm.
|
|
491
|
+
function __wasm_bindgen_func_elem_7392(arg0, arg1) {
|
|
492
|
+
wasm.__wasm_bindgen_func_elem_7392(arg0, arg1);
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
-
function
|
|
496
|
-
wasm.
|
|
495
|
+
function __wasm_bindgen_func_elem_8765(arg0, arg1, arg2) {
|
|
496
|
+
wasm.__wasm_bindgen_func_elem_8765(arg0, arg1, addHeapObject(arg2));
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
-
function
|
|
500
|
-
wasm.
|
|
499
|
+
function __wasm_bindgen_func_elem_7664(arg0, arg1, arg2, arg3) {
|
|
500
|
+
wasm.__wasm_bindgen_func_elem_7664(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
501
501
|
}
|
|
502
502
|
|
|
503
503
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -10014,6 +10014,35 @@ class Program {
|
|
|
10014
10014
|
const ret = wasm.program_getFunctions(this.__wbg_ptr);
|
|
10015
10015
|
return takeObject(ret);
|
|
10016
10016
|
}
|
|
10017
|
+
/**
|
|
10018
|
+
* Get the program's name (without the `.aleo` suffix) encoded as a field element.
|
|
10019
|
+
*
|
|
10020
|
+
* This is the same value as casting the program name identifier to a field on-chain
|
|
10021
|
+
* (e.g. `my_program.aleo` -> `Identifier("my_program") as field`), which is used as
|
|
10022
|
+
* the program id in dynamic dispatch calls such as `IARC20@(token_id)`.
|
|
10023
|
+
*
|
|
10024
|
+
* @example
|
|
10025
|
+
* const program = aleo_wasm.Program.getCreditsProgram();
|
|
10026
|
+
* const field = program.nameToField(); // Field encoding of "credits"
|
|
10027
|
+
*
|
|
10028
|
+
* @returns {Field} The program name as a field element
|
|
10029
|
+
* @returns {Field}
|
|
10030
|
+
*/
|
|
10031
|
+
nameToField() {
|
|
10032
|
+
try {
|
|
10033
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
10034
|
+
wasm.program_nameToField(retptr, this.__wbg_ptr);
|
|
10035
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
10036
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
10037
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
10038
|
+
if (r2) {
|
|
10039
|
+
throw takeObject(r1);
|
|
10040
|
+
}
|
|
10041
|
+
return Field.__wrap(r0);
|
|
10042
|
+
} finally {
|
|
10043
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
10044
|
+
}
|
|
10045
|
+
}
|
|
10017
10046
|
/**
|
|
10018
10047
|
* Get the external call graph reachable from a specific entry function.
|
|
10019
10048
|
*
|
|
@@ -10269,6 +10298,47 @@ class Program {
|
|
|
10269
10298
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
10270
10299
|
}
|
|
10271
10300
|
}
|
|
10301
|
+
/**
|
|
10302
|
+
* Determine if the program implements the ARC-20 fungible token interface (IARC20).
|
|
10303
|
+
*
|
|
10304
|
+
* This checks that the program defines a `Token` record with an `amount: u128` entry
|
|
10305
|
+
* (additional entries are permitted, per the interface's open record definition) and
|
|
10306
|
+
* that every function and view function required by ARC-20 is present with the exact
|
|
10307
|
+
* input and output signature defined by the standard.
|
|
10308
|
+
*
|
|
10309
|
+
* @see https://github.com/ProvableHQ/ARCs/blob/master/arc-0020/README.md
|
|
10310
|
+
*
|
|
10311
|
+
* @returns {boolean} True if the program implements the ARC-20 token interface
|
|
10312
|
+
* @returns {boolean}
|
|
10313
|
+
*/
|
|
10314
|
+
isArc20() {
|
|
10315
|
+
const ret = wasm.program_isArc20(this.__wbg_ptr);
|
|
10316
|
+
return ret !== 0;
|
|
10317
|
+
}
|
|
10318
|
+
/**
|
|
10319
|
+
* Determine if the program implements the ARC-22 compliant token interface (IARC22).
|
|
10320
|
+
*
|
|
10321
|
+
* This checks that the program defines `Token` and `ComplianceRecord` records with the
|
|
10322
|
+
* entries required by the standard (additional entries are permitted, per the
|
|
10323
|
+
* interface's open record definitions), and that every function and view function
|
|
10324
|
+
* required by ARC-22 is present with the exact input and output signature defined by
|
|
10325
|
+
* the standard. The `MerkleProof` struct used by the private transfer functions may be
|
|
10326
|
+
* declared locally (in which case its shape must match the standard exactly) or
|
|
10327
|
+
* imported from another program such as a freeze list registry.
|
|
10328
|
+
*
|
|
10329
|
+
* Note: this checks the token interface (IARC22) only. The freeze list registry
|
|
10330
|
+
* interface (IARC22Freezelist) is typically implemented by a separate program and is
|
|
10331
|
+
* not required for a token program to be considered ARC-22 compliant.
|
|
10332
|
+
*
|
|
10333
|
+
* @see https://github.com/ProvableHQ/ARCs/blob/master/arc-0022/README.md
|
|
10334
|
+
*
|
|
10335
|
+
* @returns {boolean} True if the program implements the ARC-22 token interface
|
|
10336
|
+
* @returns {boolean}
|
|
10337
|
+
*/
|
|
10338
|
+
isArc22() {
|
|
10339
|
+
const ret = wasm.program_isArc22(this.__wbg_ptr);
|
|
10340
|
+
return ret !== 0;
|
|
10341
|
+
}
|
|
10272
10342
|
/**
|
|
10273
10343
|
* Determine equality with another program
|
|
10274
10344
|
*
|
|
@@ -19232,7 +19302,7 @@ function __wbg_get_imports(memory) {
|
|
|
19232
19302
|
const ret = getObject(arg0).length;
|
|
19233
19303
|
return ret;
|
|
19234
19304
|
};
|
|
19235
|
-
imports.wbg.
|
|
19305
|
+
imports.wbg.__wbg_log_4507b73801c06872 = function(arg0, arg1) {
|
|
19236
19306
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
19237
19307
|
};
|
|
19238
19308
|
imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
|
|
@@ -19250,7 +19320,7 @@ function __wbg_get_imports(memory) {
|
|
|
19250
19320
|
const a = state0.a;
|
|
19251
19321
|
state0.a = 0;
|
|
19252
19322
|
try {
|
|
19253
|
-
return
|
|
19323
|
+
return __wasm_bindgen_func_elem_7664(a, state0.b, arg0, arg1);
|
|
19254
19324
|
} finally {
|
|
19255
19325
|
state0.a = a;
|
|
19256
19326
|
}
|
|
@@ -19422,7 +19492,7 @@ function __wbg_get_imports(memory) {
|
|
|
19422
19492
|
const ret = Signature.__wrap(arg0);
|
|
19423
19493
|
return addHeapObject(ret);
|
|
19424
19494
|
};
|
|
19425
|
-
imports.wbg.
|
|
19495
|
+
imports.wbg.__wbg_spawnWorker_6197e35077a8baba = function(arg0, arg1, arg2, arg3) {
|
|
19426
19496
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
19427
19497
|
return addHeapObject(ret);
|
|
19428
19498
|
};
|
|
@@ -19506,7 +19576,7 @@ function __wbg_get_imports(memory) {
|
|
|
19506
19576
|
};
|
|
19507
19577
|
imports.wbg.__wbindgen_cast_073ddd2b87fab8ab = function(arg0, arg1) {
|
|
19508
19578
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19509
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
19579
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7391, __wasm_bindgen_func_elem_7392);
|
|
19510
19580
|
return addHeapObject(ret);
|
|
19511
19581
|
};
|
|
19512
19582
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
@@ -19516,7 +19586,7 @@ function __wbg_get_imports(memory) {
|
|
|
19516
19586
|
};
|
|
19517
19587
|
imports.wbg.__wbindgen_cast_263b62405be3c669 = function(arg0, arg1) {
|
|
19518
19588
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19519
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
19589
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7391, __wasm_bindgen_func_elem_8765);
|
|
19520
19590
|
return addHeapObject(ret);
|
|
19521
19591
|
};
|
|
19522
19592
|
imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
|
|
@@ -19531,7 +19601,7 @@ function __wbg_get_imports(memory) {
|
|
|
19531
19601
|
};
|
|
19532
19602
|
imports.wbg.__wbindgen_cast_5cd376b701f56c0e = function(arg0, arg1) {
|
|
19533
19603
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [Externref], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19534
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
19604
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7391, __wasm_bindgen_func_elem_8765);
|
|
19535
19605
|
return addHeapObject(ret);
|
|
19536
19606
|
};
|
|
19537
19607
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|