@biglup/cometa 1.0.1 → 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.
- package/README.md +30 -13
- package/dist/cjs/index.d.mts +295 -9
- package/dist/cjs/index.d.ts +295 -9
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.d.mts +295 -9
- package/dist/esm/index.d.ts +295 -9
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +10 -5
package/dist/esm/index.d.mts
CHANGED
|
@@ -1,9 +1,162 @@
|
|
|
1
1
|
declare const getLibCardanoCVersion: () => string;
|
|
2
|
+
declare const hexToUint8Array: (hexString: string) => Uint8Array;
|
|
3
|
+
declare const uint8ArrayToHex: (byteArray: Uint8Array) => string;
|
|
4
|
+
declare const utf8ToUint8Array: (str: string) => Uint8Array;
|
|
5
|
+
declare const uint8ArrayToUtf8: (uint8Array: Uint8Array) => string;
|
|
2
6
|
|
|
3
7
|
declare const ready: () => Promise<void>;
|
|
4
8
|
declare const getModule: () => any;
|
|
5
9
|
declare const isReady: () => boolean;
|
|
6
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
|
+
|
|
7
160
|
declare enum CborMajorType {
|
|
8
161
|
UnsignedInteger = 0,
|
|
9
162
|
NegativeInteger = 1,
|
|
@@ -122,20 +275,153 @@ declare class CborWriter {
|
|
|
122
275
|
getRefCount(): number;
|
|
123
276
|
}
|
|
124
277
|
|
|
278
|
+
declare class Base58 {
|
|
279
|
+
private constructor();
|
|
280
|
+
static encode(data: Uint8Array): string;
|
|
281
|
+
static decode(encodedString: string): Uint8Array;
|
|
282
|
+
static encodeFromHex(hexString: string): string;
|
|
283
|
+
static decodeFromHex(base58String: string): string;
|
|
284
|
+
private static getEncodedLength;
|
|
285
|
+
private static getDecodedLength;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
type Bech32DecodeResult = {
|
|
289
|
+
hrp: string;
|
|
290
|
+
data: Uint8Array;
|
|
291
|
+
hex: string;
|
|
292
|
+
};
|
|
293
|
+
declare class Bech32 {
|
|
294
|
+
private constructor();
|
|
295
|
+
static encode(hrp: string, data: Uint8Array): string;
|
|
296
|
+
static encodeFromHex(hrp: string, data: string): string;
|
|
297
|
+
static decode(encodedString: string): Bech32DecodeResult;
|
|
298
|
+
private static getEncodedLength;
|
|
299
|
+
private static getDecodedLength;
|
|
300
|
+
}
|
|
301
|
+
|
|
125
302
|
declare const finalizationRegistry: FinalizationRegistry<{
|
|
126
303
|
ptr: any;
|
|
127
304
|
freeFunc: any;
|
|
128
305
|
}>;
|
|
129
306
|
|
|
130
|
-
declare class
|
|
307
|
+
declare class Crc32 {
|
|
308
|
+
private constructor();
|
|
309
|
+
static compute(data: Uint8Array): number;
|
|
310
|
+
static computeFromHex(hexString: string): number;
|
|
311
|
+
static computeFromUtf8(data: string): number;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
declare class Pbkdf2HmacSha512 {
|
|
315
|
+
private constructor();
|
|
316
|
+
static compute(password: Uint8Array, salt: Uint8Array, iterations: number, derivedKeyLength: number): Uint8Array;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
declare class Emip003 {
|
|
320
|
+
static encrypt(data: Uint8Array, passphrase: Uint8Array): Uint8Array;
|
|
321
|
+
static decrypt(encryptedData: Uint8Array, passphrase: Uint8Array): Uint8Array;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
declare class Blake2b {
|
|
325
|
+
private constructor();
|
|
326
|
+
static computeHash(data: Uint8Array, hashLength: number): Uint8Array;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
declare class Ed25519Signature {
|
|
131
330
|
ptr: number;
|
|
132
|
-
constructor(
|
|
133
|
-
static
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
331
|
+
constructor(ptr: number);
|
|
332
|
+
static fromBytes(data: Uint8Array): Ed25519Signature;
|
|
333
|
+
static fromHex(hex: string): Ed25519Signature;
|
|
334
|
+
toBytes(): Uint8Array;
|
|
335
|
+
toHex(): string;
|
|
336
|
+
refCount(): number;
|
|
337
|
+
private getBytesSize;
|
|
338
|
+
private getHexSize;
|
|
139
339
|
}
|
|
140
340
|
|
|
141
|
-
|
|
341
|
+
declare class Ed25519PublicKey {
|
|
342
|
+
ptr: number;
|
|
343
|
+
constructor(ptr: number);
|
|
344
|
+
static fromBytes(data: Uint8Array): Ed25519PublicKey;
|
|
345
|
+
static fromHex(hex: string): Ed25519PublicKey;
|
|
346
|
+
toBytes(): Uint8Array;
|
|
347
|
+
toHex(): string;
|
|
348
|
+
verify(signature: Ed25519Signature, message: Uint8Array): boolean;
|
|
349
|
+
toHash(): Uint8Array;
|
|
350
|
+
toHashHex(): string;
|
|
351
|
+
refCount(): number;
|
|
352
|
+
private getBytesSize;
|
|
353
|
+
private getHexSize;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
declare class Bip32PublicKey {
|
|
357
|
+
ptr: number;
|
|
358
|
+
constructor(ptr: number);
|
|
359
|
+
static fromBytes(data: Uint8Array): Bip32PublicKey;
|
|
360
|
+
static fromHex(hex: string): Bip32PublicKey;
|
|
361
|
+
toBytes(): Uint8Array;
|
|
362
|
+
toHex(): string;
|
|
363
|
+
derive(indices: number[]): Bip32PublicKey;
|
|
364
|
+
toEd25519Key(): Ed25519PublicKey;
|
|
365
|
+
toHash(): Uint8Array;
|
|
366
|
+
toHashHex(): string;
|
|
367
|
+
refCount(): number;
|
|
368
|
+
private getBytesSize;
|
|
369
|
+
private getHexSize;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
declare class Ed25519PrivateKey {
|
|
373
|
+
ptr: number;
|
|
374
|
+
constructor(ptr: number);
|
|
375
|
+
static fromNormalBytes(data: Uint8Array): Ed25519PrivateKey;
|
|
376
|
+
static fromExtendedBytes(data: Uint8Array): Ed25519PrivateKey;
|
|
377
|
+
static fromNormalHex(hex: string): Ed25519PrivateKey;
|
|
378
|
+
static fromExtendedHex(hex: string): Ed25519PrivateKey;
|
|
379
|
+
toBytes(): Uint8Array;
|
|
380
|
+
toHex(): string;
|
|
381
|
+
sign(message: Uint8Array): Ed25519Signature;
|
|
382
|
+
getPublicKey(): Ed25519PublicKey;
|
|
383
|
+
refCount(): number;
|
|
384
|
+
private getBytesSize;
|
|
385
|
+
private getHexSize;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
declare class Bip32PrivateKey {
|
|
389
|
+
ptr: number;
|
|
390
|
+
private constructor();
|
|
391
|
+
static fromBip39Entropy(password: Uint8Array, entropy: Uint8Array): Bip32PrivateKey;
|
|
392
|
+
static fromBytes(data: Uint8Array): Bip32PrivateKey;
|
|
393
|
+
static fromHex(hex: string): Bip32PrivateKey;
|
|
394
|
+
derive(indices: number[]): Bip32PrivateKey;
|
|
395
|
+
getPublicKey(): Bip32PublicKey;
|
|
396
|
+
toBytes(): Uint8Array;
|
|
397
|
+
toHex(): string;
|
|
398
|
+
toEd25519Key(): Ed25519PrivateKey;
|
|
399
|
+
refCount(): number;
|
|
400
|
+
private getBytesSize;
|
|
401
|
+
}
|
|
402
|
+
|
|
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 };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,162 @@
|
|
|
1
1
|
declare const getLibCardanoCVersion: () => string;
|
|
2
|
+
declare const hexToUint8Array: (hexString: string) => Uint8Array;
|
|
3
|
+
declare const uint8ArrayToHex: (byteArray: Uint8Array) => string;
|
|
4
|
+
declare const utf8ToUint8Array: (str: string) => Uint8Array;
|
|
5
|
+
declare const uint8ArrayToUtf8: (uint8Array: Uint8Array) => string;
|
|
2
6
|
|
|
3
7
|
declare const ready: () => Promise<void>;
|
|
4
8
|
declare const getModule: () => any;
|
|
5
9
|
declare const isReady: () => boolean;
|
|
6
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
|
+
|
|
7
160
|
declare enum CborMajorType {
|
|
8
161
|
UnsignedInteger = 0,
|
|
9
162
|
NegativeInteger = 1,
|
|
@@ -122,20 +275,153 @@ declare class CborWriter {
|
|
|
122
275
|
getRefCount(): number;
|
|
123
276
|
}
|
|
124
277
|
|
|
278
|
+
declare class Base58 {
|
|
279
|
+
private constructor();
|
|
280
|
+
static encode(data: Uint8Array): string;
|
|
281
|
+
static decode(encodedString: string): Uint8Array;
|
|
282
|
+
static encodeFromHex(hexString: string): string;
|
|
283
|
+
static decodeFromHex(base58String: string): string;
|
|
284
|
+
private static getEncodedLength;
|
|
285
|
+
private static getDecodedLength;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
type Bech32DecodeResult = {
|
|
289
|
+
hrp: string;
|
|
290
|
+
data: Uint8Array;
|
|
291
|
+
hex: string;
|
|
292
|
+
};
|
|
293
|
+
declare class Bech32 {
|
|
294
|
+
private constructor();
|
|
295
|
+
static encode(hrp: string, data: Uint8Array): string;
|
|
296
|
+
static encodeFromHex(hrp: string, data: string): string;
|
|
297
|
+
static decode(encodedString: string): Bech32DecodeResult;
|
|
298
|
+
private static getEncodedLength;
|
|
299
|
+
private static getDecodedLength;
|
|
300
|
+
}
|
|
301
|
+
|
|
125
302
|
declare const finalizationRegistry: FinalizationRegistry<{
|
|
126
303
|
ptr: any;
|
|
127
304
|
freeFunc: any;
|
|
128
305
|
}>;
|
|
129
306
|
|
|
130
|
-
declare class
|
|
307
|
+
declare class Crc32 {
|
|
308
|
+
private constructor();
|
|
309
|
+
static compute(data: Uint8Array): number;
|
|
310
|
+
static computeFromHex(hexString: string): number;
|
|
311
|
+
static computeFromUtf8(data: string): number;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
declare class Pbkdf2HmacSha512 {
|
|
315
|
+
private constructor();
|
|
316
|
+
static compute(password: Uint8Array, salt: Uint8Array, iterations: number, derivedKeyLength: number): Uint8Array;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
declare class Emip003 {
|
|
320
|
+
static encrypt(data: Uint8Array, passphrase: Uint8Array): Uint8Array;
|
|
321
|
+
static decrypt(encryptedData: Uint8Array, passphrase: Uint8Array): Uint8Array;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
declare class Blake2b {
|
|
325
|
+
private constructor();
|
|
326
|
+
static computeHash(data: Uint8Array, hashLength: number): Uint8Array;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
declare class Ed25519Signature {
|
|
131
330
|
ptr: number;
|
|
132
|
-
constructor(
|
|
133
|
-
static
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
331
|
+
constructor(ptr: number);
|
|
332
|
+
static fromBytes(data: Uint8Array): Ed25519Signature;
|
|
333
|
+
static fromHex(hex: string): Ed25519Signature;
|
|
334
|
+
toBytes(): Uint8Array;
|
|
335
|
+
toHex(): string;
|
|
336
|
+
refCount(): number;
|
|
337
|
+
private getBytesSize;
|
|
338
|
+
private getHexSize;
|
|
139
339
|
}
|
|
140
340
|
|
|
141
|
-
|
|
341
|
+
declare class Ed25519PublicKey {
|
|
342
|
+
ptr: number;
|
|
343
|
+
constructor(ptr: number);
|
|
344
|
+
static fromBytes(data: Uint8Array): Ed25519PublicKey;
|
|
345
|
+
static fromHex(hex: string): Ed25519PublicKey;
|
|
346
|
+
toBytes(): Uint8Array;
|
|
347
|
+
toHex(): string;
|
|
348
|
+
verify(signature: Ed25519Signature, message: Uint8Array): boolean;
|
|
349
|
+
toHash(): Uint8Array;
|
|
350
|
+
toHashHex(): string;
|
|
351
|
+
refCount(): number;
|
|
352
|
+
private getBytesSize;
|
|
353
|
+
private getHexSize;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
declare class Bip32PublicKey {
|
|
357
|
+
ptr: number;
|
|
358
|
+
constructor(ptr: number);
|
|
359
|
+
static fromBytes(data: Uint8Array): Bip32PublicKey;
|
|
360
|
+
static fromHex(hex: string): Bip32PublicKey;
|
|
361
|
+
toBytes(): Uint8Array;
|
|
362
|
+
toHex(): string;
|
|
363
|
+
derive(indices: number[]): Bip32PublicKey;
|
|
364
|
+
toEd25519Key(): Ed25519PublicKey;
|
|
365
|
+
toHash(): Uint8Array;
|
|
366
|
+
toHashHex(): string;
|
|
367
|
+
refCount(): number;
|
|
368
|
+
private getBytesSize;
|
|
369
|
+
private getHexSize;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
declare class Ed25519PrivateKey {
|
|
373
|
+
ptr: number;
|
|
374
|
+
constructor(ptr: number);
|
|
375
|
+
static fromNormalBytes(data: Uint8Array): Ed25519PrivateKey;
|
|
376
|
+
static fromExtendedBytes(data: Uint8Array): Ed25519PrivateKey;
|
|
377
|
+
static fromNormalHex(hex: string): Ed25519PrivateKey;
|
|
378
|
+
static fromExtendedHex(hex: string): Ed25519PrivateKey;
|
|
379
|
+
toBytes(): Uint8Array;
|
|
380
|
+
toHex(): string;
|
|
381
|
+
sign(message: Uint8Array): Ed25519Signature;
|
|
382
|
+
getPublicKey(): Ed25519PublicKey;
|
|
383
|
+
refCount(): number;
|
|
384
|
+
private getBytesSize;
|
|
385
|
+
private getHexSize;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
declare class Bip32PrivateKey {
|
|
389
|
+
ptr: number;
|
|
390
|
+
private constructor();
|
|
391
|
+
static fromBip39Entropy(password: Uint8Array, entropy: Uint8Array): Bip32PrivateKey;
|
|
392
|
+
static fromBytes(data: Uint8Array): Bip32PrivateKey;
|
|
393
|
+
static fromHex(hex: string): Bip32PrivateKey;
|
|
394
|
+
derive(indices: number[]): Bip32PrivateKey;
|
|
395
|
+
getPublicKey(): Bip32PublicKey;
|
|
396
|
+
toBytes(): Uint8Array;
|
|
397
|
+
toHex(): string;
|
|
398
|
+
toEd25519Key(): Ed25519PrivateKey;
|
|
399
|
+
refCount(): number;
|
|
400
|
+
private getBytesSize;
|
|
401
|
+
}
|
|
402
|
+
|
|
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 };
|