@subsocial/utils
Version:
JavaScript utils for Subsocial blockchain.
19 lines (18 loc) • 1.08 kB
TypeScript
import BN from 'bn.js';
import BigNumber from 'bignumber.js';
/** Extract decimals from the balance and converts it to human readable format */
export declare const simpleFormatBalance: (balance: BN | string | number, decimals?: number | undefined, currency?: string | undefined, withUnit?: boolean) => string;
/** Add decimals to the balance. Example balanceWithDecimal(5, 10) // 50000000000 */
export declare const balanceWithDecimal: (balance: string | number, decimal: number) => BigNumber;
/** Extract decimals from the balance. Example convertToBalanceWithDecimal("50000000000", 10) // 5 */
export declare const convertToBalanceWithDecimal: (balance: string | number, decimal: number) => BigNumber;
export declare const formatBalanceWithoutDecimals: (balance: BigNumber, symbol: string) => string;
declare type ShortMoneyProps = {
num: number;
prefix?: string;
suffix?: string;
fractions?: number;
};
/** Shorten number format. For example, 1_000_000 becomes 1M */
export declare function toShortMoney({ num, ...props }: ShortMoneyProps): string;
export {};