@provablehq/wasm 0.9.3 → 0.9.4-offline-rc
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 +271 -12
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.js +668 -43
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +669 -42
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +271 -12
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.js +668 -43
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +669 -42
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/mainnet/index.js
CHANGED
|
@@ -209,11 +209,12 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
209
209
|
* @param {VerifyingKey} verifying_key
|
|
210
210
|
* @param {Program} program
|
|
211
211
|
* @param {string} function_id
|
|
212
|
-
* @param {object | null}
|
|
213
|
-
* @param {object | null}
|
|
212
|
+
* @param {object | null | undefined} imports
|
|
213
|
+
* @param {object | null | undefined} imported_verifying_keys
|
|
214
|
+
* @param {number} block_height
|
|
214
215
|
* @returns {boolean}
|
|
215
216
|
*/
|
|
216
|
-
function verifyFunctionExecution(execution, verifying_key, program, function_id, imports, imported_verifying_keys) {
|
|
217
|
+
function verifyFunctionExecution(execution, verifying_key, program, function_id, imports, imported_verifying_keys, block_height) {
|
|
217
218
|
try {
|
|
218
219
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
219
220
|
_assertClass(execution, Execution);
|
|
@@ -221,7 +222,7 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
221
222
|
_assertClass(program, Program);
|
|
222
223
|
const ptr0 = passStringToWasm0(function_id, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
223
224
|
const len0 = WASM_VECTOR_LEN;
|
|
224
|
-
wasm.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));
|
|
225
|
+
wasm.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);
|
|
225
226
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
226
227
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
227
228
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -263,12 +264,16 @@ function initThreadPool$1(url, num_threads) {
|
|
|
263
264
|
return takeObject(ret);
|
|
264
265
|
}
|
|
265
266
|
|
|
266
|
-
function __wbg_adapter_40(arg0, arg1
|
|
267
|
-
wasm.__wbindgen_export_6(arg0, arg1
|
|
267
|
+
function __wbg_adapter_40(arg0, arg1) {
|
|
268
|
+
wasm.__wbindgen_export_6(arg0, arg1);
|
|
268
269
|
}
|
|
269
270
|
|
|
270
|
-
function
|
|
271
|
-
wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2)
|
|
271
|
+
function __wbg_adapter_43(arg0, arg1, arg2) {
|
|
272
|
+
wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2));
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function __wbg_adapter_606(arg0, arg1, arg2, arg3) {
|
|
276
|
+
wasm.__wbindgen_export_8(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
272
277
|
}
|
|
273
278
|
|
|
274
279
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -1370,6 +1375,248 @@ class BHP768 {
|
|
|
1370
1375
|
}
|
|
1371
1376
|
}
|
|
1372
1377
|
|
|
1378
|
+
const BooleanFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1379
|
+
? { register: () => {}, unregister: () => {} }
|
|
1380
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_boolean_free(ptr >>> 0, 1));
|
|
1381
|
+
/**
|
|
1382
|
+
* Boolean element.
|
|
1383
|
+
*/
|
|
1384
|
+
class Boolean {
|
|
1385
|
+
|
|
1386
|
+
static __wrap(ptr) {
|
|
1387
|
+
ptr = ptr >>> 0;
|
|
1388
|
+
const obj = Object.create(Boolean.prototype);
|
|
1389
|
+
obj.__wbg_ptr = ptr;
|
|
1390
|
+
BooleanFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1391
|
+
return obj;
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
__destroy_into_raw() {
|
|
1395
|
+
const ptr = this.__wbg_ptr;
|
|
1396
|
+
this.__wbg_ptr = 0;
|
|
1397
|
+
BooleanFinalization.unregister(this);
|
|
1398
|
+
return ptr;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
free() {
|
|
1402
|
+
const ptr = this.__destroy_into_raw();
|
|
1403
|
+
wasm.__wbg_boolean_free(ptr, 0);
|
|
1404
|
+
}
|
|
1405
|
+
/**
|
|
1406
|
+
* Creates a Boolean from a native JS bool.
|
|
1407
|
+
* @param {boolean} value
|
|
1408
|
+
*/
|
|
1409
|
+
constructor(value) {
|
|
1410
|
+
const ret = wasm.boolean_new(value);
|
|
1411
|
+
this.__wbg_ptr = ret >>> 0;
|
|
1412
|
+
BooleanFinalization.register(this, this.__wbg_ptr, this);
|
|
1413
|
+
return this;
|
|
1414
|
+
}
|
|
1415
|
+
/**
|
|
1416
|
+
* Creates a boolean object from a string representation ("true"/"false").
|
|
1417
|
+
* @param {string} boolean
|
|
1418
|
+
* @returns {Boolean}
|
|
1419
|
+
*/
|
|
1420
|
+
static fromString(boolean) {
|
|
1421
|
+
try {
|
|
1422
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1423
|
+
const ptr0 = passStringToWasm0(boolean, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
1424
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1425
|
+
wasm.boolean_fromString(retptr, ptr0, len0);
|
|
1426
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1427
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1428
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1429
|
+
if (r2) {
|
|
1430
|
+
throw takeObject(r1);
|
|
1431
|
+
}
|
|
1432
|
+
return Boolean.__wrap(r0);
|
|
1433
|
+
} finally {
|
|
1434
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
/**
|
|
1438
|
+
* Returns the string representation of the boolean element.
|
|
1439
|
+
* @returns {string}
|
|
1440
|
+
*/
|
|
1441
|
+
toString() {
|
|
1442
|
+
let deferred1_0;
|
|
1443
|
+
let deferred1_1;
|
|
1444
|
+
try {
|
|
1445
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1446
|
+
wasm.boolean_toString(retptr, this.__wbg_ptr);
|
|
1447
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1448
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1449
|
+
deferred1_0 = r0;
|
|
1450
|
+
deferred1_1 = r1;
|
|
1451
|
+
return getStringFromWasm0(r0, r1);
|
|
1452
|
+
} finally {
|
|
1453
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1454
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
/**
|
|
1458
|
+
* Create a boolean element from a Uint8Array of left endian bytes.
|
|
1459
|
+
* @param {Uint8Array} bytes
|
|
1460
|
+
* @returns {Boolean}
|
|
1461
|
+
*/
|
|
1462
|
+
static fromBytesLe(bytes) {
|
|
1463
|
+
try {
|
|
1464
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1465
|
+
wasm.boolean_fromBytesLe(retptr, addBorrowedObject(bytes));
|
|
1466
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1467
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1468
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1469
|
+
if (r2) {
|
|
1470
|
+
throw takeObject(r1);
|
|
1471
|
+
}
|
|
1472
|
+
return Boolean.__wrap(r0);
|
|
1473
|
+
} finally {
|
|
1474
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1475
|
+
heap[stack_pointer++] = undefined;
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Encode the boolean element as a Uint8Array of left endian bytes.
|
|
1480
|
+
* @returns {Uint8Array}
|
|
1481
|
+
*/
|
|
1482
|
+
toBytesLe() {
|
|
1483
|
+
try {
|
|
1484
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1485
|
+
wasm.boolean_toBytesLe(retptr, this.__wbg_ptr);
|
|
1486
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1487
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1488
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1489
|
+
if (r2) {
|
|
1490
|
+
throw takeObject(r1);
|
|
1491
|
+
}
|
|
1492
|
+
return takeObject(r0);
|
|
1493
|
+
} finally {
|
|
1494
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
/**
|
|
1498
|
+
* Reconstruct a boolean element from a boolean array representation.
|
|
1499
|
+
* @param {Array<any>} bits
|
|
1500
|
+
* @returns {Boolean}
|
|
1501
|
+
*/
|
|
1502
|
+
static fromBitsLe(bits) {
|
|
1503
|
+
try {
|
|
1504
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1505
|
+
wasm.boolean_fromBitsLe(retptr, addBorrowedObject(bits));
|
|
1506
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1507
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1508
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1509
|
+
if (r2) {
|
|
1510
|
+
throw takeObject(r1);
|
|
1511
|
+
}
|
|
1512
|
+
return Boolean.__wrap(r0);
|
|
1513
|
+
} finally {
|
|
1514
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1515
|
+
heap[stack_pointer++] = undefined;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Get the left endian boolean array representation of the boolean element.
|
|
1520
|
+
* @returns {Array<any>}
|
|
1521
|
+
*/
|
|
1522
|
+
toBitsLe() {
|
|
1523
|
+
const ret = wasm.boolean_toBitsLe(this.__wbg_ptr);
|
|
1524
|
+
return takeObject(ret);
|
|
1525
|
+
}
|
|
1526
|
+
/**
|
|
1527
|
+
* Create a plaintext from the boolean element.
|
|
1528
|
+
* @returns {Plaintext}
|
|
1529
|
+
*/
|
|
1530
|
+
toPlaintext() {
|
|
1531
|
+
const ret = wasm.boolean_toPlaintext(this.__wbg_ptr);
|
|
1532
|
+
return Plaintext.__wrap(ret);
|
|
1533
|
+
}
|
|
1534
|
+
/**
|
|
1535
|
+
* Clone the boolean element.
|
|
1536
|
+
* @returns {Boolean}
|
|
1537
|
+
*/
|
|
1538
|
+
clone() {
|
|
1539
|
+
const ret = wasm.boolean_clone(this.__wbg_ptr);
|
|
1540
|
+
return Boolean.__wrap(ret);
|
|
1541
|
+
}
|
|
1542
|
+
/**
|
|
1543
|
+
* Generate a random boolean element.
|
|
1544
|
+
* @returns {Boolean}
|
|
1545
|
+
*/
|
|
1546
|
+
static random() {
|
|
1547
|
+
const ret = wasm.boolean_random();
|
|
1548
|
+
return Boolean.__wrap(ret);
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* Logical NOT.
|
|
1552
|
+
* @returns {Boolean}
|
|
1553
|
+
*/
|
|
1554
|
+
not() {
|
|
1555
|
+
const ret = wasm.boolean_not(this.__wbg_ptr);
|
|
1556
|
+
return Boolean.__wrap(ret);
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* Logical AND.
|
|
1560
|
+
* @param {Boolean} other
|
|
1561
|
+
* @returns {Boolean}
|
|
1562
|
+
*/
|
|
1563
|
+
and(other) {
|
|
1564
|
+
_assertClass(other, Boolean);
|
|
1565
|
+
const ret = wasm.boolean_and(this.__wbg_ptr, other.__wbg_ptr);
|
|
1566
|
+
return Boolean.__wrap(ret);
|
|
1567
|
+
}
|
|
1568
|
+
/**
|
|
1569
|
+
* Logical OR.
|
|
1570
|
+
* @param {Boolean} other
|
|
1571
|
+
* @returns {Boolean}
|
|
1572
|
+
*/
|
|
1573
|
+
or(other) {
|
|
1574
|
+
_assertClass(other, Boolean);
|
|
1575
|
+
const ret = wasm.boolean_or(this.__wbg_ptr, other.__wbg_ptr);
|
|
1576
|
+
return Boolean.__wrap(ret);
|
|
1577
|
+
}
|
|
1578
|
+
/**
|
|
1579
|
+
* Logical XOR.
|
|
1580
|
+
* @param {Boolean} other
|
|
1581
|
+
* @returns {Boolean}
|
|
1582
|
+
*/
|
|
1583
|
+
xor(other) {
|
|
1584
|
+
_assertClass(other, Boolean);
|
|
1585
|
+
const ret = wasm.boolean_xor(this.__wbg_ptr, other.__wbg_ptr);
|
|
1586
|
+
return Boolean.__wrap(ret);
|
|
1587
|
+
}
|
|
1588
|
+
/**
|
|
1589
|
+
* Logical NAND.
|
|
1590
|
+
* @param {Boolean} other
|
|
1591
|
+
* @returns {Boolean}
|
|
1592
|
+
*/
|
|
1593
|
+
nand(other) {
|
|
1594
|
+
_assertClass(other, Boolean);
|
|
1595
|
+
const ret = wasm.boolean_nand(this.__wbg_ptr, other.__wbg_ptr);
|
|
1596
|
+
return Boolean.__wrap(ret);
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* Logical NOR.
|
|
1600
|
+
* @param {Boolean} other
|
|
1601
|
+
* @returns {Boolean}
|
|
1602
|
+
*/
|
|
1603
|
+
nor(other) {
|
|
1604
|
+
_assertClass(other, Boolean);
|
|
1605
|
+
const ret = wasm.boolean_nor(this.__wbg_ptr, other.__wbg_ptr);
|
|
1606
|
+
return Boolean.__wrap(ret);
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Check if one boolean element equals another.
|
|
1610
|
+
* @param {Boolean} other
|
|
1611
|
+
* @returns {boolean}
|
|
1612
|
+
*/
|
|
1613
|
+
equals(other) {
|
|
1614
|
+
_assertClass(other, Boolean);
|
|
1615
|
+
const ret = wasm.boolean_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
1616
|
+
return ret !== 0;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1373
1620
|
const CiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1374
1621
|
? { register: () => {}, unregister: () => {} }
|
|
1375
1622
|
: new FinalizationRegistry(ptr => wasm.__wbg_ciphertext_free(ptr >>> 0, 1));
|
|
@@ -1432,6 +1679,14 @@ class Ciphertext {
|
|
|
1432
1679
|
/**
|
|
1433
1680
|
* Decrypt a ciphertext using the view key of the transition signer, transition public key, and
|
|
1434
1681
|
* (program, function, index) tuple.
|
|
1682
|
+
*
|
|
1683
|
+
* @param {ViewKey} view_key The view key of the transition signer.
|
|
1684
|
+
* @param {Group} transition_public_key The transition public key used to encrypt the ciphertext.
|
|
1685
|
+
* @param {string} program The program ID associated with the ciphertext.
|
|
1686
|
+
* @param {string} function_name The name of the function associated with the encrypted inputs and outputs.
|
|
1687
|
+
* @param {u16} index The index of the input or output parameter that was encrypted.
|
|
1688
|
+
*
|
|
1689
|
+
* @returns {Plaintext} The decrypted plaintext.
|
|
1435
1690
|
* @param {ViewKey} view_key
|
|
1436
1691
|
* @param {Group} transition_public_key
|
|
1437
1692
|
* @param {string} program
|
|
@@ -1464,6 +1719,13 @@ class Ciphertext {
|
|
|
1464
1719
|
}
|
|
1465
1720
|
/**
|
|
1466
1721
|
* Decrypt a ciphertext using the transition view key and a (program, function, index) tuple.
|
|
1722
|
+
*
|
|
1723
|
+
* @param {Field} transition_view_key The transition view key that was used to encrypt the ciphertext.
|
|
1724
|
+
* @param {string} program The program ID associated with the ciphertext.
|
|
1725
|
+
* @param {string} function_name The name of the function associated with the encrypted inputs and outputs.
|
|
1726
|
+
* @param {u16} index The index of the input or output parameter that was encrypted.
|
|
1727
|
+
*
|
|
1728
|
+
* @returns {Plaintext} The decrypted plaintext.
|
|
1467
1729
|
* @param {Field} transition_view_key
|
|
1468
1730
|
* @param {string} program
|
|
1469
1731
|
* @param {string} function_name
|
|
@@ -1806,6 +2068,11 @@ class EncryptionToolkit {
|
|
|
1806
2068
|
}
|
|
1807
2069
|
/**
|
|
1808
2070
|
* Generates a transition view key from the view key and the transition public key.
|
|
2071
|
+
*
|
|
2072
|
+
* @param {ViewKey} view_key The view key of the account that generated the transition.
|
|
2073
|
+
* @param {Group} tpk The transition public key.
|
|
2074
|
+
*
|
|
2075
|
+
* @returns {Field} The transition view key.
|
|
1809
2076
|
* @param {ViewKey} view_key
|
|
1810
2077
|
* @param {Group} tpk
|
|
1811
2078
|
* @returns {Field}
|
|
@@ -1818,6 +2085,11 @@ class EncryptionToolkit {
|
|
|
1818
2085
|
}
|
|
1819
2086
|
/**
|
|
1820
2087
|
* Creates a record view key from the view key. This can be later be used to decrypt a
|
|
2088
|
+
*
|
|
2089
|
+
* @param {ViewKey} view_key The view key of the owner of the record.
|
|
2090
|
+
* @param {RecordCiphertext} record_ciphertext The record ciphertext used to derive the record view key.
|
|
2091
|
+
*
|
|
2092
|
+
* @returns {Field} The record view key.
|
|
1821
2093
|
* @param {ViewKey} view_key
|
|
1822
2094
|
* @param {RecordCiphertext} record_ciphertext
|
|
1823
2095
|
* @returns {Field}
|
|
@@ -1842,6 +2114,11 @@ class EncryptionToolkit {
|
|
|
1842
2114
|
/**
|
|
1843
2115
|
* Decrypts a record ciphertext using the record view key. Decryption only succeeds
|
|
1844
2116
|
* if the record view key was generated from the view key of the record owner.
|
|
2117
|
+
*
|
|
2118
|
+
* @param {Field} record_vk The record view key.
|
|
2119
|
+
* @param {RecordCiphertext} record_ciphertext The record ciphertext to decrypt.
|
|
2120
|
+
*
|
|
2121
|
+
* @returns {RecordPlaintext} The decrypted record plaintext.
|
|
1845
2122
|
* @param {Field} record_vk
|
|
1846
2123
|
* @param {RecordCiphertext} record_ciphertext
|
|
1847
2124
|
* @returns {RecordPlaintext}
|
|
@@ -1866,6 +2143,11 @@ class EncryptionToolkit {
|
|
|
1866
2143
|
/**
|
|
1867
2144
|
* Decrypts a transition using the transition view key. The ciphertext inputs and outputs
|
|
1868
2145
|
* can only be decrypted if the transition view key was generated by the transaction signer.
|
|
2146
|
+
*
|
|
2147
|
+
* @param {Transition} transition The transition to decrypt.
|
|
2148
|
+
* @param {Field} transition_vk The transition view key.
|
|
2149
|
+
*
|
|
2150
|
+
* @returns {Transition} The decrypted transition.
|
|
1869
2151
|
* @param {Transition} transition
|
|
1870
2152
|
* @param {Field} transition_vk
|
|
1871
2153
|
* @returns {Transition}
|
|
@@ -2045,6 +2327,8 @@ class ExecutionRequest {
|
|
|
2045
2327
|
}
|
|
2046
2328
|
/**
|
|
2047
2329
|
* Returns the request as a string.
|
|
2330
|
+
*
|
|
2331
|
+
* @returns {string} String representation of the request.
|
|
2048
2332
|
* @returns {string}
|
|
2049
2333
|
*/
|
|
2050
2334
|
toString() {
|
|
@@ -2065,6 +2349,8 @@ class ExecutionRequest {
|
|
|
2065
2349
|
}
|
|
2066
2350
|
/**
|
|
2067
2351
|
* Builds a request object from a string representation of a request.
|
|
2352
|
+
*
|
|
2353
|
+
* @param {string} request String representation of the request.
|
|
2068
2354
|
* @param {string} request
|
|
2069
2355
|
* @returns {ExecutionRequest}
|
|
2070
2356
|
*/
|
|
@@ -3442,6 +3728,11 @@ class OfflineQuery {
|
|
|
3442
3728
|
}
|
|
3443
3729
|
/**
|
|
3444
3730
|
* Creates a new offline query object. The state root is required to be passed in as a string
|
|
3731
|
+
*
|
|
3732
|
+
* @param {u32} block_height The block height.
|
|
3733
|
+
* @param {string} state_root The state root of the current network.
|
|
3734
|
+
*
|
|
3735
|
+
* @returns {OfflineQuery} The newly created offline query object.
|
|
3445
3736
|
* @param {number} block_height
|
|
3446
3737
|
* @param {string} state_root
|
|
3447
3738
|
*/
|
|
@@ -3466,6 +3757,8 @@ class OfflineQuery {
|
|
|
3466
3757
|
}
|
|
3467
3758
|
/**
|
|
3468
3759
|
* Add a new block height to the offline query object.
|
|
3760
|
+
*
|
|
3761
|
+
* @param {u32} block_height The block height to add.
|
|
3469
3762
|
* @param {number} block_height
|
|
3470
3763
|
*/
|
|
3471
3764
|
addBlockHeight(block_height) {
|
|
@@ -3474,8 +3767,8 @@ class OfflineQuery {
|
|
|
3474
3767
|
/**
|
|
3475
3768
|
* Add a new state path to the offline query object.
|
|
3476
3769
|
*
|
|
3477
|
-
* @param {string} commitment: The commitment corresponding to a record
|
|
3478
|
-
* @param {string} state_path: The state path corresponding to the commitment
|
|
3770
|
+
* @param {string} commitment: The commitment corresponding to a record input.
|
|
3771
|
+
* @param {string} state_path: The state path corresponding to the commitment.
|
|
3479
3772
|
* @param {string} commitment
|
|
3480
3773
|
* @param {string} state_path
|
|
3481
3774
|
*/
|
|
@@ -3497,7 +3790,9 @@ class OfflineQuery {
|
|
|
3497
3790
|
}
|
|
3498
3791
|
}
|
|
3499
3792
|
/**
|
|
3500
|
-
* Get a json string representation of the offline query object
|
|
3793
|
+
* Get a json string representation of the offline query object.
|
|
3794
|
+
*
|
|
3795
|
+
* @returns {string} JSON string representation of the offline query object.
|
|
3501
3796
|
* @returns {string}
|
|
3502
3797
|
*/
|
|
3503
3798
|
toString() {
|
|
@@ -3517,7 +3812,9 @@ class OfflineQuery {
|
|
|
3517
3812
|
}
|
|
3518
3813
|
}
|
|
3519
3814
|
/**
|
|
3520
|
-
* Create an offline query object from a json string representation
|
|
3815
|
+
* Create an offline query object from a json string representation.
|
|
3816
|
+
*
|
|
3817
|
+
* @param {string} JSON string representation of the offline query object.
|
|
3521
3818
|
* @param {string} s
|
|
3522
3819
|
* @returns {OfflineQuery}
|
|
3523
3820
|
*/
|
|
@@ -3839,6 +4136,11 @@ class Plaintext {
|
|
|
3839
4136
|
}
|
|
3840
4137
|
/**
|
|
3841
4138
|
* Encrypt a plaintext with an address and randomizer.
|
|
4139
|
+
*
|
|
4140
|
+
* @param {Address} address The address to encrypt the plaintext for.
|
|
4141
|
+
* @param {Scalar} randomizer The randomizer to use for encryption.
|
|
4142
|
+
*
|
|
4143
|
+
* @returns {Ciphertext} The encrypted ciphertext.
|
|
3842
4144
|
* @param {Address} address
|
|
3843
4145
|
* @param {Scalar} randomizer
|
|
3844
4146
|
* @returns {Ciphertext}
|
|
@@ -3862,6 +4164,11 @@ class Plaintext {
|
|
|
3862
4164
|
}
|
|
3863
4165
|
/**
|
|
3864
4166
|
* Encrypt a plaintext with a transition view key.
|
|
4167
|
+
*
|
|
4168
|
+
* @param {Field} transition_view_key The transition view key of the transition
|
|
4169
|
+
* associated with the plaintext.
|
|
4170
|
+
*
|
|
4171
|
+
* @returns {Ciphertext} The encrypted ciphertext.
|
|
3865
4172
|
* @param {Field} transition_view_key
|
|
3866
4173
|
* @returns {Ciphertext}
|
|
3867
4174
|
*/
|
|
@@ -3933,6 +4240,8 @@ class Plaintext {
|
|
|
3933
4240
|
}
|
|
3934
4241
|
/**
|
|
3935
4242
|
* Get the left endian byte array representation of the plaintext.
|
|
4243
|
+
*
|
|
4244
|
+
* @returns {Uint8Array} The left endian byte array representation of the plaintext.
|
|
3936
4245
|
* @returns {Uint8Array}
|
|
3937
4246
|
*/
|
|
3938
4247
|
toBytesLe() {
|
|
@@ -3976,6 +4285,8 @@ class Plaintext {
|
|
|
3976
4285
|
}
|
|
3977
4286
|
/**
|
|
3978
4287
|
* Get the left endian boolean array representation of the bits of the plaintext.
|
|
4288
|
+
*
|
|
4289
|
+
* @returns {Array} The left endian boolean array representation of the bits of the plaintext.
|
|
3979
4290
|
* @returns {Array<any>}
|
|
3980
4291
|
*/
|
|
3981
4292
|
toBitsLe() {
|
|
@@ -4008,6 +4319,8 @@ class Plaintext {
|
|
|
4008
4319
|
}
|
|
4009
4320
|
/**
|
|
4010
4321
|
* Get the field array representation of the plaintext.
|
|
4322
|
+
*
|
|
4323
|
+
* @returns {Array} The field array representation of the plaintext.
|
|
4011
4324
|
* @returns {Array<any>}
|
|
4012
4325
|
*/
|
|
4013
4326
|
toFields() {
|
|
@@ -5315,6 +5628,31 @@ class ProgramManager {
|
|
|
5315
5628
|
const ret = wasm.programmanager_authorize(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports));
|
|
5316
5629
|
return takeObject(ret);
|
|
5317
5630
|
}
|
|
5631
|
+
/**
|
|
5632
|
+
* Create an execution `Authorization` without generating a circuit. Use this function when
|
|
5633
|
+
* fast delegated proving is needed.
|
|
5634
|
+
*
|
|
5635
|
+
* @param private_key The private key of the signer.
|
|
5636
|
+
* @param program The program source code containing the function to authorize.
|
|
5637
|
+
* @param function_name The function to authorize.
|
|
5638
|
+
* @param inputs A javascript array of inputs to the function.
|
|
5639
|
+
* @param imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
5640
|
+
* @param {PrivateKey} private_key
|
|
5641
|
+
* @param {string} program
|
|
5642
|
+
* @param {string} function_name
|
|
5643
|
+
* @param {Array<any>} inputs
|
|
5644
|
+
* @param {object | null} [imports]
|
|
5645
|
+
* @returns {Promise<Authorization>}
|
|
5646
|
+
*/
|
|
5647
|
+
static buildAuthorizationUnchecked(private_key, program, function_name, inputs, imports) {
|
|
5648
|
+
_assertClass(private_key, PrivateKey);
|
|
5649
|
+
const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
5650
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5651
|
+
const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
5652
|
+
const len1 = WASM_VECTOR_LEN;
|
|
5653
|
+
const ret = wasm.programmanager_buildAuthorizationUnchecked(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports));
|
|
5654
|
+
return takeObject(ret);
|
|
5655
|
+
}
|
|
5318
5656
|
/**
|
|
5319
5657
|
* Create an `Authorization` for `credits.aleo/fee_public` or `credits.aleo/fee_private`.
|
|
5320
5658
|
* This object requires an associated execution or deployment ID. This can be gained from
|
|
@@ -5745,6 +6083,48 @@ class ProgramManager {
|
|
|
5745
6083
|
const ret = wasm.programmanager_buildJoinTransaction(private_key.__wbg_ptr, ptr0, ptr1, priority_fee_credits, ptr2, ptr3, len3, ptr4, ptr5, ptr6, ptr7, ptr8);
|
|
5746
6084
|
return takeObject(ret);
|
|
5747
6085
|
}
|
|
6086
|
+
/**
|
|
6087
|
+
* Create a `ProvingRequest` object. This object creates authorizations for the top level
|
|
6088
|
+
* function and associated fee function. This object can be sent directly to a remote prover
|
|
6089
|
+
* OR used to extract both execution and fee authorizations.
|
|
6090
|
+
*
|
|
6091
|
+
* @param private_key The private key of the signer.
|
|
6092
|
+
* @param program The program source code containing the function to authorize.
|
|
6093
|
+
* @param function_name The function to authorize.
|
|
6094
|
+
* @param inputs A javascript array of inputs to the function.
|
|
6095
|
+
* @param base_fee_credits The base fee to be paid for the authorization
|
|
6096
|
+
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
6097
|
+
* @param fee_record The record to spend the fee from
|
|
6098
|
+
* @param imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
6099
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
6100
|
+
* @param broadcast (optional) Flag to indicate if the transaction should be broadcast
|
|
6101
|
+
* @returns {Authorization}
|
|
6102
|
+
* @param {PrivateKey} private_key
|
|
6103
|
+
* @param {string} program
|
|
6104
|
+
* @param {string} function_name
|
|
6105
|
+
* @param {Array<any>} inputs
|
|
6106
|
+
* @param {number} base_fee_credits
|
|
6107
|
+
* @param {number} priority_fee_credits
|
|
6108
|
+
* @param {RecordPlaintext | null | undefined} fee_record
|
|
6109
|
+
* @param {object | null | undefined} imports
|
|
6110
|
+
* @param {boolean} broadcast
|
|
6111
|
+
* @param {boolean} unchecked
|
|
6112
|
+
* @returns {Promise<ProvingRequest>}
|
|
6113
|
+
*/
|
|
6114
|
+
static buildProvingRequest(private_key, program, function_name, inputs, base_fee_credits, priority_fee_credits, fee_record, imports, broadcast, unchecked) {
|
|
6115
|
+
_assertClass(private_key, PrivateKey);
|
|
6116
|
+
const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
6117
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6118
|
+
const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
6119
|
+
const len1 = WASM_VECTOR_LEN;
|
|
6120
|
+
let ptr2 = 0;
|
|
6121
|
+
if (!isLikeNone(fee_record)) {
|
|
6122
|
+
_assertClass(fee_record, RecordPlaintext);
|
|
6123
|
+
ptr2 = fee_record.__destroy_into_raw();
|
|
6124
|
+
}
|
|
6125
|
+
const ret = wasm.programmanager_buildProvingRequest(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), base_fee_credits, priority_fee_credits, ptr2, isLikeNone(imports) ? 0 : addHeapObject(imports), broadcast, unchecked);
|
|
6126
|
+
return takeObject(ret);
|
|
6127
|
+
}
|
|
5748
6128
|
/**
|
|
5749
6129
|
* Split an Aleo credits record into two separate records. This function does not require a fee.
|
|
5750
6130
|
*
|
|
@@ -5869,10 +6249,10 @@ class ProgramManager {
|
|
|
5869
6249
|
/**
|
|
5870
6250
|
* Synthesize proving and verifying keys for a program
|
|
5871
6251
|
*
|
|
5872
|
-
* @param
|
|
5873
|
-
* @param
|
|
5874
|
-
* @param
|
|
5875
|
-
* @param
|
|
6252
|
+
* @param {string} program The program source code of the program to synthesize keys for
|
|
6253
|
+
* @param {string} function_id The function to synthesize keys for
|
|
6254
|
+
* @param {Array} inputs The inputs to the function
|
|
6255
|
+
* @param {Object | undefined} imports The imports for the program
|
|
5876
6256
|
* @param {PrivateKey} private_key
|
|
5877
6257
|
* @param {string} program
|
|
5878
6258
|
* @param {string} function_id
|
|
@@ -5889,6 +6269,14 @@ class ProgramManager {
|
|
|
5889
6269
|
const ret = wasm.programmanager_synthesizeKeyPair(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports));
|
|
5890
6270
|
return takeObject(ret);
|
|
5891
6271
|
}
|
|
6272
|
+
/**
|
|
6273
|
+
* @param {ProvingKey} proving_key
|
|
6274
|
+
*/
|
|
6275
|
+
static loadInclusionProver(proving_key) {
|
|
6276
|
+
_assertClass(proving_key, ProvingKey);
|
|
6277
|
+
var ptr0 = proving_key.__destroy_into_raw();
|
|
6278
|
+
wasm.programmanager_loadInclusionProver(ptr0);
|
|
6279
|
+
}
|
|
5892
6280
|
}
|
|
5893
6281
|
|
|
5894
6282
|
const ProvingKeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -6257,6 +6645,176 @@ class ProvingKey {
|
|
|
6257
6645
|
}
|
|
6258
6646
|
}
|
|
6259
6647
|
|
|
6648
|
+
const ProvingRequestFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6649
|
+
? { register: () => {}, unregister: () => {} }
|
|
6650
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_provingrequest_free(ptr >>> 0, 1));
|
|
6651
|
+
/**
|
|
6652
|
+
* Represents a proving request to a prover.
|
|
6653
|
+
*/
|
|
6654
|
+
class ProvingRequest {
|
|
6655
|
+
|
|
6656
|
+
static __wrap(ptr) {
|
|
6657
|
+
ptr = ptr >>> 0;
|
|
6658
|
+
const obj = Object.create(ProvingRequest.prototype);
|
|
6659
|
+
obj.__wbg_ptr = ptr;
|
|
6660
|
+
ProvingRequestFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
6661
|
+
return obj;
|
|
6662
|
+
}
|
|
6663
|
+
|
|
6664
|
+
__destroy_into_raw() {
|
|
6665
|
+
const ptr = this.__wbg_ptr;
|
|
6666
|
+
this.__wbg_ptr = 0;
|
|
6667
|
+
ProvingRequestFinalization.unregister(this);
|
|
6668
|
+
return ptr;
|
|
6669
|
+
}
|
|
6670
|
+
|
|
6671
|
+
free() {
|
|
6672
|
+
const ptr = this.__destroy_into_raw();
|
|
6673
|
+
wasm.__wbg_provingrequest_free(ptr, 0);
|
|
6674
|
+
}
|
|
6675
|
+
/**
|
|
6676
|
+
* Creates a new ProvingRequest from a function Authorization and an optional fee Authorization.
|
|
6677
|
+
*
|
|
6678
|
+
* @param {Authorization} authorization An Authorization for a function.
|
|
6679
|
+
* @param {Authorization} fee_authorization The authorization for the `credits.aleo/fee_public` or `credits.aleo/fee_private` function that pays the fee for the execution of the main function.
|
|
6680
|
+
* @param {boolean} broadcast Flag that indicates whether the remote proving service should attempt to submit the transaction on the caller's behalf.
|
|
6681
|
+
* @param {Authorization} authorization
|
|
6682
|
+
* @param {Authorization | null | undefined} fee_authorization
|
|
6683
|
+
* @param {boolean} broadcast
|
|
6684
|
+
* @returns {ProvingRequest}
|
|
6685
|
+
*/
|
|
6686
|
+
static new(authorization, fee_authorization, broadcast) {
|
|
6687
|
+
_assertClass(authorization, Authorization);
|
|
6688
|
+
var ptr0 = authorization.__destroy_into_raw();
|
|
6689
|
+
let ptr1 = 0;
|
|
6690
|
+
if (!isLikeNone(fee_authorization)) {
|
|
6691
|
+
_assertClass(fee_authorization, Authorization);
|
|
6692
|
+
ptr1 = fee_authorization.__destroy_into_raw();
|
|
6693
|
+
}
|
|
6694
|
+
const ret = wasm.provingrequest_new(ptr0, ptr1, broadcast);
|
|
6695
|
+
return ProvingRequest.__wrap(ret);
|
|
6696
|
+
}
|
|
6697
|
+
/**
|
|
6698
|
+
* Creates a ProvingRequest from a string representation.
|
|
6699
|
+
*
|
|
6700
|
+
* @param {Uint8Array} request String representation of the ProvingRequest.
|
|
6701
|
+
* @param {string} request
|
|
6702
|
+
* @returns {ProvingRequest}
|
|
6703
|
+
*/
|
|
6704
|
+
static fromString(request) {
|
|
6705
|
+
try {
|
|
6706
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6707
|
+
const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
6708
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6709
|
+
wasm.provingrequest_fromString(retptr, ptr0, len0);
|
|
6710
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6711
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6712
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6713
|
+
if (r2) {
|
|
6714
|
+
throw takeObject(r1);
|
|
6715
|
+
}
|
|
6716
|
+
return ProvingRequest.__wrap(r0);
|
|
6717
|
+
} finally {
|
|
6718
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6719
|
+
}
|
|
6720
|
+
}
|
|
6721
|
+
/**
|
|
6722
|
+
* Creates a string representation of the ProvingRequest.
|
|
6723
|
+
* @returns {string}
|
|
6724
|
+
*/
|
|
6725
|
+
toString() {
|
|
6726
|
+
let deferred1_0;
|
|
6727
|
+
let deferred1_1;
|
|
6728
|
+
try {
|
|
6729
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6730
|
+
wasm.provingrequest_toString(retptr, this.__wbg_ptr);
|
|
6731
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6732
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6733
|
+
deferred1_0 = r0;
|
|
6734
|
+
deferred1_1 = r1;
|
|
6735
|
+
return getStringFromWasm0(r0, r1);
|
|
6736
|
+
} finally {
|
|
6737
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6738
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
6739
|
+
}
|
|
6740
|
+
}
|
|
6741
|
+
/**
|
|
6742
|
+
* Creates a ProvingRequest from a left-endian byte representation of the ProvingRequest.
|
|
6743
|
+
*
|
|
6744
|
+
* @param {Uint8Array} bytes Left-endian bytes representing the proving request.
|
|
6745
|
+
* @param {Uint8Array} bytes
|
|
6746
|
+
* @returns {ProvingRequest}
|
|
6747
|
+
*/
|
|
6748
|
+
static fromBytesLe(bytes) {
|
|
6749
|
+
try {
|
|
6750
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6751
|
+
wasm.provingrequest_fromBytesLe(retptr, addHeapObject(bytes));
|
|
6752
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6753
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6754
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6755
|
+
if (r2) {
|
|
6756
|
+
throw takeObject(r1);
|
|
6757
|
+
}
|
|
6758
|
+
return ProvingRequest.__wrap(r0);
|
|
6759
|
+
} finally {
|
|
6760
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6761
|
+
}
|
|
6762
|
+
}
|
|
6763
|
+
/**
|
|
6764
|
+
* Creates a left-endian byte representation of the ProvingRequest.
|
|
6765
|
+
* @returns {Uint8Array}
|
|
6766
|
+
*/
|
|
6767
|
+
toBytesLe() {
|
|
6768
|
+
try {
|
|
6769
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6770
|
+
wasm.provingrequest_toBytesLe(retptr, this.__wbg_ptr);
|
|
6771
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6772
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6773
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6774
|
+
if (r2) {
|
|
6775
|
+
throw takeObject(r1);
|
|
6776
|
+
}
|
|
6777
|
+
return takeObject(r0);
|
|
6778
|
+
} finally {
|
|
6779
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6780
|
+
}
|
|
6781
|
+
}
|
|
6782
|
+
/**
|
|
6783
|
+
* Get the Authorization of the main function in the ProvingRequest.
|
|
6784
|
+
* @returns {Authorization}
|
|
6785
|
+
*/
|
|
6786
|
+
authorization() {
|
|
6787
|
+
const ret = wasm.provingrequest_authorization(this.__wbg_ptr);
|
|
6788
|
+
return Authorization.__wrap(ret);
|
|
6789
|
+
}
|
|
6790
|
+
/**
|
|
6791
|
+
* Get the fee Authorization in the ProvingRequest.
|
|
6792
|
+
* @returns {Authorization | undefined}
|
|
6793
|
+
*/
|
|
6794
|
+
feeAuthorization() {
|
|
6795
|
+
const ret = wasm.provingrequest_feeAuthorization(this.__wbg_ptr);
|
|
6796
|
+
return ret === 0 ? undefined : Authorization.__wrap(ret);
|
|
6797
|
+
}
|
|
6798
|
+
/**
|
|
6799
|
+
* Get the broadcast flag set in the ProvingRequest.
|
|
6800
|
+
* @returns {boolean}
|
|
6801
|
+
*/
|
|
6802
|
+
broadcast() {
|
|
6803
|
+
const ret = wasm.provingrequest_broadcast(this.__wbg_ptr);
|
|
6804
|
+
return ret !== 0;
|
|
6805
|
+
}
|
|
6806
|
+
/**
|
|
6807
|
+
* Check if a ProvingRequest is the same as another ProvingRequest.
|
|
6808
|
+
* @param {ProvingRequest} other
|
|
6809
|
+
* @returns {boolean}
|
|
6810
|
+
*/
|
|
6811
|
+
equals(other) {
|
|
6812
|
+
_assertClass(other, ProvingRequest);
|
|
6813
|
+
const ret = wasm.provingrequest_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
6814
|
+
return ret !== 0;
|
|
6815
|
+
}
|
|
6816
|
+
}
|
|
6817
|
+
|
|
6260
6818
|
const RecordCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6261
6819
|
? { register: () => {}, unregister: () => {} }
|
|
6262
6820
|
: new FinalizationRegistry(ptr => wasm.__wbg_recordciphertext_free(ptr >>> 0, 1));
|
|
@@ -6439,6 +6997,8 @@ class RecordCiphertext {
|
|
|
6439
6997
|
}
|
|
6440
6998
|
/**
|
|
6441
6999
|
* Get the left endian byte array representation of the record ciphertext.
|
|
7000
|
+
*
|
|
7001
|
+
* @returns {Uint8Array} Left endian byte array representation of the record ciphertext.
|
|
6442
7002
|
* @returns {Uint8Array}
|
|
6443
7003
|
*/
|
|
6444
7004
|
toBytesLe() {
|
|
@@ -6458,6 +7018,8 @@ class RecordCiphertext {
|
|
|
6458
7018
|
}
|
|
6459
7019
|
/**
|
|
6460
7020
|
* Get the left endian boolean array representation of the record ciphertext bits.
|
|
7021
|
+
*
|
|
7022
|
+
* returns {Array} Left endian boolean array representation of the bits of the record ciphertext.
|
|
6461
7023
|
* @returns {Array<any>}
|
|
6462
7024
|
*/
|
|
6463
7025
|
toBitsLe() {
|
|
@@ -6466,6 +7028,8 @@ class RecordCiphertext {
|
|
|
6466
7028
|
}
|
|
6467
7029
|
/**
|
|
6468
7030
|
* Get the field array representation of the record ciphertext.
|
|
7031
|
+
*
|
|
7032
|
+
* @returns {Array} Field array representation of the record ciphertext.
|
|
6469
7033
|
* @returns {Array<any>}
|
|
6470
7034
|
*/
|
|
6471
7035
|
toFields() {
|
|
@@ -6511,6 +7075,8 @@ class RecordCiphertext {
|
|
|
6511
7075
|
}
|
|
6512
7076
|
/**
|
|
6513
7077
|
* Get the record nonce.
|
|
7078
|
+
*
|
|
7079
|
+
* @returns {Group} The record nonce.
|
|
6514
7080
|
* @returns {Group}
|
|
6515
7081
|
*/
|
|
6516
7082
|
nonce() {
|
|
@@ -6549,16 +7115,19 @@ class RecordPlaintext {
|
|
|
6549
7115
|
/**
|
|
6550
7116
|
* @param {string} program_id
|
|
6551
7117
|
* @param {string} record_name
|
|
7118
|
+
* @param {string} record_view_key
|
|
6552
7119
|
* @returns {Field}
|
|
6553
7120
|
*/
|
|
6554
|
-
commitment(program_id, record_name) {
|
|
7121
|
+
commitment(program_id, record_name, record_view_key) {
|
|
6555
7122
|
try {
|
|
6556
7123
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6557
7124
|
const ptr0 = passStringToWasm0(program_id, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
6558
7125
|
const len0 = WASM_VECTOR_LEN;
|
|
6559
7126
|
const ptr1 = passStringToWasm0(record_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
6560
7127
|
const len1 = WASM_VECTOR_LEN;
|
|
6561
|
-
|
|
7128
|
+
const ptr2 = passStringToWasm0(record_view_key, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
7129
|
+
const len2 = WASM_VECTOR_LEN;
|
|
7130
|
+
wasm.recordplaintext_commitment(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
6562
7131
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6563
7132
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6564
7133
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -6573,7 +7142,8 @@ class RecordPlaintext {
|
|
|
6573
7142
|
/**
|
|
6574
7143
|
* Return a record plaintext from a string.
|
|
6575
7144
|
*
|
|
6576
|
-
* @param {string} record String representation of a plaintext representation of an Aleo record
|
|
7145
|
+
* @param {string} record String representation of a plaintext representation of an Aleo record.
|
|
7146
|
+
*
|
|
6577
7147
|
* @returns {RecordPlaintext} Record plaintext
|
|
6578
7148
|
* @param {string} record
|
|
6579
7149
|
* @returns {RecordPlaintext}
|
|
@@ -6596,6 +7166,11 @@ class RecordPlaintext {
|
|
|
6596
7166
|
}
|
|
6597
7167
|
}
|
|
6598
7168
|
/**
|
|
7169
|
+
* Get the record entry matching a key.
|
|
7170
|
+
*
|
|
7171
|
+
* @param {string} input The key to retrieve the value in the record data field.
|
|
7172
|
+
*
|
|
7173
|
+
* @returns {Plaintext} The plaintext value corresponding to the key.
|
|
6599
7174
|
* @param {string} input
|
|
6600
7175
|
* @returns {Plaintext}
|
|
6601
7176
|
*/
|
|
@@ -6618,6 +7193,8 @@ class RecordPlaintext {
|
|
|
6618
7193
|
}
|
|
6619
7194
|
/**
|
|
6620
7195
|
* Get the owner of the record.
|
|
7196
|
+
*
|
|
7197
|
+
* @returns {Address} Address of the owner of the record.
|
|
6621
7198
|
* @returns {Address}
|
|
6622
7199
|
*/
|
|
6623
7200
|
owner() {
|
|
@@ -6836,16 +7413,18 @@ class RecordPlaintext {
|
|
|
6836
7413
|
* @param {PrivateKey} private_key Private key of the account that owns the record
|
|
6837
7414
|
* @param {string} program_id Program ID of the program that the record is associated with
|
|
6838
7415
|
* @param {string} record_name Name of the record
|
|
7416
|
+
* @param {string} record_view_key The string representation of the record view key.
|
|
6839
7417
|
*
|
|
6840
7418
|
* @returns {string} Serial number of the record
|
|
6841
7419
|
* @param {PrivateKey} private_key
|
|
6842
7420
|
* @param {string} program_id
|
|
6843
7421
|
* @param {string} record_name
|
|
7422
|
+
* @param {string} record_view_key
|
|
6844
7423
|
* @returns {string}
|
|
6845
7424
|
*/
|
|
6846
|
-
serialNumberString(private_key, program_id, record_name) {
|
|
6847
|
-
let
|
|
6848
|
-
let
|
|
7425
|
+
serialNumberString(private_key, program_id, record_name, record_view_key) {
|
|
7426
|
+
let deferred5_0;
|
|
7427
|
+
let deferred5_1;
|
|
6849
7428
|
try {
|
|
6850
7429
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6851
7430
|
_assertClass(private_key, PrivateKey);
|
|
@@ -6853,23 +7432,25 @@ class RecordPlaintext {
|
|
|
6853
7432
|
const len0 = WASM_VECTOR_LEN;
|
|
6854
7433
|
const ptr1 = passStringToWasm0(record_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
6855
7434
|
const len1 = WASM_VECTOR_LEN;
|
|
6856
|
-
|
|
7435
|
+
const ptr2 = passStringToWasm0(record_view_key, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
7436
|
+
const len2 = WASM_VECTOR_LEN;
|
|
7437
|
+
wasm.recordplaintext_serialNumberString(retptr, this.__wbg_ptr, private_key.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
6857
7438
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6858
7439
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6859
7440
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6860
7441
|
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
6861
|
-
var
|
|
6862
|
-
var
|
|
7442
|
+
var ptr4 = r0;
|
|
7443
|
+
var len4 = r1;
|
|
6863
7444
|
if (r3) {
|
|
6864
|
-
|
|
7445
|
+
ptr4 = 0; len4 = 0;
|
|
6865
7446
|
throw takeObject(r2);
|
|
6866
7447
|
}
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
return getStringFromWasm0(
|
|
7448
|
+
deferred5_0 = ptr4;
|
|
7449
|
+
deferred5_1 = len4;
|
|
7450
|
+
return getStringFromWasm0(ptr4, len4);
|
|
6870
7451
|
} finally {
|
|
6871
7452
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6872
|
-
wasm.__wbindgen_export_2(
|
|
7453
|
+
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
6873
7454
|
}
|
|
6874
7455
|
}
|
|
6875
7456
|
/**
|
|
@@ -6896,6 +7477,21 @@ class RecordPlaintext {
|
|
|
6896
7477
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6897
7478
|
}
|
|
6898
7479
|
}
|
|
7480
|
+
/**
|
|
7481
|
+
* Generate the record view key. The record view key can only decrypt record if the
|
|
7482
|
+
* supplied view key belongs to the record owner.
|
|
7483
|
+
*
|
|
7484
|
+
* @param {ViewKey} view_key View key used to generate the record view key
|
|
7485
|
+
*
|
|
7486
|
+
* @returns {Group} record view key
|
|
7487
|
+
* @param {ViewKey} view_key
|
|
7488
|
+
* @returns {Field}
|
|
7489
|
+
*/
|
|
7490
|
+
recordViewKey(view_key) {
|
|
7491
|
+
_assertClass(view_key, ViewKey);
|
|
7492
|
+
const ret = wasm.recordplaintext_recordViewKey(this.__wbg_ptr, view_key.__wbg_ptr);
|
|
7493
|
+
return Field.__wrap(ret);
|
|
7494
|
+
}
|
|
6899
7495
|
}
|
|
6900
7496
|
|
|
6901
7497
|
const ScalarFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -7195,7 +7791,7 @@ class Signature {
|
|
|
7195
7791
|
_assertClass(private_key, PrivateKey);
|
|
7196
7792
|
const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_export_3);
|
|
7197
7793
|
const len0 = WASM_VECTOR_LEN;
|
|
7198
|
-
const ret = wasm.
|
|
7794
|
+
const ret = wasm.signature_sign(private_key.__wbg_ptr, ptr0, len0);
|
|
7199
7795
|
return Signature.__wrap(ret);
|
|
7200
7796
|
}
|
|
7201
7797
|
/**
|
|
@@ -7997,6 +8593,8 @@ class Transition {
|
|
|
7997
8593
|
}
|
|
7998
8594
|
/**
|
|
7999
8595
|
* Get the transition public key of the transition.
|
|
8596
|
+
*
|
|
8597
|
+
* @returns {Group} Transition public key
|
|
8000
8598
|
* @returns {Group}
|
|
8001
8599
|
*/
|
|
8002
8600
|
tpk() {
|
|
@@ -8005,6 +8603,10 @@ class Transition {
|
|
|
8005
8603
|
}
|
|
8006
8604
|
/**
|
|
8007
8605
|
* Get the transition view key of the transition.
|
|
8606
|
+
*
|
|
8607
|
+
* @param {ViewKey} view_key The view key of the transition signer.
|
|
8608
|
+
*
|
|
8609
|
+
* @returns {Field} Transition view key
|
|
8008
8610
|
* @param {ViewKey} view_key
|
|
8009
8611
|
* @returns {Field}
|
|
8010
8612
|
*/
|
|
@@ -8015,6 +8617,8 @@ class Transition {
|
|
|
8015
8617
|
}
|
|
8016
8618
|
/**
|
|
8017
8619
|
* Get the transition commitment of the transition.
|
|
8620
|
+
*
|
|
8621
|
+
* @returns {Field} Transition commitment
|
|
8018
8622
|
* @returns {Field}
|
|
8019
8623
|
*/
|
|
8020
8624
|
tcm() {
|
|
@@ -8023,6 +8627,8 @@ class Transition {
|
|
|
8023
8627
|
}
|
|
8024
8628
|
/**
|
|
8025
8629
|
* Get the transition signer commitment of the transition.
|
|
8630
|
+
*
|
|
8631
|
+
* @returns {Field} Transition signer commitment
|
|
8026
8632
|
* @returns {Field}
|
|
8027
8633
|
*/
|
|
8028
8634
|
scm() {
|
|
@@ -8042,7 +8648,7 @@ class Transition {
|
|
|
8042
8648
|
try {
|
|
8043
8649
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
8044
8650
|
_assertClass(tvk, Field);
|
|
8045
|
-
wasm.
|
|
8651
|
+
wasm.transition_decryptTransition(retptr, this.__wbg_ptr, tvk.__wbg_ptr);
|
|
8046
8652
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
8047
8653
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
8048
8654
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -8548,7 +9154,7 @@ class ViewKey {
|
|
|
8548
9154
|
*/
|
|
8549
9155
|
static from_private_key(private_key) {
|
|
8550
9156
|
_assertClass(private_key, PrivateKey);
|
|
8551
|
-
const ret = wasm.
|
|
9157
|
+
const ret = wasm.viewkey_from_private_key(private_key.__wbg_ptr);
|
|
8552
9158
|
return ViewKey.__wrap(ret);
|
|
8553
9159
|
}
|
|
8554
9160
|
/**
|
|
@@ -8675,6 +9281,9 @@ async function __wbg_load(module, imports) {
|
|
|
8675
9281
|
function __wbg_get_imports() {
|
|
8676
9282
|
const imports = {};
|
|
8677
9283
|
imports.wbg = {};
|
|
9284
|
+
imports.wbg.__wbg_abort_410ec47a64ac6117 = function(arg0, arg1) {
|
|
9285
|
+
getObject(arg0).abort(getObject(arg1));
|
|
9286
|
+
};
|
|
8678
9287
|
imports.wbg.__wbg_abort_775ef1d17fc65868 = function(arg0) {
|
|
8679
9288
|
getObject(arg0).abort();
|
|
8680
9289
|
};
|
|
@@ -8713,6 +9322,10 @@ function __wbg_get_imports() {
|
|
|
8713
9322
|
const ret = Ciphertext.__wrap(arg0);
|
|
8714
9323
|
return addHeapObject(ret);
|
|
8715
9324
|
};
|
|
9325
|
+
imports.wbg.__wbg_clearTimeout_86721db0036bea98 = function(arg0) {
|
|
9326
|
+
const ret = clearTimeout(takeObject(arg0));
|
|
9327
|
+
return addHeapObject(ret);
|
|
9328
|
+
};
|
|
8716
9329
|
imports.wbg.__wbg_crypto_ed58b8e10a292839 = function(arg0) {
|
|
8717
9330
|
const ret = getObject(arg0).crypto;
|
|
8718
9331
|
return addHeapObject(ret);
|
|
@@ -8744,7 +9357,7 @@ function __wbg_get_imports() {
|
|
|
8744
9357
|
const ret = getObject(arg0).fetch(getObject(arg1));
|
|
8745
9358
|
return addHeapObject(ret);
|
|
8746
9359
|
};
|
|
8747
|
-
imports.wbg.
|
|
9360
|
+
imports.wbg.__wbg_fetch_d36a73832f0a45e8 = function(arg0) {
|
|
8748
9361
|
const ret = fetch(getObject(arg0));
|
|
8749
9362
|
return addHeapObject(ret);
|
|
8750
9363
|
};
|
|
@@ -8809,7 +9422,7 @@ function __wbg_get_imports() {
|
|
|
8809
9422
|
const ret = getObject(arg0).length;
|
|
8810
9423
|
return ret;
|
|
8811
9424
|
};
|
|
8812
|
-
imports.wbg.
|
|
9425
|
+
imports.wbg.__wbg_log_b1cdcca99372fe6e = function(arg0, arg1) {
|
|
8813
9426
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
8814
9427
|
};
|
|
8815
9428
|
imports.wbg.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
|
|
@@ -8827,7 +9440,7 @@ function __wbg_get_imports() {
|
|
|
8827
9440
|
const a = state0.a;
|
|
8828
9441
|
state0.a = 0;
|
|
8829
9442
|
try {
|
|
8830
|
-
return
|
|
9443
|
+
return __wbg_adapter_606(a, state0.b, arg0, arg1);
|
|
8831
9444
|
} finally {
|
|
8832
9445
|
state0.a = a;
|
|
8833
9446
|
}
|
|
@@ -8923,6 +9536,10 @@ function __wbg_get_imports() {
|
|
|
8923
9536
|
const ret = getObject(arg0).process;
|
|
8924
9537
|
return addHeapObject(ret);
|
|
8925
9538
|
};
|
|
9539
|
+
imports.wbg.__wbg_provingrequest_new = function(arg0) {
|
|
9540
|
+
const ret = ProvingRequest.__wrap(arg0);
|
|
9541
|
+
return addHeapObject(ret);
|
|
9542
|
+
};
|
|
8926
9543
|
imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
|
|
8927
9544
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
8928
9545
|
return ret;
|
|
@@ -8967,6 +9584,10 @@ function __wbg_get_imports() {
|
|
|
8967
9584
|
imports.wbg.__wbg_send_40a47636ff90f64d = function() { return handleError(function (arg0) {
|
|
8968
9585
|
getObject(arg0).send();
|
|
8969
9586
|
}, arguments) };
|
|
9587
|
+
imports.wbg.__wbg_setTimeout_2e707715f8cc9497 = function(arg0, arg1) {
|
|
9588
|
+
const ret = setTimeout(getObject(arg0), arg1);
|
|
9589
|
+
return addHeapObject(ret);
|
|
9590
|
+
};
|
|
8970
9591
|
imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
|
|
8971
9592
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
8972
9593
|
};
|
|
@@ -9006,7 +9627,7 @@ function __wbg_get_imports() {
|
|
|
9006
9627
|
const ret = Signature.__wrap(arg0);
|
|
9007
9628
|
return addHeapObject(ret);
|
|
9008
9629
|
};
|
|
9009
|
-
imports.wbg.
|
|
9630
|
+
imports.wbg.__wbg_spawnWorker_41e51220404b3348 = function(arg0, arg1, arg2, arg3) {
|
|
9010
9631
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
9011
9632
|
return addHeapObject(ret);
|
|
9012
9633
|
};
|
|
@@ -9126,12 +9747,16 @@ function __wbg_get_imports() {
|
|
|
9126
9747
|
const ret = false;
|
|
9127
9748
|
return ret;
|
|
9128
9749
|
};
|
|
9129
|
-
imports.wbg.
|
|
9130
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
9750
|
+
imports.wbg.__wbindgen_closure_wrapper6193 = function(arg0, arg1, arg2) {
|
|
9751
|
+
const ret = makeMutClosure(arg0, arg1, 470, __wbg_adapter_40);
|
|
9752
|
+
return addHeapObject(ret);
|
|
9753
|
+
};
|
|
9754
|
+
imports.wbg.__wbindgen_closure_wrapper6795 = function(arg0, arg1, arg2) {
|
|
9755
|
+
const ret = makeMutClosure(arg0, arg1, 470, __wbg_adapter_43);
|
|
9131
9756
|
return addHeapObject(ret);
|
|
9132
9757
|
};
|
|
9133
|
-
imports.wbg.
|
|
9134
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
9758
|
+
imports.wbg.__wbindgen_closure_wrapper6799 = function(arg0, arg1, arg2) {
|
|
9759
|
+
const ret = makeMutClosure(arg0, arg1, 470, __wbg_adapter_43);
|
|
9135
9760
|
return addHeapObject(ret);
|
|
9136
9761
|
};
|
|
9137
9762
|
imports.wbg.__wbindgen_is_function = function(arg0) {
|
|
@@ -9207,7 +9832,7 @@ function __wbg_get_imports() {
|
|
|
9207
9832
|
}
|
|
9208
9833
|
|
|
9209
9834
|
function __wbg_init_memory(imports, memory) {
|
|
9210
|
-
imports.wbg.memory = memory || new WebAssembly.Memory({initial:
|
|
9835
|
+
imports.wbg.memory = memory || new WebAssembly.Memory({initial:119,maximum:65536,shared:true});
|
|
9211
9836
|
}
|
|
9212
9837
|
|
|
9213
9838
|
function __wbg_finalize_init(instance, module, thread_stack_size) {
|
|
@@ -9286,5 +9911,5 @@ async function initThreadPool(threads) {
|
|
|
9286
9911
|
await initThreadPool$1(new URL("worker.js", import.meta.url), threads);
|
|
9287
9912
|
}
|
|
9288
9913
|
|
|
9289
|
-
export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Ciphertext, ComputeKey, EncryptionToolkit, Execution, ExecutionRequest, ExecutionResponse, Field, GraphKey, Group, KeyPair, Metadata, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager, ProvingKey, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, VerifyingKey, ViewKey, initSync, initThreadPool, runRayonThread, verifyFunctionExecution };
|
|
9914
|
+
export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Boolean, Ciphertext, ComputeKey, EncryptionToolkit, Execution, ExecutionRequest, ExecutionResponse, Field, GraphKey, Group, KeyPair, Metadata, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, VerifyingKey, ViewKey, initSync, initThreadPool, runRayonThread, verifyFunctionExecution };
|
|
9290
9915
|
//# sourceMappingURL=index.js.map
|