aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorThomas Huang <tmashuang@users.noreply.github.com>2018-01-09 03:47:47 +0800
committerGitHub <noreply@github.com>2018-01-09 03:47:47 +0800
commit0fbecb9f7c3b4b0d0b885f6478db70625851f1c2 (patch)
treee3f4b117381d8edb49428f726cb082417d7efae3 /app
parent0cf5c22178050fff0e89af2a12d87ef7fdf4440c (diff)
parentd11ec81f49328d3f0fee484fba5191d4c29c42ad (diff)
downloadtangerine-wallet-browser-0fbecb9f7c3b4b0d0b885f6478db70625851f1c2.tar
tangerine-wallet-browser-0fbecb9f7c3b4b0d0b885f6478db70625851f1c2.tar.gz
tangerine-wallet-browser-0fbecb9f7c3b4b0d0b885f6478db70625851f1c2.tar.bz2
tangerine-wallet-browser-0fbecb9f7c3b4b0d0b885f6478db70625851f1c2.tar.lz
tangerine-wallet-browser-0fbecb9f7c3b4b0d0b885f6478db70625851f1c2.tar.xz
tangerine-wallet-browser-0fbecb9f7c3b4b0d0b885f6478db70625851f1c2.tar.zst
tangerine-wallet-browser-0fbecb9f7c3b4b0d0b885f6478db70625851f1c2.zip
Merge pull request #2891 from MetaMask/i2621-0xRecipientAddress
Account for 0x/empty string recipient
Diffstat (limited to 'app')
-rw-r--r--app/scripts/lib/tx-gas-utils.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/scripts/lib/tx-gas-utils.js b/app/scripts/lib/tx-gas-utils.js
index ccf8bb1b1..5e49fdb22 100644
--- a/app/scripts/lib/tx-gas-utils.js
+++ b/app/scripts/lib/tx-gas-utils.js
@@ -81,6 +81,7 @@ module.exports = class txProvideUtil {
}
async validateTxParams (txParams) {
+ this.validateRecipient(txParams)
if ('value' in txParams) {
const value = txParams.value.toString()
if (value.includes('-')) {
@@ -92,4 +93,14 @@ module.exports = class txProvideUtil {
}
}
}
+ validateRecipient (txParams) {
+ if (txParams.to === '0x') {
+ if (txParams.data) {
+ delete txParams.to
+ } else {
+ throw new Error('Invalid recipient address')
+ }
+ }
+ return txParams
+ }
}