Linting to the max.

feature/default_network_editable
Kevin Serrano 8 years ago
parent c664b8f11e
commit 23263bec7d
No known key found for this signature in database
GPG Key ID: 7CC862A58D2889B4
  1. 6
      app/scripts/contentscript.js
  2. 3
      app/scripts/keyrings/hd.js
  3. 1
      app/scripts/keyrings/simple.js
  4. 1
      app/scripts/lib/auto-reload.js
  5. 1
      app/scripts/lib/config-manager.js
  6. 4
      app/scripts/lib/notifications.js
  7. 21
      app/scripts/metamask-controller.js
  8. 2
      ui/app/app.js
  9. 2
      ui/app/components/coinbase-form.js
  10. 2
      ui/app/components/copyButton.js
  11. 6
      ui/app/components/drop-menu-item.js
  12. 2
      ui/app/components/network.js
  13. 12
      ui/app/components/pending-tx.js
  14. 2
      ui/app/components/shapeshift-form.js
  15. 1
      ui/app/components/shift-list-item.js
  16. 2
      ui/app/components/tooltip.js
  17. 1
      ui/app/reducers/app.js
  18. 3
      ui/lib/contract-namer.js

@ -6,7 +6,7 @@ const extension = require('./lib/extension')
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const inpageText = fs.readFileSync(path.join(__dirname + '/inpage.js')).toString() const inpageText = fs.readFileSync(path.join(__dirname, 'inpage.js')).toString()
// Eventually this streaming injection could be replaced with: // Eventually this streaming injection could be replaced with:
// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Language_Bindings/Components.utils.exportFunction // https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Language_Bindings/Components.utils.exportFunction
@ -22,7 +22,6 @@ if (shouldInjectWeb3()) {
function setupInjection () { function setupInjection () {
try { try {
// inject in-page script // inject in-page script
var scriptTag = document.createElement('script') var scriptTag = document.createElement('script')
scriptTag.src = extension.extension.getURL('scripts/inpage.js') scriptTag.src = extension.extension.getURL('scripts/inpage.js')
@ -31,14 +30,12 @@ function setupInjection(){
var container = document.head || document.documentElement var container = document.head || document.documentElement
// append as first child // append as first child
container.insertBefore(scriptTag, container.children[0]) container.insertBefore(scriptTag, container.children[0])
} catch (e) { } catch (e) {
console.error('Metamask injection failed.', e) console.error('Metamask injection failed.', e)
} }
} }
function setupStreams () { function setupStreams () {
// setup communication to page and plugin // setup communication to page and plugin
var pageStream = new LocalMessageDuplexStream({ var pageStream = new LocalMessageDuplexStream({
name: 'contentscript', name: 'contentscript',
@ -65,7 +62,6 @@ function setupStreams(){
mx.ignoreStream('provider') mx.ignoreStream('provider')
mx.ignoreStream('publicConfig') mx.ignoreStream('publicConfig')
mx.ignoreStream('reload') mx.ignoreStream('reload')
} }
function shouldInjectWeb3 () { function shouldInjectWeb3 () {

@ -97,9 +97,6 @@ module.exports = class HdKeyring extends EventEmitter {
return ((address === account) || (normalize(address) === account)) return ((address === account) || (normalize(address) === account))
}) })
} }
} }
function normalize (address) { function normalize (address) {

@ -65,4 +65,3 @@ module.exports = class SimpleKeyring extends EventEmitter {
} }
} }

@ -25,7 +25,6 @@ function setupDappAutoReload (web3) {
// reload after short timeout // reload after short timeout
setTimeout(triggerReset, 500) setTimeout(triggerReset, 500)
} }
} }
// reload the page // reload the page

@ -358,7 +358,6 @@ ConfigManager.prototype.updateConversionRate = function () {
this.setConversionPrice(0) this.setConversionPrice(0)
this.setConversionDate('N/A') this.setConversionDate('N/A')
}) })
} }
ConfigManager.prototype.setConversionPrice = function (price) { ConfigManager.prototype.setConversionPrice = function (price) {

@ -15,12 +15,9 @@ function show () {
if (err) throw err if (err) throw err
if (popup) { if (popup) {
// bring focus to existing popup // bring focus to existing popup
extension.windows.update(popup.id, { focused: true }) extension.windows.update(popup.id, { focused: true })
} else { } else {
// create new popup // create new popup
extension.windows.create({ extension.windows.create({
url: 'notification.html', url: 'notification.html',
@ -29,7 +26,6 @@ function show () {
width, width,
height, height,
}) })
} }
}) })
} }

