@lodestar/utils
Version:
Utilities required across multiple lodestar packages
37 lines • 1.35 kB
TypeScript
/**
* Format bytes as `0x1234…1234`
* 4 bytes can represent 4294967296 values, so the chance of collision is low
*/
export declare function prettyBytes(root: Uint8Array | string): string;
/**
* Format bytes as `0x1234…`
* Paired with block numbers or slots, it can still act as a decent identify-able format
*/
export declare function prettyBytesShort(root: Uint8Array | string): string;
/**
* Truncate and format bytes as `0x123456789abc`
* 6 bytes is sufficient to avoid collisions and it allows to easily look up
* values on explorers like beaconcha.in while improving readability of logs
*/
export declare function truncBytes(root: Uint8Array | string): string;
/**
* Format a bigint value as a decimal string
*/
export declare function formatBigDecimal(numerator: bigint, denominator: bigint, maxDecimalFactor: bigint): string;
/**
* Format wei as ETH, with up to 5 decimals
*/
export declare function formatWeiToEth(wei: bigint): string;
/**
* Format wei as ETH, with up to 5 decimals and append ' ETH'
*/
export declare function prettyWeiToEth(wei: bigint): string;
/**
* Format milliseconds to time format HH:MM:SS.ms
*/
export declare function prettyMsToTime(timeMs: number): string;
/**
* Remove 0x prefix from a string
*/
export declare function strip0xPrefix(hex: string): string;
//# sourceMappingURL=format.d.ts.map