@provablehq/wasm 0.9.2 → 0.9.3
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 +243 -4
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.js +827 -60
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +829 -59
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +243 -4
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.js +827 -60
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +829 -59
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/testnet/index.js
CHANGED
|
@@ -267,7 +267,7 @@ function __wbg_adapter_40(arg0, arg1, arg2) {
|
|
|
267
267
|
wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
function
|
|
270
|
+
function __wbg_adapter_571(arg0, arg1, arg2, arg3) {
|
|
271
271
|
wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
272
272
|
}
|
|
273
273
|
|
|
@@ -544,6 +544,256 @@ class Address {
|
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
|
|
547
|
+
const AuthorizationFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
548
|
+
? { register: () => {}, unregister: () => {} }
|
|
549
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_authorization_free(ptr >>> 0, 1));
|
|
550
|
+
/**
|
|
551
|
+
* Authorization object containing the authorization for a transaction.
|
|
552
|
+
*/
|
|
553
|
+
class Authorization {
|
|
554
|
+
|
|
555
|
+
static __wrap(ptr) {
|
|
556
|
+
ptr = ptr >>> 0;
|
|
557
|
+
const obj = Object.create(Authorization.prototype);
|
|
558
|
+
obj.__wbg_ptr = ptr;
|
|
559
|
+
AuthorizationFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
560
|
+
return obj;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
__destroy_into_raw() {
|
|
564
|
+
const ptr = this.__wbg_ptr;
|
|
565
|
+
this.__wbg_ptr = 0;
|
|
566
|
+
AuthorizationFinalization.unregister(this);
|
|
567
|
+
return ptr;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
free() {
|
|
571
|
+
const ptr = this.__destroy_into_raw();
|
|
572
|
+
wasm.__wbg_authorization_free(ptr, 0);
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Create a new authorization from a request object.
|
|
576
|
+
*
|
|
577
|
+
* @param {ExecutionRequest} request The ExecutionRequest to build the authorization from.
|
|
578
|
+
* @param {ExecutionRequest} request
|
|
579
|
+
* @returns {Authorization}
|
|
580
|
+
*/
|
|
581
|
+
static new(request) {
|
|
582
|
+
try {
|
|
583
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
584
|
+
_assertClass(request, ExecutionRequest);
|
|
585
|
+
var ptr0 = request.__destroy_into_raw();
|
|
586
|
+
wasm.authorization_new(retptr, ptr0);
|
|
587
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
588
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
589
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
590
|
+
if (r2) {
|
|
591
|
+
throw takeObject(r1);
|
|
592
|
+
}
|
|
593
|
+
return Authorization.__wrap(r0);
|
|
594
|
+
} finally {
|
|
595
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Returns a new and independent replica of the Authorization.
|
|
600
|
+
* @returns {Authorization}
|
|
601
|
+
*/
|
|
602
|
+
replicate() {
|
|
603
|
+
const ret = wasm.authorization_replicate(this.__wbg_ptr);
|
|
604
|
+
return Authorization.__wrap(ret);
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Returns the string representation of the Authorization.
|
|
608
|
+
* @returns {string}
|
|
609
|
+
*/
|
|
610
|
+
toString() {
|
|
611
|
+
let deferred1_0;
|
|
612
|
+
let deferred1_1;
|
|
613
|
+
try {
|
|
614
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
615
|
+
wasm.authorization_toString(retptr, this.__wbg_ptr);
|
|
616
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
617
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
618
|
+
deferred1_0 = r0;
|
|
619
|
+
deferred1_1 = r1;
|
|
620
|
+
return getStringFromWasm0(r0, r1);
|
|
621
|
+
} finally {
|
|
622
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
623
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Reconstructs an Authorization object from its string representation.
|
|
628
|
+
*
|
|
629
|
+
* @param {String} authorization The string representation of the Authorization.
|
|
630
|
+
* @param {string} authorization
|
|
631
|
+
* @returns {Authorization}
|
|
632
|
+
*/
|
|
633
|
+
static fromString(authorization) {
|
|
634
|
+
try {
|
|
635
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
636
|
+
const ptr0 = passStringToWasm0(authorization, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
637
|
+
const len0 = WASM_VECTOR_LEN;
|
|
638
|
+
wasm.authorization_fromString(retptr, ptr0, len0);
|
|
639
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
640
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
641
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
642
|
+
if (r2) {
|
|
643
|
+
throw takeObject(r1);
|
|
644
|
+
}
|
|
645
|
+
return Authorization.__wrap(r0);
|
|
646
|
+
} finally {
|
|
647
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Returns the left-endian byte representation of the Authorization.
|
|
652
|
+
* @returns {Uint8Array}
|
|
653
|
+
*/
|
|
654
|
+
toBytesLe() {
|
|
655
|
+
try {
|
|
656
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
657
|
+
wasm.authorization_toBytesLe(retptr, this.__wbg_ptr);
|
|
658
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
659
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
660
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
661
|
+
if (r2) {
|
|
662
|
+
throw takeObject(r1);
|
|
663
|
+
}
|
|
664
|
+
return takeObject(r0);
|
|
665
|
+
} finally {
|
|
666
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Creates an authorization object from a left-endian byte representation of an Authorization.
|
|
671
|
+
*
|
|
672
|
+
* @param {Uint8Array} bytes Left-endian bytes representing the Authorization.
|
|
673
|
+
* @param {Uint8Array} bytes
|
|
674
|
+
* @returns {Authorization}
|
|
675
|
+
*/
|
|
676
|
+
static fromBytesLe(bytes) {
|
|
677
|
+
try {
|
|
678
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
679
|
+
wasm.authorization_fromBytesLe(retptr, addHeapObject(bytes));
|
|
680
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
681
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
682
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
683
|
+
if (r2) {
|
|
684
|
+
throw takeObject(r1);
|
|
685
|
+
}
|
|
686
|
+
return Authorization.__wrap(r0);
|
|
687
|
+
} finally {
|
|
688
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Check if an Authorization object is the same as another.
|
|
693
|
+
*
|
|
694
|
+
* @param {Authorization} other The Authorization object to determine equality with.
|
|
695
|
+
* @param {Authorization} other
|
|
696
|
+
* @returns {boolean}
|
|
697
|
+
*/
|
|
698
|
+
equals(other) {
|
|
699
|
+
_assertClass(other, Authorization);
|
|
700
|
+
const ret = wasm.authorization_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
701
|
+
return ret !== 0;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Returns the number of `Request`s in the Authorization.
|
|
705
|
+
* @returns {number}
|
|
706
|
+
*/
|
|
707
|
+
len() {
|
|
708
|
+
const ret = wasm.authorization_len(this.__wbg_ptr);
|
|
709
|
+
return ret >>> 0;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Return `true` if the Authorization is empty.
|
|
713
|
+
* @returns {boolean}
|
|
714
|
+
*/
|
|
715
|
+
isEmpty() {
|
|
716
|
+
const ret = wasm.authorization_isEmpty(this.__wbg_ptr);
|
|
717
|
+
return ret !== 0;
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Returns `true` if the Authorization is for `credits.aleo/fee_private`.
|
|
721
|
+
* @returns {boolean}
|
|
722
|
+
*/
|
|
723
|
+
isFeePrivate() {
|
|
724
|
+
const ret = wasm.authorization_isFeePrivate(this.__wbg_ptr);
|
|
725
|
+
return ret !== 0;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Returns `true` if the Authorization is for `credits.aleo/fee_public`.
|
|
729
|
+
* @returns {boolean}
|
|
730
|
+
*/
|
|
731
|
+
isFeePublic() {
|
|
732
|
+
const ret = wasm.authorization_isFeePublic(this.__wbg_ptr);
|
|
733
|
+
return ret !== 0;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Returns `true` if the Authorization is for `credits.aleo/split`.
|
|
737
|
+
* @returns {boolean}
|
|
738
|
+
*/
|
|
739
|
+
isSplit() {
|
|
740
|
+
const ret = wasm.authorization_isSplit(this.__wbg_ptr);
|
|
741
|
+
return ret !== 0;
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Insert a transition into the Authorization.
|
|
745
|
+
*
|
|
746
|
+
* @param {Transition} transition The transition object to insert into the Authorization.
|
|
747
|
+
* @param {Transition} transition
|
|
748
|
+
*/
|
|
749
|
+
insertTransition(transition) {
|
|
750
|
+
try {
|
|
751
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
752
|
+
_assertClass(transition, Transition);
|
|
753
|
+
var ptr0 = transition.__destroy_into_raw();
|
|
754
|
+
wasm.authorization_insertTransition(retptr, this.__wbg_ptr, ptr0);
|
|
755
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
756
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
757
|
+
if (r1) {
|
|
758
|
+
throw takeObject(r0);
|
|
759
|
+
}
|
|
760
|
+
} finally {
|
|
761
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Get the transitions in an Authorization.
|
|
766
|
+
*
|
|
767
|
+
* @returns {Array<Transition>} Array of transition objects
|
|
768
|
+
* @returns {Array<any>}
|
|
769
|
+
*/
|
|
770
|
+
transitions() {
|
|
771
|
+
const ret = wasm.authorization_transitions(this.__wbg_ptr);
|
|
772
|
+
return takeObject(ret);
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Returns the execution ID for the Authorization.
|
|
776
|
+
*
|
|
777
|
+
* @returns {Field} The execution ID for the Authorization, call toString() after this result to get the string representation.
|
|
778
|
+
* @returns {Field}
|
|
779
|
+
*/
|
|
780
|
+
toExecutionId() {
|
|
781
|
+
try {
|
|
782
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
783
|
+
wasm.authorization_toExecutionId(retptr, this.__wbg_ptr);
|
|
784
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
785
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
786
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
787
|
+
if (r2) {
|
|
788
|
+
throw takeObject(r1);
|
|
789
|
+
}
|
|
790
|
+
return Field.__wrap(r0);
|
|
791
|
+
} finally {
|
|
792
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
547
797
|
const BHP1024Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
548
798
|
? { register: () => {}, unregister: () => {} }
|
|
549
799
|
: new FinalizationRegistry(ptr => wasm.__wbg_bhp1024_free(ptr >>> 0, 1));
|
|
@@ -1127,8 +1377,6 @@ const CiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1127
1377
|
* SnarkVM Ciphertext object. A Ciphertext represents an symmetrically encrypted plaintext. This
|
|
1128
1378
|
* object provides decryption methods to recover the plaintext from the ciphertext (given the
|
|
1129
1379
|
* api consumer has the proper decryption materials).
|
|
1130
|
-
*
|
|
1131
|
-
* @example
|
|
1132
1380
|
*/
|
|
1133
1381
|
class Ciphertext {
|
|
1134
1382
|
|
|
@@ -1528,48 +1776,275 @@ class ComputeKey {
|
|
|
1528
1776
|
return Group.__wrap(ret);
|
|
1529
1777
|
}
|
|
1530
1778
|
/**
|
|
1531
|
-
* Get the pr_sig of the compute key.
|
|
1779
|
+
* Get the pr_sig of the compute key.
|
|
1780
|
+
*
|
|
1781
|
+
* @returns {Group} pr_sig
|
|
1782
|
+
* @returns {Group}
|
|
1783
|
+
*/
|
|
1784
|
+
pr_sig() {
|
|
1785
|
+
const ret = wasm.computekey_pr_sig(this.__wbg_ptr);
|
|
1786
|
+
return Group.__wrap(ret);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
const EncryptionToolkitFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1791
|
+
? { register: () => {}, unregister: () => {} }
|
|
1792
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_encryptiontoolkit_free(ptr >>> 0, 1));
|
|
1793
|
+
|
|
1794
|
+
class EncryptionToolkit {
|
|
1795
|
+
|
|
1796
|
+
__destroy_into_raw() {
|
|
1797
|
+
const ptr = this.__wbg_ptr;
|
|
1798
|
+
this.__wbg_ptr = 0;
|
|
1799
|
+
EncryptionToolkitFinalization.unregister(this);
|
|
1800
|
+
return ptr;
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
free() {
|
|
1804
|
+
const ptr = this.__destroy_into_raw();
|
|
1805
|
+
wasm.__wbg_encryptiontoolkit_free(ptr, 0);
|
|
1806
|
+
}
|
|
1807
|
+
/**
|
|
1808
|
+
* Generates a transition view key from the view key and the transition public key.
|
|
1809
|
+
* @param {ViewKey} view_key
|
|
1810
|
+
* @param {Group} tpk
|
|
1811
|
+
* @returns {Field}
|
|
1812
|
+
*/
|
|
1813
|
+
static generateTvk(view_key, tpk) {
|
|
1814
|
+
_assertClass(view_key, ViewKey);
|
|
1815
|
+
_assertClass(tpk, Group);
|
|
1816
|
+
const ret = wasm.encryptiontoolkit_generateTvk(view_key.__wbg_ptr, tpk.__wbg_ptr);
|
|
1817
|
+
return Field.__wrap(ret);
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* Creates a record view key from the view key. This can be later be used to decrypt a
|
|
1821
|
+
* @param {ViewKey} view_key
|
|
1822
|
+
* @param {RecordCiphertext} record_ciphertext
|
|
1823
|
+
* @returns {Field}
|
|
1824
|
+
*/
|
|
1825
|
+
static generateRecordViewKey(view_key, record_ciphertext) {
|
|
1826
|
+
try {
|
|
1827
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1828
|
+
_assertClass(view_key, ViewKey);
|
|
1829
|
+
_assertClass(record_ciphertext, RecordCiphertext);
|
|
1830
|
+
wasm.encryptiontoolkit_generateRecordViewKey(retptr, view_key.__wbg_ptr, record_ciphertext.__wbg_ptr);
|
|
1831
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1832
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1833
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1834
|
+
if (r2) {
|
|
1835
|
+
throw takeObject(r1);
|
|
1836
|
+
}
|
|
1837
|
+
return Field.__wrap(r0);
|
|
1838
|
+
} finally {
|
|
1839
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
/**
|
|
1843
|
+
* Decrypts a record ciphertext using the record view key. Decryption only succeeds
|
|
1844
|
+
* if the record view key was generated from the view key of the record owner.
|
|
1845
|
+
* @param {Field} record_vk
|
|
1846
|
+
* @param {RecordCiphertext} record_ciphertext
|
|
1847
|
+
* @returns {RecordPlaintext}
|
|
1848
|
+
*/
|
|
1849
|
+
static decryptRecordWithRVk(record_vk, record_ciphertext) {
|
|
1850
|
+
try {
|
|
1851
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1852
|
+
_assertClass(record_vk, Field);
|
|
1853
|
+
_assertClass(record_ciphertext, RecordCiphertext);
|
|
1854
|
+
wasm.encryptiontoolkit_decryptRecordWithRVk(retptr, record_vk.__wbg_ptr, record_ciphertext.__wbg_ptr);
|
|
1855
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1856
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1857
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1858
|
+
if (r2) {
|
|
1859
|
+
throw takeObject(r1);
|
|
1860
|
+
}
|
|
1861
|
+
return RecordPlaintext.__wrap(r0);
|
|
1862
|
+
} finally {
|
|
1863
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Decrypts a transition using the transition view key. The ciphertext inputs and outputs
|
|
1868
|
+
* can only be decrypted if the transition view key was generated by the transaction signer.
|
|
1869
|
+
* @param {Transition} transition
|
|
1870
|
+
* @param {Field} transition_vk
|
|
1871
|
+
* @returns {Transition}
|
|
1872
|
+
*/
|
|
1873
|
+
static decryptTransitionWithVk(transition, transition_vk) {
|
|
1874
|
+
try {
|
|
1875
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1876
|
+
_assertClass(transition, Transition);
|
|
1877
|
+
_assertClass(transition_vk, Field);
|
|
1878
|
+
wasm.encryptiontoolkit_decryptTransitionWithVk(retptr, transition.__wbg_ptr, transition_vk.__wbg_ptr);
|
|
1879
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1880
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1881
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1882
|
+
if (r2) {
|
|
1883
|
+
throw takeObject(r1);
|
|
1884
|
+
}
|
|
1885
|
+
return Transition.__wrap(r0);
|
|
1886
|
+
} finally {
|
|
1887
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
const ExecutionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1893
|
+
? { register: () => {}, unregister: () => {} }
|
|
1894
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_execution_free(ptr >>> 0, 1));
|
|
1895
|
+
/**
|
|
1896
|
+
* Execution of an Aleo program.
|
|
1897
|
+
*/
|
|
1898
|
+
class Execution {
|
|
1899
|
+
|
|
1900
|
+
static __wrap(ptr) {
|
|
1901
|
+
ptr = ptr >>> 0;
|
|
1902
|
+
const obj = Object.create(Execution.prototype);
|
|
1903
|
+
obj.__wbg_ptr = ptr;
|
|
1904
|
+
ExecutionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1905
|
+
return obj;
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
__destroy_into_raw() {
|
|
1909
|
+
const ptr = this.__wbg_ptr;
|
|
1910
|
+
this.__wbg_ptr = 0;
|
|
1911
|
+
ExecutionFinalization.unregister(this);
|
|
1912
|
+
return ptr;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
free() {
|
|
1916
|
+
const ptr = this.__destroy_into_raw();
|
|
1917
|
+
wasm.__wbg_execution_free(ptr, 0);
|
|
1918
|
+
}
|
|
1919
|
+
/**
|
|
1920
|
+
* Returns the string representation of the execution.
|
|
1921
|
+
*
|
|
1922
|
+
* @returns {string} The string representation of the execution.
|
|
1923
|
+
* @returns {string}
|
|
1924
|
+
*/
|
|
1925
|
+
toString() {
|
|
1926
|
+
let deferred1_0;
|
|
1927
|
+
let deferred1_1;
|
|
1928
|
+
try {
|
|
1929
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1930
|
+
wasm.execution_toString(retptr, this.__wbg_ptr);
|
|
1931
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1932
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1933
|
+
deferred1_0 = r0;
|
|
1934
|
+
deferred1_1 = r1;
|
|
1935
|
+
return getStringFromWasm0(r0, r1);
|
|
1936
|
+
} finally {
|
|
1937
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1938
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
/**
|
|
1942
|
+
* Creates an execution object from a string representation of an execution.
|
|
1943
|
+
*
|
|
1944
|
+
* @returns {Execution | Error} The wasm representation of an execution object.
|
|
1945
|
+
* @param {string} execution
|
|
1946
|
+
* @returns {Execution}
|
|
1947
|
+
*/
|
|
1948
|
+
static fromString(execution) {
|
|
1949
|
+
try {
|
|
1950
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1951
|
+
const ptr0 = passStringToWasm0(execution, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
1952
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1953
|
+
wasm.execution_fromString(retptr, ptr0, len0);
|
|
1954
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1955
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1956
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1957
|
+
if (r2) {
|
|
1958
|
+
throw takeObject(r1);
|
|
1959
|
+
}
|
|
1960
|
+
return Execution.__wrap(r0);
|
|
1961
|
+
} finally {
|
|
1962
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
/**
|
|
1966
|
+
* Returns the global state root of the execution.
|
|
1967
|
+
*
|
|
1968
|
+
* @returns {Execution | Error} The global state root used in the execution.
|
|
1969
|
+
* @returns {string}
|
|
1970
|
+
*/
|
|
1971
|
+
globalStateRoot() {
|
|
1972
|
+
let deferred1_0;
|
|
1973
|
+
let deferred1_1;
|
|
1974
|
+
try {
|
|
1975
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1976
|
+
wasm.execution_globalStateRoot(retptr, this.__wbg_ptr);
|
|
1977
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1978
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1979
|
+
deferred1_0 = r0;
|
|
1980
|
+
deferred1_1 = r1;
|
|
1981
|
+
return getStringFromWasm0(r0, r1);
|
|
1982
|
+
} finally {
|
|
1983
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1984
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
/**
|
|
1988
|
+
* Returns the proof of the execution.
|
|
1989
|
+
*
|
|
1990
|
+
* @returns {string} The execution proof.
|
|
1991
|
+
* @returns {string}
|
|
1992
|
+
*/
|
|
1993
|
+
proof() {
|
|
1994
|
+
let deferred1_0;
|
|
1995
|
+
let deferred1_1;
|
|
1996
|
+
try {
|
|
1997
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1998
|
+
wasm.execution_proof(retptr, this.__wbg_ptr);
|
|
1999
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2000
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2001
|
+
deferred1_0 = r0;
|
|
2002
|
+
deferred1_1 = r1;
|
|
2003
|
+
return getStringFromWasm0(r0, r1);
|
|
2004
|
+
} finally {
|
|
2005
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2006
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
/**
|
|
2010
|
+
* Returns the transitions present in the execution.
|
|
1532
2011
|
*
|
|
1533
|
-
* @returns
|
|
1534
|
-
* @returns {
|
|
2012
|
+
* @returns Array<Transition> the array of transitions present in the execution.
|
|
2013
|
+
* @returns {Array<any>}
|
|
1535
2014
|
*/
|
|
1536
|
-
|
|
1537
|
-
const ret = wasm.
|
|
1538
|
-
return
|
|
2015
|
+
transitions() {
|
|
2016
|
+
const ret = wasm.execution_transitions(this.__wbg_ptr);
|
|
2017
|
+
return takeObject(ret);
|
|
1539
2018
|
}
|
|
1540
2019
|
}
|
|
1541
2020
|
|
|
1542
|
-
const
|
|
2021
|
+
const ExecutionRequestFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1543
2022
|
? { register: () => {}, unregister: () => {} }
|
|
1544
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
*/
|
|
1548
|
-
class Execution {
|
|
2023
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_executionrequest_free(ptr >>> 0, 1));
|
|
2024
|
+
|
|
2025
|
+
class ExecutionRequest {
|
|
1549
2026
|
|
|
1550
2027
|
static __wrap(ptr) {
|
|
1551
2028
|
ptr = ptr >>> 0;
|
|
1552
|
-
const obj = Object.create(
|
|
2029
|
+
const obj = Object.create(ExecutionRequest.prototype);
|
|
1553
2030
|
obj.__wbg_ptr = ptr;
|
|
1554
|
-
|
|
2031
|
+
ExecutionRequestFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1555
2032
|
return obj;
|
|
1556
2033
|
}
|
|
1557
2034
|
|
|
1558
2035
|
__destroy_into_raw() {
|
|
1559
2036
|
const ptr = this.__wbg_ptr;
|
|
1560
2037
|
this.__wbg_ptr = 0;
|
|
1561
|
-
|
|
2038
|
+
ExecutionRequestFinalization.unregister(this);
|
|
1562
2039
|
return ptr;
|
|
1563
2040
|
}
|
|
1564
2041
|
|
|
1565
2042
|
free() {
|
|
1566
2043
|
const ptr = this.__destroy_into_raw();
|
|
1567
|
-
wasm.
|
|
2044
|
+
wasm.__wbg_executionrequest_free(ptr, 0);
|
|
1568
2045
|
}
|
|
1569
2046
|
/**
|
|
1570
|
-
* Returns the
|
|
1571
|
-
*
|
|
1572
|
-
* @returns {string} The string representation of the execution.
|
|
2047
|
+
* Returns the request as a string.
|
|
1573
2048
|
* @returns {string}
|
|
1574
2049
|
*/
|
|
1575
2050
|
toString() {
|
|
@@ -1577,7 +2052,7 @@ class Execution {
|
|
|
1577
2052
|
let deferred1_1;
|
|
1578
2053
|
try {
|
|
1579
2054
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1580
|
-
wasm.
|
|
2055
|
+
wasm.executionrequest_toString(retptr, this.__wbg_ptr);
|
|
1581
2056
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1582
2057
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1583
2058
|
deferred1_0 = r0;
|
|
@@ -1589,41 +2064,92 @@ class Execution {
|
|
|
1589
2064
|
}
|
|
1590
2065
|
}
|
|
1591
2066
|
/**
|
|
1592
|
-
*
|
|
1593
|
-
*
|
|
1594
|
-
* @returns {
|
|
1595
|
-
* @param {string} execution
|
|
1596
|
-
* @returns {Execution}
|
|
2067
|
+
* Builds a request object from a string representation of a request.
|
|
2068
|
+
* @param {string} request
|
|
2069
|
+
* @returns {ExecutionRequest}
|
|
1597
2070
|
*/
|
|
1598
|
-
static fromString(
|
|
2071
|
+
static fromString(request) {
|
|
1599
2072
|
try {
|
|
1600
2073
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1601
|
-
const ptr0 = passStringToWasm0(
|
|
2074
|
+
const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
1602
2075
|
const len0 = WASM_VECTOR_LEN;
|
|
1603
|
-
wasm.
|
|
2076
|
+
wasm.executionrequest_fromString(retptr, ptr0, len0);
|
|
1604
2077
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1605
2078
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1606
2079
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1607
2080
|
if (r2) {
|
|
1608
2081
|
throw takeObject(r1);
|
|
1609
2082
|
}
|
|
1610
|
-
return
|
|
2083
|
+
return ExecutionRequest.__wrap(r0);
|
|
1611
2084
|
} finally {
|
|
1612
2085
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1613
2086
|
}
|
|
1614
2087
|
}
|
|
1615
2088
|
/**
|
|
1616
|
-
* Returns the
|
|
1617
|
-
*
|
|
1618
|
-
|
|
2089
|
+
* Returns the bytes representation of the request.
|
|
2090
|
+
* @returns {Uint8Array}
|
|
2091
|
+
*/
|
|
2092
|
+
toBytesLe() {
|
|
2093
|
+
try {
|
|
2094
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2095
|
+
wasm.executionrequest_toBytesLe(retptr, this.__wbg_ptr);
|
|
2096
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2097
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2098
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2099
|
+
if (r2) {
|
|
2100
|
+
throw takeObject(r1);
|
|
2101
|
+
}
|
|
2102
|
+
return takeObject(r0);
|
|
2103
|
+
} finally {
|
|
2104
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
/**
|
|
2108
|
+
* Creates an request object from a bytes representation of an request.
|
|
2109
|
+
* @param {Uint8Array} bytes
|
|
2110
|
+
* @returns {ExecutionRequest}
|
|
2111
|
+
*/
|
|
2112
|
+
static fromBytesLe(bytes) {
|
|
2113
|
+
try {
|
|
2114
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2115
|
+
wasm.executionrequest_fromBytesLe(retptr, addHeapObject(bytes));
|
|
2116
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2117
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2118
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2119
|
+
if (r2) {
|
|
2120
|
+
throw takeObject(r1);
|
|
2121
|
+
}
|
|
2122
|
+
return ExecutionRequest.__wrap(r0);
|
|
2123
|
+
} finally {
|
|
2124
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
/**
|
|
2128
|
+
* Returns the request signer.
|
|
2129
|
+
* @returns {Address}
|
|
2130
|
+
*/
|
|
2131
|
+
signer() {
|
|
2132
|
+
const ret = wasm.address_toGroup(this.__wbg_ptr);
|
|
2133
|
+
return Address.__wrap(ret);
|
|
2134
|
+
}
|
|
2135
|
+
/**
|
|
2136
|
+
* Returns the network ID.
|
|
2137
|
+
* @returns {number}
|
|
2138
|
+
*/
|
|
2139
|
+
network_id() {
|
|
2140
|
+
const ret = wasm.executionrequest_network_id(this.__wbg_ptr);
|
|
2141
|
+
return ret;
|
|
2142
|
+
}
|
|
2143
|
+
/**
|
|
2144
|
+
* Returns the program ID.
|
|
1619
2145
|
* @returns {string}
|
|
1620
2146
|
*/
|
|
1621
|
-
|
|
2147
|
+
program_id() {
|
|
1622
2148
|
let deferred1_0;
|
|
1623
2149
|
let deferred1_1;
|
|
1624
2150
|
try {
|
|
1625
2151
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1626
|
-
wasm.
|
|
2152
|
+
wasm.executionrequest_program_id(retptr, this.__wbg_ptr);
|
|
1627
2153
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1628
2154
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1629
2155
|
deferred1_0 = r0;
|
|
@@ -1635,17 +2161,15 @@ class Execution {
|
|
|
1635
2161
|
}
|
|
1636
2162
|
}
|
|
1637
2163
|
/**
|
|
1638
|
-
* Returns the
|
|
1639
|
-
*
|
|
1640
|
-
* @returns {string} The execution proof.
|
|
2164
|
+
* Returns the function name.
|
|
1641
2165
|
* @returns {string}
|
|
1642
2166
|
*/
|
|
1643
|
-
|
|
2167
|
+
function_name() {
|
|
1644
2168
|
let deferred1_0;
|
|
1645
2169
|
let deferred1_1;
|
|
1646
2170
|
try {
|
|
1647
2171
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1648
|
-
wasm.
|
|
2172
|
+
wasm.executionrequest_function_name(retptr, this.__wbg_ptr);
|
|
1649
2173
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1650
2174
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1651
2175
|
deferred1_0 = r0;
|
|
@@ -1657,15 +2181,127 @@ class Execution {
|
|
|
1657
2181
|
}
|
|
1658
2182
|
}
|
|
1659
2183
|
/**
|
|
1660
|
-
* Returns the
|
|
1661
|
-
*
|
|
1662
|
-
* @returns Array<Transition> the array of transitions present in the execution.
|
|
2184
|
+
* Returns the input IDs for the transition.
|
|
1663
2185
|
* @returns {Array<any>}
|
|
1664
2186
|
*/
|
|
1665
|
-
|
|
1666
|
-
const ret = wasm.
|
|
2187
|
+
input_ids() {
|
|
2188
|
+
const ret = wasm.executionrequest_input_ids(this.__wbg_ptr);
|
|
2189
|
+
return takeObject(ret);
|
|
2190
|
+
}
|
|
2191
|
+
/**
|
|
2192
|
+
* Returns the function inputs as an array of strings.
|
|
2193
|
+
* @returns {Array<any>}
|
|
2194
|
+
*/
|
|
2195
|
+
inputs() {
|
|
2196
|
+
const ret = wasm.executionrequest_inputs(this.__wbg_ptr);
|
|
1667
2197
|
return takeObject(ret);
|
|
1668
2198
|
}
|
|
2199
|
+
/**
|
|
2200
|
+
* Returns the signature for the transition.
|
|
2201
|
+
* @returns {Signature}
|
|
2202
|
+
*/
|
|
2203
|
+
signature() {
|
|
2204
|
+
const ret = wasm.executionrequest_signature(this.__wbg_ptr);
|
|
2205
|
+
return Signature.__wrap(ret);
|
|
2206
|
+
}
|
|
2207
|
+
/**
|
|
2208
|
+
* Returns the tag secret key `sk_tag`.
|
|
2209
|
+
* @returns {Field}
|
|
2210
|
+
*/
|
|
2211
|
+
sk_tag() {
|
|
2212
|
+
const ret = wasm.executionrequest_sk_tag(this.__wbg_ptr);
|
|
2213
|
+
return Field.__wrap(ret);
|
|
2214
|
+
}
|
|
2215
|
+
/**
|
|
2216
|
+
* Returns the transition view key `tvk`.
|
|
2217
|
+
* @returns {Field}
|
|
2218
|
+
*/
|
|
2219
|
+
tvk() {
|
|
2220
|
+
const ret = wasm.executionrequest_tvk(this.__wbg_ptr);
|
|
2221
|
+
return Field.__wrap(ret);
|
|
2222
|
+
}
|
|
2223
|
+
/**
|
|
2224
|
+
* Returns the transition public key `tpk`.
|
|
2225
|
+
* @returns {Group}
|
|
2226
|
+
*/
|
|
2227
|
+
to_tpk() {
|
|
2228
|
+
const ret = wasm.executionrequest_to_tpk(this.__wbg_ptr);
|
|
2229
|
+
return Group.__wrap(ret);
|
|
2230
|
+
}
|
|
2231
|
+
/**
|
|
2232
|
+
* Returns the transition commitment `tcm`.
|
|
2233
|
+
* @returns {Field}
|
|
2234
|
+
*/
|
|
2235
|
+
tcm() {
|
|
2236
|
+
const ret = wasm.executionrequest_tcm(this.__wbg_ptr);
|
|
2237
|
+
return Field.__wrap(ret);
|
|
2238
|
+
}
|
|
2239
|
+
/**
|
|
2240
|
+
* Returns the signer commitment `scm`.
|
|
2241
|
+
* @returns {Field}
|
|
2242
|
+
*/
|
|
2243
|
+
scm() {
|
|
2244
|
+
const ret = wasm.executionrequest_scm(this.__wbg_ptr);
|
|
2245
|
+
return Field.__wrap(ret);
|
|
2246
|
+
}
|
|
2247
|
+
/**
|
|
2248
|
+
* Create a new request by signing over a program ID and set of inputs.
|
|
2249
|
+
*
|
|
2250
|
+
* @param {PrivateKey} private_key The private key of the signer.
|
|
2251
|
+
* @param {string} program_id The id of the program to create the signature for.
|
|
2252
|
+
* @param {string} function_name The function name to create the signature for.
|
|
2253
|
+
* @param {string[]} inputs The inputs to the function.
|
|
2254
|
+
* @param {string[]} input_types The input types of the function.
|
|
2255
|
+
* @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.
|
|
2256
|
+
* @param {boolean} is_root Flag to indicate if this is the top level function in the call graph.
|
|
2257
|
+
* @param {PrivateKey} private_key
|
|
2258
|
+
* @param {string} program_id
|
|
2259
|
+
* @param {string} function_name
|
|
2260
|
+
* @param {Array<any>} inputs
|
|
2261
|
+
* @param {Array<any>} input_types
|
|
2262
|
+
* @param {Field | null | undefined} root_tvk
|
|
2263
|
+
* @param {boolean} is_root
|
|
2264
|
+
* @returns {ExecutionRequest}
|
|
2265
|
+
*/
|
|
2266
|
+
static sign(private_key, program_id, function_name, inputs, input_types, root_tvk, is_root) {
|
|
2267
|
+
try {
|
|
2268
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2269
|
+
_assertClass(private_key, PrivateKey);
|
|
2270
|
+
var ptr0 = private_key.__destroy_into_raw();
|
|
2271
|
+
const ptr1 = passStringToWasm0(program_id, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
2272
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2273
|
+
const ptr2 = passStringToWasm0(function_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
2274
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2275
|
+
let ptr3 = 0;
|
|
2276
|
+
if (!isLikeNone(root_tvk)) {
|
|
2277
|
+
_assertClass(root_tvk, Field);
|
|
2278
|
+
ptr3 = root_tvk.__destroy_into_raw();
|
|
2279
|
+
}
|
|
2280
|
+
wasm.executionrequest_sign(retptr, ptr0, ptr1, len1, ptr2, len2, addHeapObject(inputs), addHeapObject(input_types), ptr3, is_root);
|
|
2281
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2282
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2283
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2284
|
+
if (r2) {
|
|
2285
|
+
throw takeObject(r1);
|
|
2286
|
+
}
|
|
2287
|
+
return ExecutionRequest.__wrap(r0);
|
|
2288
|
+
} finally {
|
|
2289
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* Verify the input types within a request.
|
|
2294
|
+
*
|
|
2295
|
+
* @param {string[]} The input_types within the request.
|
|
2296
|
+
* @param {boolean} Flag to indicate whether this request is the first function in the call graph.
|
|
2297
|
+
* @param {Array<any>} input_types
|
|
2298
|
+
* @param {boolean} is_root
|
|
2299
|
+
* @returns {boolean}
|
|
2300
|
+
*/
|
|
2301
|
+
verify(input_types, is_root) {
|
|
2302
|
+
const ret = wasm.executionrequest_verify(this.__wbg_ptr, addHeapObject(input_types), is_root);
|
|
2303
|
+
return ret !== 0;
|
|
2304
|
+
}
|
|
1669
2305
|
}
|
|
1670
2306
|
|
|
1671
2307
|
const ExecutionResponseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -2281,7 +2917,7 @@ class Group {
|
|
|
2281
2917
|
toFields() {
|
|
2282
2918
|
try {
|
|
2283
2919
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2284
|
-
wasm.
|
|
2920
|
+
wasm.address_toFields(retptr, this.__wbg_ptr);
|
|
2285
2921
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2286
2922
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2287
2923
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -2314,7 +2950,7 @@ class Group {
|
|
|
2314
2950
|
* @returns {Group}
|
|
2315
2951
|
*/
|
|
2316
2952
|
clone() {
|
|
2317
|
-
const ret = wasm.
|
|
2953
|
+
const ret = wasm.address_toGroup(this.__wbg_ptr);
|
|
2318
2954
|
return Group.__wrap(ret);
|
|
2319
2955
|
}
|
|
2320
2956
|
/**
|
|
@@ -4655,6 +5291,60 @@ class ProgramManager {
|
|
|
4655
5291
|
const ptr = this.__destroy_into_raw();
|
|
4656
5292
|
wasm.__wbg_programmanager_free(ptr, 0);
|
|
4657
5293
|
}
|
|
5294
|
+
/**
|
|
5295
|
+
* Create an execution `Authorization` for a given program:function tuple with specified inputs.
|
|
5296
|
+
*
|
|
5297
|
+
* @param private_key The private key of the signer.
|
|
5298
|
+
* @param program The program source code containing the function to authorize.
|
|
5299
|
+
* @param function_name The function to authorize.
|
|
5300
|
+
* @param inputs A javascript array of inputs to the function.
|
|
5301
|
+
* @param imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
5302
|
+
* @param {PrivateKey} private_key
|
|
5303
|
+
* @param {string} program
|
|
5304
|
+
* @param {string} function_name
|
|
5305
|
+
* @param {Array<any>} inputs
|
|
5306
|
+
* @param {object | null} [imports]
|
|
5307
|
+
* @returns {Promise<Authorization>}
|
|
5308
|
+
*/
|
|
5309
|
+
static authorize(private_key, program, function_name, inputs, imports) {
|
|
5310
|
+
_assertClass(private_key, PrivateKey);
|
|
5311
|
+
const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
5312
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5313
|
+
const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
5314
|
+
const len1 = WASM_VECTOR_LEN;
|
|
5315
|
+
const ret = wasm.programmanager_authorize(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports));
|
|
5316
|
+
return takeObject(ret);
|
|
5317
|
+
}
|
|
5318
|
+
/**
|
|
5319
|
+
* Create an `Authorization` for `credits.aleo/fee_public` or `credits.aleo/fee_private`.
|
|
5320
|
+
* This object requires an associated execution or deployment ID. This can be gained from
|
|
5321
|
+
* any previously created authorization by calling (authorization.toExecutionId()).
|
|
5322
|
+
*
|
|
5323
|
+
* @param private_key The private key of the signer.
|
|
5324
|
+
* @param deployment_or_execution_id The id of the deployment or execution to authorize the fee program for.
|
|
5325
|
+
* @param base_fee_credits The base fee to be paid for the authorization
|
|
5326
|
+
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
5327
|
+
* @param fee_record The record to spend the fee from
|
|
5328
|
+
* @returns {Authorization}
|
|
5329
|
+
* @param {PrivateKey} private_key
|
|
5330
|
+
* @param {string} deployment_or_execution_id
|
|
5331
|
+
* @param {number} base_fee_credits
|
|
5332
|
+
* @param {number} priority_fee_credits
|
|
5333
|
+
* @param {RecordPlaintext | null} [fee_record]
|
|
5334
|
+
* @returns {Promise<Authorization>}
|
|
5335
|
+
*/
|
|
5336
|
+
static authorizeFee(private_key, deployment_or_execution_id, base_fee_credits, priority_fee_credits, fee_record) {
|
|
5337
|
+
_assertClass(private_key, PrivateKey);
|
|
5338
|
+
const ptr0 = passStringToWasm0(deployment_or_execution_id, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
5339
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5340
|
+
let ptr1 = 0;
|
|
5341
|
+
if (!isLikeNone(fee_record)) {
|
|
5342
|
+
_assertClass(fee_record, RecordPlaintext);
|
|
5343
|
+
ptr1 = fee_record.__destroy_into_raw();
|
|
5344
|
+
}
|
|
5345
|
+
const ret = wasm.programmanager_authorizeFee(private_key.__wbg_ptr, ptr0, len0, base_fee_credits, priority_fee_credits, ptr1);
|
|
5346
|
+
return takeObject(ret);
|
|
5347
|
+
}
|
|
4658
5348
|
/**
|
|
4659
5349
|
* Deploy an Aleo program
|
|
4660
5350
|
*
|
|
@@ -5620,7 +6310,7 @@ class RecordCiphertext {
|
|
|
5620
6310
|
}
|
|
5621
6311
|
}
|
|
5622
6312
|
/**
|
|
5623
|
-
* Return the string
|
|
6313
|
+
* Return the string representation of the record ciphertext
|
|
5624
6314
|
*
|
|
5625
6315
|
* @returns {string} String representation of the record ciphertext
|
|
5626
6316
|
* @returns {string}
|
|
@@ -5666,6 +6356,21 @@ class RecordCiphertext {
|
|
|
5666
6356
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5667
6357
|
}
|
|
5668
6358
|
}
|
|
6359
|
+
/**
|
|
6360
|
+
* Generate the record view key. The record view key can only decrypt record if the
|
|
6361
|
+
* supplied view key belongs to the record owner.
|
|
6362
|
+
*
|
|
6363
|
+
* @param {ViewKey} view_key View key used to generate the record view key
|
|
6364
|
+
*
|
|
6365
|
+
* @returns {Group} record view key
|
|
6366
|
+
* @param {ViewKey} view_key
|
|
6367
|
+
* @returns {Field}
|
|
6368
|
+
*/
|
|
6369
|
+
recordViewKey(view_key) {
|
|
6370
|
+
_assertClass(view_key, ViewKey);
|
|
6371
|
+
const ret = wasm.recordciphertext_recordViewKey(this.__wbg_ptr, view_key.__wbg_ptr);
|
|
6372
|
+
return Field.__wrap(ret);
|
|
6373
|
+
}
|
|
5669
6374
|
/**
|
|
5670
6375
|
* Determines if the account corresponding to the view key is the owner of the record
|
|
5671
6376
|
*
|
|
@@ -5778,6 +6483,40 @@ class RecordCiphertext {
|
|
|
5778
6483
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5779
6484
|
}
|
|
5780
6485
|
}
|
|
6486
|
+
/**
|
|
6487
|
+
* Decrypt the record ciphertext into plaintext using a record view key.
|
|
6488
|
+
*
|
|
6489
|
+
* @param {Field} record_vk Record view key used to decrypt the record.
|
|
6490
|
+
*
|
|
6491
|
+
* @returns {RecordPlaintext}
|
|
6492
|
+
* @param {Field} record_vk
|
|
6493
|
+
* @returns {RecordPlaintext}
|
|
6494
|
+
*/
|
|
6495
|
+
decryptWithRecordViewKey(record_vk) {
|
|
6496
|
+
try {
|
|
6497
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6498
|
+
_assertClass(record_vk, Field);
|
|
6499
|
+
var ptr0 = record_vk.__destroy_into_raw();
|
|
6500
|
+
wasm.recordciphertext_decryptWithRecordViewKey(retptr, this.__wbg_ptr, ptr0);
|
|
6501
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6502
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6503
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6504
|
+
if (r2) {
|
|
6505
|
+
throw takeObject(r1);
|
|
6506
|
+
}
|
|
6507
|
+
return RecordPlaintext.__wrap(r0);
|
|
6508
|
+
} finally {
|
|
6509
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6510
|
+
}
|
|
6511
|
+
}
|
|
6512
|
+
/**
|
|
6513
|
+
* Get the record nonce.
|
|
6514
|
+
* @returns {Group}
|
|
6515
|
+
*/
|
|
6516
|
+
nonce() {
|
|
6517
|
+
const ret = wasm.recordciphertext_nonce(this.__wbg_ptr);
|
|
6518
|
+
return Group.__wrap(ret);
|
|
6519
|
+
}
|
|
5781
6520
|
}
|
|
5782
6521
|
|
|
5783
6522
|
const RecordPlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -6946,7 +7685,6 @@ class Transaction {
|
|
|
6946
7685
|
}
|
|
6947
7686
|
}
|
|
6948
7687
|
/**
|
|
6949
|
-
* Get the
|
|
6950
7688
|
* Get the type of the transaction (will return "deploy" or "execute")
|
|
6951
7689
|
*
|
|
6952
7690
|
* @returns {string} Transaction type
|
|
@@ -7291,6 +8029,31 @@ class Transition {
|
|
|
7291
8029
|
const ret = wasm.transition_scm(this.__wbg_ptr);
|
|
7292
8030
|
return Field.__wrap(ret);
|
|
7293
8031
|
}
|
|
8032
|
+
/**
|
|
8033
|
+
* Decrypt the transition using the transition view key.
|
|
8034
|
+
*
|
|
8035
|
+
* @param {Field} tvk The transition view key.
|
|
8036
|
+
*
|
|
8037
|
+
* @returns {Transition} The transition with public values for inputs and outputs.
|
|
8038
|
+
* @param {Field} tvk
|
|
8039
|
+
* @returns {Transition}
|
|
8040
|
+
*/
|
|
8041
|
+
decryptTransition(tvk) {
|
|
8042
|
+
try {
|
|
8043
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
8044
|
+
_assertClass(tvk, Field);
|
|
8045
|
+
wasm.encryptiontoolkit_decryptTransitionWithVk(retptr, this.__wbg_ptr, tvk.__wbg_ptr);
|
|
8046
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
8047
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
8048
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
8049
|
+
if (r2) {
|
|
8050
|
+
throw takeObject(r1);
|
|
8051
|
+
}
|
|
8052
|
+
return Transition.__wrap(r0);
|
|
8053
|
+
} finally {
|
|
8054
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
8055
|
+
}
|
|
8056
|
+
}
|
|
7294
8057
|
}
|
|
7295
8058
|
|
|
7296
8059
|
const VerifyingKeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -7930,6 +8693,10 @@ function __wbg_get_imports() {
|
|
|
7930
8693
|
const ret = getObject(arg0).async;
|
|
7931
8694
|
return ret;
|
|
7932
8695
|
};
|
|
8696
|
+
imports.wbg.__wbg_authorization_new = function(arg0) {
|
|
8697
|
+
const ret = Authorization.__wrap(arg0);
|
|
8698
|
+
return addHeapObject(ret);
|
|
8699
|
+
};
|
|
7933
8700
|
imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
|
|
7934
8701
|
const ret = getObject(arg0).buffer;
|
|
7935
8702
|
return addHeapObject(ret);
|
|
@@ -8042,7 +8809,7 @@ function __wbg_get_imports() {
|
|
|
8042
8809
|
const ret = getObject(arg0).length;
|
|
8043
8810
|
return ret;
|
|
8044
8811
|
};
|
|
8045
|
-
imports.wbg.
|
|
8812
|
+
imports.wbg.__wbg_log_112b57e1bd7dc2f1 = function(arg0, arg1) {
|
|
8046
8813
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
8047
8814
|
};
|
|
8048
8815
|
imports.wbg.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
|
|
@@ -8060,7 +8827,7 @@ function __wbg_get_imports() {
|
|
|
8060
8827
|
const a = state0.a;
|
|
8061
8828
|
state0.a = 0;
|
|
8062
8829
|
try {
|
|
8063
|
-
return
|
|
8830
|
+
return __wbg_adapter_571(a, state0.b, arg0, arg1);
|
|
8064
8831
|
} finally {
|
|
8065
8832
|
state0.a = a;
|
|
8066
8833
|
}
|
|
@@ -8239,7 +9006,7 @@ function __wbg_get_imports() {
|
|
|
8239
9006
|
const ret = Signature.__wrap(arg0);
|
|
8240
9007
|
return addHeapObject(ret);
|
|
8241
9008
|
};
|
|
8242
|
-
imports.wbg.
|
|
9009
|
+
imports.wbg.__wbg_spawnWorker_e58e27d3efb914e4 = function(arg0, arg1, arg2, arg3) {
|
|
8243
9010
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
8244
9011
|
return addHeapObject(ret);
|
|
8245
9012
|
};
|
|
@@ -8359,12 +9126,12 @@ function __wbg_get_imports() {
|
|
|
8359
9126
|
const ret = false;
|
|
8360
9127
|
return ret;
|
|
8361
9128
|
};
|
|
8362
|
-
imports.wbg.
|
|
8363
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
9129
|
+
imports.wbg.__wbindgen_closure_wrapper6258 = function(arg0, arg1, arg2) {
|
|
9130
|
+
const ret = makeMutClosure(arg0, arg1, 520, __wbg_adapter_40);
|
|
8364
9131
|
return addHeapObject(ret);
|
|
8365
9132
|
};
|
|
8366
|
-
imports.wbg.
|
|
8367
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
9133
|
+
imports.wbg.__wbindgen_closure_wrapper6264 = function(arg0, arg1, arg2) {
|
|
9134
|
+
const ret = makeMutClosure(arg0, arg1, 520, __wbg_adapter_40);
|
|
8368
9135
|
return addHeapObject(ret);
|
|
8369
9136
|
};
|
|
8370
9137
|
imports.wbg.__wbindgen_is_function = function(arg0) {
|
|
@@ -8440,7 +9207,7 @@ function __wbg_get_imports() {
|
|
|
8440
9207
|
}
|
|
8441
9208
|
|
|
8442
9209
|
function __wbg_init_memory(imports, memory) {
|
|
8443
|
-
imports.wbg.memory = memory || new WebAssembly.Memory({initial:
|
|
9210
|
+
imports.wbg.memory = memory || new WebAssembly.Memory({initial:23,maximum:65536,shared:true});
|
|
8444
9211
|
}
|
|
8445
9212
|
|
|
8446
9213
|
function __wbg_finalize_init(instance, module, thread_stack_size) {
|
|
@@ -8519,5 +9286,5 @@ async function initThreadPool(threads) {
|
|
|
8519
9286
|
await initThreadPool$1(new URL("worker.js", import.meta.url), threads);
|
|
8520
9287
|
}
|
|
8521
9288
|
|
|
8522
|
-
export { Address, BHP1024, BHP256, BHP512, BHP768, Ciphertext, ComputeKey, Execution, ExecutionResponse, Field, GraphKey, Group, KeyPair, Metadata, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager, ProvingKey, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, VerifyingKey, ViewKey, initSync, initThreadPool, runRayonThread, verifyFunctionExecution };
|
|
9289
|
+
export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Ciphertext, ComputeKey, EncryptionToolkit, Execution, ExecutionRequest, ExecutionResponse, Field, GraphKey, Group, KeyPair, Metadata, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager, ProvingKey, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, VerifyingKey, ViewKey, initSync, initThreadPool, runRayonThread, verifyFunctionExecution };
|
|
8523
9290
|
//# sourceMappingURL=index.js.map
|