hive-keychain-commons
Version:
Platform-agnostic functions used in Hive Keychain mobile and extensions
25 lines (24 loc) • 1.64 kB
TypeScript
import type { DynamicGlobalProperties } from '@hiveio/dhive';
import { Asset } from '..';
import { GlobalProperties } from '../interfaces/global-properties';
import { CurrencyPrices } from '../interfaces/price';
export declare const FormatUtils: {
withCommas: (nb: string, decimals?: number, removeTrailingZeros?: boolean) => string;
toHP: (vests: string, props?: DynamicGlobalProperties) => number;
toFormattedHP: (vests: number, props?: DynamicGlobalProperties) => string;
fromHP: (hp: string, props: DynamicGlobalProperties) => number;
formatCurrencyValue: (value: string | Asset | number, digits?: number, removeTrailingZeros?: boolean) => string;
nFormatter: (num: number, digits: number) => string;
hasMoreThanXDecimal: (nb: number, decimal: number) => boolean;
toNumber: (value: string | Asset) => number;
getSymbol: (nai: string) => "HIVE" | "HBD" | "HP" | undefined;
getAmountFromNai: (obj: any) => number;
fromNaiAndSymbol: (obj: any) => string;
removeHtmlTags: (str: string) => string;
getValFromString: (str: string) => number;
trimUselessZero: (nb: number, precision: number) => string;
getUSDFromVests: (vestAmount: number, globalProperties: GlobalProperties, currencyPrices: CurrencyPrices) => string;
getOrdinalLabelTranslation: (activeRank: string) => "html_popup_witness_ranking_ordinal_st_label" | "html_popup_witness_ranking_ordinal_nd_label" | "html_popup_witness_ranking_ordinal_rd_label" | "html_popup_witness_ranking_ordinal_th_label";
dateToFormattedString: (date: Date) => string;
shortenString: (str: string, length?: number) => string;
};