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

Auto linted

This commit is contained in:
Dan Finlay 2016-06-21 13:18:32 -07:00
parent f7f8f8b1c5
commit a08c3bc01b
70 changed files with 2282 additions and 2393 deletions

View File

@ -1,5 +1,4 @@
{
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {

View File

@ -138,7 +138,6 @@ function storeSetFromObj(store, obj){
})
}
//
// remote features
//
@ -149,7 +148,6 @@ function setupPublicConfig(stream){
}
function setupProviderConnection (stream, originDomain) {
stream.on('data', function onRpcRequest (payload) {
// Append origin to rpc payload
payload.origin = originDomain
@ -161,6 +159,9 @@ function setupProviderConnection(stream, originDomain){
}
// handle rpc request
provider.sendAsync(payload, function onPayloadHandled (err, response) {
if (err) {
return logger(err)
}
logger(null, payload, response)
try {
stream.write(response)
@ -205,7 +206,6 @@ function setupControllerConnection(stream){
})
stream.pipe(dnode).pipe(stream)
dnode.on('remote', function (remote) {
// push updates to popup
ethStore.on('update', sendUpdate)
idStore.on('update', sendUpdate)
@ -217,7 +217,6 @@ function setupControllerConnection(stream){
var state = getState()
remote.sendUpdate(state)
}
})
}
@ -263,7 +262,6 @@ function newUnsignedMessage(msgParams, cb){
createUnlockRequestNotification({
title: 'Account Unlock Request',
})
var msgId = idStore.addUnconfirmedMessage(msgParams, cb)
} else {
addUnconfirmedMsg(msgParams, cb)
}

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,12 +41,12 @@ function IdManagement(opts) {
this.signMsg = function (address, message) {
// sign message
var privKeyHex = this.exportPrivateKey(address);
var privKey = ethUtil.toBuffer(privKeyHex);
var msgSig = ethUtil.ecsign(new Buffer(message.replace('0x',''), 'hex'), privKey);
var rawMsgSig = ethUtil.bufferToHex(concatSig(msgSig.v, msgSig.r, msgSig.s));
return rawMsgSig;
};
var privKeyHex = this.exportPrivateKey(address)
var privKey = ethUtil.toBuffer(privKeyHex)
var msgSig = ethUtil.ecsign(new Buffer(message.replace('0x', ''), 'hex'), privKey)
var rawMsgSig = ethUtil.bufferToHex(concatSig(msgSig.v, msgSig.r, msgSig.s))
return rawMsgSig
}
this.getSeed = function () {
return this.keyStore.getSeed(this.derivedKey)
@ -59,11 +59,11 @@ function IdManagement(opts) {
}
function pad_with_zeroes (number, length) {
var my_string = '' + number;
var my_string = '' + number
while (my_string.length < length) {
my_string = '0' + my_string;
my_string = '0' + my_string
}
return my_string;
return my_string
}
function concatSig (v, r, s) {

View File

@ -15,10 +15,8 @@ const messageManager = require('./message-manager')
const DEFAULT_RPC = 'https://testrpc.metamask.io/'
const IdManagement = require('./id-management')
module.exports = IdentityStore
inherits(IdentityStore, EventEmitter)
function IdentityStore (opts = {}) {
EventEmitter.call(this)
@ -142,7 +140,6 @@ IdentityStore.prototype.revealAccount = function(cb) {
}
IdentityStore.prototype.getNetwork = function (err) {
if (err) {
this._currentState.network = 'loading'
this._didUpdate()
@ -232,7 +229,6 @@ IdentityStore.prototype.addUnconfirmedTransaction = function(txParams, onTxDoneC
// signal completion of add tx
cb(null, txData)
}
}
// comes from metamask ui
@ -279,7 +275,6 @@ IdentityStore.prototype.signTransaction = function(txParams, cb){
// comes from dapp via zero-client hooked-wallet provider
IdentityStore.prototype.addUnconfirmedMessage = function (msgParams, cb) {
// create txData obj with parameters and meta data
var time = (new Date()).getTime()
var msgId = createId()
@ -448,7 +443,7 @@ IdentityStore.prototype._createIdmgmt = function(password, seed, entropy, cb){
IdentityStore.prototype._restoreFromSeed = function (password, seed, derivedKey) {
var keyStore = new LightwalletKeyStore(seed, derivedKey, this.hdPathString)
keyStore.addHdDerivationPath(this.hdPathString, derivedKey, {curve: 'secp256k1', purpose: 'sign'});
keyStore.addHdDerivationPath(this.hdPathString, derivedKey, {curve: 'secp256k1', purpose: 'sign'})
keyStore.setDefaultHdDerivationPath(this.hdPathString)
keyStore.generateNewAddress(derivedKey, 3)
@ -460,7 +455,7 @@ IdentityStore.prototype._restoreFromSeed = function(password, seed, derivedKey)
IdentityStore.prototype._createFirstWallet = function (entropy, derivedKey) {
var secretSeed = LightwalletKeyStore.generateRandomSeed(entropy)
var keyStore = new LightwalletKeyStore(secretSeed, derivedKey, this.hdPathString)
keyStore.addHdDerivationPath(this.hdPathString, derivedKey, {curve: 'secp256k1', purpose: 'sign'});
keyStore.addHdDerivationPath(this.hdPathString, derivedKey, {curve: 'secp256k1', purpose: 'sign'})
keyStore.setDefaultHdDerivationPath(this.hdPathString)
keyStore.generateNewAddress(derivedKey, 3)

View File

@ -7,7 +7,6 @@ const MetamaskConfig = require('../config.js')
module.exports = MetamaskInpageProvider
function MetamaskInpageProvider (connectionStream) {
const self = this

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -88,7 +88,7 @@ AccountDetailScreen.prototype.render = function() {
style: {
height: '62px',
paddingTop: '8px',
}
},
}, [
h(EditableLabel, {
textValue: identity ? identity.name : '',
@ -211,7 +211,7 @@ AccountDetailScreen.prototype.transactionList = function() {
unconfMsgs,
viewPendingTx: (txId) => {
this.props.dispatch(actions.viewPendingTx(txId))
}
},
})
}

View File

@ -9,7 +9,6 @@ const Identicon = require('../components/identicon')
module.exports = NewComponent
inherits(NewComponent, Component)
function NewComponent () {
Component.call(this)
@ -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,7 +67,7 @@ NewComponent.prototype.render = function() {
event.stopPropagation()
event.preventDefault()
copyToClipboard(ethUtil.toChecksumAddress(identity.address))
}
},
}),
]),
])

View File

@ -10,7 +10,6 @@ const AccountPanel = require('./account-panel')
module.exports = connect(mapStateToProps)(AccountsScreen)
function mapStateToProps (state) {
const pendingTxs = valuesFor(state.metamask.unconfTxs)
const pendingMsgs = valuesFor(state.metamask.unconfMsgs)
@ -32,7 +31,6 @@ function AccountsScreen() {
Component.call(this)
}
AccountsScreen.prototype.render = function () {
var state = this.props
var identityList = valuesFor(state.identities)
@ -63,7 +61,7 @@ AccountsScreen.prototype.render = function() {
height: '418px',
overflowY: 'auto',
overflowX: 'hidden',
}
},
},
[
identityList.map((identity) => {
@ -100,7 +98,7 @@ AccountsScreen.prototype.render = function() {
paddint: '10px',
justifyContent: 'center',
alignItems: 'center',
}
},
}, [
h('i.fa.fa-plus.fa-lg', {key: ''}),
]),

View File

@ -296,7 +296,6 @@ function cancelTx(txData){
// initialize screen
//
function showCreateVault () {
return {
type: actions.SHOW_CREATE_VAULT,

View File

@ -33,7 +33,6 @@ const NetworkIndicator = require('./components/network')
module.exports = connect(mapStateToProps)(App)
inherits(App, Component)
function App () { Component.call(this) }
@ -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',
@ -121,7 +120,7 @@ App.prototype.renderAppBar = function(){
event.preventDefault()
event.stopPropagation()
this.setState({ isNetworkMenuOpen: !isNetworkMenuOpen })
}
},
}),
// metamask name
@ -252,7 +251,6 @@ App.prototype.renderPrimary = function(){
// show initialize screen
if (!props.isInitialized) {
// show current view
switch (props.currentView.name) {

View File

@ -6,14 +6,13 @@ const actions = require('../actions')
module.exports = ExportAccountView
inherits(ExportAccountView, Component)
function ExportAccountView () {
Component.call(this)
}
ExportAccountView.prototype.render = function () {
console.log("EXPORT VIEW")
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'),
])
@ -74,10 +73,10 @@ ExportAccountView.prototype.render = function() {
},
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'),
])
}

View File

@ -10,7 +10,6 @@ const Panel = require('./panel')
module.exports = AccountPanel
inherits(AccountPanel, Component)
function AccountPanel () {
Component.call(this)
@ -40,18 +39,16 @@ 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) {
// Temporarily deactivating isFauceting indication
// because it shows fauceting for empty restored accounts.
if (/* isFauceting*/ false) {
@ -62,7 +59,7 @@ function balanceOrFaucetingIndication(account, isFauceting) {
} else {
return {
key: 'BALANCE',
value: formatBalance(account.balance)
value: formatBalance(account.balance),
}
}
}

View File

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

View File

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

View File

@ -7,7 +7,6 @@ const debounce = require('debounce')
module.exports = Mascot
inherits(Mascot, Component)
function Mascot () {
Component.call(this)
@ -22,7 +21,6 @@ function Mascot() {
this.unfollowMouse = this.logo.setFollowMouse.bind(this.logo, false)
}
Mascot.prototype.render = function () {
// this is a bit hacky
// the event emitter is on `this.props`

View File

@ -14,7 +14,7 @@ Network.prototype.render = function() {
const state = this.props
const networkNumber = state.network
let iconName, hoverText
const imagePath = "/images/"
const imagePath = '/images/'
if (networkNumber == 'loading') {
return h('img', {
@ -22,7 +22,7 @@ Network.prototype.render = function() {
onClick: (event) => this.props.onClick(event),
style: {
width: '27px',
marginRight: '-27px'
marginRight: '-27px',
},
src: 'images/loading.svg',
})
@ -30,10 +30,10 @@ Network.prototype.render = function() {
hoverText = 'Main Ethereum Network'
iconName = 'ethereum-network'
} else if (parseInt(networkNumber) == 2) {
hoverText = "Morden Test Network"
hoverText = 'Morden Test Network'
iconName = 'morden-test-network'
} else {
hoverText = "Unknown Private Network"
hoverText = 'Unknown Private Network'
iconName = 'unknown-private-network'
}
return (
@ -60,7 +60,7 @@ Network.prototype.render = function() {
},
})
}
}()
}(),
])
)
}

View File

@ -6,7 +6,6 @@ const Identicon = require('./identicon')
module.exports = Panel
inherits(Panel, Component)
function Panel () {
Component.call(this)

View File

@ -10,7 +10,6 @@ const dataSize = require('../util').dataSize
module.exports = PendingMsg
inherits(PendingMsg, Component)
function PendingMsg () {
Component.call(this)
@ -34,7 +33,7 @@ PendingMsg.prototype.render = function() {
style: {
fontWeight: 'bold',
textAlign: 'center',
}
},
}, 'Sign Message'),
// account that will sign

View File

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

View File

@ -4,7 +4,6 @@ const inherits = require('util').inherits
module.exports = NewComponent
inherits(NewComponent, Component)
function NewComponent () {
Component.call(this)

View File

@ -6,7 +6,6 @@ const Identicon = require('./identicon')
module.exports = TransactionIcon
inherits(TransactionIcon, Component)
function TransactionIcon () {
Component.call(this)
@ -19,7 +18,7 @@ TransactionIcon.prototype.render = function() {
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',
}
},
})
}
}

View File

@ -12,7 +12,6 @@ const TransactionIcon = require('./transaction-list-item-icon')
module.exports = TransactionListItem
inherits(TransactionListItem, Component)
function TransactionListItem () {
Component.call(this)
@ -107,7 +106,6 @@ function recipientField(txParams, transaction, isTx, isMsg) {
message,
failIfFailed(transaction),
])
}
TransactionListItem.prototype.renderMessage = function () {

View File

@ -64,7 +64,7 @@ TransactionList.prototype.render = function() {
height: '100%',
},
}, 'No transaction history...')]
))
)),
])
)
}

