aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Serrano <kevin.serrano@consensys.net>2017-09-12 04:58:46 +0800
committerKevin Serrano <kevin.serrano@consensys.net>2017-09-12 04:58:46 +0800
commit2e18dd27a4c92ff876ad29e73fc4cba13c9a630f (patch)
treeeb87a89414f601713d08cbf3935ca60cdbcc5f56
parent55b07b2b4a3c501b77f619685a458b5f42b68f24 (diff)
parent96107556dcc57f04aeebfc7d775d5a60a88cb450 (diff)
downloadtangerine-wallet-browser-2e18dd27a4c92ff876ad29e73fc4cba13c9a630f.tar
tangerine-wallet-browser-2e18dd27a4c92ff876ad29e73fc4cba13c9a630f.tar.gz
tangerine-wallet-browser-2e18dd27a4c92ff876ad29e73fc4cba13c9a630f.tar.bz2
tangerine-wallet-browser-2e18dd27a4c92ff876ad29e73fc4cba13c9a630f.tar.lz
tangerine-wallet-browser-2e18dd27a4c92ff876ad29e73fc4cba13c9a630f.tar.xz
tangerine-wallet-browser-2e18dd27a4c92ff876ad29e73fc4cba13c9a630f.tar.zst
tangerine-wallet-browser-2e18dd27a4c92ff876ad29e73fc4cba13c9a630f.zip
Merge github.com:MetaMask/metamask-extension into rejectallunapproved
-rw-r--r--CHANGELOG.md7
-rw-r--r--app/manifest.json7
-rw-r--r--app/scripts/lib/inpage-provider.js52
-rw-r--r--circle.yml4
-rw-r--r--test/unit/nonce-tracker-test.js19
-rw-r--r--ui/app/add-token.js31
-rw-r--r--ui/app/components/network.js11
-rw-r--r--ui/app/unlock.js2
8 files changed, 90 insertions, 43 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0a2edb478..50de1a465 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/app/manifest.json b/app/manifest.json
index 256737c89..f597bec7f 100644
--- a/app/manifest.json
+++ b/app/manifest.json
@@ -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"
],
diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js
index c63af06dc..13888dc67 100644
--- a/app/scripts/lib/inpage-provider.js
+++ b/app/scripts/lib/inpage-provider.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
}
diff --git a/circle.yml b/circle.yml
index 2ea60bb9d..e81e1bcaa 100644
--- a/circle.yml
+++ b/circle.yml
@@ -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" \ No newline at end of file
diff --git a/test/unit/nonce-tracker-test.js b/test/unit/nonce-tracker-test.js
index 3312a3bd0..8970cf84d 100644
--- a/test/unit/nonce-tracker-test.js
+++ b/test/unit/nonce-tracker-test.js
@@ -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()
+ })
+ })
})
})
diff --git a/ui/app/add-token.js b/ui/app/add-token.js
index 15ef7a852..18adc7eb5 100644
--- a/ui/app/add-token.js
+++ b/ui/app/add-token.js
@@ -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() })
}
}
-
diff --git a/ui/app/components/network.js b/ui/app/components/network.js
index 698a0bbb9..0dbe37cdd 100644
--- a/ui/app/components/network.js
+++ b/ui/app/components/network.js
@@ -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'),
])
}
})(),
diff --git a/ui/app/unlock.js b/ui/app/unlock.js
index 9bacd5124..4180791c4 100644
--- a/ui/app/unlock.js
+++ b/ui/app/unlock.js
@@ -80,7 +80,7 @@ UnlockScreen.prototype.render = function () {
color: 'rgb(247, 134, 28)',
textDecoration: 'underline',
},
- }, 'I forgot my password.'),
+ }, 'Restore from seed phrase'),
]),
])
)