0.0.2 • Published 1 month ago

@solocker/safe-bn v0.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago

@solocker/safe-bn

To install

bun install @solocker/safe-bn

Usage

By default safe-bn support 3 decimal places to increase add the optional decimal param

Perform BigNumber mathematical operations

const target = 3124.456;
const safeBnRepresentation = safeBN(target);
// reverse to unSafe after performing mathematical operations
const unSafeRepresentation = unSafe(safeRepresentation);

Convert to Number from hex or BN

/// This unwrap safeBN, note don't pass unSafe output, convert first to save before this
const backToTarget = unSafeToNumber(safeRepresentation);