diff options
Diffstat (limited to 'ui/app')
-rw-r--r-- | ui/app/app.js | 11 | ||||
-rw-r--r-- | ui/app/send.js | 18 | ||||
-rw-r--r-- | ui/app/util.js | 3 |
3 files changed, 26 insertions, 6 deletions
diff --git a/ui/app/app.js b/ui/app/app.js index bd0ccb0a2..bc198b482 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -460,11 +460,6 @@ App.prototype.renderPrimary = function () { }) } - if (props.seedWords) { - log.debug('rendering seed words') - return h(HDCreateVaultComplete, {key: 'HDCreateVaultComplete'}) - } - // show initialize screen if (!props.isInitialized || props.forgottenPassword) { // show current view @@ -499,6 +494,12 @@ App.prototype.renderPrimary = function () { } } + // show seed words screen + if (props.seedWords) { + log.debug('rendering seed words') + return h(HDCreateVaultComplete, {key: 'HDCreateVaultComplete'}) + } + // show current view switch (props.currentView.name) { diff --git a/ui/app/send.js b/ui/app/send.js index e59c1130e..09c9e03d4 100644 --- a/ui/app/send.js +++ b/ui/app/send.js @@ -247,10 +247,26 @@ SendTransactionScreen.prototype.onSubmit = function () { const recipient = state.recipient || document.querySelector('input[name="address"]').value.replace(/^[.\s]+|[.\s]+$/g, '') const nickname = state.nickname || ' ' const input = document.querySelector('input[name="amount"]').value + const parts = input.split('') + + let message + + if (isNaN(input) || input === '') { + message = 'Invalid ether value.' + return this.props.dispatch(actions.displayWarning(message)) + } + + if (parts[1]) { + var decimal = parts[1] + if (decimal.length > 18) { + message = 'Ether amount is too precise.' + return this.props.dispatch(actions.displayWarning(message)) + } + } + const value = util.normalizeEthStringToWei(input) const txData = document.querySelector('input[name="txData"]').value const balance = this.props.balance - let message if (value.gt(balance)) { message = 'Insufficient funds.' diff --git a/ui/app/util.js b/ui/app/util.js index 3f8b4dcc3..293f4228c 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -193,6 +193,9 @@ function normalizeEthStringToWei (str) { while (decimal.length < 18) { decimal += '0' } + if (decimal.length > 18) { + decimal = decimal.slice(0, 18) + } const decimalBN = new ethUtil.BN(decimal, 10) eth = eth.add(decimalBN) } |