mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +01:00
Allow txs with no recipient when they have a data field
This commit is contained in:
parent
e5034ade24
commit
685a1881b8
@ -206,20 +206,21 @@ SendTransactionScreen.prototype.back = function() {
|
|||||||
this.props.dispatch(actions.backToAccountDetail(address))
|
this.props.dispatch(actions.backToAccountDetail(address))
|
||||||
}
|
}
|
||||||
|
|
||||||
SendTransactionScreen.prototype.onSubmit = function(event) {
|
SendTransactionScreen.prototype.onSubmit = function() {
|
||||||
var recipient = document.querySelector('input[name="address"]').value
|
|
||||||
|
|
||||||
var inputAmount = parseFloat(document.querySelector('input[name="amount"]').value)
|
const recipient = document.querySelector('input[name="address"]').value
|
||||||
var value = util.normalizeNumberToWei(inputAmount, 'ether')
|
const inputAmount = parseFloat(document.querySelector('input[name="amount"]').value)
|
||||||
|
const value = util.normalizeNumberToWei(inputAmount, 'ether')
|
||||||
var balance = this.props.balance
|
const txData = document.querySelector('input[name="txData"]').value
|
||||||
|
const balance = this.props.balance
|
||||||
|
|
||||||
if (value.gt(balance)) {
|
if (value.gt(balance)) {
|
||||||
var message = 'Insufficient funds.'
|
var message = 'Insufficient funds.'
|
||||||
return this.props.dispatch(actions.displayWarning(message))
|
return this.props.dispatch(actions.displayWarning(message))
|
||||||
}
|
}
|
||||||
if (recipient.length !== 42) {
|
|
||||||
var message = 'Recipient address is the incorrect length.'
|
if ((recipient.length !== 42 && !txData) || (!recipient && !txData)) {
|
||||||
|
var message = 'Recipient address is invalid.'
|
||||||
return this.props.dispatch(actions.displayWarning(message))
|
return this.props.dispatch(actions.displayWarning(message))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +233,6 @@ SendTransactionScreen.prototype.onSubmit = function(event) {
|
|||||||
value: '0x' + value.toString(16),
|
value: '0x' + value.toString(16),
|
||||||
}
|
}
|
||||||
|
|
||||||
var txData = document.querySelector('input[name="txData"]').value
|
|
||||||
if (txData) txParams.data = txData
|
if (txData) txParams.data = txData
|
||||||
|
|
||||||
this.props.dispatch(actions.signTx(txParams))
|
this.props.dispatch(actions.signTx(txParams))
|
||||||
|
Loading…
Reference in New Issue
Block a user