diff options
author | kumavis <kumavis@users.noreply.github.com> | 2018-03-14 06:42:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-14 06:42:50 +0800 |
commit | b7a24840f2aa358a174d134d7ed30dc3ff2fc4be (patch) | |
tree | 6ad88353ae1b8847fb91b5cd51fc7e18a68e5ab3 | |
parent | b183d879d672e3c8e8812d86e11246f36a16cd3d (diff) | |
parent | 22cd7882038d05e51c5b76f2f4c76c15b2fd89f6 (diff) | |
download | tangerine-wallet-browser-b7a24840f2aa358a174d134d7ed30dc3ff2fc4be.tar tangerine-wallet-browser-b7a24840f2aa358a174d134d7ed30dc3ff2fc4be.tar.gz tangerine-wallet-browser-b7a24840f2aa358a174d134d7ed30dc3ff2fc4be.tar.bz2 tangerine-wallet-browser-b7a24840f2aa358a174d134d7ed30dc3ff2fc4be.tar.lz tangerine-wallet-browser-b7a24840f2aa358a174d134d7ed30dc3ff2fc4be.tar.xz tangerine-wallet-browser-b7a24840f2aa358a174d134d7ed30dc3ff2fc4be.tar.zst tangerine-wallet-browser-b7a24840f2aa358a174d134d7ed30dc3ff2fc4be.zip |
Merge pull request #3551 from MetaMask/i#3509
fix for where null is not supported in txParams
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | app/scripts/lib/tx-gas-utils.js | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 25eb9b915..80bef88b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog ## Current Master + +- Will now throw an error if the `to` field in txParams is not valid. +- Will strip null values from the `to` field. - 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..0fa9dd8d4 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. /* @@ -113,12 +113,14 @@ module.exports = class TxGasUtil { } } validateRecipient (txParams) { - if (txParams.to === '0x') { + if (txParams.to === '0x' || txParams.to === null ) { if (txParams.data) { delete txParams.to } else { throw new Error('Invalid recipient address') } + } else if ( txParams.to !== undefined && !isValidAddress(txParams.to) ) { + throw new Error('Invalid recipient address') } return txParams } |