Module: utils/format
Variables
NEAR_NOMINATION
Const
NEAR_NOMINATION: BN
Number of indivisible units in one NEAR. Derived from NEAR_NOMINATION_EXP.
Defined in
NEAR_NOMINATION_EXP
Const
NEAR_NOMINATION_EXP: 24
Exponent for calculating how many indivisible units are there in one NEAR. See NEAR_NOMINATION.
Defined in
Functions
formatNearAmount
formatNearAmount(balance
, fracDigits?
): string
Convert account balance value from internal indivisible units to NEAR. 1 NEAR is defined by NEAR_NOMINATION. Effectively this divides given amount by NEAR_NOMINATION.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
balance | string | undefined | decimal string representing balance in smallest non-divisible NEAR units (as specified by NEAR_NOMINATION) |
fracDigits | number | NEAR_NOMINATION_EXP | number of fractional digits to preserve in formatted string. Balance is rounded to match given number of digits. |
Returns
string
Value in Ⓝ
Defined in
parseNearAmount
parseNearAmount(amt?
): string
| null
Convert human readable NEAR amount to internal indivisible units. Effectively this multiplies given amount by NEAR_NOMINATION.
Parameters
Name | Type | Description |
---|---|---|
amt? | string | decimal string (potentially fractional) denominated in NEAR. |
Returns
string
| null
The parsed yoctoⓃ amount or null if no amount was passed in