Browse Source

fix(lint): fix linting errors

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
2bb28e0bbd
  1. 6
      app/components/Onboarding/InitWallet.js
  2. 8
      app/components/Onboarding/Login.js
  3. 2
      app/components/Onboarding/NewAezeedPassword.js
  4. 50
      app/components/Onboarding/NewWalletPassword.js
  5. 28
      app/components/Onboarding/NewWalletSeed.js
  6. 15
      app/components/Onboarding/Onboarding.js
  7. 55
      app/components/Onboarding/ReEnterSeed.js
  8. 6
      app/components/Onboarding/Signup.js
  9. 13
      app/lnd/init/index.js
  10. 18
      app/lnd/walletUnlockerMethods/index.js
  11. 7
      app/main.dev.js
  12. 16
      app/reducers/onboarding.js

6
app/components/Onboarding/InitWallet.js

@ -15,6 +15,10 @@ const InitWallet = ({ hasSeed, loginProps, signupProps }) => (
</div> </div>
) )
InitWallet.propTypes = {} InitWallet.propTypes = {
hasSeed: PropTypes.bool.isRequired,
loginProps: PropTypes.object.isRequired,
signupProps: PropTypes.object.isRequired
}
export default InitWallet export default InitWallet

8
app/components/Onboarding/Login.js

@ -38,6 +38,12 @@ const Login = ({
</div> </div>
) )
Login.propTypes = {} Login.propTypes = {
password: PropTypes.string.isRequired,
updatePassword: PropTypes.func.isRequired,
unlockingWallet: PropTypes.bool.isRequired,
unlockWallet: PropTypes.func.isRequired,
unlockWalletError: PropTypes.object.isRequired
}
export default Login export default Login

2
app/components/Onboarding/NewAezeedPassword.js

