aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--app/scripts/lib/tx-gas-utils.js8
2 files changed, 9 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 25eb9b915..1450a8c9f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,8 @@
# Changelog
## Current Master
+
+- MetaMask will now throw an error if the `to` field in txParams is not valid and also will make sure that the two field is not `null` mucking up metamask
- Fix flashing to Log in screen after logging in or restoring from seed phrase.
- Increase tap areas for menu buttons on mobile
- Change all fonts in new-ui onboarding to Roboto, size 400
diff --git a/app/scripts/lib/tx-gas-utils.js b/app/scripts/lib/tx-gas-utils.js
index 6f6ff7852..e61db3332 100644
--- a/app/scripts/lib/tx-gas-utils.js
+++ b/app/scripts/lib/tx-gas-utils.js
@@ -4,7 +4,7 @@ const {
BnMultiplyByFraction,
bnToHex,
} = require('./util')
-const addHexPrefix = require('ethereumjs-util').addHexPrefix
+const {addHexPrefix, isValidAddress} = require('ethereumjs-util')
const SIMPLE_GAS_COST = '0x5208' // Hex for 21000, cost of a simple send.
/*
@@ -101,6 +101,12 @@ module.exports = class TxGasUtil {
async validateTxParams (txParams) {
this.validateRecipient(txParams)
+ if ('to' in txParams) {
+ if ( txParams.to === null ) delete txParams.to
+ else if ( txParams.to !== undefined && !isValidAddress(txParams.to) ) {
+ throw new Error(`Invalid transaction value of ${txParams.to} not a valid to address.`)
+ }
+ }
if ('value' in txParams) {
const value = txParams.value.toString()
if (value.includes('-')) {