app/util/number.js
/**
 * Converts fiat number as human-readable fiat string to wei expressed as a BN
 *
 * @param {number|string} fiat - Fiat number
 * @param {number} conversionRate - ETH to current currency conversion rate
 * @returns {Object} - The converted balance as BN instance
 */
Converts fiat number as human-readable fiat string to wei expressed as a BN
@param {number|string} fiat - Fiat number
@param {number} conversionRate - ETH to current currency conversion rate
@returns {Object} - The converted balance as BN instance
Converts fiat number as human - readable fiat string to wei expressed as a BN @param { number|string } fiat - Fiat number @param { number } conversionRate - ETH to current currency conversion rate @returns { Object } - The converted balance as BN instance
function fiatNumberToWei(fiat, conversionRate) {
	const floatFiatConverted = parseFloat(fiat) / conversionRate;
	const base = Math.pow(10, 18);
	let weiNumber = Math.trunc(base * floatFiatConverted);
	weiNumber = weiNumber.toLocaleString('fullwide', { useGrouping: false }).split('.');
	const weiBN = numberToBN(weiNumber[0]);
	return weiBN;
}
function fiatNumberToWei ( fiat , conversionRate ) { const floatFiatConverted = parseFloat ( fiat ) / conversionRate ; const base = Math . pow ( 10 , 18 ) ; let weiNumber = Math . trunc ( base * floatFiatConverted ) ; weiNumber = weiNumber . toLocaleString ( 'fullwide' , { useGrouping : false } ) . split ( '.' ) ; const weiBN = numberToBN ( weiNumber [ 0 ] ) ; return weiBN ; }
Converts fiat number as human-readable fiat string to wei expressed as a BN
 @param {number|string} fiat - Fiat number
 @param {number} conversionRate - ETH to current currency conversion rate
 @returns {Object} - The converted balance as BN instance
Converts fiat number as human - readable fiat string to wei expressed as a BN @param { number|string } fiat - Fiat number @param { number } conversionRate - ETH to current currency conversion rate @returns { Object } - The converted balance as BN instance
// avoid decimals