aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-09-06 11:13:43 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-09-06 11:13:43 +0800
commit4c554f32eca5ceda2d525b967075ec2b6ff41809 (patch)
tree44991fc7147fc888db03058d052bad3c36295655
parent474a4e941f7bb5c19ac50d61c6c681a19278b52f (diff)
downloadtangerine-wallet-browser-4c554f32eca5ceda2d525b967075ec2b6ff41809.tar
tangerine-wallet-browser-4c554f32eca5ceda2d525b967075ec2b6ff41809.tar.gz
tangerine-wallet-browser-4c554f32eca5ceda2d525b967075ec2b6ff41809.tar.bz2
tangerine-wallet-browser-4c554f32eca5ceda2d525b967075ec2b6ff41809.tar.lz
tangerine-wallet-browser-4c554f32eca5ceda2d525b967075ec2b6ff41809.tar.xz
tangerine-wallet-browser-4c554f32eca5ceda2d525b967075ec2b6ff41809.tar.zst
tangerine-wallet-browser-4c554f32eca5ceda2d525b967075ec2b6ff41809.zip
remove #buildEthTxFromParams
-rw-r--r--app/scripts/lib/tx-utils.js17
-rw-r--r--test/unit/tx-utils-test.js4
2 files changed, 3 insertions, 18 deletions
diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js
index 5af078dc4..618f69e1c 100644
--- a/app/scripts/lib/tx-utils.js
+++ b/app/scripts/lib/tx-utils.js
@@ -1,5 +1,4 @@
const EthQuery = require('ethjs-query')
-const Transaction = require('ethereumjs-tx')
const normalize = require('eth-sig-util').normalize
const {
hexToBn,
@@ -78,22 +77,6 @@ module.exports = class txProvideUtil {
return bnToHex(upperGasLimitBn)
}
- // builds ethTx from txParams object
- buildEthTxFromParams (txParams) {
- // normalize values
- txParams.to = normalize(txParams.to)
- txParams.from = normalize(txParams.from)
- txParams.value = normalize(txParams.value)
- txParams.data = normalize(txParams.data)
- txParams.gas = normalize(txParams.gas || txParams.gasLimit)
- txParams.gasPrice = normalize(txParams.gasPrice)
- txParams.nonce = normalize(txParams.nonce)
- // build ethTx
- log.info(`Prepared tx for signing: ${JSON.stringify(txParams)}`)
- const ethTx = new Transaction(txParams)
- return ethTx
- }
-
async publishTransaction (rawTx) {
return await this.query.sendRawTransaction(rawTx)
}
diff --git a/test/unit/tx-utils-test.js b/test/unit/tx-utils-test.js
index 43128b977..dcfb9fb3d 100644
--- a/test/unit/tx-utils-test.js
+++ b/test/unit/tx-utils-test.js
@@ -1,6 +1,8 @@
const assert = require('assert')
+const Transaction = require('ethereumjs-tx')
const BN = require('bn.js')
+
const { hexToBn, bnToHex } = require('../../app/scripts/lib/util')
const TxUtils = require('../../app/scripts/lib/tx-utils')
@@ -28,7 +30,7 @@ describe('txUtils', function () {
nonce: '0x3',
chainId: 42,
}
- const ethTx = txUtils.buildEthTxFromParams(txParams)
+ const ethTx = new Transaction(txParams)
assert.equal(ethTx.getChainId(), 42, 'chainId is set from tx params')
})
})