mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge github.com:MetaMask/metamask-extension into rejectallunapproved
This commit is contained in:
commit
2e18dd27a4
@ -3,6 +3,13 @@
|
||||
## Current Master
|
||||
- Readded loose keyring label back into the account list.
|
||||
- Added button to reject all transactions (thanks [davidp94](https://github.com/davidp94)!)
|
||||
- Remove cryptonator from chrome permissions.
|
||||
- Add info on token contract addresses.
|
||||
- Add validation preventing users from inputting their own addresses as token tracking addresses.
|
||||
|
||||
## 3.9.13 2017-9-8
|
||||
|
||||
- Changed the way we initialize the inpage provider to fix a bug affecting some developers.
|
||||
|
||||
## 3.9.12 2017-9-6
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "MetaMask",
|
||||
"short_name": "Metamask",
|
||||
"version": "3.9.12",
|
||||
"version": "3.9.13",
|
||||
"manifest_version": 2,
|
||||
"author": "https://metamask.io",
|
||||
"description": "Ethereum Browser Extension",
|
||||
@ -57,9 +57,8 @@
|
||||
"permissions": [
|
||||
"storage",
|
||||
"clipboardWrite",
|
||||
"http://localhost:8545/",
|
||||
"https://api.cryptonator.com/"
|
||||
],
|
||||
"http://localhost:8545/"
|
||||
],
|
||||
"web_accessible_resources": [
|
||||
"scripts/inpage.js"
|
||||
],
|
||||
|
@ -40,31 +40,37 @@ function MetamaskInpageProvider (connectionStream) {
|
||||
// start and stop polling to unblock first block lock
|
||||
|
||||
self.idMap = {}
|
||||
// handle sendAsync requests via asyncProvider
|
||||
self.sendAsync = function (payload, cb) {
|
||||
// rewrite request ids
|
||||
var request = eachJsonMessage(payload, (_message) => {
|
||||
const message = Object.assign({}, _message)
|
||||
const newId = createRandomId()
|
||||
self.idMap[newId] = message.id
|
||||
message.id = newId
|
||||
}
|
||||
|
||||
// handle sendAsync requests via asyncProvider
|
||||
// also remap ids inbound and outbound
|
||||
MetamaskInpageProvider.prototype.sendAsync = function (payload, cb) {
|
||||
const self = this
|
||||
|
||||
// rewrite request ids
|
||||
const request = eachJsonMessage(payload, (_message) => {
|
||||
const message = Object.assign({}, _message)
|
||||
const newId = createRandomId()
|
||||
self.idMap[newId] = message.id
|
||||
message.id = newId
|
||||
return message
|
||||
})
|
||||
|
||||
// forward to asyncProvider
|
||||
self.asyncProvider.sendAsync(request, (err, _res) => {
|
||||
if (err) return cb(err)
|
||||
// transform messages to original ids
|
||||
const res = eachJsonMessage(_res, (message) => {
|
||||
const oldId = self.idMap[message.id]
|
||||
delete self.idMap[message.id]
|
||||
message.id = oldId
|
||||
return message
|
||||
})
|
||||
// forward to asyncProvider
|
||||
asyncProvider.sendAsync(request, function (err, res) {
|
||||
if (err) return cb(err)
|
||||
// transform messages to original ids
|
||||
eachJsonMessage(res, (message) => {
|
||||
var oldId = self.idMap[message.id]
|
||||
delete self.idMap[message.id]
|
||||
message.id = oldId
|
||||
return message
|
||||
})
|
||||
cb(null, res)
|
||||
})
|
||||
}
|
||||
cb(null, res)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
MetamaskInpageProvider.prototype.send = function (payload) {
|
||||
const self = this
|
||||
|
||||
@ -110,10 +116,6 @@ MetamaskInpageProvider.prototype.send = function (payload) {
|
||||
}
|
||||
}
|
||||
|
||||
MetamaskInpageProvider.prototype.sendAsync = function () {
|
||||
throw new Error('MetamaskInpageProvider - sendAsync not overwritten')
|
||||
}
|
||||
|
||||
MetamaskInpageProvider.prototype.isConnected = function () {
|
||||
return true
|
||||
}
|
||||
|
@ -1,10 +1,6 @@
|
||||
machine:
|
||||
node:
|
||||
version: 8.1.4
|
||||
dependencies:
|
||||
pre:
|
||||
- "npm i -g testem"
|
||||
- "npm i -g mocha"
|
||||
test:
|
||||
override:
|
||||
- "npm run ci"
|
@ -162,6 +162,25 @@ describe('Nonce Tracker', function () {
|
||||
await nonceLock.releaseLock()
|
||||
})
|
||||
})
|
||||
|
||||
describe('Faq issue 67', function () {
|
||||
beforeEach(function () {
|
||||
const txGen = new MockTxGen()
|
||||
const confirmedTxs = txGen.generate({ status: 'confirmed' }, { count: 64 })
|
||||
const pendingTxs = txGen.generate({
|
||||
status: 'submitted',
|
||||
}, { count: 10 })
|
||||
// 0x40 is 64 in hex:
|
||||
nonceTracker = generateNonceTrackerWith(pendingTxs, [], '0x40')
|
||||
})
|
||||
|
||||
it('should return nonce after network nonce', async function () {
|
||||
this.timeout(15000)
|
||||
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
|
||||
assert.equal(nonceLock.nextNonce, '74', `nonce should be 74 got ${nonceLock.nextNonce}`)
|
||||
await nonceLock.releaseLock()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -3,6 +3,8 @@ const Component = require('react').Component
|
||||
const h = require('react-hyperscript')
|
||||
const connect = require('react-redux').connect
|
||||
const actions = require('./actions')
|
||||
const Tooltip = require('./components/tooltip.js')
|
||||
|
||||
|
||||
const ethUtil = require('ethereumjs-util')
|
||||
const abi = require('human-standard-token-abi')
|
||||
@ -15,6 +17,7 @@ module.exports = connect(mapStateToProps)(AddTokenScreen)
|
||||
|
||||
function mapStateToProps (state) {
|
||||
return {
|
||||
identities: state.metamask.identities,
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,15 +67,25 @@ AddTokenScreen.prototype.render = function () {
|
||||
}, [
|
||||
|
||||
h('div', [
|
||||
h('span', {
|
||||
style: { fontWeight: 'bold', paddingRight: '10px'},
|
||||
}, 'Token Address'),
|
||||
h(Tooltip, {
|
||||
position: 'top',
|
||||
title: 'The contract of the actual token contract. Click for more info.',
|
||||
}, [
|
||||
h('a', {
|
||||
style: { fontWeight: 'bold', paddingRight: '10px'},
|
||||
href: 'https://consensyssupport.happyfox.com/staff/kb/article/24-what-is-a-token-contract-address',
|
||||
target: '_blank',
|
||||
}, [
|
||||
h('span', 'Token Contract Address '),
|
||||
h('i.fa.fa-question-circle'),
|
||||
]),
|
||||
]),
|
||||
]),
|
||||
|
||||
h('section.flex-row.flex-center', [
|
||||
h('input#token-address', {
|
||||
name: 'address',
|
||||
placeholder: 'Token Address',
|
||||
placeholder: 'Token Contract Address',
|
||||
onChange: this.tokenAddressDidChange.bind(this),
|
||||
style: {
|
||||
width: 'inherit',
|
||||
@ -171,7 +184,9 @@ AddTokenScreen.prototype.tokenAddressDidChange = function (event) {
|
||||
AddTokenScreen.prototype.validateInputs = function () {
|
||||
let msg = ''
|
||||
const state = this.state
|
||||
const identitiesList = Object.keys(this.props.identities)
|
||||
const { address, symbol, decimals } = state
|
||||
const standardAddress = ethUtil.addHexPrefix(address).toLowerCase()
|
||||
|
||||
const validAddress = ethUtil.isValidAddress(address)
|
||||
if (!validAddress) {
|
||||
@ -189,7 +204,12 @@ AddTokenScreen.prototype.validateInputs = function () {
|
||||
msg += 'Symbol must be between 0 and 10 characters.'
|
||||
}
|
||||
|
||||
const isValid = validAddress && validDecimals
|
||||
const ownAddress = identitiesList.includes(standardAddress)
|
||||
if (ownAddress) {
|
||||
msg = 'Personal address detected. Input the token contract address.'
|
||||
}
|
||||
|
||||
const isValid = validAddress && validDecimals && !ownAddress
|
||||
|
||||
if (!isValid) {
|
||||
this.setState({
|
||||
@ -216,4 +236,3 @@ AddTokenScreen.prototype.attemptToAutoFillTokenParams = async function (address)
|
||||
this.setState({ symbol: symbol[0], decimals: decimals[0].toString() })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ Network.prototype.render = function () {
|
||||
let iconName, hoverText
|
||||
|
||||
if (networkNumber === 'loading') {
|
||||
return h('span', {
|
||||
return h('span.pointer', {
|
||||
style: {
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
@ -37,7 +37,7 @@ Network.prototype.render = function () {
|
||||
},
|
||||
src: 'images/loading.svg',
|
||||
}),
|
||||
h('i.fa.fa-sort-desc'),
|
||||
h('i.fa.fa-caret-down'),
|
||||
])
|
||||
} else if (providerName === 'mainnet') {
|
||||
hoverText = 'Main Ethereum Network'
|
||||
@ -73,7 +73,8 @@ Network.prototype.render = function () {
|
||||
style: {
|
||||
color: '#039396',
|
||||
}},
|
||||
'Ethereum Main Net'),
|
||||
'Main Network'),
|
||||
h('i.fa.fa-caret-down.fa-lg'),
|
||||
])
|
||||
case 'ropsten-test-network':
|
||||
return h('.network-indicator', [
|
||||
@ -83,6 +84,7 @@ Network.prototype.render = function () {
|
||||
color: '#ff6666',
|
||||
}},
|
||||
'Ropsten Test Net'),
|
||||
h('i.fa.fa-caret-down.fa-lg'),
|
||||
])
|
||||
case 'kovan-test-network':
|
||||
return h('.network-indicator', [
|
||||
@ -92,6 +94,7 @@ Network.prototype.render = function () {
|
||||
color: '#690496',
|
||||
}},
|
||||
'Kovan Test Net'),
|
||||
h('i.fa.fa-caret-down.fa-lg'),
|
||||
])
|
||||
case 'rinkeby-test-network':
|
||||
return h('.network-indicator', [
|
||||
@ -101,6 +104,7 @@ Network.prototype.render = function () {
|
||||
color: '#e7a218',
|
||||
}},
|
||||
'Rinkeby Test Net'),
|
||||
h('i.fa.fa-caret-down.fa-lg'),
|
||||
])
|
||||
default:
|
||||
return h('.network-indicator', [
|
||||
@ -116,6 +120,7 @@ Network.prototype.render = function () {
|
||||
color: '#AEAEAE',
|
||||
}},
|
||||
'Private Network'),
|
||||
h('i.fa.fa-caret-down.fa-lg'),
|
||||
])
|
||||
}
|
||||
})(),
|
||||
|
@ -80,7 +80,7 @@ UnlockScreen.prototype.render = function () {
|
||||
color: 'rgb(247, 134, 28)',
|
||||
textDecoration: 'underline',
|
||||
},
|
||||
}, 'I forgot my password.'),
|
||||
}, 'Restore from seed phrase'),
|
||||
]),
|
||||
])
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user