Manually linted

This commit is contained in:
Dan Finlay 2016-06-21 13:56:04 -07:00
parent ab15b4c825
commit 8fde8a8921
41 changed files with 95 additions and 153 deletions

View File

@ -603,10 +603,10 @@ window.LiveReloadOptions = { host: 'localhost' };
} else if (__indexOf.call(message.protocols, PROTOCOL_7) >= 0) {
this.protocol = 7
} else if (__indexOf.call(message.protocols, PROTOCOL_6) >= 0) {
this.protocol = 6
} else {
throw new ProtocolError('no supported protocols found')
}
this.protocol = 6
} else {
throw new ProtocolError('no supported protocols found')
}
}
return this.handlers.connected(this.protocol)
} else if (this.protocol === 6) {

View File

@ -12,7 +12,7 @@ function IdManagement (opts) {
this.hdPathString = "m/44'/60'/0'/0"
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) {
@ -60,17 +60,17 @@ function IdManagement (opts) {
}
}
function pad_with_zeroes (number, length) {
var my_string = '' + number
while (my_string.length < length) {
my_string = '0' + my_string
function padWithZeroes (number, length) {
var myString = '' + number
while (myString.length < length) {
myString = '0' + myString
}
return my_string
return myString
}
function concatSig (v, r, s) {
r = pad_with_zeroes(ethUtil.fromSigned(r), 64)
s = pad_with_zeroes(ethUtil.fromSigned(s), 64)
r = padWithZeroes(ethUtil.fromSigned(r), 64)
s = padWithZeroes(ethUtil.fromSigned(s), 64)
r = ethUtil.stripHexPrefix(r.toString('hex'))
s = ethUtil.stripHexPrefix(s.toString('hex'))
v = ethUtil.stripHexPrefix(ethUtil.intToHex(v))

View File

@ -1,10 +1,7 @@
const EventEmitter = require('events').EventEmitter
const inherits = require('util').inherits
const Transaction = require('ethereumjs-tx')
const ethUtil = require('ethereumjs-util')
const LightwalletKeyStore = require('eth-lightwallet').keystore
const LightwalletSigner = require('eth-lightwallet').signing
const async = require('async')
const clone = require('clone')
const extend = require('xtend')
const createId = require('web3-provider-engine/util/random-id')
@ -88,7 +85,6 @@ IdentityStore.prototype.clearSeedWordCache = function (cb) {
IdentityStore.prototype.getState = function () {
var seedWords = this.getSeedIfUnlocked()
var wallet = configManager.getWallet()
return clone(extend(this._currentState, {
isInitialized: !!configManager.getWallet() && !seedWords,
isUnlocked: this._isUnlocked(),
@ -125,7 +121,6 @@ IdentityStore.prototype.setSelectedAddress = function (address, cb) {
}
IdentityStore.prototype.revealAccount = function (cb) {
let addresses = this._getAddresses()
const derivedKey = this._idmgmt.derivedKey
const keyStore = this._keyStore
@ -133,7 +128,6 @@ IdentityStore.prototype.revealAccount = function (cb) {
keyStore.generateNewAddress(derivedKey, 1)
configManager.setWallet(keyStore.serialize())
addresses = this._getAddresses()
this._loadIdentities()
this._didUpdate()
cb(null)
@ -233,7 +227,6 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone
// comes from metamask ui
IdentityStore.prototype.approveTransaction = function (txId, cb) {
var txData = configManager.getTx(txId)
var approvalCb = this._unconfTxCbs[txId] || noop
// accept tx
@ -247,7 +240,6 @@ IdentityStore.prototype.approveTransaction = function (txId, cb) {
// comes from metamask ui
IdentityStore.prototype.cancelTransaction = function (txId) {
var txData = configManager.getTx(txId)
var approvalCb = this._unconfTxCbs[txId] || noop
// reject tx
@ -299,7 +291,6 @@ IdentityStore.prototype.addUnconfirmedMessage = function (msgParams, cb) {
// comes from metamask ui
IdentityStore.prototype.approveMessage = function (msgId, cb) {
var msgData = messageManager.getMsg(msgId)
var approvalCb = this._unconfMsgCbs[msgId] || noop
// accept msg
@ -313,7 +304,6 @@ IdentityStore.prototype.approveMessage = function (msgId, cb) {
// comes from metamask ui
IdentityStore.prototype.cancelMessage = function (msgId) {
var txData = messageManager.getMsg(msgId)
var approvalCb = this._unconfMsgCbs[msgId] || noop
// reject tx

View File

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

View File

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

View File

@ -56,7 +56,7 @@ gulp.task('copy:watch', function(){
gulp.task('lint', function () {
// Ignoring node_modules, dist, and docs folders:
return gulp.src(['app/**/*.js', 'ui/**/*.js', '!node_modules/**', '!dist/**', '!docs/**'])
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).
@ -96,8 +96,8 @@ gulp.task('clean', function clean() {
// high level tasks
gulp.task('dev', gulp.series('dev:js', 'copy', gulp.parallel('copy:watch', 'dev:reload', 'lint')))
gulp.task('build', gulp.series('clean', gulp.parallel('build:js', 'copy', 'lint')))
gulp.task('dev', gulp.series('dev:js', 'copy', gulp.parallel('copy:watch', 'dev:reload')))
gulp.task('build', gulp.series('clean', gulp.parallel('build:js', 'copy')))
// task generators

View File

@ -40,8 +40,6 @@ AccountDetailScreen.prototype.render = function () {
var selected = props.address || Object.keys(props.accounts)[0]
var identity = props.identities[selected]
var account = props.accounts[selected]
var accountDetail = props.accountDetail
var transactions = props.transactions
return (

View File

@ -16,10 +16,8 @@ function NewComponent () {
NewComponent.prototype.render = function () {
const identity = this.props.identity
var mayBeFauceting = identity.mayBeFauceting
var isSelected = this.props.selectedAddress === identity.address
var account = this.props.accounts[identity.address]
var isFauceting = mayBeFauceting && account.balance === '0x0'
const selectedClass = isSelected ? '.selected' : ''
return (

View File

@ -2,7 +2,6 @@ const inherits = require('util').inherits
const Component = require('react').Component
const h = require('react-hyperscript')
const connect = require('react-redux').connect
const extend = require('xtend')
const actions = require('../actions')
const valuesFor = require('../util').valuesFor
const findDOMNode = require('react-dom').findDOMNode

View File

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

View File

@ -1,10 +1,7 @@
const inherits = require('util').inherits
const React = require('react')
const Component = require('react').Component
const PropTypes = require('react').PropTypes
const connect = require('react-redux').connect
const h = require('react-hyperscript')
const extend = require('xtend')
const actions = require('./actions')
const ReactCSSTransitionGroup = require('react-addons-css-transition-group')
// init
@ -25,7 +22,6 @@ const ConfigScreen = require('./config')
const RevealSeedConfirmation = require('./recover-seed/confirmation')
const InfoScreen = require('./info')
const LoadingIndicator = require('./loading')
const txHelper = require('../lib/tx-helper')
const SandwichExpando = require('sandwich-expando')
const MenuDroppo = require('menu-droppo')
const DropMenuItem = require('./components/drop-menu-item')
@ -55,7 +51,6 @@ function mapStateToProps (state) {
App.prototype.render = function () {
var props = this.props
var view = props.currentView.name
var transForward = props.transForward
return (
@ -148,8 +143,6 @@ App.prototype.renderNetworkDropdown = function () {
const state = this.state || {}
const isOpen = state.isNetworkMenuOpen
const checked = h('i.fa.fa-check.fa-lg', { ariaHidden: true })
return h(MenuDroppo, {
isOpen,
onClickOutside: (event) => {

View File

@ -1,9 +1,7 @@
const inherits = require('util').inherits
const ethUtil = require('ethereumjs-util')
const Component = require('react').Component
const h = require('react-hyperscript')
const formatBalance = require('../util').formatBalance
const Identicon = require('./identicon')
const addressSummary = require('../util').addressSummary
const Panel = require('./panel')
@ -21,9 +19,6 @@ AccountPanel.prototype.render = function () {
var account = state.account || {}
var isFauceting = state.isFauceting
var identicon = new Identicon(identity.address, 46).toString()
var identiconSrc = `data:image/png;base64,${identicon}`
var panelOpts = {
key: `accountPanel${identity.address}`,
onClick: (event) => {

View File

@ -12,7 +12,7 @@ function EditableLabel () {
EditableLabel.prototype.render = function () {
const props = this.props
let state = this.state
const state = this.state
if (state && state.isEditingLabel) {
return h('div.editable-label', [

View File

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

View File

@ -2,7 +2,6 @@ const inherits = require('util').inherits
const Component = require('react').Component
const h = require('react-hyperscript')
const metamaskLogo = require('metamask-logo')
const getCaretCoordinates = require('textarea-caret')
const debounce = require('debounce')
module.exports = Mascot

View File

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

View File

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

View File

@ -3,10 +3,7 @@ const h = require('react-hyperscript')
const inherits = require('util').inherits
const AccountPanel = require('./account-panel')
const addressSummary = require('../util').addressSummary
const readableDate = require('../util').readableDate
const formatBalance = require('../util').formatBalance
const dataSize = require('../util').dataSize
module.exports = PendingMsg

View File

@ -6,7 +6,6 @@ const AccountPanel = require('./account-panel')
const addressSummary = require('../util').addressSummary
const readableDate = require('../util').readableDate
const formatBalance = require('../util').formatBalance
const dataSize = require('../util').dataSize
module.exports = PendingTx

View File

@ -10,9 +10,9 @@ function NewComponent () {
}
NewComponent.prototype.render = function () {
var state = this.props
const props = this.props
return (
h('span', 'Placeholder component')
h('span', props.message)
)
}

View File

@ -12,7 +12,7 @@ function TransactionIcon () {
}
TransactionIcon.prototype.render = function () {
const { transaction, txParams, isTx, isMsg } = this.props
const { transaction, txParams, isMsg } = this.props
if (transaction.status === 'rejected') {
return h('i.fa.fa-exclamation-triangle.fa-lg.error', {

View File

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

View File

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

View File

@ -3,10 +3,7 @@ const Component = require('react').Component
const ReactCSSTransitionGroup = require('react-addons-css-transition-group')
const h = require('react-hyperscript')
const connect = require('react-redux').connect
const copyToClipboard = require('copy-to-clipboard')
const actions = require('./actions')
const AccountPanel = require('./components/account-panel')
const valuesFor = require('./util').valuesFor
const txHelper = require('../lib/tx-helper')
const ConfirmTx = require('./components/pending-tx')

View File

@ -8,7 +8,6 @@ module.exports = connect(mapStateToProps)(ConfigScreen)
function mapStateToProps (state) {
return {
rpc: state.metamask.rpcTarget,
metamask: state.metamask,
}
}
@ -20,7 +19,6 @@ function ConfigScreen () {
ConfigScreen.prototype.render = function () {
var state = this.props
var rpc = state.rpc
var metamaskState = state.metamask
return (

View File

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

View File

@ -17,7 +17,6 @@ function InfoScreen () {
InfoScreen.prototype.render = function () {
var state = this.props
var rpc = state.rpc
var manifest = chrome.runtime.getManifest()
return (
h('.flex-column.flex-grow', [

View File

@ -2,7 +2,6 @@ const inherits = require('util').inherits
const Component = require('react').Component
const h = require('react-hyperscript')
const connect = require('react-redux').connect
const actions = require('./actions')
const ReactCSSTransitionGroup = require('react-addons-css-transition-group')
module.exports = connect(mapStateToProps)(LoadingIndicator)

View File

@ -1,5 +1,3 @@
const combineReducers = require('redux').combineReducers
const actions = require('./actions')
const extend = require('xtend')
//

View File

@ -1,6 +1,5 @@
const extend = require('xtend')
const actions = require('../actions')
const valuesFor = require('../util').valuesFor
const txHelper = require('../../lib/tx-helper')
module.exports = reduceApp
@ -180,7 +179,7 @@ function reduceApp (state, action) {
return extend(appState, {
currentView: {
name: 'accountDetail',
context: action.value || account,
context: action.value,
},
accountDetail: {
subview: 'transactions',
@ -205,7 +204,6 @@ function reduceApp (state, action) {
})
case actions.SHOW_ACCOUNTS_PAGE:
var seedWords = state.metamask.seedWords
return extend(appState, {
currentView: {
name: seedWords ? 'createVaultComplete' : 'accounts',

View File

@ -1,5 +1,4 @@
const extend = require('xtend')
const actions = require('../actions')
module.exports = reduceIdentities

View File

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

View File

@ -1,5 +1,4 @@
const inherits = require('util').inherits
const React = require('react')
const Component = require('react').Component
const Provider = require('react-redux').Provider
const h = require('react-hyperscript')

View File

@ -6,7 +6,6 @@ const Identicon = require('./components/identicon')
const actions = require('./actions')
const util = require('./util')
const numericBalance = require('./util').numericBalance
const formatBalance = require('./util').formatBalance
const addressSummary = require('./util').addressSummary
const EtherBalance = require('./components/eth-balance')
const ethUtil = require('ethereumjs-util')
@ -212,14 +211,15 @@ SendTransactionScreen.prototype.onSubmit = function () {
const value = util.normalizeEthStringToWei(input)
const txData = document.querySelector('input[name="txData"]').value
const balance = this.props.balance
let message
if (value.gt(balance)) {
var message = 'Insufficient funds.'
message = 'Insufficient funds.'
return this.props.dispatch(actions.displayWarning(message))
}
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))
}

View File

@ -2,17 +2,12 @@ const inherits = require('util').inherits
const Component = require('react').Component
const h = require('react-hyperscript')
const connect = require('react-redux').connect
const copyToClipboard = require('copy-to-clipboard')
const actions = require('./actions')
const AccountPanel = require('./components/account-panel')
module.exports = connect(mapStateToProps)(AppSettingsPage)
function mapStateToProps (state) {
return {
identities: state.metamask.identities,
address: state.appState.currentView.context,
}
return {}
}
inherits(AppSettingsPage, Component)
@ -21,8 +16,6 @@ function AppSettingsPage () {
}
AppSettingsPage.prototype.render = function () {
var state = this.props
var identity = state.identities[state.address]
return (
h('.account-detail-section.flex-column.flex-grow', [

View File

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

View File

@ -84,13 +84,13 @@ function weiToEth (bn) {
// Takes hex, returns [beforeDecimal, afterDecimal]
function parseBalance (balance) {
let beforeDecimal, afterDecimal
let wei = numericBalance(balance).toString()
let trailingZeros = /0+$/
var beforeDecimal, afterDecimal
const wei = numericBalance(balance).toString()
const trailingZeros = /0+$/
beforeDecimal = wei.length > 18 ? wei.slice(0, wei.length - 18) : '0'
afterDecimal = ("000000000000000000" + wei).slice(-18).replace(trailingZeros, "")
if(afterDecimal == ""){afterDecimal = "0" }
beforeDecimal = wei.length > 18 ? wei.slice(0, wei.length - 18) : '0'
afterDecimal = ('000000000000000000' + wei).slice(-18).replace(trailingZeros, '')
if (afterDecimal === '') { afterDecimal = '0' }
return [beforeDecimal, afterDecimal]
}
@ -161,7 +161,7 @@ function readableDate (ms) {
var minutes = '0' + date.getMinutes()
var seconds = '0' + date.getSeconds()
var date = `${month}/${day}/${year}`
var dateStr = `${month}/${day}/${year}`
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 path = require('path')
module.exports = bundleCss
var cssFiles = {
'fonts.css': fs.readFileSync(__dirname + '/app/css/fonts.css', 'utf8'),
'reset.css': fs.readFileSync(__dirname + '/app/css/reset.css', 'utf8'),
'lib.css': fs.readFileSync(__dirname + '/app/css/lib.css', 'utf8'),
'index.css': fs.readFileSync(__dirname + '/app/css/index.css', 'utf8'),
'transitions.css': fs.readFileSync(__dirname + '/app/css/transitions.css', 'utf8'),
'fonts.css': fs.readFileSync(path.join(__dirname, '/app/css/fonts.css'), 'utf8'),
'reset.css': fs.readFileSync(path.join(__dirname, '/app/css/reset.css'), 'utf8'),
'lib.css': fs.readFileSync(path.join(__dirname, '/app/css/lib.css'), 'utf8'),
'index.css': fs.readFileSync(path.join(__dirname, '/app/css/index.css'), 'utf8'),
'transitions.css': fs.readFileSync(path.join(__dirname, '/app/css/transitions.css'), 'utf8'),
}
function bundleCss () {

View File

@ -106,7 +106,7 @@ var container = document.getElementById('app-content')
var css = MetaMaskUiCss()
injectCss(css)
var app = MetaMaskUi({
MetaMaskUi({
container: container,
accountManager: accountManager,
})

View File

@ -1,7 +1,5 @@
const React = require('react')
const render = require('react-dom').render
const h = require('react-hyperscript')
const extend = require('xtend')
const Root = require('./app/root')
const actions = require('./app/actions')
const configureStore = require('./app/store')
@ -40,11 +38,6 @@ function startApp (metamaskState, accountManager, opts) {
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) {
store.dispatch(actions.updateMetamaskState(metamaskState))
})

View File

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