Merge github.com:MetaMask/metamask-plugin into i765-gaslimits

This commit is contained in:
Kevin Serrano 2017-02-23 14:17:52 -08:00
commit 30e4bdf24b
No known key found for this signature in database
GPG Key ID: 7CC862A58D2889B4
19 changed files with 215 additions and 20 deletions

View File

@ -25,6 +25,7 @@
"globals": {
"document": false,
"log": true,
"navigator": false,
"web3": true,
"window": false

View File

@ -1,10 +1,13 @@
# Changelog
## Current Master
## 3.3.0 2017-2-20
- Add personal_sign and personal_ecRecover support.
- net_version has been made synchronous.
- Test suite for migrations expanded.
- Network now changeable from lock screen.
- Improve test coverage of eth.sign behavior, including a code example of verifying a signature.
## 3.2.2 2017-2-8

View File

@ -1,7 +1,7 @@
{
"name": "MetaMask",
"short_name": "Metamask",
"version": "3.2.2",
"version": "3.3.0",
"manifest_version": 2,
"author": "https://metamask.io",
"description": "Ethereum Browser Extension",

View File

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,107 @@
{
"metamask": {
"isInitialized": true,
"isUnlocked": true,
"rpcTarget": "https://rawtestrpc.metamask.io/",
"identities": {
"0xa06599bd35921cfb5b71b4be3869740385b0b306": {
"address": "0xa06599bd35921cfb5b71b4be3869740385b0b306",
"name": "Account 1"
}
},
"unapprovedTxs": {
"1188547363326880": {
"id": 1188547363326880,
"time": 1487662234127,
"status": "unapproved",
"gasMultiplier": 1,
"metamaskNetworkId": "3",
"txParams": {
"from": "0xa06599bd35921cfb5b71b4be3869740385b0b306",
"to": "0x18a3462427bcc9133bb46e88bcbe39cd7ef0e761",
"value": "0xde0b6b3a7640000",
"metamaskId": 1188547363326880,
"metamaskNetworkId": "3",
"gas": "0x5209"
},
"gasLimitSpecified": false,
"estimatedGas": "0x5209",
"txFee": "17e0186e60800",
"txValue": "de0b6b3a7640000",
"maxCost": "de234b52e4a0800"
}
},
"currentFiat": "USD",
"conversionRate": 12.59854817,
"conversionDate": 1487662141,
"noActiveNotices": true,
"network": "3",
"accounts": {
"0xa06599bd35921cfb5b71b4be3869740385b0b306": {
"nonce": "0x0",
"balance": "0x0",
"code": "0x",
"address": "0xa06599bd35921cfb5b71b4be3869740385b0b306"
}
},
"transactions": {},
"selectedAddressTxList": [
{
"id": 1188547363326880,
"time": 1487662234127,
"status": "unapproved",
"gasMultiplier": 1,
"metamaskNetworkId": "3",
"txParams": {
"from": "0xa06599bd35921cfb5b71b4be3869740385b0b306",
"to": "0x18a3462427bcc9133bb46e88bcbe39cd7ef0e761",
"value": "0xde0b6b3a7640000",
"metamaskId": 1188547363326880,
"metamaskNetworkId": "3",
"gas": "0x5209"
},
"gasLimitSpecified": false,
"estimatedGas": "0x5209",
"txFee": "17e0186e60800",
"txValue": "de0b6b3a7640000",
"maxCost": "de234b52e4a0800"
}
],
"unapprovedMsgs": {},
"unapprovedMsgCount": 0,
"keyringTypes": [
"Simple Key Pair",
"HD Key Tree"
],
"keyrings": [
{
"type": "HD Key Tree",
"accounts": [
"a06599bd35921cfb5b71b4be3869740385b0b306"
]
}
],
"selectedAddress": "0xa06599bd35921cfb5b71b4be3869740385b0b306",
"currentCurrency": "USD",
"provider": {
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": [],
"seedWords": null
},
"appState": {
"menuOpen": false,
"currentView": {
"name": "confTx",
"context": 0
},
"accountDetail": {
"subview": "transactions"
},
"transForward": true,
"isLoading": false,
"warning": null
},
"identities": {}
}

View File

@ -1 +0,0 @@
{"metamask":{"isInitialized":true,"isUnlocked":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":{"1467868023090690":{"id":1467868023090690,"txParams":{"data":"0xa9059cbb0000000000000000000000008deb4d106090c3eb8f1950f727e87c4f884fb06f0000000000000000000000000000000000000000000000000000000000000064","from":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","value":"0x16345785d8a0000","to":"0xbeb0ed3034c4155f3d16a64a5c5e7c8d4ea9e9c9","origin":"MetaMask","metamaskId":1467868023090690,"metamaskNetworkId":"2"},"time":1467868023090,"status":"unconfirmed","containsDelegateCall":false}},"accounts":{"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825":{"code":"0x","balance":"0x38326dc32cf80800","nonce":"0x10000c","address":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"},"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb":{"code":"0x","balance":"0x15e578bd8e9c8000","nonce":"0x100000","address":"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb"},"0x2f8d4a878cfa04a6e60d46362f5644deab66572d":{"code":"0x","nonce":"0x100000","balance":"0x2386f26fc10000","address":"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"}},"transactions":[],"selectedAddress":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","network":"2","seedWords":null,"unconfMsgs":{},"messages":[],"provider":{"type":"testnet"},"selectedAddress":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"},"appState":{"menuOpen":false,"currentView":{"name":"confTx","context":0},"accountDetail":{"subview":"transactions"},"currentDomain":"extensions","transForward":true,"isLoading":false,"warning":null},"identities":{}}

File diff suppressed because one or more lines are too long

View File

@ -26,6 +26,9 @@ const firstTimeState = require('./app/scripts/first-time-state')
const extension = require('./development/mockExtension')
const noop = function () {}
const log = require('loglevel')
window.log = log
log.setLevel('debug')
//
// Query String

View File

@ -67,6 +67,7 @@
"iframe-stream": "^1.0.2",
"inject-css": "^0.1.1",
"jazzicon": "^1.2.0",
"loglevel": "^1.4.1",
"menu-droppo": "^1.1.0",
"metamask-logo": "^2.1.2",
"mississippi": "^1.2.0",
@ -105,7 +106,7 @@
"valid-url": "^1.0.9",
"vreme": "^3.0.2",
"web3": "0.18.2",
"web3-provider-engine": "^8.5.0",
"web3-provider-engine": "^9.1.0",
"web3-stream-provider": "^2.0.6",
"xtend": "^4.0.1"
},

View File

@ -1,5 +1,11 @@
var log = require('loglevel')
log.setDefaultLevel(5)
require('jsdom-global')()
window.localStorage = {}
if (!('crypto' in window)) { window.crypto = {} }
window.crypto.getRandomValues = require('polyfill-crypto.getrandomvalues')
window.log = log
global.log = log

View File

@ -9,6 +9,23 @@ QUnit.test('render init screen', function (assert) {
wait().then(function() {
app = $('iframe').contents().find('#app-content .mock-app-root')
const recurseNotices = function () {
let button = app.find('button')
if (button.html() === 'Continue') {
let termsPage = app.find('.markdown')[0]
termsPage.scrollTop = termsPage.scrollHeight
return wait().then(() => {
button.click()
return wait()
}).then(() => {
return recurseNotices()
})
} else {
return wait()
}
}
return recurseNotices()
}).then(function() {
// Scroll through terms
var title = app.find('h1').text()
assert.equal(title, 'MetaMask', 'title screen')

View File

@ -22,6 +22,11 @@ const configureStore = require('./development/uiStore')
const states = require('./development/states')
const Selector = require('./development/selector')
// logger
const log = require('loglevel')
window.log = log
log.setDefaultLevel(1)
// Query String
const qs = require('qs')
let queryString = qs.parse(window.location.href.split('#')[1])

View File

@ -350,13 +350,15 @@ App.prototype.renderPrimary = function () {
var props = this.props
// notices
if (!props.noActiveNotices && !global.METAMASK_DEBUG) {
if (!props.noActiveNotices) {
log.debug('rendering notice screen for unread notices.')
return h(NoticeScreen, {
notice: props.lastUnreadNotice,
key: 'NoticeScreen',
onConfirm: () => props.dispatch(actions.markNoticeRead(props.lastUnreadNotice)),
})
} else if (props.lostAccounts && props.lostAccounts.length > 0) {
log.debug('rendering notice screen for lost accounts view.')
return h(NoticeScreen, {
notice: generateLostAccountsNotice(props.lostAccounts),
key: 'LostAccountsNotice',
@ -365,18 +367,22 @@ App.prototype.renderPrimary = function () {
}
if (props.seedWords) {
log.debug('rendering seed words')
return h(HDCreateVaultComplete, {key: 'HDCreateVaultComplete'})
}
// show initialize screen
if (!props.isInitialized || props.forgottenPassword) {
// show current view
log.debug('rendering an initialize screen')
switch (props.currentView.name) {
case 'restoreVault':
log.debug('rendering restore vault screen')
return h(HDRestoreVaultScreen, {key: 'HDRestoreVaultScreen'})
default:
log.debug('rendering menu screen')
return h(InitializeMenuScreen, {key: 'menuScreenInit'})
}
}
@ -386,9 +392,11 @@ App.prototype.renderPrimary = function () {
switch (props.currentView.name) {
case 'restoreVault':
log.debug('rendering restore vault screen')
return h(HDRestoreVaultScreen, {key: 'HDRestoreVaultScreen'})
default:
log.debug('rendering locked screen')
return h(UnlockScreen, {key: 'locked'})
}
}
@ -397,36 +405,47 @@ App.prototype.renderPrimary = function () {
switch (props.currentView.name) {
case 'accounts':
log.debug('rendering accounts screen')
return h(AccountsScreen, {key: 'accounts'})
case 'accountDetail':
log.debug('rendering account detail screen')
return h(AccountDetailScreen, {key: 'account-detail'})
case 'sendTransaction':
log.debug('rendering send tx screen')
return h(SendTransactionScreen, {key: 'send-transaction'})
case 'newKeychain':
log.debug('rendering new keychain screen')
return h(NewKeyChainScreen, {key: 'new-keychain'})
case 'confTx':
log.debug('rendering confirm tx screen')
return h(ConfirmTxScreen, {key: 'confirm-tx'})
case 'config':
log.debug('rendering config screen')
return h(ConfigScreen, {key: 'config'})
case 'import-menu':
log.debug('rendering import screen')
return h(Import, {key: 'import-menu'})
case 'reveal-seed-conf':
log.debug('rendering reveal seed confirmation screen')
return h(RevealSeedConfirmation, {key: 'reveal-seed-conf'})
case 'info':
log.debug('rendering info screen')
return h(InfoScreen, {key: 'info'})
case 'buyEth':
log.debug('rendering buy ether screen')
return h(BuyView, {key: 'buyEthView'})
case 'qr':
log.debug('rendering show qr screen')
return h('div', {
style: {
position: 'absolute',
@ -454,6 +473,7 @@ App.prototype.renderPrimary = function () {
])
default:
log.debug('rendering default, account detail screen')
return h(AccountDetailScreen, {key: 'account-detail'})
}
}

View File

@ -15,10 +15,12 @@ function Notice () {
Notice.prototype.render = function () {
const { notice, onConfirm } = this.props
const { title, date, body } = notice
const state = this.state || { disclaimerDisabled: true }
const disabled = state.disclaimerDisabled
return (
h('.flex-column.flex-center.flex-grow', [
h('h3.flex-center.text-transform-uppercacse.terms-header', {
h('h3.flex-center.text-transform-uppercase.terms-header', {
style: {
background: '#EBEBEB',
color: '#AEAEAE',
@ -31,7 +33,7 @@ Notice.prototype.render = function () {
title,
]),
h('h5.flex-center.text-transform-uppercacse.terms-header', {
h('h5.flex-center.text-transform-uppercase.terms-header', {
style: {
background: '#EBEBEB',
color: '#AEAEAE',
@ -74,6 +76,12 @@ Notice.prototype.render = function () {
`),
h('div.markdown', {
onScroll: (e) => {
var object = e.currentTarget
if (object.offsetHeight + object.scrollTop + 100 >= object.scrollHeight) {
this.setState({disclaimerDisabled: false})
}
},
style: {
background: 'rgb(235, 235, 235)',
height: '310px',
@ -90,6 +98,7 @@ Notice.prototype.render = function () {
]),
h('button', {
disabled,
onClick: onConfirm,
style: {
marginTop: '18px',

View File

@ -47,6 +47,8 @@ ConfirmTxScreen.prototype.render = function () {
var txData = unconfTxList[index] || {}
var txParams = txData.params || {}
var isNotification = isPopupOrNotification() === 'notification'
log.info(`rendering a combined ${unconfTxList.length} unconf msg & txs`)
if (unconfTxList.length === 0) return null
return (
@ -120,11 +122,14 @@ function currentTxView (opts) {
const { txData } = opts
const { txParams, msgParams } = txData
log.info('rendering current tx view')
if (txParams) {
// This is a pending transaction
log.debug('txParams detected, rendering pending tx')
return h(PendingTx, opts)
} else if (msgParams) {
// This is a pending message to sign
log.debug('msgParams detected, rendering pending msg')
return h(PendingMsg, opts)
}
}

View File

@ -6,6 +6,10 @@ const configureStore = require('./app/store')
const txHelper = require('./lib/tx-helper')
module.exports = launchApp
const log = require('loglevel')
window.log = log
log.setLevel('warn')
function launchApp (opts) {
var accountManager = opts.accountManager
actions._setBackgroundConnection(accountManager)

View File

@ -1,8 +1,13 @@
const valuesFor = require('../app/util').valuesFor
module.exports = function (unapprovedTxs, unapprovedMsgs, network) {
log.debug('tx-helper called with params:')
log.debug({ unapprovedTxs, unapprovedMsgs, network })
var txValues = network ? valuesFor(unapprovedTxs).filter(tx => tx.txParams.metamaskNetworkId === network) : valuesFor(unapprovedTxs)
log.debug(`tx helper found ${txValues.length} unapproved txs`)
var msgValues = valuesFor(unapprovedMsgs)
log.debug(`tx helper found ${msgValues.length} unsigned messages`)
var allValues = txValues.concat(msgValues)
return allValues.sort(tx => tx.time)
}