@typeberry/trie
Advanced tools
Comparing version 0.0.1-aae42cd to 0.0.1-b19c732
{ | ||
"name": "@typeberry/trie", | ||
"version": "0.0.1-aae42cd", | ||
"main": "trie.js", | ||
"version": "0.0.1-b19c732", | ||
"main": "index.js", | ||
"author": "Fluffy Labs", | ||
"license": "MPL-2.0" | ||
} | ||
} |
@@ -0,19 +1,47 @@ | ||
/** | ||
* 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 { | ||
readonly buffer: Uint8Array; | ||
readonly length: number; | ||
constructor(data: Uint8Array); | ||
private constructor(); | ||
/** | ||
* Display a hex-encoded version of this byte blob. | ||
*/ | ||
toString(): string; | ||
static fromBytes(v: number[]): BytesBlob; | ||
/** 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; | ||
constructor(raw: Uint8Array, len: 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>; | ||
} |
@@ -6,2 +6,7 @@ import { Bytes, BytesBlob } from "@typeberry/bytes"; | ||
export type TruncatedStateKey = Opaque<Bytes<31>, "stateKey">; | ||
/** | ||
* A state commitment. | ||
* | ||
* https://graypaper.fluffylabs.dev/#/387103d/0cb0000cb400 | ||
*/ | ||
export type TrieHash = Opaque<Hash, "trie">; | ||
@@ -8,0 +13,0 @@ export type ValueHash = Opaque<Hash, "trieValue">; |
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
35446
13
962
1
23
2
3
0
23