@ -87,23 +87,6 @@ module.exports = class MetamaskController {
} }
onRpcRequest (stream, originDomain, request) { onRpcRequest (stream, originDomain, request) {
/* Commented out for Parity compliance
* Parity does not permit additional keys, like `origin`,
* and Infura is not currently filtering this key out.
var payloads = Array.isArray(request) ? request : [request]
payloads.forEach(function (payload) {
// Append origin to rpc payload
payload.origin = originDomain
// Append origin to signature request
if (payload.method === 'eth_sendTransaction') {
payload.params[0].origin = originDomain
} else if (payload.method === 'eth_sign') {
payload.params.push({ origin: originDomain })
}
})
*/
// handle rpc request // handle rpc request
this.provider.sendAsync(request, function onPayloadHandled (err, response) { this.provider.sendAsync(request, function onPayloadHandled (err, response) {
logger(err, request, response) logger(err, request, response)
@ -217,7 +200,7 @@ module.exports = class MetamaskController {
newUnsignedTransaction (txParams, onTxDoneCb) { newUnsignedTransaction (txParams, onTxDoneCb) {
const keyringController = this.keyringController const keyringController = this.keyringController
let err = this.enforceTxValidations(txParams) const err = this.enforceTxValidations(txParams)
if (err) return onTxDoneCb(err) if (err) return onTxDoneCb(err)
keyringController.addUnconfirmedTransaction(txParams, onTxDoneCb, (err, txData) => { keyringController.addUnconfirmedTransaction(txParams, onTxDoneCb, (err, txData) => {
if (err) return onTxDoneCb(err) if (err) return onTxDoneCb(err)
@ -291,7 +274,6 @@ module.exports = class MetamaskController {
} catch (e) { } catch (e) {
console.error('Error in checking TOS change.') console.error('Error in checking TOS change.')
} }
} }
agreeToDisclaimer (cb) { agreeToDisclaimer (cb) {
@ -405,4 +387,3 @@ module.exports = class MetamaskController {
return this.state.network return this.state.network
} }
} }

@ -98,7 +98,6 @@ App.prototype.render = function () {
} }
App.prototype.renderAppBar = function () { App.prototype.renderAppBar = function () {
if (window.METAMASK_UI_TYPE === 'notification') { if (window.METAMASK_UI_TYPE === 'notification') {
return null return null
} }
@ -367,7 +366,6 @@ App.prototype.renderPrimary = function () {
// show initialize screen // show initialize screen
if (!props.isInitialized || props.forgottenPassword) { if (!props.isInitialized || props.forgottenPassword) {
// show current view // show current view
switch (props.currentView.name) { switch (props.currentView.name) {

@ -124,7 +124,6 @@ CoinbaseForm.prototype.toCoinbase = function () {
} }
CoinbaseForm.prototype.renderLoading = function () { CoinbaseForm.prototype.renderLoading = function () {
return h('img', { return h('img', {
style: { style: {
width: '27px', width: '27px',
@ -136,7 +135,6 @@ CoinbaseForm.prototype.renderLoading = function () {
function isValidAmountforCoinBase (amount) { function isValidAmountforCoinBase (amount) {
amount = parseFloat(amount) amount = parseFloat(amount)
if (amount) { if (amount) {
if (amount <= 5 && amount > 0) { if (amount <= 5 && amount > 0) {
return { return {

@ -51,11 +51,9 @@ CopyButton.prototype.render = function () {
} }
CopyButton.prototype.debounceRestore = function () { CopyButton.prototype.debounceRestore = function () {
this.setState({ copied: true }) this.setState({ copied: true })
clearTimeout(this.timeout) clearTimeout(this.timeout)
this.timeout = setTimeout(() => { this.timeout = setTimeout(() => {
this.setState({ copied: false }) this.setState({ copied: false })
}, 850) }, 850)
} }

@ -32,9 +32,9 @@ DropMenuItem.prototype.render = function () {
} }
DropMenuItem.prototype.activeNetworkRender = function () { DropMenuItem.prototype.activeNetworkRender = function () {
let activeNetwork = this.props.activeNetworkRender const activeNetwork = this.props.activeNetworkRender
let { provider } = this.props const { provider } = this.props
let providerType = provider ? provider.type : null const providerType = provider ? provider.type : null
if (activeNetwork === undefined) return if (activeNetwork === undefined) return
switch (this.props.label) { switch (this.props.label) {

@ -22,7 +22,6 @@ Network.prototype.render = function () {
let iconName, hoverText let iconName, hoverText
if (networkNumber === 'loading') { if (networkNumber === 'loading') {
return h('img.network-indicator', { return h('img.network-indicator', {
title: 'Attempting to connect to blockchain.', title: 'Attempting to connect to blockchain.',
onClick: (event) => this.props.onClick(event), onClick: (event) => this.props.onClick(event),
@ -32,7 +31,6 @@ Network.prototype.render = function () {
}, },
src: 'images/loading.svg', src: 'images/loading.svg',
}) })
} else if (providerName === 'mainnet') { } else if (providerName === 'mainnet') {
hoverText = 'Main Ethereum Network' hoverText = 'Main Ethereum Network'
iconName = 'ethereum-network' iconName = 'ethereum-network'

@ -30,8 +30,8 @@ PendingTx.prototype.render = function () {
} }
`), `),
txData.simulationFails ? txData.simulationFails
h('.error', { ? h('.error', {
style: { style: {
marginLeft: 50, marginLeft: 50,
fontSize: '0.9em', fontSize: '0.9em',
@ -39,8 +39,8 @@ PendingTx.prototype.render = function () {
}, 'Transaction Error. Exception thrown in contract code.') }, 'Transaction Error. Exception thrown in contract code.')
: null, : null,
state.insufficientBalance ? state.insufficientBalance
h('span.error', { ? h('span.error', {
style: { style: {
marginLeft: 50, marginLeft: 50,
fontSize: '0.9em', fontSize: '0.9em',
@ -57,8 +57,8 @@ PendingTx.prototype.render = function () {
}, },
}, [ }, [
state.insufficientBalance ? state.insufficientBalance
h('button.btn-green', { ? h('button.btn-green', {
onClick: state.buyEth, onClick: state.buyEth,
}, 'Buy Ether') }, 'Buy Ether')
: null, : null,

@ -25,7 +25,6 @@ function ShapeshiftForm () {
} }
ShapeshiftForm.prototype.render = function () { ShapeshiftForm.prototype.render = function () {
return h(ReactCSSTransitionGroup, { return h(ReactCSSTransitionGroup, {
className: 'css-transition-group', className: 'css-transition-group',
transitionName: 'main', transitionName: 'main',
@ -34,7 +33,6 @@ ShapeshiftForm.prototype.render = function () {
}, [ }, [
this.props.qrRequested ? h(Qr, {key: 'qr'}) : this.renderMain(), this.props.qrRequested ? h(Qr, {key: 'qr'}) : this.renderMain(),
]) ])
} }
ShapeshiftForm.prototype.renderMain = function () { ShapeshiftForm.prototype.renderMain = function () {

@ -26,7 +26,6 @@ function ShiftListItem () {
} }
ShiftListItem.prototype.render = function () { ShiftListItem.prototype.render = function () {
return ( return (
h('.transaction-list-item.flex-row', { h('.transaction-list-item.flex-row', {
style: { style: {

@ -11,7 +11,6 @@ function Tooltip () {
} }
Tooltip.prototype.render = function () { Tooltip.prototype.render = function () {
const props = this.props const props = this.props
const { position, title, children } = props const { position, title, children } = props
@ -20,5 +19,4 @@ Tooltip.prototype.render = function () {
title, title,
fixed: false, fixed: false,
}, children) }, children)
} }

@ -278,7 +278,6 @@ function reduceApp (state, action) {
warning: null, warning: null,
}) })
} else { } else {
notification.closePopup() notification.closePopup()
return extend(appState, { return extend(appState, {

@ -9,7 +9,6 @@
const nicknames = {} const nicknames = {}
module.exports = function (addr, identities = {}) { module.exports = function (addr, identities = {}) {
const address = addr.toLowerCase() const address = addr.toLowerCase()
const ids = hashFromIdentities(identities) const ids = hashFromIdentities(identities)
@ -18,7 +17,7 @@ module.exports = function(addr, identities = {}) {
function hashFromIdentities (identities) { function hashFromIdentities (identities) {
const result = {} const result = {}
for (let key in identities) { for (const key in identities) {
result[key] = identities[key].name result[key] = identities[key].name
} }
return result return result

Loading…
Cancel
Save