import { BigNumber } from 'bignumber.js' ; export function winstonToAr ( winstonString , { formatted = false , decimals = 12 } = { } ) { const num = stringToBigNum ( winstonString , decimals ) . shiftedBy ( - 12 ) ; return formatted ? num . toFormat ( decimals ) : num . toFixed ( decimals ) ; } export function arToWinston ( arString , { formatted = false } = { } ) { const num = stringToBigNum ( arString ) . shiftedBy ( 12 ) ; return formatted ? num . toFormat ( ) : num . toFixed ( 0 ) ; } export function stringToBigNum ( stringValue , decimalPlaces = 12 ) { return new BigNumber ( stringValue , decimalPlaces ) ; }