View File

@ -31,7 +31,6 @@ function ConfirmTxScreen() {
Component.call(this)
}
ConfirmTxScreen.prototype.render = function () {
var state = this.props
@ -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)

View File

@ -18,7 +18,6 @@ function ConfigScreen() {
Component.call(this)
}
ConfigScreen.prototype.render = function () {
var state = this.props
var rpc = state.rpc
@ -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),
@ -62,7 +61,7 @@ ConfigScreen.prototype.render = function() {
var newRpc = element.value
state.dispatch(actions.setRpcTarget(newRpc))
}
}
},
}),
h('button', {
style: {
@ -73,8 +72,8 @@ ConfigScreen.prototype.render = function() {
var element = document.querySelector('input#new_rpc')
var newRpc = element.value
state.dispatch(actions.setRpcTarget(newRpc))
}
}, 'Save')
},
}, 'Save'),
]),
h('div', [
@ -85,7 +84,7 @@ ConfigScreen.prototype.render = function() {
onClick (event) {
event.preventDefault()
state.dispatch(actions.setProviderType('mainnet'))
}
},
}, 'Use Main Network'),
]),
@ -97,7 +96,7 @@ ConfigScreen.prototype.render = function() {
onClick (event) {
event.preventDefault()
state.dispatch(actions.setProviderType('testnet'))
}
},
}, 'Use Morden Test Network'),
]),
@ -109,7 +108,7 @@ ConfigScreen.prototype.render = function() {
onClick (event) {
event.preventDefault()
state.dispatch(actions.setRpcTarget('http://localhost:8545/'))
}
},
}, 'Use http://localhost:8545'),
]),
@ -118,7 +117,7 @@ ConfigScreen.prototype.render = function() {
h('div', {
style: {
marginTop: '20px',
}
},
}, [
h('button', {
style: {
@ -127,8 +126,8 @@ ConfigScreen.prototype.render = function() {
onClick (event) {
event.preventDefault()
state.dispatch(actions.revealSeedConfirmation())
}
}, 'Reveal Seed Words')
},
}, 'Reveal Seed Words'),
]),
]),
@ -160,6 +159,6 @@ function currentProviderDisplay(metamaskState) {
return h('div', [
h('span', {style: { fontWeight: 'bold', paddingRight: '10px'}}, title),
h('span', value)
h('span', value),
])
}

