aboutsummaryrefslogtreecommitdiffstats
path: root/old-ui
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2018-10-30 09:47:07 +0800
committerGitHub <noreply@github.com>2018-10-30 09:47:07 +0800
commit310229d22e5e916e8d6e3b1a469b9b196e0f70c2 (patch)
tree518bd3f5fb01c792fe2e44db3aace1c20f22c7e1 /old-ui
parent1bb4a8428c73c1f1137793b25900db159eec3fa8 (diff)
parent9b42416fc0d92662d1a21759db357e7f439d7a7b (diff)
downloadtangerine-wallet-browser-310229d22e5e916e8d6e3b1a469b9b196e0f70c2.tar
tangerine-wallet-browser-310229d22e5e916e8d6e3b1a469b9b196e0f70c2.tar.gz
tangerine-wallet-browser-310229d22e5e916e8d6e3b1a469b9b196e0f70c2.tar.bz2
tangerine-wallet-browser-310229d22e5e916e8d6e3b1a469b9b196e0f70c2.tar.lz
tangerine-wallet-browser-310229d22e5e916e8d6e3b1a469b9b196e0f70c2.tar.xz
tangerine-wallet-browser-310229d22e5e916e8d6e3b1a469b9b196e0f70c2.tar.zst
tangerine-wallet-browser-310229d22e5e916e8d6e3b1a469b9b196e0f70c2.zip
Merge pull request #5567 from MetaMask/HowardBraham-develop
Feature: Warn when attempting to send tx with data to non-contract
Diffstat (limited to 'old-ui')
-rw-r--r--old-ui/app/components/pending-tx.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/old-ui/app/components/pending-tx.js b/old-ui/app/components/pending-tx.js
index c8132539c..35e81210e 100644
--- a/old-ui/app/components/pending-tx.js
+++ b/old-ui/app/components/pending-tx.js
@@ -1,4 +1,5 @@
const Component = require('react').Component
+const connect = require('react-redux').connect
const h = require('react-hyperscript')
const inherits = require('util').inherits
const actions = require('../../../ui/app/actions')
@@ -19,7 +20,9 @@ const BNInput = require('./bn-as-decimal-input')
const MIN_GAS_PRICE_BN = new BN('0')
const MIN_GAS_LIMIT_BN = new BN('21000')
-module.exports = PendingTx
+module.exports = connect()(PendingTx)
+
+
inherits(PendingTx, Component)
function PendingTx () {
Component.call(this)
@@ -445,7 +448,8 @@ PendingTx.prototype.onSubmit = function (event) {
const txMeta = this.gatherTxMeta()
const valid = this.checkValidity()
this.setState({ valid, submitting: true })
- if (valid && this.verifyGasParams()) {
+ const validGasParams = this.verifyGasParams()
+ if (valid && validGasParams) {
this.props.sendTransaction(txMeta, event)
} else {
this.props.dispatch(actions.displayWarning('Invalid Gas Parameters'))
@@ -488,8 +492,12 @@ PendingTx.prototype.verifyGasParams = function () {
)
}
-PendingTx.prototype._notZeroOrEmptyString = function (obj) {
- return obj !== '' && obj !== '0x0'
+PendingTx.prototype._notZeroOrEmptyString = function (value) {
+ // allow undefined values
+ if (value === undefined) return true
+ // Geth will return '0x', and ganache-core v2.2.1 will return '0x0'
+ const valueIsEmpty = !value || value === '0x' || value === '0x0'
+ return !valueIsEmpty
}
PendingTx.prototype.bnMultiplyByFraction = function (targetBN, numerator, denominator) {