UNPKG

927 BTypeScriptView Raw
1import type { U8aLike } from '@polkadot/util/types';
2export type { U8aLike } from '@polkadot/util/types';
3interface Coder {
4 decode: (value: string) => Uint8Array;
5 encode: (value: Uint8Array) => string;
6}
7interface Config {
8 chars: string;
9 coder: Coder;
10 ipfs?: string;
11 regex?: RegExp;
12 type: string;
13}
14type DecodeFn = (value: string, ipfsCompat?: boolean) => Uint8Array;
15type EncodeFn = (value: U8aLike, ipfsCompat?: boolean) => string;
16type ValidateFn = (value?: unknown, ipfsCompat?: boolean) => value is string;
17/** @internal */
18export declare function createDecode({ coder, ipfs }: Config, validate: ValidateFn): DecodeFn;
19/** @internal */
20export declare function createEncode({ coder, ipfs }: Config): EncodeFn;
21/** @internal */
22export declare function createIs(validate: ValidateFn): ValidateFn;
23/** @internal */
24export declare function createValidate({ chars, ipfs, type }: Config): ValidateFn;