1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Fix conflict

This commit is contained in:
Frankie 2016-06-21 15:04:00 -07:00
commit cf663f1104
76 changed files with 2542 additions and 2516 deletions

151
.eslintrc Normal file
View File

@ -0,0 +1,151 @@
{
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"impliedStrict": true,
"modules": true,
"blockBindings": true,
"arrowFunctions": true,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"templateStrings": true
},
},
"env": {
"es6": true,
"node": true,
"browser": true
},
"plugins": [
],
"globals": {
"chrome": true,
"document": false,
"navigator": false,
"web3": true,
"window": false
},
"rules": {
"accessor-pairs": 2,
"arrow-spacing": [2, { "before": true, "after": true }],
"block-spacing": [2, "always"],
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
"camelcase": [2, { "properties": "never" }],
"comma-dangle": [2, "always-multiline"],
"comma-spacing": [2, { "before": false, "after": true }],
"comma-style": [2, "last"],
"constructor-super": 2,
"curly": [2, "multi-line"],
"dot-location": [2, "property"],
"eol-last": 2,
"eqeqeq": [2, "allow-null"],
"generator-star-spacing": [2, { "before": true, "after": true }],
"handle-callback-err": [2, "^(err|error)$" ],
"indent": [2, 2, { "SwitchCase": 1 }],
"jsx-quotes": [2, "prefer-single"],
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
"keyword-spacing": [2, { "before": true, "after": true }],
"new-cap": [2, { "newIsCap": true, "capIsNew": false }],
"new-parens": 2,
"no-array-constructor": 2,
"no-caller": 2,
"no-class-assign": 2,
"no-cond-assign": 2,
"no-const-assign": 2,
"no-control-regex": 2,
"no-debugger": 2,
"no-delete-var": 2,
"no-dupe-args": 2,
"no-dupe-class-members": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-duplicate-imports": 2,
"no-empty-character-class": 2,
"no-empty-pattern": 2,
"no-eval": 2,
"no-ex-assign": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-extra-boolean-cast": 2,
"no-extra-parens": [2, "functions"],
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-func-assign": 2,
"no-implied-eval": 2,
"no-inner-declarations": [2, "functions"],
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-iterator": 2,
"no-label-var": 2,
"no-labels": [2, { "allowLoop": false, "allowSwitch": false }],
"no-lone-blocks": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-multiple-empty-lines": [2, { "max": 1 }],
"no-native-reassign": 2,
"no-negated-in-lhs": 2,
"no-new": 2,
"no-new-func": 2,
"no-new-object": 2,
"no-new-require": 2,
"no-new-symbol": 2,
"no-new-wrappers": 2,
"no-obj-calls": 2,
"no-octal": 2,
"no-octal-escape": 2,
"no-path-concat": 2,
"no-proto": 2,
"no-redeclare": 2,
"no-regex-spaces": 2,
"no-return-assign": [2, "except-parens"],
"no-self-assign": 2,
"no-self-compare": 2,
"no-sequences": 2,
"no-shadow-restricted-names": 2,
"no-spaced-func": 2,
"no-sparse-arrays": 2,
"no-this-before-super": 2,
"no-throw-literal": 2,
"no-trailing-spaces": 2,
"no-undef": 2,
"no-undef-init": 2,
"no-unexpected-multiline": 2,
"no-unmodified-loop-condition": 2,
"no-unneeded-ternary": [2, { "defaultAssignment": false }],
"no-unreachable": 2,
"no-unsafe-finally": 2,
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
"no-useless-call": 2,
"no-useless-computed-key": 2,
"no-useless-constructor": 2,
"no-useless-escape": 2,
"no-whitespace-before-property": 2,
"no-with": 2,
"one-var": [2, { "initialized": "never" }],
"operator-linebreak": [2, "after", { "overrides": { "?": "before", ":": "before" } }],
"padded-blocks": [2, "never"],
"quotes": [2, "single", "avoid-escape"],
"semi": [2, "never"],
"semi-spacing": [2, { "before": false, "after": true }],
"space-before-blocks": [1, "always"],
"space-before-function-paren": [1, "always"],
"space-in-parens": [2, "never"],
"space-infix-ops": 2,
"space-unary-ops": [2, { "words": true, "nonwords": false }],
"spaced-comment": [2, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }],
"strict": 0,
"template-curly-spacing": [2, "never"],
"use-isnan": 2,
"valid-typeof": 2,
"wrap-iife": [2, "any"],
"yield-star-spacing": [2, "both"],
"yoda": [2, "never"],
"prefer-const": 1
}
}

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
6.0

View File

@ -1,4 +1,4 @@
# Metamask Plugin [![Build Status](https://travis-ci.com/MetaMask/metamask-plugin.svg?token=3txzDGFpqQqvRCdgwTJp&branch=master)](https://travis-ci.com/MetaMask/metamask-plugin) # Metamask Plugin [![Build Status](https://circleci.com/gh/MetaMask/metamask-plugin.svg?style=shield&circle-token=a1ddcf3cd38e29267f254c9c59d556d513e3a1fd)](https://circleci.com/gh/MetaMask/metamask-plugin)
## Architecture ## Architecture
@ -54,6 +54,8 @@ Then just run `npm test`.
You can also test with a continuously watching process, via `npm run watch`. You can also test with a continuously watching process, via `npm run watch`.
You can run the linter by itself with `gulp lint`.
### Deploying the UI ### Deploying the UI
You must be authorized already on the Metamask plugin. You must be authorized already on the Metamask plugin.

View File

