import { Unit } from "../store/app-context" ; export const SAT_DENOMINATOR = 100000000 ; export const NUM_LOCALE = "en-US" ; export function convertSatToBtc ( sat ) { return sat / SAT_DENOMINATOR ; } export function convertBtcToSat ( btc ) { return btc * SAT_DENOMINATOR ; } export function convertMSatToSat ( mSat ) { return mSat / 1000 ; } export function convertMSatToBtc ( mSat ) { return convertSatToBtc ( mSat / 1000 ) ; } export function convertToString ( unit , num ) { if ( unit === Unit . SAT ) { return num . toLocaleString ( NUM_LOCALE ) ; } return num . toFixed ( 8 ) . toString ( ) ; }