Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/utils/cashMethods.js
- This file was added.
import { currency } from '@components/Common/Ticker'; | |||||
import BigNumber from 'bignumber.js'; | |||||
export const fromSmallestDenomination = ( | |||||
amount, | |||||
cashDecimals = currency.cashDecimals, | |||||
) => { | |||||
const amountBig = new BigNumber(amount); | |||||
const multiplier = new BigNumber(10 ** (-1 * cashDecimals)); | |||||
const amountInBaseUnits = amountBig.times(multiplier); | |||||
return amountInBaseUnits.toNumber(); | |||||
}; |