@provablehq/wasm 0.7.2 → 0.8.0
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 +883 -4
- package/dist/mainnet/aleo_wasm.js +2060 -162
- package/dist/mainnet/aleo_wasm.js.map +1 -1
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.d.ts +5 -0
- package/dist/mainnet/index.js +2067 -164
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +2060 -162
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +883 -4
- package/dist/testnet/aleo_wasm.js +2061 -163
- package/dist/testnet/aleo_wasm.js.map +1 -1
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.d.ts +5 -0
- package/dist/testnet/index.js +2068 -165
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +2061 -163
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +2 -2
|
@@ -237,7 +237,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|
|
237
237
|
CLOSURE_DTORS.register(real, state, state);
|
|
238
238
|
return real;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function __wbg_adapter_40(arg0, arg1, arg2) {
|
|
241
241
|
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1503081f6025e61c(arg0, arg1, addHeapObject(arg2));
|
|
242
242
|
}
|
|
243
243
|
|
|
@@ -328,7 +328,7 @@ function handleError(f, args) {
|
|
|
328
328
|
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function __wbg_adapter_419(arg0, arg1, arg2, arg3) {
|
|
332
332
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__hc5c49be524f0cde8(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
333
333
|
}
|
|
334
334
|
|
|
@@ -386,6 +386,18 @@ class Address {
|
|
|
386
386
|
return Address.__wrap(ret);
|
|
387
387
|
}
|
|
388
388
|
/**
|
|
389
|
+
* Derive an Aleo address from a compute key.
|
|
390
|
+
*
|
|
391
|
+
* @param {ComputeKey} compute_key The compute key to derive the address from
|
|
392
|
+
* @param {ComputeKey} compute_key
|
|
393
|
+
* @returns {Address}
|
|
394
|
+
*/
|
|
395
|
+
static from_compute_key(compute_key) {
|
|
396
|
+
_assertClass(compute_key, ComputeKey);
|
|
397
|
+
const ret = wasm.address_from_compute_key(compute_key.__wbg_ptr);
|
|
398
|
+
return Address.__wrap(ret);
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
389
401
|
* Create an aleo address object from a string representation of an address
|
|
390
402
|
*
|
|
391
403
|
* @param {string} address String representation of an addressm
|
|
@@ -440,6 +452,270 @@ class Address {
|
|
|
440
452
|
}
|
|
441
453
|
}
|
|
442
454
|
|
|
455
|
+
const CiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
456
|
+
? { register: () => {}, unregister: () => {} }
|
|
457
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_ciphertext_free(ptr >>> 0));
|
|
458
|
+
/**
|
|
459
|
+
* SnarkVM Ciphertext object. A Ciphertext represents an symmetrically encrypted plaintext. This
|
|
460
|
+
* object provides decryption methods to recover the plaintext from the ciphertext (given the
|
|
461
|
+
* api consumer has the proper decryption materials).
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
*/
|
|
465
|
+
class Ciphertext {
|
|
466
|
+
|
|
467
|
+
static __wrap(ptr) {
|
|
468
|
+
ptr = ptr >>> 0;
|
|
469
|
+
const obj = Object.create(Ciphertext.prototype);
|
|
470
|
+
obj.__wbg_ptr = ptr;
|
|
471
|
+
CiphertextFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
472
|
+
return obj;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
__destroy_into_raw() {
|
|
476
|
+
const ptr = this.__wbg_ptr;
|
|
477
|
+
this.__wbg_ptr = 0;
|
|
478
|
+
CiphertextFinalization.unregister(this);
|
|
479
|
+
return ptr;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
free() {
|
|
483
|
+
const ptr = this.__destroy_into_raw();
|
|
484
|
+
wasm.__wbg_ciphertext_free(ptr);
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Decrypt the ciphertext using the given view key.
|
|
488
|
+
*
|
|
489
|
+
* @param {ViewKey} The view key of the account that encrypted the ciphertext.
|
|
490
|
+
* @param {Group} The nonce used to encrypt the ciphertext.
|
|
491
|
+
*
|
|
492
|
+
* @returns {Plaintext} The decrypted plaintext.
|
|
493
|
+
* @param {ViewKey} view_key
|
|
494
|
+
* @param {Group} nonce
|
|
495
|
+
* @returns {Plaintext}
|
|
496
|
+
*/
|
|
497
|
+
decrypt(view_key, nonce) {
|
|
498
|
+
try {
|
|
499
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
500
|
+
_assertClass(view_key, ViewKey);
|
|
501
|
+
var ptr0 = view_key.__destroy_into_raw();
|
|
502
|
+
_assertClass(nonce, Group);
|
|
503
|
+
var ptr1 = nonce.__destroy_into_raw();
|
|
504
|
+
wasm.ciphertext_decrypt(retptr, this.__wbg_ptr, ptr0, ptr1);
|
|
505
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
506
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
507
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
508
|
+
if (r2) {
|
|
509
|
+
throw takeObject(r1);
|
|
510
|
+
}
|
|
511
|
+
return Plaintext.__wrap(r0);
|
|
512
|
+
} finally {
|
|
513
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Decrypts a ciphertext into plaintext using the given transition view key.
|
|
518
|
+
*
|
|
519
|
+
* @param {Field} transition_view_key The transition view key that was used to encrypt the ciphertext.
|
|
520
|
+
*
|
|
521
|
+
* @returns {Plaintext} The decrypted plaintext.
|
|
522
|
+
* @param {Field} transition_view_key
|
|
523
|
+
* @returns {Plaintext}
|
|
524
|
+
*/
|
|
525
|
+
decryptSymmetric(transition_view_key) {
|
|
526
|
+
try {
|
|
527
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
528
|
+
_assertClass(transition_view_key, Field);
|
|
529
|
+
var ptr0 = transition_view_key.__destroy_into_raw();
|
|
530
|
+
wasm.ciphertext_decryptSymmetric(retptr, this.__wbg_ptr, ptr0);
|
|
531
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
532
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
533
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
534
|
+
if (r2) {
|
|
535
|
+
throw takeObject(r1);
|
|
536
|
+
}
|
|
537
|
+
return Plaintext.__wrap(r0);
|
|
538
|
+
} finally {
|
|
539
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Deserialize a left endian byte array into a Ciphertext.
|
|
544
|
+
*
|
|
545
|
+
* @param {Uint8Array} bytes The byte array representing the Ciphertext.
|
|
546
|
+
*
|
|
547
|
+
* @returns {Ciphertext} The Ciphertext object.
|
|
548
|
+
* @param {Uint8Array} bytes
|
|
549
|
+
* @returns {Ciphertext}
|
|
550
|
+
*/
|
|
551
|
+
static fromBytesLe(bytes) {
|
|
552
|
+
try {
|
|
553
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
554
|
+
wasm.ciphertext_fromBytesLe(retptr, addHeapObject(bytes));
|
|
555
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
556
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
557
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
558
|
+
if (r2) {
|
|
559
|
+
throw takeObject(r1);
|
|
560
|
+
}
|
|
561
|
+
return Ciphertext.__wrap(r0);
|
|
562
|
+
} finally {
|
|
563
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Deserialize a Ciphertext string into a Ciphertext object.
|
|
568
|
+
*
|
|
569
|
+
* @param {string} ciphertext A string representation of the ciphertext.
|
|
570
|
+
*
|
|
571
|
+
* @returns {Ciphertext} The Ciphertext object.
|
|
572
|
+
* @param {string} ciphertext
|
|
573
|
+
* @returns {Ciphertext}
|
|
574
|
+
*/
|
|
575
|
+
static fromString(ciphertext) {
|
|
576
|
+
try {
|
|
577
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
578
|
+
const ptr0 = passStringToWasm0(ciphertext, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
579
|
+
const len0 = WASM_VECTOR_LEN;
|
|
580
|
+
wasm.ciphertext_fromString(retptr, ptr0, len0);
|
|
581
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
582
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
583
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
584
|
+
if (r2) {
|
|
585
|
+
throw takeObject(r1);
|
|
586
|
+
}
|
|
587
|
+
return Ciphertext.__wrap(r0);
|
|
588
|
+
} finally {
|
|
589
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Serialize a Ciphertext object into a byte array.
|
|
594
|
+
*
|
|
595
|
+
* @returns {Uint8Array} The serialized Ciphertext.
|
|
596
|
+
* @returns {Uint8Array}
|
|
597
|
+
*/
|
|
598
|
+
toBytes() {
|
|
599
|
+
try {
|
|
600
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
601
|
+
wasm.ciphertext_toBytes(retptr, this.__wbg_ptr);
|
|
602
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
603
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
604
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
605
|
+
if (r2) {
|
|
606
|
+
throw takeObject(r1);
|
|
607
|
+
}
|
|
608
|
+
return takeObject(r0);
|
|
609
|
+
} finally {
|
|
610
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Serialize a Ciphertext into a js string.
|
|
615
|
+
*
|
|
616
|
+
* @returns {string} The serialized Ciphertext.
|
|
617
|
+
* @returns {string}
|
|
618
|
+
*/
|
|
619
|
+
toString() {
|
|
620
|
+
let deferred1_0;
|
|
621
|
+
let deferred1_1;
|
|
622
|
+
try {
|
|
623
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
624
|
+
wasm.ciphertext_toString(retptr, this.__wbg_ptr);
|
|
625
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
626
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
627
|
+
deferred1_0 = r0;
|
|
628
|
+
deferred1_1 = r1;
|
|
629
|
+
return getStringFromWasm0(r0, r1);
|
|
630
|
+
} finally {
|
|
631
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
632
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
const ComputeKeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
638
|
+
? { register: () => {}, unregister: () => {} }
|
|
639
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_computekey_free(ptr >>> 0));
|
|
640
|
+
/**
|
|
641
|
+
*/
|
|
642
|
+
class ComputeKey {
|
|
643
|
+
|
|
644
|
+
static __wrap(ptr) {
|
|
645
|
+
ptr = ptr >>> 0;
|
|
646
|
+
const obj = Object.create(ComputeKey.prototype);
|
|
647
|
+
obj.__wbg_ptr = ptr;
|
|
648
|
+
ComputeKeyFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
649
|
+
return obj;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
__destroy_into_raw() {
|
|
653
|
+
const ptr = this.__wbg_ptr;
|
|
654
|
+
this.__wbg_ptr = 0;
|
|
655
|
+
ComputeKeyFinalization.unregister(this);
|
|
656
|
+
return ptr;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
free() {
|
|
660
|
+
const ptr = this.__destroy_into_raw();
|
|
661
|
+
wasm.__wbg_computekey_free(ptr);
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Create a new compute key from a private key.
|
|
665
|
+
*
|
|
666
|
+
* @param {PrivateKey} private_key Private key
|
|
667
|
+
*
|
|
668
|
+
* @returns {ComputeKey} Compute key
|
|
669
|
+
* @param {PrivateKey} private_key
|
|
670
|
+
* @returns {ComputeKey}
|
|
671
|
+
*/
|
|
672
|
+
static from_private_key(private_key) {
|
|
673
|
+
_assertClass(private_key, PrivateKey);
|
|
674
|
+
const ret = wasm.computekey_from_private_key(private_key.__wbg_ptr);
|
|
675
|
+
return ComputeKey.__wrap(ret);
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Get the address from the compute key.
|
|
679
|
+
*
|
|
680
|
+
* @returns {Address}
|
|
681
|
+
* @returns {Address}
|
|
682
|
+
*/
|
|
683
|
+
address() {
|
|
684
|
+
const ret = wasm.address_from_compute_key(this.__wbg_ptr);
|
|
685
|
+
return Address.__wrap(ret);
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Get the sk_prf of the compute key.
|
|
689
|
+
*
|
|
690
|
+
* @returns {Scalar} sk_prf
|
|
691
|
+
* @returns {Scalar}
|
|
692
|
+
*/
|
|
693
|
+
sk_prf() {
|
|
694
|
+
const ret = wasm.computekey_sk_prf(this.__wbg_ptr);
|
|
695
|
+
return Scalar.__wrap(ret);
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Get the pr_tag of the compute key.
|
|
699
|
+
*
|
|
700
|
+
* @returns {Group} pr_tag
|
|
701
|
+
* @returns {Group}
|
|
702
|
+
*/
|
|
703
|
+
pk_sig() {
|
|
704
|
+
const ret = wasm.computekey_pk_sig(this.__wbg_ptr);
|
|
705
|
+
return Group.__wrap(ret);
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Get the pr_sig of the compute key.
|
|
709
|
+
*
|
|
710
|
+
* @returns {Group} pr_sig
|
|
711
|
+
* @returns {Group}
|
|
712
|
+
*/
|
|
713
|
+
pr_sig() {
|
|
714
|
+
const ret = wasm.computekey_pr_sig(this.__wbg_ptr);
|
|
715
|
+
return Group.__wrap(ret);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
443
719
|
const ExecutionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
444
720
|
? { register: () => {}, unregister: () => {} }
|
|
445
721
|
: new FinalizationRegistry(ptr => wasm.__wbg_execution_free(ptr >>> 0));
|
|
@@ -469,6 +745,8 @@ class Execution {
|
|
|
469
745
|
}
|
|
470
746
|
/**
|
|
471
747
|
* Returns the string representation of the execution.
|
|
748
|
+
*
|
|
749
|
+
* @returns {string} The string representation of the execution.
|
|
472
750
|
* @returns {string}
|
|
473
751
|
*/
|
|
474
752
|
toString() {
|
|
@@ -489,6 +767,8 @@ class Execution {
|
|
|
489
767
|
}
|
|
490
768
|
/**
|
|
491
769
|
* Creates an execution object from a string representation of an execution.
|
|
770
|
+
*
|
|
771
|
+
* @returns {Execution | Error} The wasm representation of an execution object.
|
|
492
772
|
* @param {string} execution
|
|
493
773
|
* @returns {Execution}
|
|
494
774
|
*/
|
|
@@ -509,6 +789,60 @@ class Execution {
|
|
|
509
789
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
510
790
|
}
|
|
511
791
|
}
|
|
792
|
+
/**
|
|
793
|
+
* Returns the global state root of the execution.
|
|
794
|
+
*
|
|
795
|
+
* @returns {Execution | Error} The global state root used in the execution.
|
|
796
|
+
* @returns {string}
|
|
797
|
+
*/
|
|
798
|
+
globalStateRoot() {
|
|
799
|
+
let deferred1_0;
|
|
800
|
+
let deferred1_1;
|
|
801
|
+
try {
|
|
802
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
803
|
+
wasm.execution_globalStateRoot(retptr, this.__wbg_ptr);
|
|
804
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
805
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
806
|
+
deferred1_0 = r0;
|
|
807
|
+
deferred1_1 = r1;
|
|
808
|
+
return getStringFromWasm0(r0, r1);
|
|
809
|
+
} finally {
|
|
810
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
811
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Returns the proof of the execution.
|
|
816
|
+
*
|
|
817
|
+
* @returns {string} The execution proof.
|
|
818
|
+
* @returns {string}
|
|
819
|
+
*/
|
|
820
|
+
proof() {
|
|
821
|
+
let deferred1_0;
|
|
822
|
+
let deferred1_1;
|
|
823
|
+
try {
|
|
824
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
825
|
+
wasm.execution_proof(retptr, this.__wbg_ptr);
|
|
826
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
827
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
828
|
+
deferred1_0 = r0;
|
|
829
|
+
deferred1_1 = r1;
|
|
830
|
+
return getStringFromWasm0(r0, r1);
|
|
831
|
+
} finally {
|
|
832
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
833
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Returns the transitions present in the execution.
|
|
838
|
+
*
|
|
839
|
+
* @returns Array<Transition> the array of transitions present in the execution.
|
|
840
|
+
* @returns {Array<any>}
|
|
841
|
+
*/
|
|
842
|
+
transitions() {
|
|
843
|
+
const ret = wasm.execution_transitions(this.__wbg_ptr);
|
|
844
|
+
return takeObject(ret);
|
|
845
|
+
}
|
|
512
846
|
}
|
|
513
847
|
|
|
514
848
|
const ExecutionResponseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -636,6 +970,7 @@ const FieldFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
636
970
|
? { register: () => {}, unregister: () => {} }
|
|
637
971
|
: new FinalizationRegistry(ptr => wasm.__wbg_field_free(ptr >>> 0));
|
|
638
972
|
/**
|
|
973
|
+
* Field element.
|
|
639
974
|
*/
|
|
640
975
|
class Field {
|
|
641
976
|
|
|
@@ -659,6 +994,37 @@ class Field {
|
|
|
659
994
|
wasm.__wbg_field_free(ptr);
|
|
660
995
|
}
|
|
661
996
|
/**
|
|
997
|
+
* Creates a field object from a string representation of a field.
|
|
998
|
+
* @param {string} field
|
|
999
|
+
* @returns {Field}
|
|
1000
|
+
*/
|
|
1001
|
+
static fromString(field) {
|
|
1002
|
+
try {
|
|
1003
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1004
|
+
const ptr0 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1005
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1006
|
+
wasm.field_fromString(retptr, ptr0, len0);
|
|
1007
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1008
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1009
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
1010
|
+
if (r2) {
|
|
1011
|
+
throw takeObject(r1);
|
|
1012
|
+
}
|
|
1013
|
+
return Field.__wrap(r0);
|
|
1014
|
+
} finally {
|
|
1015
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Create a plaintext element from a group element.
|
|
1020
|
+
* @returns {Plaintext}
|
|
1021
|
+
*/
|
|
1022
|
+
toPlaintext() {
|
|
1023
|
+
const ret = wasm.field_toPlaintext(this.__wbg_ptr);
|
|
1024
|
+
return Plaintext.__wrap(ret);
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* Returns the string representation of the field.
|
|
662
1028
|
* @returns {string}
|
|
663
1029
|
*/
|
|
664
1030
|
toString() {
|
|
@@ -678,26 +1044,358 @@ class Field {
|
|
|
678
1044
|
}
|
|
679
1045
|
}
|
|
680
1046
|
/**
|
|
681
|
-
*
|
|
1047
|
+
* Generate a random field element.
|
|
682
1048
|
* @returns {Field}
|
|
683
1049
|
*/
|
|
684
|
-
static
|
|
1050
|
+
static random() {
|
|
1051
|
+
const ret = wasm.field_random();
|
|
1052
|
+
return Field.__wrap(ret);
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Add two field elements.
|
|
1056
|
+
* @param {Field} other
|
|
1057
|
+
* @returns {Field}
|
|
1058
|
+
*/
|
|
1059
|
+
add(other) {
|
|
1060
|
+
_assertClass(other, Field);
|
|
1061
|
+
const ret = wasm.field_add(this.__wbg_ptr, other.__wbg_ptr);
|
|
1062
|
+
return Field.__wrap(ret);
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Subtract two field elements.
|
|
1066
|
+
* @param {Field} other
|
|
1067
|
+
* @returns {Field}
|
|
1068
|
+
*/
|
|
1069
|
+
subtract(other) {
|
|
1070
|
+
_assertClass(other, Field);
|
|
1071
|
+
const ret = wasm.field_subtract(this.__wbg_ptr, other.__wbg_ptr);
|
|
1072
|
+
return Field.__wrap(ret);
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Multiply two field elements.
|
|
1076
|
+
* @param {Field} other
|
|
1077
|
+
* @returns {Field}
|
|
1078
|
+
*/
|
|
1079
|
+
multiply(other) {
|
|
1080
|
+
_assertClass(other, Field);
|
|
1081
|
+
const ret = wasm.field_multiply(this.__wbg_ptr, other.__wbg_ptr);
|
|
1082
|
+
return Field.__wrap(ret);
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Divide two field elements.
|
|
1086
|
+
* @param {Field} other
|
|
1087
|
+
* @returns {Field}
|
|
1088
|
+
*/
|
|
1089
|
+
divide(other) {
|
|
1090
|
+
_assertClass(other, Field);
|
|
1091
|
+
const ret = wasm.field_divide(this.__wbg_ptr, other.__wbg_ptr);
|
|
1092
|
+
return Field.__wrap(ret);
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Power of a field element.
|
|
1096
|
+
* @param {Field} other
|
|
1097
|
+
* @returns {Field}
|
|
1098
|
+
*/
|
|
1099
|
+
pow(other) {
|
|
1100
|
+
_assertClass(other, Field);
|
|
1101
|
+
const ret = wasm.field_pow(this.__wbg_ptr, other.__wbg_ptr);
|
|
1102
|
+
return Field.__wrap(ret);
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Invert the field element.
|
|
1106
|
+
* @returns {Field}
|
|
1107
|
+
*/
|
|
1108
|
+
inverse() {
|
|
1109
|
+
const ret = wasm.field_inverse(this.__wbg_ptr);
|
|
1110
|
+
return Field.__wrap(ret);
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* Get the zero element of the field.
|
|
1114
|
+
* @returns {Field}
|
|
1115
|
+
*/
|
|
1116
|
+
static zero() {
|
|
1117
|
+
const ret = wasm.field_zero();
|
|
1118
|
+
return Field.__wrap(ret);
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Get the one element of the field.
|
|
1122
|
+
* @returns {Field}
|
|
1123
|
+
*/
|
|
1124
|
+
static one() {
|
|
1125
|
+
const ret = wasm.field_one();
|
|
1126
|
+
return Field.__wrap(ret);
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Double the field element.
|
|
1130
|
+
* @returns {Field}
|
|
1131
|
+
*/
|
|
1132
|
+
double() {
|
|
1133
|
+
const ret = wasm.field_double(this.__wbg_ptr);
|
|
1134
|
+
return Field.__wrap(ret);
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* Check if one field element equals another.
|
|
1138
|
+
* @param {Field} other
|
|
1139
|
+
* @returns {boolean}
|
|
1140
|
+
*/
|
|
1141
|
+
equals(other) {
|
|
1142
|
+
_assertClass(other, Field);
|
|
1143
|
+
const ret = wasm.field_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
1144
|
+
return ret !== 0;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
const GraphKeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1149
|
+
? { register: () => {}, unregister: () => {} }
|
|
1150
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_graphkey_free(ptr >>> 0));
|
|
1151
|
+
/**
|
|
1152
|
+
*/
|
|
1153
|
+
class GraphKey {
|
|
1154
|
+
|
|
1155
|
+
static __wrap(ptr) {
|
|
1156
|
+
ptr = ptr >>> 0;
|
|
1157
|
+
const obj = Object.create(GraphKey.prototype);
|
|
1158
|
+
obj.__wbg_ptr = ptr;
|
|
1159
|
+
GraphKeyFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1160
|
+
return obj;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
__destroy_into_raw() {
|
|
1164
|
+
const ptr = this.__wbg_ptr;
|
|
1165
|
+
this.__wbg_ptr = 0;
|
|
1166
|
+
GraphKeyFinalization.unregister(this);
|
|
1167
|
+
return ptr;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
free() {
|
|
1171
|
+
const ptr = this.__destroy_into_raw();
|
|
1172
|
+
wasm.__wbg_graphkey_free(ptr);
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Create a new graph key from a view key.
|
|
1176
|
+
*
|
|
1177
|
+
* @param {ViewKey} view_key View key
|
|
1178
|
+
* @returns {GraphKey} Graph key
|
|
1179
|
+
* @param {ViewKey} view_key
|
|
1180
|
+
* @returns {GraphKey}
|
|
1181
|
+
*/
|
|
1182
|
+
static from_view_key(view_key) {
|
|
1183
|
+
_assertClass(view_key, ViewKey);
|
|
1184
|
+
const ret = wasm.graphkey_from_view_key(view_key.__wbg_ptr);
|
|
1185
|
+
return GraphKey.__wrap(ret);
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Create a new graph key from a string representation of a graph key
|
|
1189
|
+
*
|
|
1190
|
+
* @param {string} graph_key String representation of a graph key
|
|
1191
|
+
* @returns {GraphKey} Graph key
|
|
1192
|
+
* @param {string} graph_key
|
|
1193
|
+
* @returns {GraphKey}
|
|
1194
|
+
*/
|
|
1195
|
+
static from_string(graph_key) {
|
|
1196
|
+
const ptr0 = passStringToWasm0(graph_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1197
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1198
|
+
const ret = wasm.graphkey_from_string(ptr0, len0);
|
|
1199
|
+
return GraphKey.__wrap(ret);
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Get a string representation of a graph key
|
|
1203
|
+
*
|
|
1204
|
+
* @returns {string} String representation of a graph key
|
|
1205
|
+
* @returns {string}
|
|
1206
|
+
*/
|
|
1207
|
+
to_string() {
|
|
1208
|
+
let deferred1_0;
|
|
1209
|
+
let deferred1_1;
|
|
685
1210
|
try {
|
|
686
1211
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
687
|
-
|
|
1212
|
+
wasm.graphkey_to_string(retptr, this.__wbg_ptr);
|
|
1213
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1214
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1215
|
+
deferred1_0 = r0;
|
|
1216
|
+
deferred1_1 = r1;
|
|
1217
|
+
return getStringFromWasm0(r0, r1);
|
|
1218
|
+
} finally {
|
|
1219
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1220
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* Get the sk_tag of the graph key. Used to determine ownership of records.
|
|
1225
|
+
* @returns {Field}
|
|
1226
|
+
*/
|
|
1227
|
+
sk_tag() {
|
|
1228
|
+
const ret = wasm.graphkey_sk_tag(this.__wbg_ptr);
|
|
1229
|
+
return Field.__wrap(ret);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
const GroupFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1234
|
+
? { register: () => {}, unregister: () => {} }
|
|
1235
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_group_free(ptr >>> 0));
|
|
1236
|
+
/**
|
|
1237
|
+
* Elliptic curve element.
|
|
1238
|
+
*/
|
|
1239
|
+
class Group {
|
|
1240
|
+
|
|
1241
|
+
static __wrap(ptr) {
|
|
1242
|
+
ptr = ptr >>> 0;
|
|
1243
|
+
const obj = Object.create(Group.prototype);
|
|
1244
|
+
obj.__wbg_ptr = ptr;
|
|
1245
|
+
GroupFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1246
|
+
return obj;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
__destroy_into_raw() {
|
|
1250
|
+
const ptr = this.__wbg_ptr;
|
|
1251
|
+
this.__wbg_ptr = 0;
|
|
1252
|
+
GroupFinalization.unregister(this);
|
|
1253
|
+
return ptr;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
free() {
|
|
1257
|
+
const ptr = this.__destroy_into_raw();
|
|
1258
|
+
wasm.__wbg_group_free(ptr);
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Creates a group object from a string representation of a group.
|
|
1262
|
+
* @param {string} group
|
|
1263
|
+
* @returns {Group}
|
|
1264
|
+
*/
|
|
1265
|
+
static fromString(group) {
|
|
1266
|
+
try {
|
|
1267
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1268
|
+
const ptr0 = passStringToWasm0(group, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
688
1269
|
const len0 = WASM_VECTOR_LEN;
|
|
689
|
-
wasm.
|
|
1270
|
+
wasm.group_fromString(retptr, ptr0, len0);
|
|
690
1271
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
691
1272
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
692
1273
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
693
1274
|
if (r2) {
|
|
694
1275
|
throw takeObject(r1);
|
|
695
1276
|
}
|
|
696
|
-
return
|
|
1277
|
+
return Group.__wrap(r0);
|
|
1278
|
+
} finally {
|
|
1279
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Returns the string representation of the group.
|
|
1284
|
+
* @returns {string}
|
|
1285
|
+
*/
|
|
1286
|
+
toString() {
|
|
1287
|
+
let deferred1_0;
|
|
1288
|
+
let deferred1_1;
|
|
1289
|
+
try {
|
|
1290
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1291
|
+
wasm.group_toString(retptr, this.__wbg_ptr);
|
|
1292
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1293
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1294
|
+
deferred1_0 = r0;
|
|
1295
|
+
deferred1_1 = r1;
|
|
1296
|
+
return getStringFromWasm0(r0, r1);
|
|
697
1297
|
} finally {
|
|
698
1298
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1299
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
699
1300
|
}
|
|
700
1301
|
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Get the x-coordinate of the group element.
|
|
1304
|
+
* @returns {Field}
|
|
1305
|
+
*/
|
|
1306
|
+
toXCoordinate() {
|
|
1307
|
+
const ret = wasm.group_toXCoordinate(this.__wbg_ptr);
|
|
1308
|
+
return Field.__wrap(ret);
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Create a plaintext element from a group element.
|
|
1312
|
+
* @returns {Plaintext}
|
|
1313
|
+
*/
|
|
1314
|
+
toPlaintext() {
|
|
1315
|
+
const ret = wasm.group_toPlaintext(this.__wbg_ptr);
|
|
1316
|
+
return Plaintext.__wrap(ret);
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* Generate a random group element.
|
|
1320
|
+
* @returns {Group}
|
|
1321
|
+
*/
|
|
1322
|
+
static random() {
|
|
1323
|
+
const ret = wasm.group_random();
|
|
1324
|
+
return Group.__wrap(ret);
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* Add two group elements.
|
|
1328
|
+
* @param {Group} other
|
|
1329
|
+
* @returns {Group}
|
|
1330
|
+
*/
|
|
1331
|
+
add(other) {
|
|
1332
|
+
_assertClass(other, Group);
|
|
1333
|
+
const ret = wasm.group_add(this.__wbg_ptr, other.__wbg_ptr);
|
|
1334
|
+
return Group.__wrap(ret);
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Subtract two group elements (equivalently: add the inverse of an element).
|
|
1338
|
+
* @param {Group} other
|
|
1339
|
+
* @returns {Group}
|
|
1340
|
+
*/
|
|
1341
|
+
subtract(other) {
|
|
1342
|
+
_assertClass(other, Group);
|
|
1343
|
+
const ret = wasm.group_subtract(this.__wbg_ptr, other.__wbg_ptr);
|
|
1344
|
+
return Group.__wrap(ret);
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Multiply a group element by a scalar element.
|
|
1348
|
+
* @param {Scalar} scalar
|
|
1349
|
+
* @returns {Group}
|
|
1350
|
+
*/
|
|
1351
|
+
scalarMultiply(scalar) {
|
|
1352
|
+
_assertClass(scalar, Scalar);
|
|
1353
|
+
const ret = wasm.group_scalarMultiply(this.__wbg_ptr, scalar.__wbg_ptr);
|
|
1354
|
+
return Group.__wrap(ret);
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Double the group element.
|
|
1358
|
+
* @returns {Group}
|
|
1359
|
+
*/
|
|
1360
|
+
double() {
|
|
1361
|
+
const ret = wasm.group_double(this.__wbg_ptr);
|
|
1362
|
+
return Group.__wrap(ret);
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Get the inverse of the group element. This is the reflection of the point about the axis
|
|
1366
|
+
* of symmetry i.e. (x,y) -> (x, -y).
|
|
1367
|
+
* @returns {Group}
|
|
1368
|
+
*/
|
|
1369
|
+
inverse() {
|
|
1370
|
+
const ret = wasm.group_inverse(this.__wbg_ptr);
|
|
1371
|
+
return Group.__wrap(ret);
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Check if one group element equals another.
|
|
1375
|
+
* @param {Group} other
|
|
1376
|
+
* @returns {boolean}
|
|
1377
|
+
*/
|
|
1378
|
+
equals(other) {
|
|
1379
|
+
_assertClass(other, Group);
|
|
1380
|
+
const ret = wasm.group_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
1381
|
+
return ret !== 0;
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Get the group identity element under the group operation (i.e. the point at infinity.)
|
|
1385
|
+
* @returns {Group}
|
|
1386
|
+
*/
|
|
1387
|
+
static zero() {
|
|
1388
|
+
const ret = wasm.group_zero();
|
|
1389
|
+
return Group.__wrap(ret);
|
|
1390
|
+
}
|
|
1391
|
+
/**
|
|
1392
|
+
* Get the generator of the group.
|
|
1393
|
+
* @returns {Group}
|
|
1394
|
+
*/
|
|
1395
|
+
static generator() {
|
|
1396
|
+
const ret = wasm.group_generator();
|
|
1397
|
+
return Group.__wrap(ret);
|
|
1398
|
+
}
|
|
701
1399
|
}
|
|
702
1400
|
|
|
703
1401
|
const KeyPairFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -1203,113 +1901,366 @@ class OfflineQuery {
|
|
|
1203
1901
|
}
|
|
1204
1902
|
}
|
|
1205
1903
|
|
|
1206
|
-
const
|
|
1904
|
+
const PlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1207
1905
|
? { register: () => {}, unregister: () => {} }
|
|
1208
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
1906
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_plaintext_free(ptr >>> 0));
|
|
1209
1907
|
/**
|
|
1210
|
-
*
|
|
1908
|
+
* SnarkVM Plaintext object. Plaintext is a fundamental monadic type used to represent Aleo
|
|
1909
|
+
* primitive types (boolean, field, group, i8, i16, i32, i64, i128, u8, u16, u32, u64, u128,
|
|
1910
|
+
* scalar, and signature), struct types, and array types.
|
|
1911
|
+
*
|
|
1912
|
+
* In the context of a web or NodeJS application, this type is useful for turning an Aleo type into
|
|
1913
|
+
* a JS value, object, or array that might be necessary for performing computations within the
|
|
1914
|
+
* application.
|
|
1915
|
+
*
|
|
1916
|
+
* @example
|
|
1917
|
+
* // Get the bond state of an existing address.
|
|
1918
|
+
* const bondState = await fetch(https://api.explorer.provable.com/v1/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
|
|
1919
|
+
* // Convert the bond state to a Plaintext object.
|
|
1920
|
+
* const bondStatePlaintext = Plaintext.fromString(bond_state);
|
|
1921
|
+
* // Convert the Plaintext object to a JS object.
|
|
1922
|
+
* const bondStateObject = bond_state_plaintext.toObject();
|
|
1923
|
+
* // Check if the bond state matches the expected object.
|
|
1924
|
+
* const expectedObject = { validator: "aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f", microcredits: 100000000u64 };
|
|
1925
|
+
* assert( JSON.stringify(bondStateObject) === JSON.stringify(expectedObject) );
|
|
1211
1926
|
*/
|
|
1212
|
-
class
|
|
1927
|
+
class Plaintext {
|
|
1213
1928
|
|
|
1214
1929
|
static __wrap(ptr) {
|
|
1215
1930
|
ptr = ptr >>> 0;
|
|
1216
|
-
const obj = Object.create(
|
|
1931
|
+
const obj = Object.create(Plaintext.prototype);
|
|
1217
1932
|
obj.__wbg_ptr = ptr;
|
|
1218
|
-
|
|
1933
|
+
PlaintextFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1219
1934
|
return obj;
|
|
1220
1935
|
}
|
|
1221
1936
|
|
|
1222
1937
|
__destroy_into_raw() {
|
|
1223
1938
|
const ptr = this.__wbg_ptr;
|
|
1224
1939
|
this.__wbg_ptr = 0;
|
|
1225
|
-
|
|
1940
|
+
PlaintextFinalization.unregister(this);
|
|
1226
1941
|
return ptr;
|
|
1227
1942
|
}
|
|
1228
1943
|
|
|
1229
1944
|
free() {
|
|
1230
1945
|
const ptr = this.__destroy_into_raw();
|
|
1231
|
-
wasm.
|
|
1946
|
+
wasm.__wbg_plaintext_free(ptr);
|
|
1232
1947
|
}
|
|
1233
1948
|
/**
|
|
1234
|
-
*
|
|
1949
|
+
* Find plaintext member if the plaintext is a struct. Returns `null` if the plaintext is not
|
|
1950
|
+
* a struct or the member does not exist.
|
|
1235
1951
|
*
|
|
1236
|
-
* @
|
|
1237
|
-
*/
|
|
1238
|
-
constructor() {
|
|
1239
|
-
const ret = wasm.privatekey_new();
|
|
1240
|
-
this.__wbg_ptr = ret >>> 0;
|
|
1241
|
-
return this;
|
|
1242
|
-
}
|
|
1243
|
-
/**
|
|
1244
|
-
* Get a private key from a series of unchecked bytes
|
|
1952
|
+
* @param {string} name The name of the plaintext member to find.
|
|
1245
1953
|
*
|
|
1246
|
-
* @
|
|
1247
|
-
* @
|
|
1248
|
-
* @
|
|
1249
|
-
* @returns {PrivateKey}
|
|
1954
|
+
* @returns {Plaintext} The plaintext member.
|
|
1955
|
+
* @param {string} name
|
|
1956
|
+
* @returns {Plaintext}
|
|
1250
1957
|
*/
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1958
|
+
find(name) {
|
|
1959
|
+
try {
|
|
1960
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1961
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1962
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1963
|
+
wasm.plaintext_find(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1964
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1965
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1966
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
1967
|
+
if (r2) {
|
|
1968
|
+
throw takeObject(r1);
|
|
1969
|
+
}
|
|
1970
|
+
return Plaintext.__wrap(r0);
|
|
1971
|
+
} finally {
|
|
1972
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1973
|
+
}
|
|
1256
1974
|
}
|
|
1257
1975
|
/**
|
|
1258
|
-
*
|
|
1259
|
-
*
|
|
1260
|
-
* @param {
|
|
1261
|
-
* @returns {
|
|
1262
|
-
* @param {string} private_key
|
|
1263
|
-
* @returns {PrivateKey}
|
|
1976
|
+
* Encrypt a plaintext with an address and randomizer.
|
|
1977
|
+
* @param {Address} address
|
|
1978
|
+
* @param {Scalar} randomizer
|
|
1979
|
+
* @returns {Ciphertext}
|
|
1264
1980
|
*/
|
|
1265
|
-
|
|
1981
|
+
encrypt(address, randomizer) {
|
|
1266
1982
|
try {
|
|
1267
1983
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
wasm.
|
|
1984
|
+
_assertClass(address, Address);
|
|
1985
|
+
_assertClass(randomizer, Scalar);
|
|
1986
|
+
wasm.plaintext_encrypt(retptr, this.__wbg_ptr, address.__wbg_ptr, randomizer.__wbg_ptr);
|
|
1271
1987
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1272
1988
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1273
1989
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
1274
1990
|
if (r2) {
|
|
1275
1991
|
throw takeObject(r1);
|
|
1276
1992
|
}
|
|
1277
|
-
return
|
|
1993
|
+
return Ciphertext.__wrap(r0);
|
|
1278
1994
|
} finally {
|
|
1279
1995
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1280
1996
|
}
|
|
1281
1997
|
}
|
|
1282
1998
|
/**
|
|
1283
|
-
*
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1286
|
-
* @returns {string} String representation of a private key
|
|
1287
|
-
* @returns {string}
|
|
1999
|
+
* Encrypt a plaintext with a transition view key.
|
|
2000
|
+
* @param {Field} transition_view_key
|
|
2001
|
+
* @returns {Ciphertext}
|
|
1288
2002
|
*/
|
|
1289
|
-
|
|
1290
|
-
let deferred1_0;
|
|
1291
|
-
let deferred1_1;
|
|
2003
|
+
encryptSymmetric(transition_view_key) {
|
|
1292
2004
|
try {
|
|
1293
2005
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1294
|
-
|
|
2006
|
+
_assertClass(transition_view_key, Field);
|
|
2007
|
+
wasm.plaintext_encryptSymmetric(retptr, this.__wbg_ptr, transition_view_key.__wbg_ptr);
|
|
1295
2008
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1296
2009
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
2010
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
2011
|
+
if (r2) {
|
|
2012
|
+
throw takeObject(r1);
|
|
2013
|
+
}
|
|
2014
|
+
return Ciphertext.__wrap(r0);
|
|
1300
2015
|
} finally {
|
|
1301
2016
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1302
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1303
2017
|
}
|
|
1304
2018
|
}
|
|
1305
2019
|
/**
|
|
1306
|
-
*
|
|
2020
|
+
* Creates a plaintext object from a string representation of a plaintext.
|
|
1307
2021
|
*
|
|
1308
|
-
* @
|
|
1309
|
-
*
|
|
2022
|
+
* @param {string} plaintext The string representation of the plaintext.
|
|
2023
|
+
*
|
|
2024
|
+
* @returns {Plaintext} The plaintext object.
|
|
2025
|
+
* @param {string} plaintext
|
|
2026
|
+
* @returns {Plaintext}
|
|
1310
2027
|
*/
|
|
1311
|
-
|
|
1312
|
-
|
|
2028
|
+
static fromString(plaintext) {
|
|
2029
|
+
try {
|
|
2030
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2031
|
+
const ptr0 = passStringToWasm0(plaintext, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2032
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2033
|
+
wasm.plaintext_fromString(retptr, ptr0, len0);
|
|
2034
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
2035
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
2036
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
2037
|
+
if (r2) {
|
|
2038
|
+
throw takeObject(r1);
|
|
2039
|
+
}
|
|
2040
|
+
return Plaintext.__wrap(r0);
|
|
2041
|
+
} finally {
|
|
2042
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
/**
|
|
2046
|
+
* Get a plaintext object from a series of bytes.
|
|
2047
|
+
*
|
|
2048
|
+
* @param {Uint8Array} bytes A left endian byte array representing the plaintext.
|
|
2049
|
+
*
|
|
2050
|
+
* @returns {Plaintext} The plaintext object.
|
|
2051
|
+
* @param {Uint8Array} bytes
|
|
2052
|
+
* @returns {Plaintext}
|
|
2053
|
+
*/
|
|
2054
|
+
static fromBytesLe(bytes) {
|
|
2055
|
+
try {
|
|
2056
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2057
|
+
wasm.plaintext_fromBytesLe(retptr, addHeapObject(bytes));
|
|
2058
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
2059
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
2060
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
2061
|
+
if (r2) {
|
|
2062
|
+
throw takeObject(r1);
|
|
2063
|
+
}
|
|
2064
|
+
return Plaintext.__wrap(r0);
|
|
2065
|
+
} finally {
|
|
2066
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
/**
|
|
2070
|
+
* Generate a random plaintext element from a series of bytes.
|
|
2071
|
+
*
|
|
2072
|
+
* @param {Uint8Array} bytes A left endian byte array representing the plaintext.
|
|
2073
|
+
* @returns {Uint8Array}
|
|
2074
|
+
*/
|
|
2075
|
+
toBytesLe() {
|
|
2076
|
+
try {
|
|
2077
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2078
|
+
wasm.plaintext_toBytesLe(retptr, this.__wbg_ptr);
|
|
2079
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
2080
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
2081
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
2082
|
+
if (r2) {
|
|
2083
|
+
throw takeObject(r1);
|
|
2084
|
+
}
|
|
2085
|
+
return takeObject(r0);
|
|
2086
|
+
} finally {
|
|
2087
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
/**
|
|
2091
|
+
* Returns the string representation of the plaintext.
|
|
2092
|
+
*
|
|
2093
|
+
* @returns {string} The string representation of the plaintext.
|
|
2094
|
+
* @returns {string}
|
|
2095
|
+
*/
|
|
2096
|
+
toString() {
|
|
2097
|
+
let deferred1_0;
|
|
2098
|
+
let deferred1_1;
|
|
2099
|
+
try {
|
|
2100
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2101
|
+
wasm.plaintext_toString(retptr, this.__wbg_ptr);
|
|
2102
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
2103
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
2104
|
+
deferred1_0 = r0;
|
|
2105
|
+
deferred1_1 = r1;
|
|
2106
|
+
return getStringFromWasm0(r0, r1);
|
|
2107
|
+
} finally {
|
|
2108
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2109
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
/**
|
|
2113
|
+
* Gives the type of the plaintext.
|
|
2114
|
+
*
|
|
2115
|
+
* @returns {string} The type of the plaintext.
|
|
2116
|
+
* @returns {string}
|
|
2117
|
+
*/
|
|
2118
|
+
plaintextType() {
|
|
2119
|
+
let deferred1_0;
|
|
2120
|
+
let deferred1_1;
|
|
2121
|
+
try {
|
|
2122
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2123
|
+
wasm.plaintext_plaintextType(retptr, this.__wbg_ptr);
|
|
2124
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
2125
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
2126
|
+
deferred1_0 = r0;
|
|
2127
|
+
deferred1_1 = r1;
|
|
2128
|
+
return getStringFromWasm0(r0, r1);
|
|
2129
|
+
} finally {
|
|
2130
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2131
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
/**
|
|
2135
|
+
* Attempt to convert the plaintext to a JS object.
|
|
2136
|
+
*
|
|
2137
|
+
* @returns {Object} The JS object representation of the plaintext.
|
|
2138
|
+
* @returns {any}
|
|
2139
|
+
*/
|
|
2140
|
+
toObject() {
|
|
2141
|
+
try {
|
|
2142
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2143
|
+
wasm.plaintext_toObject(retptr, this.__wbg_ptr);
|
|
2144
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
2145
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
2146
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
2147
|
+
if (r2) {
|
|
2148
|
+
throw takeObject(r1);
|
|
2149
|
+
}
|
|
2150
|
+
return takeObject(r0);
|
|
2151
|
+
} finally {
|
|
2152
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
const PrivateKeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2158
|
+
? { register: () => {}, unregister: () => {} }
|
|
2159
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_privatekey_free(ptr >>> 0));
|
|
2160
|
+
/**
|
|
2161
|
+
* Private key of an Aleo account
|
|
2162
|
+
*/
|
|
2163
|
+
class PrivateKey {
|
|
2164
|
+
|
|
2165
|
+
static __wrap(ptr) {
|
|
2166
|
+
ptr = ptr >>> 0;
|
|
2167
|
+
const obj = Object.create(PrivateKey.prototype);
|
|
2168
|
+
obj.__wbg_ptr = ptr;
|
|
2169
|
+
PrivateKeyFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2170
|
+
return obj;
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
__destroy_into_raw() {
|
|
2174
|
+
const ptr = this.__wbg_ptr;
|
|
2175
|
+
this.__wbg_ptr = 0;
|
|
2176
|
+
PrivateKeyFinalization.unregister(this);
|
|
2177
|
+
return ptr;
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
free() {
|
|
2181
|
+
const ptr = this.__destroy_into_raw();
|
|
2182
|
+
wasm.__wbg_privatekey_free(ptr);
|
|
2183
|
+
}
|
|
2184
|
+
/**
|
|
2185
|
+
* Generate a new private key using a cryptographically secure random number generator
|
|
2186
|
+
*
|
|
2187
|
+
* @returns {PrivateKey}
|
|
2188
|
+
*/
|
|
2189
|
+
constructor() {
|
|
2190
|
+
const ret = wasm.privatekey_new();
|
|
2191
|
+
this.__wbg_ptr = ret >>> 0;
|
|
2192
|
+
return this;
|
|
2193
|
+
}
|
|
2194
|
+
/**
|
|
2195
|
+
* Get a private key from a series of unchecked bytes
|
|
2196
|
+
*
|
|
2197
|
+
* @param {Uint8Array} seed Unchecked 32 byte long Uint8Array acting as the seed for the private key
|
|
2198
|
+
* @returns {PrivateKey}
|
|
2199
|
+
* @param {Uint8Array} seed
|
|
2200
|
+
* @returns {PrivateKey}
|
|
2201
|
+
*/
|
|
2202
|
+
static from_seed_unchecked(seed) {
|
|
2203
|
+
const ptr0 = passArray8ToWasm0(seed, wasm.__wbindgen_malloc);
|
|
2204
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2205
|
+
const ret = wasm.privatekey_from_seed_unchecked(ptr0, len0);
|
|
2206
|
+
return PrivateKey.__wrap(ret);
|
|
2207
|
+
}
|
|
2208
|
+
/**
|
|
2209
|
+
* Get a private key from a string representation of a private key
|
|
2210
|
+
*
|
|
2211
|
+
* @param {string} seed String representation of a private key
|
|
2212
|
+
* @returns {PrivateKey}
|
|
2213
|
+
* @param {string} private_key
|
|
2214
|
+
* @returns {PrivateKey}
|
|
2215
|
+
*/
|
|
2216
|
+
static from_string(private_key) {
|
|
2217
|
+
try {
|
|
2218
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2219
|
+
const ptr0 = passStringToWasm0(private_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2220
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2221
|
+
wasm.privatekey_from_string(retptr, ptr0, len0);
|
|
2222
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
2223
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
2224
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
2225
|
+
if (r2) {
|
|
2226
|
+
throw takeObject(r1);
|
|
2227
|
+
}
|
|
2228
|
+
return PrivateKey.__wrap(r0);
|
|
2229
|
+
} finally {
|
|
2230
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
/**
|
|
2234
|
+
* Get a string representation of the private key. This function should be used very carefully
|
|
2235
|
+
* as it exposes the private key plaintext
|
|
2236
|
+
*
|
|
2237
|
+
* @returns {string} String representation of a private key
|
|
2238
|
+
* @returns {string}
|
|
2239
|
+
*/
|
|
2240
|
+
to_string() {
|
|
2241
|
+
let deferred1_0;
|
|
2242
|
+
let deferred1_1;
|
|
2243
|
+
try {
|
|
2244
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2245
|
+
wasm.privatekey_to_string(retptr, this.__wbg_ptr);
|
|
2246
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
2247
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
2248
|
+
deferred1_0 = r0;
|
|
2249
|
+
deferred1_1 = r1;
|
|
2250
|
+
return getStringFromWasm0(r0, r1);
|
|
2251
|
+
} finally {
|
|
2252
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2253
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
/**
|
|
2257
|
+
* Get the view key corresponding to the private key
|
|
2258
|
+
*
|
|
2259
|
+
* @returns {ViewKey}
|
|
2260
|
+
* @returns {ViewKey}
|
|
2261
|
+
*/
|
|
2262
|
+
to_view_key() {
|
|
2263
|
+
const ret = wasm.privatekey_to_view_key(this.__wbg_ptr);
|
|
1313
2264
|
return ViewKey.__wrap(ret);
|
|
1314
2265
|
}
|
|
1315
2266
|
/**
|
|
@@ -1511,7 +2462,7 @@ class PrivateKeyCiphertext {
|
|
|
1511
2462
|
let deferred1_1;
|
|
1512
2463
|
try {
|
|
1513
2464
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1514
|
-
wasm.
|
|
2465
|
+
wasm.ciphertext_toString(retptr, this.__wbg_ptr);
|
|
1515
2466
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1516
2467
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1517
2468
|
deferred1_0 = r0;
|
|
@@ -3009,6 +3960,35 @@ class RecordCiphertext {
|
|
|
3009
3960
|
const ret = wasm.recordciphertext_isOwner(this.__wbg_ptr, view_key.__wbg_ptr);
|
|
3010
3961
|
return ret !== 0;
|
|
3011
3962
|
}
|
|
3963
|
+
/**
|
|
3964
|
+
* Get the tag of the record using the graph key.
|
|
3965
|
+
*
|
|
3966
|
+
* @param {GraphKey} graph key of the account associatd with the record.
|
|
3967
|
+
* @param {Field} commitment of the record.
|
|
3968
|
+
*
|
|
3969
|
+
* @returns {Field} tag of the record.
|
|
3970
|
+
* @param {GraphKey} graph_key
|
|
3971
|
+
* @param {Field} commitment
|
|
3972
|
+
* @returns {Field}
|
|
3973
|
+
*/
|
|
3974
|
+
static tag(graph_key, commitment) {
|
|
3975
|
+
try {
|
|
3976
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3977
|
+
_assertClass(graph_key, GraphKey);
|
|
3978
|
+
_assertClass(commitment, Field);
|
|
3979
|
+
var ptr0 = commitment.__destroy_into_raw();
|
|
3980
|
+
wasm.recordciphertext_tag(retptr, graph_key.__wbg_ptr, ptr0);
|
|
3981
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
3982
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
3983
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
3984
|
+
if (r2) {
|
|
3985
|
+
throw takeObject(r1);
|
|
3986
|
+
}
|
|
3987
|
+
return Field.__wrap(r0);
|
|
3988
|
+
} finally {
|
|
3989
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3990
|
+
}
|
|
3991
|
+
}
|
|
3012
3992
|
}
|
|
3013
3993
|
|
|
3014
3994
|
const RecordPlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -3088,40 +4068,147 @@ class RecordPlaintext {
|
|
|
3088
4068
|
}
|
|
3089
4069
|
}
|
|
3090
4070
|
/**
|
|
3091
|
-
*
|
|
3092
|
-
*
|
|
3093
|
-
* @returns {string} String representation of the record plaintext
|
|
3094
|
-
* @returns {string}
|
|
4071
|
+
* @param {string} input
|
|
4072
|
+
* @returns {Plaintext}
|
|
3095
4073
|
*/
|
|
3096
|
-
|
|
3097
|
-
let deferred1_0;
|
|
3098
|
-
let deferred1_1;
|
|
4074
|
+
getMember(input) {
|
|
3099
4075
|
try {
|
|
3100
4076
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3101
|
-
wasm.
|
|
4077
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4078
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4079
|
+
wasm.recordplaintext_getMember(retptr, this.__wbg_ptr, ptr0, len0);
|
|
3102
4080
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
3103
4081
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
4082
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
4083
|
+
if (r2) {
|
|
4084
|
+
throw takeObject(r1);
|
|
4085
|
+
}
|
|
4086
|
+
return Plaintext.__wrap(r0);
|
|
3107
4087
|
} finally {
|
|
3108
4088
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3109
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
3110
4089
|
}
|
|
3111
4090
|
}
|
|
3112
4091
|
/**
|
|
3113
|
-
*
|
|
3114
|
-
*
|
|
3115
|
-
* @returns {u64} Amount of microcredits in the record
|
|
3116
|
-
* @returns {bigint}
|
|
4092
|
+
* Get the owner of the record.
|
|
4093
|
+
* @returns {Address}
|
|
3117
4094
|
*/
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
4095
|
+
owner() {
|
|
4096
|
+
try {
|
|
4097
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4098
|
+
wasm.recordplaintext_owner(retptr, this.__wbg_ptr);
|
|
4099
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
4100
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
4101
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
4102
|
+
if (r2) {
|
|
4103
|
+
throw takeObject(r1);
|
|
4104
|
+
}
|
|
4105
|
+
return Address.__wrap(r0);
|
|
4106
|
+
} finally {
|
|
4107
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4108
|
+
}
|
|
4109
|
+
}
|
|
4110
|
+
/**
|
|
4111
|
+
* Get a representation of a record as a javascript object for usage in client side
|
|
4112
|
+
* computations. Note that this is not a reversible operation and exists for the convenience
|
|
4113
|
+
* of discovering and using properties of the record.
|
|
4114
|
+
*
|
|
4115
|
+
* The conversion guide is as follows:
|
|
4116
|
+
* - u8, u16, u32, i8, i16 i32 --> Number
|
|
4117
|
+
* - u64, u128, i64, i128 --> BigInt
|
|
4118
|
+
* - Address, Field, Group, Scalar --> String.
|
|
4119
|
+
*
|
|
4120
|
+
* Address, Field, Group, and Scalar will all be converted to their bech32 string
|
|
4121
|
+
* representation. These string representations can be converted back to their respective wasm
|
|
4122
|
+
* types using the fromString method on the Address, Field, Group, and Scalar objects in this
|
|
4123
|
+
* library.
|
|
4124
|
+
*
|
|
4125
|
+
* @example
|
|
4126
|
+
* # Create a wasm record from a record string.
|
|
4127
|
+
* let record_plaintext_wasm = RecordPlainext.from_string("{
|
|
4128
|
+
* owner: aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48.private,
|
|
4129
|
+
* metadata: {
|
|
4130
|
+
* player1: aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48.private,
|
|
4131
|
+
* player2: aleo1dreuxnmg9cny8ee9v2u0wr4v4affnwm09u2pytfwz0f2en2shgqsdsfjn6.private,
|
|
4132
|
+
* nonce: 660310649780728486489183263981322848354071976582883879926426319832534836534field.private
|
|
4133
|
+
* },
|
|
4134
|
+
* id: 1953278585719525811355617404139099418855053112960441725284031425961000152405field.private,
|
|
4135
|
+
* positions: 50794271u64.private,
|
|
4136
|
+
* attempts: 0u64.private,
|
|
4137
|
+
* hits: 0u64.private,
|
|
4138
|
+
* _nonce: 5668100912391182624073500093436664635767788874314097667746354181784048204413group.public
|
|
4139
|
+
* }");
|
|
4140
|
+
*
|
|
4141
|
+
* let expected_object = {
|
|
4142
|
+
* owner: "aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48",
|
|
4143
|
+
* metadata: {
|
|
4144
|
+
* player1: "aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48",
|
|
4145
|
+
* player2: "aleo1dreuxnmg9cny8ee9v2u0wr4v4affnwm09u2pytfwz0f2en2shgqsdsfjn6",
|
|
4146
|
+
* nonce: "660310649780728486489183263981322848354071976582883879926426319832534836534field"
|
|
4147
|
+
* },
|
|
4148
|
+
* id: "1953278585719525811355617404139099418855053112960441725284031425961000152405field",
|
|
4149
|
+
* positions: 50794271,
|
|
4150
|
+
* attempts: 0,
|
|
4151
|
+
* hits: 0,
|
|
4152
|
+
* _nonce: "5668100912391182624073500093436664635767788874314097667746354181784048204413group"
|
|
4153
|
+
* };
|
|
4154
|
+
*
|
|
4155
|
+
* # Create the expected object
|
|
4156
|
+
* let record_plaintext_object = record_plaintext_wasm.to_js_object();
|
|
4157
|
+
* assert(JSON.stringify(record_plaintext_object) == JSON.stringify(expected_object));
|
|
4158
|
+
*
|
|
4159
|
+
* @returns {Object} Javascript object representation of the record
|
|
4160
|
+
* @returns {object}
|
|
4161
|
+
*/
|
|
4162
|
+
toJsObject() {
|
|
4163
|
+
try {
|
|
4164
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4165
|
+
wasm.recordplaintext_toJsObject(retptr, this.__wbg_ptr);
|
|
4166
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
4167
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
4168
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
4169
|
+
if (r2) {
|
|
4170
|
+
throw takeObject(r1);
|
|
4171
|
+
}
|
|
4172
|
+
return takeObject(r0);
|
|
4173
|
+
} finally {
|
|
4174
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4175
|
+
}
|
|
4176
|
+
}
|
|
4177
|
+
/**
|
|
4178
|
+
* Returns the record plaintext string
|
|
4179
|
+
*
|
|
4180
|
+
* @returns {string} String representation of the record plaintext
|
|
4181
|
+
* @returns {string}
|
|
4182
|
+
*/
|
|
4183
|
+
toString() {
|
|
4184
|
+
let deferred1_0;
|
|
4185
|
+
let deferred1_1;
|
|
4186
|
+
try {
|
|
4187
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4188
|
+
wasm.recordplaintext_toString(retptr, this.__wbg_ptr);
|
|
4189
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
4190
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
4191
|
+
deferred1_0 = r0;
|
|
4192
|
+
deferred1_1 = r1;
|
|
4193
|
+
return getStringFromWasm0(r0, r1);
|
|
4194
|
+
} finally {
|
|
4195
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4196
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
4197
|
+
}
|
|
4198
|
+
}
|
|
4199
|
+
/**
|
|
4200
|
+
* Returns the amount of microcredits in the record
|
|
4201
|
+
*
|
|
4202
|
+
* @returns {u64} Amount of microcredits in the record
|
|
4203
|
+
* @returns {bigint}
|
|
4204
|
+
*/
|
|
4205
|
+
microcredits() {
|
|
4206
|
+
const ret = wasm.recordplaintext_microcredits(this.__wbg_ptr);
|
|
4207
|
+
return BigInt.asUintN(64, ret);
|
|
4208
|
+
}
|
|
4209
|
+
/**
|
|
4210
|
+
* Returns the nonce of the record. This can be used to uniquely identify a record.
|
|
4211
|
+
*
|
|
3125
4212
|
* @returns {string} Nonce of the record
|
|
3126
4213
|
* @returns {string}
|
|
3127
4214
|
*/
|
|
@@ -3147,6 +4234,7 @@ class RecordPlaintext {
|
|
|
3147
4234
|
* @param {PrivateKey} private_key Private key of the account that owns the record
|
|
3148
4235
|
* @param {string} program_id Program ID of the program that the record is associated with
|
|
3149
4236
|
* @param {string} record_name Name of the record
|
|
4237
|
+
*
|
|
3150
4238
|
* @returns {string} Serial number of the record
|
|
3151
4239
|
* @param {PrivateKey} private_key
|
|
3152
4240
|
* @param {string} program_id
|
|
@@ -3182,6 +4270,209 @@ class RecordPlaintext {
|
|
|
3182
4270
|
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
3183
4271
|
}
|
|
3184
4272
|
}
|
|
4273
|
+
/**
|
|
4274
|
+
* Get the tag of the record using the graph key.
|
|
4275
|
+
* @param {GraphKey} graph_key
|
|
4276
|
+
* @param {Field} commitment
|
|
4277
|
+
* @returns {Field}
|
|
4278
|
+
*/
|
|
4279
|
+
tag(graph_key, commitment) {
|
|
4280
|
+
try {
|
|
4281
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4282
|
+
_assertClass(graph_key, GraphKey);
|
|
4283
|
+
_assertClass(commitment, Field);
|
|
4284
|
+
var ptr0 = commitment.__destroy_into_raw();
|
|
4285
|
+
wasm.recordplaintext_tag(retptr, this.__wbg_ptr, graph_key.__wbg_ptr, ptr0);
|
|
4286
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
4287
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
4288
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
4289
|
+
if (r2) {
|
|
4290
|
+
throw takeObject(r1);
|
|
4291
|
+
}
|
|
4292
|
+
return Field.__wrap(r0);
|
|
4293
|
+
} finally {
|
|
4294
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4295
|
+
}
|
|
4296
|
+
}
|
|
4297
|
+
}
|
|
4298
|
+
|
|
4299
|
+
const ScalarFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4300
|
+
? { register: () => {}, unregister: () => {} }
|
|
4301
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_scalar_free(ptr >>> 0));
|
|
4302
|
+
/**
|
|
4303
|
+
* Scalar field element.
|
|
4304
|
+
*/
|
|
4305
|
+
class Scalar {
|
|
4306
|
+
|
|
4307
|
+
static __wrap(ptr) {
|
|
4308
|
+
ptr = ptr >>> 0;
|
|
4309
|
+
const obj = Object.create(Scalar.prototype);
|
|
4310
|
+
obj.__wbg_ptr = ptr;
|
|
4311
|
+
ScalarFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
4312
|
+
return obj;
|
|
4313
|
+
}
|
|
4314
|
+
|
|
4315
|
+
__destroy_into_raw() {
|
|
4316
|
+
const ptr = this.__wbg_ptr;
|
|
4317
|
+
this.__wbg_ptr = 0;
|
|
4318
|
+
ScalarFinalization.unregister(this);
|
|
4319
|
+
return ptr;
|
|
4320
|
+
}
|
|
4321
|
+
|
|
4322
|
+
free() {
|
|
4323
|
+
const ptr = this.__destroy_into_raw();
|
|
4324
|
+
wasm.__wbg_scalar_free(ptr);
|
|
4325
|
+
}
|
|
4326
|
+
/**
|
|
4327
|
+
* Returns the string representation of the group.
|
|
4328
|
+
* @returns {string}
|
|
4329
|
+
*/
|
|
4330
|
+
toString() {
|
|
4331
|
+
let deferred1_0;
|
|
4332
|
+
let deferred1_1;
|
|
4333
|
+
try {
|
|
4334
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4335
|
+
wasm.scalar_toString(retptr, this.__wbg_ptr);
|
|
4336
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
4337
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
4338
|
+
deferred1_0 = r0;
|
|
4339
|
+
deferred1_1 = r1;
|
|
4340
|
+
return getStringFromWasm0(r0, r1);
|
|
4341
|
+
} finally {
|
|
4342
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4343
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
/**
|
|
4347
|
+
* Create a plaintext element from a group element.
|
|
4348
|
+
* @returns {Plaintext}
|
|
4349
|
+
*/
|
|
4350
|
+
toPlaintext() {
|
|
4351
|
+
const ret = wasm.scalar_toPlaintext(this.__wbg_ptr);
|
|
4352
|
+
return Plaintext.__wrap(ret);
|
|
4353
|
+
}
|
|
4354
|
+
/**
|
|
4355
|
+
* Creates a group object from a string representation of a group.
|
|
4356
|
+
* @param {string} group
|
|
4357
|
+
* @returns {Scalar}
|
|
4358
|
+
*/
|
|
4359
|
+
static fromString(group) {
|
|
4360
|
+
try {
|
|
4361
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4362
|
+
const ptr0 = passStringToWasm0(group, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4363
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4364
|
+
wasm.scalar_fromString(retptr, ptr0, len0);
|
|
4365
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
4366
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
4367
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
4368
|
+
if (r2) {
|
|
4369
|
+
throw takeObject(r1);
|
|
4370
|
+
}
|
|
4371
|
+
return Scalar.__wrap(r0);
|
|
4372
|
+
} finally {
|
|
4373
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4374
|
+
}
|
|
4375
|
+
}
|
|
4376
|
+
/**
|
|
4377
|
+
* Generate a random group element.
|
|
4378
|
+
* @returns {Scalar}
|
|
4379
|
+
*/
|
|
4380
|
+
static random() {
|
|
4381
|
+
const ret = wasm.scalar_random();
|
|
4382
|
+
return Scalar.__wrap(ret);
|
|
4383
|
+
}
|
|
4384
|
+
/**
|
|
4385
|
+
* Add two scalar elements.
|
|
4386
|
+
* @param {Scalar} other
|
|
4387
|
+
* @returns {Scalar}
|
|
4388
|
+
*/
|
|
4389
|
+
add(other) {
|
|
4390
|
+
_assertClass(other, Scalar);
|
|
4391
|
+
const ret = wasm.scalar_add(this.__wbg_ptr, other.__wbg_ptr);
|
|
4392
|
+
return Scalar.__wrap(ret);
|
|
4393
|
+
}
|
|
4394
|
+
/**
|
|
4395
|
+
* Subtract two scalar elements.
|
|
4396
|
+
* @param {Scalar} other
|
|
4397
|
+
* @returns {Scalar}
|
|
4398
|
+
*/
|
|
4399
|
+
subtract(other) {
|
|
4400
|
+
_assertClass(other, Scalar);
|
|
4401
|
+
const ret = wasm.scalar_subtract(this.__wbg_ptr, other.__wbg_ptr);
|
|
4402
|
+
return Scalar.__wrap(ret);
|
|
4403
|
+
}
|
|
4404
|
+
/**
|
|
4405
|
+
* Multiply two scalar elements.
|
|
4406
|
+
* @param {Scalar} other
|
|
4407
|
+
* @returns {Scalar}
|
|
4408
|
+
*/
|
|
4409
|
+
multiply(other) {
|
|
4410
|
+
_assertClass(other, Scalar);
|
|
4411
|
+
const ret = wasm.scalar_multiply(this.__wbg_ptr, other.__wbg_ptr);
|
|
4412
|
+
return Scalar.__wrap(ret);
|
|
4413
|
+
}
|
|
4414
|
+
/**
|
|
4415
|
+
* Divide two scalar elements.
|
|
4416
|
+
* @param {Scalar} other
|
|
4417
|
+
* @returns {Scalar}
|
|
4418
|
+
*/
|
|
4419
|
+
divide(other) {
|
|
4420
|
+
_assertClass(other, Scalar);
|
|
4421
|
+
const ret = wasm.scalar_divide(this.__wbg_ptr, other.__wbg_ptr);
|
|
4422
|
+
return Scalar.__wrap(ret);
|
|
4423
|
+
}
|
|
4424
|
+
/**
|
|
4425
|
+
* Double the scalar element.
|
|
4426
|
+
* @returns {Scalar}
|
|
4427
|
+
*/
|
|
4428
|
+
double() {
|
|
4429
|
+
const ret = wasm.scalar_double(this.__wbg_ptr);
|
|
4430
|
+
return Scalar.__wrap(ret);
|
|
4431
|
+
}
|
|
4432
|
+
/**
|
|
4433
|
+
* Power of a scalar element.
|
|
4434
|
+
* @param {Scalar} other
|
|
4435
|
+
* @returns {Scalar}
|
|
4436
|
+
*/
|
|
4437
|
+
pow(other) {
|
|
4438
|
+
_assertClass(other, Scalar);
|
|
4439
|
+
const ret = wasm.scalar_pow(this.__wbg_ptr, other.__wbg_ptr);
|
|
4440
|
+
return Scalar.__wrap(ret);
|
|
4441
|
+
}
|
|
4442
|
+
/**
|
|
4443
|
+
* Invert the scalar element.
|
|
4444
|
+
* @returns {Scalar}
|
|
4445
|
+
*/
|
|
4446
|
+
inverse() {
|
|
4447
|
+
const ret = wasm.scalar_inverse(this.__wbg_ptr);
|
|
4448
|
+
return Scalar.__wrap(ret);
|
|
4449
|
+
}
|
|
4450
|
+
/**
|
|
4451
|
+
* Creates a one valued element of the scalar field.
|
|
4452
|
+
* @returns {Scalar}
|
|
4453
|
+
*/
|
|
4454
|
+
static one() {
|
|
4455
|
+
const ret = wasm.scalar_one();
|
|
4456
|
+
return Scalar.__wrap(ret);
|
|
4457
|
+
}
|
|
4458
|
+
/**
|
|
4459
|
+
* Creates a zero valued element of the scalar field
|
|
4460
|
+
* @returns {Scalar}
|
|
4461
|
+
*/
|
|
4462
|
+
static zero() {
|
|
4463
|
+
const ret = wasm.field_zero();
|
|
4464
|
+
return Scalar.__wrap(ret);
|
|
4465
|
+
}
|
|
4466
|
+
/**
|
|
4467
|
+
* Check if one scalar element equals another.
|
|
4468
|
+
* @param {Scalar} other
|
|
4469
|
+
* @returns {boolean}
|
|
4470
|
+
*/
|
|
4471
|
+
equals(other) {
|
|
4472
|
+
_assertClass(other, Scalar);
|
|
4473
|
+
const ret = wasm.field_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
4474
|
+
return ret !== 0;
|
|
4475
|
+
}
|
|
3185
4476
|
}
|
|
3186
4477
|
|
|
3187
4478
|
const SignatureFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -3229,6 +4520,32 @@ class Signature {
|
|
|
3229
4520
|
return Signature.__wrap(ret);
|
|
3230
4521
|
}
|
|
3231
4522
|
/**
|
|
4523
|
+
* Get an address from a signature.
|
|
4524
|
+
*
|
|
4525
|
+
* @returns {Address} Address object
|
|
4526
|
+
* @returns {Address}
|
|
4527
|
+
*/
|
|
4528
|
+
to_address() {
|
|
4529
|
+
const ret = wasm.signature_to_address(this.__wbg_ptr);
|
|
4530
|
+
return Address.__wrap(ret);
|
|
4531
|
+
}
|
|
4532
|
+
/**
|
|
4533
|
+
* Get the challenge of a signature.
|
|
4534
|
+
* @returns {Scalar}
|
|
4535
|
+
*/
|
|
4536
|
+
challenge() {
|
|
4537
|
+
const ret = wasm.graphkey_sk_tag(this.__wbg_ptr);
|
|
4538
|
+
return Scalar.__wrap(ret);
|
|
4539
|
+
}
|
|
4540
|
+
/**
|
|
4541
|
+
* Get the response of a signature.
|
|
4542
|
+
* @returns {Scalar}
|
|
4543
|
+
*/
|
|
4544
|
+
response() {
|
|
4545
|
+
const ret = wasm.signature_response(this.__wbg_ptr);
|
|
4546
|
+
return Scalar.__wrap(ret);
|
|
4547
|
+
}
|
|
4548
|
+
/**
|
|
3232
4549
|
* Verify a signature of a message with an address
|
|
3233
4550
|
*
|
|
3234
4551
|
* @param {Address} address The address to verify the signature with
|
|
@@ -3253,24 +4570,352 @@ class Signature {
|
|
|
3253
4570
|
* @param {string} signature
|
|
3254
4571
|
* @returns {Signature}
|
|
3255
4572
|
*/
|
|
3256
|
-
static from_string(signature) {
|
|
3257
|
-
const ptr0 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3258
|
-
const len0 = WASM_VECTOR_LEN;
|
|
3259
|
-
const ret = wasm.signature_from_string(ptr0, len0);
|
|
3260
|
-
return Signature.__wrap(ret);
|
|
4573
|
+
static from_string(signature) {
|
|
4574
|
+
const ptr0 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4575
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4576
|
+
const ret = wasm.signature_from_string(ptr0, len0);
|
|
4577
|
+
return Signature.__wrap(ret);
|
|
4578
|
+
}
|
|
4579
|
+
/**
|
|
4580
|
+
* Get a string representation of a signature
|
|
4581
|
+
*
|
|
4582
|
+
* @returns {string} String representation of a signature
|
|
4583
|
+
* @returns {string}
|
|
4584
|
+
*/
|
|
4585
|
+
to_string() {
|
|
4586
|
+
let deferred1_0;
|
|
4587
|
+
let deferred1_1;
|
|
4588
|
+
try {
|
|
4589
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4590
|
+
wasm.signature_to_string(retptr, this.__wbg_ptr);
|
|
4591
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
4592
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
4593
|
+
deferred1_0 = r0;
|
|
4594
|
+
deferred1_1 = r1;
|
|
4595
|
+
return getStringFromWasm0(r0, r1);
|
|
4596
|
+
} finally {
|
|
4597
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4598
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
4599
|
+
}
|
|
4600
|
+
}
|
|
4601
|
+
}
|
|
4602
|
+
|
|
4603
|
+
const TransactionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4604
|
+
? { register: () => {}, unregister: () => {} }
|
|
4605
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_transaction_free(ptr >>> 0));
|
|
4606
|
+
/**
|
|
4607
|
+
* Webassembly Representation of an Aleo transaction
|
|
4608
|
+
*
|
|
4609
|
+
* This object is created when generating an on-chain function deployment or execution and is the
|
|
4610
|
+
* object that should be submitted to the Aleo Network in order to deploy or execute a function.
|
|
4611
|
+
*/
|
|
4612
|
+
class Transaction {
|
|
4613
|
+
|
|
4614
|
+
static __wrap(ptr) {
|
|
4615
|
+
ptr = ptr >>> 0;
|
|
4616
|
+
const obj = Object.create(Transaction.prototype);
|
|
4617
|
+
obj.__wbg_ptr = ptr;
|
|
4618
|
+
TransactionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
4619
|
+
return obj;
|
|
4620
|
+
}
|
|
4621
|
+
|
|
4622
|
+
__destroy_into_raw() {
|
|
4623
|
+
const ptr = this.__wbg_ptr;
|
|
4624
|
+
this.__wbg_ptr = 0;
|
|
4625
|
+
TransactionFinalization.unregister(this);
|
|
4626
|
+
return ptr;
|
|
4627
|
+
}
|
|
4628
|
+
|
|
4629
|
+
free() {
|
|
4630
|
+
const ptr = this.__destroy_into_raw();
|
|
4631
|
+
wasm.__wbg_transaction_free(ptr);
|
|
4632
|
+
}
|
|
4633
|
+
/**
|
|
4634
|
+
* Create a transaction from a string
|
|
4635
|
+
*
|
|
4636
|
+
* @param {string} transaction String representation of a transaction
|
|
4637
|
+
* @returns {Transaction}
|
|
4638
|
+
* @param {string} transaction
|
|
4639
|
+
* @returns {Transaction}
|
|
4640
|
+
*/
|
|
4641
|
+
static fromString(transaction) {
|
|
4642
|
+
try {
|
|
4643
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4644
|
+
const ptr0 = passStringToWasm0(transaction, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4645
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4646
|
+
wasm.transaction_fromString(retptr, ptr0, len0);
|
|
4647
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
4648
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
4649
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
4650
|
+
if (r2) {
|
|
4651
|
+
throw takeObject(r1);
|
|
4652
|
+
}
|
|
4653
|
+
return Transaction.__wrap(r0);
|
|
4654
|
+
} finally {
|
|
4655
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4656
|
+
}
|
|
4657
|
+
}
|
|
4658
|
+
/**
|
|
4659
|
+
* Create a transaction from a Uint8Array of left endian bytes.
|
|
4660
|
+
*
|
|
4661
|
+
* @param {Uint8Array} Uint8Array of left endian bytes encoding a Transaction.
|
|
4662
|
+
* @returns {Transaction}
|
|
4663
|
+
* @param {Uint8Array} bytes
|
|
4664
|
+
* @returns {Transaction}
|
|
4665
|
+
*/
|
|
4666
|
+
static fromBytesLe(bytes) {
|
|
4667
|
+
try {
|
|
4668
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4669
|
+
wasm.transaction_fromBytesLe(retptr, addHeapObject(bytes));
|
|
4670
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
4671
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
4672
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
4673
|
+
if (r2) {
|
|
4674
|
+
throw takeObject(r1);
|
|
4675
|
+
}
|
|
4676
|
+
return Transaction.__wrap(r0);
|
|
4677
|
+
} finally {
|
|
4678
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4679
|
+
}
|
|
4680
|
+
}
|
|
4681
|
+
/**
|
|
4682
|
+
* Get the transaction as a string. If you want to submit this transaction to the Aleo Network
|
|
4683
|
+
* this function will create the string that should be submitted in the `POST` data.
|
|
4684
|
+
*
|
|
4685
|
+
* @returns {string} String representation of the transaction
|
|
4686
|
+
* @returns {string}
|
|
4687
|
+
*/
|
|
4688
|
+
toString() {
|
|
4689
|
+
let deferred1_0;
|
|
4690
|
+
let deferred1_1;
|
|
4691
|
+
try {
|
|
4692
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4693
|
+
wasm.transaction_toString(retptr, this.__wbg_ptr);
|
|
4694
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
4695
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
4696
|
+
deferred1_0 = r0;
|
|
4697
|
+
deferred1_1 = r1;
|
|
4698
|
+
return getStringFromWasm0(r0, r1);
|
|
4699
|
+
} finally {
|
|
4700
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4701
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
4702
|
+
}
|
|
4703
|
+
}
|
|
4704
|
+
/**
|
|
4705
|
+
* Get the transaction as a Uint8Array of left endian bytes.
|
|
4706
|
+
*
|
|
4707
|
+
* @returns {Uint8Array} Uint8Array representation of the transaction
|
|
4708
|
+
* @returns {Uint8Array}
|
|
4709
|
+
*/
|
|
4710
|
+
toBytesLe() {
|
|
4711
|
+
try {
|
|
4712
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4713
|
+
wasm.transaction_toBytesLe(retptr, this.__wbg_ptr);
|
|
4714
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
4715
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
4716
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
4717
|
+
if (r2) {
|
|
4718
|
+
throw takeObject(r1);
|
|
4719
|
+
}
|
|
4720
|
+
return takeObject(r0);
|
|
4721
|
+
} finally {
|
|
4722
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4723
|
+
}
|
|
4724
|
+
}
|
|
4725
|
+
/**
|
|
4726
|
+
* Returns true if the transaction contains the given serial number.
|
|
4727
|
+
*
|
|
4728
|
+
* @param {boolean} True if the transaction contains the given serial number.
|
|
4729
|
+
* @param {Field} serial_number
|
|
4730
|
+
* @returns {boolean}
|
|
4731
|
+
*/
|
|
4732
|
+
constainsSerialNumber(serial_number) {
|
|
4733
|
+
_assertClass(serial_number, Field);
|
|
4734
|
+
const ret = wasm.transaction_constainsSerialNumber(this.__wbg_ptr, serial_number.__wbg_ptr);
|
|
4735
|
+
return ret !== 0;
|
|
4736
|
+
}
|
|
4737
|
+
/**
|
|
4738
|
+
* Returns true if the transaction contains the given commitment.
|
|
4739
|
+
*
|
|
4740
|
+
* @param {boolean} True if the transaction contains the given commitment.
|
|
4741
|
+
* @param {Field} commitment
|
|
4742
|
+
* @returns {boolean}
|
|
4743
|
+
*/
|
|
4744
|
+
constainsCommitment(commitment) {
|
|
4745
|
+
_assertClass(commitment, Field);
|
|
4746
|
+
const ret = wasm.transaction_constainsCommitment(this.__wbg_ptr, commitment.__wbg_ptr);
|
|
4747
|
+
return ret !== 0;
|
|
4748
|
+
}
|
|
4749
|
+
/**
|
|
4750
|
+
* Find a record in the transaction by the record's commitment.
|
|
4751
|
+
* @param {Field} commitment
|
|
4752
|
+
* @returns {RecordCiphertext | undefined}
|
|
4753
|
+
*/
|
|
4754
|
+
findRecord(commitment) {
|
|
4755
|
+
_assertClass(commitment, Field);
|
|
4756
|
+
const ret = wasm.transaction_findRecord(this.__wbg_ptr, commitment.__wbg_ptr);
|
|
4757
|
+
return ret === 0 ? undefined : RecordCiphertext.__wrap(ret);
|
|
4758
|
+
}
|
|
4759
|
+
/**
|
|
4760
|
+
* Returns the transaction's base fee.
|
|
4761
|
+
* @returns {bigint}
|
|
4762
|
+
*/
|
|
4763
|
+
baseFeeAmount() {
|
|
4764
|
+
const ret = wasm.transaction_baseFeeAmount(this.__wbg_ptr);
|
|
4765
|
+
return BigInt.asUintN(64, ret);
|
|
4766
|
+
}
|
|
4767
|
+
/**
|
|
4768
|
+
* Returns the transaction's total fee.
|
|
4769
|
+
* @returns {bigint}
|
|
4770
|
+
*/
|
|
4771
|
+
feeAmount() {
|
|
4772
|
+
const ret = wasm.transaction_feeAmount(this.__wbg_ptr);
|
|
4773
|
+
return BigInt.asUintN(64, ret);
|
|
4774
|
+
}
|
|
4775
|
+
/**
|
|
4776
|
+
* Returns the transaction's priority fee.
|
|
4777
|
+
*
|
|
4778
|
+
* returns {bigint} The transaction's priority fee.
|
|
4779
|
+
* @returns {bigint}
|
|
4780
|
+
*/
|
|
4781
|
+
priorityFeeAmount() {
|
|
4782
|
+
const ret = wasm.transaction_priorityFeeAmount(this.__wbg_ptr);
|
|
4783
|
+
return BigInt.asUintN(64, ret);
|
|
4784
|
+
}
|
|
4785
|
+
/**
|
|
4786
|
+
* Returns true if the transaction is a deployment transaction.
|
|
4787
|
+
*
|
|
4788
|
+
* @returns {boolean} True if the transaction is a deployment transaction
|
|
4789
|
+
* @returns {boolean}
|
|
4790
|
+
*/
|
|
4791
|
+
isDeploy() {
|
|
4792
|
+
const ret = wasm.transaction_isDeploy(this.__wbg_ptr);
|
|
4793
|
+
return ret !== 0;
|
|
4794
|
+
}
|
|
4795
|
+
/**
|
|
4796
|
+
* Returns true if the transaction is an execution transaction.
|
|
4797
|
+
*
|
|
4798
|
+
* @returns {boolean} True if the transaction is an execution transaction
|
|
4799
|
+
* @returns {boolean}
|
|
4800
|
+
*/
|
|
4801
|
+
isExecute() {
|
|
4802
|
+
const ret = wasm.transaction_isExecute(this.__wbg_ptr);
|
|
4803
|
+
return ret !== 0;
|
|
4804
|
+
}
|
|
4805
|
+
/**
|
|
4806
|
+
* Returns true if the transaction is a fee transaction.
|
|
4807
|
+
*
|
|
4808
|
+
* @returns {boolean} True if the transaction is a fee transaction
|
|
4809
|
+
* @returns {boolean}
|
|
4810
|
+
*/
|
|
4811
|
+
isFee() {
|
|
4812
|
+
const ret = wasm.transaction_isFee(this.__wbg_ptr);
|
|
4813
|
+
return ret !== 0;
|
|
4814
|
+
}
|
|
4815
|
+
/**
|
|
4816
|
+
* Returns the program deployed within the transaction if the transaction is a deployment
|
|
4817
|
+
* transaction.
|
|
4818
|
+
*
|
|
4819
|
+
* @returns {Program | undefined} The program deployed within the transaction.
|
|
4820
|
+
* @returns {Program | undefined}
|
|
4821
|
+
*/
|
|
4822
|
+
deployedProgram() {
|
|
4823
|
+
const ret = wasm.transaction_deployedProgram(this.__wbg_ptr);
|
|
4824
|
+
return ret === 0 ? undefined : Program.__wrap(ret);
|
|
4825
|
+
}
|
|
4826
|
+
/**
|
|
4827
|
+
* Returns the execution within the transaction (if present).
|
|
4828
|
+
*
|
|
4829
|
+
* @returns {Execution | undefined} The execution within the transaction.
|
|
4830
|
+
* @returns {Execution | undefined}
|
|
4831
|
+
*/
|
|
4832
|
+
execution() {
|
|
4833
|
+
const ret = wasm.transaction_execution(this.__wbg_ptr);
|
|
4834
|
+
return ret === 0 ? undefined : Execution.__wrap(ret);
|
|
4835
|
+
}
|
|
4836
|
+
/**
|
|
4837
|
+
* Get the record plaintext present in a transaction owned by a specific view key.
|
|
4838
|
+
*
|
|
4839
|
+
* @param {ViewKey} view_key View key used to decrypt the ciphertext
|
|
4840
|
+
*
|
|
4841
|
+
* @returns {Array<RecordPlaintext>} Array of record plaintext objects
|
|
4842
|
+
* @param {ViewKey} view_key
|
|
4843
|
+
* @returns {Array<any>}
|
|
4844
|
+
*/
|
|
4845
|
+
ownedRecords(view_key) {
|
|
4846
|
+
_assertClass(view_key, ViewKey);
|
|
4847
|
+
const ret = wasm.transaction_ownedRecords(this.__wbg_ptr, view_key.__wbg_ptr);
|
|
4848
|
+
return takeObject(ret);
|
|
4849
|
+
}
|
|
4850
|
+
/**
|
|
4851
|
+
* Get the records present in a transaction and their commitments.
|
|
4852
|
+
*
|
|
4853
|
+
* @returns {Array<{commitment: Field, record: RecordCiphertext}>} Array of record ciphertext objects
|
|
4854
|
+
* @returns {Array<any>}
|
|
4855
|
+
*/
|
|
4856
|
+
records() {
|
|
4857
|
+
const ret = wasm.transaction_records(this.__wbg_ptr);
|
|
4858
|
+
return takeObject(ret);
|
|
4859
|
+
}
|
|
4860
|
+
/**
|
|
4861
|
+
* Get a summary of the transaction within a javascript object.
|
|
4862
|
+
*
|
|
4863
|
+
* If the transaction is an execution transaction, this function will return a list of the
|
|
4864
|
+
* transitions and their inputs and outputs.
|
|
4865
|
+
*
|
|
4866
|
+
* If the transaction is a deployment transaction, this function will return the program id and
|
|
4867
|
+
* a list of the functions and their verifying keys, constraint, and variable counts.
|
|
4868
|
+
*
|
|
4869
|
+
* @param {boolean} convert_to_js If true the inputs and outputs will be converted to JS objects,
|
|
4870
|
+
* if false the inputs and outputs will be in wasm format.
|
|
4871
|
+
*
|
|
4872
|
+
* @returns {Object} Transaction summary
|
|
4873
|
+
* @param {boolean} convert_to_js
|
|
4874
|
+
* @returns {object}
|
|
4875
|
+
*/
|
|
4876
|
+
summary(convert_to_js) {
|
|
4877
|
+
const ret = wasm.transaction_summary(this.__wbg_ptr, convert_to_js);
|
|
4878
|
+
return takeObject(ret);
|
|
4879
|
+
}
|
|
4880
|
+
/**
|
|
4881
|
+
* Get the id of the transaction. This is the merkle root of the transaction's inclusion proof.
|
|
4882
|
+
*
|
|
4883
|
+
* This value can be used to query the status of the transaction on the Aleo Network to see
|
|
4884
|
+
* if it was successful. If successful, the transaction will be included in a block and this
|
|
4885
|
+
* value can be used to lookup the transaction data on-chain.
|
|
4886
|
+
*
|
|
4887
|
+
* @returns {string} TransactionId
|
|
4888
|
+
* @returns {string}
|
|
4889
|
+
*/
|
|
4890
|
+
id() {
|
|
4891
|
+
let deferred1_0;
|
|
4892
|
+
let deferred1_1;
|
|
4893
|
+
try {
|
|
4894
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4895
|
+
wasm.transaction_id(retptr, this.__wbg_ptr);
|
|
4896
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
4897
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
4898
|
+
deferred1_0 = r0;
|
|
4899
|
+
deferred1_1 = r1;
|
|
4900
|
+
return getStringFromWasm0(r0, r1);
|
|
4901
|
+
} finally {
|
|
4902
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4903
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
4904
|
+
}
|
|
3261
4905
|
}
|
|
3262
4906
|
/**
|
|
3263
|
-
* Get
|
|
4907
|
+
* Get the
|
|
4908
|
+
* Get the type of the transaction (will return "deploy" or "execute")
|
|
3264
4909
|
*
|
|
3265
|
-
* @returns {string}
|
|
4910
|
+
* @returns {string} Transaction type
|
|
3266
4911
|
* @returns {string}
|
|
3267
4912
|
*/
|
|
3268
|
-
|
|
4913
|
+
transactionType() {
|
|
3269
4914
|
let deferred1_0;
|
|
3270
4915
|
let deferred1_1;
|
|
3271
4916
|
try {
|
|
3272
4917
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3273
|
-
wasm.
|
|
4918
|
+
wasm.transaction_transactionType(retptr, this.__wbg_ptr);
|
|
3274
4919
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
3275
4920
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
3276
4921
|
deferred1_0 = r0;
|
|
@@ -3281,68 +4926,129 @@ class Signature {
|
|
|
3281
4926
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
3282
4927
|
}
|
|
3283
4928
|
}
|
|
4929
|
+
/**
|
|
4930
|
+
* Get the transitions in a transaction.
|
|
4931
|
+
*
|
|
4932
|
+
* @returns {Array<Transition>} Array of transition objects
|
|
4933
|
+
* @returns {Array<any>}
|
|
4934
|
+
*/
|
|
4935
|
+
transitions() {
|
|
4936
|
+
const ret = wasm.transaction_transitions(this.__wbg_ptr);
|
|
4937
|
+
return takeObject(ret);
|
|
4938
|
+
}
|
|
4939
|
+
/**
|
|
4940
|
+
* Get the verifying keys in a transaction.
|
|
4941
|
+
*
|
|
4942
|
+
* @returns {Array<Object>} Array of verifying keys.
|
|
4943
|
+
* @returns {Array<any>}
|
|
4944
|
+
*/
|
|
4945
|
+
verifyingKeys() {
|
|
4946
|
+
const ret = wasm.transaction_verifyingKeys(this.__wbg_ptr);
|
|
4947
|
+
return takeObject(ret);
|
|
4948
|
+
}
|
|
3284
4949
|
}
|
|
3285
4950
|
|
|
3286
|
-
const
|
|
4951
|
+
const TransitionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3287
4952
|
? { register: () => {}, unregister: () => {} }
|
|
3288
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
4953
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_transition_free(ptr >>> 0));
|
|
3289
4954
|
/**
|
|
3290
|
-
* Webassembly Representation of an Aleo transaction
|
|
3291
|
-
*
|
|
3292
|
-
* This object is created when generating an on-chain function deployment or execution and is the
|
|
3293
|
-
* object that should be submitted to the Aleo Network in order to deploy or execute a function.
|
|
3294
4955
|
*/
|
|
3295
|
-
class
|
|
4956
|
+
class Transition {
|
|
3296
4957
|
|
|
3297
4958
|
static __wrap(ptr) {
|
|
3298
4959
|
ptr = ptr >>> 0;
|
|
3299
|
-
const obj = Object.create(
|
|
4960
|
+
const obj = Object.create(Transition.prototype);
|
|
3300
4961
|
obj.__wbg_ptr = ptr;
|
|
3301
|
-
|
|
4962
|
+
TransitionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
3302
4963
|
return obj;
|
|
3303
4964
|
}
|
|
3304
4965
|
|
|
3305
4966
|
__destroy_into_raw() {
|
|
3306
4967
|
const ptr = this.__wbg_ptr;
|
|
3307
4968
|
this.__wbg_ptr = 0;
|
|
3308
|
-
|
|
4969
|
+
TransitionFinalization.unregister(this);
|
|
3309
4970
|
return ptr;
|
|
3310
4971
|
}
|
|
3311
4972
|
|
|
3312
4973
|
free() {
|
|
3313
4974
|
const ptr = this.__destroy_into_raw();
|
|
3314
|
-
wasm.
|
|
4975
|
+
wasm.__wbg_transition_free(ptr);
|
|
3315
4976
|
}
|
|
3316
4977
|
/**
|
|
3317
|
-
*
|
|
4978
|
+
* Get the transition ID
|
|
3318
4979
|
*
|
|
3319
|
-
* @
|
|
3320
|
-
* @returns {
|
|
3321
|
-
* @param {string} transaction
|
|
3322
|
-
* @returns {Transaction}
|
|
4980
|
+
* @returns {string} The transition ID
|
|
4981
|
+
* @returns {string}
|
|
3323
4982
|
*/
|
|
3324
|
-
|
|
4983
|
+
id() {
|
|
4984
|
+
let deferred1_0;
|
|
4985
|
+
let deferred1_1;
|
|
3325
4986
|
try {
|
|
3326
4987
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3327
|
-
|
|
4988
|
+
wasm.transition_id(retptr, this.__wbg_ptr);
|
|
4989
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
4990
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
4991
|
+
deferred1_0 = r0;
|
|
4992
|
+
deferred1_1 = r1;
|
|
4993
|
+
return getStringFromWasm0(r0, r1);
|
|
4994
|
+
} finally {
|
|
4995
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4996
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
4997
|
+
}
|
|
4998
|
+
}
|
|
4999
|
+
/**
|
|
5000
|
+
* Create a transition from a string
|
|
5001
|
+
*
|
|
5002
|
+
* @param {string} transition String representation of a transition
|
|
5003
|
+
* @returns {Transition}
|
|
5004
|
+
* @param {string} transition
|
|
5005
|
+
* @returns {Transition}
|
|
5006
|
+
*/
|
|
5007
|
+
static fromString(transition) {
|
|
5008
|
+
try {
|
|
5009
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
5010
|
+
const ptr0 = passStringToWasm0(transition, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3328
5011
|
const len0 = WASM_VECTOR_LEN;
|
|
3329
|
-
wasm.
|
|
5012
|
+
wasm.transition_fromString(retptr, ptr0, len0);
|
|
3330
5013
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
3331
5014
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
3332
5015
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
3333
5016
|
if (r2) {
|
|
3334
5017
|
throw takeObject(r1);
|
|
3335
5018
|
}
|
|
3336
|
-
return
|
|
5019
|
+
return Transition.__wrap(r0);
|
|
3337
5020
|
} finally {
|
|
3338
5021
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3339
5022
|
}
|
|
3340
5023
|
}
|
|
3341
5024
|
/**
|
|
3342
|
-
*
|
|
5025
|
+
* Create a transition from a Uint8Array of left endian bytes.
|
|
5026
|
+
*
|
|
5027
|
+
* @param {Uint8Array} Uint8Array of left endian bytes encoding a Transition.
|
|
5028
|
+
* @returns {Transition}
|
|
5029
|
+
* @param {Uint8Array} bytes
|
|
5030
|
+
* @returns {Transition}
|
|
5031
|
+
*/
|
|
5032
|
+
static fromBytesLe(bytes) {
|
|
5033
|
+
try {
|
|
5034
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
5035
|
+
wasm.transition_fromBytesLe(retptr, addHeapObject(bytes));
|
|
5036
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
5037
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
5038
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
5039
|
+
if (r2) {
|
|
5040
|
+
throw takeObject(r1);
|
|
5041
|
+
}
|
|
5042
|
+
return Transition.__wrap(r0);
|
|
5043
|
+
} finally {
|
|
5044
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5045
|
+
}
|
|
5046
|
+
}
|
|
5047
|
+
/**
|
|
5048
|
+
* Get the transition as a string. If you want to submit this transition to the Aleo Network
|
|
3343
5049
|
* this function will create the string that should be submitted in the `POST` data.
|
|
3344
5050
|
*
|
|
3345
|
-
* @returns {string} String representation of the
|
|
5051
|
+
* @returns {string} String representation of the transition
|
|
3346
5052
|
* @returns {string}
|
|
3347
5053
|
*/
|
|
3348
5054
|
toString() {
|
|
@@ -3350,7 +5056,7 @@ class Transaction {
|
|
|
3350
5056
|
let deferred1_1;
|
|
3351
5057
|
try {
|
|
3352
5058
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3353
|
-
wasm.
|
|
5059
|
+
wasm.transition_toString(retptr, this.__wbg_ptr);
|
|
3354
5060
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
3355
5061
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
3356
5062
|
deferred1_0 = r0;
|
|
@@ -3362,21 +5068,36 @@ class Transaction {
|
|
|
3362
5068
|
}
|
|
3363
5069
|
}
|
|
3364
5070
|
/**
|
|
3365
|
-
* Get the
|
|
3366
|
-
*
|
|
3367
|
-
* This value can be used to query the status of the transaction on the Aleo Network to see
|
|
3368
|
-
* if it was successful. If successful, the transaction will be included in a block and this
|
|
3369
|
-
* value can be used to lookup the transaction data on-chain.
|
|
5071
|
+
* Get the transition as a Uint8Array of left endian bytes.
|
|
3370
5072
|
*
|
|
3371
|
-
* @returns {
|
|
5073
|
+
* @returns {Uint8Array} Uint8Array representation of the transition
|
|
5074
|
+
* @returns {Uint8Array}
|
|
5075
|
+
*/
|
|
5076
|
+
toBytesLe() {
|
|
5077
|
+
try {
|
|
5078
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
5079
|
+
wasm.transition_toBytesLe(retptr, this.__wbg_ptr);
|
|
5080
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
5081
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
5082
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
5083
|
+
if (r2) {
|
|
5084
|
+
throw takeObject(r1);
|
|
5085
|
+
}
|
|
5086
|
+
return takeObject(r0);
|
|
5087
|
+
} finally {
|
|
5088
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5089
|
+
}
|
|
5090
|
+
}
|
|
5091
|
+
/**
|
|
5092
|
+
* Get the program ID of the transition.
|
|
3372
5093
|
* @returns {string}
|
|
3373
5094
|
*/
|
|
3374
|
-
|
|
5095
|
+
programId() {
|
|
3375
5096
|
let deferred1_0;
|
|
3376
5097
|
let deferred1_1;
|
|
3377
5098
|
try {
|
|
3378
5099
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3379
|
-
wasm.
|
|
5100
|
+
wasm.transition_programId(retptr, this.__wbg_ptr);
|
|
3380
5101
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
3381
5102
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
3382
5103
|
deferred1_0 = r0;
|
|
@@ -3388,17 +5109,15 @@ class Transaction {
|
|
|
3388
5109
|
}
|
|
3389
5110
|
}
|
|
3390
5111
|
/**
|
|
3391
|
-
* Get the
|
|
3392
|
-
*
|
|
3393
|
-
* @returns {string} Transaction type
|
|
5112
|
+
* Get the function name of the transition.
|
|
3394
5113
|
* @returns {string}
|
|
3395
5114
|
*/
|
|
3396
|
-
|
|
5115
|
+
functionName() {
|
|
3397
5116
|
let deferred1_0;
|
|
3398
5117
|
let deferred1_1;
|
|
3399
5118
|
try {
|
|
3400
5119
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3401
|
-
wasm.
|
|
5120
|
+
wasm.transition_functionName(retptr, this.__wbg_ptr);
|
|
3402
5121
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
3403
5122
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
3404
5123
|
deferred1_0 = r0;
|
|
@@ -3409,6 +5128,118 @@ class Transaction {
|
|
|
3409
5128
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
3410
5129
|
}
|
|
3411
5130
|
}
|
|
5131
|
+
/**
|
|
5132
|
+
* Returns true if the transition contains the given commitment.
|
|
5133
|
+
*
|
|
5134
|
+
* @param {boolean} True if the transition contains the given commitment.
|
|
5135
|
+
* @param {Field} commitment
|
|
5136
|
+
* @returns {boolean}
|
|
5137
|
+
*/
|
|
5138
|
+
containsCommitment(commitment) {
|
|
5139
|
+
_assertClass(commitment, Field);
|
|
5140
|
+
const ret = wasm.transition_containsCommitment(this.__wbg_ptr, commitment.__wbg_ptr);
|
|
5141
|
+
return ret !== 0;
|
|
5142
|
+
}
|
|
5143
|
+
/**
|
|
5144
|
+
* Check if the transition contains a serial number.
|
|
5145
|
+
*
|
|
5146
|
+
* @param {Field} serial_number The serial number to check for
|
|
5147
|
+
*
|
|
5148
|
+
* @returns {bool} True if the transition contains a serial number, false otherwise
|
|
5149
|
+
* @param {Field} serial_number
|
|
5150
|
+
* @returns {boolean}
|
|
5151
|
+
*/
|
|
5152
|
+
containsSerialNumber(serial_number) {
|
|
5153
|
+
_assertClass(serial_number, Field);
|
|
5154
|
+
const ret = wasm.transition_containsSerialNumber(this.__wbg_ptr, serial_number.__wbg_ptr);
|
|
5155
|
+
return ret !== 0;
|
|
5156
|
+
}
|
|
5157
|
+
/**
|
|
5158
|
+
* Find a record in the transition by the record's commitment.
|
|
5159
|
+
* @param {Field} commitment
|
|
5160
|
+
* @returns {RecordCiphertext | undefined}
|
|
5161
|
+
*/
|
|
5162
|
+
findRecord(commitment) {
|
|
5163
|
+
_assertClass(commitment, Field);
|
|
5164
|
+
const ret = wasm.transition_findRecord(this.__wbg_ptr, commitment.__wbg_ptr);
|
|
5165
|
+
return ret === 0 ? undefined : RecordCiphertext.__wrap(ret);
|
|
5166
|
+
}
|
|
5167
|
+
/**
|
|
5168
|
+
* Get the record plaintext present in a transition owned by a specific view key.
|
|
5169
|
+
*
|
|
5170
|
+
* @param {ViewKey} view_key The view key of the record owner.
|
|
5171
|
+
*
|
|
5172
|
+
* @returns {Array<RecordPlaintext>} Array of record plaintext objects
|
|
5173
|
+
* @param {ViewKey} view_key
|
|
5174
|
+
* @returns {Array<any>}
|
|
5175
|
+
*/
|
|
5176
|
+
ownedRecords(view_key) {
|
|
5177
|
+
_assertClass(view_key, ViewKey);
|
|
5178
|
+
const ret = wasm.transition_ownedRecords(this.__wbg_ptr, view_key.__wbg_ptr);
|
|
5179
|
+
return takeObject(ret);
|
|
5180
|
+
}
|
|
5181
|
+
/**
|
|
5182
|
+
* Get the records present in a transition and their commitments.
|
|
5183
|
+
*
|
|
5184
|
+
* @returns {Array<{commitment: Field, record: RecordCiphertext}>} Array of record ciphertext objects
|
|
5185
|
+
* @returns {Array<any>}
|
|
5186
|
+
*/
|
|
5187
|
+
records() {
|
|
5188
|
+
const ret = wasm.transition_records(this.__wbg_ptr);
|
|
5189
|
+
return takeObject(ret);
|
|
5190
|
+
}
|
|
5191
|
+
/**
|
|
5192
|
+
* Get the inputs of the transition.
|
|
5193
|
+
*
|
|
5194
|
+
* @param {bool} convert_to_js If true the inputs will be converted to JS objects, if false
|
|
5195
|
+
* the inputs will be in wasm format.
|
|
5196
|
+
*
|
|
5197
|
+
* @returns {Array} Array of inputs
|
|
5198
|
+
* @param {boolean} convert_to_js
|
|
5199
|
+
* @returns {Array<any>}
|
|
5200
|
+
*/
|
|
5201
|
+
inputs(convert_to_js) {
|
|
5202
|
+
const ret = wasm.transition_inputs(this.__wbg_ptr, convert_to_js);
|
|
5203
|
+
return takeObject(ret);
|
|
5204
|
+
}
|
|
5205
|
+
/**
|
|
5206
|
+
* Get the outputs of the transition.
|
|
5207
|
+
*
|
|
5208
|
+
* @param {bool} convert_to_js If true the outputs will be converted to JS objects, if false
|
|
5209
|
+
* the outputs will be in wasm format.
|
|
5210
|
+
*
|
|
5211
|
+
* @returns {Array} Array of outputs
|
|
5212
|
+
* @param {boolean} convert_to_js
|
|
5213
|
+
* @returns {Array<any>}
|
|
5214
|
+
*/
|
|
5215
|
+
outputs(convert_to_js) {
|
|
5216
|
+
const ret = wasm.transition_outputs(this.__wbg_ptr, convert_to_js);
|
|
5217
|
+
return takeObject(ret);
|
|
5218
|
+
}
|
|
5219
|
+
/**
|
|
5220
|
+
* Get the transition public key of the transition.
|
|
5221
|
+
* @returns {Group}
|
|
5222
|
+
*/
|
|
5223
|
+
tpk() {
|
|
5224
|
+
const ret = wasm.computekey_pk_sig(this.__wbg_ptr);
|
|
5225
|
+
return Group.__wrap(ret);
|
|
5226
|
+
}
|
|
5227
|
+
/**
|
|
5228
|
+
* Get the transition commitment of the transition.
|
|
5229
|
+
* @returns {Field}
|
|
5230
|
+
*/
|
|
5231
|
+
tcm() {
|
|
5232
|
+
const ret = wasm.transition_tcm(this.__wbg_ptr);
|
|
5233
|
+
return Field.__wrap(ret);
|
|
5234
|
+
}
|
|
5235
|
+
/**
|
|
5236
|
+
* Get the transition signer commitment of the transition.
|
|
5237
|
+
* @returns {Field}
|
|
5238
|
+
*/
|
|
5239
|
+
scm() {
|
|
5240
|
+
const ret = wasm.transition_scm(this.__wbg_ptr);
|
|
5241
|
+
return Field.__wrap(ret);
|
|
5242
|
+
}
|
|
3412
5243
|
}
|
|
3413
5244
|
|
|
3414
5245
|
const VerifyingKeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -3954,6 +5785,14 @@ class ViewKey {
|
|
|
3954
5785
|
return Address.__wrap(ret);
|
|
3955
5786
|
}
|
|
3956
5787
|
/**
|
|
5788
|
+
* Get the underlying scalar of a view key.
|
|
5789
|
+
* @returns {Scalar}
|
|
5790
|
+
*/
|
|
5791
|
+
to_scalar() {
|
|
5792
|
+
const ret = wasm.graphkey_sk_tag(this.__wbg_ptr);
|
|
5793
|
+
return Scalar.__wrap(ret);
|
|
5794
|
+
}
|
|
5795
|
+
/**
|
|
3957
5796
|
* Decrypt a record ciphertext with a view key
|
|
3958
5797
|
*
|
|
3959
5798
|
* @param {string} ciphertext String representation of a record ciphertext
|
|
@@ -4155,24 +5994,16 @@ function __wbg_get_imports() {
|
|
|
4155
5994
|
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
4156
5995
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
4157
5996
|
};
|
|
4158
|
-
imports.wbg.
|
|
4159
|
-
|
|
4160
|
-
};
|
|
4161
|
-
imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
|
|
4162
|
-
const ret = BigInt.asUintN(64, arg0);
|
|
5997
|
+
imports.wbg.__wbg_transaction_new = function(arg0) {
|
|
5998
|
+
const ret = Transaction.__wrap(arg0);
|
|
4163
5999
|
return addHeapObject(ret);
|
|
4164
6000
|
};
|
|
4165
6001
|
imports.wbg.__wbg_call_b3ca7c6051f9bec1 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
4166
6002
|
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
4167
6003
|
return addHeapObject(ret);
|
|
4168
6004
|
}, arguments) };
|
|
4169
|
-
imports.wbg.
|
|
4170
|
-
|
|
4171
|
-
return addHeapObject(ret);
|
|
4172
|
-
};
|
|
4173
|
-
imports.wbg.__wbg_transaction_new = function(arg0) {
|
|
4174
|
-
const ret = Transaction.__wrap(arg0);
|
|
4175
|
-
return addHeapObject(ret);
|
|
6005
|
+
imports.wbg.__wbg_log_0373a28c0a891b83 = function(arg0, arg1) {
|
|
6006
|
+
console.log(getStringFromWasm0(arg0, arg1));
|
|
4176
6007
|
};
|
|
4177
6008
|
imports.wbg.__wbg_executionresponse_new = function(arg0) {
|
|
4178
6009
|
const ret = ExecutionResponse.__wrap(arg0);
|
|
@@ -4185,6 +6016,10 @@ function __wbg_get_imports() {
|
|
|
4185
6016
|
imports.wbg.__wbg_set_d4638f722068f043 = function(arg0, arg1, arg2) {
|
|
4186
6017
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
4187
6018
|
};
|
|
6019
|
+
imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
|
|
6020
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
6021
|
+
return addHeapObject(ret);
|
|
6022
|
+
};
|
|
4188
6023
|
imports.wbg.__wbindgen_module = function() {
|
|
4189
6024
|
const ret = __wbg_init.__wbindgen_wasm_module;
|
|
4190
6025
|
return addHeapObject(ret);
|
|
@@ -4193,10 +6028,14 @@ function __wbg_get_imports() {
|
|
|
4193
6028
|
const ret = wasm.memory;
|
|
4194
6029
|
return addHeapObject(ret);
|
|
4195
6030
|
};
|
|
4196
|
-
imports.wbg.
|
|
6031
|
+
imports.wbg.__wbg_spawnWorker_bf2b4274ab1ad344 = function(arg0, arg1, arg2, arg3) {
|
|
4197
6032
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
4198
6033
|
return addHeapObject(ret);
|
|
4199
6034
|
};
|
|
6035
|
+
imports.wbg.__wbg_keypair_new = function(arg0) {
|
|
6036
|
+
const ret = KeyPair.__wrap(arg0);
|
|
6037
|
+
return addHeapObject(ret);
|
|
6038
|
+
};
|
|
4200
6039
|
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
4201
6040
|
const obj = takeObject(arg0).original;
|
|
4202
6041
|
if (obj.cnt-- == 1) {
|
|
@@ -4226,6 +6065,70 @@ function __wbg_get_imports() {
|
|
|
4226
6065
|
const ret = getObject(arg0).length;
|
|
4227
6066
|
return ret;
|
|
4228
6067
|
};
|
|
6068
|
+
imports.wbg.__wbg_plaintext_new = function(arg0) {
|
|
6069
|
+
const ret = Plaintext.__wrap(arg0);
|
|
6070
|
+
return addHeapObject(ret);
|
|
6071
|
+
};
|
|
6072
|
+
imports.wbg.__wbg_field_new = function(arg0) {
|
|
6073
|
+
const ret = Field.__wrap(arg0);
|
|
6074
|
+
return addHeapObject(ret);
|
|
6075
|
+
};
|
|
6076
|
+
imports.wbg.__wbg_ciphertext_new = function(arg0) {
|
|
6077
|
+
const ret = Ciphertext.__wrap(arg0);
|
|
6078
|
+
return addHeapObject(ret);
|
|
6079
|
+
};
|
|
6080
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
6081
|
+
const ret = arg0;
|
|
6082
|
+
return addHeapObject(ret);
|
|
6083
|
+
};
|
|
6084
|
+
imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
|
|
6085
|
+
const ret = arg0;
|
|
6086
|
+
return addHeapObject(ret);
|
|
6087
|
+
};
|
|
6088
|
+
imports.wbg.__wbindgen_bigint_from_i128 = function(arg0, arg1) {
|
|
6089
|
+
const ret = arg0 << BigInt(64) | BigInt.asUintN(64, arg1);
|
|
6090
|
+
return addHeapObject(ret);
|
|
6091
|
+
};
|
|
6092
|
+
imports.wbg.__wbindgen_bigint_from_u128 = function(arg0, arg1) {
|
|
6093
|
+
const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1);
|
|
6094
|
+
return addHeapObject(ret);
|
|
6095
|
+
};
|
|
6096
|
+
imports.wbg.__wbg_recordciphertext_new = function(arg0) {
|
|
6097
|
+
const ret = RecordCiphertext.__wrap(arg0);
|
|
6098
|
+
return addHeapObject(ret);
|
|
6099
|
+
};
|
|
6100
|
+
imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
|
|
6101
|
+
const ret = getObject(arg0).buffer;
|
|
6102
|
+
return addHeapObject(ret);
|
|
6103
|
+
};
|
|
6104
|
+
imports.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
|
|
6105
|
+
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
6106
|
+
return addHeapObject(ret);
|
|
6107
|
+
};
|
|
6108
|
+
imports.wbg.__wbg_recordplaintext_new = function(arg0) {
|
|
6109
|
+
const ret = RecordPlaintext.__wrap(arg0);
|
|
6110
|
+
return addHeapObject(ret);
|
|
6111
|
+
};
|
|
6112
|
+
imports.wbg.__wbg_group_new = function(arg0) {
|
|
6113
|
+
const ret = Group.__wrap(arg0);
|
|
6114
|
+
return addHeapObject(ret);
|
|
6115
|
+
};
|
|
6116
|
+
imports.wbg.__wbg_verifyingkey_new = function(arg0) {
|
|
6117
|
+
const ret = VerifyingKey.__wrap(arg0);
|
|
6118
|
+
return addHeapObject(ret);
|
|
6119
|
+
};
|
|
6120
|
+
imports.wbg.__wbg_address_new = function(arg0) {
|
|
6121
|
+
const ret = Address.__wrap(arg0);
|
|
6122
|
+
return addHeapObject(ret);
|
|
6123
|
+
};
|
|
6124
|
+
imports.wbg.__wbg_signature_new = function(arg0) {
|
|
6125
|
+
const ret = Signature.__wrap(arg0);
|
|
6126
|
+
return addHeapObject(ret);
|
|
6127
|
+
};
|
|
6128
|
+
imports.wbg.__wbg_transition_new = function(arg0) {
|
|
6129
|
+
const ret = Transition.__wrap(arg0);
|
|
6130
|
+
return addHeapObject(ret);
|
|
6131
|
+
};
|
|
4229
6132
|
imports.wbg.__wbg_new_81740750da40724f = function(arg0, arg1) {
|
|
4230
6133
|
try {
|
|
4231
6134
|
var state0 = {a: arg0, b: arg1};
|
|
@@ -4233,7 +6136,7 @@ function __wbg_get_imports() {
|
|
|
4233
6136
|
const a = state0.a;
|
|
4234
6137
|
state0.a = 0;
|
|
4235
6138
|
try {
|
|
4236
|
-
return
|
|
6139
|
+
return __wbg_adapter_419(a, state0.b, arg0, arg1);
|
|
4237
6140
|
} finally {
|
|
4238
6141
|
state0.a = a;
|
|
4239
6142
|
}
|
|
@@ -4244,10 +6147,6 @@ function __wbg_get_imports() {
|
|
|
4244
6147
|
state0.a = state0.b = 0;
|
|
4245
6148
|
}
|
|
4246
6149
|
};
|
|
4247
|
-
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
4248
|
-
const ret = arg0;
|
|
4249
|
-
return addHeapObject(ret);
|
|
4250
|
-
};
|
|
4251
6150
|
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
4252
6151
|
const ret = new Error();
|
|
4253
6152
|
return addHeapObject(ret);
|
|
@@ -4270,14 +6169,6 @@ function __wbg_get_imports() {
|
|
|
4270
6169
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
4271
6170
|
}
|
|
4272
6171
|
};
|
|
4273
|
-
imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
|
|
4274
|
-
const ret = getObject(arg0).buffer;
|
|
4275
|
-
return addHeapObject(ret);
|
|
4276
|
-
};
|
|
4277
|
-
imports.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
|
|
4278
|
-
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
4279
|
-
return addHeapObject(ret);
|
|
4280
|
-
};
|
|
4281
6172
|
imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
|
|
4282
6173
|
getObject(arg0).randomFillSync(takeObject(arg1));
|
|
4283
6174
|
}, arguments) };
|
|
@@ -4461,12 +6352,12 @@ function __wbg_get_imports() {
|
|
|
4461
6352
|
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
4462
6353
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
4463
6354
|
}, arguments) };
|
|
4464
|
-
imports.wbg.
|
|
4465
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6355
|
+
imports.wbg.__wbindgen_closure_wrapper6326 = function(arg0, arg1, arg2) {
|
|
6356
|
+
const ret = makeMutClosure(arg0, arg1, 624, __wbg_adapter_40);
|
|
4466
6357
|
return addHeapObject(ret);
|
|
4467
6358
|
};
|
|
4468
|
-
imports.wbg.
|
|
4469
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6359
|
+
imports.wbg.__wbindgen_closure_wrapper6352 = function(arg0, arg1, arg2) {
|
|
6360
|
+
const ret = makeMutClosure(arg0, arg1, 624, __wbg_adapter_40);
|
|
4470
6361
|
return addHeapObject(ret);
|
|
4471
6362
|
};
|
|
4472
6363
|
|
|
@@ -4524,12 +6415,17 @@ async function __wbg_init(input, maybe_memory) {
|
|
|
4524
6415
|
var exports = /*#__PURE__*/Object.freeze({
|
|
4525
6416
|
__proto__: null,
|
|
4526
6417
|
Address: Address,
|
|
6418
|
+
Ciphertext: Ciphertext,
|
|
6419
|
+
ComputeKey: ComputeKey,
|
|
4527
6420
|
Execution: Execution,
|
|
4528
6421
|
ExecutionResponse: ExecutionResponse,
|
|
4529
6422
|
Field: Field,
|
|
6423
|
+
GraphKey: GraphKey,
|
|
6424
|
+
Group: Group,
|
|
4530
6425
|
KeyPair: KeyPair,
|
|
4531
6426
|
Metadata: Metadata,
|
|
4532
6427
|
OfflineQuery: OfflineQuery,
|
|
6428
|
+
Plaintext: Plaintext,
|
|
4533
6429
|
PrivateKey: PrivateKey,
|
|
4534
6430
|
PrivateKeyCiphertext: PrivateKeyCiphertext,
|
|
4535
6431
|
Program: Program,
|
|
@@ -4537,8 +6433,10 @@ var exports = /*#__PURE__*/Object.freeze({
|
|
|
4537
6433
|
ProvingKey: ProvingKey,
|
|
4538
6434
|
RecordCiphertext: RecordCiphertext,
|
|
4539
6435
|
RecordPlaintext: RecordPlaintext,
|
|
6436
|
+
Scalar: Scalar,
|
|
4540
6437
|
Signature: Signature,
|
|
4541
6438
|
Transaction: Transaction,
|
|
6439
|
+
Transition: Transition,
|
|
4542
6440
|
VerifyingKey: VerifyingKey,
|
|
4543
6441
|
ViewKey: ViewKey,
|
|
4544
6442
|
default: __wbg_init,
|