@ -1,7 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import Isvg from 'react-inlinesvg'
import eye from 'icons/eye.svg'
import styles from './NewAezeedPassword.scss' import styles from './NewAezeedPassword.scss'
class NewAezeedPassword extends React.Component { class NewAezeedPassword extends React.Component {

50
app/components/Onboarding/NewWalletPassword.js

@ -1,7 +1,5 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import Isvg from 'react-inlinesvg'
import eye from 'icons/eye.svg'
import styles from './NewWalletPassword.scss' import styles from './NewWalletPassword.scss'
const NewWalletPassword = ({ const NewWalletPassword = ({
@ -11,32 +9,30 @@ const NewWalletPassword = ({
updateCreateWalletPassword, updateCreateWalletPassword,
updateCreateWalletPasswordConfirmation updateCreateWalletPasswordConfirmation
}) => { }) => (
return ( <div className={styles.container}>
<div className={styles.container}> <section className={styles.input}>
<section className={styles.input}> <input
<input type='password'
type='password' placeholder='Password'
placeholder='Password' className={styles.password}
className={styles.password} value={createWalletPassword}
value={createWalletPassword} onChange={event => updateCreateWalletPassword(event.target.value)}
onChange={event => updateCreateWalletPassword(event.target.value)} />
/> </section>
</section>
<section className={styles.input}> <section className={styles.input}>
<input <input
type='password' type='password'
placeholder='Confirm Password' placeholder='Confirm Password'
className={`${styles.password} ${showCreateWalletPasswordConfirmationError && styles.error}`} className={`${styles.password} ${showCreateWalletPasswordConfirmationError && styles.error}`}
value={createWalletPasswordConfirmation} value={createWalletPasswordConfirmation}
onChange={event => updateCreateWalletPasswordConfirmation(event.target.value)} onChange={event => updateCreateWalletPasswordConfirmation(event.target.value)}
/> />
<p className={`${styles.errorMessage} ${showCreateWalletPasswordConfirmationError && styles.visible}`}>Passwords do not match</p> <p className={`${styles.errorMessage} ${showCreateWalletPasswordConfirmationError && styles.visible}`}>Passwords do not match</p>
</section> </section>
</div> </div>
) )
}
NewWalletPassword.propTypes = { NewWalletPassword.propTypes = {
createWalletPassword: PropTypes.string.isRequired, createWalletPassword: PropTypes.string.isRequired,

28
app/components/Onboarding/NewWalletSeed.js

@ -5,21 +5,19 @@ import styles from './NewWalletSeed.scss'
const NewWalletSeed = ({ seed }) => ( const NewWalletSeed = ({ seed }) => (
<div className={styles.container}> <div className={styles.container}>
<ul className={styles.seedContainer}> <ul className={styles.seedContainer}>
{ {
seed.map((word, index) => { seed.map((word, index) => (
return ( <li key={index}>
<li> <section>
<section> <label htmlFor={word}>{index + 1}</label>
<label htmlFor={word}>{index + 1}</label> </section>
</section> <section>
<section> <span>{word}</span>
<span>{word}</span> </section>
</section> </li>
</li> ))
) }
}) </ul>
}
</ul>
</div> </div>
) )

15
app/components/Onboarding/Onboarding.js

@ -6,7 +6,6 @@ import LoadingBolt from 'components/LoadingBolt'
import FormContainer from './FormContainer' import FormContainer from './FormContainer'
import Alias from './Alias' import Alias from './Alias'
import Autopilot from './Autopilot' import Autopilot from './Autopilot'
import InitWallet from './InitWallet'
import Login from './Login' import Login from './Login'
import Signup from './Signup' import Signup from './Signup'
import NewWalletSeed from './NewWalletSeed' import NewWalletSeed from './NewWalletSeed'
@ -94,7 +93,7 @@ const Onboarding = ({
title={'Alright, let\'s get set up'} title={'Alright, let\'s get set up'}
description='Would you like to create a new wallet or import an existing one?' // eslint-disable-line description='Would you like to create a new wallet or import an existing one?' // eslint-disable-line
back={() => changeStep(4)} back={() => changeStep(4)}
next={() => initWalletProps.signupProps.signupForm.create ? changeStep(6) : console.log('import')} next={() => (initWalletProps.signupProps.signupForm.create ? changeStep(6) : console.log('import'))}
> >
<Signup {...initWalletProps.signupProps} /> <Signup {...initWalletProps.signupProps} />
</FormContainer> </FormContainer>
@ -143,9 +142,7 @@ const Onboarding = ({
} }
if (startingLnd) { return <LoadingBolt /> } if (startingLnd) { return <LoadingBolt /> }
if (fetchingSeed) { if (fetchingSeed) { return <LoadingBolt /> }
console.log('got em!')
return <LoadingBolt /> }
return ( return (
<div className={styles.container}> <div className={styles.container}>
@ -158,8 +155,14 @@ Onboarding.propTypes = {
onboarding: PropTypes.object.isRequired, onboarding: PropTypes.object.isRequired,
aliasProps: PropTypes.object.isRequired, aliasProps: PropTypes.object.isRequired,
autopilotProps: PropTypes.object.isRequired, autopilotProps: PropTypes.object.isRequired,
initWalletProps: PropTypes.object.isRequired,
newWalletSeedProps: PropTypes.object.isRequired,
newWalletPasswordProps: PropTypes.object.isRequired,
newAezeedPasswordProps: PropTypes.object.isRequired,
reEnterSeedProps: PropTypes.object.isRequired,
changeStep: PropTypes.func.isRequired, changeStep: PropTypes.func.isRequired,
startLnd: PropTypes.func.isRequired startLnd: PropTypes.func.isRequired,
submitNewWallet: PropTypes.func.isRequired
} }
export default Onboarding export default Onboarding

55
app/components/Onboarding/ReEnterSeed.js

@ -2,35 +2,32 @@ import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import styles from './ReEnterSeed.scss' import styles from './ReEnterSeed.scss'
const ReEnterSeed = ({ seed, seedInput, updateSeedInput }) => { const ReEnterSeed = ({ seed, seedInput, updateSeedInput }) => (
return ( <div className={styles.container}>
<div className={styles.container}> <ul className={styles.seedContainer}>
<ul className={styles.seedContainer}> {
{ seed.map((word, index) => (
seed.map((word, index) => { <li key={index}>
return ( <section>
<li> <label htmlFor={word}>{index + 1}</label>
<section> </section>
<label htmlFor={word}>{index + 1}</label> <section>
</section> <input
<section> type='text'
<input id={word}
type='text' placeholder='word'
id={word} value={seedInput[index] ? seedInput[index].word : ''}
placeholder='word' onChange={event => updateSeedInput({ word: event.target.value, index })}
value={seedInput[index] ? seedInput[index].word : ''} className={`${styles.word} ${seedInput[index] && word === seedInput[index].word ? styles.valid : styles.invalid}`}
onChange={(event) => updateSeedInput({ word: event.target.value, index })} />
className={`${styles.word} ${seedInput[index] && word === seedInput[index].word ? styles.valid : styles.invalid}`} </section>
/> </li>
</section> ))
</li> }
) </ul>
}) </div>
} )
</ul>
</div>
)
}
ReEnterSeed.propTypes = { ReEnterSeed.propTypes = {
seed: PropTypes.array.isRequired, seed: PropTypes.array.isRequired,

6
app/components/Onboarding/Signup.js

@ -34,6 +34,10 @@ const Signup = ({ signupForm, setSignupCreate, setSignupImport }) => (
</div> </div>
) )
Signup.propTypes = {} Signup.propTypes = {
signupForm: PropTypes.object.isRequired,
setSignupCreate: PropTypes.func.isRequired,
setSignupImport: PropTypes.func.isRequired
}
export default Signup export default Signup

13
app/lnd/init/index.js

@ -1,13 +0,0 @@
/* eslint no-console: 0 */ // --> OFF
import * as walletController from '../methods/walletController'
export default function (walletUnlocker, meta, event, msg, data) {
console.log('msg yo wtf: ', msg)
switch (msg) {
case 'genSeed':
walletController.genSeed(walletUnlocker, meta)
.then(data => { console.log('data: ', data) })
.catch(error => { console.log('error: ', error) })
default:
}
}

18
app/lnd/walletUnlockerMethods/index.js

@ -6,24 +6,18 @@ export default function (walletUnlocker, event, msg, data) {
switch (msg) { switch (msg) {
case 'genSeed': case 'genSeed':
walletController.genSeed(walletUnlocker) walletController.genSeed(walletUnlocker)
.then(data => { .then(genSeedData => event.sender.send('receiveSeed', genSeedData))
console.log('data yo: ', data) .catch(error => event.sender.send('receiveSeedError', error))
event.sender.send('receiveSeed', data)
})
.catch(error => {
console.log('genSeed error: ', error)
event.sender.send('receiveSeedError', error)
})
break break
case 'unlockWallet': case 'unlockWallet':
walletController.unlockWallet(walletUnlocker, data) walletController.unlockWallet(walletUnlocker, data)
.then(data => event.sender.send('walletUnlocked')) .then(() => event.sender.send('walletUnlocked'))
.catch(error => event.sender.send('unlockWalletError')) .catch(() => event.sender.send('unlockWalletError'))
break break
case 'initWallet': case 'initWallet':
walletController.initWallet(walletUnlocker, data) walletController.initWallet(walletUnlocker, data)
.then(data => event.sender.send('successfullyCreatedWallet')) .then(() => event.sender.send('successfullyCreatedWallet'))
.catch(error => console.log('initWallet error: ', error)) .catch(error => console.log('initWallet error: ', error))
break break
default: default:
} }

7
app/main.dev.js

@ -17,7 +17,7 @@ import { spawn } from 'child_process'
import { lookup } from 'ps-node' import { lookup } from 'ps-node'
import os from 'os' import os from 'os'
import MenuBuilder from './menu' import MenuBuilder from './menu'
import { initLnd, initWalletUnlocker } from './lnd' import lnd from './lnd'
const plat = os.platform() const plat = os.platform()
const homedir = os.homedir() const homedir = os.homedir()
@ -111,7 +111,7 @@ const sendGrpcConnected = () => {
// Create and subscribe the grpc object // Create and subscribe the grpc object
const startGrpc = () => { const startGrpc = () => {
initLnd((lndSubscribe, lndMethods) => { lnd.initLnd((lndSubscribe, lndMethods) => {
// Subscribe to bi-directional streams // Subscribe to bi-directional streams
lndSubscribe(mainWindow) lndSubscribe(mainWindow)
@ -126,7 +126,7 @@ const startGrpc = () => {
// Create and subscribe the grpc object // Create and subscribe the grpc object
const startWalletUnlocker = () => { const startWalletUnlocker = () => {
initWalletUnlocker((walletUnlockerMethods) => { lnd.initWalletUnlocker((walletUnlockerMethods) => {
// Listen for all gRPC restful methods // Listen for all gRPC restful methods
ipcMain.on('walletUnlocker', (event, { msg, data }) => { ipcMain.on('walletUnlocker', (event, { msg, data }) => {
walletUnlockerMethods(event, msg, data) walletUnlockerMethods(event, msg, data)
@ -196,7 +196,6 @@ const startLnd = (alias, autopilot) => {
if (mainWindow) { if (mainWindow) {
mainWindow.webContents.send('walletUnlockerStarted') mainWindow.webContents.send('walletUnlockerStarted')
} }
} }
}, 1000) }, 1000)
} }

16
app/reducers/onboarding.js

@ -134,7 +134,7 @@ export const createWallet = () => (dispatch) => {
dispatch({ type: CHANGE_STEP, step: 4 }) dispatch({ type: CHANGE_STEP, step: 4 })
} }
export const successfullyCreatedWallet = (event) => (dispatch) => dispatch({ type: ONBOARDING_FINISHED }) export const successfullyCreatedWallet = () => dispatch => dispatch({ type: ONBOARDING_FINISHED })
// Listener for when LND creates and sends us a generated seed // Listener for when LND creates and sends us a generated seed
export const receiveSeed = (event, { cipher_seed_mnemonic }) => (dispatch) => { export const receiveSeed = (event, { cipher_seed_mnemonic }) => (dispatch) => {
@ -144,14 +144,14 @@ export const receiveSeed = (event, { cipher_seed_mnemonic }) => (dispatch) => {
} }
// Listener for when LND throws an error on seed creation // Listener for when LND throws an error on seed creation
export const receiveSeedError = (event, error) => (dispatch) => { export const receiveSeedError = () => (dispatch) => {
dispatch({ type: SET_HAS_SEED, hasSeed: true }) dispatch({ type: SET_HAS_SEED, hasSeed: true })
// there is already a seed, send user to the login component // there is already a seed, send user to the login component
dispatch({ type: CHANGE_STEP, step: 3 }) dispatch({ type: CHANGE_STEP, step: 3 })
} }
// Unlock an existing wallet with a wallet password // Unlock an existing wallet with a wallet password
export const unlockWallet = (wallet_password) => (dispatch) => { export const unlockWallet = wallet_password => (dispatch) => {
ipcRenderer.send('walletUnlocker', { msg: 'unlockWallet', data: { wallet_password } }) ipcRenderer.send('walletUnlocker', { msg: 'unlockWallet', data: { wallet_password } })
dispatch({ type: UNLOCKING_WALLET }) dispatch({ type: UNLOCKING_WALLET })
} }
@ -174,12 +174,10 @@ const ACTION_HANDLERS = {
[UPDATE_CREATE_WALLET_PASSWORD]: (state, { createWalletPassword }) => ({ ...state, createWalletPassword }), [UPDATE_CREATE_WALLET_PASSWORD]: (state, { createWalletPassword }) => ({ ...state, createWalletPassword }),
[UPDATE_CREATE_WALLET_PASSWORD_CONFIRMATION]: (state, { createWalletPasswordConfirmation }) => ({ ...state, createWalletPasswordConfirmation }), [UPDATE_CREATE_WALLET_PASSWORD_CONFIRMATION]: (state, { createWalletPasswordConfirmation }) => ({ ...state, createWalletPasswordConfirmation }),
[UPDATE_AEZEED_PASSWORD]: (state, { aezeedPassword }) => ({ ...state, aezeedPassword }), [UPDATE_AEZEED_PASSWORD]: (state, { aezeedPassword }) => ({ ...state, aezeedPassword }),
[UPDATE_SEED_INPUT]: (state, { inputSeedObj }) => { [UPDATE_SEED_INPUT]: (state, { inputSeedObj }) => ({
return { ...state,
...state, seedInput: Object.assign([], state.seedInput, { [inputSeedObj.index]: inputSeedObj })
seedInput: Object.assign([], state.seedInput, { [inputSeedObj['index']]: inputSeedObj }) }),
}
},
[SET_AUTOPILOT]: (state, { autopilot }) => ({ ...state, autopilot }), [SET_AUTOPILOT]: (state, { autopilot }) => ({ ...state, autopilot }),

Loading…
Cancel
Save