/** * 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 bytes { export function fromHex(hex: string): Uint8Array; export function toHex(d: Uint8Array): string; export function toString(b: Uint8Array): string; } } declare module "multiformats/bases/base16" { declare namespace base16 { export const prefix = "f"; export function baseDecode(text: string): Uint8Array; export function baseEncode(bytesToEncode: Uint8Array): string; export function decode(input: string): Uint8Array; export function encode(input: Uint8Array): Multibase<"f">; } } declare module "multiformats/bases/base58" { declare namespace base58btc { export const prefix = "z"; export function baseDecode(text: string): Uint8Array; export function baseEncode(bytesToEncode: Uint8Array): string; export function decode(input: string): Uint8Array; export function encode(input: Uint8Array): Multibase<"z">; } } declare module "multiformats/bases/base64" { declare namespace base64 { export const prefix = "m"; export function baseDecode(text: string): Uint8Array; export function baseEncode(bytesToEncode: Uint8Array): string; export function decode(input: string): Uint8Array; export function encode(input: Uint8Array): Multibase<"m">; } declare namespace base64url { export const prefix = "u"; export function baseDecode(text: string): Uint8Array; export function baseEncode(bytesToEncode: Uint8Array): string; export function decode(input: string): Uint8Array; export function encode(input: Uint8Array): Multibase<"u">; } }