@typeberry/trie
Advanced tools
Comparing version 0.0.1-46c9206 to 0.0.1-70b37e6
{ | ||
"name": "@typeberry/trie", | ||
"version": "0.0.1-46c9206", | ||
"main": "trie.js", | ||
"version": "0.0.1-70b37e6", | ||
"main": "index.js", | ||
"author": "Fluffy Labs", | ||
"license": "MPL-2.0" | ||
} | ||
} |
@@ -0,1 +1,7 @@ | ||
/** | ||
* A variable-length blob of bytes with a concise text representation. | ||
* | ||
* The structure is used as convenience wrapper for [`Uint8Array`], | ||
* especially if the data is coming from a hex-encoded string. | ||
*/ | ||
export declare class BytesBlob { | ||
@@ -5,18 +11,38 @@ readonly buffer: Uint8Array; | ||
private constructor(); | ||
/** | ||
* Display a hex-encoded version of this byte blob. | ||
*/ | ||
toString(): string; | ||
/** Create a new [`BytesBlob`] from existing [`Uint8Array`]. */ | ||
static fromBlob(v: Uint8Array): BytesBlob; | ||
/** Create a new [`BytesBlob`] from an array of bytes. */ | ||
static fromNumbers(v: number[]): BytesBlob; | ||
/** Parse a hex-encoded bytes blob without `0x` prefix. */ | ||
static parseBlobNoPrefix(v: string): BytesBlob; | ||
/** Parse a hex-encoded bytes blob with `0x` prefix. */ | ||
static parseBlob(v: string): BytesBlob; | ||
} | ||
/** | ||
* A convenience wrapper for a fix-length sequence of bytes. | ||
*/ | ||
export declare class Bytes<T extends number> { | ||
/** Raw bytes array. */ | ||
readonly raw: Uint8Array; | ||
/** Length of the bytes array. */ | ||
readonly length: T; | ||
private constructor(); | ||
/** Return hex encoding of the sequence. */ | ||
toString(): string; | ||
/** Compare the sequence to another one. */ | ||
isEqualTo(other: Bytes<T>): boolean; | ||
/** Create new [`Bytes<X>`] given a backing buffer and it's length. */ | ||
static fromBlob<X extends number>(v: Uint8Array, len: X): Bytes<X>; | ||
/** Create an empty [`Bytes<X>`] of given length. */ | ||
static zero<X extends number>(len: X): Bytes<X>; | ||
/** Create a [`Bytes<X>`] with all bytes filled with given input number. */ | ||
static fill<X extends number>(len: X, input: number): Bytes<X>; | ||
/** Parse a hex-encoded fixed-length bytes without `0x` prefix. */ | ||
static parseBytesNoPrefix<X extends number>(v: string, len: X): Bytes<X>; | ||
/** Parse a hex-encoded fixed-length bytes with `0x` prefix. */ | ||
static parseBytes<X extends number>(v: string, len: X): Bytes<X>; | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
35353
957
1
23
2
3
0
23