@biglup/cometa 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,155 @@ declare const ready: () => Promise<void>;
8
8
  declare const getModule: () => any;
9
9
  declare const isReady: () => boolean;
10
10
 
11
+ declare enum AddressType {
12
+ BasePaymentKeyStakeKey = 0,
13
+ BasePaymentScriptStakeKey = 1,
14
+ BasePaymentKeyStakeScript = 2,
15
+ BasePaymentScriptStakeScript = 3,
16
+ PointerKey = 4,
17
+ PointerScript = 5,
18
+ EnterpriseKey = 6,
19
+ EnterpriseScript = 7,
20
+ Byron = 8,
21
+ RewardKey = 14,
22
+ RewardScript = 15
23
+ }
24
+
25
+ declare enum CredentialType {
26
+ KeyHash = 0,
27
+ ScriptHash = 1
28
+ }
29
+
30
+ type Credential = {
31
+ hash: string;
32
+ type: CredentialType;
33
+ };
34
+
35
+ declare enum NetworkId {
36
+ Testnet = 0,
37
+ Mainnet = 1
38
+ }
39
+
40
+ declare class BaseAddress {
41
+ ptr: number;
42
+ constructor(ptr: number);
43
+ static fromCredentials(networkId: NetworkId, payment: Credential, stake: Credential): BaseAddress;
44
+ static fromAddress(address: Address): BaseAddress;
45
+ static fromBytes(data: Uint8Array): BaseAddress;
46
+ static fromBech32(data: string): BaseAddress;
47
+ toAddress(): Address;
48
+ getPaymentCredential(): Credential;
49
+ getStakeCredential(): Credential;
50
+ getNetworkId(): NetworkId;
51
+ toBytes(): Uint8Array;
52
+ toBech32(): string;
53
+ refCount(): number;
54
+ }
55
+
56
+ interface ByronAddressAttributes {
57
+ derivationPath: string;
58
+ magic: number;
59
+ }
60
+
61
+ declare enum ByronAddressType {
62
+ PubKey = 0,
63
+ Script = 1,
64
+ Redeem = 2
65
+ }
66
+
67
+ declare class ByronAddress {
68
+ ptr: number;
69
+ constructor(ptr: number);
70
+ static fromCredentials(root: string, attributes: ByronAddressAttributes, type: ByronAddressType): ByronAddress;
71
+ static fromAddress(address: Address): ByronAddress;
72
+ static fromBytes(bytes: Uint8Array): ByronAddress;
73
+ static fromBase58(base58: string): ByronAddress;
74
+ toAddress(): Address;
75
+ getAttributes(): ByronAddressAttributes;
76
+ getType(): ByronAddressType;
77
+ getRoot(): string;
78
+ getBytes(): Uint8Array;
79
+ toBase58(): string;
80
+ getNetworkId(): NetworkId;
81
+ refCount(): number;
82
+ }
83
+
84
+ declare class EnterpriseAddress {
85
+ ptr: number;
86
+ constructor(ptr: number);
87
+ static fromCredentials(networkId: NetworkId, payment: Credential): EnterpriseAddress;
88
+ static fromAddress(address: Address): EnterpriseAddress;
89
+ static fromBytes(data: Uint8Array): EnterpriseAddress;
90
+ static fromBech32(data: string): EnterpriseAddress;
91
+ toAddress(): Address;
92
+ getCredential(): Credential;
93
+ getNetworkId(): NetworkId;
94
+ toBytes(): Uint8Array;
95
+ toBech32(): string;
96
+ refCount(): number;
97
+ }
98
+
99
+ interface StakePointer {
100
+ slot: bigint;
101
+ txIndex: number;
102
+ certIndex: number;
103
+ }
104
+
105
+ declare class PointerAddress {
106
+ ptr: number;
107
+ constructor(ptr: number);
108
+ static fromCredentials(networkId: NetworkId, payment: Credential, stakePointer: StakePointer): PointerAddress;
109
+ static fromAddress(address: Address): PointerAddress;
110
+ static fromBytes(data: Uint8Array): PointerAddress;
111
+ static fromBech32(data: string): PointerAddress;
112
+ toAddress(): Address;
113
+ getPaymentCredential(): Credential;
114
+ getStakePointer(): StakePointer;
115
+ getNetworkId(): NetworkId;
116
+ toBytes(): Uint8Array;
117
+ toBech32(): string;
118
+ refCount(): number;
119
+ }
120
+
121
+ declare class RewardAddress {
122
+ ptr: number;
123
+ constructor(ptr: number);
124
+ static fromCredentials(networkId: NetworkId, stake: Credential): RewardAddress;
125
+ static fromAddress(address: Address): RewardAddress;
126
+ static fromBytes(data: Uint8Array): RewardAddress;
127
+ static fromBech32(data: string): RewardAddress;
128
+ toAddress(): Address;
129
+ getCredential(): Credential;
130
+ getNetworkId(): NetworkId;
131
+ toBytes(): Uint8Array;
132
+ toBech32(): string;
133
+ refCount(): number;
134
+ }
135
+
136
+ declare class Address {
137
+ ptr: number;
138
+ constructor(ptr: number);
139
+ static fromBytes(data: Uint8Array): Address;
140
+ static fromHex(hex: string): Address;
141
+ static fromString(address: string): Address;
142
+ toBytes(): Uint8Array;
143
+ toHex(): string;
144
+ toString(): string;
145
+ refCount(): number;
146
+ static isValidBech32(bech32: string): boolean;
147
+ static isValidByron(byron: string): boolean;
148
+ static isValid(address: string): boolean;
149
+ getType(): AddressType;
150
+ getNetworkId(): NetworkId;
151
+ asBase(): BaseAddress | null;
152
+ asEnterprise(): EnterpriseAddress | null;
153
+ asPointer(): PointerAddress | null;
154
+ asReward(): RewardAddress | null;
155
+ asByron(): ByronAddress | null;
156
+ private getBytesSize;
157
+ private getStringSize;
158
+ }
159
+
11
160
  declare enum CborMajorType {
12
161
  UnsignedInteger = 0,
13
162
  NegativeInteger = 1,
@@ -155,17 +304,6 @@ declare const finalizationRegistry: FinalizationRegistry<{
155
304
  freeFunc: any;
156
305
  }>;
157
306
 
158
- declare class ProtocolVersion {
159
- ptr: number;
160
- constructor(major: number, minor: number);
161
- static fromCbor(reader: CborReader): ProtocolVersion;
162
- toCbor(writer: CborWriter): void;
163
- getMajor(): number;
164
- setMajor(major: number): void;
165
- getMinor(): number;
166
- setMinor(minor: number): void;
167
- }
168
-
169
307
  declare class Crc32 {
170
308
  private constructor();
171
309
  static compute(data: Uint8Array): number;
@@ -262,4 +400,28 @@ declare class Bip32PrivateKey {
262
400
  private getBytesSize;
263
401
  }
264
402
 
265
- export { Base58, Bech32, type Bech32DecodeResult, Bip32PrivateKey, Bip32PublicKey, Blake2b, CborMajorType, CborReader, CborReaderState, CborSimpleValue, CborTag, CborWriter, Crc32, Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature, Emip003, Pbkdf2HmacSha512, ProtocolVersion, finalizationRegistry, getLibCardanoCVersion, getModule, hexToUint8Array, isReady, ready, uint8ArrayToHex, uint8ArrayToUtf8, utf8ToUint8Array };
403
+ declare const writeStringToMemory: (str: string) => number;
404
+ declare const getErrorString: (error: number) => string;
405
+
406
+ declare const MIN_SIGNED_64BIT: bigint;
407
+ declare const MAX_SIGNED_64BIT: bigint;
408
+ declare const MAX_UNSIGNED_64BIT: bigint;
409
+ declare const splitToLowHigh64bit: (value: number | bigint) => {
410
+ low: number;
411
+ high: number;
412
+ };
413
+ declare const readI64: (ptr: any, isSigned?: boolean) => bigint;
414
+ declare const writeI64: (ptr: number, value: number | bigint, signed?: boolean) => void;
415
+
416
+ declare const unrefObject: (ptr: number) => void;
417
+ declare const assertSuccess: (result: number, lastError: string) => void;
418
+ declare const readBufferData: (bufferPtr: number) => Uint8Array;
419
+
420
+ declare const readCredential: (credentialPtr: number) => Credential;
421
+ declare const writeCredential: (credential: Credential) => number;
422
+
423
+ declare const blake2bHashFromBytes: (data: Uint8Array) => number;
424
+ declare const blake2bHashFromHex: (hex: string) => number;
425
+ declare const readBlake2bHashData: (bufferPtr: number) => Uint8Array;
426
+
427
+ export { Address, AddressType, Base58, BaseAddress, Bech32, type Bech32DecodeResult, Bip32PrivateKey, Bip32PublicKey, Blake2b, ByronAddress, ByronAddressType, CborMajorType, CborReader, CborReaderState, CborSimpleValue, CborTag, CborWriter, Crc32, type Credential, CredentialType, Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature, Emip003, EnterpriseAddress, MAX_SIGNED_64BIT, MAX_UNSIGNED_64BIT, MIN_SIGNED_64BIT, NetworkId, Pbkdf2HmacSha512, PointerAddress, RewardAddress, type StakePointer, assertSuccess, blake2bHashFromBytes, blake2bHashFromHex, finalizationRegistry, getErrorString, getLibCardanoCVersion, getModule, hexToUint8Array, isReady, readBlake2bHashData, readBufferData, readCredential, readI64, ready, splitToLowHigh64bit, uint8ArrayToHex, uint8ArrayToUtf8, unrefObject, utf8ToUint8Array, writeCredential, writeI64, writeStringToMemory };
@@ -8,6 +8,155 @@ declare const ready: () => Promise<void>;
8
8
  declare const getModule: () => any;
9
9
  declare const isReady: () => boolean;
10
10
 
11
+ declare enum AddressType {
12
+ BasePaymentKeyStakeKey = 0,
13
+ BasePaymentScriptStakeKey = 1,
14
+ BasePaymentKeyStakeScript = 2,
15
+ BasePaymentScriptStakeScript = 3,
16
+ PointerKey = 4,
17
+ PointerScript = 5,
18
+ EnterpriseKey = 6,
19
+ EnterpriseScript = 7,
20
+ Byron = 8,
21
+ RewardKey = 14,
22
+ RewardScript = 15
23
+ }
24
+
25
+ declare enum CredentialType {
26
+ KeyHash = 0,
27
+ ScriptHash = 1
28
+ }
29
+
30
+ type Credential = {
31
+ hash: string;
32
+ type: CredentialType;
33
+ };
34
+
35
+ declare enum NetworkId {
36
+ Testnet = 0,
37
+ Mainnet = 1
38
+ }
39
+
40
+ declare class BaseAddress {
41
+ ptr: number;
42
+ constructor(ptr: number);
43
+ static fromCredentials(networkId: NetworkId, payment: Credential, stake: Credential): BaseAddress;
44
+ static fromAddress(address: Address): BaseAddress;
45
+ static fromBytes(data: Uint8Array): BaseAddress;
46
+ static fromBech32(data: string): BaseAddress;
47
+ toAddress(): Address;
48
+ getPaymentCredential(): Credential;
49
+ getStakeCredential(): Credential;
50
+ getNetworkId(): NetworkId;
51
+ toBytes(): Uint8Array;
52
+ toBech32(): string;
53
+ refCount(): number;
54
+ }
55
+
56
+ interface ByronAddressAttributes {
57
+ derivationPath: string;
58
+ magic: number;
59
+ }
60
+
61
+ declare enum ByronAddressType {
62
+ PubKey = 0,
63
+ Script = 1,
64
+ Redeem = 2
65
+ }
66
+
67
+ declare class ByronAddress {
68
+ ptr: number;
69
+ constructor(ptr: number);
70
+ static fromCredentials(root: string, attributes: ByronAddressAttributes, type: ByronAddressType): ByronAddress;
71
+ static fromAddress(address: Address): ByronAddress;
72
+ static fromBytes(bytes: Uint8Array): ByronAddress;
73
+ static fromBase58(base58: string): ByronAddress;
74
+ toAddress(): Address;
75
+ getAttributes(): ByronAddressAttributes;
76
+ getType(): ByronAddressType;
77
+ getRoot(): string;
78
+ getBytes(): Uint8Array;
79
+ toBase58(): string;
80
+ getNetworkId(): NetworkId;
81
+ refCount(): number;
82
+ }
83
+
84
+ declare class EnterpriseAddress {
85
+ ptr: number;
86
+ constructor(ptr: number);
87
+ static fromCredentials(networkId: NetworkId, payment: Credential): EnterpriseAddress;
88
+ static fromAddress(address: Address): EnterpriseAddress;
89
+ static fromBytes(data: Uint8Array): EnterpriseAddress;
90
+ static fromBech32(data: string): EnterpriseAddress;
91
+ toAddress(): Address;
92
+ getCredential(): Credential;
93
+ getNetworkId(): NetworkId;
94
+ toBytes(): Uint8Array;
95
+ toBech32(): string;
96
+ refCount(): number;
97
+ }
98
+
99
+ interface StakePointer {
100
+ slot: bigint;
101
+ txIndex: number;
102
+ certIndex: number;
103
+ }
104
+
105
+ declare class PointerAddress {
106
+ ptr: number;
107
+ constructor(ptr: number);
108
+ static fromCredentials(networkId: NetworkId, payment: Credential, stakePointer: StakePointer): PointerAddress;
109
+ static fromAddress(address: Address): PointerAddress;
110
+ static fromBytes(data: Uint8Array): PointerAddress;
111
+ static fromBech32(data: string): PointerAddress;
112
+ toAddress(): Address;
113
+ getPaymentCredential(): Credential;
114
+ getStakePointer(): StakePointer;
115
+ getNetworkId(): NetworkId;
116
+ toBytes(): Uint8Array;
117
+ toBech32(): string;
118
+ refCount(): number;
119
+ }
120
+
121
+ declare class RewardAddress {
122
+ ptr: number;
123
+ constructor(ptr: number);
124
+ static fromCredentials(networkId: NetworkId, stake: Credential): RewardAddress;
125
+ static fromAddress(address: Address): RewardAddress;
126
+ static fromBytes(data: Uint8Array): RewardAddress;
127
+ static fromBech32(data: string): RewardAddress;
128
+ toAddress(): Address;
129
+ getCredential(): Credential;
130
+ getNetworkId(): NetworkId;
131
+ toBytes(): Uint8Array;
132
+ toBech32(): string;
133
+ refCount(): number;
134
+ }
135
+
136
+ declare class Address {
137
+ ptr: number;
138
+ constructor(ptr: number);
139
+ static fromBytes(data: Uint8Array): Address;
140
+ static fromHex(hex: string): Address;
141
+ static fromString(address: string): Address;
142
+ toBytes(): Uint8Array;
143
+ toHex(): string;
144
+ toString(): string;
145
+ refCount(): number;
146
+ static isValidBech32(bech32: string): boolean;
147
+ static isValidByron(byron: string): boolean;
148
+ static isValid(address: string): boolean;
149
+ getType(): AddressType;
150
+ getNetworkId(): NetworkId;
151
+ asBase(): BaseAddress | null;
152
+ asEnterprise(): EnterpriseAddress | null;
153
+ asPointer(): PointerAddress | null;
154
+ asReward(): RewardAddress | null;
155
+ asByron(): ByronAddress | null;
156
+ private getBytesSize;
157
+ private getStringSize;
158
+ }
159
+
11
160
  declare enum CborMajorType {
12
161
  UnsignedInteger = 0,
13
162
  NegativeInteger = 1,
@@ -155,17 +304,6 @@ declare const finalizationRegistry: FinalizationRegistry<{
155
304
  freeFunc: any;
156
305
  }>;
157
306
 
158
- declare class ProtocolVersion {
159
- ptr: number;
160
- constructor(major: number, minor: number);
161
- static fromCbor(reader: CborReader): ProtocolVersion;
162
- toCbor(writer: CborWriter): void;
163
- getMajor(): number;
164
- setMajor(major: number): void;
165
- getMinor(): number;
166
- setMinor(minor: number): void;
167
- }
168
-
169
307
  declare class Crc32 {
170
308
  private constructor();
171
309
  static compute(data: Uint8Array): number;
@@ -262,4 +400,28 @@ declare class Bip32PrivateKey {
262
400
  private getBytesSize;
263
401
  }
264
402
 
265
- export { Base58, Bech32, type Bech32DecodeResult, Bip32PrivateKey, Bip32PublicKey, Blake2b, CborMajorType, CborReader, CborReaderState, CborSimpleValue, CborTag, CborWriter, Crc32, Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature, Emip003, Pbkdf2HmacSha512, ProtocolVersion, finalizationRegistry, getLibCardanoCVersion, getModule, hexToUint8Array, isReady, ready, uint8ArrayToHex, uint8ArrayToUtf8, utf8ToUint8Array };
403
+ declare const writeStringToMemory: (str: string) => number;
404
+ declare const getErrorString: (error: number) => string;
405
+
406
+ declare const MIN_SIGNED_64BIT: bigint;
407
+ declare const MAX_SIGNED_64BIT: bigint;
408
+ declare const MAX_UNSIGNED_64BIT: bigint;
409
+ declare const splitToLowHigh64bit: (value: number | bigint) => {
410
+ low: number;
411
+ high: number;
412
+ };
413
+ declare const readI64: (ptr: any, isSigned?: boolean) => bigint;
414
+ declare const writeI64: (ptr: number, value: number | bigint, signed?: boolean) => void;
415
+
416
+ declare const unrefObject: (ptr: number) => void;
417
+ declare const assertSuccess: (result: number, lastError: string) => void;
418
+ declare const readBufferData: (bufferPtr: number) => Uint8Array;
419
+
420
+ declare const readCredential: (credentialPtr: number) => Credential;
421
+ declare const writeCredential: (credential: Credential) => number;
422
+
423
+ declare const blake2bHashFromBytes: (data: Uint8Array) => number;
424
+ declare const blake2bHashFromHex: (hex: string) => number;
425
+ declare const readBlake2bHashData: (bufferPtr: number) => Uint8Array;
426
+
427
+ export { Address, AddressType, Base58, BaseAddress, Bech32, type Bech32DecodeResult, Bip32PrivateKey, Bip32PublicKey, Blake2b, ByronAddress, ByronAddressType, CborMajorType, CborReader, CborReaderState, CborSimpleValue, CborTag, CborWriter, Crc32, type Credential, CredentialType, Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature, Emip003, EnterpriseAddress, MAX_SIGNED_64BIT, MAX_UNSIGNED_64BIT, MIN_SIGNED_64BIT, NetworkId, Pbkdf2HmacSha512, PointerAddress, RewardAddress, type StakePointer, assertSuccess, blake2bHashFromBytes, blake2bHashFromHex, finalizationRegistry, getErrorString, getLibCardanoCVersion, getModule, hexToUint8Array, isReady, readBlake2bHashData, readBufferData, readCredential, readI64, ready, splitToLowHigh64bit, uint8ArrayToHex, uint8ArrayToUtf8, unrefObject, utf8ToUint8Array, writeCredential, writeI64, writeStringToMemory };