View File

@ -6,7 +6,6 @@ const actions = require('../actions')
module.exports = connect(mapStateToProps)(CreateVaultCompleteScreen)
inherits(CreateVaultCompleteScreen, Component)
function CreateVaultCompleteScreen () {
Component.call(this)
@ -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', {

View File

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

View File

@ -18,7 +18,6 @@ function DisclaimerScreen() {
}
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'),
])
)
}

View File

@ -33,7 +33,6 @@ InitializeMenuScreen.prototype.render = function() {
return this.renderMenu()
}
}
// InitializeMenuScreen.prototype.componentDidMount = function(){

View File

@ -6,7 +6,6 @@ const actions = require('../actions')
module.exports = connect(mapStateToProps)(RestoreVaultScreen)
inherits(RestoreVaultScreen, Component)
function RestoreVaultScreen () {
Component.call(this)
@ -18,7 +17,6 @@ function mapStateToProps(state) {
}
}
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

View File

@ -18,7 +18,7 @@ function InfoScreen() {
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,7 +37,7 @@ InfoScreen.prototype.render = function() {
h('.flex-space-around', {
style: {
padding: '20px',
}
},
}, [
// current version number
@ -46,7 +46,7 @@ InfoScreen.prototype.render = function() {
h('div', {
style: {
marginBottom: '10px',
}
},
}, `Version: ${manifest.version}`),
]),
@ -54,10 +54,9 @@ InfoScreen.prototype.render = function() {
style: {
margin: '20px 0 ',
width: '7em',
}
},
}),
h('.info', {
style: {
marginBottom: '20px',
@ -79,14 +78,14 @@ InfoScreen.prototype.render = function() {
onClick (event) { this.navigateTo(event.target.href) },
}, [
h('img.icon-size', {
src: manifest.icons[128]
src: manifest.icons[128],
}),
h('div.info', {
style: {
fontWeight: 800,
}
},'Visit our web site')
])
},
}, 'Visit our web site'),
]),
]),
h('div.fa.fa-slack', [
h('a.info', {
@ -96,7 +95,6 @@ InfoScreen.prototype.render = function() {
}, 'Join the conversation on Slack'),
]),
h('div.fa.fa-twitter', [
h('a.info', {
href: 'https://twitter.com/metamask_io',
@ -124,9 +122,8 @@ InfoScreen.prototype.render = function() {
]),
])
)
}
InfoScreen.prototype.navigateTo = function (url) {
chrome.tabs.create({ url });
chrome.tabs.create({ url })
}

