mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge branch 'master' into infura-rest-api
This commit is contained in:
commit
cf60b23eec
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## Current Master
|
## Current Master
|
||||||
|
|
||||||
|
## 3.13.4 2018-1-9
|
||||||
|
|
||||||
- Remove recipient field if application initializes a tx with an empty string, or 0x, and tx data. Throw an error with the same condition, but without tx data.
|
- Remove recipient field if application initializes a tx with an empty string, or 0x, and tx data. Throw an error with the same condition, but without tx data.
|
||||||
- Improve gas price suggestion to be closer to the lowest that will be accepted.
|
- Improve gas price suggestion to be closer to the lowest that will be accepted.
|
||||||
- Throw an error if a application tries to submit a tx whose value is a decimal, and inform that it should be in wei.
|
- Throw an error if a application tries to submit a tx whose value is a decimal, and inform that it should be in wei.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "MetaMask",
|
"name": "MetaMask",
|
||||||
"short_name": "Metamask",
|
"short_name": "Metamask",
|
||||||
"version": "3.13.3",
|
"version": "3.13.4",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"author": "https://metamask.io",
|
"author": "https://metamask.io",
|
||||||
"description": "Ethereum Browser Extension",
|
"description": "Ethereum Browser Extension",
|
||||||
|
@ -490,9 +490,15 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
getGasPrice () {
|
getGasPrice () {
|
||||||
const { recentBlocksController } = this
|
const { recentBlocksController } = this
|
||||||
const { recentBlocks } = recentBlocksController.store.getState()
|
const { recentBlocks } = recentBlocksController.store.getState()
|
||||||
|
|
||||||
|
// Return 1 gwei if no blocks have been observed:
|
||||||
|
if (recentBlocks.length === 0) {
|
||||||
|
return '0x' + GWEI_BN.toString(16)
|
||||||
|
}
|
||||||
|
|
||||||
const lowestPrices = recentBlocks.map((block) => {
|
const lowestPrices = recentBlocks.map((block) => {
|
||||||
if (!block.gasPrices) {
|
if (!block.gasPrices || block.gasPrices.length < 1) {
|
||||||
return new BN(0)
|
return GWEI_BN
|
||||||
}
|
}
|
||||||
return block.gasPrices
|
return block.gasPrices
|
||||||
.map(hexPrefix => hexPrefix.substr(2))
|
.map(hexPrefix => hexPrefix.substr(2))
|
||||||
@ -502,6 +508,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
})[0]
|
})[0]
|
||||||
})
|
})
|
||||||
.map(number => number.div(GWEI_BN).toNumber())
|
.map(number => number.div(GWEI_BN).toNumber())
|
||||||
|
|
||||||
const percentileNum = percentile(50, lowestPrices)
|
const percentileNum = percentile(50, lowestPrices)
|
||||||
const percentileNumBn = new BN(percentileNum)
|
const percentileNumBn = new BN(percentileNum)
|
||||||
return '0x' + percentileNumBn.mul(GWEI_BN).toString(16)
|
return '0x' + percentileNumBn.mul(GWEI_BN).toString(16)
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
"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.2.1",
|
"eth-hd-keyring": "^1.2.1",
|
||||||
"eth-json-rpc-filters": "^1.2.4",
|
"eth-json-rpc-filters": "^1.2.5",
|
||||||
"eth-json-rpc-infura": "^2.0.5",
|
"eth-json-rpc-infura": "^2.0.5",
|
||||||
"eth-keyring-controller": "^2.1.2",
|
"eth-keyring-controller": "^2.1.2",
|
||||||
"eth-phishing-detect": "^1.1.4",
|
"eth-phishing-detect": "^1.1.4",
|
||||||
|
@ -72,6 +72,25 @@ describe('MetaMaskController', function () {
|
|||||||
|
|
||||||
metamaskController.recentBlocksController = realRecentBlocksController
|
metamaskController.recentBlocksController = realRecentBlocksController
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('gives the 1 gwei price if no blocks have been seen.', async function () {
|
||||||
|
const realRecentBlocksController = metamaskController.recentBlocksController
|
||||||
|
metamaskController.recentBlocksController = {
|
||||||
|
store: {
|
||||||
|
getState: () => {
|
||||||
|
return {
|
||||||
|
recentBlocks: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const gasPrice = metamaskController.getGasPrice()
|
||||||
|
assert.equal(gasPrice, '0x' + GWEI_BN.toString(16), 'defaults to 1 gwei')
|
||||||
|
|
||||||
|
metamaskController.recentBlocksController = realRecentBlocksController
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('#createNewVaultAndKeychain', function () {
|
describe('#createNewVaultAndKeychain', function () {
|
||||||
|
@ -138,7 +138,6 @@ InfoScreen.prototype.render = function () {
|
|||||||
h('div.fa.fa-envelope', [
|
h('div.fa.fa-envelope', [
|
||||||
h('a.info', {
|
h('a.info', {
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
style: { width: '85vw' },
|
|
||||||
href: 'mailto:help@metamask.io?subject=Feedback',
|
href: 'mailto:help@metamask.io?subject=Feedback',
|
||||||
}, 'Email us!'),
|
}, 'Email us!'),
|
||||||
]),
|
]),
|
||||||
|
Loading…
Reference in New Issue
Block a user