@spacesprotocol/libveritas 0.0.0-dev.20260318155541 → 0.0.0-dev.20260318234945
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/libveritas.d.ts +9 -2
- package/libveritas.js +54 -105
- package/libveritas_bg.wasm +0 -0
- package/package.json +1 -1
package/libveritas.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
export class Anchors {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
computeAnchorSetHash(): Uint8Array;
|
|
8
|
+
constructor(json: string);
|
|
9
|
+
}
|
|
10
|
+
|
|
4
11
|
/**
|
|
5
12
|
* A message containing chain proofs and handle data.
|
|
6
13
|
*/
|
|
@@ -191,7 +198,7 @@ export class Veritas {
|
|
|
191
198
|
[Symbol.dispose](): void;
|
|
192
199
|
computeAnchorSetHash(): Uint8Array;
|
|
193
200
|
is_finalized(commitment_height: number): boolean;
|
|
194
|
-
constructor(anchors:
|
|
201
|
+
constructor(anchors: Anchors);
|
|
195
202
|
newest_anchor(): number;
|
|
196
203
|
oldest_anchor(): number;
|
|
197
204
|
sovereignty_for(commitment_height: number): string;
|
|
@@ -199,7 +206,7 @@ export class Veritas {
|
|
|
199
206
|
* Verify a message against a query context.
|
|
200
207
|
*/
|
|
201
208
|
verify_message(ctx: QueryContext, msg: Message): VerifiedMessage;
|
|
202
|
-
static withDevMode(anchors:
|
|
209
|
+
static withDevMode(anchors: Anchors): Veritas;
|
|
203
210
|
}
|
|
204
211
|
|
|
205
212
|
/**
|
package/libveritas.js
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
/* @ts-self-types="./libveritas.d.ts" */
|
|
2
2
|
|
|
3
|
+
class Anchors {
|
|
4
|
+
__destroy_into_raw() {
|
|
5
|
+
const ptr = this.__wbg_ptr;
|
|
6
|
+
this.__wbg_ptr = 0;
|
|
7
|
+
AnchorsFinalization.unregister(this);
|
|
8
|
+
return ptr;
|
|
9
|
+
}
|
|
10
|
+
free() {
|
|
11
|
+
const ptr = this.__destroy_into_raw();
|
|
12
|
+
wasm.__wbg_anchors_free(ptr, 0);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @returns {Uint8Array}
|
|
16
|
+
*/
|
|
17
|
+
computeAnchorSetHash() {
|
|
18
|
+
const ret = wasm.anchors_computeAnchorSetHash(this.__wbg_ptr);
|
|
19
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
20
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
21
|
+
return v1;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} json
|
|
25
|
+
*/
|
|
26
|
+
constructor(json) {
|
|
27
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
28
|
+
const len0 = WASM_VECTOR_LEN;
|
|
29
|
+
const ret = wasm.anchors_from_json(ptr0, len0);
|
|
30
|
+
if (ret[2]) {
|
|
31
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
32
|
+
}
|
|
33
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
34
|
+
AnchorsFinalization.register(this, this.__wbg_ptr, this);
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (Symbol.dispose) Anchors.prototype[Symbol.dispose] = Anchors.prototype.free;
|
|
39
|
+
exports.Anchors = Anchors;
|
|
40
|
+
|
|
3
41
|
/**
|
|
4
42
|
* A message containing chain proofs and handle data.
|
|
5
43
|
*/
|
|
@@ -464,7 +502,10 @@ class VerifiedMessage {
|
|
|
464
502
|
*/
|
|
465
503
|
zones() {
|
|
466
504
|
const ret = wasm.verifiedmessage_zones(this.__wbg_ptr);
|
|
467
|
-
|
|
505
|
+
if (ret[2]) {
|
|
506
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
507
|
+
}
|
|
508
|
+
return takeFromExternrefTable0(ret[0]);
|
|
468
509
|
}
|
|
469
510
|
}
|
|
470
511
|
if (Symbol.dispose) VerifiedMessage.prototype[Symbol.dispose] = VerifiedMessage.prototype.free;
|
|
@@ -506,10 +547,11 @@ class Veritas {
|
|
|
506
547
|
return ret !== 0;
|
|
507
548
|
}
|
|
508
549
|
/**
|
|
509
|
-
* @param {
|
|
550
|
+
* @param {Anchors} anchors
|
|
510
551
|
*/
|
|
511
552
|
constructor(anchors) {
|
|
512
|
-
|
|
553
|
+
_assertClass(anchors, Anchors);
|
|
554
|
+
const ret = wasm.veritas_new(anchors.__wbg_ptr);
|
|
513
555
|
if (ret[2]) {
|
|
514
556
|
throw takeFromExternrefTable0(ret[1]);
|
|
515
557
|
}
|
|
@@ -563,11 +605,12 @@ class Veritas {
|
|
|
563
605
|
return VerifiedMessage.__wrap(ret[0]);
|
|
564
606
|
}
|
|
565
607
|
/**
|
|
566
|
-
* @param {
|
|
608
|
+
* @param {Anchors} anchors
|
|
567
609
|
* @returns {Veritas}
|
|
568
610
|
*/
|
|
569
611
|
static withDevMode(anchors) {
|
|
570
|
-
|
|
612
|
+
_assertClass(anchors, Anchors);
|
|
613
|
+
const ret = wasm.veritas_withDevMode(anchors.__wbg_ptr);
|
|
571
614
|
if (ret[2]) {
|
|
572
615
|
throw takeFromExternrefTable0(ret[1]);
|
|
573
616
|
}
|
|
@@ -703,22 +746,6 @@ function __wbg_get_imports() {
|
|
|
703
746
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
704
747
|
return ret;
|
|
705
748
|
},
|
|
706
|
-
__wbg_Number_a5a435bd7bbec835: function(arg0) {
|
|
707
|
-
const ret = Number(arg0);
|
|
708
|
-
return ret;
|
|
709
|
-
},
|
|
710
|
-
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
711
|
-
const ret = String(arg1);
|
|
712
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
713
|
-
const len1 = WASM_VECTOR_LEN;
|
|
714
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
715
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
716
|
-
},
|
|
717
|
-
__wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
|
|
718
|
-
const v = arg0;
|
|
719
|
-
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
720
|
-
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
721
|
-
},
|
|
722
749
|
__wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
|
|
723
750
|
const ret = debugString(arg1);
|
|
724
751
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -726,31 +753,14 @@ function __wbg_get_imports() {
|
|
|
726
753
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
727
754
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
728
755
|
},
|
|
729
|
-
__wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
|
|
730
|
-
const ret = arg0 in arg1;
|
|
731
|
-
return ret;
|
|
732
|
-
},
|
|
733
|
-
__wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
|
|
734
|
-
const ret = typeof(arg0) === 'function';
|
|
735
|
-
return ret;
|
|
736
|
-
},
|
|
737
756
|
__wbg___wbindgen_is_null_0b605fc6b167c56f: function(arg0) {
|
|
738
757
|
const ret = arg0 === null;
|
|
739
758
|
return ret;
|
|
740
759
|
},
|
|
741
|
-
__wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
|
|
742
|
-
const val = arg0;
|
|
743
|
-
const ret = typeof(val) === 'object' && val !== null;
|
|
744
|
-
return ret;
|
|
745
|
-
},
|
|
746
760
|
__wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
|
|
747
761
|
const ret = arg0 === undefined;
|
|
748
762
|
return ret;
|
|
749
763
|
},
|
|
750
|
-
__wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
|
|
751
|
-
const ret = arg0 == arg1;
|
|
752
|
-
return ret;
|
|
753
|
-
},
|
|
754
764
|
__wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
|
|
755
765
|
const obj = arg1;
|
|
756
766
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
@@ -768,22 +778,10 @@ function __wbg_get_imports() {
|
|
|
768
778
|
__wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
|
|
769
779
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
770
780
|
},
|
|
771
|
-
__wbg_call_e133b57c9155d22c: function() { return handleError(function (arg0, arg1) {
|
|
772
|
-
const ret = arg0.call(arg1);
|
|
773
|
-
return ret;
|
|
774
|
-
}, arguments); },
|
|
775
|
-
__wbg_done_08ce71ee07e3bd17: function(arg0) {
|
|
776
|
-
const ret = arg0.done;
|
|
777
|
-
return ret;
|
|
778
|
-
},
|
|
779
781
|
__wbg_from_4bdf88943703fd48: function(arg0) {
|
|
780
782
|
const ret = Array.from(arg0);
|
|
781
783
|
return ret;
|
|
782
784
|
},
|
|
783
|
-
__wbg_get_326e41e095fb2575: function() { return handleError(function (arg0, arg1) {
|
|
784
|
-
const ret = Reflect.get(arg0, arg1);
|
|
785
|
-
return ret;
|
|
786
|
-
}, arguments); },
|
|
787
785
|
__wbg_get_3ef1eba1850ade27: function() { return handleError(function (arg0, arg1) {
|
|
788
786
|
const ret = Reflect.get(arg0, arg1);
|
|
789
787
|
return ret;
|
|
@@ -792,46 +790,6 @@ function __wbg_get_imports() {
|
|
|
792
790
|
const ret = arg0[arg1 >>> 0];
|
|
793
791
|
return ret;
|
|
794
792
|
},
|
|
795
|
-
__wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
|
|
796
|
-
const ret = arg0[arg1 >>> 0];
|
|
797
|
-
return ret;
|
|
798
|
-
},
|
|
799
|
-
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
800
|
-
const ret = arg0[arg1];
|
|
801
|
-
return ret;
|
|
802
|
-
},
|
|
803
|
-
__wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
|
|
804
|
-
let result;
|
|
805
|
-
try {
|
|
806
|
-
result = arg0 instanceof ArrayBuffer;
|
|
807
|
-
} catch (_) {
|
|
808
|
-
result = false;
|
|
809
|
-
}
|
|
810
|
-
const ret = result;
|
|
811
|
-
return ret;
|
|
812
|
-
},
|
|
813
|
-
__wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
|
|
814
|
-
let result;
|
|
815
|
-
try {
|
|
816
|
-
result = arg0 instanceof Uint8Array;
|
|
817
|
-
} catch (_) {
|
|
818
|
-
result = false;
|
|
819
|
-
}
|
|
820
|
-
const ret = result;
|
|
821
|
-
return ret;
|
|
822
|
-
},
|
|
823
|
-
__wbg_isArray_33b91feb269ff46e: function(arg0) {
|
|
824
|
-
const ret = Array.isArray(arg0);
|
|
825
|
-
return ret;
|
|
826
|
-
},
|
|
827
|
-
__wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
|
|
828
|
-
const ret = Number.isSafeInteger(arg0);
|
|
829
|
-
return ret;
|
|
830
|
-
},
|
|
831
|
-
__wbg_iterator_d8f549ec8fb061b1: function() {
|
|
832
|
-
const ret = Symbol.iterator;
|
|
833
|
-
return ret;
|
|
834
|
-
},
|
|
835
793
|
__wbg_length_b3416cf66a5452c8: function(arg0) {
|
|
836
794
|
const ret = arg0.length;
|
|
837
795
|
return ret;
|
|
@@ -840,10 +798,6 @@ function __wbg_get_imports() {
|
|
|
840
798
|
const ret = arg0.length;
|
|
841
799
|
return ret;
|
|
842
800
|
},
|
|
843
|
-
__wbg_new_5f486cdf45a04d78: function(arg0) {
|
|
844
|
-
const ret = new Uint8Array(arg0);
|
|
845
|
-
return ret;
|
|
846
|
-
},
|
|
847
801
|
__wbg_new_a70fbab9066b301f: function() {
|
|
848
802
|
const ret = new Array();
|
|
849
803
|
return ret;
|
|
@@ -856,14 +810,6 @@ function __wbg_get_imports() {
|
|
|
856
810
|
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
857
811
|
return ret;
|
|
858
812
|
},
|
|
859
|
-
__wbg_next_11b99ee6237339e3: function() { return handleError(function (arg0) {
|
|
860
|
-
const ret = arg0.next();
|
|
861
|
-
return ret;
|
|
862
|
-
}, arguments); },
|
|
863
|
-
__wbg_next_e01a967809d1aa68: function(arg0) {
|
|
864
|
-
const ret = arg0.next;
|
|
865
|
-
return ret;
|
|
866
|
-
},
|
|
867
813
|
__wbg_parse_e9eddd2a82c706eb: function() { return handleError(function (arg0, arg1) {
|
|
868
814
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
869
815
|
return ret;
|
|
@@ -879,10 +825,10 @@ function __wbg_get_imports() {
|
|
|
879
825
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
880
826
|
return ret;
|
|
881
827
|
}, arguments); },
|
|
882
|
-
|
|
883
|
-
const ret = arg0
|
|
828
|
+
__wbg_stringify_5ae93966a84901ac: function() { return handleError(function (arg0) {
|
|
829
|
+
const ret = JSON.stringify(arg0);
|
|
884
830
|
return ret;
|
|
885
|
-
},
|
|
831
|
+
}, arguments); },
|
|
886
832
|
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
887
833
|
// Cast intrinsic for `F64 -> Externref`.
|
|
888
834
|
const ret = arg0;
|
|
@@ -914,6 +860,9 @@ function __wbg_get_imports() {
|
|
|
914
860
|
};
|
|
915
861
|
}
|
|
916
862
|
|
|
863
|
+
const AnchorsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
864
|
+
? { register: () => {}, unregister: () => {} }
|
|
865
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_anchors_free(ptr >>> 0, 1));
|
|
917
866
|
const MessageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
918
867
|
? { register: () => {}, unregister: () => {} }
|
|
919
868
|
: new FinalizationRegistry(ptr => wasm.__wbg_message_free(ptr >>> 0, 1));
|
package/libveritas_bg.wasm
CHANGED
|
Binary file
|