Merge branch 'master' into PopupNotifications

feature/default_network_editable
Dan Finlay 8 years ago
commit 793ad6b8d8
  1. 5
      CHANGELOG.md
  2. 2
      app/manifest.json
  3. 4
      app/scripts/lib/config-manager.js
  4. 1
      app/scripts/metamask-controller.js
  5. 2
      development/states.js
  6. 406
      development/states/pending-signature.json
  7. 1
      package.json
  8. 13
      test/unit/config-manager-test.js
  9. 9
      ui/app/components/pending-msg-details.js
  10. 2
      ui/app/conf-tx.js

@ -3,10 +3,15 @@
## Current Master ## Current Master
- Changed transaction approval from notifications system to popup system. - Changed transaction approval from notifications system to popup system.
## 2.9.1 2016-08-24
- Added static image as fallback for when WebGL isn't supported. - Added static image as fallback for when WebGL isn't supported.
- Transaction history now has a hard limit. - Transaction history now has a hard limit.
- Added info link on account screen that visits Etherscan. - Added info link on account screen that visits Etherscan.
- Fixed bug where a message signing request would be lost if the vault was locked.
- Added shortcut to open MetaMask (Ctrl+Alt+M or Cmd+Opt/Alt+M) - Added shortcut to open MetaMask (Ctrl+Alt+M or Cmd+Opt/Alt+M)
- Prevent API calls in tests.
- Fixed bug where sign message confirmation would sometimes render blank.
## 2.9.0 2016-08-22 ## 2.9.0 2016-08-22

@ -1,7 +1,7 @@
{ {
"name": "MetaMask", "name": "MetaMask",
"short_name": "Metamask", "short_name": "Metamask",
"version": "2.9.0", "version": "2.9.1",
"manifest_version": 2, "manifest_version": 2,
"description": "Ethereum Browser Extension", "description": "Ethereum Browser Extension",
"commands": { "commands": {

@ -300,9 +300,10 @@ ConfigManager.prototype.updateConversionRate = function () {
this.setConversionPrice(0) this.setConversionPrice(0)
this.setConversionDate('N/A') this.setConversionDate('N/A')
}) })
} }
ConfigManager.prototype.setConversionPrice = function(price) { ConfigManager.prototype.setConversionPrice = function (price) {
var data = this.getData() var data = this.getData()
data.conversionRate = Number(price) data.conversionRate = Number(price)
this.setData(data) this.setData(data)
@ -372,4 +373,3 @@ ConfigManager.prototype.createShapeShiftTx = function (depositAddress, depositTy
} }
this.setData(data) this.setData(data)
} }

