mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge branch 'master' into SignTypedData
This commit is contained in:
commit
c5b7880f05
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## Current Master
|
## Current Master
|
||||||
|
|
||||||
|
- Remove Slack link from info page, since it is a big phishing target.
|
||||||
|
|
||||||
## 3.10.8 2017-9-28
|
## 3.10.8 2017-9-28
|
||||||
|
|
||||||
- Fixed usage of new currency fetching API.
|
- Fixed usage of new currency fetching API.
|
||||||
|
@ -86,12 +86,15 @@ module.exports = class PendingTransactionTracker extends EventEmitter {
|
|||||||
// other
|
// other
|
||||||
|| errorMessage.includes('gateway timeout')
|
|| errorMessage.includes('gateway timeout')
|
||||||
|| errorMessage.includes('nonce too low')
|
|| errorMessage.includes('nonce too low')
|
||||||
|| txMeta.retryCount > 1
|
|
||||||
)
|
)
|
||||||
// ignore resubmit warnings, return early
|
// ignore resubmit warnings, return early
|
||||||
if (isKnownTx) return
|
if (isKnownTx) return
|
||||||
// encountered real error - transition to error state
|
// encountered real error - transition to error state
|
||||||
this.emit('tx:failed', txMeta.id, err)
|
txMeta.warning = {
|
||||||
|
error: errorMessage,
|
||||||
|
message: 'There was an error when resubmitting this transaction.',
|
||||||
|
}
|
||||||
|
this.emit('tx:warning', txMeta, err)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,11 +136,10 @@ module.exports = class PendingTransactionTracker extends EventEmitter {
|
|||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
txMeta.warning = {
|
txMeta.warning = {
|
||||||
error: err,
|
error: err.message,
|
||||||
message: 'There was a problem loading this transaction.',
|
message: 'There was a problem loading this transaction.',
|
||||||
}
|
}
|
||||||
this.emit('tx:warning', txMeta)
|
this.emit('tx:warning', txMeta, err)
|
||||||
throw err
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,6 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
eth_syncing: false,
|
eth_syncing: false,
|
||||||
web3_clientVersion: `MetaMask/v${version}`,
|
web3_clientVersion: `MetaMask/v${version}`,
|
||||||
},
|
},
|
||||||
originHttpHeaderKey: 'X-Metamask-Origin',
|
|
||||||
// account mgmt
|
// account mgmt
|
||||||
getAccounts: (cb) => {
|
getAccounts: (cb) => {
|
||||||
const isUnlocked = this.keyringController.memStore.getState().isUnlocked
|
const isUnlocked = this.keyringController.memStore.getState().isUnlocked
|
||||||
|
@ -69,8 +69,8 @@
|
|||||||
"eth-bin-to-ops": "^1.0.1",
|
"eth-bin-to-ops": "^1.0.1",
|
||||||
"eth-block-tracker": "^2.2.0",
|
"eth-block-tracker": "^2.2.0",
|
||||||
"eth-contract-metadata": "^1.1.4",
|
"eth-contract-metadata": "^1.1.4",
|
||||||
"eth-hd-keyring": "^1.1.1",
|
"eth-hd-keyring": "^1.2.1",
|
||||||
"eth-json-rpc-filters": "^1.2.1",
|
"eth-json-rpc-filters": "^1.2.2",
|
||||||
"eth-keyring-controller": "^2.0.0",
|
"eth-keyring-controller": "^2.0.0",
|
||||||
"eth-phishing-detect": "^1.1.4",
|
"eth-phishing-detect": "^1.1.4",
|
||||||
"eth-query": "^2.1.2",
|
"eth-query": "^2.1.2",
|
||||||
@ -158,7 +158,7 @@
|
|||||||
"brfs": "^1.4.3",
|
"brfs": "^1.4.3",
|
||||||
"browserify": "^14.4.0",
|
"browserify": "^14.4.0",
|
||||||
"chai": "^4.1.0",
|
"chai": "^4.1.0",
|
||||||
"coveralls": "^2.13.1",
|
"coveralls": "^3.0.0",
|
||||||
"deep-freeze-strict": "^1.1.1",
|
"deep-freeze-strict": "^1.1.1",
|
||||||
"del": "^3.0.0",
|
"del": "^3.0.0",
|
||||||
"envify": "^4.0.0",
|
"envify": "^4.0.0",
|
||||||
@ -186,7 +186,7 @@
|
|||||||
"karma-firefox-launcher": "^1.0.1",
|
"karma-firefox-launcher": "^1.0.1",
|
||||||
"karma-qunit": "^1.2.1",
|
"karma-qunit": "^1.2.1",
|
||||||
"lodash.assign": "^4.0.6",
|
"lodash.assign": "^4.0.6",
|
||||||
"mocha": "^3.4.2",
|
"mocha": "^4.0.0",
|
||||||
"mocha-eslint": "^4.0.0",
|
"mocha-eslint": "^4.0.0",
|
||||||
"mocha-jsdom": "^1.1.0",
|
"mocha-jsdom": "^1.1.0",
|
||||||
"mocha-sinon": "^2.0.0",
|
"mocha-sinon": "^2.0.0",
|
||||||
|
@ -57,7 +57,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
const block = Proxy.revocable({}, {}).revoke()
|
const block = Proxy.revocable({}, {}).revoke()
|
||||||
pendingTxTracker.checkForTxInBlock(block)
|
pendingTxTracker.checkForTxInBlock(block)
|
||||||
})
|
})
|
||||||
it('should emit \'txFailed\' if the txMeta does not have a hash', function (done) {
|
it('should emit \'tx:failed\' if the txMeta does not have a hash', function (done) {
|
||||||
const block = Proxy.revocable({}, {}).revoke()
|
const block = Proxy.revocable({}, {}).revoke()
|
||||||
pendingTxTracker.getPendingTransactions = () => [txMetaNoHash]
|
pendingTxTracker.getPendingTransactions = () => [txMetaNoHash]
|
||||||
pendingTxTracker.once('tx:failed', (txId, err) => {
|
pendingTxTracker.once('tx:failed', (txId, err) => {
|
||||||
@ -105,7 +105,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('#_checkPendingTx', function () {
|
describe('#_checkPendingTx', function () {
|
||||||
it('should emit \'txFailed\' if the txMeta does not have a hash', function (done) {
|
it('should emit \'tx:failed\' if the txMeta does not have a hash', function (done) {
|
||||||
pendingTxTracker.once('tx:failed', (txId, err) => {
|
pendingTxTracker.once('tx:failed', (txId, err) => {
|
||||||
assert(txId, txMetaNoHash.id, 'should pass txId')
|
assert(txId, txMetaNoHash.id, 'should pass txId')
|
||||||
done()
|
done()
|
||||||
@ -172,7 +172,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
.catch(done)
|
.catch(done)
|
||||||
pendingTxTracker.resubmitPendingTxs()
|
pendingTxTracker.resubmitPendingTxs()
|
||||||
})
|
})
|
||||||
it('should not emit \'txFailed\' if the txMeta throws a known txError', function (done) {
|
it('should not emit \'tx:failed\' if the txMeta throws a known txError', function (done) {
|
||||||
knownErrors =[
|
knownErrors =[
|
||||||
// geth
|
// geth
|
||||||
' Replacement transaction Underpriced ',
|
' Replacement transaction Underpriced ',
|
||||||
@ -199,8 +199,15 @@ describe('PendingTransactionTracker', function () {
|
|||||||
|
|
||||||
pendingTxTracker.resubmitPendingTxs()
|
pendingTxTracker.resubmitPendingTxs()
|
||||||
})
|
})
|
||||||
it('should emit \'txFailed\' if it encountered a real error', function (done) {
|
it('should emit \'tx:warning\' if it encountered a real error', function (done) {
|
||||||
pendingTxTracker.once('tx:failed', (id, err) => err.message === 'im some real error' ? txList[id - 1].resolve() : done(err))
|
pendingTxTracker.once('tx:warning', (txMeta, err) => {
|
||||||
|
if (err.message === 'im some real error') {
|
||||||
|
const matchingTx = txList.find(tx => tx.id === txMeta.id)
|
||||||
|
matchingTx.resolve()
|
||||||
|
} else {
|
||||||
|
done(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
pendingTxTracker.getPendingTransactions = () => txList
|
pendingTxTracker.getPendingTransactions = () => txList
|
||||||
pendingTxTracker._resubmitTx = async (tx) => { throw new TypeError('im some real error') }
|
pendingTxTracker._resubmitTx = async (tx) => { throw new TypeError('im some real error') }
|
||||||
|
@ -46,7 +46,7 @@ AccountDetailScreen.prototype.render = function () {
|
|||||||
var selected = props.address || Object.keys(props.accounts)[0]
|
var selected = props.address || Object.keys(props.accounts)[0]
|
||||||
var checksumAddress = selected && ethUtil.toChecksumAddress(selected)
|
var checksumAddress = selected && ethUtil.toChecksumAddress(selected)
|
||||||
var identity = props.identities[selected]
|
var identity = props.identities[selected]
|
||||||
var account = props.computedBalances[selected]
|
var account = props.accounts[selected]
|
||||||
const { network, conversionRate, currentCurrency } = props
|
const { network, conversionRate, currentCurrency } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -181,7 +181,7 @@ AccountDetailScreen.prototype.render = function () {
|
|||||||
}, [
|
}, [
|
||||||
|
|
||||||
h(EthBalance, {
|
h(EthBalance, {
|
||||||
value: account && account.ethBalance,
|
value: account && account.balance,
|
||||||
conversionRate,
|
conversionRate,
|
||||||
currentCurrency,
|
currentCurrency,
|
||||||
style: {
|
style: {
|
||||||
|
@ -167,14 +167,6 @@ App.prototype.renderAppBar = function () {
|
|||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
// metamask name
|
|
||||||
props.isUnlocked && h('h1', {
|
|
||||||
style: {
|
|
||||||
position: 'relative',
|
|
||||||
left: '9px',
|
|
||||||
},
|
|
||||||
}, 'MetaMask'),
|
|
||||||
|
|
||||||
props.isUnlocked && h('div', {
|
props.isUnlocked && h('div', {
|
||||||
style: {
|
style: {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
@ -33,7 +33,7 @@ function PendingTx () {
|
|||||||
|
|
||||||
PendingTx.prototype.render = function () {
|
PendingTx.prototype.render = function () {
|
||||||
const props = this.props
|
const props = this.props
|
||||||
const { currentCurrency, blockGasLimit, computedBalances } = props
|
const { currentCurrency, blockGasLimit } = props
|
||||||
|
|
||||||
const conversionRate = props.conversionRate
|
const conversionRate = props.conversionRate
|
||||||
const txMeta = this.gatherTxMeta()
|
const txMeta = this.gatherTxMeta()
|
||||||
@ -42,8 +42,8 @@ PendingTx.prototype.render = function () {
|
|||||||
// Account Details
|
// Account Details
|
||||||
const address = txParams.from || props.selectedAddress
|
const address = txParams.from || props.selectedAddress
|
||||||
const identity = props.identities[address] || { address: address }
|
const identity = props.identities[address] || { address: address }
|
||||||
const account = computedBalances[address]
|
const account = props.accounts[address]
|
||||||
const balance = account ? account.ethBalance : '0x0'
|
const balance = account ? account.balance : '0x0'
|
||||||
|
|
||||||
// recipient check
|
// recipient check
|
||||||
const isValidAddress = !txParams.to || util.isValidAddress(txParams.to)
|
const isValidAddress = !txParams.to || util.isValidAddress(txParams.to)
|
||||||
|
@ -133,7 +133,7 @@ function recipientField (txParams, transaction, isTx, isMsg) {
|
|||||||
},
|
},
|
||||||
}, [
|
}, [
|
||||||
message,
|
message,
|
||||||
failIfFailed(transaction),
|
renderErrorOrWarning(transaction),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,25 +141,35 @@ function formatDate (date) {
|
|||||||
return vreme.format(new Date(date), 'March 16 2014 14:30')
|
return vreme.format(new Date(date), 'March 16 2014 14:30')
|
||||||
}
|
}
|
||||||
|
|
||||||
function failIfFailed (transaction) {
|
function renderErrorOrWarning (transaction) {
|
||||||
if (transaction.status === 'rejected') {
|
const { status, err, warning } = transaction
|
||||||
|
|
||||||
|
// show rejected
|
||||||
|
if (status === 'rejected') {
|
||||||
return h('span.error', ' (Rejected)')
|
return h('span.error', ' (Rejected)')
|
||||||
}
|
}
|
||||||
if (transaction.err || transaction.warning) {
|
|
||||||
const { err, warning = {} } = transaction
|
|
||||||
const errFirst = !!(( err && warning ) || err)
|
|
||||||
const message = errFirst ? err.message : warning.message
|
|
||||||
|
|
||||||
errFirst ? err.message : warning.message
|
|
||||||
|
|
||||||
|
// show error
|
||||||
|
if (err) {
|
||||||
|
const message = err.message || ''
|
||||||
|
return (
|
||||||
|
h(Tooltip, {
|
||||||
|
title: message,
|
||||||
|
position: 'bottom',
|
||||||
|
}, [
|
||||||
|
h(`span.error`, ` (Failed)`),
|
||||||
|
])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// show warning
|
||||||
|
if (warning) {
|
||||||
|
const message = warning.message
|
||||||
return h(Tooltip, {
|
return h(Tooltip, {
|
||||||
title: message,
|
title: message,
|
||||||
position: 'bottom',
|
position: 'bottom',
|
||||||
}, [
|
}, [
|
||||||
h(`span.${errFirst ? 'error' : 'warning'}`,
|
h(`span.warning`, ` (Warning)`),
|
||||||
` (${errFirst ? 'Failed' : 'Warning'})`
|
|
||||||
),
|
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,13 +126,6 @@ InfoScreen.prototype.render = function () {
|
|||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
h('div.fa.fa-slack', [
|
|
||||||
h('a.info', {
|
|
||||||
href: 'http://slack.metamask.io',
|
|
||||||
target: '_blank',
|
|
||||||
}, 'Join the conversation on Slack'),
|
|
||||||
]),
|
|
||||||
|
|
||||||
h('div', [
|
h('div', [
|
||||||
h('.fa.fa-twitter', [
|
h('.fa.fa-twitter', [
|
||||||
h('a.info', {
|
h('a.info', {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user