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. 17
      app/components/Onboarding/Onboarding.js
  7. 55
      app/components/Onboarding/ReEnterSeed.js
  8. 6
      app/components/Onboarding/Signup.js
  9. 4
      app/containers/Root.js
  10. 2
      app/lnd/index.js
  11. 13
      app/lnd/init/index.js
  12. 18
      app/lnd/walletUnlockerMethods/index.js
  13. 7
      app/main.dev.js
  14. 36
      app/reducers/onboarding.js

6
app/components/Onboarding/InitWallet.js

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

8
app/components/Onboarding/Login.js

@ -38,6 +38,12 @@ const Login = ({
</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

2
app/components/Onboarding/NewAezeedPassword.js

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

50
app/components/Onboarding/NewWalletPassword.js

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

28
app/components/Onboarding/NewWalletSeed.js

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

17
app/components/Onboarding/Onboarding.js

@ -6,7 +6,6 @@ import LoadingBolt from 'components/LoadingBolt'
import FormContainer from './FormContainer'
import Alias from './Alias'
import Autopilot from './Autopilot'
import InitWallet from './InitWallet'
import Login from './Login'
import Signup from './Signup'
import NewWalletSeed from './NewWalletSeed'
@ -81,7 +80,7 @@ const Onboarding = ({
next={() => {
// dont allow the user to move on if the confirmation password doesnt match the original password
if (newWalletPasswordProps.showCreateWalletPasswordConfirmationError) { return }
changeStep(5)
}}
>
@ -94,7 +93,7 @@ const Onboarding = ({
title={'Alright, let\'s get set up'}
description='Would you like to create a new wallet or import an existing one?' // eslint-disable-line
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} />
</FormContainer>
@ -143,9 +142,7 @@ const Onboarding = ({
}
if (startingLnd) { return <LoadingBolt /> }
if (fetchingSeed) {
console.log('got em!')
return <LoadingBolt /> }
if (fetchingSeed) { return <LoadingBolt /> }
return (
<div className={styles.container}>
@ -158,8 +155,14 @@ Onboarding.propTypes = {
onboarding: PropTypes.object.isRequired,
aliasProps: 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,
startLnd: PropTypes.func.isRequired
startLnd: PropTypes.func.isRequired,
submitNewWallet: PropTypes.func.isRequired
}
export default Onboarding

55
app/components/Onboarding/ReEnterSeed.js

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

6
app/components/Onboarding/Signup.js

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

4
app/containers/Root.js

@ -74,14 +74,14 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
const initWalletProps = {
hasSeed: stateProps.onboarding.hasSeed,
loginProps: {
password: stateProps.onboarding.password,
passwordIsValid: stateProps.passwordIsValid,
hasSeed: stateProps.onboarding.hasSeed,
unlockingWallet: stateProps.onboarding.unlockingWallet,
unlockWalletError: stateProps.onboarding.unlockWalletError,
updatePassword: dispatchProps.updatePassword,
createWallet: dispatchProps.createWallet,
unlockWallet: dispatchProps.unlockWallet

2
app/lnd/index.js

@ -31,4 +31,4 @@ const initWalletUnlocker = (callback) => {
export default {
initLnd,
initWalletUnlocker
}
}

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) {
case 'genSeed':
walletController.genSeed(walletUnlocker)
.then(data => {
console.log('data yo: ', data)
event.sender.send('receiveSeed', data)
})
.catch(error => {
console.log('genSeed error: ', error)
event.sender.send('receiveSeedError', error)
})
.then(genSeedData => event.sender.send('receiveSeed', genSeedData))
.catch(error => event.sender.send('receiveSeedError', error))
break
case 'unlockWallet':
walletController.unlockWallet(walletUnlocker, data)
.then(data => event.sender.send('walletUnlocked'))
.catch(error => event.sender.send('unlockWalletError'))
.then(() => event.sender.send('walletUnlocked'))
.catch(() => event.sender.send('unlockWalletError'))
break
case 'initWallet':
walletController.initWallet(walletUnlocker, data)
.then(data => event.sender.send('successfullyCreatedWallet'))
.catch(error => console.log('initWallet error: ', error))
.then(() => event.sender.send('successfullyCreatedWallet'))
.catch(error => console.log('initWallet error: ', error))
break
default:
}

7
app/main.dev.js

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

36
app/reducers/onboarding.js

@ -105,7 +105,7 @@ export function changeStep(step) {
}
export function startLnd(alias, autopilot) {
// once the user submits the data needed to start LND we will alert the app that it should start LND
// once the user submits the data needed to start LND we will alert the app that it should start LND
ipcRenderer.send('startLnd', { alias, autopilot })
return {
@ -114,7 +114,7 @@ export function startLnd(alias, autopilot) {
}
export const submitNewWallet = (wallet_password, cipher_seed_mnemonic, aezeed_passphrase) => (dispatch) => {
// once the user submits the data needed to start LND we will alert the app that it should start LND
// once the user submits the data needed to start LND we will alert the app that it should start LND
ipcRenderer.send('walletUnlocker', { msg: 'initWallet', data: { wallet_password, cipher_seed_mnemonic, aezeed_passphrase } })
dispatch({ type: CREATING_NEW_WALLET })
}
@ -134,7 +134,7 @@ export const createWallet = () => (dispatch) => {
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
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
export const receiveSeedError = (event, error) => (dispatch) => {
export const receiveSeedError = () => (dispatch) => {
dispatch({ type: SET_HAS_SEED, hasSeed: true })
// there is already a seed, send user to the login component
dispatch({ type: CHANGE_STEP, step: 3 })
}
// 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 } })
dispatch({ type: UNLOCKING_WALLET })
}
@ -174,23 +174,21 @@ const ACTION_HANDLERS = {
[UPDATE_CREATE_WALLET_PASSWORD]: (state, { createWalletPassword }) => ({ ...state, createWalletPassword }),
[UPDATE_CREATE_WALLET_PASSWORD_CONFIRMATION]: (state, { createWalletPasswordConfirmation }) => ({ ...state, createWalletPasswordConfirmation }),
[UPDATE_AEZEED_PASSWORD]: (state, { aezeedPassword }) => ({ ...state, aezeedPassword }),
[UPDATE_SEED_INPUT]: (state, { inputSeedObj }) => {
return {
...state,
seedInput: Object.assign([], state.seedInput, { [inputSeedObj['index']]: inputSeedObj })
}
},
[UPDATE_SEED_INPUT]: (state, { inputSeedObj }) => ({
...state,
seedInput: Object.assign([], state.seedInput, { [inputSeedObj.index]: inputSeedObj })
}),
[SET_AUTOPILOT]: (state, { autopilot }) => ({ ...state, autopilot }),
[SET_HAS_SEED]: (state, { hasSeed }) => ({ ...state, hasSeed }),
[SET_SEED]: (state, { seed }) => ({ ...state, seed, fetchingSeed: false }),
[CHANGE_STEP]: (state, { step }) => ({ ...state, step }),
[ONBOARDING_STARTED]: state => ({ ...state, onboarded: false }),
[ONBOARDING_FINISHED]: state => ({ ...state, onboarded: true }),
[STARTING_LND]: state => ({ ...state, startingLnd: true }),
[LND_STARTED]: state => ({ ...state, startingLnd: false }),
@ -199,7 +197,7 @@ const ACTION_HANDLERS = {
[UNLOCKING_WALLET]: state => ({ ...state, unlockingWallet: true }),
[WALLET_UNLOCKED]: state => ({ ...state, unlockingWallet: false, unlockWalletError: { isError: false, message: '' } }),
[SET_UNLOCK_WALLET_ERROR]: state => ({ ...state, unlockingWallet: false, unlockWalletError: { isError: true, message: 'Incorrect password' } }),
[SET_SIGNUP_CREATE]: state => ({ ...state, signupForm: { create: true, import: false } }),
[SET_SIGNUP_IMPORT]: state => ({ ...state, signupForm: { create: false, import: true } })
}
@ -241,11 +239,11 @@ const initialState = {
alias: '',
password: '',
startingLnd: false,
fetchingSeed: false,
hasSeed: false,
seed: [],
// wallet password. password used to encrypt the wallet and is required to unlock the daemon after set
createWalletPassword: '',
createWalletPasswordConfirmation: '',

Loading…
Cancel
Save