aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/tx-utils.js
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2017-01-14 09:47:20 +0800
committerFrankie <frankie.diamond@gmail.com>2017-01-14 09:47:20 +0800
commit580d93188cb77cb4d4ce809b46dade8525efc380 (patch)
tree58159a87cc45ae338f17c2b01ac9c21cf26b72f1 /app/scripts/lib/tx-utils.js
parent212ef0b850d3bd07c24a7e2d662fe1952cf9a6dd (diff)
downloadtangerine-wallet-browser-580d93188cb77cb4d4ce809b46dade8525efc380.tar
tangerine-wallet-browser-580d93188cb77cb4d4ce809b46dade8525efc380.tar.gz
tangerine-wallet-browser-580d93188cb77cb4d4ce809b46dade8525efc380.tar.bz2
tangerine-wallet-browser-580d93188cb77cb4d4ce809b46dade8525efc380.tar.lz
tangerine-wallet-browser-580d93188cb77cb4d4ce809b46dade8525efc380.tar.xz
tangerine-wallet-browser-580d93188cb77cb4d4ce809b46dade8525efc380.tar.zst
tangerine-wallet-browser-580d93188cb77cb4d4ce809b46dade8525efc380.zip
Satisfy review needs:
removed unnecessary this.query = opts.query from constructor Created a tx error state for errors in approveTransaction validateTxParams has been moved to tx-utils removed "value" arg from _setTxStatus
Diffstat (limited to 'app/scripts/lib/tx-utils.js')
-rw-r--r--app/scripts/lib/tx-utils.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js
index eba537d0a..5116cb93b 100644
--- a/app/scripts/lib/tx-utils.js
+++ b/app/scripts/lib/tx-utils.js
@@ -16,7 +16,7 @@ module.exports = class txProviderUtils {
this.provider = provider
this.query = new EthQuery(provider)
}
-
+
analyzeGasUsage (txData, cb) {
var self = this
this.query.getBlockByNumber('latest', true, (err, block) => {
@@ -113,10 +113,20 @@ module.exports = class txProviderUtils {
publishTransaction (rawTx, cb) {
this.query.sendRawTransaction(rawTx, cb)
}
+
+ validateTxParams (txParams, cb) {
+ if (('value' in txParams) && txParams.value.indexOf('-') === 0) {
+ cb(new Error(`Invalid transaction value of ${txParams.value} not a positive number.`))
+ } else {
+ cb()
+ }
+ }
+
+
}
// util
function isUndef(value) {
return value === undefined
-} \ No newline at end of file
+}