Constructors
constructor
- new BigNum(val: string | number | BN, precisionVal?: string | number | BN): BigNum
-
Parameters
-
val: string | number | BN
-
precisionVal: string | number | BN = ...
Properties
Static
delim
delim: string = '.'
Static
spacer
spacer: string = ','
Methods
debug
- debug(): void
-
Returns void
eq
- eq(bn: BN | BigNum, ignorePrecision?: boolean): boolean
-
Parameters
-
-
Optional
ignorePrecision: boolean
Returns boolean
eqZero
- eqZero(): boolean
-
Returns boolean
Private
getZeroes
- getZeroes(count: number): string
-
Returns string
gt
- gt(bn: BN | BigNum, ignorePrecision?: boolean): boolean
-
Parameters
-
-
Optional
ignorePrecision: boolean
Returns boolean
gtZero
- gtZero(): boolean
-
Returns boolean
gte
- gte(bn: BN | BigNum, ignorePrecision?: boolean): boolean
-
Parameters
-
-
Optional
ignorePrecision: boolean
Returns boolean
gteZero
- gteZero(): boolean
-
Returns boolean
isNeg
- isNeg(): boolean
-
Returns boolean
isPos
- isPos(): boolean
-
Returns boolean
lt
- lt(bn: BN | BigNum, ignorePrecision?: boolean): boolean
-
Parameters
-
-
Optional
ignorePrecision: boolean
Returns boolean
ltZero
- ltZero(): boolean
-
Returns boolean
lte
- lte(bn: BN | BigNum, ignorePrecision?: boolean): boolean
-
Parameters
-
-
Optional
ignorePrecision: boolean
Returns boolean
lteZero
- lteZero(): boolean
-
Returns boolean
prettyPrint
- prettyPrint(useTradePrecision?: boolean, precisionOverride?: number): string
-
Parameters
-
Optional
useTradePrecision: boolean
-
Optional
precisionOverride: number
Returns string
print
- print(): string
-
Returns string
printShort
- printShort(useTradePrecision?: boolean, precisionOverride?: number): string
-
Parameters
-
Optional
useTradePrecision: boolean
-
Optional
precisionOverride: number
Returns string
scale
- scale(numerator: number | BN, denominator: number | BN): BigNum
-
Parameters
-
numerator: number | BN
-
denominator: number | BN
shift
- shift(exponent: number | BN, skipAdjustingPrecision?: boolean): BigNum
-
Parameters
-
exponent: number | BN
-
skipAdjustingPrecision: boolean = false
toFixed
- toFixed(fixedPrecision: number, rounded?: boolean): string
-
Parameters
-
fixedPrecision: number
-
rounded: boolean = false
Returns string
toJSON
- toJSON(): {
precision: string;
val: string;
}
-
Returns {
precision: string;
val: string;
}
-
precision: string
-
val: string
toMillified
- toMillified(precision?: number, rounded?: boolean, type?: "financial" | "scientific"): string
-
Parameters
-
precision: number = 3
-
rounded: boolean = false
-
type: "financial" | "scientific" = 'financial'
Returns string
toNotional
- toNotional(useTradePrecision?: boolean, precisionOverride?: number): string
-
Parameters
-
Optional
useTradePrecision: boolean
-
Optional
precisionOverride: number
Returns string
toNum
- toNum(): number
-
Returns number
toPercentage
- toPercentage(denominator: BigNum, precision: number): string
-
Parameters
-
denominator: BigNum
-
precision: number
Returns string
toPrecision
- toPrecision(fixedPrecision: number, trailingZeroes?: boolean, rounded?: boolean): string
-
Parameters
-
fixedPrecision: number
-
trailingZeroes: boolean = false
-
rounded: boolean = false
Returns string
toRounded
- toRounded(roundingPrecision: number): BigNum
-
Parameters
-
roundingPrecision: number
toString
- toString(base?: number | "hex", length?: number): string
-
Parameters
-
Optional
base: number | "hex"
-
Optional
length: number
Returns string
toTradePrecision
- toTradePrecision(rounded?: boolean): string
-
Returns string
Static
from
- from(val?: string | number | BN, precision?: string | number | BN): BigNum
-
Parameters
-
val: string | number | BN = ZERO
-
Optional
precision: string | number | BN
Static
fromJSON
- fromJSON(json: {
precision: string;
val: string;
}): BigNum
-
Parameters
-
json: {
precision: string;
val: string;
}
-
precision: string
-
val: string
Static
fromPrint
- fromPrint(val: string, precisionShift?: BN): BigNum
-
Parameters
-
val: string
-
Optional
precisionShift: BN
Static
setLocale
- setLocale(locale: string): void
-
Returns void
Static
zero
- zero(precision?: number | BN): BigNum
-
Parameters
-
Optional
precision: number | BN
Pretty print the underlying value in human-readable form. Depends on precision being correct for the output string to be correct
Returns