@oma3/omatrust 0.1.0-alpha.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.
@@ -0,0 +1,93 @@
1
+ type Hex$2 = `0x${string}`;
2
+ type InterfaceFlags = {
3
+ human: boolean;
4
+ api: boolean;
5
+ smartContract: boolean;
6
+ };
7
+ type InterfaceType = "human" | "api" | "contract";
8
+ type RegistryStatus = "Active" | "Deprecated" | "Replaced";
9
+ type Version = {
10
+ major: number;
11
+ minor: number;
12
+ patch: number;
13
+ };
14
+
15
+ type Hex$1 = `0x${string}`;
16
+ declare function hashTrait(trait: string): Hex$1;
17
+ declare function hashTraits(traits: string[]): Hex$1[];
18
+
19
+ declare function computeInterfacesBitmap(flags: InterfaceFlags): number;
20
+ declare function parseBitmapToFlags(bitmap: number): InterfaceFlags;
21
+ declare function hasInterface(bitmap: number, type: InterfaceType): boolean;
22
+ declare function getInterfaceTypes(bitmap: number): InterfaceType[];
23
+
24
+ declare function registryCodeToStatus(code: number): RegistryStatus;
25
+ declare function registryStatusToCode(status: RegistryStatus): number;
26
+ declare function isValidRegistryStatus(status: string): status is RegistryStatus;
27
+
28
+ declare function parseVersion(input: string): Version;
29
+ declare function formatVersion(version: Version): string;
30
+ declare function compareVersions(a: Version, b: Version): -1 | 0 | 1;
31
+ declare function isVersionGreater(a: Version, b: Version): boolean;
32
+ declare function isVersionEqual(a: Version, b: Version): boolean;
33
+ declare function getLatestVersion(history: Version[]): Version;
34
+
35
+ declare const METADATA_KEY_DID = "omat.did";
36
+ declare const METADATA_KEY_DID_HASH = "omat.didHash";
37
+ declare const METADATA_KEY_DATA_HASH = "omat.dataHash";
38
+ declare const METADATA_KEY_DATA_HASH_ALGORITHM = "omat.dataHashAlgorithm";
39
+ declare const METADATA_KEY_STATUS = "omat.status";
40
+ declare const METADATA_KEY_INTERFACES = "omat.interfaces";
41
+ declare const METADATA_KEY_FUNGIBLE_TOKEN_ID = "omat.fungibleTokenId";
42
+ declare const METADATA_KEY_CONTRACT_ID = "omat.contractId";
43
+ declare const METADATA_KEY_VERSION_MAJOR = "omat.versionMajor";
44
+ declare const METADATA_KEY_VERSION_MINOR = "omat.versionMinor";
45
+ declare const METADATA_KEY_VERSION_PATCH = "omat.versionPatch";
46
+ declare const METADATA_KEY_TRAIT_HASHES = "omat.traitHashes";
47
+ declare const METADATA_KEY_METADATA_JSON = "omat.metadataJson";
48
+
49
+ type Hex = `0x${string}`;
50
+ type DataHashAlgorithm = "keccak256" | "sha256";
51
+ declare function computeDataHashFromUrl(url: string, algorithm: DataHashAlgorithm): Promise<Hex>;
52
+ declare function verifyDataUrlHash(url: string, expectedHash: Hex, algorithm: DataHashAlgorithm): Promise<boolean>;
53
+
54
+ type index_DataHashAlgorithm = DataHashAlgorithm;
55
+ type index_InterfaceFlags = InterfaceFlags;
56
+ type index_InterfaceType = InterfaceType;
57
+ declare const index_METADATA_KEY_CONTRACT_ID: typeof METADATA_KEY_CONTRACT_ID;
58
+ declare const index_METADATA_KEY_DATA_HASH: typeof METADATA_KEY_DATA_HASH;
59
+ declare const index_METADATA_KEY_DATA_HASH_ALGORITHM: typeof METADATA_KEY_DATA_HASH_ALGORITHM;
60
+ declare const index_METADATA_KEY_DID: typeof METADATA_KEY_DID;
61
+ declare const index_METADATA_KEY_DID_HASH: typeof METADATA_KEY_DID_HASH;
62
+ declare const index_METADATA_KEY_FUNGIBLE_TOKEN_ID: typeof METADATA_KEY_FUNGIBLE_TOKEN_ID;
63
+ declare const index_METADATA_KEY_INTERFACES: typeof METADATA_KEY_INTERFACES;
64
+ declare const index_METADATA_KEY_METADATA_JSON: typeof METADATA_KEY_METADATA_JSON;
65
+ declare const index_METADATA_KEY_STATUS: typeof METADATA_KEY_STATUS;
66
+ declare const index_METADATA_KEY_TRAIT_HASHES: typeof METADATA_KEY_TRAIT_HASHES;
67
+ declare const index_METADATA_KEY_VERSION_MAJOR: typeof METADATA_KEY_VERSION_MAJOR;
68
+ declare const index_METADATA_KEY_VERSION_MINOR: typeof METADATA_KEY_VERSION_MINOR;
69
+ declare const index_METADATA_KEY_VERSION_PATCH: typeof METADATA_KEY_VERSION_PATCH;
70
+ type index_RegistryStatus = RegistryStatus;
71
+ type index_Version = Version;
72
+ declare const index_compareVersions: typeof compareVersions;
73
+ declare const index_computeDataHashFromUrl: typeof computeDataHashFromUrl;
74
+ declare const index_computeInterfacesBitmap: typeof computeInterfacesBitmap;
75
+ declare const index_formatVersion: typeof formatVersion;
76
+ declare const index_getInterfaceTypes: typeof getInterfaceTypes;
77
+ declare const index_getLatestVersion: typeof getLatestVersion;
78
+ declare const index_hasInterface: typeof hasInterface;
79
+ declare const index_hashTrait: typeof hashTrait;
80
+ declare const index_hashTraits: typeof hashTraits;
81
+ declare const index_isValidRegistryStatus: typeof isValidRegistryStatus;
82
+ declare const index_isVersionEqual: typeof isVersionEqual;
83
+ declare const index_isVersionGreater: typeof isVersionGreater;
84
+ declare const index_parseBitmapToFlags: typeof parseBitmapToFlags;
85
+ declare const index_parseVersion: typeof parseVersion;
86
+ declare const index_registryCodeToStatus: typeof registryCodeToStatus;
87
+ declare const index_registryStatusToCode: typeof registryStatusToCode;
88
+ declare const index_verifyDataUrlHash: typeof verifyDataUrlHash;
89
+ declare namespace index {
90
+ export { type index_DataHashAlgorithm as DataHashAlgorithm, type Hex$2 as Hex, type index_InterfaceFlags as InterfaceFlags, type index_InterfaceType as InterfaceType, index_METADATA_KEY_CONTRACT_ID as METADATA_KEY_CONTRACT_ID, index_METADATA_KEY_DATA_HASH as METADATA_KEY_DATA_HASH, index_METADATA_KEY_DATA_HASH_ALGORITHM as METADATA_KEY_DATA_HASH_ALGORITHM, index_METADATA_KEY_DID as METADATA_KEY_DID, index_METADATA_KEY_DID_HASH as METADATA_KEY_DID_HASH, index_METADATA_KEY_FUNGIBLE_TOKEN_ID as METADATA_KEY_FUNGIBLE_TOKEN_ID, index_METADATA_KEY_INTERFACES as METADATA_KEY_INTERFACES, index_METADATA_KEY_METADATA_JSON as METADATA_KEY_METADATA_JSON, index_METADATA_KEY_STATUS as METADATA_KEY_STATUS, index_METADATA_KEY_TRAIT_HASHES as METADATA_KEY_TRAIT_HASHES, index_METADATA_KEY_VERSION_MAJOR as METADATA_KEY_VERSION_MAJOR, index_METADATA_KEY_VERSION_MINOR as METADATA_KEY_VERSION_MINOR, index_METADATA_KEY_VERSION_PATCH as METADATA_KEY_VERSION_PATCH, type index_RegistryStatus as RegistryStatus, type index_Version as Version, index_compareVersions as compareVersions, index_computeDataHashFromUrl as computeDataHashFromUrl, index_computeInterfacesBitmap as computeInterfacesBitmap, index_formatVersion as formatVersion, index_getInterfaceTypes as getInterfaceTypes, index_getLatestVersion as getLatestVersion, index_hasInterface as hasInterface, index_hashTrait as hashTrait, index_hashTraits as hashTraits, index_isValidRegistryStatus as isValidRegistryStatus, index_isVersionEqual as isVersionEqual, index_isVersionGreater as isVersionGreater, index_parseBitmapToFlags as parseBitmapToFlags, index_parseVersion as parseVersion, index_registryCodeToStatus as registryCodeToStatus, index_registryStatusToCode as registryStatusToCode, index_verifyDataUrlHash as verifyDataUrlHash };
91
+ }
92
+
93
+ export { parseBitmapToFlags as A, parseVersion as B, registryCodeToStatus as C, type DataHashAlgorithm as D, registryStatusToCode as E, verifyDataUrlHash as F, type Hex$2 as H, type InterfaceFlags as I, METADATA_KEY_CONTRACT_ID as M, type RegistryStatus as R, type Version as V, type InterfaceType as a, METADATA_KEY_DATA_HASH as b, METADATA_KEY_DATA_HASH_ALGORITHM as c, METADATA_KEY_DID as d, METADATA_KEY_DID_HASH as e, METADATA_KEY_FUNGIBLE_TOKEN_ID as f, METADATA_KEY_INTERFACES as g, METADATA_KEY_METADATA_JSON as h, index as i, METADATA_KEY_STATUS as j, METADATA_KEY_TRAIT_HASHES as k, METADATA_KEY_VERSION_MAJOR as l, METADATA_KEY_VERSION_MINOR as m, METADATA_KEY_VERSION_PATCH as n, compareVersions as o, computeDataHashFromUrl as p, computeInterfacesBitmap as q, formatVersion as r, getInterfaceTypes as s, getLatestVersion as t, hasInterface as u, hashTrait as v, hashTraits as w, isValidRegistryStatus as x, isVersionEqual as y, isVersionGreater as z };
@@ -0,0 +1,93 @@
1
+ type Hex$2 = `0x${string}`;
2
+ type InterfaceFlags = {
3
+ human: boolean;
4
+ api: boolean;
5
+ smartContract: boolean;
6
+ };
7
+ type InterfaceType = "human" | "api" | "contract";
8
+ type RegistryStatus = "Active" | "Deprecated" | "Replaced";
9
+ type Version = {
10
+ major: number;
11
+ minor: number;
12
+ patch: number;
13
+ };
14
+
15
+ type Hex$1 = `0x${string}`;
16
+ declare function hashTrait(trait: string): Hex$1;
17
+ declare function hashTraits(traits: string[]): Hex$1[];
18
+
19
+ declare function computeInterfacesBitmap(flags: InterfaceFlags): number;
20
+ declare function parseBitmapToFlags(bitmap: number): InterfaceFlags;
21
+ declare function hasInterface(bitmap: number, type: InterfaceType): boolean;
22
+ declare function getInterfaceTypes(bitmap: number): InterfaceType[];
23
+
24
+ declare function registryCodeToStatus(code: number): RegistryStatus;
25
+ declare function registryStatusToCode(status: RegistryStatus): number;
26
+ declare function isValidRegistryStatus(status: string): status is RegistryStatus;
27
+
28
+ declare function parseVersion(input: string): Version;
29
+ declare function formatVersion(version: Version): string;
30
+ declare function compareVersions(a: Version, b: Version): -1 | 0 | 1;
31
+ declare function isVersionGreater(a: Version, b: Version): boolean;
32
+ declare function isVersionEqual(a: Version, b: Version): boolean;
33
+ declare function getLatestVersion(history: Version[]): Version;
34
+
35
+ declare const METADATA_KEY_DID = "omat.did";
36
+ declare const METADATA_KEY_DID_HASH = "omat.didHash";
37
+ declare const METADATA_KEY_DATA_HASH = "omat.dataHash";
38
+ declare const METADATA_KEY_DATA_HASH_ALGORITHM = "omat.dataHashAlgorithm";
39
+ declare const METADATA_KEY_STATUS = "omat.status";
40
+ declare const METADATA_KEY_INTERFACES = "omat.interfaces";
41
+ declare const METADATA_KEY_FUNGIBLE_TOKEN_ID = "omat.fungibleTokenId";
42
+ declare const METADATA_KEY_CONTRACT_ID = "omat.contractId";
43
+ declare const METADATA_KEY_VERSION_MAJOR = "omat.versionMajor";
44
+ declare const METADATA_KEY_VERSION_MINOR = "omat.versionMinor";
45
+ declare const METADATA_KEY_VERSION_PATCH = "omat.versionPatch";
46
+ declare const METADATA_KEY_TRAIT_HASHES = "omat.traitHashes";
47
+ declare const METADATA_KEY_METADATA_JSON = "omat.metadataJson";
48
+
49
+ type Hex = `0x${string}`;
50
+ type DataHashAlgorithm = "keccak256" | "sha256";
51
+ declare function computeDataHashFromUrl(url: string, algorithm: DataHashAlgorithm): Promise<Hex>;
52
+ declare function verifyDataUrlHash(url: string, expectedHash: Hex, algorithm: DataHashAlgorithm): Promise<boolean>;
53
+
54
+ type index_DataHashAlgorithm = DataHashAlgorithm;
55
+ type index_InterfaceFlags = InterfaceFlags;
56
+ type index_InterfaceType = InterfaceType;
57
+ declare const index_METADATA_KEY_CONTRACT_ID: typeof METADATA_KEY_CONTRACT_ID;
58
+ declare const index_METADATA_KEY_DATA_HASH: typeof METADATA_KEY_DATA_HASH;
59
+ declare const index_METADATA_KEY_DATA_HASH_ALGORITHM: typeof METADATA_KEY_DATA_HASH_ALGORITHM;
60
+ declare const index_METADATA_KEY_DID: typeof METADATA_KEY_DID;
61
+ declare const index_METADATA_KEY_DID_HASH: typeof METADATA_KEY_DID_HASH;
62
+ declare const index_METADATA_KEY_FUNGIBLE_TOKEN_ID: typeof METADATA_KEY_FUNGIBLE_TOKEN_ID;
63
+ declare const index_METADATA_KEY_INTERFACES: typeof METADATA_KEY_INTERFACES;
64
+ declare const index_METADATA_KEY_METADATA_JSON: typeof METADATA_KEY_METADATA_JSON;
65
+ declare const index_METADATA_KEY_STATUS: typeof METADATA_KEY_STATUS;
66
+ declare const index_METADATA_KEY_TRAIT_HASHES: typeof METADATA_KEY_TRAIT_HASHES;
67
+ declare const index_METADATA_KEY_VERSION_MAJOR: typeof METADATA_KEY_VERSION_MAJOR;
68
+ declare const index_METADATA_KEY_VERSION_MINOR: typeof METADATA_KEY_VERSION_MINOR;
69
+ declare const index_METADATA_KEY_VERSION_PATCH: typeof METADATA_KEY_VERSION_PATCH;
70
+ type index_RegistryStatus = RegistryStatus;
71
+ type index_Version = Version;
72
+ declare const index_compareVersions: typeof compareVersions;
73
+ declare const index_computeDataHashFromUrl: typeof computeDataHashFromUrl;
74
+ declare const index_computeInterfacesBitmap: typeof computeInterfacesBitmap;
75
+ declare const index_formatVersion: typeof formatVersion;
76
+ declare const index_getInterfaceTypes: typeof getInterfaceTypes;
77
+ declare const index_getLatestVersion: typeof getLatestVersion;
78
+ declare const index_hasInterface: typeof hasInterface;
79
+ declare const index_hashTrait: typeof hashTrait;
80
+ declare const index_hashTraits: typeof hashTraits;
81
+ declare const index_isValidRegistryStatus: typeof isValidRegistryStatus;
82
+ declare const index_isVersionEqual: typeof isVersionEqual;
83
+ declare const index_isVersionGreater: typeof isVersionGreater;
84
+ declare const index_parseBitmapToFlags: typeof parseBitmapToFlags;
85
+ declare const index_parseVersion: typeof parseVersion;
86
+ declare const index_registryCodeToStatus: typeof registryCodeToStatus;
87
+ declare const index_registryStatusToCode: typeof registryStatusToCode;
88
+ declare const index_verifyDataUrlHash: typeof verifyDataUrlHash;
89
+ declare namespace index {
90
+ export { type index_DataHashAlgorithm as DataHashAlgorithm, type Hex$2 as Hex, type index_InterfaceFlags as InterfaceFlags, type index_InterfaceType as InterfaceType, index_METADATA_KEY_CONTRACT_ID as METADATA_KEY_CONTRACT_ID, index_METADATA_KEY_DATA_HASH as METADATA_KEY_DATA_HASH, index_METADATA_KEY_DATA_HASH_ALGORITHM as METADATA_KEY_DATA_HASH_ALGORITHM, index_METADATA_KEY_DID as METADATA_KEY_DID, index_METADATA_KEY_DID_HASH as METADATA_KEY_DID_HASH, index_METADATA_KEY_FUNGIBLE_TOKEN_ID as METADATA_KEY_FUNGIBLE_TOKEN_ID, index_METADATA_KEY_INTERFACES as METADATA_KEY_INTERFACES, index_METADATA_KEY_METADATA_JSON as METADATA_KEY_METADATA_JSON, index_METADATA_KEY_STATUS as METADATA_KEY_STATUS, index_METADATA_KEY_TRAIT_HASHES as METADATA_KEY_TRAIT_HASHES, index_METADATA_KEY_VERSION_MAJOR as METADATA_KEY_VERSION_MAJOR, index_METADATA_KEY_VERSION_MINOR as METADATA_KEY_VERSION_MINOR, index_METADATA_KEY_VERSION_PATCH as METADATA_KEY_VERSION_PATCH, type index_RegistryStatus as RegistryStatus, type index_Version as Version, index_compareVersions as compareVersions, index_computeDataHashFromUrl as computeDataHashFromUrl, index_computeInterfacesBitmap as computeInterfacesBitmap, index_formatVersion as formatVersion, index_getInterfaceTypes as getInterfaceTypes, index_getLatestVersion as getLatestVersion, index_hasInterface as hasInterface, index_hashTrait as hashTrait, index_hashTraits as hashTraits, index_isValidRegistryStatus as isValidRegistryStatus, index_isVersionEqual as isVersionEqual, index_isVersionGreater as isVersionGreater, index_parseBitmapToFlags as parseBitmapToFlags, index_parseVersion as parseVersion, index_registryCodeToStatus as registryCodeToStatus, index_registryStatusToCode as registryStatusToCode, index_verifyDataUrlHash as verifyDataUrlHash };
91
+ }
92
+
93
+ export { parseBitmapToFlags as A, parseVersion as B, registryCodeToStatus as C, type DataHashAlgorithm as D, registryStatusToCode as E, verifyDataUrlHash as F, type Hex$2 as H, type InterfaceFlags as I, METADATA_KEY_CONTRACT_ID as M, type RegistryStatus as R, type Version as V, type InterfaceType as a, METADATA_KEY_DATA_HASH as b, METADATA_KEY_DATA_HASH_ALGORITHM as c, METADATA_KEY_DID as d, METADATA_KEY_DID_HASH as e, METADATA_KEY_FUNGIBLE_TOKEN_ID as f, METADATA_KEY_INTERFACES as g, METADATA_KEY_METADATA_JSON as h, index as i, METADATA_KEY_STATUS as j, METADATA_KEY_TRAIT_HASHES as k, METADATA_KEY_VERSION_MAJOR as l, METADATA_KEY_VERSION_MINOR as m, METADATA_KEY_VERSION_PATCH as n, compareVersions as o, computeDataHashFromUrl as p, computeInterfacesBitmap as q, formatVersion as r, getInterfaceTypes as s, getLatestVersion as t, hasInterface as u, hashTrait as v, hashTraits as w, isValidRegistryStatus as x, isVersionEqual as y, isVersionGreater as z };