diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-04-21 00:29:37 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-04-21 00:29:37 +0800 |
commit | 532edf670e8c30db958765141974f3fb0f5ec44c (patch) | |
tree | 2a2eccc7fba9e98b6a69abe2cb74d793264d5ba4 /app | |
parent | 7455a0fa32850e46a3d7c84d39c549928274a248 (diff) | |
download | tangerine-wallet-browser-532edf670e8c30db958765141974f3fb0f5ec44c.tar tangerine-wallet-browser-532edf670e8c30db958765141974f3fb0f5ec44c.tar.gz tangerine-wallet-browser-532edf670e8c30db958765141974f3fb0f5ec44c.tar.bz2 tangerine-wallet-browser-532edf670e8c30db958765141974f3fb0f5ec44c.tar.lz tangerine-wallet-browser-532edf670e8c30db958765141974f3fb0f5ec44c.tar.xz tangerine-wallet-browser-532edf670e8c30db958765141974f3fb0f5ec44c.tar.zst tangerine-wallet-browser-532edf670e8c30db958765141974f3fb0f5ec44c.zip |
Store metamaskId on metaTx instead of getTxWithParams method.
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/lib/config-manager.js | 10 | ||||
-rw-r--r-- | app/scripts/lib/idStore.js | 10 |
2 files changed, 7 insertions, 13 deletions
diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js index b0dcd4d3f..c79dc7a8f 100644 --- a/app/scripts/lib/config-manager.js +++ b/app/scripts/lib/config-manager.js @@ -161,16 +161,6 @@ ConfigManager.prototype.getTx = function(txId) { return matching.length > 0 ? matching[0] : null } -ConfigManager.prototype.getTxWithParams = function(params) { - var transactions = this.getTxList() - var matching = transactions.filter((tx) => { - return Object.keys(tx.txParams).reduce((result, key) => { - return ('params' in tx) ? tx.params[key] === params[key] && result : result - }, true) - }) - return matching.length > 0 ? matching[0] : null -} - ConfigManager.prototype.confirmTx = function(txId) { this._setTxStatus(txId, 'confirmed') } diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index 66194fd41..7763d33d8 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -135,6 +135,7 @@ IdentityStore.prototype.addUnconfirmedTransaction = function(txParams, cb){ // create txData obj with parameters and meta data var time = (new Date()).getTime() var txId = createId() + txParams.metamaskId = txId var txData = { id: txId, txParams: txParams, @@ -337,10 +338,13 @@ function IdManagement(opts) { txParams.gasLimit = ethUtil.addHexPrefix(txParams.gasLimit || txParams.gas) txParams.nonce = ethUtil.addHexPrefix(txParams.nonce) var tx = new Transaction(txParams) + + // Add the tx hash to the persisted meta-tx object var hash = '0x' + tx.hash().toString('hex') - var txLog = configManager.getTxWithParams(txParams) - txLog.hash = hash - configManager.updateTx(txLog) + var metaTx = configManager.getTx(txParams.metamaskId) + metaTx.hash = hash + configManager.updateTx(metaTx) + var rawTx = '0x'+tx.serialize().toString('hex') return '0x'+LightwalletSigner.signTx(this.keyStore, this.derivedKey, rawTx, txParams.from, this.hdPathString) } |