aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-06-22 04:18:32 +0800
committerDan Finlay <dan@danfinlay.com>2016-06-22 04:18:32 +0800
commita08c3bc01b11fbd0e3a243359befbe9fc909edf4 (patch)
treeb79b7324139945c429ca4b6c74715d8040fdf4e1 /ui
parentf7f8f8b1c50be39db22a7b10c6c6db007fe590aa (diff)
downloadtangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.gz
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.bz2
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.lz
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.xz
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.zst
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.zip
Auto linted
Diffstat (limited to 'ui')
-rw-r--r--ui/app/account-detail.js26
-rw-r--r--ui/app/accounts/account-panel.js11
-rw-r--r--ui/app/accounts/index.js100
-rw-r--r--ui/app/actions.js113
-rw-r--r--ui/app/app.js54
-rw-r--r--ui/app/components/account-export.js21
-rw-r--r--ui/app/components/account-panel.js15
-rw-r--r--ui/app/components/drop-menu-item.js8
-rw-r--r--ui/app/components/editable-label.js19
-rw-r--r--ui/app/components/eth-balance.js4
-rw-r--r--ui/app/components/identicon.js6
-rw-r--r--ui/app/components/mascot.js14
-rw-r--r--ui/app/components/network.js58
-rw-r--r--ui/app/components/panel.js5
-rw-r--r--ui/app/components/pending-msg.js9
-rw-r--r--ui/app/components/pending-tx.js9
-rw-r--r--ui/app/components/template.js5
-rw-r--r--ui/app/components/transaction-list-item-icon.js11
-rw-r--r--ui/app/components/transaction-list-item.js22
-rw-r--r--ui/app/components/transaction-list.js8
-rw-r--r--ui/app/conf-tx.js20
-rw-r--r--ui/app/config.js47
-rw-r--r--ui/app/first-time/create-vault-complete.js11
-rw-r--r--ui/app/first-time/create-vault.js17
-rw-r--r--ui/app/first-time/disclaimer.js13
-rw-r--r--ui/app/first-time/init-menu.js15
-rw-r--r--ui/app/first-time/restore-vault.js16
-rw-r--r--ui/app/info.js141
-rw-r--r--ui/app/loading.js8
-rw-r--r--ui/app/recover-seed/confirmation.js23
-rw-r--r--ui/app/reducers.js5
-rw-r--r--ui/app/reducers/app.js612
-rw-r--r--ui/app/reducers/identities.js4
-rw-r--r--ui/app/reducers/metamask.js185
-rw-r--r--ui/app/root.js9
-rw-r--r--ui/app/send.js21
-rw-r--r--ui/app/settings.js16
-rw-r--r--ui/app/store.js3
-rw-r--r--ui/app/template.js10
-rw-r--r--ui/app/unlock.js21
-rw-r--r--ui/app/util.js87
-rw-r--r--ui/css.js18
-rw-r--r--ui/example.js30
-rw-r--r--ui/index.js12
-rw-r--r--ui/lib/explorer-link.js2
-rw-r--r--ui/lib/icon-factory.js17
-rw-r--r--ui/lib/tx-helper.js2
47 files changed, 913 insertions, 970 deletions
diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js
index 663ba234b..8e07822e0 100644
--- a/ui/app/account-detail.js
+++ b/ui/app/account-detail.js
@@ -17,7 +17,7 @@ const EditableLabel = require('./components/editable-label')
module.exports = connect(mapStateToProps)(AccountDetailScreen)
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {
identities: state.metamask.identities,
accounts: state.metamask.accounts,
@@ -31,11 +31,11 @@ function mapStateToProps(state) {
}
inherits(AccountDetailScreen, Component)
-function AccountDetailScreen() {
+function AccountDetailScreen () {
Component.call(this)
}
-AccountDetailScreen.prototype.render = function() {
+AccountDetailScreen.prototype.render = function () {
var props = this.props
var selected = props.address || Object.keys(props.accounts)[0]
var identity = props.identities[selected]
@@ -88,7 +88,7 @@ AccountDetailScreen.prototype.render = function() {
style: {
height: '62px',
paddingTop: '8px',
- }
+ },
}, [
h(EditableLabel, {
textValue: identity ? identity.name : '',
@@ -101,7 +101,7 @@ AccountDetailScreen.prototype.render = function() {
}, [
// What is shown when not editing + edit text:
- h('label.editing-label',[h('.edit-text','edit')]),
+ h('label.editing-label', [h('.edit-text', 'edit')]),
h('h2.font-medium.color-forest', {name: 'edit'}, identity && identity.name),
]),
]),
@@ -124,7 +124,7 @@ AccountDetailScreen.prototype.render = function() {
h('img.cursor-pointer.color-orange', {
src: 'images/copy.svg',
onClick: () => copyToClipboard(ethUtil.toChecksumAddress(selected)),
- style:{
+ style: {
margin: '0px 5px',
},
}),
@@ -132,7 +132,7 @@ AccountDetailScreen.prototype.render = function() {
h('img.cursor-pointer.color-orange', {
src: 'images/download.svg',
onClick: () => this.requestAccountExport(selected),
- style:{
+ style: {
margin: '0px 5px',
},
}),
@@ -174,7 +174,7 @@ AccountDetailScreen.prototype.render = function() {
)
}
-AccountDetailScreen.prototype.subview = function() {
+AccountDetailScreen.prototype.subview = function () {
var subview
try {
subview = this.props.accountDetail.subview
@@ -193,7 +193,7 @@ AccountDetailScreen.prototype.subview = function() {
}
}
-AccountDetailScreen.prototype.transactionList = function() {
+AccountDetailScreen.prototype.transactionList = function () {
const { transactions, unconfTxs, unconfMsgs, address, network } = this.props
var txsToRender = transactions
@@ -209,18 +209,18 @@ AccountDetailScreen.prototype.transactionList = function() {
network,
unconfTxs,
unconfMsgs,
- viewPendingTx:(txId) => {
+ viewPendingTx: (txId) => {
this.props.dispatch(actions.viewPendingTx(txId))
- }
+ },
})
}
-AccountDetailScreen.prototype.navigateToAccounts = function(event){
+AccountDetailScreen.prototype.navigateToAccounts = function (event) {
event.stopPropagation()
this.props.dispatch(actions.showAccountsPage())
}
-AccountDetailScreen.prototype.requestAccountExport = function() {
+AccountDetailScreen.prototype.requestAccountExport = function () {
this.props.dispatch(actions.requestExportAccount())
}
diff --git a/ui/app/accounts/account-panel.js b/ui/app/accounts/account-panel.js
index b49f4c098..42d186201 100644
--- a/ui/app/accounts/account-panel.js
+++ b/ui/app/accounts/account-panel.js
@@ -9,13 +9,12 @@ const Identicon = require('../components/identicon')
module.exports = NewComponent
-
inherits(NewComponent, Component)
-function NewComponent() {
+function NewComponent () {
Component.call(this)
}
-NewComponent.prototype.render = function() {
+NewComponent.prototype.render = function () {
const identity = this.props.identity
var mayBeFauceting = identity.mayBeFauceting
var isSelected = this.props.selectedAddress === identity.address
@@ -35,7 +34,7 @@ NewComponent.prototype.render = function() {
h('.identicon-wrapper.flex-column.flex-center.select-none', [
this.pendingOrNot(),
h(Identicon, {
- address: identity.address
+ address: identity.address,
}),
]),
@@ -68,14 +67,14 @@ NewComponent.prototype.render = function() {
event.stopPropagation()
event.preventDefault()
copyToClipboard(ethUtil.toChecksumAddress(identity.address))
- }
+ },
}),
]),
])
)
}
-NewComponent.prototype.pendingOrNot = function() {
+NewComponent.prototype.pendingOrNot = function () {
const pending = this.props.pending
if (pending.length === 0) return null
return h('.pending-dot', pending.length)
diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js
index 8215a559a..240abd6d9 100644
--- a/ui/app/accounts/index.js
+++ b/ui/app/accounts/index.js
@@ -10,8 +10,7 @@ const AccountPanel = require('./account-panel')
module.exports = connect(mapStateToProps)(AccountsScreen)
-
-function mapStateToProps(state) {
+function mapStateToProps (state) {
const pendingTxs = valuesFor(state.metamask.unconfTxs)
const pendingMsgs = valuesFor(state.metamask.unconfMsgs)
const pending = pendingTxs.concat(pendingMsgs)
@@ -28,12 +27,11 @@ function mapStateToProps(state) {
}
inherits(AccountsScreen, Component)
-function AccountsScreen() {
+function AccountsScreen () {
Component.call(this)
}
-
-AccountsScreen.prototype.render = function() {
+AccountsScreen.prototype.render = function () {
var state = this.props
var identityList = valuesFor(state.identities)
var unconfTxList = valuesFor(state.unconfTxs)
@@ -63,48 +61,48 @@ AccountsScreen.prototype.render = function() {
height: '418px',
overflowY: 'auto',
overflowX: 'hidden',
- }
+ },
},
- [
- identityList.map((identity) => {
- const pending = this.props.pending.filter((txOrMsg) => {
- if ('txParams' in txOrMsg) {
- return txOrMsg.txParams.from === identity.address
- } else if ('msgParams' in txOrMsg) {
- return txOrMsg.msgParams.from === identity.address
- } else {
- return false
- }
- })
-
- return h(AccountPanel, {
- key: `acct-panel-${identity.address}`,
- identity,
- selectedAddress: this.props.selectedAddress,
- accounts: this.props.accounts,
- onShowDetail: this.onShowDetail.bind(this),
- pending,
- })
- }),
-
- h('hr.horizontal-line', {key: 'horizontal-line1'}),
- h('div.footer.hover-white.pointer', {
- key: 'reveal-account-bar',
- onClick:() => {
- actions.revealAccount()
- },
- style: {
- display: 'flex',
- flex: '1 0 auto',
- height: '40px',
- paddint: '10px',
- justifyContent: 'center',
- alignItems: 'center',
- }
- }, [
- h('i.fa.fa-plus.fa-lg', {key: ''}),
+ [
+ identityList.map((identity) => {
+ const pending = this.props.pending.filter((txOrMsg) => {
+ if ('txParams' in txOrMsg) {
+ return txOrMsg.txParams.from === identity.address
+ } else if ('msgParams' in txOrMsg) {
+ return txOrMsg.msgParams.from === identity.address
+ } else {
+ return false
+ }
+ })
+
+ return h(AccountPanel, {
+ key: `acct-panel-${identity.address}`,
+ identity,
+ selectedAddress: this.props.selectedAddress,
+ accounts: this.props.accounts,
+ onShowDetail: this.onShowDetail.bind(this),
+ pending,
+ })
+ }),
+
+ h('hr.horizontal-line', {key: 'horizontal-line1'}),
+ h('div.footer.hover-white.pointer', {
+ key: 'reveal-account-bar',
+ onClick: () => {
+ actions.revealAccount()
+ },
+ style: {
+ display: 'flex',
+ flex: '1 0 auto',
+ height: '40px',
+ paddint: '10px',
+ justifyContent: 'center',
+ alignItems: 'center',
+ },
+ }, [
+ h('i.fa.fa-plus.fa-lg', {key: ''}),
+ ]),
]),
- ]),
unconfTxList.length ? (
@@ -123,7 +121,7 @@ AccountsScreen.prototype.render = function() {
}
// If a new account was revealed, scroll to the bottom
-AccountsScreen.prototype.componentDidUpdate = function(){
+AccountsScreen.prototype.componentDidUpdate = function () {
const scrollToBottom = this.props.scrollToBottom
if (scrollToBottom) {
@@ -133,27 +131,27 @@ AccountsScreen.prototype.componentDidUpdate = function(){
}
}
-AccountsScreen.prototype.navigateToConfTx = function(){
+AccountsScreen.prototype.navigateToConfTx = function () {
event.stopPropagation()
this.props.dispatch(actions.showConfTxPage())
}
-AccountsScreen.prototype.onSelect = function(address, event){
+AccountsScreen.prototype.onSelect = function (address, event) {
event.stopPropagation()
// if already selected, deselect
if (this.props.selectedAddress === address) address = null
this.props.dispatch(actions.setSelectedAddress(address))
}
-AccountsScreen.prototype.onShowDetail = function(address, event){
+AccountsScreen.prototype.onShowDetail = function (address, event) {
event.stopPropagation()
this.props.dispatch(actions.showAccountDetail(address))
}
-AccountsScreen.prototype.onRevealAccount = function() {
+AccountsScreen.prototype.onRevealAccount = function () {
this.props.dispatch(actions.revealAccount())
}
-AccountsScreen.prototype.goHome = function() {
+AccountsScreen.prototype.goHome = function () {
this.props.dispatch(actions.goHome())
}
diff --git a/ui/app/actions.js b/ui/app/actions.js
index e178d2340..5ceae6b6c 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -114,11 +114,11 @@ var actions = {
module.exports = actions
var _accountManager = null
-function _setAccountManager(accountManager){
+function _setAccountManager (accountManager) {
_accountManager = accountManager
}
-function goHome() {
+function goHome () {
return {
type: actions.GO_HOME,
}
@@ -126,20 +126,20 @@ function goHome() {
// menu state
-function toggleMenu() {
+function toggleMenu () {
return {
type: actions.TOGGLE_MENU,
}
}
-function closeMenu() {
+function closeMenu () {
return {
type: actions.SET_MENU_STATE,
value: false,
}
}
-function getNetworkStatus(){
+function getNetworkStatus () {
return {
type: actions.getNetworkStatus,
}
@@ -147,7 +147,7 @@ function getNetworkStatus(){
// async actions
-function tryUnlockMetamask(password) {
+function tryUnlockMetamask (password) {
return (dispatch) => {
dispatch(actions.unlockInProgress())
_accountManager.submitPassword(password, (err, selectedAccount) => {
@@ -160,7 +160,7 @@ function tryUnlockMetamask(password) {
}
}
-function createNewVault(password, entropy) {
+function createNewVault (password, entropy) {
return (dispatch) => {
dispatch(actions.createNewVaultInProgress())
_accountManager.createNewVault(password, entropy, (err, result) => {
@@ -169,13 +169,13 @@ function createNewVault(password, entropy) {
}
}
-function revealSeedConfirmation() {
+function revealSeedConfirmation () {
return {
type: this.REVEAL_SEED_CONFIRMATION,
}
}
-function requestRevealSeed(password) {
+function requestRevealSeed (password) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
_accountManager.tryPassword(password, (err, seed) => {
@@ -189,7 +189,7 @@ function requestRevealSeed(password) {
}
}
-function recoverFromSeed(password, seed) {
+function recoverFromSeed (password, seed) {
return (dispatch) => {
// dispatch(actions.createNewVaultInProgress())
dispatch(actions.showLoadingIndication())
@@ -199,23 +199,23 @@ function recoverFromSeed(password, seed) {
var account = Object.keys(metamaskState.identities)[0]
dispatch(actions.unlockMetamask(account))
- })
+ })
}
}
-function showInfoPage() {
+function showInfoPage () {
return {
type: actions.SHOW_INFO_PAGE,
}
}
-function setSelectedAddress(address) {
+function setSelectedAddress (address) {
return (dispatch) => {
_accountManager.setSelectedAddress(address)
}
}
-function revealAccount() {
+function revealAccount () {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
_accountManager.revealAccount((err) => {
@@ -228,7 +228,7 @@ function revealAccount() {
}
}
-function signMsg(msgData) {
+function signMsg (msgData) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
@@ -241,7 +241,7 @@ function signMsg(msgData) {
}
}
-function signTx(txData) {
+function signTx (txData) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
@@ -255,7 +255,7 @@ function signTx(txData) {
}
}
-function sendTx(txData) {
+function sendTx (txData) {
return (dispatch) => {
_accountManager.approveTransaction(txData.id, (err) => {
if (err) {
@@ -268,26 +268,26 @@ function sendTx(txData) {
}
}
-function completedTx(id) {
+function completedTx (id) {
return {
type: actions.COMPLETED_TX,
id,
}
}
-function txError(err) {
+function txError (err) {
return {
type: actions.TRANSACTION_ERROR,
message: err.message,
}
}
-function cancelMsg(msgData){
+function cancelMsg (msgData) {
_accountManager.cancelMessage(msgData.id)
return actions.completedTx(msgData.id)
}
-function cancelTx(txData){
+function cancelTx (txData) {
_accountManager.cancelTransaction(txData.id)
return actions.completedTx(txData.id)
}
@@ -296,26 +296,25 @@ function cancelTx(txData){
// initialize screen
//
-
-function showCreateVault() {
+function showCreateVault () {
return {
type: actions.SHOW_CREATE_VAULT,
}
}
-function showRestoreVault() {
+function showRestoreVault () {
return {
type: actions.SHOW_RESTORE_VAULT,
}
}
-function showInitializeMenu() {
+function showInitializeMenu () {
return {
type: actions.SHOW_INIT_MENU,
}
}
-function agreeToDisclaimer() {
+function agreeToDisclaimer () {
return (dispatch) => {
dispatch(this.showLoadingIndication())
_accountManager.agreeToDisclaimer((err) => {
@@ -327,13 +326,13 @@ function agreeToDisclaimer() {
}
}
-function createNewVaultInProgress() {
+function createNewVaultInProgress () {
return {
type: actions.CREATE_NEW_VAULT_IN_PROGRESS,
}
}
-function showNewVaultSeed(seed) {
+function showNewVaultSeed (seed) {
return {
type: actions.SHOW_NEW_VAULT_SEED,
value: seed,
@@ -344,33 +343,33 @@ function showNewVaultSeed(seed) {
// unlock screen
//
-function unlockInProgress() {
+function unlockInProgress () {
return {
type: actions.UNLOCK_IN_PROGRESS,
}
}
-function unlockFailed() {
+function unlockFailed () {
return {
type: actions.UNLOCK_FAILED,
}
}
-function unlockMetamask(account) {
+function unlockMetamask (account) {
return {
type: actions.UNLOCK_METAMASK,
value: account,
}
}
-function updateMetamaskState(newState) {
+function updateMetamaskState (newState) {
return {
type: actions.UPDATE_METAMASK_STATE,
value: newState,
}
}
-function lockMetamask() {
+function lockMetamask () {
return (dispatch) => {
_accountManager.setLocked((err) => {
dispatch({
@@ -381,7 +380,7 @@ function lockMetamask() {
}
}
-function showAccountDetail(address) {
+function showAccountDetail (address) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
_accountManager.setSelectedAddress(address, (err, address) => {
@@ -394,20 +393,20 @@ function showAccountDetail(address) {
}
}
-function backToAccountDetail(address) {
+function backToAccountDetail (address) {
return {
type: actions.BACK_TO_ACCOUNT_DETAIL,
value: address,
}
}
-function clearSeedWordCache(account) {
+function clearSeedWordCache (account) {
return {
type: actions.CLEAR_SEED_WORD_CACHE,
value: account,
}
}
-function confirmSeedWords() {
+function confirmSeedWords () {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
_accountManager.clearSeedWordCache((err, account) => {
@@ -417,38 +416,38 @@ function confirmSeedWords() {
}
}
-function showAccountsPage() {
+function showAccountsPage () {
return {
type: actions.SHOW_ACCOUNTS_PAGE,
}
}
-function showConfTxPage() {
+function showConfTxPage () {
return {
type: actions.SHOW_CONF_TX_PAGE,
}
}
-function nextTx() {
+function nextTx () {
return {
type: actions.NEXT_TX,
}
}
-function viewPendingTx(txId) {
+function viewPendingTx (txId) {
return {
type: actions.VIEW_PENDING_TX,
value: txId,
}
}
-function previousTx() {
+function previousTx () {
return {
type: actions.PREVIOUS_TX,
}
}
-function showConfigPage(transitionForward = true) {
+function showConfigPage (transitionForward = true) {
return {
type: actions.SHOW_CONFIG_PAGE,
value: transitionForward,
@@ -459,7 +458,7 @@ function showConfigPage(transitionForward = true) {
// config
//
-function setRpcTarget(newRpc) {
+function setRpcTarget (newRpc) {
_accountManager.setRpcTarget(newRpc)
return {
type: actions.SET_RPC_TARGET,
@@ -467,7 +466,7 @@ function setRpcTarget(newRpc) {
}
}
-function setProviderType(type) {
+function setProviderType (type) {
_accountManager.setProviderType(type)
return {
type: actions.SET_PROVIDER_TYPE,
@@ -475,51 +474,51 @@ function setProviderType(type) {
}
}
-function useEtherscanProvider() {
+function useEtherscanProvider () {
_accountManager.useEtherscanProvider()
return {
type: actions.USE_ETHERSCAN_PROVIDER,
}
}
-function showLoadingIndication() {
+function showLoadingIndication () {
return {
type: actions.SHOW_LOADING,
}
}
-function hideLoadingIndication() {
+function hideLoadingIndication () {
return {
type: actions.HIDE_LOADING,
}
}
-function displayWarning(text) {
+function displayWarning (text) {
return {
type: actions.DISPLAY_WARNING,
value: text,
}
}
-function hideWarning() {
+function hideWarning () {
return {
type: actions.HIDE_WARNING,
}
}
-function requestExportAccount() {
+function requestExportAccount () {
return {
type: actions.REQUEST_ACCOUNT_EXPORT,
}
}
-function exportAccount(address) {
+function exportAccount (address) {
var self = this
- return function(dispatch) {
+ return function (dispatch) {
dispatch(self.showLoadingIndication())
- _accountManager.exportAccount(address, function(err, result) {
+ _accountManager.exportAccount(address, function (err, result) {
dispatch(self.hideLoadingIndication())
if (err) {
@@ -532,14 +531,14 @@ function exportAccount(address) {
}
}
-function showPrivateKey(key) {
+function showPrivateKey (key) {
return {
type: actions.SHOW_PRIVATE_KEY,
value: key,
}
}
-function saveAccountLabel(account, label) {
+function saveAccountLabel (account, label) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
_accountManager.saveAccountLabel(account, label, (err) => {
@@ -555,7 +554,7 @@ function saveAccountLabel(account, label) {
}
}
-function showSendPage() {
+function showSendPage () {
return {
type: actions.SHOW_SEND_PAGE,
}
diff --git a/ui/app/app.js b/ui/app/app.js
index 6088d17e4..b4a44f15e 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -33,11 +33,10 @@ const NetworkIndicator = require('./components/network')
module.exports = connect(mapStateToProps)(App)
-
inherits(App, Component)
-function App() { Component.call(this) }
+function App () { Component.call(this) }
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {
// state from plugin
isConfirmed: state.metamask.isConfirmed,
@@ -54,7 +53,7 @@ function mapStateToProps(state) {
}
}
-App.prototype.render = function() {
+App.prototype.render = function () {
var props = this.props
var view = props.currentView.name
var transForward = props.transForward
@@ -65,7 +64,7 @@ App.prototype.render = function() {
style: {
// Windows was showing a vertical scroll bar:
overflow: 'hidden',
- }
+ },
}, [
h(LoadingIndicator),
@@ -80,7 +79,7 @@ App.prototype.render = function() {
style: {
height: '380px',
width: '360px',
- }
+ },
}, [
h(ReactCSSTransitionGroup, {
className: 'css-transition-group',
@@ -95,7 +94,7 @@ App.prototype.render = function() {
)
}
-App.prototype.renderAppBar = function(){
+App.prototype.renderAppBar = function () {
const props = this.props
const state = this.state || {}
const isNetworkMenuOpen = state.isNetworkMenuOpen || false
@@ -117,11 +116,11 @@ App.prototype.renderAppBar = function(){
h(NetworkIndicator, {
network: this.props.network,
- onClick:(event) => {
+ onClick: (event) => {
event.preventDefault()
event.stopPropagation()
this.setState({ isNetworkMenuOpen: !isNetworkMenuOpen })
- }
+ },
}),
// metamask name
@@ -144,7 +143,7 @@ App.prototype.renderAppBar = function(){
)
}
-App.prototype.renderNetworkDropdown = function() {
+App.prototype.renderNetworkDropdown = function () {
const props = this.props
const state = this.state || {}
const isOpen = state.isNetworkMenuOpen
@@ -153,7 +152,7 @@ App.prototype.renderNetworkDropdown = function() {
return h(MenuDroppo, {
isOpen,
- onClickOutside:(event) => {
+ onClickOutside: (event) => {
this.setState({ isNetworkMenuOpen: !isOpen })
},
style: {
@@ -173,28 +172,28 @@ App.prototype.renderNetworkDropdown = function() {
h(DropMenuItem, {
label: 'Main Ethereum Network',
- closeMenu:() => this.setState({ isNetworkMenuOpen: false }),
- action:() => props.dispatch(actions.setProviderType('mainnet')),
+ closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
+ action: () => props.dispatch(actions.setProviderType('mainnet')),
icon: h('.menu-icon.ether-icon'),
}),
h(DropMenuItem, {
label: 'Morden Test Network',
- closeMenu:() => this.setState({ isNetworkMenuOpen: false }),
- action:() => props.dispatch(actions.setProviderType('testnet')),
+ closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
+ action: () => props.dispatch(actions.setProviderType('testnet')),
icon: h('.menu-icon.morden-icon'),
}),
h(DropMenuItem, {
label: 'Localhost 8545',
- closeMenu:() => this.setState({ isNetworkMenuOpen: false }),
- action:() => props.dispatch(actions.setRpcTarget('http://localhost:8545')),
+ closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
+ action: () => props.dispatch(actions.setRpcTarget('http://localhost:8545')),
icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }),
}),
])
}
-App.prototype.renderDropdown = function() {
+App.prototype.renderDropdown = function () {
const props = this.props
return h(MenuDroppo, {
isOpen: props.menuOpen,
@@ -218,28 +217,28 @@ App.prototype.renderDropdown = function() {
h(DropMenuItem, {
label: 'Settings',
- closeMenu:() => this.props.dispatch(actions.closeMenu()),
- action:() => this.props.dispatch(actions.showConfigPage()),
+ closeMenu: () => this.props.dispatch(actions.closeMenu()),
+ action: () => this.props.dispatch(actions.showConfigPage()),
icon: h('i.fa.fa-gear.fa-lg', { ariaHidden: true }),
}),
h(DropMenuItem, {
label: 'Lock',
- closeMenu:() => this.props.dispatch(actions.closeMenu()),
- action:() => this.props.dispatch(actions.lockMetamask()),
+ closeMenu: () => this.props.dispatch(actions.closeMenu()),
+ action: () => this.props.dispatch(actions.lockMetamask()),
icon: h('i.fa.fa-lock.fa-lg', { ariaHidden: true }),
}),
h(DropMenuItem, {
label: 'Help',
- closeMenu:() => this.props.dispatch(actions.closeMenu()),
- action:() => this.props.dispatch(actions.showInfoPage()),
+ closeMenu: () => this.props.dispatch(actions.closeMenu()),
+ action: () => this.props.dispatch(actions.showInfoPage()),
icon: h('i.fa.fa-question.fa-lg', { ariaHidden: true }),
}),
])
}
-App.prototype.renderPrimary = function(){
+App.prototype.renderPrimary = function () {
var props = this.props
if (!props.isConfirmed) {
@@ -252,7 +251,6 @@ App.prototype.renderPrimary = function(){
// show initialize screen
if (!props.isInitialized) {
-
// show current view
switch (props.currentView.name) {
@@ -305,10 +303,10 @@ App.prototype.renderPrimary = function(){
default:
return h(AccountDetailScreen, {key: 'account-detail'})
- }
+ }
}
-App.prototype.toggleMetamaskActive = function(){
+App.prototype.toggleMetamaskActive = function () {
if (!this.props.isUnlocked) {
// currently inactive: redirect to password box
var passwordBox = document.querySelector('input[type=password]')
diff --git a/ui/app/components/account-export.js b/ui/app/components/account-export.js
index e31951a7d..f36b9faeb 100644
--- a/ui/app/components/account-export.js
+++ b/ui/app/components/account-export.js
@@ -6,14 +6,13 @@ const actions = require('../actions')
module.exports = ExportAccountView
-
inherits(ExportAccountView, Component)
-function ExportAccountView() {
+function ExportAccountView () {
Component.call(this)
}
-ExportAccountView.prototype.render = function() {
- console.log("EXPORT VIEW")
+ExportAccountView.prototype.render = function () {
+ console.log('EXPORT VIEW')
console.dir(this.props)
var state = this.props
var accountDetail = state.accountDetail
@@ -47,13 +46,13 @@ ExportAccountView.prototype.render = function() {
style: {
position: 'relative',
top: '1.5px',
- }
+ },
}),
h('button', {
onClick: () => this.onExportKeyPress({ key: 'Enter', preventDefault: () => {} }),
}, 'Submit'),
h('button', {
- onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address))
+ onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)),
}, 'Cancel'),
])
@@ -72,18 +71,18 @@ ExportAccountView.prototype.render = function() {
webkitUserSelect: 'text',
width: '100%',
},
- onClick: function(event) {
+ onClick: function (event) {
copyToClipboard(accountDetail.privateKey)
- }
+ },
}, accountDetail.privateKey),
h('button', {
- onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address))
+ onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)),
}, 'Done'),
])
}
}
-ExportAccountView.prototype.onExportKeyPress = function(event) {
+ExportAccountView.prototype.onExportKeyPress = function (event) {
if (event.key !== 'Enter') return
event.preventDefault()
@@ -96,6 +95,6 @@ ExportAccountView.prototype.onExportKeyPress = function(event) {
}
}
-ExportAccountView.prototype.exportAccount = function(address) {
+ExportAccountView.prototype.exportAccount = function (address) {
this.props.dispatch(actions.exportAccount(address))
}
diff --git a/ui/app/components/account-panel.js b/ui/app/components/account-panel.js
index 5583d06ae..05ac5d67b 100644
--- a/ui/app/components/account-panel.js
+++ b/ui/app/components/account-panel.js
@@ -10,13 +10,12 @@ const Panel = require('./panel')
module.exports = AccountPanel
-
inherits(AccountPanel, Component)
-function AccountPanel() {
+function AccountPanel () {
Component.call(this)
}
-AccountPanel.prototype.render = function() {
+AccountPanel.prototype.render = function () {
var state = this.props
var identity = state.identity || {}
var account = state.account || {}
@@ -40,21 +39,19 @@ AccountPanel.prototype.render = function() {
value: addressSummary(identity.address),
},
balanceOrFaucetingIndication(account, isFauceting),
- ]
+ ],
}
return h(Panel, panelOpts,
!state.onShowDetail ? null : h('.arrow-right.cursor-pointer', [
h('i.fa.fa-chevron-right.fa-lg'),
]))
-
}
-function balanceOrFaucetingIndication(account, isFauceting) {
-
+function balanceOrFaucetingIndication (account, isFauceting) {
// Temporarily deactivating isFauceting indication
// because it shows fauceting for empty restored accounts.
- if (/*isFauceting*/ false) {
+ if (/* isFauceting*/ false) {
return {
key: 'Account is auto-funding.',
value: 'Please wait.',
@@ -62,7 +59,7 @@ function balanceOrFaucetingIndication(account, isFauceting) {
} else {
return {
key: 'BALANCE',
- value: formatBalance(account.balance)
+ value: formatBalance(account.balance),
}
}
}
diff --git a/ui/app/components/drop-menu-item.js b/ui/app/components/drop-menu-item.js
index c8e61278c..d9fde72ac 100644
--- a/ui/app/components/drop-menu-item.js
+++ b/ui/app/components/drop-menu-item.js
@@ -4,16 +4,14 @@ const inherits = require('util').inherits
module.exports = DropMenuItem
-
inherits(DropMenuItem, Component)
-function DropMenuItem() {
+function DropMenuItem () {
Component.call(this)
}
-DropMenuItem.prototype.render = function() {
-
+DropMenuItem.prototype.render = function () {
return h('li.drop-menu-item', {
- onClick:() => {
+ onClick: () => {
this.props.closeMenu()
this.props.action()
},
diff --git a/ui/app/components/editable-label.js b/ui/app/components/editable-label.js
index 41c129d4e..303c49c44 100644
--- a/ui/app/components/editable-label.js
+++ b/ui/app/components/editable-label.js
@@ -5,46 +5,43 @@ const findDOMNode = require('react-dom').findDOMNode
module.exports = EditableLabel
-
inherits(EditableLabel, Component)
-function EditableLabel() {
+function EditableLabel () {
Component.call(this)
}
-EditableLabel.prototype.render = function() {
+EditableLabel.prototype.render = function () {
const props = this.props
let state = this.state
if (state && state.isEditingLabel) {
-
return h('div.editable-label', [
h('input.sizing-input', {
defaultValue: props.textValue,
- onKeyPress:(event) => {
+ onKeyPress: (event) => {
this.saveIfEnter(event)
},
}),
h('button.editable-button', {
- onClick:() => this.saveText(),
- }, 'Save')
+ onClick: () => this.saveText(),
+ }, 'Save'),
])
-
} else {
return h('div.name-label', {
- onClick:(event) => {
+ onClick: (event) => {
this.setState({ isEditingLabel: true })
},
}, this.props.children)
}
}
-EditableLabel.prototype.saveIfEnter = function(event) {
+EditableLabel.prototype.saveIfEnter = function (event) {
if (event.key === 'Enter') {
this.saveText()
}
}
-EditableLabel.prototype.saveText = function() {
+EditableLabel.prototype.saveText = function () {
var container = findDOMNode(this)
var text = container.querySelector('.editable-label input').value
this.props.saveText(text)
diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js
index 76b75d4c8..0423d2ab6 100644
--- a/ui/app/components/eth-balance.js
+++ b/ui/app/components/eth-balance.js
@@ -7,11 +7,11 @@ const formatBalance = require('../util').formatBalance
module.exports = EthBalanceComponent
inherits(EthBalanceComponent, Component)
-function EthBalanceComponent() {
+function EthBalanceComponent () {
Component.call(this)
}
-EthBalanceComponent.prototype.render = function() {
+EthBalanceComponent.prototype.render = function () {
var state = this.props
var style = state.style
var value = formatBalance(state.value)
diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js
index fd61b3125..5fe07ce7a 100644
--- a/ui/app/components/identicon.js
+++ b/ui/app/components/identicon.js
@@ -9,13 +9,13 @@ const iconFactory = iconFactoryGen(jazzicon)
module.exports = IdenticonComponent
inherits(IdenticonComponent, Component)
-function IdenticonComponent() {
+function IdenticonComponent () {
Component.call(this)
this.defaultDiameter = 46
}
-IdenticonComponent.prototype.render = function() {
+IdenticonComponent.prototype.render = function () {
var state = this.props
var diameter = state.diameter || this.defaultDiameter
return (
@@ -32,7 +32,7 @@ IdenticonComponent.prototype.render = function() {
)
}
-IdenticonComponent.prototype.componentDidMount = function(){
+IdenticonComponent.prototype.componentDidMount = function () {
var state = this.props
var address = state.address
diff --git a/ui/app/components/mascot.js b/ui/app/components/mascot.js
index e043caca1..3e0ecc14f 100644
--- a/ui/app/components/mascot.js
+++ b/ui/app/components/mascot.js
@@ -7,9 +7,8 @@ const debounce = require('debounce')
module.exports = Mascot
-
inherits(Mascot, Component)
-function Mascot() {
+function Mascot () {
Component.call(this)
this.logo = metamaskLogo({
followMouse: true,
@@ -22,8 +21,7 @@ function Mascot() {
this.unfollowMouse = this.logo.setFollowMouse.bind(this.logo, false)
}
-
-Mascot.prototype.render = function() {
+Mascot.prototype.render = function () {
// this is a bit hacky
// the event emitter is on `this.props`
// and we dont get that until render
@@ -36,19 +34,19 @@ Mascot.prototype.render = function() {
)
}
-Mascot.prototype.componentDidMount = function() {
+Mascot.prototype.componentDidMount = function () {
if (!this.logo) return
var targetDivId = 'metamask-mascot-container'
var container = document.getElementById(targetDivId)
container.appendChild(this.logo.canvas)
}
-Mascot.prototype.componentWillUnmount = function() {
+Mascot.prototype.componentWillUnmount = function () {
if (!this.logo) return
this.logo.canvas.remove()
}
-Mascot.prototype.handleAnimationEvents = function(){
+Mascot.prototype.handleAnimationEvents = function () {
if (!this.logo) return
// only setup listeners once
if (this.animations) return
@@ -57,7 +55,7 @@ Mascot.prototype.handleAnimationEvents = function(){
this.animations.on('setFollowMouse', this.logo.setFollowMouse.bind(this.logo))
}
-Mascot.prototype.lookAt = function(target){
+Mascot.prototype.lookAt = function (target) {
if (!this.logo) return
this.unfollowMouse()
this.logo.lookAt(target)
diff --git a/ui/app/components/network.js b/ui/app/components/network.js
index b226a6db6..5a84e7d58 100644
--- a/ui/app/components/network.js
+++ b/ui/app/components/network.js
@@ -6,34 +6,34 @@ module.exports = Network
inherits(Network, Component)
-function Network() {
+function Network () {
Component.call(this)
}
-Network.prototype.render = function() {
+Network.prototype.render = function () {
const state = this.props
const networkNumber = state.network
let iconName, hoverText
- const imagePath = "/images/"
+ const imagePath = '/images/'
- if (networkNumber == 'loading') {
+ if (networkNumber == 'loading') {
return h('img', {
title: 'Attempting to connect to blockchain.',
- onClick:(event) => this.props.onClick(event),
+ onClick: (event) => this.props.onClick(event),
style: {
width: '27px',
- marginRight: '-27px'
+ marginRight: '-27px',
},
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) {
- hoverText = "Morden Test Network"
+ } else if (parseInt(networkNumber) == 2) {
+ hoverText = 'Morden Test Network'
iconName = 'morden-test-network'
- }else {
- hoverText = "Unknown Private Network"
+ } else {
+ hoverText = 'Unknown Private Network'
iconName = 'unknown-private-network'
}
return (
@@ -43,24 +43,24 @@ Network.prototype.render = function() {
marginLeft: '-3px',
},
title: hoverText,
- onClick:(event) => this.props.onClick(event),
- },[
- function() {
- switch (iconName) {
- case 'ethereum-network':
- return h('.menu-icon.ether-icon')
- case 'morden-test-network':
- return h('.menu-icon.morden-icon')
- default:
- return h('i.fa.fa-question-circle.fa-lg', {
- ariaHidden: true,
- style: {
- margin: '10px',
- color: 'rgb(125, 128, 130)',
- },
- })
- }
- }()
+ onClick: (event) => this.props.onClick(event),
+ }, [
+ function () {
+ switch (iconName) {
+ case 'ethereum-network':
+ return h('.menu-icon.ether-icon')
+ case 'morden-test-network':
+ return h('.menu-icon.morden-icon')
+ default:
+ return h('i.fa.fa-question-circle.fa-lg', {
+ ariaHidden: true,
+ style: {
+ margin: '10px',
+ color: 'rgb(125, 128, 130)',
+ },
+ })
+ }
+ }(),
])
)
}
diff --git a/ui/app/components/panel.js b/ui/app/components/panel.js
index 5d72d6068..8841247a7 100644
--- a/ui/app/components/panel.js
+++ b/ui/app/components/panel.js
@@ -6,13 +6,12 @@ const Identicon = require('./identicon')
module.exports = Panel
-
inherits(Panel, Component)
-function Panel() {
+function Panel () {
Component.call(this)
}
-Panel.prototype.render = function() {
+Panel.prototype.render = function () {
var state = this.props
var identity = state.identity || {}
diff --git a/ui/app/components/pending-msg.js b/ui/app/components/pending-msg.js
index b0a6bb87d..2f1b88493 100644
--- a/ui/app/components/pending-msg.js
+++ b/ui/app/components/pending-msg.js
@@ -10,18 +10,17 @@ const dataSize = require('../util').dataSize
module.exports = PendingMsg
-
inherits(PendingMsg, Component)
-function PendingMsg() {
+function PendingMsg () {
Component.call(this)
}
-PendingMsg.prototype.render = function() {
+PendingMsg.prototype.render = function () {
var state = this.props
var msgData = state.txData
var msgParams = msgData.msgParams || {}
- var address = msgParams.from || state.selectedAddress
+ var address = msgParams.from || state.selectedAddress
var identity = state.identities[address] || { address: address }
var account = state.accounts[address] || { address: address }
@@ -34,7 +33,7 @@ PendingMsg.prototype.render = function() {
style: {
fontWeight: 'bold',
textAlign: 'center',
- }
+ },
}, 'Sign Message'),
// account that will sign
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js
index 2bfb89705..69b9d2962 100644
--- a/ui/app/components/pending-tx.js
+++ b/ui/app/components/pending-tx.js
@@ -10,18 +10,17 @@ const dataSize = require('../util').dataSize
module.exports = PendingTx
-
inherits(PendingTx, Component)
-function PendingTx() {
+function PendingTx () {
Component.call(this)
}
-PendingTx.prototype.render = function() {
+PendingTx.prototype.render = function () {
var state = this.props
var txData = state.txData
var txParams = txData.txParams || {}
- var address = txParams.from || state.selectedAddress
+ var address = txParams.from || state.selectedAddress
var identity = state.identities[address] || { address: address }
var account = state.accounts[address] || { address: address }
@@ -34,7 +33,7 @@ PendingTx.prototype.render = function() {
style: {
fontWeight: 'bold',
textAlign: 'center',
- }
+ },
}, 'Submit Transaction'),
// account that will sign
diff --git a/ui/app/components/template.js b/ui/app/components/template.js
index 9e4eca20f..a5203aec8 100644
--- a/ui/app/components/template.js
+++ b/ui/app/components/template.js
@@ -4,13 +4,12 @@ const inherits = require('util').inherits
module.exports = NewComponent
-
inherits(NewComponent, Component)
-function NewComponent() {
+function NewComponent () {
Component.call(this)
}
-NewComponent.prototype.render = function() {
+NewComponent.prototype.render = function () {
var state = this.props
return (
diff --git a/ui/app/components/transaction-list-item-icon.js b/ui/app/components/transaction-list-item-icon.js
index fbee4b218..beeec5192 100644
--- a/ui/app/components/transaction-list-item-icon.js
+++ b/ui/app/components/transaction-list-item-icon.js
@@ -6,20 +6,19 @@ const Identicon = require('./identicon')
module.exports = TransactionIcon
-
inherits(TransactionIcon, Component)
-function TransactionIcon() {
+function TransactionIcon () {
Component.call(this)
}
-TransactionIcon.prototype.render = function() {
+TransactionIcon.prototype.render = function () {
const { transaction, txParams, isTx, isMsg } = this.props
if (transaction.status === 'rejected') {
return h('i.fa.fa-exclamation-triangle.fa-lg.error', {
style: {
width: '24px',
- }
+ },
})
}
@@ -27,7 +26,7 @@ TransactionIcon.prototype.render = function() {
return h('i.fa.fa-certificate.fa-lg', {
style: {
width: '24px',
- }
+ },
})
}
@@ -40,7 +39,7 @@ TransactionIcon.prototype.render = function() {
return h('i.fa.fa-file-text-o.fa-lg', {
style: {
width: '24px',
- }
+ },
})
}
}
diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js
index fc1c3c630..f7b357d61 100644
--- a/ui/app/components/transaction-list-item.js
+++ b/ui/app/components/transaction-list-item.js
@@ -12,13 +12,12 @@ const TransactionIcon = require('./transaction-list-item-icon')
module.exports = TransactionListItem
-
inherits(TransactionListItem, Component)
-function TransactionListItem() {
+function TransactionListItem () {
Component.call(this)
}
-TransactionListItem.prototype.render = function() {
+TransactionListItem.prototype.render = function () {
const { transaction, i, network } = this.props
var date = formatDate(transaction.time)
@@ -76,24 +75,24 @@ TransactionListItem.prototype.render = function() {
)
}
-function domainField(txParams) {
+function domainField (txParams) {
return h('div', {
style: {
fontSize: 'small',
color: '#ABA9AA',
},
- },[
+ }, [
txParams.origin,
])
}
-function recipientField(txParams, transaction, isTx, isMsg) {
+function recipientField (txParams, transaction, isTx, isMsg) {
let message
if (isMsg) {
message = 'Signature Requested'
} else if (txParams.to) {
- message = addressSummary(txParams.to)
+ message = addressSummary(txParams.to)
} else {
message = 'Contract Published'
}
@@ -103,23 +102,22 @@ function recipientField(txParams, transaction, isTx, isMsg) {
fontSize: 'small',
color: '#ABA9AA',
},
- },[
+ }, [
message,
failIfFailed(transaction),
])
-
}
-TransactionListItem.prototype.renderMessage = function() {
+TransactionListItem.prototype.renderMessage = function () {
const { transaction, i, network } = this.props
return h('div', 'wowie, thats a message')
}
-function formatDate(date){
+function formatDate (date) {
return vreme.format(new Date(date), 'March 16 2014 14:30')
}
-function failIfFailed(transaction) {
+function failIfFailed (transaction) {
if (transaction.status === 'rejected') {
return h('span.error', ' (Rejected)')
}
diff --git a/ui/app/components/transaction-list.js b/ui/app/components/transaction-list.js
index ed2e1ee0a..e1b41fb44 100644
--- a/ui/app/components/transaction-list.js
+++ b/ui/app/components/transaction-list.js
@@ -8,11 +8,11 @@ module.exports = TransactionList
inherits(TransactionList, Component)
-function TransactionList() {
+function TransactionList () {
Component.call(this)
}
-TransactionList.prototype.render = function() {
+TransactionList.prototype.render = function () {
const { txsToRender, network, unconfTxs, unconfMsgs } = this.props
const transactions = txsToRender.concat(unconfMsgs)
.sort((a, b) => b.time - a.time)
@@ -53,7 +53,7 @@ TransactionList.prototype.render = function() {
transactions.map((transaction, i) => {
return h(TransactionListItem, {
transaction, i, network,
- showTx:(txId) => {
+ showTx: (txId) => {
this.props.viewPendingTx(txId)
},
})
@@ -64,7 +64,7 @@ TransactionList.prototype.render = function() {
height: '100%',
},
}, 'No transaction history...')]
- ))
+ )),
])
)
}
diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js
index 9092c85c9..fd6dbb3a6 100644
--- a/ui/app/conf-tx.js
+++ b/ui/app/conf-tx.js
@@ -14,7 +14,7 @@ const PendingMsg = require('./components/pending-msg')
module.exports = connect(mapStateToProps)(ConfirmTxScreen)
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {
identities: state.metamask.identities,
accounts: state.metamask.accounts,
@@ -27,12 +27,11 @@ function mapStateToProps(state) {
}
inherits(ConfirmTxScreen, Component)
-function ConfirmTxScreen() {
+function ConfirmTxScreen () {
Component.call(this)
}
-
-ConfirmTxScreen.prototype.render = function() {
+ConfirmTxScreen.prototype.render = function () {
var state = this.props
var unconfTxs = state.unconfTxs
@@ -103,7 +102,6 @@ ConfirmTxScreen.prototype.render = function() {
}
function currentTxView (opts) {
-
if ('txParams' in opts.txData) {
// This is a pending transaction
return h(ConfirmTx, opts)
@@ -113,34 +111,34 @@ function currentTxView (opts) {
}
}
-ConfirmTxScreen.prototype.sendTransaction = function(txData, event){
+ConfirmTxScreen.prototype.sendTransaction = function (txData, event) {
event.stopPropagation()
this.props.dispatch(actions.sendTx(txData))
}
-ConfirmTxScreen.prototype.cancelTransaction = function(txData, event){
+ConfirmTxScreen.prototype.cancelTransaction = function (txData, event) {
event.stopPropagation()
this.props.dispatch(actions.cancelTx(txData))
}
-ConfirmTxScreen.prototype.signMessage = function(msgData, event){
+ConfirmTxScreen.prototype.signMessage = function (msgData, event) {
var params = msgData.msgParams
params.metamaskId = msgData.id
event.stopPropagation()
this.props.dispatch(actions.signMsg(params))
}
-ConfirmTxScreen.prototype.cancelMessage = function(msgData, event){
+ConfirmTxScreen.prototype.cancelMessage = function (msgData, event) {
event.stopPropagation()
this.props.dispatch(actions.cancelMsg(msgData))
}
-ConfirmTxScreen.prototype.goHome = function(event){
+ConfirmTxScreen.prototype.goHome = function (event) {
event.stopPropagation()
this.props.dispatch(actions.goHome())
}
-function warningIfExists(warning) {
+function warningIfExists (warning) {
if (warning) {
return h('span.error', { style: { margin: 'auto' } }, warning)
}
diff --git a/ui/app/config.js b/ui/app/config.js
index c4d473b10..7af3cf0f7 100644
--- a/ui/app/config.js
+++ b/ui/app/config.js
@@ -6,7 +6,7 @@ const actions = require('./actions')
module.exports = connect(mapStateToProps)(ConfigScreen)
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {
rpc: state.metamask.rpcTarget,
metamask: state.metamask,
@@ -14,12 +14,11 @@ function mapStateToProps(state) {
}
inherits(ConfigScreen, Component)
-function ConfigScreen() {
+function ConfigScreen () {
Component.call(this)
}
-
-ConfigScreen.prototype.render = function() {
+ConfigScreen.prototype.render = function () {
var state = this.props
var rpc = state.rpc
var metamaskState = state.metamask
@@ -32,7 +31,7 @@ ConfigScreen.prototype.render = function() {
h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', {
onClick: (event) => {
state.dispatch(actions.goHome())
- }
+ },
}),
h('h2.page-subtitle', 'Configuration'),
]),
@@ -42,7 +41,7 @@ ConfigScreen.prototype.render = function() {
h('.flex-space-around', {
style: {
padding: '20px',
- }
+ },
}, [
currentProviderDisplay(metamaskState),
@@ -56,25 +55,25 @@ ConfigScreen.prototype.render = function() {
height: '30px',
margin: '8px',
},
- onKeyPress(event) {
+ onKeyPress (event) {
if (event.key === 'Enter') {
var element = event.target
var newRpc = element.value
state.dispatch(actions.setRpcTarget(newRpc))
}
- }
+ },
}),
h('button', {
style: {
alignSelf: 'center',
},
- onClick(event) {
+ onClick (event) {
event.preventDefault()
var element = document.querySelector('input#new_rpc')
var newRpc = element.value
state.dispatch(actions.setRpcTarget(newRpc))
- }
- }, 'Save')
+ },
+ }, 'Save'),
]),
h('div', [
@@ -82,10 +81,10 @@ ConfigScreen.prototype.render = function() {
style: {
alignSelf: 'center',
},
- onClick(event) {
+ onClick (event) {
event.preventDefault()
state.dispatch(actions.setProviderType('mainnet'))
- }
+ },
}, 'Use Main Network'),
]),
@@ -94,10 +93,10 @@ ConfigScreen.prototype.render = function() {
style: {
alignSelf: 'center',
},
- onClick(event) {
+ onClick (event) {
event.preventDefault()
state.dispatch(actions.setProviderType('testnet'))
- }
+ },
}, 'Use Morden Test Network'),
]),
@@ -106,10 +105,10 @@ ConfigScreen.prototype.render = function() {
style: {
alignSelf: 'center',
},
- onClick(event) {
+ onClick (event) {
event.preventDefault()
state.dispatch(actions.setRpcTarget('http://localhost:8545/'))
- }
+ },
}, 'Use http://localhost:8545'),
]),
@@ -118,17 +117,17 @@ ConfigScreen.prototype.render = function() {
h('div', {
style: {
marginTop: '20px',
- }
+ },
}, [
h('button', {
style: {
alignSelf: 'center',
},
- onClick(event) {
+ onClick (event) {
event.preventDefault()
state.dispatch(actions.revealSeedConfirmation())
- }
- }, 'Reveal Seed Words')
+ },
+ }, 'Reveal Seed Words'),
]),
]),
@@ -137,7 +136,7 @@ ConfigScreen.prototype.render = function() {
)
}
-function currentProviderDisplay(metamaskState) {
+function currentProviderDisplay (metamaskState) {
var provider = metamaskState.provider
var title, value
@@ -156,10 +155,10 @@ function currentProviderDisplay(metamaskState) {
default:
title = 'Current RPC'
value = metamaskState.provider.rpcTarget
- }
+ }
return h('div', [
h('span', {style: { fontWeight: 'bold', paddingRight: '10px'}}, title),
- h('span', value)
+ h('span', value),
])
}
diff --git a/ui/app/first-time/create-vault-complete.js b/ui/app/first-time/create-vault-complete.js
index 9eceb4421..0ca0a1b22 100644
--- a/ui/app/first-time/create-vault-complete.js
+++ b/ui/app/first-time/create-vault-complete.js
@@ -6,20 +6,19 @@ const actions = require('../actions')
module.exports = connect(mapStateToProps)(CreateVaultCompleteScreen)
-
inherits(CreateVaultCompleteScreen, Component)
-function CreateVaultCompleteScreen() {
+function CreateVaultCompleteScreen () {
Component.call(this)
}
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {
seed: state.appState.currentView.seedWords,
cachedSeed: state.metamask.seedWords,
}
}
-CreateVaultCompleteScreen.prototype.render = function() {
+CreateVaultCompleteScreen.prototype.render = function () {
var state = this.props
var seed = state.seed || state.cachedSeed
@@ -50,7 +49,7 @@ CreateVaultCompleteScreen.prototype.render = function() {
style: {
padding: '12px 20px 0px 20px',
textAlign: 'center',
- }
+ },
}, 'These 12 words can restore all of your MetaMask accounts for this vault.\nSave them somewhere safe and secret.'),
h('textarea.twelve-word-phrase', {
@@ -68,7 +67,7 @@ CreateVaultCompleteScreen.prototype.render = function() {
)
}
-CreateVaultCompleteScreen.prototype.confirmSeedWords = function() {
+CreateVaultCompleteScreen.prototype.confirmSeedWords = function () {
this.props.dispatch(actions.confirmSeedWords())
}
diff --git a/ui/app/first-time/create-vault.js b/ui/app/first-time/create-vault.js
index 1e963aa5a..3dfbf0dbd 100644
--- a/ui/app/first-time/create-vault.js
+++ b/ui/app/first-time/create-vault.js
@@ -7,19 +7,18 @@ const actions = require('../actions')
module.exports = connect(mapStateToProps)(CreateVaultScreen)
-
inherits(CreateVaultScreen, Component)
-function CreateVaultScreen() {
+function CreateVaultScreen () {
Component.call(this)
}
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {
warning: state.appState.warning,
}
}
-CreateVaultScreen.prototype.render = function() {
+CreateVaultScreen.prototype.render = function () {
var state = this.props
return (
@@ -91,24 +90,24 @@ CreateVaultScreen.prototype.render = function() {
)
}
-CreateVaultScreen.prototype.componentDidMount = function(){
+CreateVaultScreen.prototype.componentDidMount = function () {
document.getElementById('password-box').focus()
}
-CreateVaultScreen.prototype.showInitializeMenu = function() {
+CreateVaultScreen.prototype.showInitializeMenu = function () {
this.props.dispatch(actions.showInitializeMenu())
}
// create vault
-CreateVaultScreen.prototype.createVaultOnEnter = function(event) {
+CreateVaultScreen.prototype.createVaultOnEnter = function (event) {
if (event.key === 'Enter') {
event.preventDefault()
this.createNewVault()
}
}
-CreateVaultScreen.prototype.createNewVault = function(){
+CreateVaultScreen.prototype.createNewVault = function () {
var passwordBox = document.getElementById('password-box')
var password = passwordBox.value
var passwordConfirmBox = document.getElementById('password-box-confirm')
@@ -126,5 +125,5 @@ CreateVaultScreen.prototype.createNewVault = function(){
return
}
- this.props.dispatch(actions.createNewVault(password, ''/*entropy*/))
+ this.props.dispatch(actions.createNewVault(password, ''/* entropy*/))
}
diff --git a/ui/app/first-time/disclaimer.js b/ui/app/first-time/disclaimer.js
index fe138c93b..bfd6c490d 100644
--- a/ui/app/first-time/disclaimer.js
+++ b/ui/app/first-time/disclaimer.js
@@ -8,17 +8,16 @@ const path = require('path')
const disclaimer = fs.readFileSync(path.join(__dirname, 'disclaimer.txt')).toString()
module.exports = connect(mapStateToProps)(DisclaimerScreen)
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {}
}
inherits(DisclaimerScreen, Component)
-function DisclaimerScreen() {
+function DisclaimerScreen () {
Component.call(this)
}
-DisclaimerScreen.prototype.render = function() {
-
+DisclaimerScreen.prototype.render = function () {
return (
h('.flex-column.flex-center.flex-grow', [
@@ -43,13 +42,13 @@ DisclaimerScreen.prototype.render = function() {
padding: '6px',
width: '80%',
overflowY: 'scroll',
- }
+ },
}, disclaimer),
h('button', {
style: { marginTop: '18px' },
- onClick: () => this.props.dispatch(actions.agreeToDisclaimer())
- }, 'I Agree')
+ onClick: () => this.props.dispatch(actions.agreeToDisclaimer()),
+ }, 'I Agree'),
])
)
}
diff --git a/ui/app/first-time/init-menu.js b/ui/app/first-time/init-menu.js
index 197193063..5fa6ec501 100644
--- a/ui/app/first-time/init-menu.js
+++ b/ui/app/first-time/init-menu.js
@@ -12,19 +12,19 @@ const CreateVaultCompleteScreen = require('./create-vault-complete')
module.exports = connect(mapStateToProps)(InitializeMenuScreen)
inherits(InitializeMenuScreen, Component)
-function InitializeMenuScreen() {
+function InitializeMenuScreen () {
Component.call(this)
this.animationEventEmitter = new EventEmitter()
}
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {
// state from plugin
currentView: state.appState.currentView,
}
}
-InitializeMenuScreen.prototype.render = function() {
+InitializeMenuScreen.prototype.render = function () {
var state = this.props
switch (state.currentView.name) {
@@ -33,14 +33,13 @@ InitializeMenuScreen.prototype.render = function() {
return this.renderMenu()
}
-
}
// InitializeMenuScreen.prototype.componentDidMount = function(){
// document.getElementById('password-box').focus()
// }
-InitializeMenuScreen.prototype.renderMenu = function() {
+InitializeMenuScreen.prototype.renderMenu = function () {
var state = this.props
return (
@@ -88,15 +87,15 @@ InitializeMenuScreen.prototype.renderMenu = function() {
// this.props.dispatch(actions.showInitializeMenu())
// }
-InitializeMenuScreen.prototype.showInitializeMenu = function() {
+InitializeMenuScreen.prototype.showInitializeMenu = function () {
this.props.dispatch(actions.showInitializeMenu())
}
-InitializeMenuScreen.prototype.showCreateVault = function() {
+InitializeMenuScreen.prototype.showCreateVault = function () {
this.props.dispatch(actions.showCreateVault())
}
-InitializeMenuScreen.prototype.showRestoreVault = function() {
+InitializeMenuScreen.prototype.showRestoreVault = function () {
this.props.dispatch(actions.showRestoreVault())
}
diff --git a/ui/app/first-time/restore-vault.js b/ui/app/first-time/restore-vault.js
index ff3b308c4..684781e50 100644
--- a/ui/app/first-time/restore-vault.js
+++ b/ui/app/first-time/restore-vault.js
@@ -6,20 +6,18 @@ const actions = require('../actions')
module.exports = connect(mapStateToProps)(RestoreVaultScreen)
-
inherits(RestoreVaultScreen, Component)
-function RestoreVaultScreen() {
+function RestoreVaultScreen () {
Component.call(this)
}
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {
warning: state.appState.warning,
}
}
-
-RestoreVaultScreen.prototype.render = function() {
+RestoreVaultScreen.prototype.render = function () {
var state = this.props
return (
@@ -41,7 +39,7 @@ RestoreVaultScreen.prototype.render = function() {
// wallet seed entry
h('h3', 'Wallet Seed'),
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
@@ -97,17 +95,17 @@ RestoreVaultScreen.prototype.render = function() {
)
}
-RestoreVaultScreen.prototype.showInitializeMenu = function() {
+RestoreVaultScreen.prototype.showInitializeMenu = function () {
this.props.dispatch(actions.showInitializeMenu())
}
-RestoreVaultScreen.prototype.onMaybeCreate = function(event) {
+RestoreVaultScreen.prototype.onMaybeCreate = function (event) {
if (event.key === 'Enter') {
this.restoreVault()
}
}
-RestoreVaultScreen.prototype.restoreVault = function(){
+RestoreVaultScreen.prototype.restoreVault = function () {
// check password
var passwordBox = document.getElementById('password-box')
var password = passwordBox.value
diff --git a/ui/app/info.js b/ui/app/info.js
index b69e006d5..04b740069 100644
--- a/ui/app/info.js
+++ b/ui/app/info.js
@@ -6,19 +6,19 @@ const actions = require('./actions')
module.exports = connect(mapStateToProps)(InfoScreen)
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {}
}
inherits(InfoScreen, Component)
-function InfoScreen() {
+function InfoScreen () {
Component.call(this)
}
-InfoScreen.prototype.render = function() {
+InfoScreen.prototype.render = function () {
var state = this.props
var rpc = state.rpc
- var manifest = chrome.runtime.getManifest();
+ var manifest = chrome.runtime.getManifest()
return (
h('.flex-column.flex-grow', [
@@ -27,7 +27,7 @@ InfoScreen.prototype.render = function() {
h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', {
onClick: (event) => {
state.dispatch(actions.goHome())
- }
+ },
}),
h('h2.page-subtitle', 'Info'),
]),
@@ -37,96 +37,93 @@ InfoScreen.prototype.render = function() {
h('.flex-space-around', {
style: {
padding: '20px',
- }
+ },
}, [
- //current version number
+ // current version number
- h('.info.info-gray',[
- h('div','Metamask'),
+ h('.info.info-gray', [
+ h('div', 'Metamask'),
h('div', {
style: {
- marginBottom: '10px',
- }
- },`Version: ${manifest.version}`),
+ marginBottom: '10px',
+ },
+ }, `Version: ${manifest.version}`),
]),
- h('hr',{
+ h('hr', {
style: {
- margin:'20px 0 ',
+ margin: '20px 0 ',
width: '7em',
- }
+ },
}),
-
- h('.info',{
- style: {
- marginBottom: '20px',
- }},
+ h('.info', {
+ style: {
+ marginBottom: '20px',
+ }},
`For more information on MetaMask
you can visit our web site. If you want to
contact us with questions or just
say 'Hi', you can find us on theise platforms:`),
- h('div',{
+ h('div', {
style: {
paddingLeft: '30px',
}},
- [
- h('div', [
- h('a', {
- href: 'https://metamask.io/',
- target: '_blank',
- onClick(event) { this.navigateTo(event.target.href) },
- },[
- h('img.icon-size', {
- src: manifest.icons[128]
- }),
- h('div.info',{
- style: {
- fontWeight: 800,
- }
- },'Visit our web site')
- ])
- ]),
- h('div.fa.fa-slack', [
- h('a.info', {
- href: 'http://slack.metamask.io',
- target: '_blank',
- onClick(event) { this.navigateTo(event.target.href) },
- }, 'Join the conversation on Slack'),
- ]),
-
-
- h('div.fa.fa-twitter', [
- h('a.info', {
- href: 'https://twitter.com/metamask_io',
- target: '_blank',
- onClick(event) { this.navigateTo(event.target.href) },
- }, 'Follow us on Twitter'),
- ]),
-
- h('div.fa.fa-envelope', [
- h('a.info', {
- href: 'mailto:hello@metamask.io?subject=Feedback',
- target: '_blank',
- }, 'Email us any questions or comments!'),
+ [
+ h('div', [
+ h('a', {
+ href: 'https://metamask.io/',
+ target: '_blank',
+ onClick (event) { this.navigateTo(event.target.href) },
+ }, [
+ h('img.icon-size', {
+ src: manifest.icons[128],
+ }),
+ h('div.info', {
+ style: {
+ fontWeight: 800,
+ },
+ }, 'Visit our web site'),
+ ]),
+ ]),
+ h('div.fa.fa-slack', [
+ h('a.info', {
+ href: 'http://slack.metamask.io',
+ target: '_blank',
+ onClick (event) { this.navigateTo(event.target.href) },
+ }, 'Join the conversation on Slack'),
+ ]),
+
+ h('div.fa.fa-twitter', [
+ h('a.info', {
+ href: 'https://twitter.com/metamask_io',
+ target: '_blank',
+ onClick (event) { this.navigateTo(event.target.href) },
+ }, 'Follow us on Twitter'),
+ ]),
+
+ h('div.fa.fa-envelope', [
+ h('a.info', {
+ href: 'mailto:hello@metamask.io?subject=Feedback',
+ target: '_blank',
+ }, 'Email us any questions or comments!'),
+ ]),
+
+ h('div.fa.fa-github', [
+ h('a.info', {
+ href: 'https://github.com/metamask/talk/issues',
+ target: '_blank',
+ onClick (event) { this.navigateTo(event.target.href) },
+ }, 'Start a thread on Github'),
+ ]),
]),
-
- h('div.fa.fa-github', [
- h('a.info', {
- href: 'https://github.com/metamask/talk/issues',
- target: '_blank',
- onClick(event) { this.navigateTo(event.target.href) },
- }, 'Start a thread on Github'),
- ]),
- ]),
]),
]),
])
)
-
}
-InfoScreen.prototype.navigateTo = function(url) {
- chrome.tabs.create({ url });
+InfoScreen.prototype.navigateTo = function (url) {
+ chrome.tabs.create({ url })
}
diff --git a/ui/app/loading.js b/ui/app/loading.js
index f6279d5cf..f65f58ade 100644
--- a/ui/app/loading.js
+++ b/ui/app/loading.js
@@ -7,18 +7,18 @@ const ReactCSSTransitionGroup = require('react-addons-css-transition-group')
module.exports = connect(mapStateToProps)(LoadingIndicator)
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {
isLoading: state.appState.isLoading,
}
}
inherits(LoadingIndicator, Component)
-function LoadingIndicator() {
+function LoadingIndicator () {
Component.call(this)
}
-LoadingIndicator.prototype.render = function() {
+LoadingIndicator.prototype.render = function () {
var isLoading = this.props.isLoading
return (
@@ -38,7 +38,7 @@ LoadingIndicator.prototype.render = function() {
height: '100%',
width: '100%',
background: 'rgba(255, 255, 255, 0.5)',
- }
+ },
}, [
h('img', {
src: 'images/loading.svg',
diff --git a/ui/app/recover-seed/confirmation.js b/ui/app/recover-seed/confirmation.js
index 0276d547d..55b18025f 100644
--- a/ui/app/recover-seed/confirmation.js
+++ b/ui/app/recover-seed/confirmation.js
@@ -7,13 +7,12 @@ const actions = require('../actions')
module.exports = connect(mapStateToProps)(RevealSeedConfirmatoin)
-
inherits(RevealSeedConfirmatoin, Component)
-function RevealSeedConfirmatoin() {
+function RevealSeedConfirmatoin () {
Component.call(this)
}
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {
warning: state.appState.warning,
}
@@ -21,7 +20,7 @@ function mapStateToProps(state) {
RevealSeedConfirmatoin.prototype.confirmationPhrase = 'I understand'
-RevealSeedConfirmatoin.prototype.render = function() {
+RevealSeedConfirmatoin.prototype.render = function () {
const props = this.props
const state = this.state
@@ -48,7 +47,7 @@ RevealSeedConfirmatoin.prototype.render = function() {
flexDirection: 'column',
padding: '20px',
justifyContent: 'center',
- }
+ },
}, [
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' : ''}`, {
style: {
marginTop: '12px',
- }
- }, `Enter the phrase "I understand" to proceed.`),
+ },
+ }, 'Enter the phrase "I understand" to proceed.'),
// confirm confirmation
h('input.large-input.letter-spacey', {
@@ -105,7 +104,7 @@ RevealSeedConfirmatoin.prototype.render = function() {
h('span.error', {
style: {
margin: '20px',
- }
+ },
}, props.warning.split('-'))
),
@@ -117,24 +116,24 @@ RevealSeedConfirmatoin.prototype.render = function() {
)
}
-RevealSeedConfirmatoin.prototype.componentDidMount = function(){
+RevealSeedConfirmatoin.prototype.componentDidMount = function () {
document.getElementById('password-box').focus()
}
-RevealSeedConfirmatoin.prototype.goHome = function() {
+RevealSeedConfirmatoin.prototype.goHome = function () {
this.props.dispatch(actions.showConfigPage(false))
}
// create vault
-RevealSeedConfirmatoin.prototype.checkConfirmation = function(event) {
+RevealSeedConfirmatoin.prototype.checkConfirmation = function (event) {
if (event.key === 'Enter') {
event.preventDefault()
this.revealSeedWords()
}
}
-RevealSeedConfirmatoin.prototype.revealSeedWords = function(){
+RevealSeedConfirmatoin.prototype.revealSeedWords = function () {
this.setState({ confirmationWrong: false })
const confirmBox = document.getElementById('confirm-box')
diff --git a/ui/app/reducers.js b/ui/app/reducers.js
index 0f2ad4c21..ccd8ac8f6 100644
--- a/ui/app/reducers.js
+++ b/ui/app/reducers.js
@@ -11,8 +11,7 @@ const reduceApp = require('./reducers/app')
module.exports = rootReducer
-function rootReducer(state, action) {
-
+function rootReducer (state, action) {
// clone
state = extend(state)
@@ -34,8 +33,6 @@ function rootReducer(state, action) {
state.appState = reduceApp(state, action)
-
return state
-
}
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js
index 3ee9a61fe..5ad6d82c3 100644
--- a/ui/app/reducers/app.js
+++ b/ui/app/reducers/app.js
@@ -5,8 +5,7 @@ const txHelper = require('../../lib/tx-helper')
module.exports = reduceApp
-function reduceApp(state, action) {
-
+function reduceApp (state, action) {
// clone and defaults
const selectedAccount = state.metamask.selectedAccount
const pendingTxs = hasPendingTxs(state)
@@ -45,343 +44,342 @@ function reduceApp(state, action) {
switch (action.type) {
- case actions.TOGGLE_MENU:
- return extend(appState, {
- menuOpen: !appState.menuOpen,
- })
+ case actions.TOGGLE_MENU:
+ return extend(appState, {
+ menuOpen: !appState.menuOpen,
+ })
- case actions.SET_MENU_STATE:
- return extend(appState, {
- menuOpen: action.value,
- })
+ case actions.SET_MENU_STATE:
+ return extend(appState, {
+ menuOpen: action.value,
+ })
// intialize
- case actions.SHOW_CREATE_VAULT:
- return extend(appState, {
- currentView: {
- name: 'createVault',
- },
- transForward: true,
- warning: null,
- })
-
- case actions.SHOW_RESTORE_VAULT:
- return extend(appState, {
- currentView: {
- name: 'restoreVault',
- },
- transForward: true,
- })
-
- case actions.SHOW_INIT_MENU:
- return extend(appState, {
- currentView: defaultView,
- transForward: false,
- })
-
- case actions.SHOW_CONFIG_PAGE:
- return extend(appState, {
- currentView: {
- name: 'config',
- context: appState.currentView.context,
- },
- transForward: action.value,
- })
-
- case actions.SHOW_INFO_PAGE:
- return extend(appState, {
- currentView: {
- name: 'info',
- context: appState.currentView.context,
- },
- transForward: true,
- })
-
- case actions.CREATE_NEW_VAULT_IN_PROGRESS:
- return extend(appState, {
- currentView: {
- name: 'createVault',
- inProgress: true,
- },
- transForward: true,
- isLoading: true,
- })
-
- case actions.SHOW_NEW_VAULT_SEED:
- return extend(appState, {
- currentView: {
- name: 'createVaultComplete',
- seedWords: action.value,
- },
- transForward: true,
- isLoading: false,
- })
-
- case actions.SHOW_SEND_PAGE:
- return extend(appState, {
- currentView: {
- name: 'sendTransaction',
- context: appState.currentView.context,
- },
- transForward: true,
- warning: null,
- })
+ case actions.SHOW_CREATE_VAULT:
+ return extend(appState, {
+ currentView: {
+ name: 'createVault',
+ },
+ transForward: true,
+ warning: null,
+ })
- // unlock
+ case actions.SHOW_RESTORE_VAULT:
+ return extend(appState, {
+ currentView: {
+ name: 'restoreVault',
+ },
+ transForward: true,
+ })
- case actions.UNLOCK_METAMASK:
- return extend(appState, {
- detailView: {},
- transForward: true,
- isLoading: false,
- warning: null,
- })
-
- case actions.LOCK_METAMASK:
- return extend(appState, {
- currentView: defaultView,
- transForward: false,
- warning: null,
- })
+ case actions.SHOW_INIT_MENU:
+ return extend(appState, {
+ currentView: defaultView,
+ transForward: false,
+ })
- // reveal seed words
+ case actions.SHOW_CONFIG_PAGE:
+ return extend(appState, {
+ currentView: {
+ name: 'config',
+ context: appState.currentView.context,
+ },
+ transForward: action.value,
+ })
- case actions.REVEAL_SEED_CONFIRMATION:
- return extend(appState, {
- currentView: {
- name: 'reveal-seed-conf',
- },
- transForward: true,
- warning: null,
- })
+ case actions.SHOW_INFO_PAGE:
+ return extend(appState, {
+ currentView: {
+ name: 'info',
+ context: appState.currentView.context,
+ },
+ transForward: true,
+ })
+ case actions.CREATE_NEW_VAULT_IN_PROGRESS:
+ return extend(appState, {
+ currentView: {
+ name: 'createVault',
+ inProgress: true,
+ },
+ transForward: true,
+ isLoading: true,
+ })
- // accounts
+ case actions.SHOW_NEW_VAULT_SEED:
+ return extend(appState, {
+ currentView: {
+ name: 'createVaultComplete',
+ seedWords: action.value,
+ },
+ transForward: true,
+ isLoading: false,
+ })
- case actions.SET_SELECTED_ACCOUNT:
- return extend(appState, {
- activeAddress: action.value,
- })
-
- case actions.GO_HOME:
- return extend(appState, {
- currentView: extend(appState.currentView, {
- name: 'accountDetail',
- }),
- accountDetail: {
- subview: 'transactions',
- accountExport: 'none',
- privateKey: '',
- },
- transForward: false,
- warning: null,
- })
-
- case actions.SHOW_ACCOUNT_DETAIL:
- return extend(appState, {
- currentView: {
- name: 'accountDetail',
- context: action.value || account,
- },
- accountDetail: {
- subview: 'transactions',
- accountExport: 'none',
- privateKey: '',
- },
- transForward: false,
- })
-
- case actions.BACK_TO_ACCOUNT_DETAIL:
- return extend(appState, {
- currentView: {
- name: 'accountDetail',
- context: action.value,
- },
- accountDetail: {
- subview: 'transactions',
- accountExport: 'none',
- privateKey: '',
- },
- transForward: false,
- })
-
- case actions.SHOW_ACCOUNTS_PAGE:
- var seedWords = state.metamask.seedWords
- return extend(appState, {
- currentView: {
- name: seedWords ? 'createVaultComplete' : 'accounts',
- seedWords,
- },
- transForward: true,
- isLoading: false,
- warning: null,
- scrollToBottom: false,
- })
-
- case actions.REVEAL_ACCOUNT:
- return extend(appState, {
- scrollToBottom: true,
- })
-
- case actions.SHOW_CONF_TX_PAGE:
- return extend(appState, {
- currentView: {
- name: 'confTx',
- context: 0,
- },
- transForward: true,
- warning: null,
- })
-
- case actions.SHOW_CONF_MSG_PAGE:
- return extend(appState, {
- currentView: {
- name: 'confTx',
- context: 0,
- },
- transForward: true,
- warning: null,
- })
-
- case actions.COMPLETED_TX:
- var unconfTxs = state.metamask.unconfTxs
- var unconfMsgs = state.metamask.unconfMsgs
-
- var unconfTxList = txHelper(unconfTxs, unconfMsgs)
- .filter(tx => tx !== tx.id)
+ case actions.SHOW_SEND_PAGE:
+ return extend(appState, {
+ currentView: {
+ name: 'sendTransaction',
+ context: appState.currentView.context,
+ },
+ transForward: true,
+ warning: null,
+ })
+
+ // unlock
- if (unconfTxList && unconfTxList.length > 0) {
+ case actions.UNLOCK_METAMASK:
return extend(appState, {
+ detailView: {},
+ transForward: true,
+ isLoading: false,
+ warning: null,
+ })
+
+ case actions.LOCK_METAMASK:
+ return extend(appState, {
+ currentView: defaultView,
transForward: false,
+ warning: null,
+ })
+
+ // reveal seed words
+
+ case actions.REVEAL_SEED_CONFIRMATION:
+ return extend(appState, {
currentView: {
- name: 'confTx',
- context: 0,
+ name: 'reveal-seed-conf',
},
+ transForward: true,
warning: null,
})
- } else {
+
+ // accounts
+
+ case actions.SET_SELECTED_ACCOUNT:
return extend(appState, {
+ activeAddress: action.value,
+ })
+
+ case actions.GO_HOME:
+ return extend(appState, {
+ currentView: extend(appState.currentView, {
+ name: 'accountDetail',
+ }),
+ accountDetail: {
+ subview: 'transactions',
+ accountExport: 'none',
+ privateKey: '',
+ },
transForward: false,
warning: null,
+ })
+
+ case actions.SHOW_ACCOUNT_DETAIL:
+ return extend(appState, {
currentView: {
name: 'accountDetail',
- context: state.metamask.selectedAddress,
+ context: action.value || account,
},
accountDetail: {
subview: 'transactions',
+ accountExport: 'none',
+ privateKey: '',
},
+ transForward: false,
})
- }
- case actions.NEXT_TX:
- return extend(appState, {
- transForward: true,
- currentView: {
- name: 'confTx',
- context: ++appState.currentView.context,
+ case actions.BACK_TO_ACCOUNT_DETAIL:
+ return extend(appState, {
+ currentView: {
+ name: 'accountDetail',
+ context: action.value,
+ },
+ accountDetail: {
+ subview: 'transactions',
+ accountExport: 'none',
+ privateKey: '',
+ },
+ transForward: false,
+ })
+
+ case actions.SHOW_ACCOUNTS_PAGE:
+ var seedWords = state.metamask.seedWords
+ return extend(appState, {
+ currentView: {
+ name: seedWords ? 'createVaultComplete' : 'accounts',
+ seedWords,
+ },
+ transForward: true,
+ isLoading: false,
warning: null,
- }
- })
-
- case actions.VIEW_PENDING_TX:
- const context = indexForPending(state, action.value)
- return extend(appState, {
- transForward: true,
- currentView: {
- name: 'confTx',
- context,
+ scrollToBottom: false,
+ })
+
+ case actions.REVEAL_ACCOUNT:
+ return extend(appState, {
+ scrollToBottom: true,
+ })
+
+ case actions.SHOW_CONF_TX_PAGE:
+ return extend(appState, {
+ currentView: {
+ name: 'confTx',
+ context: 0,
+ },
+ transForward: true,
warning: null,
- }
- })
-
- case actions.PREVIOUS_TX:
- return extend(appState, {
- transForward: false,
- currentView: {
- name: 'confTx',
- context: --appState.currentView.context,
+ })
+
+ case actions.SHOW_CONF_MSG_PAGE:
+ return extend(appState, {
+ currentView: {
+ name: 'confTx',
+ context: 0,
+ },
+ transForward: true,
warning: null,
+ })
+
+ case actions.COMPLETED_TX:
+ var unconfTxs = state.metamask.unconfTxs
+ var unconfMsgs = state.metamask.unconfMsgs
+
+ var unconfTxList = txHelper(unconfTxs, unconfMsgs)
+ .filter(tx => tx !== tx.id)
+
+ if (unconfTxList && unconfTxList.length > 0) {
+ return extend(appState, {
+ transForward: false,
+ currentView: {
+ name: 'confTx',
+ context: 0,
+ },
+ warning: null,
+ })
+ } else {
+ return extend(appState, {
+ transForward: false,
+ warning: null,
+ currentView: {
+ name: 'accountDetail',
+ context: state.metamask.selectedAddress,
+ },
+ accountDetail: {
+ subview: 'transactions',
+ },
+ })
}
- })
-
- case actions.TRANSACTION_ERROR:
- return extend(appState, {
- currentView: {
- name: 'confTx',
- errorMessage: 'There was a problem submitting this transaction.',
- },
- })
-
- case actions.UNLOCK_FAILED:
- return extend(appState, {
- warning: 'Incorrect password. Try again.'
- })
-
- case actions.SHOW_LOADING:
- return extend(appState, {
- isLoading: true,
- })
-
- case actions.HIDE_LOADING:
- return extend(appState, {
- isLoading: false,
- })
-
- case actions.CLEAR_SEED_WORD_CACHE:
- return extend(appState, {
- transForward: true,
- currentView: {},
- isLoading: false,
- accountDetail: {
- subview: 'transactions',
- accountExport: 'none',
- privateKey: '',
- },
- })
-
- case actions.DISPLAY_WARNING:
- return extend(appState, {
- warning: action.value,
- })
-
- case actions.HIDE_WARNING:
- return extend(appState, {
- warning: undefined,
- })
-
- case actions.REQUEST_ACCOUNT_EXPORT:
- return extend(appState, {
- transForward: true,
- currentView: {
- name: 'accountDetail',
- context: appState.currentView.context,
- },
- accountDetail: {
- subview: 'export',
- accountExport: 'requested',
- },
- })
-
- case actions.EXPORT_ACCOUNT:
- return extend(appState, {
- accountDetail: {
- subview: 'export',
- accountExport: 'completed',
- },
- })
-
- case actions.SHOW_PRIVATE_KEY:
- return extend(appState, {
- accountDetail: {
- subview: 'export',
- accountExport: 'completed',
- privateKey: action.value,
- },
- })
-
- default:
- return appState
+
+ case actions.NEXT_TX:
+ return extend(appState, {
+ transForward: true,
+ currentView: {
+ name: 'confTx',
+ context: ++appState.currentView.context,
+ warning: null,
+ },
+ })
+
+ case actions.VIEW_PENDING_TX:
+ const context = indexForPending(state, action.value)
+ return extend(appState, {
+ transForward: true,
+ currentView: {
+ name: 'confTx',
+ context,
+ warning: null,
+ },
+ })
+
+ case actions.PREVIOUS_TX:
+ return extend(appState, {
+ transForward: false,
+ currentView: {
+ name: 'confTx',
+ context: --appState.currentView.context,
+ warning: null,
+ },
+ })
+
+ case actions.TRANSACTION_ERROR:
+ return extend(appState, {
+ currentView: {
+ name: 'confTx',
+ errorMessage: 'There was a problem submitting this transaction.',
+ },
+ })
+
+ case actions.UNLOCK_FAILED:
+ return extend(appState, {
+ warning: 'Incorrect password. Try again.',
+ })
+
+ case actions.SHOW_LOADING:
+ return extend(appState, {
+ isLoading: true,
+ })
+
+ case actions.HIDE_LOADING:
+ return extend(appState, {
+ isLoading: false,
+ })
+
+ case actions.CLEAR_SEED_WORD_CACHE:
+ return extend(appState, {
+ transForward: true,
+ currentView: {},
+ isLoading: false,
+ accountDetail: {
+ subview: 'transactions',
+ accountExport: 'none',
+ privateKey: '',
+ },
+ })
+
+ case actions.DISPLAY_WARNING:
+ return extend(appState, {
+ warning: action.value,
+ })
+
+ case actions.HIDE_WARNING:
+ return extend(appState, {
+ warning: undefined,
+ })
+
+ case actions.REQUEST_ACCOUNT_EXPORT:
+ return extend(appState, {
+ transForward: true,
+ currentView: {
+ name: 'accountDetail',
+ context: appState.currentView.context,
+ },
+ accountDetail: {
+ subview: 'export',
+ accountExport: 'requested',
+ },
+ })
+
+ case actions.EXPORT_ACCOUNT:
+ return extend(appState, {
+ accountDetail: {
+ subview: 'export',
+ accountExport: 'completed',
+ },
+ })
+
+ case actions.SHOW_PRIVATE_KEY:
+ return extend(appState, {
+ accountDetail: {
+ subview: 'export',
+ accountExport: 'completed',
+ privateKey: action.value,
+ },
+ })
+
+ default:
+ return appState
}
}
@@ -392,7 +390,7 @@ function hasPendingTxs (state) {
return unconfTxList.length > 0
}
-function indexForPending(state, txId) {
+function indexForPending (state, txId) {
var unconfTxs = state.metamask.unconfTxs
var unconfMsgs = state.metamask.unconfMsgs
var unconfTxList = txHelper(unconfTxs, unconfMsgs)
diff --git a/ui/app/reducers/identities.js b/ui/app/reducers/identities.js
index 95ecd23f9..be5518b47 100644
--- a/ui/app/reducers/identities.js
+++ b/ui/app/reducers/identities.js
@@ -3,8 +3,7 @@ const actions = require('../actions')
module.exports = reduceIdentities
-function reduceIdentities(state, action) {
-
+function reduceIdentities (state, action) {
// clone + defaults
var idState = extend({
@@ -14,5 +13,4 @@ function reduceIdentities(state, action) {
default:
return idState
}
-
}
diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js
index 646100120..670312830 100644
--- a/ui/app/reducers/metamask.js
+++ b/ui/app/reducers/metamask.js
@@ -3,8 +3,7 @@ const actions = require('../actions')
module.exports = reduceMetamask
-function reduceMetamask(state, action) {
-
+function reduceMetamask (state, action) {
// clone + defaults
var metamaskState = extend({
isInitialized: false,
@@ -17,99 +16,99 @@ function reduceMetamask(state, action) {
switch (action.type) {
- case actions.SHOW_ACCOUNTS_PAGE:
- var state = extend(metamaskState)
- delete state.seedWords
- return state
-
- case actions.UPDATE_METAMASK_STATE:
- return extend(metamaskState, action.value)
-
- case actions.AGREE_TO_DISCLAIMER:
- return extend(metamaskState, {
- isConfirmed: true,
- })
-
- case actions.UNLOCK_METAMASK:
- return extend(metamaskState, {
- isUnlocked: true,
- isInitialized: true,
- selectedAccount: action.value,
- })
-
- case actions.LOCK_METAMASK:
- return extend(metamaskState, {
- isUnlocked: false,
- })
-
- case actions.SET_RPC_TARGET:
- return extend(metamaskState, {
- provider: {
- type: 'rpc',
- rpcTarget: action.value,
- },
- })
-
- case actions.SET_PROVIDER_TYPE:
- return extend(metamaskState, {
- provider: {
- type: action.value,
- },
- })
-
- case actions.COMPLETED_TX:
- var stringId = String(action.id)
- var newState = extend(metamaskState, {
- unconfTxs: {},
- unconfMsgs: {},
- })
- for (var id in metamaskState.unconfTxs) {
- if (id !== stringId) {
- newState.unconfTxs[id] = metamaskState.unconfTxs[id]
+ case actions.SHOW_ACCOUNTS_PAGE:
+ var state = extend(metamaskState)
+ delete state.seedWords
+ return state
+
+ case actions.UPDATE_METAMASK_STATE:
+ return extend(metamaskState, action.value)
+
+ case actions.AGREE_TO_DISCLAIMER:
+ return extend(metamaskState, {
+ isConfirmed: true,
+ })
+
+ case actions.UNLOCK_METAMASK:
+ return extend(metamaskState, {
+ isUnlocked: true,
+ isInitialized: true,
+ selectedAccount: action.value,
+ })
+
+ case actions.LOCK_METAMASK:
+ return extend(metamaskState, {
+ isUnlocked: false,
+ })
+
+ case actions.SET_RPC_TARGET:
+ return extend(metamaskState, {
+ provider: {
+ type: 'rpc',
+ rpcTarget: action.value,
+ },
+ })
+
+ case actions.SET_PROVIDER_TYPE:
+ return extend(metamaskState, {
+ provider: {
+ type: action.value,
+ },
+ })
+
+ case actions.COMPLETED_TX:
+ var stringId = String(action.id)
+ var newState = extend(metamaskState, {
+ unconfTxs: {},
+ unconfMsgs: {},
+ })
+ for (var id in metamaskState.unconfTxs) {
+ if (id !== stringId) {
+ newState.unconfTxs[id] = metamaskState.unconfTxs[id]
+ }
}
- }
- for (var id in metamaskState.unconfMsgs) {
- if (id !== stringId) {
- newState.unconfMsgs[id] = metamaskState.unconfMsgs[id]
+ for (var id in metamaskState.unconfMsgs) {
+ if (id !== stringId) {
+ newState.unconfMsgs[id] = metamaskState.unconfMsgs[id]
+ }
}
- }
- return newState
-
- case actions.SHOW_NEW_VAULT_SEED:
- return extend(metamaskState, {
- isUnlocked: true,
- isInitialized: false,
- })
-
- case actions.CLEAR_SEED_WORD_CACHE:
- var newState = extend(metamaskState, {
- isUnlocked: true,
- isInitialized: true,
- selectedAccount: action.value,
- })
- delete newState.seedWords
- return newState
-
- case actions.SHOW_ACCOUNT_DETAIL:
- const newState = extend(metamaskState, {
- isUnlocked: true,
- isInitialized: true,
- selectedAccount: action.value,
- selectedAddress: action.value,
- })
- delete newState.seedWords
- return newState
-
- case actions.SAVE_ACCOUNT_LABEL:
- const account = action.value.account
- const name = action.value.label
- var id = {}
- id[account] = extend(metamaskState.identities[account], { name })
- var identities = extend(metamaskState.identities, id)
- return extend(metamaskState, { identities })
-
- default:
- return metamaskState
+ return newState
+
+ case actions.SHOW_NEW_VAULT_SEED:
+ return extend(metamaskState, {
+ isUnlocked: true,
+ isInitialized: false,
+ })
+
+ case actions.CLEAR_SEED_WORD_CACHE:
+ var newState = extend(metamaskState, {
+ isUnlocked: true,
+ isInitialized: true,
+ selectedAccount: action.value,
+ })
+ delete newState.seedWords
+ return newState
+
+ case actions.SHOW_ACCOUNT_DETAIL:
+ const newState = extend(metamaskState, {
+ isUnlocked: true,
+ isInitialized: true,
+ selectedAccount: action.value,
+ selectedAddress: action.value,
+ })
+ delete newState.seedWords
+ return newState
+
+ case actions.SAVE_ACCOUNT_LABEL:
+ const account = action.value.account
+ const name = action.value.label
+ var id = {}
+ id[account] = extend(metamaskState.identities[account], { name })
+ var identities = extend(metamaskState.identities, id)
+ return extend(metamaskState, { identities })
+
+ default:
+ return metamaskState
}
}
diff --git a/ui/app/root.js b/ui/app/root.js
index 9fedf625f..92c32d324 100644
--- a/ui/app/root.js
+++ b/ui/app/root.js
@@ -7,17 +7,16 @@ const App = require('./app')
module.exports = Root
-
inherits(Root, Component)
-function Root() { Component.call(this) }
+function Root () { Component.call(this) }
-Root.prototype.render = function() {
+Root.prototype.render = function () {
return (
-
+
h(Provider, {
store: this.props.store,
}, [
- h(App)
+ h(App),
])
)
diff --git a/ui/app/send.js b/ui/app/send.js
index ba4e5bfff..a5a9d69f1 100644
--- a/ui/app/send.js
+++ b/ui/app/send.js
@@ -13,7 +13,7 @@ const ethUtil = require('ethereumjs-util')
module.exports = connect(mapStateToProps)(SendTransactionScreen)
-function mapStateToProps(state) {
+function mapStateToProps (state) {
var result = {
address: state.metamask.selectedAccount,
accounts: state.metamask.accounts,
@@ -31,11 +31,11 @@ function mapStateToProps(state) {
}
inherits(SendTransactionScreen, Component)
-function SendTransactionScreen() {
+function SendTransactionScreen () {
Component.call(this)
}
-SendTransactionScreen.prototype.render = function() {
+SendTransactionScreen.prototype.render = function () {
var state = this.props
var address = state.address
var account = state.account
@@ -111,7 +111,7 @@ SendTransactionScreen.prototype.render = function() {
// h('div', formatBalance(account && account.balance)),
h(EtherBalance, {
value: account && account.balance,
- })
+ }),
]),
@@ -140,7 +140,7 @@ SendTransactionScreen.prototype.render = function() {
h('input.large-input', {
name: 'address',
placeholder: 'Recipient Address',
- })
+ }),
]),
// 'amount' and send button
@@ -160,7 +160,7 @@ SendTransactionScreen.prototype.render = function() {
style: {
textTransform: 'uppercase',
},
- }, 'Send')
+ }, 'Send'),
]),
@@ -187,7 +187,7 @@ SendTransactionScreen.prototype.render = function() {
style: {
width: '100%',
resize: 'none',
- }
+ },
}),
]),
@@ -196,18 +196,17 @@ SendTransactionScreen.prototype.render = function() {
)
}
-SendTransactionScreen.prototype.navigateToAccounts = function(event){
+SendTransactionScreen.prototype.navigateToAccounts = function (event) {
event.stopPropagation()
this.props.dispatch(actions.showAccountsPage())
}
-SendTransactionScreen.prototype.back = function() {
+SendTransactionScreen.prototype.back = function () {
var address = this.props.address
this.props.dispatch(actions.backToAccountDetail(address))
}
-SendTransactionScreen.prototype.onSubmit = function() {
-
+SendTransactionScreen.prototype.onSubmit = function () {
const recipient = document.querySelector('input[name="address"]').value
const input = document.querySelector('input[name="amount"]').value
const value = util.normalizeEthStringToWei(input)
diff --git a/ui/app/settings.js b/ui/app/settings.js
index 9a11ef680..2b0c16c62 100644
--- a/ui/app/settings.js
+++ b/ui/app/settings.js
@@ -8,7 +8,7 @@ const AccountPanel = require('./components/account-panel')
module.exports = connect(mapStateToProps)(AppSettingsPage)
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {
identities: state.metamask.identities,
address: state.appState.currentView.context,
@@ -16,12 +16,11 @@ function mapStateToProps(state) {
}
inherits(AppSettingsPage, Component)
-function AppSettingsPage() {
+function AppSettingsPage () {
Component.call(this)
}
-
-AppSettingsPage.prototype.render = function() {
+AppSettingsPage.prototype.render = function () {
var state = this.props
var identity = state.identities[state.address]
return (
@@ -47,23 +46,22 @@ AppSettingsPage.prototype.render = function() {
}),
])
-
+
)
}
-AppSettingsPage.prototype.componentDidMount = function(){
+AppSettingsPage.prototype.componentDidMount = function () {
document.querySelector('input').focus()
}
-AppSettingsPage.prototype.onKeyPress = function(event) {
+AppSettingsPage.prototype.onKeyPress = function (event) {
// get submit event
if (event.key === 'Enter') {
// this.submitPassword(event)
}
}
-
-AppSettingsPage.prototype.navigateToAccounts = function(event){
+AppSettingsPage.prototype.navigateToAccounts = function (event) {
event.stopPropagation()
this.props.dispatch(actions.showAccountsPage())
}
diff --git a/ui/app/store.js b/ui/app/store.js
index a738f1a12..ab6422e73 100644
--- a/ui/app/store.js
+++ b/ui/app/store.js
@@ -6,7 +6,6 @@ const rootReducer = require('./reducers')
module.exports = configureStore
-
const loggerMiddleware = createLogger()
const createStoreWithMiddleware = applyMiddleware(
@@ -14,6 +13,6 @@ const createStoreWithMiddleware = applyMiddleware(
loggerMiddleware
)(createStore)
-function configureStore(initialState) {
+function configureStore (initialState) {
return createStoreWithMiddleware(rootReducer, initialState)
}
diff --git a/ui/app/template.js b/ui/app/template.js
index f16f3c363..3189a838c 100644
--- a/ui/app/template.js
+++ b/ui/app/template.js
@@ -6,25 +6,25 @@ const actions = require('./actions')
module.exports = connect(mapStateToProps)(COMPONENTNAME)
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {}
}
inherits(COMPONENTNAME, Component)
-function COMPONENTNAME() {
+function COMPONENTNAME () {
Component.call(this)
}
-COMPONENTNAME.prototype.render = function() {
+COMPONENTNAME.prototype.render = function () {
const props = this.props
return (
h('div', {
style: {
background: 'blue',
- }
+ },
}, [
- 'Hello, world!'
+ 'Hello, world!',
])
)
}
diff --git a/ui/app/unlock.js b/ui/app/unlock.js
index 687bb5e52..a7896d640 100644
--- a/ui/app/unlock.js
+++ b/ui/app/unlock.js
@@ -9,20 +9,19 @@ const EventEmitter = require('events').EventEmitter
module.exports = connect(mapStateToProps)(UnlockScreen)
-
inherits(UnlockScreen, Component)
-function UnlockScreen() {
+function UnlockScreen () {
Component.call(this)
this.animationEventEmitter = new EventEmitter()
}
-function mapStateToProps(state) {
+function mapStateToProps (state) {
return {
warning: state.appState.warning,
}
}
-UnlockScreen.prototype.render = function() {
+UnlockScreen.prototype.render = function () {
const state = this.props
const warning = state.warning
return (
@@ -55,7 +54,7 @@ UnlockScreen.prototype.render = function() {
h('.error', {
style: {
display: warning ? 'block' : 'none',
- }
+ },
}, warning),
h('button.primary.cursor-pointer', {
@@ -70,23 +69,23 @@ UnlockScreen.prototype.render = function() {
)
}
-UnlockScreen.prototype.componentDidMount = function(){
+UnlockScreen.prototype.componentDidMount = function () {
document.getElementById('password-box').focus()
}
-UnlockScreen.prototype.onSubmit = function(event) {
+UnlockScreen.prototype.onSubmit = function (event) {
const input = document.getElementById('password-box')
const password = input.value
this.props.dispatch(actions.tryUnlockMetamask(password))
}
-UnlockScreen.prototype.onKeyPress = function(event) {
+UnlockScreen.prototype.onKeyPress = function (event) {
if (event.key === 'Enter') {
this.submitPassword(event)
}
}
-UnlockScreen.prototype.submitPassword = function(event){
+UnlockScreen.prototype.submitPassword = function (event) {
var element = event.target
var password = element.value
// reset input
@@ -94,7 +93,7 @@ UnlockScreen.prototype.submitPassword = function(event){
this.props.dispatch(actions.tryUnlockMetamask(password))
}
-UnlockScreen.prototype.inputChanged = function(event){
+UnlockScreen.prototype.inputChanged = function (event) {
// tell mascot to look at page action
var element = event.target
var boundingRect = element.getBoundingClientRect()
@@ -105,6 +104,6 @@ UnlockScreen.prototype.inputChanged = function(event){
})
}
-UnlockScreen.prototype.emitAnim = function(name, a, b, c){
+UnlockScreen.prototype.emitAnim = function (name, a, b, c) {
this.animationEventEmitter.emit(name, a, b, c)
}
diff --git a/ui/app/util.js b/ui/app/util.js
index 6ece28a9e..5252fc9d3 100644
--- a/ui/app/util.js
+++ b/ui/app/util.js
@@ -1,17 +1,17 @@
const ethUtil = require('ethereumjs-util')
var valueTable = {
- wei: '1000000000000000000',
- kwei: '1000000000000000',
- mwei: '1000000000000',
- gwei: '1000000000',
+ wei: '1000000000000000000',
+ kwei: '1000000000000000',
+ mwei: '1000000000000',
+ gwei: '1000000000',
szabo: '1000000',
- finney:'1000',
+ finney: '1000',
ether: '1',
- kether:'0.001',
- mether:'0.000001',
- gether:'0.000000001',
- tether:'0.000000000001',
+ kether: '0.001',
+ mether: '0.000001',
+ gether: '0.000000001',
+ tether: '0.000000000001',
}
var bnTable = {}
for (var currency in valueTable) {
@@ -37,25 +37,24 @@ module.exports = {
bnTable: bnTable,
}
-
-function valuesFor(obj) {
+function valuesFor (obj) {
if (!obj) return []
return Object.keys(obj)
- .map(function(key){ return obj[key] })
+ .map(function (key) { return obj[key] })
}
-function addressSummary(address) {
+function addressSummary (address) {
if (!address) return ''
var checked = ethUtil.toChecksumAddress(address)
- return checked ? checked.slice(0,2+8)+'...'+checked.slice(-4) : '...'
+ return checked ? checked.slice(0, 2 + 8) + '...' + checked.slice(-4) : '...'
}
-function isValidAddress(address) {
+function isValidAddress (address) {
var prefixed = ethUtil.addHexPrefix(address)
return (isAllOneCase(prefixed) && ethUtil.isValidAddress(prefixed)) || ethUtil.isValidChecksumAddress(prefixed)
}
-function isAllOneCase(address) {
+function isAllOneCase (address) {
if (!address) return true
var lower = address.toLowerCase()
var upper = address.toUpperCase()
@@ -63,84 +62,84 @@ function isAllOneCase(address) {
}
// Takes wei Hex, returns wei BN, even if input is null
-function numericBalance(balance) {
+function numericBalance (balance) {
if (!balance) return new ethUtil.BN(0, 16)
var stripped = ethUtil.stripHexPrefix(balance)
return new ethUtil.BN(stripped, 16)
}
// Takes eth BN, returns BN wei
-function ethToWei(bn) {
+function ethToWei (bn) {
var eth = new ethUtil.BN('1000000000000000000')
var wei = bn.mul(eth)
return wei
}
// Takes BN in Wei, returns BN in eth
-function weiToEth(bn) {
+function weiToEth (bn) {
var diff = new ethUtil.BN('1000000000000000000')
var eth = bn.div(diff)
return eth
}
// Takes hex, returns [beforeDecimal, afterDecimal]
-function parseBalance(balance) {
+function parseBalance (balance) {
if (!balance || balance === '0x0') return ['0', '0']
var wei = numericBalance(balance).toString(10)
- var eth = String(wei/valueTable['wei'])
+ var eth = String(wei / valueTable['wei'])
var beforeDecimal = String(Math.floor(eth))
var afterDecimal
- if(eth.indexOf('.') > -1){
+ if (eth.indexOf('.') > -1) {
afterDecimal = eth.slice(eth.indexOf('.') + 1)
- }else{
+ } else {
afterDecimal = '0'
}
return [beforeDecimal, afterDecimal]
}
// Takes wei hex, returns "None" or "${formattedAmount} ETH"
-function formatBalance(balance, decimalsToKeep) {
+function formatBalance (balance, decimalsToKeep) {
var parsed = parseBalance(balance)
var beforeDecimal = parsed[0]
var afterDecimal = parsed[1]
- var formatted = "None"
- if(decimalsToKeep === undefined){
- if(beforeDecimal === '0'){
- if(afterDecimal !== '0'){
- var sigFigs = afterDecimal.match(/^0*(.{2})/) //default: grabs 2 most significant digits
- if(sigFigs){afterDecimal = sigFigs[0]}
+ var formatted = 'None'
+ if (decimalsToKeep === undefined) {
+ if (beforeDecimal === '0') {
+ if (afterDecimal !== '0') {
+ var sigFigs = afterDecimal.match(/^0*(.{2})/) // default: grabs 2 most significant digits
+ if (sigFigs) { afterDecimal = sigFigs[0] }
formatted = '0.' + afterDecimal + ' ETH'
}
- }else{
- formatted = beforeDecimal + "." + afterDecimal.slice(0,3) + ' ETH'
+ } else {
+ formatted = beforeDecimal + '.' + afterDecimal.slice(0, 3) + ' ETH'
}
- }else{
- afterDecimal += Array(decimalsToKeep).join("0")
- formatted = beforeDecimal + "." + afterDecimal.slice(0,decimalsToKeep) + ' ETH'
+ } else {
+ afterDecimal += Array(decimalsToKeep).join('0')
+ formatted = beforeDecimal + '.' + afterDecimal.slice(0, decimalsToKeep) + ' ETH'
}
return formatted
}
-function dataSize(data) {
+function dataSize (data) {
var size = data ? ethUtil.stripHexPrefix(data).length : 0
- return size+' bytes'
+ return size + ' bytes'
}
// Takes a BN and an ethereum currency name,
// returns a BN in wei
-function normalizeToWei(amount, currency) {
+function normalizeToWei (amount, currency) {
try {
return amount.mul(bnTable.wei).div(bnTable[currency])
} catch (e) {}
return amount
}
-function normalizeEthStringToWei(str) {
+function normalizeEthStringToWei (str) {
const parts = str.split('.')
let eth = new ethUtil.BN(parts[0], 10).mul(bnTable.wei)
if (parts[1]) {
var decimal = parts[1]
- while(decimal.length < 18) {
+ while (decimal.length < 18) {
decimal += '0'
}
const decimalBN = new ethUtil.BN(decimal, 10)
@@ -150,20 +149,20 @@ function normalizeEthStringToWei(str) {
}
var multiple = new ethUtil.BN('10000', 10)
-function normalizeNumberToWei(n, currency) {
+function normalizeNumberToWei (n, currency) {
var enlarged = n * 10000
var amount = new ethUtil.BN(String(enlarged), 10)
return normalizeToWei(amount, currency).div(multiple)
}
-function readableDate(ms) {
+function readableDate (ms) {
var date = new Date(ms)
var month = date.getMonth()
var day = date.getDate()
var year = date.getFullYear()
var hours = date.getHours()
- var minutes = "0" + date.getMinutes()
- var seconds = "0" + date.getSeconds()
+ var minutes = '0' + date.getMinutes()
+ var seconds = '0' + date.getSeconds()
var date = `${month}/${day}/${year}`
var time = `${hours}:${minutes.substr(-2)}:${seconds.substr(-2)}`
diff --git a/ui/css.js b/ui/css.js
index b7bc7d363..8b2c511f0 100644
--- a/ui/css.js
+++ b/ui/css.js
@@ -3,23 +3,23 @@ const fs = require('fs')
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(__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'),
}
-function bundleCss() {
- var cssBundle = Object.keys(cssFiles).reduce(function(bundle, fileName){
+function bundleCss () {
+ var cssBundle = Object.keys(cssFiles).reduce(function (bundle, fileName) {
var fileContent = cssFiles[fileName]
var output = String()
- output += '/*========== '+fileName+' ==========*/\n\n'
+ output += '/*========== ' + fileName + ' ==========*/\n\n'
output += fileContent
output += '\n\n'
- return bundle+output
+ return bundle + output
}, String())
return cssBundle
diff --git a/ui/example.js b/ui/example.js
index b32da4be4..c143937c1 100644
--- a/ui/example.js
+++ b/ui/example.js
@@ -26,7 +26,7 @@ var identities = {
address: '0x333462427bcc9133bb46e88bcbe39cd7ef0e7333',
balance: 0.000001,
txCount: 1,
- }
+ },
}
var unconfTxs = {}
@@ -42,7 +42,7 @@ addUnconfTx({
data: '0x000462427bcc9133bb46e88bcbe39cd7ef0e7000',
})
-function addUnconfTx(txParams){
+function addUnconfTx (txParams) {
var time = (new Date()).getTime()
var id = createRandomId()
unconfTxs[id] = {
@@ -55,7 +55,7 @@ function addUnconfTx(txParams){
var isUnlocked = false
var selectedAddress = null
-function getState(){
+function getState () {
return {
isUnlocked: isUnlocked,
identities: isUnlocked ? identities : {},
@@ -66,16 +66,16 @@ function getState(){
var accountManager = new EventEmitter()
-accountManager.getState = function(cb){
+accountManager.getState = function (cb) {
cb(null, getState())
}
-accountManager.setLocked = function(){
+accountManager.setLocked = function () {
isUnlocked = false
this._didUpdate()
}
-accountManager.submitPassword = function(password, cb){
+accountManager.submitPassword = function (password, cb) {
if (password === 'test') {
isUnlocked = true
cb(null, getState())
@@ -85,17 +85,17 @@ accountManager.submitPassword = function(password, cb){
}
}
-accountManager.setSelectedAddress = function(address, cb){
+accountManager.setSelectedAddress = function (address, cb) {
selectedAddress = address
cb(null, getState())
this._didUpdate()
}
-accountManager.signTransaction = function(txParams, cb){
+accountManager.signTransaction = function (txParams, cb) {
alert('signing tx....')
}
-accountManager._didUpdate = function(){
+accountManager._didUpdate = function () {
this.emit('update', getState())
}
@@ -108,16 +108,16 @@ injectCss(css)
var app = MetaMaskUi({
container: container,
- accountManager: accountManager
+ accountManager: accountManager,
})
// util
-function createRandomId(){
+function createRandomId () {
// 13 time digits
- var datePart = new Date().getTime()*Math.pow(10, 3)
+ var datePart = new Date().getTime() * Math.pow(10, 3)
// 3 random digits
- var extraPart = Math.floor(Math.random()*Math.pow(10, 3))
+ var extraPart = Math.floor(Math.random() * Math.pow(10, 3))
// 16 digits
- return datePart+extraPart
-} \ No newline at end of file
+ return datePart + extraPart
+}
diff --git a/ui/index.js b/ui/index.js
index d67c6f096..694a7164c 100644
--- a/ui/index.js
+++ b/ui/index.js
@@ -8,21 +8,18 @@ const configureStore = require('./app/store')
module.exports = launchApp
-function launchApp(opts) {
-
+function launchApp (opts) {
var accountManager = opts.accountManager
actions._setAccountManager(accountManager)
// check if we are unlocked first
- accountManager.getState(function(err, metamaskState){
+ accountManager.getState(function (err, metamaskState) {
if (err) throw err
startApp(metamaskState, accountManager, opts)
})
-
}
-function startApp(metamaskState, accountManager, opts){
-
+function startApp (metamaskState, accountManager, opts) {
// parse opts
var store = configureStore({
@@ -48,7 +45,7 @@ function startApp(metamaskState, accountManager, opts){
store.dispatch(actions.showConfTxPage())
}
- accountManager.on('update', function(metamaskState){
+ accountManager.on('update', function (metamaskState) {
store.dispatch(actions.updateMetamaskState(metamaskState))
})
@@ -59,5 +56,4 @@ function startApp(metamaskState, accountManager, opts){
store: store,
}
), opts.container)
-
}
diff --git a/ui/lib/explorer-link.js b/ui/lib/explorer-link.js
index 92b3376fa..2993d1cf1 100644
--- a/ui/lib/explorer-link.js
+++ b/ui/lib/explorer-link.js
@@ -1,4 +1,4 @@
-module.exports = function(hash, network) {
+module.exports = function (hash, network) {
const net = parseInt(network)
let prefix
switch (net) {
diff --git a/ui/lib/icon-factory.js b/ui/lib/icon-factory.js
index 1b1df9490..ee784dbd8 100644
--- a/ui/lib/icon-factory.js
+++ b/ui/lib/icon-factory.js
@@ -1,18 +1,18 @@
var iconFactory
-module.exports = function(jazzicon) {
+module.exports = function (jazzicon) {
if (!iconFactory) {
iconFactory = new IconFactory(jazzicon)
}
return iconFactory
}
-function IconFactory(jazzicon) {
+function IconFactory (jazzicon) {
this.jazzicon = jazzicon
this.cache = {}
}
-IconFactory.prototype.iconForAddress = function(address, diameter) {
+IconFactory.prototype.iconForAddress = function (address, diameter) {
if (this.isCached(address, diameter)) {
return this.cache[address][diameter]
}
@@ -22,30 +22,29 @@ IconFactory.prototype.iconForAddress = function(address, diameter) {
return dataUri
}
-IconFactory.prototype.generateNewUri = function(address, diameter) {
+IconFactory.prototype.generateNewUri = function (address, diameter) {
var numericRepresentation = jsNumberForAddress(address)
var identicon = this.jazzicon(diameter, numericRepresentation)
var identiconSrc = identicon.innerHTML
- var dataUri = 'data:image/svg+xml;charset=utf-8,'+encodeURIComponent(identiconSrc)
+ var dataUri = 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(identiconSrc)
return dataUri
}
-IconFactory.prototype.cacheIcon = function(address, diameter, icon) {
+IconFactory.prototype.cacheIcon = function (address, diameter, icon) {
if (!(address in this.cache)) {
var sizeCache = {}
sizeCache[diameter] = icon
return this.cache[address] = sizeCache
-
} else {
return this.cache[address][diameter] = icon
}
}
-IconFactory.prototype.isCached = function(address, diameter) {
+IconFactory.prototype.isCached = function (address, diameter) {
return address in this.cache && diameter in this.cache[address]
}
-function jsNumberForAddress(address) {
+function jsNumberForAddress (address) {
var addr = address.slice(2, 10)
var seed = parseInt(addr, 16)
return seed
diff --git a/ui/lib/tx-helper.js b/ui/lib/tx-helper.js
index 49845b01a..8f15cd3cc 100644
--- a/ui/lib/tx-helper.js
+++ b/ui/lib/tx-helper.js
@@ -1,6 +1,6 @@
const valuesFor = require('../app/util').valuesFor
-module.exports = function(unconfTxs, unconfMsgs) {
+module.exports = function (unconfTxs, unconfMsgs) {
var txValues = valuesFor(unconfTxs)
var msgValues = valuesFor(unconfMsgs)
var allValues = txValues.concat(msgValues)