@ -219,6 +219,7 @@ module.exports = class MetamaskController {
newUnsignedMessage (msgParams, cb) { newUnsignedMessage (msgParams, cb) {
var state = this.idStore.getState() var state = this.idStore.getState()
if (!state.isUnlocked) { if (!state.isUnlocked) {
this.idStore.addUnconfirmedMessage(msgParams, cb)
this.opts.unlockAccountMessage() this.opts.unlockAccountMessage()
} else { } else {
this.addUnconfirmedMessage(msgParams, cb) this.addUnconfirmedMessage(msgParams, cb)

File diff suppressed because one or more lines are too long

@ -0,0 +1,406 @@
{
"metamask": {
"isInitialized": true,
"isUnlocked": true,
"isEthConfirmed": true,
"currentDomain": "example.com",
"rpcTarget": "https://rawtestrpc.metamask.io/",
"identities": {
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825": {
"name": "Wallet 1",
"address": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"mayBeFauceting": false
},
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb": {
"name": "Wallet 2",
"address": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"mayBeFauceting": false
},
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d": {
"name": "Wallet 3",
"address": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d",
"mayBeFauceting": false
}
},
"unconfTxs": {},
"currentFiat": "USD",
"conversionRate": 11.02269525,
"conversionDate": 1472076963,
"accounts": {
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825": {
"balance": "0x056ace16d84b1c7e78",
"nonce": "0x17",
"code": "0x0",
"address": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
},
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb": {
"balance": "0x00000000000000056bc75e2d63100000",
"nonce": "0x0",
"code": "0x0",
"address": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb"
},
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d": {
"balance": "0x00000000000000056bc75e2d63100000",
"nonce": "0x0",
"code": "0x0",
"address": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
}
},
"transactions": [
{
"id": 1471975421223082,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb000000000000000000000000000000000000000000000000000000000000000a",
"origin": "localhost",
"metamaskId": 1471975421223082,
"metamaskNetworkId": "1471904489432"
},
"time": 1471975421223,
"status": "confirmed",
"containsDelegateCall": true,
"estimatedGas": "0x89ef",
"hash": "0xd0fe393e2586ebded866c9f13b90494e902bc49047fbf25ba2ac96c805a2f5d3"
},
{
"id": 1471975427199819,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb000000000000000000000000000000000000000000000000000000000000000a",
"origin": "localhost",
"metamaskId": 1471975427199819,
"metamaskNetworkId": "1471904489432"
},
"time": 1471975427199,
"status": "rejected",
"containsDelegateCall": true,
"estimatedGas": "0x89ef",
"hash": "0xb1f2f63f3e265f05d7c353ab38dd8b73fce8e7214489037311ee1f58a994dae3"
},
{
"id": 1471975806981442,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb000000000000000000000000000000000000000000000000000000000000000a",
"origin": "localhost",
"metamaskId": 1471975806981442,
"metamaskNetworkId": "1471904489432"
},
"time": 1471975806981,
"status": "confirmed",
"containsDelegateCall": true,
"estimatedGas": "0x89ef",
"hash": "0xeeb89e91aaeea14c4950016c45d60df8ee8874daa6f414de5cf267ea2c17bc6e"
},
{
"id": 1471975810133789,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb000000000000000000000000000000000000000000000000000000000000000a",
"origin": "localhost",
"metamaskId": 1471975810133789,
"metamaskNetworkId": "1471904489432"
},
"time": 1471975810133,
"status": "confirmed",
"containsDelegateCall": true,
"estimatedGas": "0x89ef",
"hash": "0xe54cab2e54b8495691b6d8315ca24a190cba546a9fcb056642479ce5770cec8b"
},
{
"id": 1471976546865348,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb000000000000000000000000000000000000000000000000000000000000000a",
"origin": "localhost",
"metamaskId": 1471976546865348,
"metamaskNetworkId": "1471904489432"
},
"time": 1471976546865,
"status": "confirmed",
"containsDelegateCall": true,
"estimatedGas": "0x89ef",
"hash": "0x54e10f77e17f28f4d12751749a2ca22f9b528592d1140ef53c6430a68e731542"
},
{
"id": 1471976930101889,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb0000000000000000000000000000000000000000000000000000000000000005",
"origin": "localhost",
"metamaskId": 1471976930101889,
"metamaskNetworkId": "1471904489432"
},
"time": 1471976930101,
"status": "confirmed",
"containsDelegateCall": true,
"estimatedGas": "0x89ef",
"hash": "0x60b5af26fad18c5549949064b67c8f965c9f20cd3e890c69512ca3acad10ed8b"
},
{
"id": 1471977268048169,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb0000000000000000000000000000000000000000000000000000000000000002",
"origin": "localhost",
"metamaskId": 1471977268048169,
"metamaskNetworkId": "1471904489432"
},
"time": 1471977268048,
"status": "confirmed",
"containsDelegateCall": true,
"estimatedGas": "0x89ef",
"hash": "0x1f96e29305ef11a9c993302c29e5419d87017e8222d4034daea0d86e155dc3aa"
},
{
"id": 1471977310778630,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb0000000000000000000000000000000000000000000000000000000000000005",
"origin": "localhost",
"metamaskId": 1471977310778630,
"metamaskNetworkId": "1471904489432"
},
"time": 1471977310778,
"status": "rejected",
"containsDelegateCall": true,
"estimatedGas": "0x89ef"
},
{
"id": 1471977316241561,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb0000000000000000000000000000000000000000000000000000000000000005",
"origin": "localhost",
"metamaskId": 1471977316241561,
"metamaskNetworkId": "1471904489432"
},
"time": 1471977316240,
"status": "confirmed",
"containsDelegateCall": true,
"estimatedGas": "0x89ef",
"hash": "0xdbd610c92d77a07c76b82e14e32674d382c45c4780dd2a550888b5cc40d54bcc"
},
{
"id": 1471977344018510,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb0000000000000000000000000000000000000000000000000000000000000004",
"origin": "localhost",
"metamaskId": 1471977344018510,
"metamaskNetworkId": "1471904489432"
},
"time": 1471977344018,
"status": "confirmed",
"containsDelegateCall": true,
"estimatedGas": "0x89ef",
"hash": "0x709d871d9ded0108de9f7718a7490b19d45e5e7562b1ba6c5bf6cce56e767d48"
},
{
"id": 1471977403830380,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb0000000000000000000000000000000000000000000000000000000000000001",
"origin": "localhost",
"metamaskId": 1471977403830380,
"metamaskNetworkId": "1471904489432"
},
"time": 1471977403830,
"status": "confirmed",
"containsDelegateCall": true,
"estimatedGas": "0x89ef",
"hash": "0x94f5088a127bba181b303d6427ae93cbfa9867997bea1326f30da311e36c6aca"
},
{
"id": 1471977431563703,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb0000000000000000000000000000000000000000000000000000000000000001",
"origin": "localhost",
"metamaskId": 1471977431563703,
"metamaskNetworkId": "1471904489432"
},
"time": 1471977431563,
"status": "rejected",
"containsDelegateCall": true,
"estimatedGas": "0x89ef"
},
{
"id": 1471977436074587,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb0000000000000000000000000000000000000000000000000000000000000001",
"origin": "localhost",
"metamaskId": 1471977436074587,
"metamaskNetworkId": "1471904489432"
},
"time": 1471977436074,
"status": "confirmed",
"containsDelegateCall": true,
"estimatedGas": "0x89ef",
"hash": "0x5f514dfe3bd48f6f301c809a7a75f73f0fc93bc3a0e469368b84dce032aff9ec"
},
{
"id": 1471991826717707,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb0000000000000000000000000000000000000000000000000000000000000004",
"origin": "localhost",
"metamaskId": 1471991826717707,
"metamaskNetworkId": "1471904489432"
},
"time": 1471991826717,
"status": "confirmed",
"containsDelegateCall": true,
"estimatedGas": "0x89ef",
"hash": "0xab1e706f8981680a6c921f9f57f8ce573392bbb4f0fe85cf45e5cbf858fa5f3e"
},
{
"id": 1471991851917592,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb0000000000000000000000000000000000000000000000000000000000000004",
"origin": "localhost",
"metamaskId": 1471991851917592,
"metamaskNetworkId": "1471904489432"
},
"time": 1471991851917,
"status": "confirmed",
"containsDelegateCall": true,
"estimatedGas": "0x89ef",
"hash": "0xdea144f7a6f06969739f676d8702a9a11efc689e032f1981fe67afc9261dd4de"
},
{
"id": 1471992032999543,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb0000000000000000000000000000000000000000000000000000000000000005",
"origin": "localhost",
"metamaskId": 1471992032999543,
"metamaskNetworkId": "1471904489432"
},
"time": 1471992032999,
"status": "confirmed",
"containsDelegateCall": true,
"estimatedGas": "0x89ef",
"hash": "0xdf31b8cc0fbd2ab6727e0b63536bd4eab51a147aa29e04691e68fae28b866fb3"
},
{
"id": 1471992043490878,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"to": "0x48ff0cbac0acefedf152281ee80e9a0a01d5da63",
"data": "0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb0000000000000000000000000000000000000000000000000000000000000005",
"origin": "localhost",
"metamaskId": 1471992043490878,
"metamaskNetworkId": "1471904489432"
},
"time": 1471992043490,
"status": "rejected",
"containsDelegateCall": true,
"estimatedGas": "0x89ef"
},
{
"id": 1472068030402279,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"value": "0x3782dace9d90000",
"gas": "0x493e0",
"to": "0x18a672e11d637fffadccc99b152f4895da069601",
"data": "0x5b7d47a900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
"origin": "www.rouleth.com",
"metamaskId": 1472068030402279,
"metamaskNetworkId": "1"
},
"time": 1472068030402,
"status": "rejected",
"containsDelegateCall": false,
"estimatedGas": "0x24704"
},
{
"id": 1472068061833258,
"txParams": {
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"value": "0x16345785d8a0000",
"gas": "0x493e0",
"to": "0x18a672e11d637fffadccc99b152f4895da069601",
"data": "0x5b7d47a900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
"origin": "www.rouleth.com",
"metamaskId": 1472068061833258,
"metamaskNetworkId": "1"
},
"time": 1472068061833,
"status": "confirmed",
"containsDelegateCall": false,
"estimatedGas": "0x24704",
"hash": "0xb6e6ff57e7b5f6bd7f2e6dc44c39f4e858a227c9509586634ca547179345a13e"
}
],
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"network": "1471904489432",
"seedWords": null,
"isConfirmed": true,
"unconfMsgs": {
"1472076978535283": {
"id": 1472076978535283,
"msgParams": {
"origin": "localhost",
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"data": "hello"
},
"time": 1472076978535,
"status": "unconfirmed"
}
},
"messages": [
{
"id": 1472076978535283,
"msgParams": {
"origin": "localhost",
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"data": "hello"
},
"time": 1472076978535,
"status": "unconfirmed"
}
],
"shapeShiftTxList": [],
"provider": {
"type": "rpc",
"rpcTarget": "http://localhost:8545"
},
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
},
"appState": {
"menuOpen": false,
"currentView": {
"name": "confTx",
"detailView": null,
"context": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
},
"accountDetail": {
"subview": "transactions"
},
"currentDomain": "ebjbdknjcgcbchkagneicjfpneaghdhb",
"transForward": true,
"isLoading": false,
"warning": null
},
"identities": {}
}

