From a195427e7208096f6f873175f2cbdbbb0a802191 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 28 Sep 2017 11:40:33 -0230 Subject: [PATCH] Fix send of USD and backspacing amount to 0 --- ui/app/conversion-util.js | 4 ++-- ui/app/send.js | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ui/app/conversion-util.js b/ui/app/conversion-util.js index 7e02fe2bd..37877d12c 100644 --- a/ui/app/conversion-util.js +++ b/ui/app/conversion-util.js @@ -47,7 +47,7 @@ const toNormalizedDenomination = { WEI: bigNumber => bigNumber.div(BIG_NUMBER_WEI_MULTIPLIER) } const toSpecifiedDenomination = { - WEI: bigNumber => bigNumber.times(BIG_NUMBER_WEI_MULTIPLIER) + WEI: bigNumber => bigNumber.times(BIG_NUMBER_WEI_MULTIPLIER).round() } const baseChange = { hex: n => n.toString(16), @@ -83,8 +83,8 @@ const whenPropApplySetterMap = (prop, setterMap) => whenPredSetWithPropAndSetter const converter = R.pipe( whenPropApplySetterMap('fromNumericBase', toBigNumber), whenPropApplySetterMap('fromDenomination', toNormalizedDenomination), - whenPropApplySetterMap('toDenomination', toSpecifiedDenomination), whenPredSetWithPropAndSetter(fromAndToCurrencyPropsNotEqual, 'conversionRate', convert), + whenPropApplySetterMap('toDenomination', toSpecifiedDenomination), whenPredSetWithPropAndSetter(R.prop('ethToUSDRate'), 'ethToUSDRate', convert), whenPredSetWithPropAndSetter(R.prop('numberOfDecimals'), 'numberOfDecimals', round), whenPropApplySetterMap('toNumericBase', baseChange), diff --git a/ui/app/send.js b/ui/app/send.js index 4d2a5f48d..d92a6f2d5 100644 --- a/ui/app/send.js +++ b/ui/app/send.js @@ -230,12 +230,16 @@ SendTransactionScreen.prototype.renderAmountInput = function (activeCurrency) { placeholder: `0 ${activeCurrency}`, type: 'number', onChange: (event) => { + const amountToSend = event.target.value + ? this.getAmountToSend(event.target.value) + : '0x0' + this.setState({ newTx: Object.assign( this.state.newTx, { amount: event.target.value, - amountToSend: this.getAmountToSend(event.target.value), + amountToSend: amountToSend, } ), })