aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/send.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/send.js')
-rw-r--r--ui/app/send.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/ui/app/send.js b/ui/app/send.js
index 52e56132c..ba4e5bfff 100644
--- a/ui/app/send.js
+++ b/ui/app/send.js
@@ -206,20 +206,21 @@ SendTransactionScreen.prototype.back = function() {
this.props.dispatch(actions.backToAccountDetail(address))
}
-SendTransactionScreen.prototype.onSubmit = function(event) {
- var recipient = document.querySelector('input[name="address"]').value
+SendTransactionScreen.prototype.onSubmit = function() {
- var inputAmount = parseFloat(document.querySelector('input[name="amount"]').value)
- var value = util.normalizeNumberToWei(inputAmount, 'ether')
-
- var balance = this.props.balance
+ const recipient = document.querySelector('input[name="address"]').value
+ const input = document.querySelector('input[name="amount"]').value
+ const value = util.normalizeEthStringToWei(input)
+ const txData = document.querySelector('input[name="txData"]').value
+ const balance = this.props.balance
if (value.gt(balance)) {
var message = 'Insufficient funds.'
return this.props.dispatch(actions.displayWarning(message))
}
- if (recipient.length !== 42) {
- var message = 'Recipient address is the incorrect length.'
+
+ if ((!util.isValidAddress(recipient) && !txData) || (!recipient && !txData)) {
+ var message = 'Recipient address is invalid.'
return this.props.dispatch(actions.displayWarning(message))
}
@@ -227,12 +228,11 @@ SendTransactionScreen.prototype.onSubmit = function(event) {
this.props.dispatch(actions.showLoadingIndication())
var txParams = {
- to: recipient,
from: this.props.address,
value: '0x' + value.toString(16),
}
- var txData = document.querySelector('input[name="txData"]').value
+ if (recipient) txParams.to = ethUtil.addHexPrefix(recipient)
if (txData) txParams.data = txData
this.props.dispatch(actions.signTx(txParams))