@ -108,6 +108,7 @@
"mocha-eslint": "^2.1.1", "mocha-eslint": "^2.1.1",
"mocha-jsdom": "^1.1.0", "mocha-jsdom": "^1.1.0",
"mocha-sinon": "^1.1.5", "mocha-sinon": "^1.1.5",
"nock": "^8.0.0",
"qs": "^6.2.0", "qs": "^6.2.0",
"qunit": "^0.9.1", "qunit": "^0.9.1",
"sinon": "^1.17.3", "sinon": "^1.17.3",

@ -1,9 +1,10 @@
var assert = require('assert') const assert = require('assert')
const extend = require('xtend') const extend = require('xtend')
const STORAGE_KEY = 'metamask-persistance-key' const STORAGE_KEY = 'metamask-persistance-key'
var configManagerGen = require('../lib/mock-config-manager') var configManagerGen = require('../lib/mock-config-manager')
var configManager var configManager
const rp = require('request-promise') const rp = require('request-promise')
const nock = require('nock')
describe('config-manager', function() { describe('config-manager', function() {
@ -47,6 +48,10 @@ describe('config-manager', function() {
describe('#updateConversionRate', function() { describe('#updateConversionRate', function() {
it('should retrieve an update for ETH to USD and set it in memory', function(done) { it('should retrieve an update for ETH to USD and set it in memory', function(done) {
this.timeout(15000) this.timeout(15000)
var usdMock = nock('https://www.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":""}')
assert.equal(configManager.getConversionRate(), false) assert.equal(configManager.getConversionRate(), false)
var promise = new Promise( var promise = new Promise(
function (resolve, reject) { function (resolve, reject) {
@ -69,6 +74,12 @@ describe('config-manager', function() {
it('should work for JPY as well.', function() { it('should work for JPY as well.', function() {
this.timeout(15000) this.timeout(15000)
assert.equal(configManager.getConversionRate(), false) assert.equal(configManager.getConversionRate(), false)
var jpyMock = nock('https://www.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":""}')
var promise = new Promise( var promise = new Promise(
function (resolve, reject) { function (resolve, reject) {
configManager.setCurrentFiat('JPY') configManager.setCurrentFiat('JPY')

@ -3,7 +3,6 @@ const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const AccountPanel = require('./account-panel') const AccountPanel = require('./account-panel')
const readableDate = require('../util').readableDate
module.exports = PendingMsgDetails module.exports = PendingMsgDetails
@ -24,6 +23,9 @@ PendingMsgDetails.prototype.render = function () {
return ( return (
h('div', { h('div', {
key: msgData.id, key: msgData.id,
style: {
margin: '10px 20px',
},
}, [ }, [
// account that will sign // account that will sign
@ -36,11 +38,6 @@ PendingMsgDetails.prototype.render = function () {
// message data // message data
h('.tx-data.flex-column.flex-justify-center.flex-grow.select-none', [ h('.tx-data.flex-column.flex-justify-center.flex-grow.select-none', [
h('.flex-row.flex-space-between', [
h('label.font-small', 'DATE'),
h('span.font-small', readableDate(msgData.time)),
]),
h('.flex-row.flex-space-between', [ h('.flex-row.flex-space-between', [
h('label.font-small', 'MESSAGE'), h('label.font-small', 'MESSAGE'),
h('span.font-small', msgParams.data), h('span.font-small', msgParams.data),

@ -36,7 +36,7 @@ ConfirmTxScreen.prototype.render = function () {
var unconfMsgs = state.unconfMsgs var unconfMsgs = state.unconfMsgs
var unconfTxList = txHelper(unconfTxs, unconfMsgs) var unconfTxList = txHelper(unconfTxs, unconfMsgs)
var index = state.index !== undefined ? state.index : 0 var index = state.index !== undefined ? state.index : 0
var txData = unconfTxList[index] || {} var txData = unconfTxList[index] || unconfTxList[0] || {}
var isNotification = isPopupOrNotification() === 'notification' var isNotification = isPopupOrNotification() === 'notification'
return ( return (

Loading…
Cancel
Save