View File

@ -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',

View File

@ -7,7 +7,6 @@ const actions = require('../actions')
module.exports = connect(mapStateToProps)(RevealSeedConfirmatoin)
inherits(RevealSeedConfirmatoin, Component)
function RevealSeedConfirmatoin () {
Component.call(this)
@ -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('-'))
),

View File

@ -12,7 +12,6 @@ const reduceApp = require('./reducers/app')
module.exports = rootReducer
function rootReducer (state, action) {
// clone
state = extend(state)
@ -34,8 +33,6 @@ function rootReducer(state, action) {
state.appState = reduceApp(state, action)
return state
}

View File

@ -6,7 +6,6 @@ const txHelper = require('../../lib/tx-helper')
module.exports = reduceApp
function reduceApp (state, action) {
// clone and defaults
const selectedAccount = state.metamask.selectedAccount
const pendingTxs = hasPendingTxs(state)
@ -156,7 +155,6 @@ function reduceApp(state, action) {
warning: null,
})
// accounts
case actions.SET_SELECTED_ACCOUNT:
@ -281,7 +279,7 @@ function reduceApp(state, action) {
name: 'confTx',
context: ++appState.currentView.context,
warning: null,
}
},
})
case actions.VIEW_PENDING_TX:
@ -292,7 +290,7 @@ function reduceApp(state, action) {
name: 'confTx',
context,
warning: null,
}
},
})
case actions.PREVIOUS_TX:
@ -302,7 +300,7 @@ function reduceApp(state, action) {
name: 'confTx',
context: --appState.currentView.context,
warning: null,
}
},
})
case actions.TRANSACTION_ERROR:
@ -315,7 +313,7 @@ function reduceApp(state, action) {
case actions.UNLOCK_FAILED:
return extend(appState, {
warning: 'Incorrect password. Try again.'
warning: 'Incorrect password. Try again.',
})
case actions.SHOW_LOADING:

View File

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

View File

@ -4,7 +4,6 @@ const actions = require('../actions')
module.exports = reduceMetamask
function reduceMetamask (state, action) {
// clone + defaults
var metamaskState = extend({
isInitialized: false,

View File

@ -7,7 +7,6 @@ const App = require('./app')
module.exports = Root
inherits(Root, Component)
function Root () { Component.call(this) }
@ -17,7 +16,7 @@ Root.prototype.render = function() {
h(Provider, {
store: this.props.store,
}, [
h(App)
h(App),
])
)

View File

@ -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',
}
},
}),
]),
@ -207,7 +207,6 @@ SendTransactionScreen.prototype.back = 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)

