aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2018-04-04 05:06:10 +0800
committerGitHub <noreply@github.com>2018-04-04 05:06:10 +0800
commit6eff5944d2855618853d30284da3610b3cc537a6 (patch)
treec05de63c2344accca5312e24dbae3bab30011dff
parentd6c4450b1cf1470cf437a80a3f78c937d267aef5 (diff)
parent83df8b58ba470b6446c158789a308e801bf5becb (diff)
downloadtangerine-wallet-browser-6eff5944d2855618853d30284da3610b3cc537a6.tar.gz
tangerine-wallet-browser-6eff5944d2855618853d30284da3610b3cc537a6.tar.zst
tangerine-wallet-browser-6eff5944d2855618853d30284da3610b3cc537a6.zip
Merge pull request #3848 from MetaMask/i#3841
transactions - dont throw if chain id is not a string
-rw-r--r--app/scripts/lib/tx-state-manager.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js
index 23c915a61..9e597ef37 100644
--- a/app/scripts/lib/tx-state-manager.js
+++ b/app/scripts/lib/tx-state-manager.js
@@ -140,8 +140,16 @@ module.exports = class TransactionStateManager extends EventEmitter {
validateTxParams(txParams) {
Object.keys(txParams).forEach((key) => {
const value = txParams[key]
- if (typeof value !== 'string') throw new Error(`${key}: ${value} in txParams is not a string`)
- if (!ethUtil.isHexPrefixed(value)) throw new Error('is not hex prefixed, everything on txParams must be hex prefixed')
+ // validate types
+ switch (key) {
+ case 'chainId':
+ if (typeof value !== 'number') throw new Error(`${key} in txParams is not a Number. got: (${value})`)
+ break
+ default:
+ if (typeof value !== 'string') throw new Error(`${key} in txParams is not a string. got: (${value})`)
+ if (!ethUtil.isHexPrefixed(value)) throw new Error(`${key} in txParams is not hex prefixed. got: (${value})`)
+ break
+ }
})
}