aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-09-07 06:23:48 +0800
committerDan Finlay <dan@danfinlay.com>2016-09-07 06:23:48 +0800
commitdcc24804a1048e9379ce30233f4ecf540db5a54a (patch)
tree4c5b5b3e924393739bacf2437953d21a495d4a53 /app
parentf6be97d9cfa005d785cdf172c79beac953a212f5 (diff)
downloadtangerine-wallet-browser-dcc24804a1048e9379ce30233f4ecf540db5a54a.tar
tangerine-wallet-browser-dcc24804a1048e9379ce30233f4ecf540db5a54a.tar.gz
tangerine-wallet-browser-dcc24804a1048e9379ce30233f4ecf540db5a54a.tar.bz2
tangerine-wallet-browser-dcc24804a1048e9379ce30233f4ecf540db5a54a.tar.lz
tangerine-wallet-browser-dcc24804a1048e9379ce30233f4ecf540db5a54a.tar.xz
tangerine-wallet-browser-dcc24804a1048e9379ce30233f4ecf540db5a54a.tar.zst
tangerine-wallet-browser-dcc24804a1048e9379ce30233f4ecf540db5a54a.zip
Add negative value validation to tx approval
Diffstat (limited to 'app')
-rw-r--r--app/scripts/metamask-controller.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index e94db2dfd..83827ec76 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -199,6 +199,9 @@ module.exports = class MetamaskController {
const idStore = this.idStore
var state = idStore.getState()
+ let err = this.enforceTxValidations(txParams)
+ if (err) return onTxDoneCb(err)
+
// It's locked
if (!state.isUnlocked) {
@@ -216,6 +219,13 @@ module.exports = class MetamaskController {
}
}
+ enforceTxValidations (txParams) {
+ if (txParams.value.indexOf('-') === 0) {
+ const msg = `Invalid transaction value of ${txParams.value} not a positive number.`
+ return new Error(msg)
+ }
+ }
+
newUnsignedMessage (msgParams, cb) {
var state = this.idStore.getState()
if (!state.isUnlocked) {