UNPKG

967 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 withPadding?: boolean;
14}
15type DecodeFn = (value: string, ipfsCompat?: boolean) => Uint8Array;
16type EncodeFn = (value: U8aLike, ipfsCompat?: boolean) => string;
17type ValidateFn = (value?: unknown, ipfsCompat?: boolean) => value is string;
18/** @internal */
19export declare function createDecode({ coder, ipfs }: Config, validate: ValidateFn): DecodeFn;
20/** @internal */
21export declare function createEncode({ coder, ipfs }: Config): EncodeFn;
22/** @internal */
23export declare function createIs(validate: ValidateFn): ValidateFn;
24/** @internal */
25export declare function createValidate({ chars, ipfs, type, withPadding }: Config): ValidateFn;