View File

@ -20,7 +20,6 @@ function AppSettingsPage() {
Component.call(this)
}
AppSettingsPage.prototype.render = function () {
var state = this.props
var identity = state.identities[state.address]
@ -62,7 +61,6 @@ AppSettingsPage.prototype.onKeyPress = function(event) {
}
}
AppSettingsPage.prototype.navigateToAccounts = function (event) {
event.stopPropagation()
this.props.dispatch(actions.showAccountsPage())

View File

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

View File

@ -22,9 +22,9 @@ COMPONENTNAME.prototype.render = function() {
h('div', {
style: {
background: 'blue',
}
},
}, [
'Hello, world!'
'Hello, world!',
])
)
}

View File

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

View File

@ -37,7 +37,6 @@ module.exports = {
bnTable: bnTable,
}
function valuesFor (obj) {
if (!obj) return []
return Object.keys(obj)
@ -103,7 +102,7 @@ function formatBalance(balance, decimalsToKeep) {
var parsed = parseBalance(balance)
var beforeDecimal = parsed[0]
var afterDecimal = parsed[1]
var formatted = "None"
var formatted = 'None'
if (decimalsToKeep === undefined) {
if (beforeDecimal === '0') {
if (afterDecimal !== '0') {
@ -112,11 +111,11 @@ function formatBalance(balance, decimalsToKeep) {
formatted = '0.' + afterDecimal + ' ETH'
}
} else {
formatted = beforeDecimal + "." + afterDecimal.slice(0,3) + ' ETH'
formatted = beforeDecimal + '.' + afterDecimal.slice(0, 3) + ' ETH'
}
} else {
afterDecimal += Array(decimalsToKeep).join("0")
formatted = beforeDecimal + "." + afterDecimal.slice(0,decimalsToKeep) + ' ETH'
afterDecimal += Array(decimalsToKeep).join('0')
formatted = beforeDecimal + '.' + afterDecimal.slice(0, decimalsToKeep) + ' ETH'
}
return formatted
}
@ -162,8 +161,8 @@ function readableDate(ms) {
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)}`

View File

@ -26,7 +26,7 @@ var identities = {
address: '0x333462427bcc9133bb46e88bcbe39cd7ef0e7333',
balance: 0.000001,
txCount: 1,
}
},
}
var unconfTxs = {}
@ -108,7 +108,7 @@ injectCss(css)
var app = MetaMaskUi({
container: container,
accountManager: accountManager
accountManager: accountManager,
})
// util

View File

@ -9,7 +9,6 @@ const configureStore = require('./app/store')
module.exports = launchApp
function launchApp (opts) {
var accountManager = opts.accountManager
actions._setAccountManager(accountManager)
@ -18,11 +17,9 @@ function launchApp(opts) {
if (err) throw err
startApp(metamaskState, accountManager, opts)
})
}
function startApp (metamaskState, accountManager, opts) {
// parse opts
var store = configureStore({
@ -59,5 +56,4 @@ function startApp(metamaskState, accountManager, opts){
store: store,
}
), opts.container)
}

View File

@ -35,7 +35,6 @@ IconFactory.prototype.cacheIcon = function(address, diameter, icon) {
var sizeCache = {}
sizeCache[diameter] = icon
return this.cache[address] = sizeCache
} else {
return this.cache[address][diameter] = icon
}