@provablehq/wasm 0.9.2 → 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 +509 -12
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.js +1543 -159
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +1547 -158
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +509 -12
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.js +1543 -159
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +1547 -158
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/mainnet/worker.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(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"];
|
|
@@ -544,6 +549,256 @@ class Address {
|
|
|
544
549
|
}
|
|
545
550
|
}
|
|
546
551
|
|
|
552
|
+
const AuthorizationFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
553
|
+
? { register: () => {}, unregister: () => {} }
|
|
554
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_authorization_free(ptr >>> 0, 1));
|
|
555
|
+
/**
|
|
556
|
+
* Authorization object containing the authorization for a transaction.
|
|
557
|
+
*/
|
|
558
|
+
class Authorization {
|
|
559
|
+
|
|
560
|
+
static __wrap(ptr) {
|
|
561
|
+
ptr = ptr >>> 0;
|
|
562
|
+
const obj = Object.create(Authorization.prototype);
|
|
563
|
+
obj.__wbg_ptr = ptr;
|
|
564
|
+
AuthorizationFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
565
|
+
return obj;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
__destroy_into_raw() {
|
|
569
|
+
const ptr = this.__wbg_ptr;
|
|
570
|
+
this.__wbg_ptr = 0;
|
|
571
|
+
AuthorizationFinalization.unregister(this);
|
|
572
|
+
return ptr;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
free() {
|
|
576
|
+
const ptr = this.__destroy_into_raw();
|
|
577
|
+
wasm.__wbg_authorization_free(ptr, 0);
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Create a new authorization from a request object.
|
|
581
|
+
*
|
|
582
|
+
* @param {ExecutionRequest} request The ExecutionRequest to build the authorization from.
|
|
583
|
+
* @param {ExecutionRequest} request
|
|
584
|
+
* @returns {Authorization}
|
|
585
|
+
*/
|
|
586
|
+
static new(request) {
|
|
587
|
+
try {
|
|
588
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
589
|
+
_assertClass(request, ExecutionRequest);
|
|
590
|
+
var ptr0 = request.__destroy_into_raw();
|
|
591
|
+
wasm.authorization_new(retptr, ptr0);
|
|
592
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
593
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
594
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
595
|
+
if (r2) {
|
|
596
|
+
throw takeObject(r1);
|
|
597
|
+
}
|
|
598
|
+
return Authorization.__wrap(r0);
|
|
599
|
+
} finally {
|
|
600
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Returns a new and independent replica of the Authorization.
|
|
605
|
+
* @returns {Authorization}
|
|
606
|
+
*/
|
|
607
|
+
replicate() {
|
|
608
|
+
const ret = wasm.authorization_replicate(this.__wbg_ptr);
|
|
609
|
+
return Authorization.__wrap(ret);
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Returns the string representation of the Authorization.
|
|
613
|
+
* @returns {string}
|
|
614
|
+
*/
|
|
615
|
+
toString() {
|
|
616
|
+
let deferred1_0;
|
|
617
|
+
let deferred1_1;
|
|
618
|
+
try {
|
|
619
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
620
|
+
wasm.authorization_toString(retptr, this.__wbg_ptr);
|
|
621
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
622
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
623
|
+
deferred1_0 = r0;
|
|
624
|
+
deferred1_1 = r1;
|
|
625
|
+
return getStringFromWasm0(r0, r1);
|
|
626
|
+
} finally {
|
|
627
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
628
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Reconstructs an Authorization object from its string representation.
|
|
633
|
+
*
|
|
634
|
+
* @param {String} authorization The string representation of the Authorization.
|
|
635
|
+
* @param {string} authorization
|
|
636
|
+
* @returns {Authorization}
|
|
637
|
+
*/
|
|
638
|
+
static fromString(authorization) {
|
|
639
|
+
try {
|
|
640
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
641
|
+
const ptr0 = passStringToWasm0(authorization, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
642
|
+
const len0 = WASM_VECTOR_LEN;
|
|
643
|
+
wasm.authorization_fromString(retptr, ptr0, len0);
|
|
644
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
645
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
646
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
647
|
+
if (r2) {
|
|
648
|
+
throw takeObject(r1);
|
|
649
|
+
}
|
|
650
|
+
return Authorization.__wrap(r0);
|
|
651
|
+
} finally {
|
|
652
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Returns the left-endian byte representation of the Authorization.
|
|
657
|
+
* @returns {Uint8Array}
|
|
658
|
+
*/
|
|
659
|
+
toBytesLe() {
|
|
660
|
+
try {
|
|
661
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
662
|
+
wasm.authorization_toBytesLe(retptr, this.__wbg_ptr);
|
|
663
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
664
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
665
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
666
|
+
if (r2) {
|
|
667
|
+
throw takeObject(r1);
|
|
668
|
+
}
|
|
669
|
+
return takeObject(r0);
|
|
670
|
+
} finally {
|
|
671
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Creates an authorization object from a left-endian byte representation of an Authorization.
|
|
676
|
+
*
|
|
677
|
+
* @param {Uint8Array} bytes Left-endian bytes representing the Authorization.
|
|
678
|
+
* @param {Uint8Array} bytes
|
|
679
|
+
* @returns {Authorization}
|
|
680
|
+
*/
|
|
681
|
+
static fromBytesLe(bytes) {
|
|
682
|
+
try {
|
|
683
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
684
|
+
wasm.authorization_fromBytesLe(retptr, addHeapObject(bytes));
|
|
685
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
686
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
687
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
688
|
+
if (r2) {
|
|
689
|
+
throw takeObject(r1);
|
|
690
|
+
}
|
|
691
|
+
return Authorization.__wrap(r0);
|
|
692
|
+
} finally {
|
|
693
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Check if an Authorization object is the same as another.
|
|
698
|
+
*
|
|
699
|
+
* @param {Authorization} other The Authorization object to determine equality with.
|
|
700
|
+
* @param {Authorization} other
|
|
701
|
+
* @returns {boolean}
|
|
702
|
+
*/
|
|
703
|
+
equals(other) {
|
|
704
|
+
_assertClass(other, Authorization);
|
|
705
|
+
const ret = wasm.authorization_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
706
|
+
return ret !== 0;
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Returns the number of `Request`s in the Authorization.
|
|
710
|
+
* @returns {number}
|
|
711
|
+
*/
|
|
712
|
+
len() {
|
|
713
|
+
const ret = wasm.authorization_len(this.__wbg_ptr);
|
|
714
|
+
return ret >>> 0;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Return `true` if the Authorization is empty.
|
|
718
|
+
* @returns {boolean}
|
|
719
|
+
*/
|
|
720
|
+
isEmpty() {
|
|
721
|
+
const ret = wasm.authorization_isEmpty(this.__wbg_ptr);
|
|
722
|
+
return ret !== 0;
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Returns `true` if the Authorization is for `credits.aleo/fee_private`.
|
|
726
|
+
* @returns {boolean}
|
|
727
|
+
*/
|
|
728
|
+
isFeePrivate() {
|
|
729
|
+
const ret = wasm.authorization_isFeePrivate(this.__wbg_ptr);
|
|
730
|
+
return ret !== 0;
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Returns `true` if the Authorization is for `credits.aleo/fee_public`.
|
|
734
|
+
* @returns {boolean}
|
|
735
|
+
*/
|
|
736
|
+
isFeePublic() {
|
|
737
|
+
const ret = wasm.authorization_isFeePublic(this.__wbg_ptr);
|
|
738
|
+
return ret !== 0;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Returns `true` if the Authorization is for `credits.aleo/split`.
|
|
742
|
+
* @returns {boolean}
|
|
743
|
+
*/
|
|
744
|
+
isSplit() {
|
|
745
|
+
const ret = wasm.authorization_isSplit(this.__wbg_ptr);
|
|
746
|
+
return ret !== 0;
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Insert a transition into the Authorization.
|
|
750
|
+
*
|
|
751
|
+
* @param {Transition} transition The transition object to insert into the Authorization.
|
|
752
|
+
* @param {Transition} transition
|
|
753
|
+
*/
|
|
754
|
+
insertTransition(transition) {
|
|
755
|
+
try {
|
|
756
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
757
|
+
_assertClass(transition, Transition);
|
|
758
|
+
var ptr0 = transition.__destroy_into_raw();
|
|
759
|
+
wasm.authorization_insertTransition(retptr, this.__wbg_ptr, ptr0);
|
|
760
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
761
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
762
|
+
if (r1) {
|
|
763
|
+
throw takeObject(r0);
|
|
764
|
+
}
|
|
765
|
+
} finally {
|
|
766
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Get the transitions in an Authorization.
|
|
771
|
+
*
|
|
772
|
+
* @returns {Array<Transition>} Array of transition objects
|
|
773
|
+
* @returns {Array<any>}
|
|
774
|
+
*/
|
|
775
|
+
transitions() {
|
|
776
|
+
const ret = wasm.authorization_transitions(this.__wbg_ptr);
|
|
777
|
+
return takeObject(ret);
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Returns the execution ID for the Authorization.
|
|
781
|
+
*
|
|
782
|
+
* @returns {Field} The execution ID for the Authorization, call toString() after this result to get the string representation.
|
|
783
|
+
* @returns {Field}
|
|
784
|
+
*/
|
|
785
|
+
toExecutionId() {
|
|
786
|
+
try {
|
|
787
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
788
|
+
wasm.authorization_toExecutionId(retptr, this.__wbg_ptr);
|
|
789
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
790
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
791
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
792
|
+
if (r2) {
|
|
793
|
+
throw takeObject(r1);
|
|
794
|
+
}
|
|
795
|
+
return Field.__wrap(r0);
|
|
796
|
+
} finally {
|
|
797
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
|
|
547
802
|
const BHP1024Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
548
803
|
? { register: () => {}, unregister: () => {} }
|
|
549
804
|
: new FinalizationRegistry(ptr => wasm.__wbg_bhp1024_free(ptr >>> 0, 1));
|
|
@@ -1120,105 +1375,360 @@ class BHP768 {
|
|
|
1120
1375
|
}
|
|
1121
1376
|
}
|
|
1122
1377
|
|
|
1123
|
-
const
|
|
1378
|
+
const BooleanFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1124
1379
|
? { register: () => {}, unregister: () => {} }
|
|
1125
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
1380
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_boolean_free(ptr >>> 0, 1));
|
|
1126
1381
|
/**
|
|
1127
|
-
*
|
|
1128
|
-
* object provides decryption methods to recover the plaintext from the ciphertext (given the
|
|
1129
|
-
* api consumer has the proper decryption materials).
|
|
1130
|
-
*
|
|
1131
|
-
* @example
|
|
1382
|
+
* Boolean element.
|
|
1132
1383
|
*/
|
|
1133
|
-
class
|
|
1384
|
+
class Boolean {
|
|
1134
1385
|
|
|
1135
1386
|
static __wrap(ptr) {
|
|
1136
1387
|
ptr = ptr >>> 0;
|
|
1137
|
-
const obj = Object.create(
|
|
1388
|
+
const obj = Object.create(Boolean.prototype);
|
|
1138
1389
|
obj.__wbg_ptr = ptr;
|
|
1139
|
-
|
|
1390
|
+
BooleanFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1140
1391
|
return obj;
|
|
1141
1392
|
}
|
|
1142
1393
|
|
|
1143
1394
|
__destroy_into_raw() {
|
|
1144
1395
|
const ptr = this.__wbg_ptr;
|
|
1145
1396
|
this.__wbg_ptr = 0;
|
|
1146
|
-
|
|
1397
|
+
BooleanFinalization.unregister(this);
|
|
1147
1398
|
return ptr;
|
|
1148
1399
|
}
|
|
1149
1400
|
|
|
1150
1401
|
free() {
|
|
1151
1402
|
const ptr = this.__destroy_into_raw();
|
|
1152
|
-
wasm.
|
|
1403
|
+
wasm.__wbg_boolean_free(ptr, 0);
|
|
1153
1404
|
}
|
|
1154
1405
|
/**
|
|
1155
|
-
*
|
|
1156
|
-
*
|
|
1157
|
-
* @param {ViewKey} viewKey The view key of the account that encrypted the ciphertext.
|
|
1158
|
-
* @param {Group} nonce The nonce used to encrypt the ciphertext.
|
|
1159
|
-
*
|
|
1160
|
-
* @returns {Plaintext} The decrypted plaintext.
|
|
1161
|
-
* @param {ViewKey} view_key
|
|
1162
|
-
* @param {Group} nonce
|
|
1163
|
-
* @returns {Plaintext}
|
|
1406
|
+
* Creates a Boolean from a native JS bool.
|
|
1407
|
+
* @param {boolean} value
|
|
1164
1408
|
*/
|
|
1165
|
-
|
|
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) {
|
|
1166
1421
|
try {
|
|
1167
1422
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
var ptr1 = nonce.__destroy_into_raw();
|
|
1172
|
-
wasm.ciphertext_decrypt(retptr, this.__wbg_ptr, ptr0, ptr1);
|
|
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);
|
|
1173
1426
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1174
1427
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1175
1428
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1176
1429
|
if (r2) {
|
|
1177
1430
|
throw takeObject(r1);
|
|
1178
1431
|
}
|
|
1179
|
-
return
|
|
1432
|
+
return Boolean.__wrap(r0);
|
|
1180
1433
|
} finally {
|
|
1181
1434
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1182
1435
|
}
|
|
1183
1436
|
}
|
|
1184
1437
|
/**
|
|
1185
|
-
*
|
|
1186
|
-
*
|
|
1187
|
-
* @param {ViewKey} view_key
|
|
1188
|
-
* @param {Group} transition_public_key
|
|
1189
|
-
* @param {string} program
|
|
1190
|
-
* @param {string} function_name
|
|
1191
|
-
* @param {number} index
|
|
1192
|
-
* @returns {Plaintext}
|
|
1438
|
+
* Returns the string representation of the boolean element.
|
|
1439
|
+
* @returns {string}
|
|
1193
1440
|
*/
|
|
1194
|
-
|
|
1441
|
+
toString() {
|
|
1442
|
+
let deferred1_0;
|
|
1443
|
+
let deferred1_1;
|
|
1195
1444
|
try {
|
|
1196
1445
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1197
|
-
|
|
1198
|
-
var
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
wasm.
|
|
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));
|
|
1206
1466
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1207
1467
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1208
1468
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1209
1469
|
if (r2) {
|
|
1210
1470
|
throw takeObject(r1);
|
|
1211
1471
|
}
|
|
1212
|
-
return
|
|
1472
|
+
return Boolean.__wrap(r0);
|
|
1213
1473
|
} finally {
|
|
1214
1474
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1475
|
+
heap[stack_pointer++] = undefined;
|
|
1215
1476
|
}
|
|
1216
1477
|
}
|
|
1217
1478
|
/**
|
|
1218
|
-
*
|
|
1219
|
-
* @
|
|
1220
|
-
|
|
1221
|
-
|
|
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
|
+
|
|
1620
|
+
const CiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1621
|
+
? { register: () => {}, unregister: () => {} }
|
|
1622
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_ciphertext_free(ptr >>> 0, 1));
|
|
1623
|
+
/**
|
|
1624
|
+
* SnarkVM Ciphertext object. A Ciphertext represents an symmetrically encrypted plaintext. This
|
|
1625
|
+
* object provides decryption methods to recover the plaintext from the ciphertext (given the
|
|
1626
|
+
* api consumer has the proper decryption materials).
|
|
1627
|
+
*/
|
|
1628
|
+
class Ciphertext {
|
|
1629
|
+
|
|
1630
|
+
static __wrap(ptr) {
|
|
1631
|
+
ptr = ptr >>> 0;
|
|
1632
|
+
const obj = Object.create(Ciphertext.prototype);
|
|
1633
|
+
obj.__wbg_ptr = ptr;
|
|
1634
|
+
CiphertextFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1635
|
+
return obj;
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
__destroy_into_raw() {
|
|
1639
|
+
const ptr = this.__wbg_ptr;
|
|
1640
|
+
this.__wbg_ptr = 0;
|
|
1641
|
+
CiphertextFinalization.unregister(this);
|
|
1642
|
+
return ptr;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
free() {
|
|
1646
|
+
const ptr = this.__destroy_into_raw();
|
|
1647
|
+
wasm.__wbg_ciphertext_free(ptr, 0);
|
|
1648
|
+
}
|
|
1649
|
+
/**
|
|
1650
|
+
* Decrypt the ciphertext using the given view key.
|
|
1651
|
+
*
|
|
1652
|
+
* @param {ViewKey} viewKey The view key of the account that encrypted the ciphertext.
|
|
1653
|
+
* @param {Group} nonce The nonce used to encrypt the ciphertext.
|
|
1654
|
+
*
|
|
1655
|
+
* @returns {Plaintext} The decrypted plaintext.
|
|
1656
|
+
* @param {ViewKey} view_key
|
|
1657
|
+
* @param {Group} nonce
|
|
1658
|
+
* @returns {Plaintext}
|
|
1659
|
+
*/
|
|
1660
|
+
decrypt(view_key, nonce) {
|
|
1661
|
+
try {
|
|
1662
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1663
|
+
_assertClass(view_key, ViewKey);
|
|
1664
|
+
var ptr0 = view_key.__destroy_into_raw();
|
|
1665
|
+
_assertClass(nonce, Group);
|
|
1666
|
+
var ptr1 = nonce.__destroy_into_raw();
|
|
1667
|
+
wasm.ciphertext_decrypt(retptr, this.__wbg_ptr, ptr0, ptr1);
|
|
1668
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1669
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1670
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1671
|
+
if (r2) {
|
|
1672
|
+
throw takeObject(r1);
|
|
1673
|
+
}
|
|
1674
|
+
return Plaintext.__wrap(r0);
|
|
1675
|
+
} finally {
|
|
1676
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
/**
|
|
1680
|
+
* Decrypt a ciphertext using the view key of the transition signer, transition public key, and
|
|
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.
|
|
1690
|
+
* @param {ViewKey} view_key
|
|
1691
|
+
* @param {Group} transition_public_key
|
|
1692
|
+
* @param {string} program
|
|
1693
|
+
* @param {string} function_name
|
|
1694
|
+
* @param {number} index
|
|
1695
|
+
* @returns {Plaintext}
|
|
1696
|
+
*/
|
|
1697
|
+
decryptWithTransitionInfo(view_key, transition_public_key, program, function_name, index) {
|
|
1698
|
+
try {
|
|
1699
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1700
|
+
_assertClass(view_key, ViewKey);
|
|
1701
|
+
var ptr0 = view_key.__destroy_into_raw();
|
|
1702
|
+
_assertClass(transition_public_key, Group);
|
|
1703
|
+
var ptr1 = transition_public_key.__destroy_into_raw();
|
|
1704
|
+
const ptr2 = passStringToWasm0(program, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
1705
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1706
|
+
const ptr3 = passStringToWasm0(function_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
1707
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1708
|
+
wasm.ciphertext_decryptWithTransitionInfo(retptr, this.__wbg_ptr, ptr0, ptr1, ptr2, len2, ptr3, len3, index);
|
|
1709
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1710
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1711
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1712
|
+
if (r2) {
|
|
1713
|
+
throw takeObject(r1);
|
|
1714
|
+
}
|
|
1715
|
+
return Plaintext.__wrap(r0);
|
|
1716
|
+
} finally {
|
|
1717
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
/**
|
|
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.
|
|
1729
|
+
* @param {Field} transition_view_key
|
|
1730
|
+
* @param {string} program
|
|
1731
|
+
* @param {string} function_name
|
|
1222
1732
|
* @param {number} index
|
|
1223
1733
|
* @returns {Plaintext}
|
|
1224
1734
|
*/
|
|
@@ -1518,58 +2028,307 @@ class ComputeKey {
|
|
|
1518
2028
|
return Scalar.__wrap(ret);
|
|
1519
2029
|
}
|
|
1520
2030
|
/**
|
|
1521
|
-
* Get the pr_tag of the compute key.
|
|
2031
|
+
* Get the pr_tag of the compute key.
|
|
2032
|
+
*
|
|
2033
|
+
* @returns {Group} pr_tag
|
|
2034
|
+
* @returns {Group}
|
|
2035
|
+
*/
|
|
2036
|
+
pk_sig() {
|
|
2037
|
+
const ret = wasm.address_toGroup(this.__wbg_ptr);
|
|
2038
|
+
return Group.__wrap(ret);
|
|
2039
|
+
}
|
|
2040
|
+
/**
|
|
2041
|
+
* Get the pr_sig of the compute key.
|
|
2042
|
+
*
|
|
2043
|
+
* @returns {Group} pr_sig
|
|
2044
|
+
* @returns {Group}
|
|
2045
|
+
*/
|
|
2046
|
+
pr_sig() {
|
|
2047
|
+
const ret = wasm.computekey_pr_sig(this.__wbg_ptr);
|
|
2048
|
+
return Group.__wrap(ret);
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
const EncryptionToolkitFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2053
|
+
? { register: () => {}, unregister: () => {} }
|
|
2054
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_encryptiontoolkit_free(ptr >>> 0, 1));
|
|
2055
|
+
|
|
2056
|
+
class EncryptionToolkit {
|
|
2057
|
+
|
|
2058
|
+
__destroy_into_raw() {
|
|
2059
|
+
const ptr = this.__wbg_ptr;
|
|
2060
|
+
this.__wbg_ptr = 0;
|
|
2061
|
+
EncryptionToolkitFinalization.unregister(this);
|
|
2062
|
+
return ptr;
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
free() {
|
|
2066
|
+
const ptr = this.__destroy_into_raw();
|
|
2067
|
+
wasm.__wbg_encryptiontoolkit_free(ptr, 0);
|
|
2068
|
+
}
|
|
2069
|
+
/**
|
|
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.
|
|
2076
|
+
* @param {ViewKey} view_key
|
|
2077
|
+
* @param {Group} tpk
|
|
2078
|
+
* @returns {Field}
|
|
2079
|
+
*/
|
|
2080
|
+
static generateTvk(view_key, tpk) {
|
|
2081
|
+
_assertClass(view_key, ViewKey);
|
|
2082
|
+
_assertClass(tpk, Group);
|
|
2083
|
+
const ret = wasm.encryptiontoolkit_generateTvk(view_key.__wbg_ptr, tpk.__wbg_ptr);
|
|
2084
|
+
return Field.__wrap(ret);
|
|
2085
|
+
}
|
|
2086
|
+
/**
|
|
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.
|
|
2093
|
+
* @param {ViewKey} view_key
|
|
2094
|
+
* @param {RecordCiphertext} record_ciphertext
|
|
2095
|
+
* @returns {Field}
|
|
2096
|
+
*/
|
|
2097
|
+
static generateRecordViewKey(view_key, record_ciphertext) {
|
|
2098
|
+
try {
|
|
2099
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2100
|
+
_assertClass(view_key, ViewKey);
|
|
2101
|
+
_assertClass(record_ciphertext, RecordCiphertext);
|
|
2102
|
+
wasm.encryptiontoolkit_generateRecordViewKey(retptr, view_key.__wbg_ptr, record_ciphertext.__wbg_ptr);
|
|
2103
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2104
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2105
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2106
|
+
if (r2) {
|
|
2107
|
+
throw takeObject(r1);
|
|
2108
|
+
}
|
|
2109
|
+
return Field.__wrap(r0);
|
|
2110
|
+
} finally {
|
|
2111
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
/**
|
|
2115
|
+
* Decrypts a record ciphertext using the record view key. Decryption only succeeds
|
|
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.
|
|
2122
|
+
* @param {Field} record_vk
|
|
2123
|
+
* @param {RecordCiphertext} record_ciphertext
|
|
2124
|
+
* @returns {RecordPlaintext}
|
|
2125
|
+
*/
|
|
2126
|
+
static decryptRecordWithRVk(record_vk, record_ciphertext) {
|
|
2127
|
+
try {
|
|
2128
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2129
|
+
_assertClass(record_vk, Field);
|
|
2130
|
+
_assertClass(record_ciphertext, RecordCiphertext);
|
|
2131
|
+
wasm.encryptiontoolkit_decryptRecordWithRVk(retptr, record_vk.__wbg_ptr, record_ciphertext.__wbg_ptr);
|
|
2132
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2133
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2134
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2135
|
+
if (r2) {
|
|
2136
|
+
throw takeObject(r1);
|
|
2137
|
+
}
|
|
2138
|
+
return RecordPlaintext.__wrap(r0);
|
|
2139
|
+
} finally {
|
|
2140
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
/**
|
|
2144
|
+
* Decrypts a transition using the transition view key. The ciphertext inputs and outputs
|
|
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.
|
|
2151
|
+
* @param {Transition} transition
|
|
2152
|
+
* @param {Field} transition_vk
|
|
2153
|
+
* @returns {Transition}
|
|
2154
|
+
*/
|
|
2155
|
+
static decryptTransitionWithVk(transition, transition_vk) {
|
|
2156
|
+
try {
|
|
2157
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2158
|
+
_assertClass(transition, Transition);
|
|
2159
|
+
_assertClass(transition_vk, Field);
|
|
2160
|
+
wasm.encryptiontoolkit_decryptTransitionWithVk(retptr, transition.__wbg_ptr, transition_vk.__wbg_ptr);
|
|
2161
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2162
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2163
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2164
|
+
if (r2) {
|
|
2165
|
+
throw takeObject(r1);
|
|
2166
|
+
}
|
|
2167
|
+
return Transition.__wrap(r0);
|
|
2168
|
+
} finally {
|
|
2169
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
const ExecutionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2175
|
+
? { register: () => {}, unregister: () => {} }
|
|
2176
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_execution_free(ptr >>> 0, 1));
|
|
2177
|
+
/**
|
|
2178
|
+
* Execution of an Aleo program.
|
|
2179
|
+
*/
|
|
2180
|
+
class Execution {
|
|
2181
|
+
|
|
2182
|
+
static __wrap(ptr) {
|
|
2183
|
+
ptr = ptr >>> 0;
|
|
2184
|
+
const obj = Object.create(Execution.prototype);
|
|
2185
|
+
obj.__wbg_ptr = ptr;
|
|
2186
|
+
ExecutionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2187
|
+
return obj;
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
__destroy_into_raw() {
|
|
2191
|
+
const ptr = this.__wbg_ptr;
|
|
2192
|
+
this.__wbg_ptr = 0;
|
|
2193
|
+
ExecutionFinalization.unregister(this);
|
|
2194
|
+
return ptr;
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
free() {
|
|
2198
|
+
const ptr = this.__destroy_into_raw();
|
|
2199
|
+
wasm.__wbg_execution_free(ptr, 0);
|
|
2200
|
+
}
|
|
2201
|
+
/**
|
|
2202
|
+
* Returns the string representation of the execution.
|
|
2203
|
+
*
|
|
2204
|
+
* @returns {string} The string representation of the execution.
|
|
2205
|
+
* @returns {string}
|
|
2206
|
+
*/
|
|
2207
|
+
toString() {
|
|
2208
|
+
let deferred1_0;
|
|
2209
|
+
let deferred1_1;
|
|
2210
|
+
try {
|
|
2211
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2212
|
+
wasm.execution_toString(retptr, this.__wbg_ptr);
|
|
2213
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2214
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2215
|
+
deferred1_0 = r0;
|
|
2216
|
+
deferred1_1 = r1;
|
|
2217
|
+
return getStringFromWasm0(r0, r1);
|
|
2218
|
+
} finally {
|
|
2219
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2220
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
/**
|
|
2224
|
+
* Creates an execution object from a string representation of an execution.
|
|
2225
|
+
*
|
|
2226
|
+
* @returns {Execution | Error} The wasm representation of an execution object.
|
|
2227
|
+
* @param {string} execution
|
|
2228
|
+
* @returns {Execution}
|
|
2229
|
+
*/
|
|
2230
|
+
static fromString(execution) {
|
|
2231
|
+
try {
|
|
2232
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2233
|
+
const ptr0 = passStringToWasm0(execution, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
2234
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2235
|
+
wasm.execution_fromString(retptr, ptr0, len0);
|
|
2236
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2237
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2238
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2239
|
+
if (r2) {
|
|
2240
|
+
throw takeObject(r1);
|
|
2241
|
+
}
|
|
2242
|
+
return Execution.__wrap(r0);
|
|
2243
|
+
} finally {
|
|
2244
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
/**
|
|
2248
|
+
* Returns the global state root of the execution.
|
|
2249
|
+
*
|
|
2250
|
+
* @returns {Execution | Error} The global state root used in the execution.
|
|
2251
|
+
* @returns {string}
|
|
2252
|
+
*/
|
|
2253
|
+
globalStateRoot() {
|
|
2254
|
+
let deferred1_0;
|
|
2255
|
+
let deferred1_1;
|
|
2256
|
+
try {
|
|
2257
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2258
|
+
wasm.execution_globalStateRoot(retptr, this.__wbg_ptr);
|
|
2259
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2260
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2261
|
+
deferred1_0 = r0;
|
|
2262
|
+
deferred1_1 = r1;
|
|
2263
|
+
return getStringFromWasm0(r0, r1);
|
|
2264
|
+
} finally {
|
|
2265
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2266
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
/**
|
|
2270
|
+
* Returns the proof of the execution.
|
|
1522
2271
|
*
|
|
1523
|
-
* @returns {
|
|
1524
|
-
* @returns {
|
|
2272
|
+
* @returns {string} The execution proof.
|
|
2273
|
+
* @returns {string}
|
|
1525
2274
|
*/
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
2275
|
+
proof() {
|
|
2276
|
+
let deferred1_0;
|
|
2277
|
+
let deferred1_1;
|
|
2278
|
+
try {
|
|
2279
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2280
|
+
wasm.execution_proof(retptr, this.__wbg_ptr);
|
|
2281
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2282
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2283
|
+
deferred1_0 = r0;
|
|
2284
|
+
deferred1_1 = r1;
|
|
2285
|
+
return getStringFromWasm0(r0, r1);
|
|
2286
|
+
} finally {
|
|
2287
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2288
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
2289
|
+
}
|
|
1529
2290
|
}
|
|
1530
2291
|
/**
|
|
1531
|
-
*
|
|
2292
|
+
* Returns the transitions present in the execution.
|
|
1532
2293
|
*
|
|
1533
|
-
* @returns
|
|
1534
|
-
* @returns {
|
|
2294
|
+
* @returns Array<Transition> the array of transitions present in the execution.
|
|
2295
|
+
* @returns {Array<any>}
|
|
1535
2296
|
*/
|
|
1536
|
-
|
|
1537
|
-
const ret = wasm.
|
|
1538
|
-
return
|
|
2297
|
+
transitions() {
|
|
2298
|
+
const ret = wasm.execution_transitions(this.__wbg_ptr);
|
|
2299
|
+
return takeObject(ret);
|
|
1539
2300
|
}
|
|
1540
2301
|
}
|
|
1541
2302
|
|
|
1542
|
-
const
|
|
2303
|
+
const ExecutionRequestFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1543
2304
|
? { register: () => {}, unregister: () => {} }
|
|
1544
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
*/
|
|
1548
|
-
class Execution {
|
|
2305
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_executionrequest_free(ptr >>> 0, 1));
|
|
2306
|
+
|
|
2307
|
+
class ExecutionRequest {
|
|
1549
2308
|
|
|
1550
2309
|
static __wrap(ptr) {
|
|
1551
2310
|
ptr = ptr >>> 0;
|
|
1552
|
-
const obj = Object.create(
|
|
2311
|
+
const obj = Object.create(ExecutionRequest.prototype);
|
|
1553
2312
|
obj.__wbg_ptr = ptr;
|
|
1554
|
-
|
|
2313
|
+
ExecutionRequestFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1555
2314
|
return obj;
|
|
1556
2315
|
}
|
|
1557
2316
|
|
|
1558
2317
|
__destroy_into_raw() {
|
|
1559
2318
|
const ptr = this.__wbg_ptr;
|
|
1560
2319
|
this.__wbg_ptr = 0;
|
|
1561
|
-
|
|
2320
|
+
ExecutionRequestFinalization.unregister(this);
|
|
1562
2321
|
return ptr;
|
|
1563
2322
|
}
|
|
1564
2323
|
|
|
1565
2324
|
free() {
|
|
1566
2325
|
const ptr = this.__destroy_into_raw();
|
|
1567
|
-
wasm.
|
|
2326
|
+
wasm.__wbg_executionrequest_free(ptr, 0);
|
|
1568
2327
|
}
|
|
1569
2328
|
/**
|
|
1570
|
-
* Returns the
|
|
2329
|
+
* Returns the request as a string.
|
|
1571
2330
|
*
|
|
1572
|
-
* @returns {string}
|
|
2331
|
+
* @returns {string} String representation of the request.
|
|
1573
2332
|
* @returns {string}
|
|
1574
2333
|
*/
|
|
1575
2334
|
toString() {
|
|
@@ -1577,7 +2336,7 @@ class Execution {
|
|
|
1577
2336
|
let deferred1_1;
|
|
1578
2337
|
try {
|
|
1579
2338
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1580
|
-
wasm.
|
|
2339
|
+
wasm.executionrequest_toString(retptr, this.__wbg_ptr);
|
|
1581
2340
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1582
2341
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1583
2342
|
deferred1_0 = r0;
|
|
@@ -1589,41 +2348,94 @@ class Execution {
|
|
|
1589
2348
|
}
|
|
1590
2349
|
}
|
|
1591
2350
|
/**
|
|
1592
|
-
*
|
|
2351
|
+
* Builds a request object from a string representation of a request.
|
|
1593
2352
|
*
|
|
1594
|
-
* @
|
|
1595
|
-
* @param {string}
|
|
1596
|
-
* @returns {
|
|
2353
|
+
* @param {string} request String representation of the request.
|
|
2354
|
+
* @param {string} request
|
|
2355
|
+
* @returns {ExecutionRequest}
|
|
1597
2356
|
*/
|
|
1598
|
-
static fromString(
|
|
2357
|
+
static fromString(request) {
|
|
1599
2358
|
try {
|
|
1600
2359
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1601
|
-
const ptr0 = passStringToWasm0(
|
|
2360
|
+
const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
1602
2361
|
const len0 = WASM_VECTOR_LEN;
|
|
1603
|
-
wasm.
|
|
2362
|
+
wasm.executionrequest_fromString(retptr, ptr0, len0);
|
|
1604
2363
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1605
2364
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1606
2365
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1607
2366
|
if (r2) {
|
|
1608
2367
|
throw takeObject(r1);
|
|
1609
2368
|
}
|
|
1610
|
-
return
|
|
2369
|
+
return ExecutionRequest.__wrap(r0);
|
|
1611
2370
|
} finally {
|
|
1612
2371
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1613
2372
|
}
|
|
1614
2373
|
}
|
|
1615
2374
|
/**
|
|
1616
|
-
* Returns the
|
|
1617
|
-
*
|
|
1618
|
-
|
|
2375
|
+
* Returns the bytes representation of the request.
|
|
2376
|
+
* @returns {Uint8Array}
|
|
2377
|
+
*/
|
|
2378
|
+
toBytesLe() {
|
|
2379
|
+
try {
|
|
2380
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2381
|
+
wasm.executionrequest_toBytesLe(retptr, this.__wbg_ptr);
|
|
2382
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2383
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2384
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2385
|
+
if (r2) {
|
|
2386
|
+
throw takeObject(r1);
|
|
2387
|
+
}
|
|
2388
|
+
return takeObject(r0);
|
|
2389
|
+
} finally {
|
|
2390
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
/**
|
|
2394
|
+
* Creates an request object from a bytes representation of an request.
|
|
2395
|
+
* @param {Uint8Array} bytes
|
|
2396
|
+
* @returns {ExecutionRequest}
|
|
2397
|
+
*/
|
|
2398
|
+
static fromBytesLe(bytes) {
|
|
2399
|
+
try {
|
|
2400
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2401
|
+
wasm.executionrequest_fromBytesLe(retptr, addHeapObject(bytes));
|
|
2402
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2403
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2404
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2405
|
+
if (r2) {
|
|
2406
|
+
throw takeObject(r1);
|
|
2407
|
+
}
|
|
2408
|
+
return ExecutionRequest.__wrap(r0);
|
|
2409
|
+
} finally {
|
|
2410
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
/**
|
|
2414
|
+
* Returns the request signer.
|
|
2415
|
+
* @returns {Address}
|
|
2416
|
+
*/
|
|
2417
|
+
signer() {
|
|
2418
|
+
const ret = wasm.address_toGroup(this.__wbg_ptr);
|
|
2419
|
+
return Address.__wrap(ret);
|
|
2420
|
+
}
|
|
2421
|
+
/**
|
|
2422
|
+
* Returns the network ID.
|
|
2423
|
+
* @returns {number}
|
|
2424
|
+
*/
|
|
2425
|
+
network_id() {
|
|
2426
|
+
const ret = wasm.executionrequest_network_id(this.__wbg_ptr);
|
|
2427
|
+
return ret;
|
|
2428
|
+
}
|
|
2429
|
+
/**
|
|
2430
|
+
* Returns the program ID.
|
|
1619
2431
|
* @returns {string}
|
|
1620
2432
|
*/
|
|
1621
|
-
|
|
2433
|
+
program_id() {
|
|
1622
2434
|
let deferred1_0;
|
|
1623
2435
|
let deferred1_1;
|
|
1624
2436
|
try {
|
|
1625
2437
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1626
|
-
wasm.
|
|
2438
|
+
wasm.executionrequest_program_id(retptr, this.__wbg_ptr);
|
|
1627
2439
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1628
2440
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1629
2441
|
deferred1_0 = r0;
|
|
@@ -1635,17 +2447,15 @@ class Execution {
|
|
|
1635
2447
|
}
|
|
1636
2448
|
}
|
|
1637
2449
|
/**
|
|
1638
|
-
* Returns the
|
|
1639
|
-
*
|
|
1640
|
-
* @returns {string} The execution proof.
|
|
2450
|
+
* Returns the function name.
|
|
1641
2451
|
* @returns {string}
|
|
1642
2452
|
*/
|
|
1643
|
-
|
|
2453
|
+
function_name() {
|
|
1644
2454
|
let deferred1_0;
|
|
1645
2455
|
let deferred1_1;
|
|
1646
2456
|
try {
|
|
1647
2457
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1648
|
-
wasm.
|
|
2458
|
+
wasm.executionrequest_function_name(retptr, this.__wbg_ptr);
|
|
1649
2459
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1650
2460
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1651
2461
|
deferred1_0 = r0;
|
|
@@ -1657,15 +2467,127 @@ class Execution {
|
|
|
1657
2467
|
}
|
|
1658
2468
|
}
|
|
1659
2469
|
/**
|
|
1660
|
-
* Returns the
|
|
1661
|
-
*
|
|
1662
|
-
* @returns Array<Transition> the array of transitions present in the execution.
|
|
2470
|
+
* Returns the input IDs for the transition.
|
|
1663
2471
|
* @returns {Array<any>}
|
|
1664
2472
|
*/
|
|
1665
|
-
|
|
1666
|
-
const ret = wasm.
|
|
2473
|
+
input_ids() {
|
|
2474
|
+
const ret = wasm.executionrequest_input_ids(this.__wbg_ptr);
|
|
1667
2475
|
return takeObject(ret);
|
|
1668
2476
|
}
|
|
2477
|
+
/**
|
|
2478
|
+
* Returns the function inputs as an array of strings.
|
|
2479
|
+
* @returns {Array<any>}
|
|
2480
|
+
*/
|
|
2481
|
+
inputs() {
|
|
2482
|
+
const ret = wasm.executionrequest_inputs(this.__wbg_ptr);
|
|
2483
|
+
return takeObject(ret);
|
|
2484
|
+
}
|
|
2485
|
+
/**
|
|
2486
|
+
* Returns the signature for the transition.
|
|
2487
|
+
* @returns {Signature}
|
|
2488
|
+
*/
|
|
2489
|
+
signature() {
|
|
2490
|
+
const ret = wasm.executionrequest_signature(this.__wbg_ptr);
|
|
2491
|
+
return Signature.__wrap(ret);
|
|
2492
|
+
}
|
|
2493
|
+
/**
|
|
2494
|
+
* Returns the tag secret key `sk_tag`.
|
|
2495
|
+
* @returns {Field}
|
|
2496
|
+
*/
|
|
2497
|
+
sk_tag() {
|
|
2498
|
+
const ret = wasm.executionrequest_sk_tag(this.__wbg_ptr);
|
|
2499
|
+
return Field.__wrap(ret);
|
|
2500
|
+
}
|
|
2501
|
+
/**
|
|
2502
|
+
* Returns the transition view key `tvk`.
|
|
2503
|
+
* @returns {Field}
|
|
2504
|
+
*/
|
|
2505
|
+
tvk() {
|
|
2506
|
+
const ret = wasm.executionrequest_tvk(this.__wbg_ptr);
|
|
2507
|
+
return Field.__wrap(ret);
|
|
2508
|
+
}
|
|
2509
|
+
/**
|
|
2510
|
+
* Returns the transition public key `tpk`.
|
|
2511
|
+
* @returns {Group}
|
|
2512
|
+
*/
|
|
2513
|
+
to_tpk() {
|
|
2514
|
+
const ret = wasm.executionrequest_to_tpk(this.__wbg_ptr);
|
|
2515
|
+
return Group.__wrap(ret);
|
|
2516
|
+
}
|
|
2517
|
+
/**
|
|
2518
|
+
* Returns the transition commitment `tcm`.
|
|
2519
|
+
* @returns {Field}
|
|
2520
|
+
*/
|
|
2521
|
+
tcm() {
|
|
2522
|
+
const ret = wasm.executionrequest_tcm(this.__wbg_ptr);
|
|
2523
|
+
return Field.__wrap(ret);
|
|
2524
|
+
}
|
|
2525
|
+
/**
|
|
2526
|
+
* Returns the signer commitment `scm`.
|
|
2527
|
+
* @returns {Field}
|
|
2528
|
+
*/
|
|
2529
|
+
scm() {
|
|
2530
|
+
const ret = wasm.executionrequest_scm(this.__wbg_ptr);
|
|
2531
|
+
return Field.__wrap(ret);
|
|
2532
|
+
}
|
|
2533
|
+
/**
|
|
2534
|
+
* Create a new request by signing over a program ID and set of inputs.
|
|
2535
|
+
*
|
|
2536
|
+
* @param {PrivateKey} private_key The private key of the signer.
|
|
2537
|
+
* @param {string} program_id The id of the program to create the signature for.
|
|
2538
|
+
* @param {string} function_name The function name to create the signature for.
|
|
2539
|
+
* @param {string[]} inputs The inputs to the function.
|
|
2540
|
+
* @param {string[]} input_types The input types of the function.
|
|
2541
|
+
* @param {Field | undefined} root_tvk The tvk of the function at the top of the call graph. This is undefined if this request is built for the top-level call or if there is only one function in the call graph.
|
|
2542
|
+
* @param {boolean} is_root Flag to indicate if this is the top level function in the call graph.
|
|
2543
|
+
* @param {PrivateKey} private_key
|
|
2544
|
+
* @param {string} program_id
|
|
2545
|
+
* @param {string} function_name
|
|
2546
|
+
* @param {Array<any>} inputs
|
|
2547
|
+
* @param {Array<any>} input_types
|
|
2548
|
+
* @param {Field | null | undefined} root_tvk
|
|
2549
|
+
* @param {boolean} is_root
|
|
2550
|
+
* @returns {ExecutionRequest}
|
|
2551
|
+
*/
|
|
2552
|
+
static sign(private_key, program_id, function_name, inputs, input_types, root_tvk, is_root) {
|
|
2553
|
+
try {
|
|
2554
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2555
|
+
_assertClass(private_key, PrivateKey);
|
|
2556
|
+
var ptr0 = private_key.__destroy_into_raw();
|
|
2557
|
+
const ptr1 = passStringToWasm0(program_id, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
2558
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2559
|
+
const ptr2 = passStringToWasm0(function_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
2560
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2561
|
+
let ptr3 = 0;
|
|
2562
|
+
if (!isLikeNone(root_tvk)) {
|
|
2563
|
+
_assertClass(root_tvk, Field);
|
|
2564
|
+
ptr3 = root_tvk.__destroy_into_raw();
|
|
2565
|
+
}
|
|
2566
|
+
wasm.executionrequest_sign(retptr, ptr0, ptr1, len1, ptr2, len2, addHeapObject(inputs), addHeapObject(input_types), ptr3, is_root);
|
|
2567
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2568
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2569
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2570
|
+
if (r2) {
|
|
2571
|
+
throw takeObject(r1);
|
|
2572
|
+
}
|
|
2573
|
+
return ExecutionRequest.__wrap(r0);
|
|
2574
|
+
} finally {
|
|
2575
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
/**
|
|
2579
|
+
* Verify the input types within a request.
|
|
2580
|
+
*
|
|
2581
|
+
* @param {string[]} The input_types within the request.
|
|
2582
|
+
* @param {boolean} Flag to indicate whether this request is the first function in the call graph.
|
|
2583
|
+
* @param {Array<any>} input_types
|
|
2584
|
+
* @param {boolean} is_root
|
|
2585
|
+
* @returns {boolean}
|
|
2586
|
+
*/
|
|
2587
|
+
verify(input_types, is_root) {
|
|
2588
|
+
const ret = wasm.executionrequest_verify(this.__wbg_ptr, addHeapObject(input_types), is_root);
|
|
2589
|
+
return ret !== 0;
|
|
2590
|
+
}
|
|
1669
2591
|
}
|
|
1670
2592
|
|
|
1671
2593
|
const ExecutionResponseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -2281,7 +3203,7 @@ class Group {
|
|
|
2281
3203
|
toFields() {
|
|
2282
3204
|
try {
|
|
2283
3205
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2284
|
-
wasm.
|
|
3206
|
+
wasm.address_toFields(retptr, this.__wbg_ptr);
|
|
2285
3207
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2286
3208
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2287
3209
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -2314,7 +3236,7 @@ class Group {
|
|
|
2314
3236
|
* @returns {Group}
|
|
2315
3237
|
*/
|
|
2316
3238
|
clone() {
|
|
2317
|
-
const ret = wasm.
|
|
3239
|
+
const ret = wasm.address_toGroup(this.__wbg_ptr);
|
|
2318
3240
|
return Group.__wrap(ret);
|
|
2319
3241
|
}
|
|
2320
3242
|
/**
|
|
@@ -2806,6 +3728,11 @@ class OfflineQuery {
|
|
|
2806
3728
|
}
|
|
2807
3729
|
/**
|
|
2808
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.
|
|
2809
3736
|
* @param {number} block_height
|
|
2810
3737
|
* @param {string} state_root
|
|
2811
3738
|
*/
|
|
@@ -2830,6 +3757,8 @@ class OfflineQuery {
|
|
|
2830
3757
|
}
|
|
2831
3758
|
/**
|
|
2832
3759
|
* Add a new block height to the offline query object.
|
|
3760
|
+
*
|
|
3761
|
+
* @param {u32} block_height The block height to add.
|
|
2833
3762
|
* @param {number} block_height
|
|
2834
3763
|
*/
|
|
2835
3764
|
addBlockHeight(block_height) {
|
|
@@ -2838,8 +3767,8 @@ class OfflineQuery {
|
|
|
2838
3767
|
/**
|
|
2839
3768
|
* Add a new state path to the offline query object.
|
|
2840
3769
|
*
|
|
2841
|
-
* @param {string} commitment: The commitment corresponding to a record
|
|
2842
|
-
* @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.
|
|
2843
3772
|
* @param {string} commitment
|
|
2844
3773
|
* @param {string} state_path
|
|
2845
3774
|
*/
|
|
@@ -2861,7 +3790,9 @@ class OfflineQuery {
|
|
|
2861
3790
|
}
|
|
2862
3791
|
}
|
|
2863
3792
|
/**
|
|
2864
|
-
* 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.
|
|
2865
3796
|
* @returns {string}
|
|
2866
3797
|
*/
|
|
2867
3798
|
toString() {
|
|
@@ -2881,7 +3812,9 @@ class OfflineQuery {
|
|
|
2881
3812
|
}
|
|
2882
3813
|
}
|
|
2883
3814
|
/**
|
|
2884
|
-
* 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.
|
|
2885
3818
|
* @param {string} s
|
|
2886
3819
|
* @returns {OfflineQuery}
|
|
2887
3820
|
*/
|
|
@@ -3203,6 +4136,11 @@ class Plaintext {
|
|
|
3203
4136
|
}
|
|
3204
4137
|
/**
|
|
3205
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.
|
|
3206
4144
|
* @param {Address} address
|
|
3207
4145
|
* @param {Scalar} randomizer
|
|
3208
4146
|
* @returns {Ciphertext}
|
|
@@ -3226,6 +4164,11 @@ class Plaintext {
|
|
|
3226
4164
|
}
|
|
3227
4165
|
/**
|
|
3228
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.
|
|
3229
4172
|
* @param {Field} transition_view_key
|
|
3230
4173
|
* @returns {Ciphertext}
|
|
3231
4174
|
*/
|
|
@@ -3297,6 +4240,8 @@ class Plaintext {
|
|
|
3297
4240
|
}
|
|
3298
4241
|
/**
|
|
3299
4242
|
* Get the left endian byte array representation of the plaintext.
|
|
4243
|
+
*
|
|
4244
|
+
* @returns {Uint8Array} The left endian byte array representation of the plaintext.
|
|
3300
4245
|
* @returns {Uint8Array}
|
|
3301
4246
|
*/
|
|
3302
4247
|
toBytesLe() {
|
|
@@ -3340,6 +4285,8 @@ class Plaintext {
|
|
|
3340
4285
|
}
|
|
3341
4286
|
/**
|
|
3342
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.
|
|
3343
4290
|
* @returns {Array<any>}
|
|
3344
4291
|
*/
|
|
3345
4292
|
toBitsLe() {
|
|
@@ -3372,6 +4319,8 @@ class Plaintext {
|
|
|
3372
4319
|
}
|
|
3373
4320
|
/**
|
|
3374
4321
|
* Get the field array representation of the plaintext.
|
|
4322
|
+
*
|
|
4323
|
+
* @returns {Array} The field array representation of the plaintext.
|
|
3375
4324
|
* @returns {Array<any>}
|
|
3376
4325
|
*/
|
|
3377
4326
|
toFields() {
|
|
@@ -4636,24 +5585,103 @@ class Program {
|
|
|
4636
5585
|
const ret = wasm.program_getImports(this.__wbg_ptr);
|
|
4637
5586
|
return takeObject(ret);
|
|
4638
5587
|
}
|
|
4639
|
-
}
|
|
4640
|
-
|
|
4641
|
-
const ProgramManagerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4642
|
-
? { register: () => {}, unregister: () => {} }
|
|
4643
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_programmanager_free(ptr >>> 0, 1));
|
|
4644
|
-
|
|
4645
|
-
class ProgramManager {
|
|
4646
|
-
|
|
4647
|
-
__destroy_into_raw() {
|
|
4648
|
-
const ptr = this.__wbg_ptr;
|
|
4649
|
-
this.__wbg_ptr = 0;
|
|
4650
|
-
ProgramManagerFinalization.unregister(this);
|
|
4651
|
-
return ptr;
|
|
4652
|
-
}
|
|
4653
|
-
|
|
4654
|
-
free() {
|
|
4655
|
-
const ptr = this.__destroy_into_raw();
|
|
4656
|
-
wasm.__wbg_programmanager_free(ptr, 0);
|
|
5588
|
+
}
|
|
5589
|
+
|
|
5590
|
+
const ProgramManagerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5591
|
+
? { register: () => {}, unregister: () => {} }
|
|
5592
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_programmanager_free(ptr >>> 0, 1));
|
|
5593
|
+
|
|
5594
|
+
class ProgramManager {
|
|
5595
|
+
|
|
5596
|
+
__destroy_into_raw() {
|
|
5597
|
+
const ptr = this.__wbg_ptr;
|
|
5598
|
+
this.__wbg_ptr = 0;
|
|
5599
|
+
ProgramManagerFinalization.unregister(this);
|
|
5600
|
+
return ptr;
|
|
5601
|
+
}
|
|
5602
|
+
|
|
5603
|
+
free() {
|
|
5604
|
+
const ptr = this.__destroy_into_raw();
|
|
5605
|
+
wasm.__wbg_programmanager_free(ptr, 0);
|
|
5606
|
+
}
|
|
5607
|
+
/**
|
|
5608
|
+
* Create an execution `Authorization` for a given program:function tuple with specified inputs.
|
|
5609
|
+
*
|
|
5610
|
+
* @param private_key The private key of the signer.
|
|
5611
|
+
* @param program The program source code containing the function to authorize.
|
|
5612
|
+
* @param function_name The function to authorize.
|
|
5613
|
+
* @param inputs A javascript array of inputs to the function.
|
|
5614
|
+
* @param imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
5615
|
+
* @param {PrivateKey} private_key
|
|
5616
|
+
* @param {string} program
|
|
5617
|
+
* @param {string} function_name
|
|
5618
|
+
* @param {Array<any>} inputs
|
|
5619
|
+
* @param {object | null} [imports]
|
|
5620
|
+
* @returns {Promise<Authorization>}
|
|
5621
|
+
*/
|
|
5622
|
+
static authorize(private_key, program, function_name, inputs, imports) {
|
|
5623
|
+
_assertClass(private_key, PrivateKey);
|
|
5624
|
+
const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
5625
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5626
|
+
const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
5627
|
+
const len1 = WASM_VECTOR_LEN;
|
|
5628
|
+
const ret = wasm.programmanager_authorize(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports));
|
|
5629
|
+
return takeObject(ret);
|
|
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
|
+
}
|
|
5656
|
+
/**
|
|
5657
|
+
* Create an `Authorization` for `credits.aleo/fee_public` or `credits.aleo/fee_private`.
|
|
5658
|
+
* This object requires an associated execution or deployment ID. This can be gained from
|
|
5659
|
+
* any previously created authorization by calling (authorization.toExecutionId()).
|
|
5660
|
+
*
|
|
5661
|
+
* @param private_key The private key of the signer.
|
|
5662
|
+
* @param deployment_or_execution_id The id of the deployment or execution to authorize the fee program for.
|
|
5663
|
+
* @param base_fee_credits The base fee to be paid for the authorization
|
|
5664
|
+
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
5665
|
+
* @param fee_record The record to spend the fee from
|
|
5666
|
+
* @returns {Authorization}
|
|
5667
|
+
* @param {PrivateKey} private_key
|
|
5668
|
+
* @param {string} deployment_or_execution_id
|
|
5669
|
+
* @param {number} base_fee_credits
|
|
5670
|
+
* @param {number} priority_fee_credits
|
|
5671
|
+
* @param {RecordPlaintext | null} [fee_record]
|
|
5672
|
+
* @returns {Promise<Authorization>}
|
|
5673
|
+
*/
|
|
5674
|
+
static authorizeFee(private_key, deployment_or_execution_id, base_fee_credits, priority_fee_credits, fee_record) {
|
|
5675
|
+
_assertClass(private_key, PrivateKey);
|
|
5676
|
+
const ptr0 = passStringToWasm0(deployment_or_execution_id, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
5677
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5678
|
+
let ptr1 = 0;
|
|
5679
|
+
if (!isLikeNone(fee_record)) {
|
|
5680
|
+
_assertClass(fee_record, RecordPlaintext);
|
|
5681
|
+
ptr1 = fee_record.__destroy_into_raw();
|
|
5682
|
+
}
|
|
5683
|
+
const ret = wasm.programmanager_authorizeFee(private_key.__wbg_ptr, ptr0, len0, base_fee_credits, priority_fee_credits, ptr1);
|
|
5684
|
+
return takeObject(ret);
|
|
4657
5685
|
}
|
|
4658
5686
|
/**
|
|
4659
5687
|
* Deploy an Aleo program
|
|
@@ -5055,6 +6083,48 @@ class ProgramManager {
|
|
|
5055
6083
|
const ret = wasm.programmanager_buildJoinTransaction(private_key.__wbg_ptr, ptr0, ptr1, priority_fee_credits, ptr2, ptr3, len3, ptr4, ptr5, ptr6, ptr7, ptr8);
|
|
5056
6084
|
return takeObject(ret);
|
|
5057
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
|
+
}
|
|
5058
6128
|
/**
|
|
5059
6129
|
* Split an Aleo credits record into two separate records. This function does not require a fee.
|
|
5060
6130
|
*
|
|
@@ -5567,6 +6637,176 @@ class ProvingKey {
|
|
|
5567
6637
|
}
|
|
5568
6638
|
}
|
|
5569
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
|
+
|
|
5570
6810
|
const RecordCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5571
6811
|
? { register: () => {}, unregister: () => {} }
|
|
5572
6812
|
: new FinalizationRegistry(ptr => wasm.__wbg_recordciphertext_free(ptr >>> 0, 1));
|
|
@@ -5620,7 +6860,7 @@ class RecordCiphertext {
|
|
|
5620
6860
|
}
|
|
5621
6861
|
}
|
|
5622
6862
|
/**
|
|
5623
|
-
* Return the string
|
|
6863
|
+
* Return the string representation of the record ciphertext
|
|
5624
6864
|
*
|
|
5625
6865
|
* @returns {string} String representation of the record ciphertext
|
|
5626
6866
|
* @returns {string}
|
|
@@ -5666,6 +6906,21 @@ class RecordCiphertext {
|
|
|
5666
6906
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5667
6907
|
}
|
|
5668
6908
|
}
|
|
6909
|
+
/**
|
|
6910
|
+
* Generate the record view key. The record view key can only decrypt record if the
|
|
6911
|
+
* supplied view key belongs to the record owner.
|
|
6912
|
+
*
|
|
6913
|
+
* @param {ViewKey} view_key View key used to generate the record view key
|
|
6914
|
+
*
|
|
6915
|
+
* @returns {Group} record view key
|
|
6916
|
+
* @param {ViewKey} view_key
|
|
6917
|
+
* @returns {Field}
|
|
6918
|
+
*/
|
|
6919
|
+
recordViewKey(view_key) {
|
|
6920
|
+
_assertClass(view_key, ViewKey);
|
|
6921
|
+
const ret = wasm.recordciphertext_recordViewKey(this.__wbg_ptr, view_key.__wbg_ptr);
|
|
6922
|
+
return Field.__wrap(ret);
|
|
6923
|
+
}
|
|
5669
6924
|
/**
|
|
5670
6925
|
* Determines if the account corresponding to the view key is the owner of the record
|
|
5671
6926
|
*
|
|
@@ -5734,6 +6989,8 @@ class RecordCiphertext {
|
|
|
5734
6989
|
}
|
|
5735
6990
|
/**
|
|
5736
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.
|
|
5737
6994
|
* @returns {Uint8Array}
|
|
5738
6995
|
*/
|
|
5739
6996
|
toBytesLe() {
|
|
@@ -5753,6 +7010,8 @@ class RecordCiphertext {
|
|
|
5753
7010
|
}
|
|
5754
7011
|
/**
|
|
5755
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.
|
|
5756
7015
|
* @returns {Array<any>}
|
|
5757
7016
|
*/
|
|
5758
7017
|
toBitsLe() {
|
|
@@ -5761,6 +7020,8 @@ class RecordCiphertext {
|
|
|
5761
7020
|
}
|
|
5762
7021
|
/**
|
|
5763
7022
|
* Get the field array representation of the record ciphertext.
|
|
7023
|
+
*
|
|
7024
|
+
* @returns {Array} Field array representation of the record ciphertext.
|
|
5764
7025
|
* @returns {Array<any>}
|
|
5765
7026
|
*/
|
|
5766
7027
|
toFields() {
|
|
@@ -5778,6 +7039,42 @@ class RecordCiphertext {
|
|
|
5778
7039
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5779
7040
|
}
|
|
5780
7041
|
}
|
|
7042
|
+
/**
|
|
7043
|
+
* Decrypt the record ciphertext into plaintext using a record view key.
|
|
7044
|
+
*
|
|
7045
|
+
* @param {Field} record_vk Record view key used to decrypt the record.
|
|
7046
|
+
*
|
|
7047
|
+
* @returns {RecordPlaintext}
|
|
7048
|
+
* @param {Field} record_vk
|
|
7049
|
+
* @returns {RecordPlaintext}
|
|
7050
|
+
*/
|
|
7051
|
+
decryptWithRecordViewKey(record_vk) {
|
|
7052
|
+
try {
|
|
7053
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
7054
|
+
_assertClass(record_vk, Field);
|
|
7055
|
+
var ptr0 = record_vk.__destroy_into_raw();
|
|
7056
|
+
wasm.recordciphertext_decryptWithRecordViewKey(retptr, this.__wbg_ptr, ptr0);
|
|
7057
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
7058
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
7059
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
7060
|
+
if (r2) {
|
|
7061
|
+
throw takeObject(r1);
|
|
7062
|
+
}
|
|
7063
|
+
return RecordPlaintext.__wrap(r0);
|
|
7064
|
+
} finally {
|
|
7065
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
7066
|
+
}
|
|
7067
|
+
}
|
|
7068
|
+
/**
|
|
7069
|
+
* Get the record nonce.
|
|
7070
|
+
*
|
|
7071
|
+
* @returns {Group} The record nonce.
|
|
7072
|
+
* @returns {Group}
|
|
7073
|
+
*/
|
|
7074
|
+
nonce() {
|
|
7075
|
+
const ret = wasm.recordciphertext_nonce(this.__wbg_ptr);
|
|
7076
|
+
return Group.__wrap(ret);
|
|
7077
|
+
}
|
|
5781
7078
|
}
|
|
5782
7079
|
|
|
5783
7080
|
const RecordPlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -5810,16 +7107,19 @@ class RecordPlaintext {
|
|
|
5810
7107
|
/**
|
|
5811
7108
|
* @param {string} program_id
|
|
5812
7109
|
* @param {string} record_name
|
|
7110
|
+
* @param {string} record_view_key
|
|
5813
7111
|
* @returns {Field}
|
|
5814
7112
|
*/
|
|
5815
|
-
commitment(program_id, record_name) {
|
|
7113
|
+
commitment(program_id, record_name, record_view_key) {
|
|
5816
7114
|
try {
|
|
5817
7115
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
5818
7116
|
const ptr0 = passStringToWasm0(program_id, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
5819
7117
|
const len0 = WASM_VECTOR_LEN;
|
|
5820
7118
|
const ptr1 = passStringToWasm0(record_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
5821
7119
|
const len1 = WASM_VECTOR_LEN;
|
|
5822
|
-
|
|
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);
|
|
5823
7123
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
5824
7124
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
5825
7125
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -5834,7 +7134,8 @@ class RecordPlaintext {
|
|
|
5834
7134
|
/**
|
|
5835
7135
|
* Return a record plaintext from a string.
|
|
5836
7136
|
*
|
|
5837
|
-
* @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
|
+
*
|
|
5838
7139
|
* @returns {RecordPlaintext} Record plaintext
|
|
5839
7140
|
* @param {string} record
|
|
5840
7141
|
* @returns {RecordPlaintext}
|
|
@@ -5857,6 +7158,11 @@ class RecordPlaintext {
|
|
|
5857
7158
|
}
|
|
5858
7159
|
}
|
|
5859
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.
|
|
5860
7166
|
* @param {string} input
|
|
5861
7167
|
* @returns {Plaintext}
|
|
5862
7168
|
*/
|
|
@@ -5879,6 +7185,8 @@ class RecordPlaintext {
|
|
|
5879
7185
|
}
|
|
5880
7186
|
/**
|
|
5881
7187
|
* Get the owner of the record.
|
|
7188
|
+
*
|
|
7189
|
+
* @returns {Address} Address of the owner of the record.
|
|
5882
7190
|
* @returns {Address}
|
|
5883
7191
|
*/
|
|
5884
7192
|
owner() {
|
|
@@ -6097,16 +7405,18 @@ class RecordPlaintext {
|
|
|
6097
7405
|
* @param {PrivateKey} private_key Private key of the account that owns the record
|
|
6098
7406
|
* @param {string} program_id Program ID of the program that the record is associated with
|
|
6099
7407
|
* @param {string} record_name Name of the record
|
|
7408
|
+
* @param {string} record_view_key The string representation of the record view key.
|
|
6100
7409
|
*
|
|
6101
7410
|
* @returns {string} Serial number of the record
|
|
6102
7411
|
* @param {PrivateKey} private_key
|
|
6103
7412
|
* @param {string} program_id
|
|
6104
7413
|
* @param {string} record_name
|
|
7414
|
+
* @param {string} record_view_key
|
|
6105
7415
|
* @returns {string}
|
|
6106
7416
|
*/
|
|
6107
|
-
serialNumberString(private_key, program_id, record_name) {
|
|
6108
|
-
let
|
|
6109
|
-
let
|
|
7417
|
+
serialNumberString(private_key, program_id, record_name, record_view_key) {
|
|
7418
|
+
let deferred5_0;
|
|
7419
|
+
let deferred5_1;
|
|
6110
7420
|
try {
|
|
6111
7421
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6112
7422
|
_assertClass(private_key, PrivateKey);
|
|
@@ -6114,23 +7424,25 @@ class RecordPlaintext {
|
|
|
6114
7424
|
const len0 = WASM_VECTOR_LEN;
|
|
6115
7425
|
const ptr1 = passStringToWasm0(record_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
6116
7426
|
const len1 = WASM_VECTOR_LEN;
|
|
6117
|
-
|
|
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);
|
|
6118
7430
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6119
7431
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6120
7432
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6121
7433
|
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
6122
|
-
var
|
|
6123
|
-
var
|
|
7434
|
+
var ptr4 = r0;
|
|
7435
|
+
var len4 = r1;
|
|
6124
7436
|
if (r3) {
|
|
6125
|
-
|
|
7437
|
+
ptr4 = 0; len4 = 0;
|
|
6126
7438
|
throw takeObject(r2);
|
|
6127
7439
|
}
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
return getStringFromWasm0(
|
|
7440
|
+
deferred5_0 = ptr4;
|
|
7441
|
+
deferred5_1 = len4;
|
|
7442
|
+
return getStringFromWasm0(ptr4, len4);
|
|
6131
7443
|
} finally {
|
|
6132
7444
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6133
|
-
wasm.__wbindgen_export_2(
|
|
7445
|
+
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
6134
7446
|
}
|
|
6135
7447
|
}
|
|
6136
7448
|
/**
|
|
@@ -6157,6 +7469,21 @@ class RecordPlaintext {
|
|
|
6157
7469
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6158
7470
|
}
|
|
6159
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
|
+
}
|
|
6160
7487
|
}
|
|
6161
7488
|
|
|
6162
7489
|
const ScalarFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -6456,7 +7783,7 @@ class Signature {
|
|
|
6456
7783
|
_assertClass(private_key, PrivateKey);
|
|
6457
7784
|
const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_export_3);
|
|
6458
7785
|
const len0 = WASM_VECTOR_LEN;
|
|
6459
|
-
const ret = wasm.
|
|
7786
|
+
const ret = wasm.signature_sign(private_key.__wbg_ptr, ptr0, len0);
|
|
6460
7787
|
return Signature.__wrap(ret);
|
|
6461
7788
|
}
|
|
6462
7789
|
/**
|
|
@@ -6946,7 +8273,6 @@ class Transaction {
|
|
|
6946
8273
|
}
|
|
6947
8274
|
}
|
|
6948
8275
|
/**
|
|
6949
|
-
* Get the
|
|
6950
8276
|
* Get the type of the transaction (will return "deploy" or "execute")
|
|
6951
8277
|
*
|
|
6952
8278
|
* @returns {string} Transaction type
|
|
@@ -7259,6 +8585,8 @@ class Transition {
|
|
|
7259
8585
|
}
|
|
7260
8586
|
/**
|
|
7261
8587
|
* Get the transition public key of the transition.
|
|
8588
|
+
*
|
|
8589
|
+
* @returns {Group} Transition public key
|
|
7262
8590
|
* @returns {Group}
|
|
7263
8591
|
*/
|
|
7264
8592
|
tpk() {
|
|
@@ -7267,6 +8595,10 @@ class Transition {
|
|
|
7267
8595
|
}
|
|
7268
8596
|
/**
|
|
7269
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
|
|
7270
8602
|
* @param {ViewKey} view_key
|
|
7271
8603
|
* @returns {Field}
|
|
7272
8604
|
*/
|
|
@@ -7277,6 +8609,8 @@ class Transition {
|
|
|
7277
8609
|
}
|
|
7278
8610
|
/**
|
|
7279
8611
|
* Get the transition commitment of the transition.
|
|
8612
|
+
*
|
|
8613
|
+
* @returns {Field} Transition commitment
|
|
7280
8614
|
* @returns {Field}
|
|
7281
8615
|
*/
|
|
7282
8616
|
tcm() {
|
|
@@ -7285,12 +8619,39 @@ class Transition {
|
|
|
7285
8619
|
}
|
|
7286
8620
|
/**
|
|
7287
8621
|
* Get the transition signer commitment of the transition.
|
|
8622
|
+
*
|
|
8623
|
+
* @returns {Field} Transition signer commitment
|
|
7288
8624
|
* @returns {Field}
|
|
7289
8625
|
*/
|
|
7290
8626
|
scm() {
|
|
7291
8627
|
const ret = wasm.transition_scm(this.__wbg_ptr);
|
|
7292
8628
|
return Field.__wrap(ret);
|
|
7293
8629
|
}
|
|
8630
|
+
/**
|
|
8631
|
+
* Decrypt the transition using the transition view key.
|
|
8632
|
+
*
|
|
8633
|
+
* @param {Field} tvk The transition view key.
|
|
8634
|
+
*
|
|
8635
|
+
* @returns {Transition} The transition with public values for inputs and outputs.
|
|
8636
|
+
* @param {Field} tvk
|
|
8637
|
+
* @returns {Transition}
|
|
8638
|
+
*/
|
|
8639
|
+
decryptTransition(tvk) {
|
|
8640
|
+
try {
|
|
8641
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
8642
|
+
_assertClass(tvk, Field);
|
|
8643
|
+
wasm.transition_decryptTransition(retptr, this.__wbg_ptr, tvk.__wbg_ptr);
|
|
8644
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
8645
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
8646
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
8647
|
+
if (r2) {
|
|
8648
|
+
throw takeObject(r1);
|
|
8649
|
+
}
|
|
8650
|
+
return Transition.__wrap(r0);
|
|
8651
|
+
} finally {
|
|
8652
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
8653
|
+
}
|
|
8654
|
+
}
|
|
7294
8655
|
}
|
|
7295
8656
|
|
|
7296
8657
|
const VerifyingKeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -7785,7 +9146,7 @@ class ViewKey {
|
|
|
7785
9146
|
*/
|
|
7786
9147
|
static from_private_key(private_key) {
|
|
7787
9148
|
_assertClass(private_key, PrivateKey);
|
|
7788
|
-
const ret = wasm.
|
|
9149
|
+
const ret = wasm.viewkey_from_private_key(private_key.__wbg_ptr);
|
|
7789
9150
|
return ViewKey.__wrap(ret);
|
|
7790
9151
|
}
|
|
7791
9152
|
/**
|
|
@@ -7912,6 +9273,9 @@ async function __wbg_load(module, imports) {
|
|
|
7912
9273
|
function __wbg_get_imports() {
|
|
7913
9274
|
const imports = {};
|
|
7914
9275
|
imports.wbg = {};
|
|
9276
|
+
imports.wbg.__wbg_abort_410ec47a64ac6117 = function(arg0, arg1) {
|
|
9277
|
+
getObject(arg0).abort(getObject(arg1));
|
|
9278
|
+
};
|
|
7915
9279
|
imports.wbg.__wbg_abort_775ef1d17fc65868 = function(arg0) {
|
|
7916
9280
|
getObject(arg0).abort();
|
|
7917
9281
|
};
|
|
@@ -7930,6 +9294,10 @@ function __wbg_get_imports() {
|
|
|
7930
9294
|
const ret = getObject(arg0).async;
|
|
7931
9295
|
return ret;
|
|
7932
9296
|
};
|
|
9297
|
+
imports.wbg.__wbg_authorization_new = function(arg0) {
|
|
9298
|
+
const ret = Authorization.__wrap(arg0);
|
|
9299
|
+
return addHeapObject(ret);
|
|
9300
|
+
};
|
|
7933
9301
|
imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
|
|
7934
9302
|
const ret = getObject(arg0).buffer;
|
|
7935
9303
|
return addHeapObject(ret);
|
|
@@ -7946,6 +9314,10 @@ function __wbg_get_imports() {
|
|
|
7946
9314
|
const ret = Ciphertext.__wrap(arg0);
|
|
7947
9315
|
return addHeapObject(ret);
|
|
7948
9316
|
};
|
|
9317
|
+
imports.wbg.__wbg_clearTimeout_86721db0036bea98 = function(arg0) {
|
|
9318
|
+
const ret = clearTimeout(takeObject(arg0));
|
|
9319
|
+
return addHeapObject(ret);
|
|
9320
|
+
};
|
|
7949
9321
|
imports.wbg.__wbg_crypto_ed58b8e10a292839 = function(arg0) {
|
|
7950
9322
|
const ret = getObject(arg0).crypto;
|
|
7951
9323
|
return addHeapObject(ret);
|
|
@@ -7977,7 +9349,7 @@ function __wbg_get_imports() {
|
|
|
7977
9349
|
const ret = getObject(arg0).fetch(getObject(arg1));
|
|
7978
9350
|
return addHeapObject(ret);
|
|
7979
9351
|
};
|
|
7980
|
-
imports.wbg.
|
|
9352
|
+
imports.wbg.__wbg_fetch_d36a73832f0a45e8 = function(arg0) {
|
|
7981
9353
|
const ret = fetch(getObject(arg0));
|
|
7982
9354
|
return addHeapObject(ret);
|
|
7983
9355
|
};
|
|
@@ -8042,7 +9414,7 @@ function __wbg_get_imports() {
|
|
|
8042
9414
|
const ret = getObject(arg0).length;
|
|
8043
9415
|
return ret;
|
|
8044
9416
|
};
|
|
8045
|
-
imports.wbg.
|
|
9417
|
+
imports.wbg.__wbg_log_b1cdcca99372fe6e = function(arg0, arg1) {
|
|
8046
9418
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
8047
9419
|
};
|
|
8048
9420
|
imports.wbg.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
|
|
@@ -8060,7 +9432,7 @@ function __wbg_get_imports() {
|
|
|
8060
9432
|
const a = state0.a;
|
|
8061
9433
|
state0.a = 0;
|
|
8062
9434
|
try {
|
|
8063
|
-
return
|
|
9435
|
+
return __wbg_adapter_605(a, state0.b, arg0, arg1);
|
|
8064
9436
|
} finally {
|
|
8065
9437
|
state0.a = a;
|
|
8066
9438
|
}
|
|
@@ -8156,6 +9528,10 @@ function __wbg_get_imports() {
|
|
|
8156
9528
|
const ret = getObject(arg0).process;
|
|
8157
9529
|
return addHeapObject(ret);
|
|
8158
9530
|
};
|
|
9531
|
+
imports.wbg.__wbg_provingrequest_new = function(arg0) {
|
|
9532
|
+
const ret = ProvingRequest.__wrap(arg0);
|
|
9533
|
+
return addHeapObject(ret);
|
|
9534
|
+
};
|
|
8159
9535
|
imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
|
|
8160
9536
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
8161
9537
|
return ret;
|
|
@@ -8200,6 +9576,10 @@ function __wbg_get_imports() {
|
|
|
8200
9576
|
imports.wbg.__wbg_send_40a47636ff90f64d = function() { return handleError(function (arg0) {
|
|
8201
9577
|
getObject(arg0).send();
|
|
8202
9578
|
}, arguments) };
|
|
9579
|
+
imports.wbg.__wbg_setTimeout_2e707715f8cc9497 = function(arg0, arg1) {
|
|
9580
|
+
const ret = setTimeout(getObject(arg0), arg1);
|
|
9581
|
+
return addHeapObject(ret);
|
|
9582
|
+
};
|
|
8203
9583
|
imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
|
|
8204
9584
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
8205
9585
|
};
|
|
@@ -8239,7 +9619,7 @@ function __wbg_get_imports() {
|
|
|
8239
9619
|
const ret = Signature.__wrap(arg0);
|
|
8240
9620
|
return addHeapObject(ret);
|
|
8241
9621
|
};
|
|
8242
|
-
imports.wbg.
|
|
9622
|
+
imports.wbg.__wbg_spawnWorker_41e51220404b3348 = function(arg0, arg1, arg2, arg3) {
|
|
8243
9623
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
8244
9624
|
return addHeapObject(ret);
|
|
8245
9625
|
};
|
|
@@ -8359,12 +9739,16 @@ function __wbg_get_imports() {
|
|
|
8359
9739
|
const ret = false;
|
|
8360
9740
|
return ret;
|
|
8361
9741
|
};
|
|
8362
|
-
imports.wbg.
|
|
8363
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
9742
|
+
imports.wbg.__wbindgen_closure_wrapper6196 = 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);
|
|
8364
9748
|
return addHeapObject(ret);
|
|
8365
9749
|
};
|
|
8366
|
-
imports.wbg.
|
|
8367
|
-
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);
|
|
8368
9752
|
return addHeapObject(ret);
|
|
8369
9753
|
};
|
|
8370
9754
|
imports.wbg.__wbindgen_is_function = function(arg0) {
|
|
@@ -8440,7 +9824,7 @@ function __wbg_get_imports() {
|
|
|
8440
9824
|
}
|
|
8441
9825
|
|
|
8442
9826
|
function __wbg_init_memory(imports, memory) {
|
|
8443
|
-
imports.wbg.memory = memory || new WebAssembly.Memory({initial:
|
|
9827
|
+
imports.wbg.memory = memory || new WebAssembly.Memory({initial:23,maximum:65536,shared:true});
|
|
8444
9828
|
}
|
|
8445
9829
|
|
|
8446
9830
|
function __wbg_finalize_init(instance, module, thread_stack_size) {
|
|
@@ -8508,13 +9892,17 @@ async function __wbg_init(module_or_path, memory) {
|
|
|
8508
9892
|
var exports = /*#__PURE__*/Object.freeze({
|
|
8509
9893
|
__proto__: null,
|
|
8510
9894
|
Address: Address,
|
|
9895
|
+
Authorization: Authorization,
|
|
8511
9896
|
BHP1024: BHP1024,
|
|
8512
9897
|
BHP256: BHP256,
|
|
8513
9898
|
BHP512: BHP512,
|
|
8514
9899
|
BHP768: BHP768,
|
|
9900
|
+
Boolean: Boolean,
|
|
8515
9901
|
Ciphertext: Ciphertext,
|
|
8516
9902
|
ComputeKey: ComputeKey,
|
|
9903
|
+
EncryptionToolkit: EncryptionToolkit,
|
|
8517
9904
|
Execution: Execution,
|
|
9905
|
+
ExecutionRequest: ExecutionRequest,
|
|
8518
9906
|
ExecutionResponse: ExecutionResponse,
|
|
8519
9907
|
Field: Field,
|
|
8520
9908
|
GraphKey: GraphKey,
|
|
@@ -8533,6 +9921,7 @@ var exports = /*#__PURE__*/Object.freeze({
|
|
|
8533
9921
|
Program: Program,
|
|
8534
9922
|
ProgramManager: ProgramManager,
|
|
8535
9923
|
ProvingKey: ProvingKey,
|
|
9924
|
+
ProvingRequest: ProvingRequest,
|
|
8536
9925
|
RecordCiphertext: RecordCiphertext,
|
|
8537
9926
|
RecordPlaintext: RecordPlaintext,
|
|
8538
9927
|
Scalar: Scalar,
|