wallet-sdk-js
Version:
62 lines (61 loc) • 1.8 kB
TypeScript
import BN from 'bn.js';
import Decimal from 'decimal.js';
/**
* Check if string is HEX, requires a 0x in front
*
* @method isHexStrict
* @param {String} hex to be checked
* @returns {Boolean}
*/
export declare function isHexStrict(hex: string | number): boolean;
/**
* Takes an input and transforms it into an BN
*
* @method toBN
* @param {Number|String|BN} number, string, HEX string or BN
* @return {BN} BN
*/
export declare function toBN(number: number | string): BN;
/**
* Converts value to it's number representation
*
* @method hexToNumber
* @param {String|Number|BN} value
* @return {String}
*/
export declare function hexToNumber(value: string | number): string | number;
/**
* Converts value to it's hex representation
*
* @method numberToHex
* @param {String|Number|BN} value
* @return {String}
*/
export declare function numberToHex(value: number | string): string;
/**
* Should be called to get hex representation (prefixed by 0x) of utf8 string
*
* @method utf8ToHex
* @param {String} str
* @returns {String} hex representation of input string
*/
export declare function utf8ToHex(str: string): string;
/**
* Convert a hexadecimal chainId to decimal
* @param chainId
*/
export declare function chainIdHexToNumber(chainId: string | number): number;
/**
* Converts to a checksum address
*
* @method toChecksumAddress
* @param {String} address the given HEX address
* @return {String}
*/
export declare function toChecksumAddress(address: string): string;
/**
* Converts value to it's decimal representation in string
* @param value The value to convert
* @returns The decimal representation of the given value
*/
export declare function toDecimal(value: string | number): Decimal;