@ -1,11 +1,9 @@
const urlUtil = require('url') const urlUtil = require('url')
const Dnode = require('dnode') const Dnode = require('dnode')
const eos = require('end-of-stream') const eos = require('end-of-stream')
const combineStreams = require('pumpify')
const extend = require('xtend') const extend = require('xtend')
const EthStore = require('eth-store') const EthStore = require('eth-store')
const MetaMaskProvider = require('web3-provider-engine/zero.js') const MetaMaskProvider = require('web3-provider-engine/zero.js')
const ObjectMultiplex = require('./lib/obj-multiplex')
const PortStream = require('./lib/port-stream.js') const PortStream = require('./lib/port-stream.js')
const IdentityStore = require('./lib/idStore') const IdentityStore = require('./lib/idStore')
const createUnlockRequestNotification = require('./lib/notifications.js').createUnlockRequestNotification const createUnlockRequestNotification = require('./lib/notifications.js').createUnlockRequestNotification
@ -55,7 +53,6 @@ function setupTrustedCommunication(connectionStream, originDomain){
// state and network // state and network
// //
var providerConfig = configManager.getProvider()
var idStore = new IdentityStore() var idStore = new IdentityStore()
var providerOpts = { var providerOpts = {
@ -141,7 +138,6 @@ function storeSetFromObj(store, obj){
}) })
} }
// //
// remote features // remote features
// //
@ -152,8 +148,10 @@ function setupPublicConfig(stream){
} }
function setupProviderConnection (stream, originDomain) { function setupProviderConnection (stream, originDomain) {
// decorate all payloads with origin domain
stream.on('data', function onRpcRequest(payload){ stream.on('data', function onRpcRequest (request) {
var payloads = Array.isArray(request) ? request : [request]
payloads.forEach(function (payload) {
// Append origin to rpc payload // Append origin to rpc payload
payload.origin = originDomain payload.origin = originDomain
// Append origin to signature request // Append origin to signature request
@ -162,9 +160,13 @@ function setupProviderConnection(stream, originDomain){
} else if (payload.method === 'eth_sign') { } else if (payload.method === 'eth_sign') {
payload.params.push({ origin: originDomain }) payload.params.push({ origin: originDomain })
} }
})
// handle rpc request // handle rpc request
provider.sendAsync(payload, function onPayloadHandled(err, response){ provider.sendAsync(request, function onPayloadHandled (err, response) {
logger(null, payload, response) if (err) {
return logger(err)
}
logger(null, request, response)
try { try {
stream.write(response) stream.write(response)
} catch (err) { } catch (err) {
@ -208,7 +210,6 @@ function setupControllerConnection(stream){
}) })
stream.pipe(dnode).pipe(stream) stream.pipe(dnode).pipe(stream)
dnode.on('remote', function (remote) { dnode.on('remote', function (remote) {
// push updates to popup // push updates to popup
ethStore.on('update', sendUpdate) ethStore.on('update', sendUpdate)
idStore.on('update', sendUpdate) idStore.on('update', sendUpdate)
@ -220,7 +221,6 @@ function setupControllerConnection(stream){
var state = getState() var state = getState()
remote.sendUpdate(state) remote.sendUpdate(state)
} }
}) })
} }
@ -266,7 +266,6 @@ function newUnsignedMessage(msgParams, cb){
createUnlockRequestNotification({ createUnlockRequestNotification({
title: 'Account Unlock Request', title: 'Account Unlock Request',
}) })
var msgId = idStore.addUnconfirmedMessage(msgParams, cb)
} else { } else {
addUnconfirmedMsg(msgParams, cb) addUnconfirmedMsg(msgParams, cb)
} }

File diff suppressed because it is too large Load Diff

View File

@ -2,8 +2,6 @@ const LocalMessageDuplexStream = require('./lib/local-message-stream.js')
const PortStream = require('./lib/port-stream.js') const PortStream = require('./lib/port-stream.js')
const ObjectMultiplex = require('./lib/obj-multiplex') const ObjectMultiplex = require('./lib/obj-multiplex')
// inject in-page script // inject in-page script
var scriptTag = document.createElement('script') var scriptTag = document.createElement('script')
scriptTag.src = chrome.extension.getURL('scripts/inpage.js') scriptTag.src = chrome.extension.getURL('scripts/inpage.js')

View File

@ -8,7 +8,6 @@ restoreContextAfterImports()
// remove from window // remove from window
delete window.Web3 delete window.Web3
// //
// setup plugin communication // setup plugin communication
// //
@ -51,7 +50,7 @@ inpageProvider.publicConfigStore.subscribe(function(state){
// need to make sure we aren't affected by overlapping namespaces // need to make sure we aren't affected by overlapping namespaces
// and that we dont affect the app with our namespace // and that we dont affect the app with our namespace
// mostly a fix for web3's BigNumber if AMD's "define" is defined... // mostly a fix for web3's BigNumber if AMD's "define" is defined...
var __define = undefined var __define
function cleanContextForImports () { function cleanContextForImports () {
__define = global.define __define = global.define

View File

@ -1,11 +1,9 @@
var uri = 'https://faucet.metamask.io/' var uri = 'https://faucet.metamask.io/'
module.exports = function (address) { module.exports = function (address) {
var http = new XMLHttpRequest() var http = new XMLHttpRequest()
var data = address var data = address
http.open('POST', uri, true) http.open('POST', uri, true)
http.setRequestHeader('Content-type', 'application/rawdata') http.setRequestHeader('Content-type', 'application/rawdata')
http.send(data) http.send(data)
} }

View File

@ -3,9 +3,7 @@ const ensnare = require('./ensnare.js')
module.exports = setupDappAutoReload module.exports = setupDappAutoReload
function setupDappAutoReload (web3, controlStream) { function setupDappAutoReload (web3, controlStream) {
// export web3 as a global, checking for usage // export web3 as a global, checking for usage
var pageIsUsingWeb3 = false var pageIsUsingWeb3 = false
var resetWasRequested = false var resetWasRequested = false
@ -33,5 +31,4 @@ function setupDappAutoReload(web3, controlStream){
global.location.reload() global.location.reload()
}, 500) }, 500)
} }
} }

View File

@ -7,7 +7,6 @@ const STORAGE_KEY = 'metamask-config'
const TESTNET_RPC = MetamaskConfig.network.testnet const TESTNET_RPC = MetamaskConfig.network.testnet
const MAINNET_RPC = MetamaskConfig.network.mainnet const MAINNET_RPC = MetamaskConfig.network.mainnet
/* The config-manager is a convenience object /* The config-manager is a convenience object
* wrapping a pojo-migrator. * wrapping a pojo-migrator.
* *
@ -62,7 +61,7 @@ ConfigManager.prototype.getConfig = function() {
return { return {
provider: { provider: {
type: 'testnet', type: 'testnet',
} },
} }
} }
} }
@ -234,17 +233,17 @@ ConfigManager.prototype.updateTx = function(tx) {
ConfigManager.prototype.getWalletNicknames = function () { ConfigManager.prototype.getWalletNicknames = function () {
var data = this.getData() var data = this.getData()
let nicknames = ('walletNicknames' in data) ? data.walletNicknames : {} const nicknames = ('walletNicknames' in data) ? data.walletNicknames : {}
return nicknames return nicknames
} }
ConfigManager.prototype.nicknameForWallet = function (account) { ConfigManager.prototype.nicknameForWallet = function (account) {
let nicknames = this.getWalletNicknames() const nicknames = this.getWalletNicknames()
return nicknames[account] return nicknames[account]
} }
ConfigManager.prototype.setNicknameForWallet = function (account, nickname) { ConfigManager.prototype.setNicknameForWallet = function (account, nickname) {
let nicknames = this.getWalletNicknames() const nicknames = this.getWalletNicknames()
nicknames[account] = nickname nicknames[account] = nickname
var data = this.getData() var data = this.getData()
data.walletNicknames = nicknames data.walletNicknames = nicknames
@ -281,9 +280,7 @@ ConfigManager.prototype.getConfirmed = function() {
return ('isConfirmed' in data) && data.isConfirmed return ('isConfirmed' in data) && data.isConfirmed
} }
function loadData () { function loadData () {
var oldData = getOldStyleData() var oldData = getOldStyleData()
var newData var newData
try { try {
@ -298,10 +295,10 @@ function loadData() {
config: { config: {
provider: { provider: {
type: 'testnet', type: 'testnet',
} },
} },
} },
}, oldData ? oldData : null, newData ? newData : null) }, oldData || null, newData || null)
return data return data
} }

View File

@ -15,7 +15,7 @@ function ensnare(obj, cb){
default: default:
Object.defineProperty(proxy, key, { Object.defineProperty(proxy, key, {
get: function () { cb(); return obj[key] }, get: function () { cb(); return obj[key] },
set: function(val){ cb(); return obj[key] = val }, set: function (val) { cb(); obj[key] = val; return val },
}) })
return return
} }

View File

@ -4,7 +4,6 @@ const configManager = require('./config-manager-singleton')
module.exports = IdManagement module.exports = IdManagement
function IdManagement (opts) { function IdManagement (opts) {
if (!opts) opts = {} if (!opts) opts = {}
@ -13,7 +12,7 @@ function IdManagement(opts) {
this.hdPathString = "m/44'/60'/0'/0" this.hdPathString = "m/44'/60'/0'/0"
this.getAddresses = function () { this.getAddresses = function () {
return keyStore.getAddresses(this.hdPathString).map(function(address){ return '0x'+address }) return this.keyStore.getAddresses(this.hdPathString).map(function (address) { return '0x' + address })
} }
this.signTx = function (txParams) { this.signTx = function (txParams) {
@ -44,12 +43,12 @@ function IdManagement(opts) {
this.signMsg = function (address, message) { this.signMsg = function (address, message) {
// sign message // sign message
var privKeyHex = this.exportPrivateKey(address); var privKeyHex = this.exportPrivateKey(address)
var privKey = ethUtil.toBuffer(privKeyHex); var privKey = ethUtil.toBuffer(privKeyHex)
var msgSig = ethUtil.ecsign(new Buffer(message.replace('0x',''), 'hex'), privKey); var msgSig = ethUtil.ecsign(new Buffer(message.replace('0x', ''), 'hex'), privKey)
var rawMsgSig = ethUtil.bufferToHex(concatSig(msgSig.v, msgSig.r, msgSig.s)); var rawMsgSig = ethUtil.bufferToHex(concatSig(msgSig.v, msgSig.r, msgSig.s))
return rawMsgSig; return rawMsgSig
}; }
this.getSeed = function () { this.getSeed = function () {
return this.keyStore.getSeed(this.derivedKey) return this.keyStore.getSeed(this.derivedKey)
@ -61,17 +60,17 @@ function IdManagement(opts) {
} }
} }
function pad_with_zeroes(number, length){ function padWithZeroes (number, length) {
var my_string = '' + number; var myString = '' + number
while (my_string.length < length) { while (myString.length < length) {
my_string = '0' + my_string; myString = '0' + myString
} }
return my_string; return myString
} }
function concatSig (v, r, s) { function concatSig (v, r, s) {
r = pad_with_zeroes(ethUtil.fromSigned(r), 64) r = padWithZeroes(ethUtil.fromSigned(r), 64)
s = pad_with_zeroes(ethUtil.fromSigned(s), 64) s = padWithZeroes(ethUtil.fromSigned(s), 64)
r = ethUtil.stripHexPrefix(r.toString('hex')) r = ethUtil.stripHexPrefix(r.toString('hex'))
s = ethUtil.stripHexPrefix(s.toString('hex')) s = ethUtil.stripHexPrefix(s.toString('hex'))
v = ethUtil.stripHexPrefix(ethUtil.intToHex(v)) v = ethUtil.stripHexPrefix(ethUtil.intToHex(v))

View File

@ -1,10 +1,7 @@
const EventEmitter = require('events').EventEmitter const EventEmitter = require('events').EventEmitter
const inherits = require('util').inherits const inherits = require('util').inherits
const Transaction = require('ethereumjs-tx')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const LightwalletKeyStore = require('eth-lightwallet').keystore const LightwalletKeyStore = require('eth-lightwallet').keystore
const LightwalletSigner = require('eth-lightwallet').signing
const async = require('async')
const clone = require('clone') const clone = require('clone')
const extend = require('xtend') const extend = require('xtend')
const createId = require('web3-provider-engine/util/random-id') const createId = require('web3-provider-engine/util/random-id')
@ -15,10 +12,8 @@ const messageManager = require('./message-manager')
const DEFAULT_RPC = 'https://testrpc.metamask.io/' const DEFAULT_RPC = 'https://testrpc.metamask.io/'
const IdManagement = require('./id-management') const IdManagement = require('./id-management')
module.exports = IdentityStore module.exports = IdentityStore
inherits(IdentityStore, EventEmitter) inherits(IdentityStore, EventEmitter)
function IdentityStore (opts = {}) { function IdentityStore (opts = {}) {
EventEmitter.call(this) EventEmitter.call(this)
@ -90,7 +85,6 @@ IdentityStore.prototype.clearSeedWordCache = function(cb) {
IdentityStore.prototype.getState = function () { IdentityStore.prototype.getState = function () {
var seedWords = this.getSeedIfUnlocked() var seedWords = this.getSeedIfUnlocked()
var wallet = configManager.getWallet()
return clone(extend(this._currentState, { return clone(extend(this._currentState, {
isInitialized: !!configManager.getWallet() && !seedWords, isInitialized: !!configManager.getWallet() && !seedWords,
isUnlocked: this._isUnlocked(), isUnlocked: this._isUnlocked(),
@ -127,7 +121,6 @@ IdentityStore.prototype.setSelectedAddress = function(address, cb){
} }
IdentityStore.prototype.revealAccount = function (cb) { IdentityStore.prototype.revealAccount = function (cb) {
let addresses = this._getAddresses()
const derivedKey = this._idmgmt.derivedKey const derivedKey = this._idmgmt.derivedKey
const keyStore = this._keyStore const keyStore = this._keyStore
@ -135,14 +128,12 @@ IdentityStore.prototype.revealAccount = function(cb) {
keyStore.generateNewAddress(derivedKey, 1) keyStore.generateNewAddress(derivedKey, 1)
configManager.setWallet(keyStore.serialize()) configManager.setWallet(keyStore.serialize())
addresses = this._getAddresses()
this._loadIdentities() this._loadIdentities()
this._didUpdate() this._didUpdate()
cb(null) cb(null)
} }
IdentityStore.prototype.getNetwork = function (err) { IdentityStore.prototype.getNetwork = function (err) {
if (err) { if (err) {
this._currentState.network = 'loading' this._currentState.network = 'loading'
this._didUpdate() this._didUpdate()
@ -232,12 +223,10 @@ IdentityStore.prototype.addUnconfirmedTransaction = function(txParams, onTxDoneC
// signal completion of add tx // signal completion of add tx
cb(null, txData) cb(null, txData)
} }
} }
// comes from metamask ui // comes from metamask ui
IdentityStore.prototype.approveTransaction = function (txId, cb) { IdentityStore.prototype.approveTransaction = function (txId, cb) {
var txData = configManager.getTx(txId)
var approvalCb = this._unconfTxCbs[txId] || noop var approvalCb = this._unconfTxCbs[txId] || noop
// accept tx // accept tx
@ -251,7 +240,6 @@ IdentityStore.prototype.approveTransaction = function(txId, cb){
// comes from metamask ui // comes from metamask ui
IdentityStore.prototype.cancelTransaction = function (txId) { IdentityStore.prototype.cancelTransaction = function (txId) {
var txData = configManager.getTx(txId)
var approvalCb = this._unconfTxCbs[txId] || noop var approvalCb = this._unconfTxCbs[txId] || noop
// reject tx // reject tx
@ -279,7 +267,6 @@ IdentityStore.prototype.signTransaction = function(txParams, cb){
// comes from dapp via zero-client hooked-wallet provider // comes from dapp via zero-client hooked-wallet provider
IdentityStore.prototype.addUnconfirmedMessage = function (msgParams, cb) { IdentityStore.prototype.addUnconfirmedMessage = function (msgParams, cb) {
// create txData obj with parameters and meta data // create txData obj with parameters and meta data
var time = (new Date()).getTime() var time = (new Date()).getTime()
var msgId = createId() var msgId = createId()
@ -304,7 +291,6 @@ IdentityStore.prototype.addUnconfirmedMessage = function(msgParams, cb){
// comes from metamask ui // comes from metamask ui
IdentityStore.prototype.approveMessage = function (msgId, cb) { IdentityStore.prototype.approveMessage = function (msgId, cb) {
var msgData = messageManager.getMsg(msgId)
var approvalCb = this._unconfMsgCbs[msgId] || noop var approvalCb = this._unconfMsgCbs[msgId] || noop
// accept msg // accept msg
@ -318,7 +304,6 @@ IdentityStore.prototype.approveMessage = function(msgId, cb){
// comes from metamask ui // comes from metamask ui
IdentityStore.prototype.cancelMessage = function (msgId) { IdentityStore.prototype.cancelMessage = function (msgId) {
var txData = messageManager.getMsg(msgId)
var approvalCb = this._unconfMsgCbs[msgId] || noop var approvalCb = this._unconfMsgCbs[msgId] || noop
// reject tx // reject tx
@ -448,7 +433,7 @@ IdentityStore.prototype._createIdmgmt = function(password, seed, entropy, cb){
IdentityStore.prototype._restoreFromSeed = function (password, seed, derivedKey) { IdentityStore.prototype._restoreFromSeed = function (password, seed, derivedKey) {
var keyStore = new LightwalletKeyStore(seed, derivedKey, this.hdPathString) var keyStore = new LightwalletKeyStore(seed, derivedKey, this.hdPathString)
keyStore.addHdDerivationPath(this.hdPathString, derivedKey, {curve: 'secp256k1', purpose: 'sign'}); keyStore.addHdDerivationPath(this.hdPathString, derivedKey, {curve: 'secp256k1', purpose: 'sign'})
keyStore.setDefaultHdDerivationPath(this.hdPathString) keyStore.setDefaultHdDerivationPath(this.hdPathString)
keyStore.generateNewAddress(derivedKey, 3) keyStore.generateNewAddress(derivedKey, 3)
@ -460,7 +445,7 @@ IdentityStore.prototype._restoreFromSeed = function(password, seed, derivedKey)
IdentityStore.prototype._createFirstWallet = function (entropy, derivedKey) { IdentityStore.prototype._createFirstWallet = function (entropy, derivedKey) {
var secretSeed = LightwalletKeyStore.generateRandomSeed(entropy) var secretSeed = LightwalletKeyStore.generateRandomSeed(entropy)
var keyStore = new LightwalletKeyStore(secretSeed, derivedKey, this.hdPathString) var keyStore = new LightwalletKeyStore(secretSeed, derivedKey, this.hdPathString)
keyStore.addHdDerivationPath(this.hdPathString, derivedKey, {curve: 'secp256k1', purpose: 'sign'}); keyStore.addHdDerivationPath(this.hdPathString, derivedKey, {curve: 'secp256k1', purpose: 'sign'})
keyStore.setDefaultHdDerivationPath(this.hdPathString) keyStore.setDefaultHdDerivationPath(this.hdPathString)
keyStore.generateNewAddress(derivedKey, 3) keyStore.generateNewAddress(derivedKey, 3)

View File

@ -7,7 +7,6 @@ const MetamaskConfig = require('../config.js')
module.exports = MetamaskInpageProvider module.exports = MetamaskInpageProvider
function MetamaskInpageProvider (connectionStream) { function MetamaskInpageProvider (connectionStream) {
const self = this const self = this
@ -49,19 +48,20 @@ function MetamaskInpageProvider(connectionStream){
MetamaskInpageProvider.prototype.send = function (payload) { MetamaskInpageProvider.prototype.send = function (payload) {
const self = this const self = this
let selectedAddress
var result = null var result = null
switch (payload.method) { switch (payload.method) {
case 'eth_accounts': case 'eth_accounts':
// read from localStorage // read from localStorage
var selectedAddress = self.publicConfigStore.get('selectedAddress') selectedAddress = self.publicConfigStore.get('selectedAddress')
result = selectedAddress ? [selectedAddress] : [] result = selectedAddress ? [selectedAddress] : []
break break
case 'eth_coinbase': case 'eth_coinbase':
// read from localStorage // read from localStorage
var selectedAddress = self.publicConfigStore.get('selectedAddress') selectedAddress = self.publicConfigStore.get('selectedAddress')
result = selectedAddress || '0x0000000000000000000000000000000000000000' result = selectedAddress || '0x0000000000000000000000000000000000000000'
break break
@ -91,7 +91,7 @@ MetamaskInpageProvider.prototype.isConnected = function(){
function createSyncProvider (providerConfig) { function createSyncProvider (providerConfig) {
providerConfig = providerConfig || {} providerConfig = providerConfig || {}
var syncProviderUrl = undefined let syncProviderUrl
if (providerConfig.rpcTarget) { if (providerConfig.rpcTarget) {
syncProviderUrl = providerConfig.rpcTarget syncProviderUrl = providerConfig.rpcTarget

View File

@ -3,7 +3,6 @@ const inherits = require('util').inherits
module.exports = LocalMessageDuplexStream module.exports = LocalMessageDuplexStream
inherits(LocalMessageDuplexStream, Duplex) inherits(LocalMessageDuplexStream, Duplex)
function LocalMessageDuplexStream (opts) { function LocalMessageDuplexStream (opts) {

View File

@ -11,7 +11,6 @@ module.exports = {
setupListeners() setupListeners()
function setupListeners () { function setupListeners () {
// guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236 // guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236
if (!chrome.notifications) return console.error('Chrome notifications API missing...') if (!chrome.notifications) return console.error('Chrome notifications API missing...')
@ -30,7 +29,6 @@ function setupListeners(){
chrome.notifications.onClosed.addListener(function (notificationId) { chrome.notifications.onClosed.addListener(function (notificationId) {
delete notificationHandlers[notificationId] delete notificationHandlers[notificationId]
}) })
} }
// creation helper // creation helper
@ -46,7 +44,6 @@ function createUnlockRequestNotification(opts){
title: opts.title, title: opts.title,
message: message, message: message,
}) })
} }
function createTxNotification (opts) { function createTxNotification (opts) {
@ -71,7 +68,7 @@ function createTxNotification(opts){
title: 'confirm', title: 'confirm',
}, { }, {
title: 'cancel', title: 'cancel',
}] }],
}) })
notificationHandlers[id] = { notificationHandlers[id] = {
confirm: opts.confirm, confirm: opts.confirm,
@ -99,7 +96,7 @@ function createMsgNotification(opts){
title: 'confirm', title: 'confirm',
}, { }, {
title: 'cancel', title: 'cancel',
}] }],
}) })
notificationHandlers[id] = { notificationHandlers[id] = {
confirm: opts.confirm, confirm: opts.confirm,

View File

@ -2,7 +2,6 @@ const through = require('through2')
module.exports = ObjectMultiplex module.exports = ObjectMultiplex
function ObjectMultiplex (opts) { function ObjectMultiplex (opts) {
opts = opts || {} opts = opts || {}
// create multiplexer // create multiplexer

View File

@ -3,7 +3,6 @@ const inherits = require('util').inherits
module.exports = PortDuplexStream module.exports = PortDuplexStream
inherits(PortDuplexStream, Duplex) inherits(PortDuplexStream, Duplex)
function PortDuplexStream (port) { function PortDuplexStream (port) {

View File

@ -1,7 +1,6 @@
const Through = require('through2') const Through = require('through2')
const ObjectMultiplex = require('./obj-multiplex') const ObjectMultiplex = require('./obj-multiplex')
module.exports = { module.exports = {
jsonParseStream: jsonParseStream, jsonParseStream: jsonParseStream,
jsonStringifyStream: jsonStringifyStream, jsonStringifyStream: jsonStringifyStream,

View File

@ -9,5 +9,5 @@ module.exports = {
} }
} catch (e) {} } catch (e) {}
return data return data
} },
} }

View File

@ -11,5 +11,5 @@ module.exports = {
} }
} catch (e) {} } catch (e) {}
return data return data
} },
} }

View File

@ -7,16 +7,16 @@ module.exports = {
switch (data.config.provider.rpcTarget) { switch (data.config.provider.rpcTarget) {
case 'https://testrpc.metamask.io/': case 'https://testrpc.metamask.io/':
data.config.provider = { data.config.provider = {
type: 'testnet' type: 'testnet',
} }
break break
case 'https://rpc.metamask.io/': case 'https://rpc.metamask.io/':
data.config.provider = { data.config.provider = {
type: 'mainnet' type: 'mainnet',
} }
break break
} }
} catch (_) {} } catch (_) {}
return data return data
} },
} }

View File

@ -69,12 +69,11 @@ function setupApp(err, opts){
if (err) { if (err) {
alert(err.stack) alert(err.stack)
throw err throw err
return
} }
var container = document.getElementById('app-content') var container = document.getElementById('app-content')
var app = MetaMaskUi({ MetaMaskUi({
container: container, container: container,
accountManager: opts.accountManager, accountManager: opts.accountManager,
currentDomain: opts.currentDomain, currentDomain: opts.currentDomain,

3
circle.yml Normal file
View File

@ -0,0 +1,3 @@
machine:
node:
version: 6.0.0

View File

@ -9,6 +9,9 @@ var sourcemaps = require('gulp-sourcemaps')
var assign = require('lodash.assign') var assign = require('lodash.assign')
var livereload = require('gulp-livereload') var livereload = require('gulp-livereload')
var del = require('del') var del = require('del')
var eslint = require('gulp-eslint')
var fs = require('fs')
var path = require('path')
// browser reload // browser reload
@ -49,6 +52,25 @@ gulp.task('copy:watch', function(){
gulp.watch(['./app/{_locales,images}/*', './app/scripts/chromereload.js', './app/*.{html,json}'], gulp.series('copy')) gulp.watch(['./app/{_locales,images}/*', './app/scripts/chromereload.js', './app/*.{html,json}'], gulp.series('copy'))
}) })
// lint js
gulp.task('lint', function () {
// Ignoring node_modules, dist, and docs folders:
return gulp.src(['app/**/*.js', 'ui/**/*.js', '!node_modules/**', '!dist/**', '!docs/**', '!app/scripts/chromereload.js'])
.pipe(eslint(fs.readFileSync(path.join(__dirname, '.eslintrc'))))
// eslint.format() outputs the lint results to the console.
// Alternatively use eslint.formatEach() (see Docs).
.pipe(eslint.format())
// To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failAfterError last.
.pipe(eslint.failAfterError())
});
/*
gulp.task('default', ['lint'], function () {
// This will only run if the lint task is successful...
});
*/
// build js // build js

View File

@ -36,6 +36,7 @@
"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",
"gulp-eslint": "^2.0.0",
"hat": "0.0.3", "hat": "0.0.3",
"identicon.js": "^1.2.1", "identicon.js": "^1.2.1",
"inject-css": "^0.1.1", "inject-css": "^0.1.1",
@ -68,6 +69,7 @@
"xtend": "^4.0.1" "xtend": "^4.0.1"
}, },
"devDependencies": { "devDependencies": {
"babel-eslint": "^6.0.5",
"babel-preset-es2015": "^6.6.0", "babel-preset-es2015": "^6.6.0",
"babel-register": "^6.7.2", "babel-register": "^6.7.2",
"babelify": "^7.2.0", "babelify": "^7.2.0",
@ -87,6 +89,7 @@
"jshint-stylish": "~0.1.5", "jshint-stylish": "~0.1.5",
"lodash.assign": "^4.0.6", "lodash.assign": "^4.0.6",
"mocha": "^2.4.5", "mocha": "^2.4.5",
"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",
"sinon": "^1.17.3", "sinon": "^1.17.3",

View File

@ -0,0 +1,9 @@
// LINTING:
const lint = require('mocha-eslint');
const lintPaths = ['app/**/*.js', 'ui/**/*.js', '!node_modules/**', '!dist/**', '!docs/**', '!app/scripts/chromereload.js']
const lintOptions = {
strict: true,
}
lint(lintPaths, lintOptions)

View File

@ -40,8 +40,6 @@ AccountDetailScreen.prototype.render = function() {
var selected = props.address || Object.keys(props.accounts)[0] var selected = props.address || Object.keys(props.accounts)[0]
var identity = props.identities[selected] var identity = props.identities[selected]
var account = props.accounts[selected] var account = props.accounts[selected]
var accountDetail = props.accountDetail
var transactions = props.transactions
return ( return (
@ -88,7 +86,7 @@ AccountDetailScreen.prototype.render = function() {
style: { style: {
height: '62px', height: '62px',
paddingTop: '8px', paddingTop: '8px',
} },
}, [ }, [
h(EditableLabel, { h(EditableLabel, {
textValue: identity ? identity.name : '', textValue: identity ? identity.name : '',
@ -216,7 +214,7 @@ AccountDetailScreen.prototype.transactionList = function() {
unconfMsgs, unconfMsgs,
viewPendingTx: (txId) => { viewPendingTx: (txId) => {
this.props.dispatch(actions.viewPendingTx(txId)) this.props.dispatch(actions.viewPendingTx(txId))
} },
}) })
} }

View File

@ -9,7 +9,6 @@ const Identicon = require('../components/identicon')
module.exports = NewComponent module.exports = NewComponent
inherits(NewComponent, Component) inherits(NewComponent, Component)
function NewComponent () { function NewComponent () {
Component.call(this) Component.call(this)
@ -17,10 +16,8 @@ function NewComponent() {
NewComponent.prototype.render = function () { NewComponent.prototype.render = function () {
const identity = this.props.identity const identity = this.props.identity
var mayBeFauceting = identity.mayBeFauceting
var isSelected = this.props.selectedAddress === identity.address var isSelected = this.props.selectedAddress === identity.address
var account = this.props.accounts[identity.address] var account = this.props.accounts[identity.address]
var isFauceting = mayBeFauceting && account.balance === '0x0'
const selectedClass = isSelected ? '.selected' : '' const selectedClass = isSelected ? '.selected' : ''
return ( return (
@ -35,7 +32,7 @@ NewComponent.prototype.render = function() {
h('.identicon-wrapper.flex-column.flex-center.select-none', [ h('.identicon-wrapper.flex-column.flex-center.select-none', [
this.pendingOrNot(), this.pendingOrNot(),
h(Identicon, { h(Identicon, {
address: identity.address address: identity.address,
}), }),
]), ]),
@ -70,9 +67,12 @@ NewComponent.prototype.render = function() {
event.preventDefault() event.preventDefault()
copyToClipboard(ethUtil.toChecksumAddress(identity.address)) copyToClipboard(ethUtil.toChecksumAddress(identity.address))
}, },
<<<<<<< HEAD
style:{ style:{
margin: '0px 5px', margin: '0px 5px',
}, },
=======
>>>>>>> master
}), }),
]), ]),
]) ])

View File

@ -2,7 +2,6 @@ const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('react-redux').connect
const extend = require('xtend')
const actions = require('../actions') const actions = require('../actions')
const valuesFor = require('../util').valuesFor const valuesFor = require('../util').valuesFor
const findDOMNode = require('react-dom').findDOMNode const findDOMNode = require('react-dom').findDOMNode
@ -10,7 +9,6 @@ const AccountPanel = require('./account-panel')
module.exports = connect(mapStateToProps)(AccountsScreen) module.exports = connect(mapStateToProps)(AccountsScreen)
function mapStateToProps (state) { function mapStateToProps (state) {
const pendingTxs = valuesFor(state.metamask.unconfTxs) const pendingTxs = valuesFor(state.metamask.unconfTxs)
const pendingMsgs = valuesFor(state.metamask.unconfMsgs) const pendingMsgs = valuesFor(state.metamask.unconfMsgs)
@ -32,7 +30,6 @@ function AccountsScreen() {
Component.call(this) Component.call(this)
} }
AccountsScreen.prototype.render = function () { AccountsScreen.prototype.render = function () {
var state = this.props var state = this.props
var identityList = valuesFor(state.identities) var identityList = valuesFor(state.identities)
@ -63,7 +60,7 @@ AccountsScreen.prototype.render = function() {
height: '418px', height: '418px',
overflowY: 'auto', overflowY: 'auto',
overflowX: 'hidden', overflowX: 'hidden',
} },
}, },
[ [
identityList.map((identity) => { identityList.map((identity) => {
@ -100,7 +97,7 @@ AccountsScreen.prototype.render = function() {
paddint: '10px', paddint: '10px',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
} },
}, [ }, [
h('i.fa.fa-plus.fa-lg', {key: ''}), h('i.fa.fa-plus.fa-lg', {key: ''}),
]), ]),

View File

@ -139,12 +139,6 @@ function closeMenu() {
} }
} }
function getNetworkStatus(){
return {
type: actions.getNetworkStatus,
}
}
// async actions // async actions
function tryUnlockMetamask (password) { function tryUnlockMetamask (password) {
@ -164,6 +158,9 @@ function createNewVault(password, entropy) {
return (dispatch) => { return (dispatch) => {
dispatch(actions.createNewVaultInProgress()) dispatch(actions.createNewVaultInProgress())
_accountManager.createNewVault(password, entropy, (err, result) => { _accountManager.createNewVault(password, entropy, (err, result) => {
if (err) {
return dispatch(actions.showWarning(err.message))
}
dispatch(actions.showNewVaultSeed(result)) dispatch(actions.showNewVaultSeed(result))
}) })
} }
@ -296,7 +293,6 @@ function cancelTx(txData){
// initialize screen // initialize screen
// //
function showCreateVault () { function showCreateVault () {
return { return {
type: actions.SHOW_CREATE_VAULT, type: actions.SHOW_CREATE_VAULT,
@ -319,6 +315,10 @@ function agreeToDisclaimer() {
return (dispatch) => { return (dispatch) => {
dispatch(this.showLoadingIndication()) dispatch(this.showLoadingIndication())
_accountManager.agreeToDisclaimer((err) => { _accountManager.agreeToDisclaimer((err) => {
if (err) {
return dispatch(actions.showWarning(err.message))
}
dispatch(this.hideLoadingIndication()) dispatch(this.hideLoadingIndication())
dispatch({ dispatch({
type: this.AGREE_TO_DISCLAIMER, type: this.AGREE_TO_DISCLAIMER,
@ -373,10 +373,14 @@ function updateMetamaskState(newState) {
function lockMetamask () { function lockMetamask () {
return (dispatch) => { return (dispatch) => {
_accountManager.setLocked((err) => { _accountManager.setLocked((err) => {
dispatch(actions.hideLoadingIndication())
if (err) {
return dispatch(actions.showWarning(err.message))
}
dispatch({ dispatch({
type: actions.LOCK_METAMASK, type: actions.LOCK_METAMASK,
}) })
dispatch(actions.hideLoadingIndication())
}) })
} }
} }
@ -386,6 +390,10 @@ function showAccountDetail(address) {
dispatch(actions.showLoadingIndication()) dispatch(actions.showLoadingIndication())
_accountManager.setSelectedAddress(address, (err, address) => { _accountManager.setSelectedAddress(address, (err, address) => {
dispatch(actions.hideLoadingIndication()) dispatch(actions.hideLoadingIndication())
if (err) {
return dispatch(actions.showWarning(err.message))
}
dispatch({ dispatch({
type: actions.SHOW_ACCOUNT_DETAIL, type: actions.SHOW_ACCOUNT_DETAIL,
value: address, value: address,
@ -411,6 +419,11 @@ function confirmSeedWords() {
return (dispatch) => { return (dispatch) => {
dispatch(actions.showLoadingIndication()) dispatch(actions.showLoadingIndication())
_accountManager.clearSeedWordCache((err, account) => { _accountManager.clearSeedWordCache((err, account) => {
dispatch(actions.hideLoadingIndication())
if (err) {
return dispatch(actions.showWarning(err.message))
}
console.log('Seed word cache cleared. ' + account) console.log('Seed word cache cleared. ' + account)
dispatch(actions.showAccountDetail(account)) dispatch(actions.showAccountDetail(account))
}) })

View File

@ -1,10 +1,7 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const React = require('react')
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('react').PropTypes
const connect = require('react-redux').connect const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const extend = require('xtend')
const actions = require('./actions') const actions = require('./actions')
const ReactCSSTransitionGroup = require('react-addons-css-transition-group') const ReactCSSTransitionGroup = require('react-addons-css-transition-group')
// init // init
@ -25,7 +22,6 @@ const ConfigScreen = require('./config')
const RevealSeedConfirmation = require('./recover-seed/confirmation') const RevealSeedConfirmation = require('./recover-seed/confirmation')
const InfoScreen = require('./info') const InfoScreen = require('./info')
const LoadingIndicator = require('./loading') const LoadingIndicator = require('./loading')
const txHelper = require('../lib/tx-helper')
const SandwichExpando = require('sandwich-expando') const SandwichExpando = require('sandwich-expando')
const MenuDroppo = require('menu-droppo') const MenuDroppo = require('menu-droppo')
const DropMenuItem = require('./components/drop-menu-item') const DropMenuItem = require('./components/drop-menu-item')
@ -33,7 +29,6 @@ const NetworkIndicator = require('./components/network')
module.exports = connect(mapStateToProps)(App) module.exports = connect(mapStateToProps)(App)
inherits(App, Component) inherits(App, Component)
function App () { Component.call(this) } function App () { Component.call(this) }
@ -56,7 +51,6 @@ function mapStateToProps(state) {
App.prototype.render = function () { App.prototype.render = function () {
var props = this.props var props = this.props
var view = props.currentView.name
var transForward = props.transForward var transForward = props.transForward
return ( return (
@ -65,7 +59,7 @@ App.prototype.render = function() {
style: { style: {
// Windows was showing a vertical scroll bar: // Windows was showing a vertical scroll bar:
overflow: 'hidden', overflow: 'hidden',
} },
}, [ }, [
h(LoadingIndicator), h(LoadingIndicator),
@ -80,7 +74,7 @@ App.prototype.render = function() {
style: { style: {
height: '380px', height: '380px',
width: '360px', width: '360px',
} },
}, [ }, [
h(ReactCSSTransitionGroup, { h(ReactCSSTransitionGroup, {
className: 'css-transition-group', className: 'css-transition-group',
@ -121,7 +115,7 @@ App.prototype.renderAppBar = function(){
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()
this.setState({ isNetworkMenuOpen: !isNetworkMenuOpen }) this.setState({ isNetworkMenuOpen: !isNetworkMenuOpen })
} },
}), }),
// metamask name // metamask name
@ -149,8 +143,6 @@ App.prototype.renderNetworkDropdown = function() {
const state = this.state || {} const state = this.state || {}
const isOpen = state.isNetworkMenuOpen const isOpen = state.isNetworkMenuOpen
const checked = h('i.fa.fa-check.fa-lg', { ariaHidden: true })
return h(MenuDroppo, { return h(MenuDroppo, {
isOpen, isOpen,
onClickOutside: (event) => { onClickOutside: (event) => {
@ -252,7 +244,6 @@ App.prototype.renderPrimary = function(){
// show initialize screen // show initialize screen
if (!props.isInitialized) { if (!props.isInitialized) {
// show current view // show current view
switch (props.currentView.name) { switch (props.currentView.name) {

View File

@ -6,14 +6,13 @@ const actions = require('../actions')
module.exports = ExportAccountView module.exports = ExportAccountView
inherits(ExportAccountView, Component) inherits(ExportAccountView, Component)
function ExportAccountView () { function ExportAccountView () {
Component.call(this) Component.call(this)
} }
ExportAccountView.prototype.render = function () { ExportAccountView.prototype.render = function () {
console.log("EXPORT VIEW") console.log('EXPORT VIEW')
console.dir(this.props) console.dir(this.props)
var state = this.props var state = this.props
var accountDetail = state.accountDetail var accountDetail = state.accountDetail
@ -47,13 +46,13 @@ ExportAccountView.prototype.render = function() {
style: { style: {
position: 'relative', position: 'relative',
top: '1.5px', top: '1.5px',
} },
}), }),
h('button', { h('button', {
onClick: () => this.onExportKeyPress({ key: 'Enter', preventDefault: () => {} }), onClick: () => this.onExportKeyPress({ key: 'Enter', preventDefault: () => {} }),
}, 'Submit'), }, 'Submit'),
h('button', { h('button', {
onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)) onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)),
}, 'Cancel'), }, 'Cancel'),
]) ])
@ -74,10 +73,10 @@ ExportAccountView.prototype.render = function() {
}, },
onClick: function (event) { onClick: function (event) {
copyToClipboard(accountDetail.privateKey) copyToClipboard(accountDetail.privateKey)
} },
}, accountDetail.privateKey), }, accountDetail.privateKey),
h('button', { h('button', {
onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)) onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)),
}, 'Done'), }, 'Done'),
]) ])
} }

View File

@ -1,16 +1,13 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const ethUtil = require('ethereumjs-util')
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const formatBalance = require('../util').formatBalance const formatBalance = require('../util').formatBalance
const Identicon = require('./identicon')
const addressSummary = require('../util').addressSummary const addressSummary = require('../util').addressSummary
const Panel = require('./panel') const Panel = require('./panel')
module.exports = AccountPanel module.exports = AccountPanel
inherits(AccountPanel, Component) inherits(AccountPanel, Component)
function AccountPanel () { function AccountPanel () {
Component.call(this) Component.call(this)
@ -22,9 +19,6 @@ AccountPanel.prototype.render = function() {
var account = state.account || {} var account = state.account || {}
var isFauceting = state.isFauceting var isFauceting = state.isFauceting
var identicon = new Identicon(identity.address, 46).toString()
var identiconSrc = `data:image/png;base64,${identicon}`
var panelOpts = { var panelOpts = {
key: `accountPanel${identity.address}`, key: `accountPanel${identity.address}`,
onClick: (event) => { onClick: (event) => {
@ -40,18 +34,16 @@ AccountPanel.prototype.render = function() {
value: addressSummary(identity.address), value: addressSummary(identity.address),
}, },
balanceOrFaucetingIndication(account, isFauceting), balanceOrFaucetingIndication(account, isFauceting),
] ],
} }
return h(Panel, panelOpts, return h(Panel, panelOpts,
!state.onShowDetail ? null : h('.arrow-right.cursor-pointer', [ !state.onShowDetail ? null : h('.arrow-right.cursor-pointer', [
h('i.fa.fa-chevron-right.fa-lg'), h('i.fa.fa-chevron-right.fa-lg'),
])) ]))
} }
function balanceOrFaucetingIndication (account, isFauceting) { function balanceOrFaucetingIndication (account, isFauceting) {
// Temporarily deactivating isFauceting indication // Temporarily deactivating isFauceting indication
// because it shows fauceting for empty restored accounts. // because it shows fauceting for empty restored accounts.
if (/* isFauceting*/ false) { if (/* isFauceting*/ false) {
@ -62,7 +54,7 @@ function balanceOrFaucetingIndication(account, isFauceting) {
} else { } else {
return { return {
key: 'BALANCE', key: 'BALANCE',
value: formatBalance(account.balance) value: formatBalance(account.balance),
} }
} }
} }

View File

@ -4,14 +4,12 @@ const inherits = require('util').inherits
module.exports = DropMenuItem module.exports = DropMenuItem
inherits(DropMenuItem, Component) inherits(DropMenuItem, Component)
function DropMenuItem () { function DropMenuItem () {
Component.call(this) Component.call(this)
} }
DropMenuItem.prototype.render = function () { DropMenuItem.prototype.render = function () {
return h('li.drop-menu-item', { return h('li.drop-menu-item', {
onClick: () => { onClick: () => {
this.props.closeMenu() this.props.closeMenu()

View File

@ -5,7 +5,6 @@ const findDOMNode = require('react-dom').findDOMNode
module.exports = EditableLabel module.exports = EditableLabel
inherits(EditableLabel, Component) inherits(EditableLabel, Component)
function EditableLabel () { function EditableLabel () {
Component.call(this) Component.call(this)
@ -13,10 +12,9 @@ function EditableLabel() {
EditableLabel.prototype.render = function () { EditableLabel.prototype.render = function () {
const props = this.props const props = this.props
let state = this.state const state = this.state
if (state && state.isEditingLabel) { if (state && state.isEditingLabel) {
return h('div.editable-label', [ return h('div.editable-label', [
h('input.sizing-input', { h('input.sizing-input', {
defaultValue: props.textValue, defaultValue: props.textValue,
@ -26,9 +24,8 @@ EditableLabel.prototype.render = function() {
}), }),
h('button.editable-button', { h('button.editable-button', {
onClick: () => this.saveText(), onClick: () => this.saveText(),
}, 'Save') }, 'Save'),
]) ])
} else { } else {
return h('div.name-label', { return h('div.name-label', {
onClick: (event) => { onClick: (event) => {

View File

@ -1,7 +1,6 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const parseBalance = require('../util').parseBalance
const formatBalance = require('../util').formatBalance const formatBalance = require('../util').formatBalance
module.exports = EthBalanceComponent module.exports = EthBalanceComponent

View File

@ -2,12 +2,10 @@ const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const metamaskLogo = require('metamask-logo') const metamaskLogo = require('metamask-logo')
const getCaretCoordinates = require('textarea-caret')
const debounce = require('debounce') const debounce = require('debounce')
module.exports = Mascot module.exports = Mascot
inherits(Mascot, Component) inherits(Mascot, Component)
function Mascot () { function Mascot () {
Component.call(this) Component.call(this)
@ -22,7 +20,6 @@ function Mascot() {
this.unfollowMouse = this.logo.setFollowMouse.bind(this.logo, false) this.unfollowMouse = this.logo.setFollowMouse.bind(this.logo, false)
} }
Mascot.prototype.render = function () { Mascot.prototype.render = function () {
// this is a bit hacky // this is a bit hacky
// the event emitter is on `this.props` // the event emitter is on `this.props`

View File

@ -14,26 +14,25 @@ Network.prototype.render = function() {
const state = this.props const state = this.props
const networkNumber = state.network const networkNumber = state.network
let iconName, hoverText let iconName, hoverText
const imagePath = "/images/"
if (networkNumber == 'loading') { if (networkNumber === 'loading') {
return h('img', { return h('img', {
title: 'Attempting to connect to blockchain.', title: 'Attempting to connect to blockchain.',
onClick: (event) => this.props.onClick(event), onClick: (event) => this.props.onClick(event),
style: { style: {
width: '27px', width: '27px',
marginRight: '-27px' marginRight: '-27px',
}, },
src: 'images/loading.svg', src: 'images/loading.svg',
}) })
} else if (parseInt(networkNumber) == 1) { } else if (parseInt(networkNumber) === 1) {
hoverText = 'Main Ethereum Network' hoverText = 'Main Ethereum Network'
iconName = 'ethereum-network' iconName = 'ethereum-network'
}else if (parseInt(networkNumber) == 2) { } else if (parseInt(networkNumber) === 2) {
hoverText = "Morden Test Network" hoverText = 'Morden Test Network'
iconName = 'morden-test-network' iconName = 'morden-test-network'
} else { } else {
hoverText = "Unknown Private Network" hoverText = 'Unknown Private Network'
iconName = 'unknown-private-network' iconName = 'unknown-private-network'
} }
return ( return (
@ -45,7 +44,7 @@ Network.prototype.render = function() {
title: hoverText, title: hoverText,
onClick: (event) => this.props.onClick(event), onClick: (event) => this.props.onClick(event),
}, [ }, [
function() { (function () {
switch (iconName) { switch (iconName) {
case 'ethereum-network': case 'ethereum-network':
return h('.menu-icon.ether-icon') return h('.menu-icon.ether-icon')
@ -60,7 +59,7 @@ Network.prototype.render = function() {
}, },
}) })
} }
}() })(),
]) ])
) )
} }

View File

@ -1,12 +1,10 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const ethUtil = require('ethereumjs-util')
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const Identicon = require('./identicon') const Identicon = require('./identicon')
module.exports = Panel module.exports = Panel
inherits(Panel, Component) inherits(Panel, Component)
function Panel () { function Panel () {
Component.call(this) Component.call(this)
@ -15,9 +13,6 @@ function Panel() {
Panel.prototype.render = function () { Panel.prototype.render = function () {
var state = this.props var state = this.props
var identity = state.identity || {}
var account = state.account || {}
var isFauceting = state.isFauceting
var style = { var style = {
flex: '1 0 auto', flex: '1 0 auto',
} }

View File

@ -3,14 +3,10 @@ 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 addressSummary = require('../util').addressSummary
const readableDate = require('../util').readableDate const readableDate = require('../util').readableDate
const formatBalance = require('../util').formatBalance
const dataSize = require('../util').dataSize
module.exports = PendingMsg module.exports = PendingMsg
inherits(PendingMsg, Component) inherits(PendingMsg, Component)
function PendingMsg () { function PendingMsg () {
Component.call(this) Component.call(this)
@ -34,7 +30,7 @@ PendingMsg.prototype.render = function() {
style: { style: {
fontWeight: 'bold', fontWeight: 'bold',
textAlign: 'center', textAlign: 'center',
} },
}, 'Sign Message'), }, 'Sign Message'),
// account that will sign // account that will sign

View File

@ -6,11 +6,9 @@ const AccountPanel = require('./account-panel')
const addressSummary = require('../util').addressSummary const addressSummary = require('../util').addressSummary
const readableDate = require('../util').readableDate const readableDate = require('../util').readableDate
const formatBalance = require('../util').formatBalance const formatBalance = require('../util').formatBalance
const dataSize = require('../util').dataSize
module.exports = PendingTx module.exports = PendingTx
inherits(PendingTx, Component) inherits(PendingTx, Component)
function PendingTx () { function PendingTx () {
Component.call(this) Component.call(this)
@ -34,7 +32,7 @@ PendingTx.prototype.render = function() {
style: { style: {
fontWeight: 'bold', fontWeight: 'bold',
textAlign: 'center', textAlign: 'center',
} },
}, 'Submit Transaction'), }, 'Submit Transaction'),
// account that will sign // account that will sign

View File

@ -4,16 +4,15 @@ const inherits = require('util').inherits
module.exports = NewComponent module.exports = NewComponent
inherits(NewComponent, Component) inherits(NewComponent, Component)
function NewComponent () { function NewComponent () {
Component.call(this) Component.call(this)
} }
NewComponent.prototype.render = function () { NewComponent.prototype.render = function () {
var state = this.props const props = this.props
return ( return (
h('span', 'Placeholder component') h('span', props.message)
) )
} }

View File

@ -6,20 +6,19 @@ const Identicon = require('./identicon')
module.exports = TransactionIcon module.exports = TransactionIcon
inherits(TransactionIcon, Component) inherits(TransactionIcon, Component)
function TransactionIcon () { function TransactionIcon () {
Component.call(this) Component.call(this)
} }
TransactionIcon.prototype.render = function () { TransactionIcon.prototype.render = function () {
const { transaction, txParams, isTx, isMsg } = this.props const { transaction, txParams, isMsg } = this.props
if (transaction.status === 'rejected') { if (transaction.status === 'rejected') {
return h('i.fa.fa-exclamation-triangle.fa-lg.error', { return h('i.fa.fa-exclamation-triangle.fa-lg.error', {
style: { style: {
width: '24px', width: '24px',
} },
}) })
} }
@ -27,7 +26,7 @@ TransactionIcon.prototype.render = function() {
return h('i.fa.fa-certificate.fa-lg', { return h('i.fa.fa-certificate.fa-lg', {
style: { style: {
width: '24px', width: '24px',
} },
}) })
} }
@ -40,7 +39,7 @@ TransactionIcon.prototype.render = function() {
return h('i.fa.fa-file-text-o.fa-lg', { return h('i.fa.fa-file-text-o.fa-lg', {
style: { style: {
width: '24px', width: '24px',
} },
}) })
} }
} }

View File

@ -5,14 +5,12 @@ const inherits = require('util').inherits
const EtherBalance = require('./eth-balance') const EtherBalance = require('./eth-balance')
const addressSummary = require('../util').addressSummary const addressSummary = require('../util').addressSummary
const explorerLink = require('../../lib/explorer-link') const explorerLink = require('../../lib/explorer-link')
const formatBalance = require('../util').formatBalance
const vreme = new (require('vreme')) const vreme = new (require('vreme'))
const TransactionIcon = require('./transaction-list-item-icon') const TransactionIcon = require('./transaction-list-item-icon')
module.exports = TransactionListItem module.exports = TransactionListItem
inherits(TransactionListItem, Component) inherits(TransactionListItem, Component)
function TransactionListItem () { function TransactionListItem () {
Component.call(this) Component.call(this)
@ -59,8 +57,8 @@ TransactionListItem.prototype.render = function() {
// large identicon // large identicon
h('.identicon-wrapper.flex-column.flex-center.select-none', [ h('.identicon-wrapper.flex-column.flex-center.select-none', [
transaction.status === 'unconfirmed' ? h('.red-dot', ' ') : transaction.status === 'unconfirmed' ? h('.red-dot', ' ')
h(TransactionIcon, { txParams, transaction, isTx, isMsg }), : h(TransactionIcon, { txParams, transaction, isTx, isMsg }),
]), ]),
h('.flex-column', [ h('.flex-column', [
@ -107,12 +105,6 @@ function recipientField(txParams, transaction, isTx, isMsg) {
message, message,
failIfFailed(transaction), failIfFailed(transaction),
]) ])
}
TransactionListItem.prototype.renderMessage = function() {
const { transaction, i, network } = this.props
return h('div', 'wowie, thats a message')
} }
function formatDate (date) { function formatDate (date) {

View File

@ -13,7 +13,7 @@ function TransactionList() {
} }
TransactionList.prototype.render = function () { TransactionList.prototype.render = function () {
const { txsToRender, network, unconfTxs, unconfMsgs } = this.props const { txsToRender, network, unconfMsgs } = this.props
const transactions = txsToRender.concat(unconfMsgs) const transactions = txsToRender.concat(unconfMsgs)
.sort((a, b) => b.time - a.time) .sort((a, b) => b.time - a.time)
@ -49,8 +49,8 @@ TransactionList.prototype.render = function() {
}, },
}, ( }, (
transactions.length ? transactions.length
transactions.map((transaction, i) => { ? transactions.map((transaction, i) => {
return h(TransactionListItem, { return h(TransactionListItem, {
transaction, i, network, transaction, i, network,
showTx: (txId) => { showTx: (txId) => {
@ -58,13 +58,12 @@ TransactionList.prototype.render = function() {
}, },
}) })
}) })
: : [h('.flex-center', {
[h('.flex-center', {
style: { style: {
height: '100%', height: '100%',
}, },
}, 'No transaction history...')] }, 'No transaction history...')]
)) )),
]) ])
) )
} }

View File

@ -3,10 +3,7 @@ const Component = require('react').Component
const ReactCSSTransitionGroup = require('react-addons-css-transition-group') const ReactCSSTransitionGroup = require('react-addons-css-transition-group')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('react-redux').connect
const copyToClipboard = require('copy-to-clipboard')
const actions = require('./actions') const actions = require('./actions')
const AccountPanel = require('./components/account-panel')
const valuesFor = require('./util').valuesFor
const txHelper = require('../lib/tx-helper') const txHelper = require('../lib/tx-helper')
const ConfirmTx = require('./components/pending-tx') const ConfirmTx = require('./components/pending-tx')
@ -31,7 +28,6 @@ function ConfirmTxScreen() {
Component.call(this) Component.call(this)
} }
ConfirmTxScreen.prototype.render = function () { ConfirmTxScreen.prototype.render = function () {
var state = this.props var state = this.props
@ -103,7 +99,6 @@ ConfirmTxScreen.prototype.render = function() {
} }
function currentTxView (opts) { function currentTxView (opts) {
if ('txParams' in opts.txData) { if ('txParams' in opts.txData) {
// This is a pending transaction // This is a pending transaction
return h(ConfirmTx, opts) return h(ConfirmTx, opts)

View File

@ -8,7 +8,6 @@ module.exports = connect(mapStateToProps)(ConfigScreen)
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
rpc: state.metamask.rpcTarget,
metamask: state.metamask, metamask: state.metamask,
} }
} }
@ -18,10 +17,8 @@ function ConfigScreen() {
Component.call(this) Component.call(this)
} }
ConfigScreen.prototype.render = function () { ConfigScreen.prototype.render = function () {
var state = this.props var state = this.props
var rpc = state.rpc
var metamaskState = state.metamask var metamaskState = state.metamask
return ( return (
@ -32,7 +29,7 @@ ConfigScreen.prototype.render = function() {
h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', { h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', {
onClick: (event) => { onClick: (event) => {
state.dispatch(actions.goHome()) state.dispatch(actions.goHome())
} },
}), }),
h('h2.page-subtitle', 'Configuration'), h('h2.page-subtitle', 'Configuration'),
]), ]),
@ -42,7 +39,7 @@ ConfigScreen.prototype.render = function() {
h('.flex-space-around', { h('.flex-space-around', {
style: { style: {
padding: '20px', padding: '20px',
} },
}, [ }, [
currentProviderDisplay(metamaskState), currentProviderDisplay(metamaskState),
@ -62,7 +59,7 @@ ConfigScreen.prototype.render = function() {
var newRpc = element.value var newRpc = element.value
state.dispatch(actions.setRpcTarget(newRpc)) state.dispatch(actions.setRpcTarget(newRpc))
} }
} },
}), }),
h('button', { h('button', {
style: { style: {
@ -73,8 +70,8 @@ ConfigScreen.prototype.render = function() {
var element = document.querySelector('input#new_rpc') var element = document.querySelector('input#new_rpc')
var newRpc = element.value var newRpc = element.value
state.dispatch(actions.setRpcTarget(newRpc)) state.dispatch(actions.setRpcTarget(newRpc))
} },
}, 'Save') }, 'Save'),
]), ]),
h('div', [ h('div', [
@ -85,7 +82,7 @@ ConfigScreen.prototype.render = function() {
onClick (event) { onClick (event) {
event.preventDefault() event.preventDefault()
state.dispatch(actions.setProviderType('mainnet')) state.dispatch(actions.setProviderType('mainnet'))
} },
}, 'Use Main Network'), }, 'Use Main Network'),
]), ]),
@ -97,7 +94,7 @@ ConfigScreen.prototype.render = function() {
onClick (event) { onClick (event) {
event.preventDefault() event.preventDefault()
state.dispatch(actions.setProviderType('testnet')) state.dispatch(actions.setProviderType('testnet'))
} },
}, 'Use Morden Test Network'), }, 'Use Morden Test Network'),
]), ]),
@ -109,7 +106,7 @@ ConfigScreen.prototype.render = function() {
onClick (event) { onClick (event) {
event.preventDefault() event.preventDefault()
state.dispatch(actions.setRpcTarget('http://localhost:8545/')) state.dispatch(actions.setRpcTarget('http://localhost:8545/'))
} },
}, 'Use http://localhost:8545'), }, 'Use http://localhost:8545'),
]), ]),
@ -118,7 +115,7 @@ ConfigScreen.prototype.render = function() {
h('div', { h('div', {
style: { style: {
marginTop: '20px', marginTop: '20px',
} },
}, [ }, [
h('button', { h('button', {
style: { style: {
@ -127,8 +124,8 @@ ConfigScreen.prototype.render = function() {
onClick (event) { onClick (event) {
event.preventDefault() event.preventDefault()
state.dispatch(actions.revealSeedConfirmation()) state.dispatch(actions.revealSeedConfirmation())
} },
}, 'Reveal Seed Words') }, 'Reveal Seed Words'),
]), ]),
]), ]),
@ -160,6 +157,6 @@ function currentProviderDisplay(metamaskState) {
return h('div', [ return h('div', [
h('span', {style: { fontWeight: 'bold', paddingRight: '10px'}}, title), h('span', {style: { fontWeight: 'bold', paddingRight: '10px'}}, title),
h('span', value) h('span', value),
]) ])
} }

View File

@ -6,7 +6,6 @@ const actions = require('../actions')
module.exports = connect(mapStateToProps)(CreateVaultCompleteScreen) module.exports = connect(mapStateToProps)(CreateVaultCompleteScreen)
inherits(CreateVaultCompleteScreen, Component) inherits(CreateVaultCompleteScreen, Component)
function CreateVaultCompleteScreen () { function CreateVaultCompleteScreen () {
Component.call(this) Component.call(this)
@ -50,7 +49,7 @@ CreateVaultCompleteScreen.prototype.render = function() {
style: { style: {
padding: '12px 20px 0px 20px', padding: '12px 20px 0px 20px',
textAlign: 'center', textAlign: 'center',
} },
}, 'These 12 words can restore all of your MetaMask accounts for this vault.\nSave them somewhere safe and secret.'), }, 'These 12 words can restore all of your MetaMask accounts for this vault.\nSave them somewhere safe and secret.'),
h('textarea.twelve-word-phrase', { h('textarea.twelve-word-phrase', {

View File

@ -7,7 +7,6 @@ const actions = require('../actions')
module.exports = connect(mapStateToProps)(CreateVaultScreen) module.exports = connect(mapStateToProps)(CreateVaultScreen)
inherits(CreateVaultScreen, Component) inherits(CreateVaultScreen, Component)
function CreateVaultScreen () { function CreateVaultScreen () {
Component.call(this) Component.call(this)

View File

@ -18,7 +18,6 @@ function DisclaimerScreen() {
} }
DisclaimerScreen.prototype.render = function () { DisclaimerScreen.prototype.render = function () {
return ( return (
h('.flex-column.flex-center.flex-grow', [ h('.flex-column.flex-center.flex-grow', [
@ -43,13 +42,13 @@ DisclaimerScreen.prototype.render = function() {
padding: '6px', padding: '6px',
width: '80%', width: '80%',
overflowY: 'scroll', overflowY: 'scroll',
} },
}, disclaimer), }, disclaimer),
h('button', { h('button', {
style: { marginTop: '18px' }, style: { marginTop: '18px' },
onClick: () => this.props.dispatch(actions.agreeToDisclaimer()) onClick: () => this.props.dispatch(actions.agreeToDisclaimer()),
}, 'I Agree') }, 'I Agree'),
]) ])
) )
} }

View File

@ -3,11 +3,8 @@ const EventEmitter = require('events').EventEmitter
const Component = require('react').Component const Component = require('react').Component
const connect = require('react-redux').connect const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const getCaretCoordinates = require('textarea-caret')
const Mascot = require('../components/mascot') const Mascot = require('../components/mascot')
const actions = require('../actions') const actions = require('../actions')
const CreateVaultScreen = require('./create-vault')
const CreateVaultCompleteScreen = require('./create-vault-complete')
module.exports = connect(mapStateToProps)(InitializeMenuScreen) module.exports = connect(mapStateToProps)(InitializeMenuScreen)
@ -33,7 +30,6 @@ InitializeMenuScreen.prototype.render = function() {
return this.renderMenu() return this.renderMenu()
} }
} }
// InitializeMenuScreen.prototype.componentDidMount = function(){ // InitializeMenuScreen.prototype.componentDidMount = function(){
@ -41,7 +37,6 @@ InitializeMenuScreen.prototype.render = function() {
// } // }
InitializeMenuScreen.prototype.renderMenu = function () { InitializeMenuScreen.prototype.renderMenu = function () {
var state = this.props
return ( return (
h('.initialize-screen.flex-column.flex-center.flex-grow', [ h('.initialize-screen.flex-column.flex-center.flex-grow', [

View File

@ -6,7 +6,6 @@ const actions = require('../actions')
module.exports = connect(mapStateToProps)(RestoreVaultScreen) module.exports = connect(mapStateToProps)(RestoreVaultScreen)
inherits(RestoreVaultScreen, Component) inherits(RestoreVaultScreen, Component)
function RestoreVaultScreen () { function RestoreVaultScreen () {
Component.call(this) Component.call(this)
@ -18,7 +17,6 @@ function mapStateToProps(state) {
} }
} }
RestoreVaultScreen.prototype.render = function () { RestoreVaultScreen.prototype.render = function () {
var state = this.props var state = this.props
return ( return (
@ -41,7 +39,7 @@ RestoreVaultScreen.prototype.render = function() {
// wallet seed entry // wallet seed entry
h('h3', 'Wallet Seed'), h('h3', 'Wallet Seed'),
h('textarea.twelve-word-phrase.letter-spacey', { h('textarea.twelve-word-phrase.letter-spacey', {
placeholder: 'Enter your secret twelve word phrase here to restore your vault.' placeholder: 'Enter your secret twelve word phrase here to restore your vault.',
}), }),
// password // password

View File

@ -17,8 +17,7 @@ function InfoScreen() {
InfoScreen.prototype.render = function () { InfoScreen.prototype.render = function () {
var state = this.props var state = this.props
var rpc = state.rpc var manifest = chrome.runtime.getManifest()
var manifest = chrome.runtime.getManifest();
return ( return (
h('.flex-column.flex-grow', [ h('.flex-column.flex-grow', [
@ -27,7 +26,7 @@ InfoScreen.prototype.render = function() {
h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', { h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', {
onClick: (event) => { onClick: (event) => {
state.dispatch(actions.goHome()) state.dispatch(actions.goHome())
} },
}), }),
h('h2.page-subtitle', 'Info'), h('h2.page-subtitle', 'Info'),
]), ]),
@ -37,7 +36,7 @@ InfoScreen.prototype.render = function() {
h('.flex-space-around', { h('.flex-space-around', {
style: { style: {
padding: '20px', padding: '20px',
} },
}, [ }, [
// current version number // current version number
@ -46,7 +45,7 @@ InfoScreen.prototype.render = function() {
h('div', { h('div', {
style: { style: {
marginBottom: '10px', marginBottom: '10px',
} },
}, `Version: ${manifest.version}`), }, `Version: ${manifest.version}`),
]), ]),
@ -54,10 +53,9 @@ InfoScreen.prototype.render = function() {
style: { style: {
margin: '20px 0 ', margin: '20px 0 ',
width: '7em', width: '7em',
} },
}), }),
h('.info', { h('.info', {
style: { style: {
marginBottom: '20px', marginBottom: '20px',
@ -79,14 +77,14 @@ InfoScreen.prototype.render = function() {
onClick (event) { this.navigateTo(event.target.href) }, onClick (event) { this.navigateTo(event.target.href) },
}, [ }, [
h('img.icon-size', { h('img.icon-size', {
src: manifest.icons[128] src: manifest.icons[128],
}), }),
h('div.info', { h('div.info', {
style: { style: {
fontWeight: 800, fontWeight: 800,
} },
},'Visit our web site') }, 'Visit our web site'),
]) ]),
]), ]),
h('div.fa.fa-slack', [ h('div.fa.fa-slack', [
h('a.info', { h('a.info', {
@ -96,7 +94,6 @@ InfoScreen.prototype.render = function() {
}, 'Join the conversation on Slack'), }, 'Join the conversation on Slack'),
]), ]),
h('div.fa.fa-twitter', [ h('div.fa.fa-twitter', [
h('a.info', { h('a.info', {
href: 'https://twitter.com/metamask_io', href: 'https://twitter.com/metamask_io',
@ -124,9 +121,8 @@ InfoScreen.prototype.render = function() {
]), ]),
]) ])
) )
} }
InfoScreen.prototype.navigateTo = function (url) { InfoScreen.prototype.navigateTo = function (url) {
chrome.tabs.create({ url }); chrome.tabs.create({ url })
} }

View File

@ -2,7 +2,6 @@ const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('react-redux').connect
const actions = require('./actions')
const ReactCSSTransitionGroup = require('react-addons-css-transition-group') const ReactCSSTransitionGroup = require('react-addons-css-transition-group')
module.exports = connect(mapStateToProps)(LoadingIndicator) module.exports = connect(mapStateToProps)(LoadingIndicator)
@ -38,7 +37,7 @@ LoadingIndicator.prototype.render = function() {
height: '100%', height: '100%',
width: '100%', width: '100%',
background: 'rgba(255, 255, 255, 0.5)', background: 'rgba(255, 255, 255, 0.5)',
} },
}, [ }, [
h('img', { h('img', {
src: 'images/loading.svg', src: 'images/loading.svg',

View File

@ -7,7 +7,6 @@ const actions = require('../actions')
module.exports = connect(mapStateToProps)(RevealSeedConfirmatoin) module.exports = connect(mapStateToProps)(RevealSeedConfirmatoin)
inherits(RevealSeedConfirmatoin, Component) inherits(RevealSeedConfirmatoin, Component)
function RevealSeedConfirmatoin () { function RevealSeedConfirmatoin () {
Component.call(this) Component.call(this)
@ -48,7 +47,7 @@ RevealSeedConfirmatoin.prototype.render = function() {
flexDirection: 'column', flexDirection: 'column',
padding: '20px', padding: '20px',
justifyContent: 'center', justifyContent: 'center',
} },
}, [ }, [
h('h4', 'Do not recover your seed words in a public place! These words can be used to steal all your accounts.'), h('h4', 'Do not recover your seed words in a public place! These words can be used to steal all your accounts.'),
@ -68,8 +67,8 @@ RevealSeedConfirmatoin.prototype.render = function() {
h(`h4${state && state.confirmationWrong ? '.error' : ''}`, { h(`h4${state && state.confirmationWrong ? '.error' : ''}`, {
style: { style: {
marginTop: '12px', marginTop: '12px',
} },
}, `Enter the phrase "I understand" to proceed.`), }, 'Enter the phrase "I understand" to proceed.'),
// confirm confirmation // confirm confirmation
h('input.large-input.letter-spacey', { h('input.large-input.letter-spacey', {
@ -105,7 +104,7 @@ RevealSeedConfirmatoin.prototype.render = function() {
h('span.error', { h('span.error', {
style: { style: {
margin: '20px', margin: '20px',
} },
}, props.warning.split('-')) }, props.warning.split('-'))
), ),

View File

@ -1,5 +1,3 @@
const combineReducers = require('redux').combineReducers
const actions = require('./actions')
const extend = require('xtend') const extend = require('xtend')
// //
@ -12,7 +10,6 @@ const reduceApp = require('./reducers/app')
module.exports = rootReducer module.exports = rootReducer
function rootReducer (state, action) { function rootReducer (state, action) {
// clone // clone
state = extend(state) state = extend(state)
@ -34,8 +31,6 @@ function rootReducer(state, action) {
state.appState = reduceApp(state, action) state.appState = reduceApp(state, action)
return state return state
} }

View File

@ -1,12 +1,10 @@
const extend = require('xtend') const extend = require('xtend')
const actions = require('../actions') const actions = require('../actions')
const valuesFor = require('../util').valuesFor
const txHelper = require('../../lib/tx-helper') const txHelper = require('../../lib/tx-helper')
module.exports = reduceApp module.exports = reduceApp
function reduceApp (state, action) { function reduceApp (state, action) {
// clone and defaults // clone and defaults
const selectedAccount = state.metamask.selectedAccount const selectedAccount = state.metamask.selectedAccount
const pendingTxs = hasPendingTxs(state) const pendingTxs = hasPendingTxs(state)
@ -156,7 +154,6 @@ function reduceApp(state, action) {
warning: null, warning: null,
}) })
// accounts // accounts
case actions.SET_SELECTED_ACCOUNT: case actions.SET_SELECTED_ACCOUNT:
@ -182,7 +179,7 @@ function reduceApp(state, action) {
return extend(appState, { return extend(appState, {
currentView: { currentView: {
name: 'accountDetail', name: 'accountDetail',
context: action.value || account, context: action.value,
}, },
accountDetail: { accountDetail: {
subview: 'transactions', subview: 'transactions',
@ -207,7 +204,6 @@ function reduceApp(state, action) {
}) })
case actions.SHOW_ACCOUNTS_PAGE: case actions.SHOW_ACCOUNTS_PAGE:
var seedWords = state.metamask.seedWords
return extend(appState, { return extend(appState, {
currentView: { currentView: {
name: seedWords ? 'createVaultComplete' : 'accounts', name: seedWords ? 'createVaultComplete' : 'accounts',
@ -281,7 +277,7 @@ function reduceApp(state, action) {
name: 'confTx', name: 'confTx',
context: ++appState.currentView.context, context: ++appState.currentView.context,
warning: null, warning: null,
} },
}) })
case actions.VIEW_PENDING_TX: case actions.VIEW_PENDING_TX:
@ -292,7 +288,7 @@ function reduceApp(state, action) {
name: 'confTx', name: 'confTx',
context, context,
warning: null, warning: null,
} },
}) })
case actions.PREVIOUS_TX: case actions.PREVIOUS_TX:
@ -302,7 +298,7 @@ function reduceApp(state, action) {
name: 'confTx', name: 'confTx',
context: --appState.currentView.context, context: --appState.currentView.context,
warning: null, warning: null,
} },
}) })
case actions.TRANSACTION_ERROR: case actions.TRANSACTION_ERROR:
@ -315,7 +311,7 @@ function reduceApp(state, action) {
case actions.UNLOCK_FAILED: case actions.UNLOCK_FAILED:
return extend(appState, { return extend(appState, {
warning: 'Incorrect password. Try again.' warning: 'Incorrect password. Try again.',
}) })
case actions.SHOW_LOADING: case actions.SHOW_LOADING:

View File

@ -1,10 +1,8 @@
const extend = require('xtend') const extend = require('xtend')
const actions = require('../actions')
module.exports = reduceIdentities module.exports = reduceIdentities
function reduceIdentities (state, action) { function reduceIdentities (state, action) {
// clone + defaults // clone + defaults
var idState = extend({ var idState = extend({
@ -14,5 +12,4 @@ function reduceIdentities(state, action) {
default: default:
return idState return idState
} }
} }

View File

@ -4,6 +4,7 @@ const actions = require('../actions')
module.exports = reduceMetamask module.exports = reduceMetamask
function reduceMetamask (state, action) { function reduceMetamask (state, action) {
let newState
// clone + defaults // clone + defaults
var metamaskState = extend({ var metamaskState = extend({
@ -18,9 +19,9 @@ function reduceMetamask(state, action) {
switch (action.type) { switch (action.type) {
case actions.SHOW_ACCOUNTS_PAGE: case actions.SHOW_ACCOUNTS_PAGE:
var state = extend(metamaskState) newState = extend(metamaskState)
delete state.seedWords delete newState.seedWords
return state return newState
case actions.UPDATE_METAMASK_STATE: case actions.UPDATE_METAMASK_STATE:
return extend(metamaskState, action.value) return extend(metamaskState, action.value)
@ -59,16 +60,16 @@ function reduceMetamask(state, action) {
case actions.COMPLETED_TX: case actions.COMPLETED_TX:
var stringId = String(action.id) var stringId = String(action.id)
var newState = extend(metamaskState, { newState = extend(metamaskState, {
unconfTxs: {}, unconfTxs: {},
unconfMsgs: {}, unconfMsgs: {},
}) })
for (var id in metamaskState.unconfTxs) { for (const id in metamaskState.unconfTxs) {
if (id !== stringId) { if (id !== stringId) {
newState.unconfTxs[id] = metamaskState.unconfTxs[id] newState.unconfTxs[id] = metamaskState.unconfTxs[id]
} }
} }
for (var id in metamaskState.unconfMsgs) { for (const id in metamaskState.unconfMsgs) {
if (id !== stringId) { if (id !== stringId) {
newState.unconfMsgs[id] = metamaskState.unconfMsgs[id] newState.unconfMsgs[id] = metamaskState.unconfMsgs[id]
} }
@ -82,7 +83,7 @@ function reduceMetamask(state, action) {
}) })
case actions.CLEAR_SEED_WORD_CACHE: case actions.CLEAR_SEED_WORD_CACHE:
var newState = extend(metamaskState, { newState = extend(metamaskState, {
isUnlocked: true, isUnlocked: true,
isInitialized: true, isInitialized: true,
selectedAccount: action.value, selectedAccount: action.value,
@ -91,7 +92,7 @@ function reduceMetamask(state, action) {
return newState return newState
case actions.SHOW_ACCOUNT_DETAIL: case actions.SHOW_ACCOUNT_DETAIL:
const newState = extend(metamaskState, { newState = extend(metamaskState, {
isUnlocked: true, isUnlocked: true,
isInitialized: true, isInitialized: true,
selectedAccount: action.value, selectedAccount: action.value,

View File

@ -1,5 +1,4 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const React = require('react')
const Component = require('react').Component const Component = require('react').Component
const Provider = require('react-redux').Provider const Provider = require('react-redux').Provider
const h = require('react-hyperscript') const h = require('react-hyperscript')
@ -7,7 +6,6 @@ const App = require('./app')
module.exports = Root module.exports = Root
inherits(Root, Component) inherits(Root, Component)
function Root () { Component.call(this) } function Root () { Component.call(this) }
@ -17,7 +15,7 @@ Root.prototype.render = function() {
h(Provider, { h(Provider, {
store: this.props.store, store: this.props.store,
}, [ }, [
h(App) h(App),
]) ])
) )

View File

@ -6,7 +6,6 @@ const Identicon = require('./components/identicon')
const actions = require('./actions') const actions = require('./actions')
const util = require('./util') const util = require('./util')
const numericBalance = require('./util').numericBalance const numericBalance = require('./util').numericBalance
const formatBalance = require('./util').formatBalance
const addressSummary = require('./util').addressSummary const addressSummary = require('./util').addressSummary
const EtherBalance = require('./components/eth-balance') const EtherBalance = require('./components/eth-balance')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
@ -111,7 +110,7 @@ SendTransactionScreen.prototype.render = function() {
// h('div', formatBalance(account && account.balance)), // h('div', formatBalance(account && account.balance)),
h(EtherBalance, { h(EtherBalance, {
value: account && account.balance, value: account && account.balance,
}) }),
]), ]),
@ -140,7 +139,7 @@ SendTransactionScreen.prototype.render = function() {
h('input.large-input', { h('input.large-input', {
name: 'address', name: 'address',
placeholder: 'Recipient Address', placeholder: 'Recipient Address',
}) }),
]), ]),
// 'amount' and send button // 'amount' and send button
@ -160,7 +159,7 @@ SendTransactionScreen.prototype.render = function() {
style: { style: {
textTransform: 'uppercase', textTransform: 'uppercase',
}, },
}, 'Send') }, 'Send'),
]), ]),
@ -187,7 +186,7 @@ SendTransactionScreen.prototype.render = function() {
style: { style: {
width: '100%', width: '100%',
resize: 'none', resize: 'none',
} },
}), }),
]), ]),
@ -207,20 +206,20 @@ SendTransactionScreen.prototype.back = function() {
} }
SendTransactionScreen.prototype.onSubmit = function () { SendTransactionScreen.prototype.onSubmit = function () {
const recipient = document.querySelector('input[name="address"]').value const recipient = document.querySelector('input[name="address"]').value
const input = document.querySelector('input[name="amount"]').value const input = document.querySelector('input[name="amount"]').value
const value = util.normalizeEthStringToWei(input) const value = util.normalizeEthStringToWei(input)
const txData = document.querySelector('input[name="txData"]').value const txData = document.querySelector('input[name="txData"]').value
const balance = this.props.balance const balance = this.props.balance
let message
if (value.gt(balance)) { if (value.gt(balance)) {
var message = 'Insufficient funds.' message = 'Insufficient funds.'
return this.props.dispatch(actions.displayWarning(message)) return this.props.dispatch(actions.displayWarning(message))
} }
if ((!util.isValidAddress(recipient) && !txData) || (!recipient && !txData)) { if ((!util.isValidAddress(recipient) && !txData) || (!recipient && !txData)) {
var message = 'Recipient address is invalid.' message = 'Recipient address is invalid.'
return this.props.dispatch(actions.displayWarning(message)) return this.props.dispatch(actions.displayWarning(message))
} }

View File

@ -2,17 +2,12 @@ const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('react-redux').connect
const copyToClipboard = require('copy-to-clipboard')
const actions = require('./actions') const actions = require('./actions')
const AccountPanel = require('./components/account-panel')
module.exports = connect(mapStateToProps)(AppSettingsPage) module.exports = connect(mapStateToProps)(AppSettingsPage)
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {}
identities: state.metamask.identities,
address: state.appState.currentView.context,
}
} }
inherits(AppSettingsPage, Component) inherits(AppSettingsPage, Component)
@ -20,10 +15,7 @@ function AppSettingsPage() {
Component.call(this) Component.call(this)
} }
AppSettingsPage.prototype.render = function () { AppSettingsPage.prototype.render = function () {
var state = this.props
var identity = state.identities[state.address]
return ( return (
h('.account-detail-section.flex-column.flex-grow', [ h('.account-detail-section.flex-column.flex-grow', [
@ -62,7 +54,6 @@ AppSettingsPage.prototype.onKeyPress = function(event) {
} }
} }
AppSettingsPage.prototype.navigateToAccounts = function (event) { AppSettingsPage.prototype.navigateToAccounts = function (event) {
event.stopPropagation() event.stopPropagation()
this.props.dispatch(actions.showAccountsPage()) this.props.dispatch(actions.showAccountsPage())

View File

@ -6,7 +6,6 @@ const rootReducer = require('./reducers')
module.exports = configureStore module.exports = configureStore
const loggerMiddleware = createLogger() const loggerMiddleware = createLogger()
const createStoreWithMiddleware = applyMiddleware( const createStoreWithMiddleware = applyMiddleware(

View File

@ -2,7 +2,6 @@ const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('react-redux').connect
const actions = require('./actions')
module.exports = connect(mapStateToProps)(COMPONENTNAME) module.exports = connect(mapStateToProps)(COMPONENTNAME)
@ -22,9 +21,9 @@ COMPONENTNAME.prototype.render = function() {
h('div', { h('div', {
style: { style: {
background: 'blue', background: 'blue',
} },
}, [ }, [
'Hello, world!' `Hello, ${props.sender}`,
]) ])
) )
} }

View File

@ -9,7 +9,6 @@ const EventEmitter = require('events').EventEmitter
module.exports = connect(mapStateToProps)(UnlockScreen) module.exports = connect(mapStateToProps)(UnlockScreen)
inherits(UnlockScreen, Component) inherits(UnlockScreen, Component)
function UnlockScreen () { function UnlockScreen () {
Component.call(this) Component.call(this)
@ -55,7 +54,7 @@ UnlockScreen.prototype.render = function() {
h('.error', { h('.error', {
style: { style: {
display: warning ? 'block' : 'none', display: warning ? 'block' : 'none',
} },
}, warning), }, warning),
h('button.primary.cursor-pointer', { h('button.primary.cursor-pointer', {

View File

@ -37,7 +37,6 @@ module.exports = {
bnTable: bnTable, bnTable: bnTable,
} }
function valuesFor (obj) { function valuesFor (obj) {
if (!obj) return [] if (!obj) return []
return Object.keys(obj) return Object.keys(obj)
@ -85,13 +84,13 @@ function weiToEth(bn) {
// Takes hex, returns [beforeDecimal, afterDecimal] // Takes hex, returns [beforeDecimal, afterDecimal]
function parseBalance (balance) { function parseBalance (balance) {
let beforeDecimal, afterDecimal var beforeDecimal, afterDecimal
let wei = numericBalance(balance).toString() const wei = numericBalance(balance).toString()
let trailingZeros = /0+$/ const trailingZeros = /0+$/
beforeDecimal = wei.length > 18 ? wei.slice(0, wei.length - 18) : '0' beforeDecimal = wei.length > 18 ? wei.slice(0, wei.length - 18) : '0'
afterDecimal = ("000000000000000000" + wei).slice(-18).replace(trailingZeros, "") afterDecimal = ('000000000000000000' + wei).slice(-18).replace(trailingZeros, '')
if(afterDecimal == ""){afterDecimal = "0" } if (afterDecimal === '') { afterDecimal = '0' }
return [beforeDecimal, afterDecimal] return [beforeDecimal, afterDecimal]
} }
@ -100,7 +99,7 @@ function formatBalance(balance, decimalsToKeep) {
var parsed = parseBalance(balance) var parsed = parseBalance(balance)
var beforeDecimal = parsed[0] var beforeDecimal = parsed[0]
var afterDecimal = parsed[1] var afterDecimal = parsed[1]
var formatted = "None" var formatted = 'None'
if (decimalsToKeep === undefined) { if (decimalsToKeep === undefined) {
if (beforeDecimal === '0') { if (beforeDecimal === '0') {
if (afterDecimal !== '0') { if (afterDecimal !== '0') {
@ -109,11 +108,11 @@ function formatBalance(balance, decimalsToKeep) {
formatted = '0.' + afterDecimal + ' ETH' formatted = '0.' + afterDecimal + ' ETH'
} }
} else { } else {
formatted = beforeDecimal + "." + afterDecimal.slice(0,3) + ' ETH' formatted = beforeDecimal + '.' + afterDecimal.slice(0, 3) + ' ETH'
} }
} else { } else {
afterDecimal += Array(decimalsToKeep).join("0") afterDecimal += Array(decimalsToKeep).join('0')
formatted = beforeDecimal + "." + afterDecimal.slice(0,decimalsToKeep) + ' ETH' formatted = beforeDecimal + '.' + afterDecimal.slice(0, decimalsToKeep) + ' ETH'
} }
return formatted return formatted
} }
@ -159,10 +158,10 @@ function readableDate(ms) {
var day = date.getDate() var day = date.getDate()
var year = date.getFullYear() var year = date.getFullYear()
var hours = date.getHours() var hours = date.getHours()
var minutes = "0" + date.getMinutes() var minutes = '0' + date.getMinutes()
var seconds = "0" + date.getSeconds() var seconds = '0' + date.getSeconds()
var date = `${month}/${day}/${year}` var dateStr = `${month}/${day}/${year}`
var time = `${hours}:${minutes.substr(-2)}:${seconds.substr(-2)}` var time = `${hours}:${minutes.substr(-2)}:${seconds.substr(-2)}`
return `${date} ${time}` return `${dateStr} ${time}`
} }

View File

@ -1,13 +1,14 @@
const fs = require('fs') const fs = require('fs')
const path = require('path')
module.exports = bundleCss module.exports = bundleCss
var cssFiles = { var cssFiles = {
'fonts.css': fs.readFileSync(__dirname+'/app/css/fonts.css', 'utf8'), 'fonts.css': fs.readFileSync(path.join(__dirname, '/app/css/fonts.css'), 'utf8'),
'reset.css': fs.readFileSync(__dirname+'/app/css/reset.css', 'utf8'), 'reset.css': fs.readFileSync(path.join(__dirname, '/app/css/reset.css'), 'utf8'),
'lib.css': fs.readFileSync(__dirname+'/app/css/lib.css', 'utf8'), 'lib.css': fs.readFileSync(path.join(__dirname, '/app/css/lib.css'), 'utf8'),
'index.css': fs.readFileSync(__dirname+'/app/css/index.css', 'utf8'), 'index.css': fs.readFileSync(path.join(__dirname, '/app/css/index.css'), 'utf8'),
'transitions.css': fs.readFileSync(__dirname+'/app/css/transitions.css', 'utf8'), 'transitions.css': fs.readFileSync(path.join(__dirname, '/app/css/transitions.css'), 'utf8'),
} }
function bundleCss () { function bundleCss () {

View File

@ -26,7 +26,7 @@ var identities = {
address: '0x333462427bcc9133bb46e88bcbe39cd7ef0e7333', address: '0x333462427bcc9133bb46e88bcbe39cd7ef0e7333',
balance: 0.000001, balance: 0.000001,
txCount: 1, txCount: 1,
} },
} }
var unconfTxs = {} var unconfTxs = {}
@ -106,9 +106,9 @@ var container = document.getElementById('app-content')
var css = MetaMaskUiCss() var css = MetaMaskUiCss()
injectCss(css) injectCss(css)
var app = MetaMaskUi({ MetaMaskUi({
container: container, container: container,
accountManager: accountManager accountManager: accountManager,
}) })
// util // util

View File

@ -1,7 +1,5 @@
const React = require('react')
const render = require('react-dom').render const render = require('react-dom').render
const h = require('react-hyperscript') const h = require('react-hyperscript')
const extend = require('xtend')
const Root = require('./app/root') const Root = require('./app/root')
const actions = require('./app/actions') const actions = require('./app/actions')
const configureStore = require('./app/store') const configureStore = require('./app/store')
@ -9,7 +7,6 @@ const configureStore = require('./app/store')
module.exports = launchApp module.exports = launchApp
function launchApp (opts) { function launchApp (opts) {
var accountManager = opts.accountManager var accountManager = opts.accountManager
actions._setAccountManager(accountManager) actions._setAccountManager(accountManager)
@ -18,11 +15,9 @@ function launchApp(opts) {
if (err) throw err if (err) throw err
startApp(metamaskState, accountManager, opts) startApp(metamaskState, accountManager, opts)
}) })
} }
function startApp (metamaskState, accountManager, opts) { function startApp (metamaskState, accountManager, opts) {
// parse opts // parse opts
var store = configureStore({ var store = configureStore({
@ -43,11 +38,6 @@ function startApp(metamaskState, accountManager, opts){
store.dispatch(actions.showConfTxPage()) store.dispatch(actions.showConfTxPage())
} }
// if unconfirmed messages, start on msgConf page
if (Object.keys(metamaskState.unconfMsgs || {}).length) {
store.dispatch(actions.showConfTxPage())
}
accountManager.on('update', function (metamaskState) { accountManager.on('update', function (metamaskState) {
store.dispatch(actions.updateMetamaskState(metamaskState)) store.dispatch(actions.updateMetamaskState(metamaskState))
}) })
@ -59,5 +49,4 @@ function startApp(metamaskState, accountManager, opts){
store: store, store: store,
} }
), opts.container) ), opts.container)
} }

View File

@ -34,10 +34,11 @@ IconFactory.prototype.cacheIcon = function(address, diameter, icon) {
if (!(address in this.cache)) { if (!(address in this.cache)) {
var sizeCache = {} var sizeCache = {}
sizeCache[diameter] = icon sizeCache[diameter] = icon
return this.cache[address] = sizeCache this.cache[address] = sizeCache
return sizeCache
} else { } else {
return this.cache[address][diameter] = icon this.cache[address][diameter] = icon
return icon
} }
} }