aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2016-07-15 14:12:05 +0800
committerKevin Serrano <kevgagser@gmail.com>2016-07-15 14:12:05 +0800
commit202ff31bf8707dc0664a1db73c71ddca97d1d6dc (patch)
treebfa4b52f25ec58d63ba114c4040b4a5005da6e00
parent4926fbd833221324b80c1ddd18e5bbd7f736d315 (diff)
parent0f7f02d1875bc2ff7e5eca581edca39b927cf802 (diff)
downloadtangerine-wallet-browser-202ff31bf8707dc0664a1db73c71ddca97d1d6dc.tar.gz
tangerine-wallet-browser-202ff31bf8707dc0664a1db73c71ddca97d1d6dc.tar.zst
tangerine-wallet-browser-202ff31bf8707dc0664a1db73c71ddca97d1d6dc.zip
Merge branch 'master' into user-agreement-proofread
-rw-r--r--CHANGELOG.md3
-rw-r--r--LICENSE34
-rw-r--r--app/manifest.json2
-rw-r--r--app/scripts/lib/idStore.js54
-rw-r--r--package.json1
-rw-r--r--ui/app/components/pending-tx-details.js15
6 files changed, 83 insertions, 26 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 96f7749c8..faaa3138c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,11 +2,14 @@
## 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.
- New vaults now generate only one wallet instead of three.
- Bumped version of web3 provider engine.
- 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
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000000000..429f4eaee
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,34 @@
+Copyright (c) 2016 MetaMask
+
+The Ethereum Project Contributor Asset Distribution Terms ( MIT + Share-alike )
+
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
+
+associated documentation files (the "Software"), to deal in the Software without restriction,
+
+including without limitation the rights to use, copy, modify, merge, publish, distribute,
+
+sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial
+
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+
+THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+These licence terms have been adapted from the MIT licence. \ No newline at end of file
diff --git a/app/manifest.json b/app/manifest.json
index d0207ee0e..d1a4a2f54 100644
--- a/app/manifest.json
+++ b/app/manifest.json
@@ -1,7 +1,7 @@
{
"name": "__MSG_appName__",
"short_name": "Metamask",
- "version": "2.6.0",
+ "version": "2.6.1",
"manifest_version": 2,
"description": "__MSG_appDescription__",
"icons": {
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js
index 133078668..2c8e9108b 100644
--- a/app/scripts/lib/idStore.js
+++ b/app/scripts/lib/idStore.js
@@ -1,6 +1,8 @@
const EventEmitter = require('events').EventEmitter
const inherits = require('util').inherits
+const async = require('async')
const ethUtil = require('ethereumjs-util')
+const EthQuery = require('eth-query')
const LightwalletKeyStore = require('eth-lightwallet').keystore
const clone = require('clone')
const extend = require('xtend')
@@ -197,35 +199,53 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone
time: time,
status: 'unconfirmed',
}
- configManager.addTx(txData)
+
console.log('addUnconfirmedTransaction:', txData)
// keep the onTxDoneCb around for after approval/denial (requires user interaction)
// This onTxDoneCb fires completion to the Dapp's write operation.
self._unconfTxCbs[txId] = onTxDoneCb
- // perform static analyis on the target contract code
var provider = self._ethStore._query.currentProvider
- if (txParams.to) {
- provider.sendAsync({ id: 1, method: 'eth_getCode', params: [txParams.to, 'latest'] }, function (err, res) {
- if (err) return didComplete(err)
- if (res.error) return didComplete(res.error)
- var code = ethUtil.toBuffer(res.result)
- if (code !== '0x') {
- var ops = ethBinToOps(code)
- var containsDelegateCall = ops.some((op) => op.name === 'DELEGATECALL')
- txData.containsDelegateCall = containsDelegateCall
- didComplete()
- } else {
- didComplete()
- }
+ 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) {
+ query.getCode(txParams.to, function (err, result) {
+ if (err) return cb(err)
+ var code = ethUtil.toBuffer(result)
+ if (code !== '0x') {
+ var ops = ethBinToOps(code)
+ var containsDelegateCall = ops.some((op) => op.name === 'DELEGATECALL')
+ txData.containsDelegateCall = containsDelegateCall
+ cb()
+ } else {
+ cb()
+ }
+ })
+ } else {
+ cb()
+ }
+ }
+
+ function estimateGas(cb){
+ query.estimateGas(txParams, function(err, result){
+ if (err) return cb(err)
+ txData.estimatedGas = result
+ cb()
})
- } else {
- didComplete()
}
function didComplete (err) {
if (err) return cb(err)
+ configManager.addTx(txData)
// signal update
self._didUpdate()
// signal completion of add tx
diff --git a/package.json b/package.json
index 4438092c2..8d2540ef2 100644
--- a/package.json
+++ b/package.json
@@ -32,6 +32,7 @@
"end-of-stream": "^1.1.0",
"eth-bin-to-ops": "^1.0.0",
"eth-lightwallet": "^2.3.3",
+ "eth-query": "^1.0.3",
"eth-store": "^1.1.0",
"ethereumjs-tx": "^1.0.0",
"ethereumjs-util": "^4.4.0",
diff --git a/ui/app/components/pending-tx-details.js b/ui/app/components/pending-tx-details.js
index 9a06ad09e..a6f72a89b 100644
--- a/ui/app/components/pending-tx-details.js
+++ b/ui/app/components/pending-tx-details.js
@@ -11,9 +11,6 @@ const nameForAddress = require('../../lib/contract-namer')
const ethUtil = require('ethereumjs-util')
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
@@ -33,9 +30,11 @@ PTXP.render = function () {
var identity = props.identities[address] || { address: address }
var balance = props.accounts[address].balance
- var gasCost = ethUtil.stripHexPrefix(txParams.gas || baseFeeHex)
- var txValue = ethUtil.stripHexPrefix(txParams.value || '0x0')
- var maxCost = ((new BN(txValue, 16)).add(new BN(gasCost, 16))).toString(16)
+ var gasCost = new BN(ethUtil.stripHexPrefix(txParams.gas || txData.estimatedGas), 16)
+ var gasPrice = new BN(ethUtil.stripHexPrefix(txParams.gasPrice || '0x4a817c800'), 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 imageify = props.imageifyIdenticons === undefined ? true : props.imageifyIdenticons
@@ -112,7 +111,7 @@ PTXP.render = function () {
h('.cell.row', [
h('.cell.label', 'Max Transaction Fee'),
- h('.cell.value', formatBalance(gasCost)),
+ h('.cell.value', formatBalance(txFee.toString(16))),
]),
h('.cell.row', {
@@ -130,7 +129,7 @@ PTXP.render = function () {
},
}, [
h(EtherBalance, {
- value: maxCost,
+ value: maxCost.toString(16),
inline: true,
labelColor: 'black',
fontSize: '16px',