/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */ export declare function assertNumber(n: number): void; export interface Coder { encode(from: F): T; decode(to: T): F; } export interface BytesCoder extends Coder { encode: (data: Uint8Array) => string; decode: (str: string) => Uint8Array; } declare type Chain = [Coder, ...Coder[]]; declare type Input = F extends Coder ? T : never; declare type Output = F extends Coder ? T : never; declare type First = T extends [infer U, ...any[]] ? U : never; declare type Last = T extends [...any[], infer U] ? U : never; declare type Tail = T extends [any, ...infer U] ? U : never; declare type AsChain> = { [K in keyof C]: Coder, Input>; }; declare function chain>(...args: T): Coder>, Output>>; declare type Alphabet = string[] | string; declare function alphabet(alphabet: Alphabet): Coder; declare function join(separator?: string): Coder; declare function padding(bits: number, chr?: string): Coder; declare function radix(num: number): Coder; declare function radix2(bits: number, revPadding?: boolean): Coder; declare function checksum(len: number, fn: (data: Uint8Array) => Uint8Array): Coder; export declare const utils: { alphabet: typeof alphabet; chain: typeof chain; checksum: typeof checksum; radix: typeof radix; radix2: typeof radix2; join: typeof join; padding: typeof padding; }; export declare const base16: BytesCoder; export declare const base32: BytesCoder; export declare const base32hex: BytesCoder; export declare const base32crockford: BytesCoder; export declare const base64: BytesCoder; export declare const base64url: BytesCoder; export declare const base58: BytesCoder; export declare const base58flickr: BytesCoder; export declare const base58xrp: BytesCoder; export declare const base58xmr: BytesCoder; export declare const base58check: (sha256: (data: Uint8Array) => Uint8Array) => BytesCoder; export interface Bech32Decoded { prefix: string; words: number[]; } export interface Bech32DecodedWithArray { prefix: string; words: number[]; bytes: Uint8Array; } export declare const bech32: { encode: (prefix: string, words: number[] | Uint8Array, limit?: number | false) => string; decode: (str: string, limit?: number | false) => Bech32Decoded; decodeToBytes: (str: string) => Bech32DecodedWithArray; decodeUnsafe: (str: string, limit?: number | false) => Bech32Decoded; fromWords: (to: number[]) => Uint8Array; fromWordsUnsafe: (to: number[]) => Uint8Array; toWords: (from: Uint8Array) => number[]; }; export declare const bech32m: { encode: (prefix: string, words: number[] | Uint8Array, limit?: number | false) => string; decode: (str: string, limit?: number | false) => Bech32Decoded; decodeToBytes: (str: string) => Bech32DecodedWithArray; decodeUnsafe: (str: string, limit?: number | false) => Bech32Decoded; fromWords: (to: number[]) => Uint8Array; fromWordsUnsafe: (to: number[]) => Uint8Array; toWords: (from: Uint8Array) => number[]; }; export declare const utf8: BytesCoder; export declare const hex: BytesCoder; declare const CODERS: { utf8: BytesCoder; hex: BytesCoder; base16: BytesCoder; base32: BytesCoder; base64: BytesCoder; base64url: BytesCoder; base58: BytesCoder; base58xmr: BytesCoder; }; declare type CoderType = keyof typeof CODERS; export declare const bytesToString: (type: CoderType, bytes: Uint8Array) => string; export declare const str: (type: CoderType, bytes: Uint8Array) => string; export declare const stringToBytes: (type: CoderType, str: string) => Uint8Array; export declare const bytes: (type: CoderType, str: string) => Uint8Array; export {};