raiden-ts
Version:
Raiden Light Client Typescript/Javascript SDK
20 lines (19 loc) • 1.17 kB
TypeScript
import type { BytesLike, Hexable } from '@ethersproject/bytes';
import type { HexString } from './types';
/**
* Encode data to hex string of exactly length size (in bytes)
* Throw if data can't be made to fit in length.
*
* @param data - May be of multiple types:
* - number|BigNumber: Encoded in the big-endian byte-order and left-zero-padded to length
* - string: Must be hex-encoded string of length bytes
* - number[] Must be of exactly of length size (left/right-pad it before if needed)
* @param length - The expected length of the hex string, in bytes
* @returns HexString byte-array of length
*/
export declare function encode<S extends number = number>(data: boolean | number | Hexable | BytesLike, length: S): HexString<S>;
export declare const jsonParse: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any;
export declare const jsonStringify: {
(value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
(value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
};