diff options
author | Dan Finlay <flyswatter@users.noreply.github.com> | 2017-01-19 05:14:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-19 05:14:27 +0800 |
commit | 25e57939920d4685a20b4e7b3a14060e9d3314c7 (patch) | |
tree | fa3c5f2811912a18ce9811c5c850bb4ec25ffbb1 /app | |
parent | 9ab7ce370bc12e10b3458c0755f0dd8488788bec (diff) | |
parent | 0e01abdf7154067ca50bf279340b868aefd8343f (diff) | |
download | tangerine-wallet-browser-25e57939920d4685a20b4e7b3a14060e9d3314c7.tar tangerine-wallet-browser-25e57939920d4685a20b4e7b3a14060e9d3314c7.tar.gz tangerine-wallet-browser-25e57939920d4685a20b4e7b3a14060e9d3314c7.tar.bz2 tangerine-wallet-browser-25e57939920d4685a20b4e7b3a14060e9d3314c7.tar.lz tangerine-wallet-browser-25e57939920d4685a20b4e7b3a14060e9d3314c7.tar.xz tangerine-wallet-browser-25e57939920d4685a20b4e7b3a14060e9d3314c7.tar.zst tangerine-wallet-browser-25e57939920d4685a20b4e7b3a14060e9d3314c7.zip |
Merge pull request #1027 from MetaMask/Version-3.1.0v3.1.0
Version 3.1.0
Diffstat (limited to 'app')
-rw-r--r-- | app/manifest.json | 2 | ||||
-rw-r--r-- | app/scripts/keyring-controller.js | 6 | ||||
-rw-r--r-- | app/scripts/keyrings/hd.js | 2 | ||||
-rw-r--r-- | app/scripts/keyrings/simple.js | 21 | ||||
-rw-r--r-- | app/scripts/lib/config-manager.js | 2 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 7 | ||||
-rw-r--r-- | app/scripts/transaction-manager.js | 11 |
7 files changed, 32 insertions, 19 deletions
diff --git a/app/manifest.json b/app/manifest.json index 9c6558d15..2f1ae9b25 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "MetaMask", "short_name": "Metamask", - "version": "3.0.0", + "version": "3.1.0", "manifest_version": 2, "author": "https://metamask.io", "description": "Ethereum Browser Extension", diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index 79cfe6fbd..e609403cc 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -234,7 +234,10 @@ module.exports = class KeyringController extends EventEmitter { addNewKeyring (type, opts) { const Keyring = this.getKeyringClassForType(type) const keyring = new Keyring(opts) - return keyring.getAccounts() + return keyring.deserialize(opts) + .then(() => { + return keyring.getAccounts() + }) .then((accounts) => { this.keyrings.push(keyring) return this.setupAccounts(accounts) @@ -397,6 +400,7 @@ module.exports = class KeyringController extends EventEmitter { }).then((rawSig) => { cb(null, rawSig) approvalCb(null, true) + messageManager.confirmMsg(msgId) return rawSig }) } catch (e) { diff --git a/app/scripts/keyrings/hd.js b/app/scripts/keyrings/hd.js index 80b713b58..1b9796e07 100644 --- a/app/scripts/keyrings/hd.js +++ b/app/scripts/keyrings/hd.js @@ -76,7 +76,7 @@ class HdKeyring extends EventEmitter { // For eth_sign, we need to sign transactions: signMessage (withAccount, data) { const wallet = this._getWalletForAccount(withAccount) - const message = ethUtil.removeHexPrefix(data) + const message = ethUtil.stripHexPrefix(data) var privKey = wallet.getPrivateKey() var msgSig = ethUtil.ecsign(new Buffer(message, 'hex'), privKey) var rawMsgSig = ethUtil.bufferToHex(sigUtil.concatSig(msgSig.v, msgSig.r, msgSig.s)) diff --git a/app/scripts/keyrings/simple.js b/app/scripts/keyrings/simple.js index 6b16137ae..46687fcaf 100644 --- a/app/scripts/keyrings/simple.js +++ b/app/scripts/keyrings/simple.js @@ -20,13 +20,19 @@ class SimpleKeyring extends EventEmitter { } deserialize (privateKeys = []) { - this.wallets = privateKeys.map((privateKey) => { - const stripped = ethUtil.stripHexPrefix(privateKey) - const buffer = new Buffer(stripped, 'hex') - const wallet = Wallet.fromPrivateKey(buffer) - return wallet + return new Promise((resolve, reject) => { + try { + this.wallets = privateKeys.map((privateKey) => { + const stripped = ethUtil.stripHexPrefix(privateKey) + const buffer = new Buffer(stripped, 'hex') + const wallet = Wallet.fromPrivateKey(buffer) + return wallet + }) + } catch (e) { + reject(e) + } + resolve() }) - return Promise.resolve() } addAccounts (n = 1) { @@ -54,8 +60,7 @@ class SimpleKeyring extends EventEmitter { // For eth_sign, we need to sign transactions: signMessage (withAccount, data) { const wallet = this._getWalletForAccount(withAccount) - - const message = ethUtil.removeHexPrefix(data) + const message = ethUtil.stripHexPrefix(data) var privKey = wallet.getPrivateKey() var msgSig = ethUtil.ecsign(new Buffer(message, 'hex'), privKey) var rawMsgSig = ethUtil.bufferToHex(sigUtil.concatSig(msgSig.v, msgSig.r, msgSig.s)) diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js index 3a1f12ac0..e927c78ec 100644 --- a/app/scripts/lib/config-manager.js +++ b/app/scripts/lib/config-manager.js @@ -306,7 +306,7 @@ ConfigManager.prototype.updateConversionRate = function () { this.setConversionPrice(parsedResponse.ticker.price) this.setConversionDate(parsedResponse.timestamp) }).catch((err) => { - console.error('Error in conversion.', err) + console.warn('MetaMask - Failed to query currency conversion.') this.setConversionPrice(0) this.setConversionDate('N/A') }) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index b94b98eac..629216e42 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -115,7 +115,12 @@ module.exports = class MetamaskController extends EventEmitter { .then((newState) => { cb(null, newState) }) .catch((reason) => { cb(reason) }) }, - addNewKeyring: nodeify(keyringController.addNewKeyring).bind(keyringController), + addNewKeyring: (type, opts, cb) => { + keyringController.addNewKeyring(type, opts) + .then(() => keyringController.fullUpdate()) + .then((newState) => { cb(null, newState) }) + .catch((reason) => { cb(reason) }) + }, addNewAccount: nodeify(keyringController.addNewAccount).bind(keyringController), setSelectedAccount: nodeify(keyringController.setSelectedAccount).bind(keyringController), saveAccountLabel: nodeify(keyringController.saveAccountLabel).bind(keyringController), diff --git a/app/scripts/transaction-manager.js b/app/scripts/transaction-manager.js index cc9082394..6d0121afd 100644 --- a/app/scripts/transaction-manager.js +++ b/app/scripts/transaction-manager.js @@ -190,7 +190,7 @@ module.exports = class TransactionManager extends EventEmitter { let fromAddress = txParams.from let ethTx = this.txProviderUtils.buildEthTxFromParams(txParams, txMeta.gasMultiplier) this.signEthTx(ethTx, fromAddress).then(() => { - this.updateTxAsSigned(txMeta.id, ethTx) + this.setTxStatusSigned(txMeta.id) cb(null, ethUtil.bufferToHex(ethTx.serialize())) }).catch((err) => { cb(err) @@ -198,21 +198,20 @@ module.exports = class TransactionManager extends EventEmitter { } publishTransaction (txId, rawTx, cb) { - this.txProviderUtils.publishTransaction(rawTx, (err) => { + this.txProviderUtils.publishTransaction(rawTx, (err, txHash) => { if (err) return cb(err) + this.setTxHash(txId, txHash) this.setTxStatusSubmitted(txId) cb() }) } - // receives a signed tx object and updates the tx hash - updateTxAsSigned (txId, ethTx) { + // receives a txHash records the tx as signed + setTxHash (txId, txHash) { // Add the tx hash to the persisted meta-tx object - let txHash = ethUtil.bufferToHex(ethTx.hash()) let txMeta = this.getTx(txId) txMeta.hash = txHash this.updateTx(txMeta) - this.setTxStatusSigned(txMeta.id) } /* |