Merge branch 'master' into legal-beagal

feature/default_network_editable
kumavis 8 years ago committed by GitHub
commit e18dc1d65d
  1. 4
      CHANGELOG.md
  2. 2
      app/manifest.json
  3. 38
      app/scripts/lib/idStore.js
  4. 1
      package.json
  5. 4
      ui/app/components/eth-balance.js
  6. 15
      ui/app/components/pending-tx-details.js
  7. 1
      ui/app/components/transaction-list-item.js
  8. 8
      ui/app/util.js

@ -2,10 +2,14 @@
## Current Master ## Current Master
## 2.6.1 2016-07-13
- Fix tool tips on Eth balance to show the 6 decimals
- Fix rendering of recipient SVG in tx approval notification. - Fix rendering of recipient SVG in tx approval notification.
- New vaults now generate only one wallet instead of three. - New vaults now generate only one wallet instead of three.
- Bumped version of web3 provider engine. - Bumped version of web3 provider engine.
- Fixed bug where some lowercase or uppercase addresses were not being recognized as valid. - Fixed bug where some lowercase or uppercase addresses were not being recognized as valid.
- Fixed bug where gas cost was misestimated on the tx confirmation view.
## 2.6.0 2016-07-11 ## 2.6.0 2016-07-11

@ -1,7 +1,7 @@
{ {
"name": "__MSG_appName__", "name": "__MSG_appName__",
"short_name": "Metamask", "short_name": "Metamask",
"version": "2.6.0", "version": "2.6.1",
"manifest_version": 2, "manifest_version": 2,
"description": "__MSG_appDescription__", "description": "__MSG_appDescription__",
"icons": { "icons": {

@ -1,6 +1,8 @@
const EventEmitter = require('events').EventEmitter const EventEmitter = require('events').EventEmitter
const inherits = require('util').inherits const inherits = require('util').inherits
const async = require('async')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const EthQuery = require('eth-query')
const LightwalletKeyStore = require('eth-lightwallet').keystore const LightwalletKeyStore = require('eth-lightwallet').keystore
const clone = require('clone') const clone = require('clone')
const extend = require('xtend') const extend = require('xtend')
@ -197,35 +199,53 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone
time: time, time: time,
status: 'unconfirmed', status: 'unconfirmed',
} }
configManager.addTx(txData)
console.log('addUnconfirmedTransaction:', txData) console.log('addUnconfirmedTransaction:', txData)
// keep the onTxDoneCb around for after approval/denial (requires user interaction) // keep the onTxDoneCb around for after approval/denial (requires user interaction)
// This onTxDoneCb fires completion to the Dapp's write operation. // This onTxDoneCb fires completion to the Dapp's write operation.
self._unconfTxCbs[txId] = onTxDoneCb self._unconfTxCbs[txId] = onTxDoneCb
// perform static analyis on the target contract code
var provider = self._ethStore._query.currentProvider var provider = self._ethStore._query.currentProvider
var query = new EthQuery(provider)
// calculate metadata for tx
async.parallel([
analyzeForDelegateCall,
estimateGas,
], didComplete)
// perform static analyis on the target contract code
function analyzeForDelegateCall(cb){
if (txParams.to) { if (txParams.to) {
provider.sendAsync({ id: 1, method: 'eth_getCode', params: [txParams.to, 'latest'] }, function (err, res) { query.getCode(txParams.to, function (err, result) {
if (err) return didComplete(err) if (err) return cb(err)
if (res.error) return didComplete(res.error) var code = ethUtil.toBuffer(result)
var code = ethUtil.toBuffer(res.result)
if (code !== '0x') { if (code !== '0x') {
var ops = ethBinToOps(code) var ops = ethBinToOps(code)
var containsDelegateCall = ops.some((op) => op.name === 'DELEGATECALL') var containsDelegateCall = ops.some((op) => op.name === 'DELEGATECALL')
txData.containsDelegateCall = containsDelegateCall txData.containsDelegateCall = containsDelegateCall
didComplete() cb()
} else { } else {
didComplete() cb()
} }
}) })
} else { } else {
didComplete() cb()
}
}
function estimateGas(cb){
query.estimateGas(txParams, function(err, result){
if (err) return cb(err)
txData.estimatedGas = result
cb()
})
} }
function didComplete (err) { function didComplete (err) {
if (err) return cb(err) if (err) return cb(err)
configManager.addTx(txData)
// signal update // signal update
self._didUpdate() self._didUpdate()
// signal completion of add tx // signal completion of add tx

@ -32,6 +32,7 @@
"end-of-stream": "^1.1.0", "end-of-stream": "^1.1.0",
"eth-bin-to-ops": "^1.0.0", "eth-bin-to-ops": "^1.0.0",
"eth-lightwallet": "^2.3.3", "eth-lightwallet": "^2.3.3",
"eth-query": "^1.0.3",
"eth-store": "^1.1.0", "eth-store": "^1.1.0",
"ethereumjs-tx": "^1.0.0", "ethereumjs-tx": "^1.0.0",
"ethereumjs-util": "^4.4.0", "ethereumjs-util": "^4.4.0",

@ -15,7 +15,7 @@ EthBalanceComponent.prototype.render = function () {
var state = this.props var state = this.props
var style = state.style var style = state.style
const value = formatBalance(state.value) const value = formatBalance(state.value, 6)
var width = state.width var width = state.width
return ( return (
@ -35,7 +35,7 @@ EthBalanceComponent.prototype.render = function () {
} }
EthBalanceComponent.prototype.renderBalance = function (value, state) { EthBalanceComponent.prototype.renderBalance = function (value, state) {
if (value === 'None') return value if (value === 'None') return value
var balanceObj = generateBalanceObject(value, 1) var balanceObj = generateBalanceObject(value, state.shorten ? 1 : 3)
var balance var balance
if (state.shorten) { if (state.shorten) {

@ -11,9 +11,6 @@ const nameForAddress = require('../../lib/contract-namer')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN const BN = ethUtil.BN
const baseGasFee = new BN('21000', 10)
const gasCost = new BN('4a817c800', 16)
const baseFeeHex = baseGasFee.mul(gasCost).toString(16)
module.exports = PendingTxDetails module.exports = PendingTxDetails
@ -33,9 +30,11 @@ PTXP.render = function () {
var identity = props.identities[address] || { address: address } var identity = props.identities[address] || { address: address }
var balance = props.accounts[address].balance var balance = props.accounts[address].balance
var gasCost = ethUtil.stripHexPrefix(txParams.gas || baseFeeHex) var gasCost = new BN(ethUtil.stripHexPrefix(txParams.gas || txData.estimatedGas), 16)
var txValue = ethUtil.stripHexPrefix(txParams.value || '0x0') var gasPrice = new BN(ethUtil.stripHexPrefix(txParams.gasPrice || '0x4a817c800'), 16)
var maxCost = ((new BN(txValue, 16)).add(new BN(gasCost, 16))).toString(16) var txFee = gasCost.mul(gasPrice)
var txValue = new BN(ethUtil.stripHexPrefix(txParams.value || '0x0'), 16)
var maxCost = txValue.add(txFee)
var dataLength = txParams.data ? (txParams.data.length - 2) / 2 : 0 var dataLength = txParams.data ? (txParams.data.length - 2) / 2 : 0
var imageify = props.imageifyIdenticons === undefined ? true : props.imageifyIdenticons var imageify = props.imageifyIdenticons === undefined ? true : props.imageifyIdenticons
@ -112,7 +111,7 @@ PTXP.render = function () {
h('.cell.row', [ h('.cell.row', [
h('.cell.label', 'Max Transaction Fee'), h('.cell.label', 'Max Transaction Fee'),
h('.cell.value', formatBalance(gasCost)), h('.cell.value', formatBalance(txFee.toString(16))),
]), ]),
h('.cell.row', { h('.cell.row', {
@ -130,7 +129,7 @@ PTXP.render = function () {
}, },
}, [ }, [
h(EtherBalance, { h(EtherBalance, {
value: maxCost, value: maxCost.toString(16),
inline: true, inline: true,
labelColor: 'black', labelColor: 'black',
fontSize: '16px', fontSize: '16px',

@ -75,6 +75,7 @@ TransactionListItem.prototype.render = function () {
value: txParams.value, value: txParams.value,
width: '55px', width: '55px',
shorten: true, shorten: true,
style: {fontSize: '15px'},
}) : h('.flex-column'), }) : h('.flex-column'),
]) ])
) )

@ -122,7 +122,11 @@ function generateBalanceObject (formattedBalance, decimalsToKeep = 1) {
var afterDecimal = balance.split('.')[1] var afterDecimal = balance.split('.')[1]
var shortBalance = shortenBalance(balance, decimalsToKeep) var shortBalance = shortenBalance(balance, decimalsToKeep)
if (beforeDecimal === '0' && afterDecimal.substr(0, 5) === '00000') { balance = '<1.0e-5' } if (beforeDecimal === '0' && afterDecimal.substr(0, 5) === '00000') {
balance = '<1.0e-5'
} else if (beforeDecimal !== '0') {
balance = `${beforeDecimal}.${afterDecimal.slice(0, decimalsToKeep)}`
}
return { balance, label, shortBalance } return { balance, label, shortBalance }
} }
@ -141,7 +145,7 @@ function shortenBalance (balance, decimalsToKeep = 1) {
truncatedValue = (convertedBalance * Math.pow(10, exponent)).toFixed(decimalsToKeep) truncatedValue = (convertedBalance * Math.pow(10, exponent)).toFixed(decimalsToKeep)
return `<${truncatedValue}e-${exponent}` return `<${truncatedValue}e-${exponent}`
} else { } else {
return balance return convertedBalance.toFixed(decimalsToKeep)
} }
} }

Loading…
Cancel
Save