@biglup/cometa 1.0.0 → 1.0.2
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 +31 -14
- package/dist/cjs/index.d.mts +125 -1
- package/dist/cjs/index.d.ts +125 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.d.mts +125 -1
- package/dist/esm/index.d.ts +125 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<a href="
|
|
2
|
+
<a href="" target="_blank">
|
|
3
3
|
<img align="center" width="300" src="assets/cometa_js.png">
|
|
4
4
|
</a>
|
|
5
5
|
</div>
|
|
@@ -8,34 +8,51 @@
|
|
|
8
8
|
|
|
9
9
|
<div align="center">
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[
|
|
12
|
+

|
|
13
|
+

|
|
14
|
+
[](https://cometajs.readthedocs.io/en/latest/?badge=latest)
|
|
15
|
+
[](https://x.com/BiglupLabs)
|
|
16
16
|
|
|
17
17
|
</div>
|
|
18
18
|
|
|
19
19
|
<hr>
|
|
20
20
|
|
|
21
|
-
Cometa
|
|
21
|
+
Cometa.js is a lightweight, high-performance JavaScript library binding for the [libcardano-c](https://github.com/Biglup/cardano-c) Library, designed to simplify blockchain development on Cardano.
|
|
22
22
|
|
|
23
|
+
It embeds the WASM module directly into a single JavaScript file, ensuring a minimal footprint, fast performance, and effortless setup without requiring special server configurations.
|
|
24
|
+
|
|
25
|
+
Built on the foundation of [libcardano-c](https://github.com/Biglup/cardano-c), Cometa.js inherits its commercial-grade quality, rigorous testing, and adherence to strict standards. It is ideal for developing reliable and secure solutions for mission-critical blockchain applications.
|
|
23
26
|
<hr>
|
|
24
27
|
|
|
25
|
-
- [Official Website]()
|
|
26
|
-
- [Installation]()
|
|
27
|
-
- [Documentation]()
|
|
28
|
+
- [Official Website](https://cometa.dev/)
|
|
29
|
+
- [Installation](#installation)
|
|
30
|
+
- [Documentation](https://cometajs.readthedocs.io/en/latest/?badge=latest)
|
|
28
31
|
|
|
29
32
|
<hr>
|
|
30
33
|
|
|
31
|
-
### **
|
|
34
|
+
### **Installation**
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
To install Cometa.js on your project, use the following command:
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
```bash
|
|
39
|
+
yarn add @biglup/cometa
|
|
40
|
+
```
|
|
36
41
|
|
|
37
42
|
<hr>
|
|
38
43
|
|
|
39
|
-
### **
|
|
44
|
+
### **Building and Testing**
|
|
45
|
+
|
|
46
|
+
To build and run the tests, use the following commands:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
yarn install
|
|
50
|
+
yarn build
|
|
51
|
+
yarn test
|
|
52
|
+
```
|
|
40
53
|
|
|
41
54
|
<hr>
|
|
55
|
+
|
|
56
|
+
### **License**
|
|
57
|
+
|
|
58
|
+
Cometa.js is licensed under the Apache 2.0 License. See the [LICENSE](LICENSE) file for more information.
|
package/dist/cjs/index.d.mts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
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;
|
|
@@ -122,6 +126,30 @@ declare class CborWriter {
|
|
|
122
126
|
getRefCount(): number;
|
|
123
127
|
}
|
|
124
128
|
|
|
129
|
+
declare class Base58 {
|
|
130
|
+
private constructor();
|
|
131
|
+
static encode(data: Uint8Array): string;
|
|
132
|
+
static decode(encodedString: string): Uint8Array;
|
|
133
|
+
static encodeFromHex(hexString: string): string;
|
|
134
|
+
static decodeFromHex(base58String: string): string;
|
|
135
|
+
private static getEncodedLength;
|
|
136
|
+
private static getDecodedLength;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
type Bech32DecodeResult = {
|
|
140
|
+
hrp: string;
|
|
141
|
+
data: Uint8Array;
|
|
142
|
+
hex: string;
|
|
143
|
+
};
|
|
144
|
+
declare class Bech32 {
|
|
145
|
+
private constructor();
|
|
146
|
+
static encode(hrp: string, data: Uint8Array): string;
|
|
147
|
+
static encodeFromHex(hrp: string, data: string): string;
|
|
148
|
+
static decode(encodedString: string): Bech32DecodeResult;
|
|
149
|
+
private static getEncodedLength;
|
|
150
|
+
private static getDecodedLength;
|
|
151
|
+
}
|
|
152
|
+
|
|
125
153
|
declare const finalizationRegistry: FinalizationRegistry<{
|
|
126
154
|
ptr: any;
|
|
127
155
|
freeFunc: any;
|
|
@@ -138,4 +166,100 @@ declare class ProtocolVersion {
|
|
|
138
166
|
setMinor(minor: number): void;
|
|
139
167
|
}
|
|
140
168
|
|
|
141
|
-
|
|
169
|
+
declare class Crc32 {
|
|
170
|
+
private constructor();
|
|
171
|
+
static compute(data: Uint8Array): number;
|
|
172
|
+
static computeFromHex(hexString: string): number;
|
|
173
|
+
static computeFromUtf8(data: string): number;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
declare class Pbkdf2HmacSha512 {
|
|
177
|
+
private constructor();
|
|
178
|
+
static compute(password: Uint8Array, salt: Uint8Array, iterations: number, derivedKeyLength: number): Uint8Array;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare class Emip003 {
|
|
182
|
+
static encrypt(data: Uint8Array, passphrase: Uint8Array): Uint8Array;
|
|
183
|
+
static decrypt(encryptedData: Uint8Array, passphrase: Uint8Array): Uint8Array;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
declare class Blake2b {
|
|
187
|
+
private constructor();
|
|
188
|
+
static computeHash(data: Uint8Array, hashLength: number): Uint8Array;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
declare class Ed25519Signature {
|
|
192
|
+
ptr: number;
|
|
193
|
+
constructor(ptr: number);
|
|
194
|
+
static fromBytes(data: Uint8Array): Ed25519Signature;
|
|
195
|
+
static fromHex(hex: string): Ed25519Signature;
|
|
196
|
+
toBytes(): Uint8Array;
|
|
197
|
+
toHex(): string;
|
|
198
|
+
refCount(): number;
|
|
199
|
+
private getBytesSize;
|
|
200
|
+
private getHexSize;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
declare class Ed25519PublicKey {
|
|
204
|
+
ptr: number;
|
|
205
|
+
constructor(ptr: number);
|
|
206
|
+
static fromBytes(data: Uint8Array): Ed25519PublicKey;
|
|
207
|
+
static fromHex(hex: string): Ed25519PublicKey;
|
|
208
|
+
toBytes(): Uint8Array;
|
|
209
|
+
toHex(): string;
|
|
210
|
+
verify(signature: Ed25519Signature, message: Uint8Array): boolean;
|
|
211
|
+
toHash(): Uint8Array;
|
|
212
|
+
toHashHex(): string;
|
|
213
|
+
refCount(): number;
|
|
214
|
+
private getBytesSize;
|
|
215
|
+
private getHexSize;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
declare class Bip32PublicKey {
|
|
219
|
+
ptr: number;
|
|
220
|
+
constructor(ptr: number);
|
|
221
|
+
static fromBytes(data: Uint8Array): Bip32PublicKey;
|
|
222
|
+
static fromHex(hex: string): Bip32PublicKey;
|
|
223
|
+
toBytes(): Uint8Array;
|
|
224
|
+
toHex(): string;
|
|
225
|
+
derive(indices: number[]): Bip32PublicKey;
|
|
226
|
+
toEd25519Key(): Ed25519PublicKey;
|
|
227
|
+
toHash(): Uint8Array;
|
|
228
|
+
toHashHex(): string;
|
|
229
|
+
refCount(): number;
|
|
230
|
+
private getBytesSize;
|
|
231
|
+
private getHexSize;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare class Ed25519PrivateKey {
|
|
235
|
+
ptr: number;
|
|
236
|
+
constructor(ptr: number);
|
|
237
|
+
static fromNormalBytes(data: Uint8Array): Ed25519PrivateKey;
|
|
238
|
+
static fromExtendedBytes(data: Uint8Array): Ed25519PrivateKey;
|
|
239
|
+
static fromNormalHex(hex: string): Ed25519PrivateKey;
|
|
240
|
+
static fromExtendedHex(hex: string): Ed25519PrivateKey;
|
|
241
|
+
toBytes(): Uint8Array;
|
|
242
|
+
toHex(): string;
|
|
243
|
+
sign(message: Uint8Array): Ed25519Signature;
|
|
244
|
+
getPublicKey(): Ed25519PublicKey;
|
|
245
|
+
refCount(): number;
|
|
246
|
+
private getBytesSize;
|
|
247
|
+
private getHexSize;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
declare class Bip32PrivateKey {
|
|
251
|
+
ptr: number;
|
|
252
|
+
private constructor();
|
|
253
|
+
static fromBip39Entropy(password: Uint8Array, entropy: Uint8Array): Bip32PrivateKey;
|
|
254
|
+
static fromBytes(data: Uint8Array): Bip32PrivateKey;
|
|
255
|
+
static fromHex(hex: string): Bip32PrivateKey;
|
|
256
|
+
derive(indices: number[]): Bip32PrivateKey;
|
|
257
|
+
getPublicKey(): Bip32PublicKey;
|
|
258
|
+
toBytes(): Uint8Array;
|
|
259
|
+
toHex(): string;
|
|
260
|
+
toEd25519Key(): Ed25519PrivateKey;
|
|
261
|
+
refCount(): number;
|
|
262
|
+
private getBytesSize;
|
|
263
|
+
}
|
|
264
|
+
|
|
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 };
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
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;
|
|
@@ -122,6 +126,30 @@ declare class CborWriter {
|
|
|
122
126
|
getRefCount(): number;
|
|
123
127
|
}
|
|
124
128
|
|
|
129
|
+
declare class Base58 {
|
|
130
|
+
private constructor();
|
|
131
|
+
static encode(data: Uint8Array): string;
|
|
132
|
+
static decode(encodedString: string): Uint8Array;
|
|
133
|
+
static encodeFromHex(hexString: string): string;
|
|
134
|
+
static decodeFromHex(base58String: string): string;
|
|
135
|
+
private static getEncodedLength;
|
|
136
|
+
private static getDecodedLength;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
type Bech32DecodeResult = {
|
|
140
|
+
hrp: string;
|
|
141
|
+
data: Uint8Array;
|
|
142
|
+
hex: string;
|
|
143
|
+
};
|
|
144
|
+
declare class Bech32 {
|
|
145
|
+
private constructor();
|
|
146
|
+
static encode(hrp: string, data: Uint8Array): string;
|
|
147
|
+
static encodeFromHex(hrp: string, data: string): string;
|
|
148
|
+
static decode(encodedString: string): Bech32DecodeResult;
|
|
149
|
+
private static getEncodedLength;
|
|
150
|
+
private static getDecodedLength;
|
|
151
|
+
}
|
|
152
|
+
|
|
125
153
|
declare const finalizationRegistry: FinalizationRegistry<{
|
|
126
154
|
ptr: any;
|
|
127
155
|
freeFunc: any;
|
|
@@ -138,4 +166,100 @@ declare class ProtocolVersion {
|
|
|
138
166
|
setMinor(minor: number): void;
|
|
139
167
|
}
|
|
140
168
|
|
|
141
|
-
|
|
169
|
+
declare class Crc32 {
|
|
170
|
+
private constructor();
|
|
171
|
+
static compute(data: Uint8Array): number;
|
|
172
|
+
static computeFromHex(hexString: string): number;
|
|
173
|
+
static computeFromUtf8(data: string): number;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
declare class Pbkdf2HmacSha512 {
|
|
177
|
+
private constructor();
|
|
178
|
+
static compute(password: Uint8Array, salt: Uint8Array, iterations: number, derivedKeyLength: number): Uint8Array;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare class Emip003 {
|
|
182
|
+
static encrypt(data: Uint8Array, passphrase: Uint8Array): Uint8Array;
|
|
183
|
+
static decrypt(encryptedData: Uint8Array, passphrase: Uint8Array): Uint8Array;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
declare class Blake2b {
|
|
187
|
+
private constructor();
|
|
188
|
+
static computeHash(data: Uint8Array, hashLength: number): Uint8Array;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
declare class Ed25519Signature {
|
|
192
|
+
ptr: number;
|
|
193
|
+
constructor(ptr: number);
|
|
194
|
+
static fromBytes(data: Uint8Array): Ed25519Signature;
|
|
195
|
+
static fromHex(hex: string): Ed25519Signature;
|
|
196
|
+
toBytes(): Uint8Array;
|
|
197
|
+
toHex(): string;
|
|
198
|
+
refCount(): number;
|
|
199
|
+
private getBytesSize;
|
|
200
|
+
private getHexSize;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
declare class Ed25519PublicKey {
|
|
204
|
+
ptr: number;
|
|
205
|
+
constructor(ptr: number);
|
|
206
|
+
static fromBytes(data: Uint8Array): Ed25519PublicKey;
|
|
207
|
+
static fromHex(hex: string): Ed25519PublicKey;
|
|
208
|
+
toBytes(): Uint8Array;
|
|
209
|
+
toHex(): string;
|
|
210
|
+
verify(signature: Ed25519Signature, message: Uint8Array): boolean;
|
|
211
|
+
toHash(): Uint8Array;
|
|
212
|
+
toHashHex(): string;
|
|
213
|
+
refCount(): number;
|
|
214
|
+
private getBytesSize;
|
|
215
|
+
private getHexSize;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
declare class Bip32PublicKey {
|
|
219
|
+
ptr: number;
|
|
220
|
+
constructor(ptr: number);
|
|
221
|
+
static fromBytes(data: Uint8Array): Bip32PublicKey;
|
|
222
|
+
static fromHex(hex: string): Bip32PublicKey;
|
|
223
|
+
toBytes(): Uint8Array;
|
|
224
|
+
toHex(): string;
|
|
225
|
+
derive(indices: number[]): Bip32PublicKey;
|
|
226
|
+
toEd25519Key(): Ed25519PublicKey;
|
|
227
|
+
toHash(): Uint8Array;
|
|
228
|
+
toHashHex(): string;
|
|
229
|
+
refCount(): number;
|
|
230
|
+
private getBytesSize;
|
|
231
|
+
private getHexSize;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare class Ed25519PrivateKey {
|
|
235
|
+
ptr: number;
|
|
236
|
+
constructor(ptr: number);
|
|
237
|
+
static fromNormalBytes(data: Uint8Array): Ed25519PrivateKey;
|
|
238
|
+
static fromExtendedBytes(data: Uint8Array): Ed25519PrivateKey;
|
|
239
|
+
static fromNormalHex(hex: string): Ed25519PrivateKey;
|
|
240
|
+
static fromExtendedHex(hex: string): Ed25519PrivateKey;
|
|
241
|
+
toBytes(): Uint8Array;
|
|
242
|
+
toHex(): string;
|
|
243
|
+
sign(message: Uint8Array): Ed25519Signature;
|
|
244
|
+
getPublicKey(): Ed25519PublicKey;
|
|
245
|
+
refCount(): number;
|
|
246
|
+
private getBytesSize;
|
|
247
|
+
private getHexSize;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
declare class Bip32PrivateKey {
|
|
251
|
+
ptr: number;
|
|
252
|
+
private constructor();
|
|
253
|
+
static fromBip39Entropy(password: Uint8Array, entropy: Uint8Array): Bip32PrivateKey;
|
|
254
|
+
static fromBytes(data: Uint8Array): Bip32PrivateKey;
|
|
255
|
+
static fromHex(hex: string): Bip32PrivateKey;
|
|
256
|
+
derive(indices: number[]): Bip32PrivateKey;
|
|
257
|
+
getPublicKey(): Bip32PublicKey;
|
|
258
|
+
toBytes(): Uint8Array;
|
|
259
|
+
toHex(): string;
|
|
260
|
+
toEd25519Key(): Ed25519PrivateKey;
|
|
261
|
+
refCount(): number;
|
|
262
|
+
private getBytesSize;
|
|
263
|
+
}
|
|
264
|
+
|
|
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 };
|