aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md7
-rw-r--r--app/manifest.json4
-rw-r--r--app/scripts/controllers/currency.js2
-rw-r--r--app/scripts/lib/eth-store.js2
-rw-r--r--app/scripts/lib/tx-utils.js9
-rw-r--r--mascara/src/background.js5
-rw-r--r--mascara/src/mascara.js5
-rw-r--r--mascara/src/ui.js8
-rw-r--r--package.json4
-rw-r--r--test/unit/currency-controller-test.js4
-rw-r--r--ui/app/app.js2
-rw-r--r--ui/app/components/pending-tx.js11
-rw-r--r--ui/app/conf-tx.js4
-rw-r--r--ui/app/info.js19
14 files changed, 46 insertions, 40 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cbab1c71a..9a0d0a579 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,13 @@
## Current Master
+- Fix currency API URL from cryptonator.
+- Update gasLimit params with every new block seen.
+
+## 3.7.7 2017-6-8
+
+- Fix bug where metamask would show old data after computer being asleep or disconnected from the internet.
+
## 3.7.6 2017-6-5
- Fix bug that prevented publishing contracts.
diff --git a/app/manifest.json b/app/manifest.json
index 2d321e862..a610d9e75 100644
--- a/app/manifest.json
+++ b/app/manifest.json
@@ -1,7 +1,7 @@
{
"name": "MetaMask",
"short_name": "Metamask",
- "version": "3.7.6",
+ "version": "3.7.7",
"manifest_version": 2,
"author": "https://metamask.io",
"description": "Ethereum Browser Extension",
@@ -58,7 +58,7 @@
"storage",
"clipboardWrite",
"http://localhost:8545/",
- "https://www.cryptonator.com/"
+ "https://api.cryptonator.com/"
],
"web_accessible_resources": [
"scripts/inpage.js"
diff --git a/app/scripts/controllers/currency.js b/app/scripts/controllers/currency.js
index fb130ed76..1f20dc005 100644
--- a/app/scripts/controllers/currency.js
+++ b/app/scripts/controllers/currency.js
@@ -45,7 +45,7 @@ class CurrencyController {
updateConversionRate () {
const currentCurrency = this.getCurrentCurrency()
- return fetch(`https://www.cryptonator.com/api/ticker/eth-${currentCurrency}`)
+ return fetch(`https://api.cryptonator.com/api/ticker/eth-${currentCurrency}`)
.then(response => response.json())
.then((parsedResponse) => {
this.setConversionRate(Number(parsedResponse.ticker.price))
diff --git a/app/scripts/lib/eth-store.js b/app/scripts/lib/eth-store.js
index 6f04a9dd6..ebba98f5c 100644
--- a/app/scripts/lib/eth-store.js
+++ b/app/scripts/lib/eth-store.js
@@ -21,6 +21,7 @@ class EthereumStore extends ObservableStore {
transactions: {},
currentBlockNumber: '0',
currentBlockHash: '',
+ currentBlockGasLimit: '',
})
this._provider = opts.provider
this._query = new EthQuery(this._provider)
@@ -73,6 +74,7 @@ class EthereumStore extends ObservableStore {
this._currentBlockNumber = blockNumber
this.updateState({ currentBlockNumber: parseInt(blockNumber) })
this.updateState({ currentBlockHash: `0x${block.hash.toString('hex')}`})
+ this.updateState({ currentBlockGasLimit: `0x${block.gasLimit.toString('hex')}` })
async.parallel([
this._updateAccounts.bind(this),
this._updateTransactions.bind(this, blockNumber),
diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js
index 658f3bedc..149d93102 100644
--- a/app/scripts/lib/tx-utils.js
+++ b/app/scripts/lib/tx-utils.js
@@ -21,21 +21,12 @@ module.exports = class txProviderUtils {
this.query.getBlockByNumber('latest', true, (err, block) => {
if (err) return cb(err)
async.waterfall([
- self.setBlockGasLimit.bind(self, txMeta, block.gasLimit),
self.estimateTxGas.bind(self, txMeta, block.gasLimit),
self.setTxGas.bind(self, txMeta, block.gasLimit),
], cb)
})
}
- setBlockGasLimit (txMeta, blockGasLimitHex, cb) {
- const blockGasLimitBN = hexToBn(blockGasLimitHex)
- const saferGasLimitBN = BnMultiplyByFraction(blockGasLimitBN, 19, 20)
- txMeta.blockGasLimit = bnToHex(saferGasLimitBN)
- cb()
- return
- }
-
estimateTxGas (txMeta, blockGasLimitHex, cb) {
const txParams = txMeta.txParams
// check if gasLimit is already specified
diff --git a/mascara/src/background.js b/mascara/src/background.js
index dff5e6a7c..d9dbf593a 100644
--- a/mascara/src/background.js
+++ b/mascara/src/background.js
@@ -33,11 +33,6 @@ self.addEventListener('install', function(event) {
})
self.addEventListener('activate', function(event) {
event.waitUntil(self.clients.claim())
- self.clients.matchAll()
- .then((clients) => {
- if (connectedClientCount < clients.length) sendMessageToAllClients('reconnect')
- })
-
})
console.log('inside:open')
diff --git a/mascara/src/mascara.js b/mascara/src/mascara.js
index 0fc2868e1..1655d1f64 100644
--- a/mascara/src/mascara.js
+++ b/mascara/src/mascara.js
@@ -1,6 +1,6 @@
const Web3 = require('web3')
const setupProvider = require('./lib/setup-provider.js')
-
+const setupDappAutoReload = require('../../app/scripts/lib/auto-reload.js')
const MASCARA_ORIGIN = process.env.MASCARA_ORIGIN || 'http://localhost:9001'
console.log('MASCARA_ORIGIN:', MASCARA_ORIGIN)
@@ -14,8 +14,7 @@ const provider = setupProvider({
instrumentForUserInteractionTriggers(provider)
const web3 = new Web3(provider)
-global.web3 = web3
-
+setupDappAutoReload(web3, provider.publicConfigStore)
//
// ui stuff
//
diff --git a/mascara/src/ui.js b/mascara/src/ui.js
index e798847a7..5f9be542f 100644
--- a/mascara/src/ui.js
+++ b/mascara/src/ui.js
@@ -40,7 +40,6 @@ const connectApp = function (readSw) {
})
})
}
-
background.on('ready', (sw) => {
background.removeListener('updatefound', connectApp)
connectApp(sw)
@@ -48,5 +47,10 @@ background.on('ready', (sw) => {
background.on('updatefound', () => window.location.reload())
background.startWorker()
-// background.startWorker()
+.then(() => {
+ setTimeout(() => {
+ const appContent = document.getElementById(`app-content`)
+ if (!appContent.children.length) window.location.reload()
+ }, 2000)
+})
console.log('hello from MetaMascara ui!')
diff --git a/package.json b/package.json
index 9efba3866..341af49a7 100644
--- a/package.json
+++ b/package.json
@@ -50,7 +50,7 @@
"bluebird": "^3.5.0",
"browser-passworder": "^2.0.3",
"browserify-derequire": "^0.9.4",
- "client-sw-ready-event": "^3.0.3",
+ "client-sw-ready-event": "^3.3.0",
"clone": "^1.0.2",
"copy-to-clipboard": "^2.0.0",
"debounce": "^1.0.0",
@@ -123,7 +123,7 @@
"valid-url": "^1.0.9",
"vreme": "^3.0.2",
"web3": "0.18.2",
- "web3-provider-engine": "^12.1.0",
+ "web3-provider-engine": "^12.2.3",
"web3-stream-provider": "^2.0.6",
"xtend": "^4.0.1"
},
diff --git a/test/unit/currency-controller-test.js b/test/unit/currency-controller-test.js
index cfbce7fb3..5eeaf9bcc 100644
--- a/test/unit/currency-controller-test.js
+++ b/test/unit/currency-controller-test.js
@@ -36,7 +36,7 @@ describe('currency-controller', function () {
describe('#updateConversionRate', function () {
it('should retrieve an update for ETH to USD and set it in memory', function (done) {
this.timeout(15000)
- nock('https://www.cryptonator.com')
+ nock('https://api.cryptonator.com')
.get('/api/ticker/eth-USD')
.reply(200, '{"ticker":{"base":"ETH","target":"USD","price":"11.02456145","volume":"44948.91745289","change":"-0.01472534"},"timestamp":1472072136,"success":true,"error":""}')
@@ -57,7 +57,7 @@ describe('currency-controller', function () {
this.timeout(15000)
assert.equal(currencyController.getConversionRate(), 0)
- nock('https://www.cryptonator.com')
+ nock('https://api.cryptonator.com')
.get('/api/ticker/eth-JPY')
.reply(200, '{"ticker":{"base":"ETH","target":"JPY","price":"11.02456145","volume":"44948.91745289","change":"-0.01472534"},"timestamp":1472072136,"success":true,"error":""}')
diff --git a/ui/app/app.js b/ui/app/app.js
index 6e5aa57cd..53dbc3354 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -341,7 +341,7 @@ App.prototype.renderDropdown = function () {
}),
h(DropMenuItem, {
- label: 'Info',
+ label: 'Info/Help',
closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }),
action: () => this.props.dispatch(actions.showInfoPage()),
icon: h('i.fa.fa-question.fa-lg'),
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js
index e3b307b0b..4b1a00eca 100644
--- a/ui/app/components/pending-tx.js
+++ b/ui/app/components/pending-tx.js
@@ -32,7 +32,7 @@ function PendingTx () {
PendingTx.prototype.render = function () {
const props = this.props
- const { currentCurrency } = props
+ const { currentCurrency, blockGasLimit } = props
const conversionRate = props.conversionRate
const txMeta = this.gatherTxMeta()
@@ -50,7 +50,8 @@ PendingTx.prototype.render = function () {
// Gas
const gas = txParams.gas
const gasBn = hexToBn(gas)
- const safeGasLimit = parseInt(txMeta.blockGasLimit)
+ const gasLimit = new BN(parseInt(blockGasLimit))
+ const safeGasLimit = this.bnMultiplyByFraction(gasLimit, 19, 20).toString(10)
// Gas Price
const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16)
@@ -458,6 +459,12 @@ PendingTx.prototype._notZeroOrEmptyString = function (obj) {
return obj !== '' && obj !== '0x0'
}
+PendingTx.prototype.bnMultiplyByFraction = function (targetBN, numerator, denominator) {
+ const numBN = new BN(numerator)
+ const denomBN = new BN(denominator)
+ return targetBN.mul(numBN).div(denomBN)
+}
+
function forwardCarrat () {
return (
h('img', {
diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js
index 4ae81f35f..747d3ce2b 100644
--- a/ui/app/conf-tx.js
+++ b/ui/app/conf-tx.js
@@ -29,6 +29,7 @@ function mapStateToProps (state) {
provider: state.metamask.provider,
conversionRate: state.metamask.conversionRate,
currentCurrency: state.metamask.currentCurrency,
+ blockGasLimit: state.metamask.currentBlockGasLimit,
}
}
@@ -40,7 +41,7 @@ function ConfirmTxScreen () {
ConfirmTxScreen.prototype.render = function () {
const props = this.props
const { network, provider, unapprovedTxs, currentCurrency,
- unapprovedMsgs, unapprovedPersonalMsgs, conversionRate } = props
+ unapprovedMsgs, unapprovedPersonalMsgs, conversionRate, blockGasLimit } = props
var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network)
@@ -107,6 +108,7 @@ ConfirmTxScreen.prototype.render = function () {
identities: props.identities,
conversionRate,
currentCurrency,
+ blockGasLimit,
// Actions
buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress),
sendTransaction: this.sendTransaction.bind(this),
diff --git a/ui/app/info.js b/ui/app/info.js
index a6fdeb315..aa4503b62 100644
--- a/ui/app/info.js
+++ b/ui/app/info.js
@@ -52,7 +52,7 @@ InfoScreen.prototype.render = function () {
h('div', {
style: {
- marginBottom: '10px',
+ marginBottom: '5px',
}},
[
h('div', [
@@ -87,7 +87,7 @@ InfoScreen.prototype.render = function () {
h('hr', {
style: {
- margin: '20px 0 ',
+ margin: '10px 0 ',
width: '7em',
},
}),
@@ -97,6 +97,13 @@ InfoScreen.prototype.render = function () {
paddingLeft: '30px',
}},
[
+ h('div.fa.fa-github', [
+ h('a.info', {
+ href: 'https://github.com/MetaMask/faq',
+ target: '_blank',
+ onClick (event) { this.navigateTo(event.target.href) },
+ }, 'Need Help? Read our FAQ!'),
+ ]),
h('div', [
h('a', {
href: 'https://metamask.io/',
@@ -138,14 +145,6 @@ InfoScreen.prototype.render = function () {
onClick () { this.navigateTo('mailto:help@metamask.io?subject=Feedback') },
}, 'Email us!'),
]),
-
- h('div.fa.fa-github', [
- h('a.info', {
- href: 'https://github.com/MetaMask/metamask-plugin/issues',
- target: '_blank',
- onClick (event) { this.navigateTo(event.target.href) },
- }, 'Start a thread on GitHub'),
- ]),
]),
]),
]),