incubed
Version:
Typescript-version of the incubed client
43 lines (42 loc) • 1.45 kB
TypeScript
import { RPCResponse } from '../types/types';
/**
*
* simple promisy-function
*/
export declare function promisify(self: any, fn: any, ...args: any[]): Promise<any>;
export declare function toUtf8(val: any): string;
/**
* check a RPC-Response for errors and rejects the promise if found
*/
export declare function checkForError<T extends RPCResponse | RPCResponse[]>(res: T): T;
/**
* convert to BigNumber
*/
export declare function toBN(val: any): any;
/**
* converts any value as hex-string
*/
export declare function toHex(val: any, bytes?: number): string;
/**
* converts to a js-number
*/
export declare function toNumber(val: any): number;
/**
* converts any value as Buffer
* if len === 0 it will return an empty Buffer if the value is 0 or '0x00', since this is the way rlpencode works wit 0-values.
*/
export declare function toBuffer(val: any, len?: number): any;
/**
* removes all leading 0 in a hex-string
*/
export declare function toSimpleHex(val: string): string;
/**
* returns a address from a private key
*/
export declare function getAddress(pk: string): string;
/** removes all leading 0 in the hexstring */
export declare function toMinHex(key: string | Buffer | number): string;
/** padStart for legacy */
export declare function padStart(val: string, minLength: number, fill?: string): string;
/** padEnd for legacy */
export declare function padEnd(val: string, minLength: number, fill?: string): string;