@provablehq/wasm 0.9.3 → 0.9.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 +266 -8
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.js +655 -38
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +656 -37
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +266 -8
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.js +655 -38
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +656 -37
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/testnet/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_605(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
|
*
|
|
@@ -6257,6 +6637,176 @@ class ProvingKey {
|
|
|
6257
6637
|
}
|
|
6258
6638
|
}
|
|
6259
6639
|
|
|
6640
|
+
const ProvingRequestFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6641
|
+
? { register: () => {}, unregister: () => {} }
|
|
6642
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_provingrequest_free(ptr >>> 0, 1));
|
|
6643
|
+
/**
|
|
6644
|
+
* Represents a proving request to a prover.
|
|
6645
|
+
*/
|
|
6646
|
+
class ProvingRequest {
|
|
6647
|
+
|
|
6648
|
+
static __wrap(ptr) {
|
|
6649
|
+
ptr = ptr >>> 0;
|
|
6650
|
+
const obj = Object.create(ProvingRequest.prototype);
|
|
6651
|
+
obj.__wbg_ptr = ptr;
|
|
6652
|
+
ProvingRequestFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
6653
|
+
return obj;
|
|
6654
|
+
}
|
|
6655
|
+
|
|
6656
|
+
__destroy_into_raw() {
|
|
6657
|
+
const ptr = this.__wbg_ptr;
|
|
6658
|
+
this.__wbg_ptr = 0;
|
|
6659
|
+
ProvingRequestFinalization.unregister(this);
|
|
6660
|
+
return ptr;
|
|
6661
|
+
}
|
|
6662
|
+
|
|
6663
|
+
free() {
|
|
6664
|
+
const ptr = this.__destroy_into_raw();
|
|
6665
|
+
wasm.__wbg_provingrequest_free(ptr, 0);
|
|
6666
|
+
}
|
|
6667
|
+
/**
|
|
6668
|
+
* Creates a new ProvingRequest from a function Authorization and an optional fee Authorization.
|
|
6669
|
+
*
|
|
6670
|
+
* @param {Authorization} authorization An Authorization for a function.
|
|
6671
|
+
* @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.
|
|
6672
|
+
* @param {boolean} broadcast Flag that indicates whether the remote proving service should attempt to submit the transaction on the caller's behalf.
|
|
6673
|
+
* @param {Authorization} authorization
|
|
6674
|
+
* @param {Authorization | null | undefined} fee_authorization
|
|
6675
|
+
* @param {boolean} broadcast
|
|
6676
|
+
* @returns {ProvingRequest}
|
|
6677
|
+
*/
|
|
6678
|
+
static new(authorization, fee_authorization, broadcast) {
|
|
6679
|
+
_assertClass(authorization, Authorization);
|
|
6680
|
+
var ptr0 = authorization.__destroy_into_raw();
|
|
6681
|
+
let ptr1 = 0;
|
|
6682
|
+
if (!isLikeNone(fee_authorization)) {
|
|
6683
|
+
_assertClass(fee_authorization, Authorization);
|
|
6684
|
+
ptr1 = fee_authorization.__destroy_into_raw();
|
|
6685
|
+
}
|
|
6686
|
+
const ret = wasm.provingrequest_new(ptr0, ptr1, broadcast);
|
|
6687
|
+
return ProvingRequest.__wrap(ret);
|
|
6688
|
+
}
|
|
6689
|
+
/**
|
|
6690
|
+
* Creates a ProvingRequest from a string representation.
|
|
6691
|
+
*
|
|
6692
|
+
* @param {Uint8Array} request String representation of the ProvingRequest.
|
|
6693
|
+
* @param {string} request
|
|
6694
|
+
* @returns {ProvingRequest}
|
|
6695
|
+
*/
|
|
6696
|
+
static fromString(request) {
|
|
6697
|
+
try {
|
|
6698
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6699
|
+
const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
6700
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6701
|
+
wasm.provingrequest_fromString(retptr, ptr0, len0);
|
|
6702
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6703
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6704
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6705
|
+
if (r2) {
|
|
6706
|
+
throw takeObject(r1);
|
|
6707
|
+
}
|
|
6708
|
+
return ProvingRequest.__wrap(r0);
|
|
6709
|
+
} finally {
|
|
6710
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6711
|
+
}
|
|
6712
|
+
}
|
|
6713
|
+
/**
|
|
6714
|
+
* Creates a string representation of the ProvingRequest.
|
|
6715
|
+
* @returns {string}
|
|
6716
|
+
*/
|
|
6717
|
+
toString() {
|
|
6718
|
+
let deferred1_0;
|
|
6719
|
+
let deferred1_1;
|
|
6720
|
+
try {
|
|
6721
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6722
|
+
wasm.provingrequest_toString(retptr, this.__wbg_ptr);
|
|
6723
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6724
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6725
|
+
deferred1_0 = r0;
|
|
6726
|
+
deferred1_1 = r1;
|
|
6727
|
+
return getStringFromWasm0(r0, r1);
|
|
6728
|
+
} finally {
|
|
6729
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6730
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
6731
|
+
}
|
|
6732
|
+
}
|
|
6733
|
+
/**
|
|
6734
|
+
* Creates a ProvingRequest from a left-endian byte representation of the ProvingRequest.
|
|
6735
|
+
*
|
|
6736
|
+
* @param {Uint8Array} bytes Left-endian bytes representing the proving request.
|
|
6737
|
+
* @param {Uint8Array} bytes
|
|
6738
|
+
* @returns {ProvingRequest}
|
|
6739
|
+
*/
|
|
6740
|
+
static fromBytesLe(bytes) {
|
|
6741
|
+
try {
|
|
6742
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6743
|
+
wasm.provingrequest_fromBytesLe(retptr, addHeapObject(bytes));
|
|
6744
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6745
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6746
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6747
|
+
if (r2) {
|
|
6748
|
+
throw takeObject(r1);
|
|
6749
|
+
}
|
|
6750
|
+
return ProvingRequest.__wrap(r0);
|
|
6751
|
+
} finally {
|
|
6752
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6753
|
+
}
|
|
6754
|
+
}
|
|
6755
|
+
/**
|
|
6756
|
+
* Creates a left-endian byte representation of the ProvingRequest.
|
|
6757
|
+
* @returns {Uint8Array}
|
|
6758
|
+
*/
|
|
6759
|
+
toBytesLe() {
|
|
6760
|
+
try {
|
|
6761
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6762
|
+
wasm.provingrequest_toBytesLe(retptr, this.__wbg_ptr);
|
|
6763
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6764
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6765
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6766
|
+
if (r2) {
|
|
6767
|
+
throw takeObject(r1);
|
|
6768
|
+
}
|
|
6769
|
+
return takeObject(r0);
|
|
6770
|
+
} finally {
|
|
6771
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6772
|
+
}
|
|
6773
|
+
}
|
|
6774
|
+
/**
|
|
6775
|
+
* Get the Authorization of the main function in the ProvingRequest.
|
|
6776
|
+
* @returns {Authorization}
|
|
6777
|
+
*/
|
|
6778
|
+
authorization() {
|
|
6779
|
+
const ret = wasm.provingrequest_authorization(this.__wbg_ptr);
|
|
6780
|
+
return Authorization.__wrap(ret);
|
|
6781
|
+
}
|
|
6782
|
+
/**
|
|
6783
|
+
* Get the fee Authorization in the ProvingRequest.
|
|
6784
|
+
* @returns {Authorization | undefined}
|
|
6785
|
+
*/
|
|
6786
|
+
feeAuthorization() {
|
|
6787
|
+
const ret = wasm.provingrequest_feeAuthorization(this.__wbg_ptr);
|
|
6788
|
+
return ret === 0 ? undefined : Authorization.__wrap(ret);
|
|
6789
|
+
}
|
|
6790
|
+
/**
|
|
6791
|
+
* Get the broadcast flag set in the ProvingRequest.
|
|
6792
|
+
* @returns {boolean}
|
|
6793
|
+
*/
|
|
6794
|
+
broadcast() {
|
|
6795
|
+
const ret = wasm.provingrequest_broadcast(this.__wbg_ptr);
|
|
6796
|
+
return ret !== 0;
|
|
6797
|
+
}
|
|
6798
|
+
/**
|
|
6799
|
+
* Check if a ProvingRequest is the same as another ProvingRequest.
|
|
6800
|
+
* @param {ProvingRequest} other
|
|
6801
|
+
* @returns {boolean}
|
|
6802
|
+
*/
|
|
6803
|
+
equals(other) {
|
|
6804
|
+
_assertClass(other, ProvingRequest);
|
|
6805
|
+
const ret = wasm.provingrequest_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
6806
|
+
return ret !== 0;
|
|
6807
|
+
}
|
|
6808
|
+
}
|
|
6809
|
+
|
|
6260
6810
|
const RecordCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6261
6811
|
? { register: () => {}, unregister: () => {} }
|
|
6262
6812
|
: new FinalizationRegistry(ptr => wasm.__wbg_recordciphertext_free(ptr >>> 0, 1));
|
|
@@ -6439,6 +6989,8 @@ class RecordCiphertext {
|
|
|
6439
6989
|
}
|
|
6440
6990
|
/**
|
|
6441
6991
|
* Get the left endian byte array representation of the record ciphertext.
|
|
6992
|
+
*
|
|
6993
|
+
* @returns {Uint8Array} Left endian byte array representation of the record ciphertext.
|
|
6442
6994
|
* @returns {Uint8Array}
|
|
6443
6995
|
*/
|
|
6444
6996
|
toBytesLe() {
|
|
@@ -6458,6 +7010,8 @@ class RecordCiphertext {
|
|
|
6458
7010
|
}
|
|
6459
7011
|
/**
|
|
6460
7012
|
* Get the left endian boolean array representation of the record ciphertext bits.
|
|
7013
|
+
*
|
|
7014
|
+
* returns {Array} Left endian boolean array representation of the bits of the record ciphertext.
|
|
6461
7015
|
* @returns {Array<any>}
|
|
6462
7016
|
*/
|
|
6463
7017
|
toBitsLe() {
|
|
@@ -6466,6 +7020,8 @@ class RecordCiphertext {
|
|
|
6466
7020
|
}
|
|
6467
7021
|
/**
|
|
6468
7022
|
* Get the field array representation of the record ciphertext.
|
|
7023
|
+
*
|
|
7024
|
+
* @returns {Array} Field array representation of the record ciphertext.
|
|
6469
7025
|
* @returns {Array<any>}
|
|
6470
7026
|
*/
|
|
6471
7027
|
toFields() {
|
|
@@ -6511,6 +7067,8 @@ class RecordCiphertext {
|
|
|
6511
7067
|
}
|
|
6512
7068
|
/**
|
|
6513
7069
|
* Get the record nonce.
|
|
7070
|
+
*
|
|
7071
|
+
* @returns {Group} The record nonce.
|
|
6514
7072
|
* @returns {Group}
|
|
6515
7073
|
*/
|
|
6516
7074
|
nonce() {
|
|
@@ -6549,16 +7107,19 @@ class RecordPlaintext {
|
|
|
6549
7107
|
/**
|
|
6550
7108
|
* @param {string} program_id
|
|
6551
7109
|
* @param {string} record_name
|
|
7110
|
+
* @param {string} record_view_key
|
|
6552
7111
|
* @returns {Field}
|
|
6553
7112
|
*/
|
|
6554
|
-
commitment(program_id, record_name) {
|
|
7113
|
+
commitment(program_id, record_name, record_view_key) {
|
|
6555
7114
|
try {
|
|
6556
7115
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6557
7116
|
const ptr0 = passStringToWasm0(program_id, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
6558
7117
|
const len0 = WASM_VECTOR_LEN;
|
|
6559
7118
|
const ptr1 = passStringToWasm0(record_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
6560
7119
|
const len1 = WASM_VECTOR_LEN;
|
|
6561
|
-
|
|
7120
|
+
const ptr2 = passStringToWasm0(record_view_key, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
7121
|
+
const len2 = WASM_VECTOR_LEN;
|
|
7122
|
+
wasm.recordplaintext_commitment(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
6562
7123
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6563
7124
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6564
7125
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -6573,7 +7134,8 @@ class RecordPlaintext {
|
|
|
6573
7134
|
/**
|
|
6574
7135
|
* Return a record plaintext from a string.
|
|
6575
7136
|
*
|
|
6576
|
-
* @param {string} record String representation of a plaintext representation of an Aleo record
|
|
7137
|
+
* @param {string} record String representation of a plaintext representation of an Aleo record.
|
|
7138
|
+
*
|
|
6577
7139
|
* @returns {RecordPlaintext} Record plaintext
|
|
6578
7140
|
* @param {string} record
|
|
6579
7141
|
* @returns {RecordPlaintext}
|
|
@@ -6596,6 +7158,11 @@ class RecordPlaintext {
|
|
|
6596
7158
|
}
|
|
6597
7159
|
}
|
|
6598
7160
|
/**
|
|
7161
|
+
* Get the record entry matching a key.
|
|
7162
|
+
*
|
|
7163
|
+
* @param {string} input The key to retrieve the value in the record data field.
|
|
7164
|
+
*
|
|
7165
|
+
* @returns {Plaintext} The plaintext value corresponding to the key.
|
|
6599
7166
|
* @param {string} input
|
|
6600
7167
|
* @returns {Plaintext}
|
|
6601
7168
|
*/
|
|
@@ -6618,6 +7185,8 @@ class RecordPlaintext {
|
|
|
6618
7185
|
}
|
|
6619
7186
|
/**
|
|
6620
7187
|
* Get the owner of the record.
|
|
7188
|
+
*
|
|
7189
|
+
* @returns {Address} Address of the owner of the record.
|
|
6621
7190
|
* @returns {Address}
|
|
6622
7191
|
*/
|
|
6623
7192
|
owner() {
|
|
@@ -6836,16 +7405,18 @@ class RecordPlaintext {
|
|
|
6836
7405
|
* @param {PrivateKey} private_key Private key of the account that owns the record
|
|
6837
7406
|
* @param {string} program_id Program ID of the program that the record is associated with
|
|
6838
7407
|
* @param {string} record_name Name of the record
|
|
7408
|
+
* @param {string} record_view_key The string representation of the record view key.
|
|
6839
7409
|
*
|
|
6840
7410
|
* @returns {string} Serial number of the record
|
|
6841
7411
|
* @param {PrivateKey} private_key
|
|
6842
7412
|
* @param {string} program_id
|
|
6843
7413
|
* @param {string} record_name
|
|
7414
|
+
* @param {string} record_view_key
|
|
6844
7415
|
* @returns {string}
|
|
6845
7416
|
*/
|
|
6846
|
-
serialNumberString(private_key, program_id, record_name) {
|
|
6847
|
-
let
|
|
6848
|
-
let
|
|
7417
|
+
serialNumberString(private_key, program_id, record_name, record_view_key) {
|
|
7418
|
+
let deferred5_0;
|
|
7419
|
+
let deferred5_1;
|
|
6849
7420
|
try {
|
|
6850
7421
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6851
7422
|
_assertClass(private_key, PrivateKey);
|
|
@@ -6853,23 +7424,25 @@ class RecordPlaintext {
|
|
|
6853
7424
|
const len0 = WASM_VECTOR_LEN;
|
|
6854
7425
|
const ptr1 = passStringToWasm0(record_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
6855
7426
|
const len1 = WASM_VECTOR_LEN;
|
|
6856
|
-
|
|
7427
|
+
const ptr2 = passStringToWasm0(record_view_key, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
7428
|
+
const len2 = WASM_VECTOR_LEN;
|
|
7429
|
+
wasm.recordplaintext_serialNumberString(retptr, this.__wbg_ptr, private_key.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
6857
7430
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6858
7431
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6859
7432
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6860
7433
|
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
6861
|
-
var
|
|
6862
|
-
var
|
|
7434
|
+
var ptr4 = r0;
|
|
7435
|
+
var len4 = r1;
|
|
6863
7436
|
if (r3) {
|
|
6864
|
-
|
|
7437
|
+
ptr4 = 0; len4 = 0;
|
|
6865
7438
|
throw takeObject(r2);
|
|
6866
7439
|
}
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
return getStringFromWasm0(
|
|
7440
|
+
deferred5_0 = ptr4;
|
|
7441
|
+
deferred5_1 = len4;
|
|
7442
|
+
return getStringFromWasm0(ptr4, len4);
|
|
6870
7443
|
} finally {
|
|
6871
7444
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6872
|
-
wasm.__wbindgen_export_2(
|
|
7445
|
+
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
6873
7446
|
}
|
|
6874
7447
|
}
|
|
6875
7448
|
/**
|
|
@@ -6896,6 +7469,21 @@ class RecordPlaintext {
|
|
|
6896
7469
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6897
7470
|
}
|
|
6898
7471
|
}
|
|
7472
|
+
/**
|
|
7473
|
+
* Generate the record view key. The record view key can only decrypt record if the
|
|
7474
|
+
* supplied view key belongs to the record owner.
|
|
7475
|
+
*
|
|
7476
|
+
* @param {ViewKey} view_key View key used to generate the record view key
|
|
7477
|
+
*
|
|
7478
|
+
* @returns {Group} record view key
|
|
7479
|
+
* @param {ViewKey} view_key
|
|
7480
|
+
* @returns {Field}
|
|
7481
|
+
*/
|
|
7482
|
+
recordViewKey(view_key) {
|
|
7483
|
+
_assertClass(view_key, ViewKey);
|
|
7484
|
+
const ret = wasm.recordplaintext_recordViewKey(this.__wbg_ptr, view_key.__wbg_ptr);
|
|
7485
|
+
return Field.__wrap(ret);
|
|
7486
|
+
}
|
|
6899
7487
|
}
|
|
6900
7488
|
|
|
6901
7489
|
const ScalarFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -7195,7 +7783,7 @@ class Signature {
|
|
|
7195
7783
|
_assertClass(private_key, PrivateKey);
|
|
7196
7784
|
const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_export_3);
|
|
7197
7785
|
const len0 = WASM_VECTOR_LEN;
|
|
7198
|
-
const ret = wasm.
|
|
7786
|
+
const ret = wasm.signature_sign(private_key.__wbg_ptr, ptr0, len0);
|
|
7199
7787
|
return Signature.__wrap(ret);
|
|
7200
7788
|
}
|
|
7201
7789
|
/**
|
|
@@ -7997,6 +8585,8 @@ class Transition {
|
|
|
7997
8585
|
}
|
|
7998
8586
|
/**
|
|
7999
8587
|
* Get the transition public key of the transition.
|
|
8588
|
+
*
|
|
8589
|
+
* @returns {Group} Transition public key
|
|
8000
8590
|
* @returns {Group}
|
|
8001
8591
|
*/
|
|
8002
8592
|
tpk() {
|
|
@@ -8005,6 +8595,10 @@ class Transition {
|
|
|
8005
8595
|
}
|
|
8006
8596
|
/**
|
|
8007
8597
|
* Get the transition view key of the transition.
|
|
8598
|
+
*
|
|
8599
|
+
* @param {ViewKey} view_key The view key of the transition signer.
|
|
8600
|
+
*
|
|
8601
|
+
* @returns {Field} Transition view key
|
|
8008
8602
|
* @param {ViewKey} view_key
|
|
8009
8603
|
* @returns {Field}
|
|
8010
8604
|
*/
|
|
@@ -8015,6 +8609,8 @@ class Transition {
|
|
|
8015
8609
|
}
|
|
8016
8610
|
/**
|
|
8017
8611
|
* Get the transition commitment of the transition.
|
|
8612
|
+
*
|
|
8613
|
+
* @returns {Field} Transition commitment
|
|
8018
8614
|
* @returns {Field}
|
|
8019
8615
|
*/
|
|
8020
8616
|
tcm() {
|
|
@@ -8023,6 +8619,8 @@ class Transition {
|
|
|
8023
8619
|
}
|
|
8024
8620
|
/**
|
|
8025
8621
|
* Get the transition signer commitment of the transition.
|
|
8622
|
+
*
|
|
8623
|
+
* @returns {Field} Transition signer commitment
|
|
8026
8624
|
* @returns {Field}
|
|
8027
8625
|
*/
|
|
8028
8626
|
scm() {
|
|
@@ -8042,7 +8640,7 @@ class Transition {
|
|
|
8042
8640
|
try {
|
|
8043
8641
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
8044
8642
|
_assertClass(tvk, Field);
|
|
8045
|
-
wasm.
|
|
8643
|
+
wasm.transition_decryptTransition(retptr, this.__wbg_ptr, tvk.__wbg_ptr);
|
|
8046
8644
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
8047
8645
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
8048
8646
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -8548,7 +9146,7 @@ class ViewKey {
|
|
|
8548
9146
|
*/
|
|
8549
9147
|
static from_private_key(private_key) {
|
|
8550
9148
|
_assertClass(private_key, PrivateKey);
|
|
8551
|
-
const ret = wasm.
|
|
9149
|
+
const ret = wasm.viewkey_from_private_key(private_key.__wbg_ptr);
|
|
8552
9150
|
return ViewKey.__wrap(ret);
|
|
8553
9151
|
}
|
|
8554
9152
|
/**
|
|
@@ -8675,6 +9273,9 @@ async function __wbg_load(module, imports) {
|
|
|
8675
9273
|
function __wbg_get_imports() {
|
|
8676
9274
|
const imports = {};
|
|
8677
9275
|
imports.wbg = {};
|
|
9276
|
+
imports.wbg.__wbg_abort_410ec47a64ac6117 = function(arg0, arg1) {
|
|
9277
|
+
getObject(arg0).abort(getObject(arg1));
|
|
9278
|
+
};
|
|
8678
9279
|
imports.wbg.__wbg_abort_775ef1d17fc65868 = function(arg0) {
|
|
8679
9280
|
getObject(arg0).abort();
|
|
8680
9281
|
};
|
|
@@ -8713,6 +9314,10 @@ function __wbg_get_imports() {
|
|
|
8713
9314
|
const ret = Ciphertext.__wrap(arg0);
|
|
8714
9315
|
return addHeapObject(ret);
|
|
8715
9316
|
};
|
|
9317
|
+
imports.wbg.__wbg_clearTimeout_86721db0036bea98 = function(arg0) {
|
|
9318
|
+
const ret = clearTimeout(takeObject(arg0));
|
|
9319
|
+
return addHeapObject(ret);
|
|
9320
|
+
};
|
|
8716
9321
|
imports.wbg.__wbg_crypto_ed58b8e10a292839 = function(arg0) {
|
|
8717
9322
|
const ret = getObject(arg0).crypto;
|
|
8718
9323
|
return addHeapObject(ret);
|
|
@@ -8744,7 +9349,7 @@ function __wbg_get_imports() {
|
|
|
8744
9349
|
const ret = getObject(arg0).fetch(getObject(arg1));
|
|
8745
9350
|
return addHeapObject(ret);
|
|
8746
9351
|
};
|
|
8747
|
-
imports.wbg.
|
|
9352
|
+
imports.wbg.__wbg_fetch_d36a73832f0a45e8 = function(arg0) {
|
|
8748
9353
|
const ret = fetch(getObject(arg0));
|
|
8749
9354
|
return addHeapObject(ret);
|
|
8750
9355
|
};
|
|
@@ -8809,7 +9414,7 @@ function __wbg_get_imports() {
|
|
|
8809
9414
|
const ret = getObject(arg0).length;
|
|
8810
9415
|
return ret;
|
|
8811
9416
|
};
|
|
8812
|
-
imports.wbg.
|
|
9417
|
+
imports.wbg.__wbg_log_b1cdcca99372fe6e = function(arg0, arg1) {
|
|
8813
9418
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
8814
9419
|
};
|
|
8815
9420
|
imports.wbg.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
|
|
@@ -8827,7 +9432,7 @@ function __wbg_get_imports() {
|
|
|
8827
9432
|
const a = state0.a;
|
|
8828
9433
|
state0.a = 0;
|
|
8829
9434
|
try {
|
|
8830
|
-
return
|
|
9435
|
+
return __wbg_adapter_605(a, state0.b, arg0, arg1);
|
|
8831
9436
|
} finally {
|
|
8832
9437
|
state0.a = a;
|
|
8833
9438
|
}
|
|
@@ -8923,6 +9528,10 @@ function __wbg_get_imports() {
|
|
|
8923
9528
|
const ret = getObject(arg0).process;
|
|
8924
9529
|
return addHeapObject(ret);
|
|
8925
9530
|
};
|
|
9531
|
+
imports.wbg.__wbg_provingrequest_new = function(arg0) {
|
|
9532
|
+
const ret = ProvingRequest.__wrap(arg0);
|
|
9533
|
+
return addHeapObject(ret);
|
|
9534
|
+
};
|
|
8926
9535
|
imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
|
|
8927
9536
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
8928
9537
|
return ret;
|
|
@@ -8967,6 +9576,10 @@ function __wbg_get_imports() {
|
|
|
8967
9576
|
imports.wbg.__wbg_send_40a47636ff90f64d = function() { return handleError(function (arg0) {
|
|
8968
9577
|
getObject(arg0).send();
|
|
8969
9578
|
}, arguments) };
|
|
9579
|
+
imports.wbg.__wbg_setTimeout_2e707715f8cc9497 = function(arg0, arg1) {
|
|
9580
|
+
const ret = setTimeout(getObject(arg0), arg1);
|
|
9581
|
+
return addHeapObject(ret);
|
|
9582
|
+
};
|
|
8970
9583
|
imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
|
|
8971
9584
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
8972
9585
|
};
|
|
@@ -9006,7 +9619,7 @@ function __wbg_get_imports() {
|
|
|
9006
9619
|
const ret = Signature.__wrap(arg0);
|
|
9007
9620
|
return addHeapObject(ret);
|
|
9008
9621
|
};
|
|
9009
|
-
imports.wbg.
|
|
9622
|
+
imports.wbg.__wbg_spawnWorker_41e51220404b3348 = function(arg0, arg1, arg2, arg3) {
|
|
9010
9623
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
9011
9624
|
return addHeapObject(ret);
|
|
9012
9625
|
};
|
|
@@ -9126,12 +9739,16 @@ function __wbg_get_imports() {
|
|
|
9126
9739
|
const ret = false;
|
|
9127
9740
|
return ret;
|
|
9128
9741
|
};
|
|
9129
|
-
imports.wbg.
|
|
9130
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
9742
|
+
imports.wbg.__wbindgen_closure_wrapper6199 = function(arg0, arg1, arg2) {
|
|
9743
|
+
const ret = makeMutClosure(arg0, arg1, 470, __wbg_adapter_40);
|
|
9744
|
+
return addHeapObject(ret);
|
|
9745
|
+
};
|
|
9746
|
+
imports.wbg.__wbindgen_closure_wrapper6790 = function(arg0, arg1, arg2) {
|
|
9747
|
+
const ret = makeMutClosure(arg0, arg1, 470, __wbg_adapter_43);
|
|
9131
9748
|
return addHeapObject(ret);
|
|
9132
9749
|
};
|
|
9133
|
-
imports.wbg.
|
|
9134
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
9750
|
+
imports.wbg.__wbindgen_closure_wrapper6794 = function(arg0, arg1, arg2) {
|
|
9751
|
+
const ret = makeMutClosure(arg0, arg1, 470, __wbg_adapter_43);
|
|
9135
9752
|
return addHeapObject(ret);
|
|
9136
9753
|
};
|
|
9137
9754
|
imports.wbg.__wbindgen_is_function = function(arg0) {
|
|
@@ -9286,5 +9903,5 @@ async function initThreadPool(threads) {
|
|
|
9286
9903
|
await initThreadPool$1(new URL("worker.js", import.meta.url), threads);
|
|
9287
9904
|
}
|
|
9288
9905
|
|
|
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 };
|
|
9906
|
+
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
9907
|
//# sourceMappingURL=index.js.map
|