mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge branch 'master' of github.com:MetaMask/metamask-extension into merge-master
This commit is contained in:
commit
4205d92729
@ -2,6 +2,14 @@
|
||||
|
||||
## Current Master
|
||||
|
||||
## 4.6.1 Mon Apr 30 2018
|
||||
|
||||
- Fix bug where sending a transaction resulted in an infinite spinner
|
||||
- Allow transactions with a 0 gwei gas price
|
||||
- Handle encoding errors in ERC20 symbol + digits
|
||||
- Fix ShapeShift forms (new + old ui)
|
||||
- Fix sourcemaps
|
||||
|
||||
## 4.6.0 Thu Apr 26 2018
|
||||
|
||||
- Correctly format currency conversion for locally selected preferred currency.
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "__MSG_appName__",
|
||||
"short_name": "__MSG_appName__",
|
||||
"version": "4.6.0",
|
||||
"version": "4.6.1",
|
||||
"manifest_version": 2,
|
||||
"author": "https://metamask.io",
|
||||
"description": "__MSG_appDescription__",
|
||||
@ -67,6 +67,7 @@
|
||||
"externally_connectable": {
|
||||
"matches": [
|
||||
"https://metamask.io/*"
|
||||
]
|
||||
],
|
||||
"ids": ["*"]
|
||||
}
|
||||
}
|
@ -309,6 +309,7 @@ function setupController (initState, initLangCode) {
|
||||
// connect to other contexts
|
||||
//
|
||||
extension.runtime.onConnect.addListener(connectRemote)
|
||||
extension.runtime.onConnectExternal.addListener(connectExternal)
|
||||
|
||||
const metamaskInternalProcessHash = {
|
||||
[ENVIRONMENT_TYPE_POPUP]: true,
|
||||
@ -335,9 +336,9 @@ function setupController (initState, initLangCode) {
|
||||
function connectRemote (remotePort) {
|
||||
const processName = remotePort.name
|
||||
const isMetaMaskInternalProcess = metamaskInternalProcessHash[processName]
|
||||
const portStream = new PortStream(remotePort)
|
||||
|
||||
if (isMetaMaskInternalProcess) {
|
||||
const portStream = new PortStream(remotePort)
|
||||
// communication with popup
|
||||
controller.isClientOpen = true
|
||||
controller.setupTrustedCommunication(portStream, 'MetaMask')
|
||||
@ -370,12 +371,17 @@ function setupController (initState, initLangCode) {
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// communication with page
|
||||
const originDomain = urlUtil.parse(remotePort.sender.url).hostname
|
||||
controller.setupUntrustedCommunication(portStream, originDomain)
|
||||
connectExternal(remotePort)
|
||||
}
|
||||
}
|
||||
|
||||
// communication with page or other extension
|
||||
function connectExternal(remotePort) {
|
||||
const originDomain = urlUtil.parse(remotePort.sender.url).hostname
|
||||
const portStream = new PortStream(remotePort)
|
||||
controller.setupUntrustedCommunication(portStream, originDomain)
|
||||
}
|
||||
|
||||
//
|
||||
// User Interface setup
|
||||
//
|
||||
|
@ -8,6 +8,7 @@ const TxGasUtil = require('./tx-gas-utils')
|
||||
const PendingTransactionTracker = require('./pending-tx-tracker')
|
||||
const NonceTracker = require('./nonce-tracker')
|
||||
const txUtils = require('./lib/util')
|
||||
const cleanErrorStack = require('../../lib/cleanErrorStack')
|
||||
const log = require('loglevel')
|
||||
|
||||
/**
|
||||
@ -118,6 +119,7 @@ class TransactionController extends EventEmitter {
|
||||
@param txParams {object} - txParams for the transaction
|
||||
@param opts {object} - with the key origin to put the origin on the txMeta
|
||||
*/
|
||||
|
||||
async newUnapprovedTransaction (txParams, opts = {}) {
|
||||
log.debug(`MetaMaskController newUnapprovedTransaction ${JSON.stringify(txParams)}`)
|
||||
const initialTxMeta = await this.addUnapprovedTransaction(txParams)
|
||||
@ -130,11 +132,11 @@ class TransactionController extends EventEmitter {
|
||||
case 'submitted':
|
||||
return resolve(finishedTxMeta.hash)
|
||||
case 'rejected':
|
||||
return reject(new Error('MetaMask Tx Signature: User denied transaction signature.'))
|
||||
return reject(cleanErrorStack(new Error('MetaMask Tx Signature: User denied transaction signature.')))
|
||||
case 'failed':
|
||||
return reject(new Error(finishedTxMeta.err.message))
|
||||
return reject(cleanErrorStack(new Error(finishedTxMeta.err.message)))
|
||||
default:
|
||||
return reject(new Error(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(finishedTxMeta.txParams)}`))
|
||||
return reject(cleanErrorStack(new Error(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(finishedTxMeta.txParams)}`)))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -2,6 +2,7 @@ const extend = require('xtend')
|
||||
const EventEmitter = require('events')
|
||||
const ObservableStore = require('obs-store')
|
||||
const ethUtil = require('ethereumjs-util')
|
||||
const log = require('loglevel')
|
||||
const txStateHistoryHelper = require('./lib/tx-state-history-helper')
|
||||
const createId = require('../../lib/random-id')
|
||||
const { getFinalStates } = require('./lib/util')
|
||||
@ -398,13 +399,19 @@ class TransactionStateManager extends EventEmitter {
|
||||
_setTxStatus (txId, status) {
|
||||
const txMeta = this.getTx(txId)
|
||||
txMeta.status = status
|
||||
setTimeout(() => {
|
||||
try {
|
||||
this.updateTx(txMeta, `txStateManager: setting status to ${status}`)
|
||||
this.emit(`${txMeta.id}:${status}`, txId)
|
||||
this.emit(`tx:status-update`, txId, status)
|
||||
if (['submitted', 'rejected', 'failed'].includes(status)) {
|
||||
this.emit(`${txMeta.id}:finished`, txMeta)
|
||||
}
|
||||
this.updateTx(txMeta, `txStateManager: setting status to ${status}`)
|
||||
this.emit('update:badge')
|
||||
} catch (error) {
|
||||
log.error(error)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
24
app/scripts/lib/cleanErrorStack.js
Normal file
24
app/scripts/lib/cleanErrorStack.js
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Returns error without stack trace for better UI display
|
||||
* @param {Error} err - error
|
||||
* @returns {Error} Error with clean stack trace.
|
||||
*/
|
||||
function cleanErrorStack(err){
|
||||
var name = err.name
|
||||
name = (name === undefined) ? 'Error' : String(name)
|
||||
|
||||
var msg = err.message
|
||||
msg = (msg === undefined) ? '' : String(msg)
|
||||
|
||||
if (name === '') {
|
||||
err.stack = err.message
|
||||
} else if (msg === '') {
|
||||
err.stack = err.name
|
||||
} else {
|
||||
err.stack = err.name + ': ' + err.message
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
module.exports = cleanErrorStack
|
@ -45,6 +45,7 @@ const BN = require('ethereumjs-util').BN
|
||||
const GWEI_BN = new BN('1000000000')
|
||||
const percentile = require('percentile')
|
||||
const seedPhraseVerifier = require('./lib/seed-phrase-verifier')
|
||||
const cleanErrorStack = require('./lib/cleanErrorStack')
|
||||
const log = require('loglevel')
|
||||
|
||||
module.exports = class MetamaskController extends EventEmitter {
|
||||
@ -642,9 +643,9 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
case 'signed':
|
||||
return cb(null, data.rawSig)
|
||||
case 'rejected':
|
||||
return cb(new Error('MetaMask Message Signature: User denied message signature.'))
|
||||
return cb(cleanErrorStack(new Error('MetaMask Message Signature: User denied message signature.')))
|
||||
default:
|
||||
return cb(new Error(`MetaMask Message Signature: Unknown problem: ${JSON.stringify(msgParams)}`))
|
||||
return cb(cleanErrorStack(new Error(`MetaMask Message Signature: Unknown problem: ${JSON.stringify(msgParams)}`)))
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -702,7 +703,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
*/
|
||||
newUnsignedPersonalMessage (msgParams, cb) {
|
||||
if (!msgParams.from) {
|
||||
return cb(new Error('MetaMask Message Signature: from field is required.'))
|
||||
return cb(cleanErrorStack(new Error('MetaMask Message Signature: from field is required.')))
|
||||
}
|
||||
|
||||
const msgId = this.personalMessageManager.addUnapprovedMessage(msgParams)
|
||||
@ -713,9 +714,9 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
case 'signed':
|
||||
return cb(null, data.rawSig)
|
||||
case 'rejected':
|
||||
return cb(new Error('MetaMask Message Signature: User denied message signature.'))
|
||||
return cb(cleanErrorStack(new Error('MetaMask Message Signature: User denied message signature.')))
|
||||
default:
|
||||
return cb(new Error(`MetaMask Message Signature: Unknown problem: ${JSON.stringify(msgParams)}`))
|
||||
return cb(cleanErrorStack(new Error(`MetaMask Message Signature: Unknown problem: ${JSON.stringify(msgParams)}`)))
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -781,9 +782,9 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
case 'signed':
|
||||
return cb(null, data.rawSig)
|
||||
case 'rejected':
|
||||
return cb(new Error('MetaMask Message Signature: User denied message signature.'))
|
||||
return cb(cleanErrorStack(new Error('MetaMask Message Signature: User denied message signature.')))
|
||||
default:
|
||||
return cb(new Error(`MetaMask Message Signature: Unknown problem: ${JSON.stringify(msgParams)}`))
|
||||
return cb(cleanErrorStack(new Error(`MetaMask Message Signature: Unknown problem: ${JSON.stringify(msgParams)}`)))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user