mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge branch 'master' into currency-fix
This commit is contained in:
commit
ba254d9041
@ -3,6 +3,11 @@
|
|||||||
## Current Master
|
## Current Master
|
||||||
|
|
||||||
- Fix currency API URL from cryptonator.
|
- 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
|
## 3.7.6 2017-6-5
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "MetaMask",
|
"name": "MetaMask",
|
||||||
"short_name": "Metamask",
|
"short_name": "Metamask",
|
||||||
"version": "3.7.6",
|
"version": "3.7.7",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"author": "https://metamask.io",
|
"author": "https://metamask.io",
|
||||||
"description": "Ethereum Browser Extension",
|
"description": "Ethereum Browser Extension",
|
||||||
|
@ -21,6 +21,7 @@ class EthereumStore extends ObservableStore {
|
|||||||
transactions: {},
|
transactions: {},
|
||||||
currentBlockNumber: '0',
|
currentBlockNumber: '0',
|
||||||
currentBlockHash: '',
|
currentBlockHash: '',
|
||||||
|
currentBlockGasLimit: '',
|
||||||
})
|
})
|
||||||
this._provider = opts.provider
|
this._provider = opts.provider
|
||||||
this._query = new EthQuery(this._provider)
|
this._query = new EthQuery(this._provider)
|
||||||
@ -73,6 +74,7 @@ class EthereumStore extends ObservableStore {
|
|||||||
this._currentBlockNumber = blockNumber
|
this._currentBlockNumber = blockNumber
|
||||||
this.updateState({ currentBlockNumber: parseInt(blockNumber) })
|
this.updateState({ currentBlockNumber: parseInt(blockNumber) })
|
||||||
this.updateState({ currentBlockHash: `0x${block.hash.toString('hex')}`})
|
this.updateState({ currentBlockHash: `0x${block.hash.toString('hex')}`})
|
||||||
|
this.updateState({ currentBlockGasLimit: `0x${block.gasLimit.toString('hex')}` })
|
||||||
async.parallel([
|
async.parallel([
|
||||||
this._updateAccounts.bind(this),
|
this._updateAccounts.bind(this),
|
||||||
this._updateTransactions.bind(this, blockNumber),
|
this._updateTransactions.bind(this, blockNumber),
|
||||||
|
@ -21,21 +21,12 @@ module.exports = class txProviderUtils {
|
|||||||
this.query.getBlockByNumber('latest', true, (err, block) => {
|
this.query.getBlockByNumber('latest', true, (err, block) => {
|
||||||
if (err) return cb(err)
|
if (err) return cb(err)
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
self.setBlockGasLimit.bind(self, txMeta, block.gasLimit),
|
|
||||||
self.estimateTxGas.bind(self, txMeta, block.gasLimit),
|
self.estimateTxGas.bind(self, txMeta, block.gasLimit),
|
||||||
self.setTxGas.bind(self, txMeta, block.gasLimit),
|
self.setTxGas.bind(self, txMeta, block.gasLimit),
|
||||||
], cb)
|
], 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) {
|
estimateTxGas (txMeta, blockGasLimitHex, cb) {
|
||||||
const txParams = txMeta.txParams
|
const txParams = txMeta.txParams
|
||||||
// check if gasLimit is already specified
|
// check if gasLimit is already specified
|
||||||
|
@ -123,7 +123,7 @@
|
|||||||
"valid-url": "^1.0.9",
|
"valid-url": "^1.0.9",
|
||||||
"vreme": "^3.0.2",
|
"vreme": "^3.0.2",
|
||||||
"web3": "0.18.2",
|
"web3": "0.18.2",
|
||||||
"web3-provider-engine": "^12.1.0",
|
"web3-provider-engine": "^12.2.3",
|
||||||
"web3-stream-provider": "^2.0.6",
|
"web3-stream-provider": "^2.0.6",
|
||||||
"xtend": "^4.0.1"
|
"xtend": "^4.0.1"
|
||||||
},
|
},
|
||||||
|
@ -32,7 +32,7 @@ function PendingTx () {
|
|||||||
|
|
||||||
PendingTx.prototype.render = function () {
|
PendingTx.prototype.render = function () {
|
||||||
const props = this.props
|
const props = this.props
|
||||||
const { currentCurrency } = props
|
const { currentCurrency, blockGasLimit } = props
|
||||||
|
|
||||||
const conversionRate = props.conversionRate
|
const conversionRate = props.conversionRate
|
||||||
const txMeta = this.gatherTxMeta()
|
const txMeta = this.gatherTxMeta()
|
||||||
@ -50,7 +50,8 @@ PendingTx.prototype.render = function () {
|
|||||||
// Gas
|
// Gas
|
||||||
const gas = txParams.gas
|
const gas = txParams.gas
|
||||||
const gasBn = hexToBn(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
|
// Gas Price
|
||||||
const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16)
|
const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16)
|
||||||
@ -458,6 +459,12 @@ PendingTx.prototype._notZeroOrEmptyString = function (obj) {
|
|||||||
return obj !== '' && obj !== '0x0'
|
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 () {
|
function forwardCarrat () {
|
||||||
return (
|
return (
|
||||||
h('img', {
|
h('img', {
|
||||||
|
@ -29,6 +29,7 @@ function mapStateToProps (state) {
|
|||||||
provider: state.metamask.provider,
|
provider: state.metamask.provider,
|
||||||
conversionRate: state.metamask.conversionRate,
|
conversionRate: state.metamask.conversionRate,
|
||||||
currentCurrency: state.metamask.currentCurrency,
|
currentCurrency: state.metamask.currentCurrency,
|
||||||
|
blockGasLimit: state.metamask.currentBlockGasLimit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ function ConfirmTxScreen () {
|
|||||||
ConfirmTxScreen.prototype.render = function () {
|
ConfirmTxScreen.prototype.render = function () {
|
||||||
const props = this.props
|
const props = this.props
|
||||||
const { network, provider, unapprovedTxs, currentCurrency,
|
const { network, provider, unapprovedTxs, currentCurrency,
|
||||||
unapprovedMsgs, unapprovedPersonalMsgs, conversionRate } = props
|
unapprovedMsgs, unapprovedPersonalMsgs, conversionRate, blockGasLimit } = props
|
||||||
|
|
||||||
var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network)
|
var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network)
|
||||||
|
|
||||||
@ -107,6 +108,7 @@ ConfirmTxScreen.prototype.render = function () {
|
|||||||
identities: props.identities,
|
identities: props.identities,
|
||||||
conversionRate,
|
conversionRate,
|
||||||
currentCurrency,
|
currentCurrency,
|
||||||
|
blockGasLimit,
|
||||||
// Actions
|
// Actions
|
||||||
buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress),
|
buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress),
|
||||||
sendTransaction: this.sendTransaction.bind(this),
|
sendTransaction: this.sendTransaction.bind(this),
|
||||||
|
Loading…
Reference in New Issue
Block a user