/** * Fix uint8arrays declarations */ declare module "uint8arrays" { export type SupportedEncodings = | "ascii" | "base10" | "base16" | "base16upper" | "base58btc" | "base64" | "base64pad" | "base64url" | "hex" | "utf8" // eslint-disable-next-line unicorn/text-encoding-identifier-case | "utf-8"; export function compare(a: Uint8Array, b: Uint8Array): -1 | 0 | 1; export function concat( arrays: ArrayLike[], length?: number, ): Uint8Array; export function fromString( string: string, encoding?: SupportedEncodings, ): Uint8Array; export function toString( array: Uint8Array, encoding?: SupportedEncodings, ): string; } /** * Fix multiformats v9 declarations */ declare type Multibase = | string | (string & { [0]: Prefix; }); declare module "multiformats" { declare namespace varint { export function decode(data: Uint8Array, offset?: number): [number, number]; export function encodeTo( int: number, target: Uint8Array, offset?: number, ): Uint8Array; export function encodingLength(int: number): number; } } declare module "multiformats/bases/base58" { declare namespace base58btc { export const prefix = "z"; export function baseDecode(text: string): Uint8Array; export function baseEncode(bytes: Uint8Array): string; export function decode(input: string): Uint8Array; export function encode(input: Uint8Array): Multibase<"z">; } } declare module "multiformats/codecs/interface" { export declare type ByteView = | Uint8Array | (Uint8Array & { data: T; }); export interface BlockCodec extends BlockDecoder, BlockEncoder {} export interface BlockDecoder { code: Code; decode(bytes: ByteView): T; } export interface BlockEncoder { code: Code; encode(data: T): ByteView; name: string; } }