diff --git a/.prettierrc.js b/.prettierrc.js index 5e11142..e87af12 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -4,6 +4,4 @@ module.exports = { singleQuote: true, trailingComma: 'all', semi: false, - printWidth: 100, - arrowParens: 'avoid', } diff --git a/package.json b/package.json index 66c4846..ce4f1b5 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "react-native-share": "3.2.0", "react-native-svg": "^12.1.0", "react-native-swipe-list-view": "^2.3.0", - "react-native-torch": "^1.1.5", "react-native-touch-id": "^4.4.1", "react-native-vector-icons": "^6.4.2", "react-redux": "^7.2.0", diff --git a/sign-with-local.sh b/sign-with-local.sh new file mode 100644 index 0000000..3a589eb --- /dev/null +++ b/sign-with-local.sh @@ -0,0 +1,12 @@ +#/bin/sh + +if [ -z $1 ]; then + echo "Please provide tx_slate_id" + exit +fi + +SLATE_PATH=slates/$1.grinslate + +adb pull /data/user/0/app.ironbelly/files/$SLATE_PATH $SLATE_PATH +grin-wallet --floonet -p 1 receive -i $SLATE_PATH +adb push $SLATE_PATH.response /sdcard/Download/ diff --git a/src/App.tsx b/src/App.tsx index 67f8012..cfdbf3e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -45,7 +45,11 @@ import TxPostConfirmationModal from 'src/components/TxPostConfirmationModal' import colors from 'src/common/colors' import { RootStack, navigationRef } from 'src/modules/navigation' import { isAndroid } from 'src/common' -import { MAINNET_CHAIN, MAINNET_API_SECRET, FLOONET_API_SECRET } from 'src/modules/settings' +import { + MAINNET_CHAIN, + MAINNET_API_SECRET, + FLOONET_API_SECRET, +} from 'src/modules/settings' import { State as ToasterState } from 'src/modules/toaster' import { State as CurrencyRatesState } from 'src/modules/currency-rates' const { GrinBridge } = NativeModules // Filesystem @@ -115,21 +119,23 @@ class RealApp extends React.Component { }) } else { Linking.getInitialURL() - .then(url => { + .then((url) => { if (url) { this._handleOpenURL({ url, }) } }) - .catch(err => console.error('An error occurred', err)) + .catch((err) => console.error('An error occurred', err)) } Linking.addEventListener('url', this._handleOpenURL) AppState.addEventListener('change', this._handleAppStateChange) checkApiSecret(() => { this.props.setApiSecret( - this.props.chain === MAINNET_CHAIN ? MAINNET_API_SECRET : FLOONET_API_SECRET, + this.props.chain === MAINNET_CHAIN + ? MAINNET_API_SECRET + : FLOONET_API_SECRET, ) }) // this.backHandler = BackHandler.addEventListener('hardwareBackPress', this._handleBackPress) @@ -155,7 +161,7 @@ class RealApp extends React.Component { _handleOpenURL = (event: { url: string }) => { // const { setFromLink } = this.props - isWalletInitialized().then(async exists => { + isWalletInitialized().then(async (exists) => { if (exists) { if (isAndroid) { try { @@ -187,13 +193,20 @@ class RealApp extends React.Component { // setFromLink(amount, message, destination) // } // } - } else if (link.protocol && ['file:'].indexOf(link.protocol) !== -1 && link.path) { + } else if ( + link.protocol && + ['file:'].indexOf(link.protocol) !== -1 && + link.path + ) { const path = isAndroid ? decodeURIComponent(link.path) : link.path store.dispatch({ type: 'SLATE_LOAD_REQUEST', slatePath: path, }) - } else if (link.protocol && ['content:'].indexOf(link.protocol) !== -1) { + } else if ( + link.protocol && + ['content:'].indexOf(link.protocol) !== -1 + ) { // Copy the file, because we can not operate on content:// // from inside rust code const url = event.url @@ -213,7 +226,7 @@ class RealApp extends React.Component { const { sharingInProgress } = this.props if (nextAppState === 'background' && !sharingInProgress) { - isWalletInitialized().then(async exists => { + isWalletInitialized().then(async (exists) => { if (exists) { store.dispatch({ type: 'CLEAR_PASSWORD', @@ -233,9 +246,13 @@ class RealApp extends React.Component { // @ts-ignore this.refs.toast.timer && clearTimeout(this.refs.toast.timer) // @ts-ignore - this.refs.toast.show(this.props.toastMessage.text, this.props.toastMessage.duration, () => { - this.props.clearToast() - }) + this.refs.toast.show( + this.props.toastMessage.text, + this.props.toastMessage.duration, + () => { + this.props.clearToast() + }, + ) } else { // @ts-ignore if (this.refs.toast.state.isShow) { @@ -247,7 +264,8 @@ class RealApp extends React.Component { } } - const sinceLastCurrencyRatesUpdate = Date.now() - this.props.currencyRates.lastUpdated + const sinceLastCurrencyRatesUpdate = + Date.now() - this.props.currencyRates.lastUpdated if ( sinceLastCurrencyRatesUpdate > 5 * 60 * 1000 && @@ -259,13 +277,20 @@ class RealApp extends React.Component { } render() { - const { walletCreated, scanInProgress, closeTxPostModal, isPasswordValid } = this.props + const { + walletCreated, + scanInProgress, + closeTxPostModal, + isPasswordValid, + } = this.props if (walletCreated === null) { return null } return ( - + @@ -302,7 +327,7 @@ const mapStateToProps = (state: GlobalState): StateProps => { const RealAppConnected = connect( mapStateToProps, - dispatch => ({ + (dispatch) => ({ requestWalletExists: () => dispatch({ type: 'WALLET_EXISTS_REQUEST', @@ -347,7 +372,10 @@ export default class App extends Component< return ( - + ) diff --git a/src/common/index.ts b/src/common/index.ts index e105ac9..51ab0c8 100644 --- a/src/common/index.ts +++ b/src/common/index.ts @@ -55,7 +55,11 @@ export const hrFiat = (amount: number, currency: Currency): string => { minimumFractionDigits: currency.fractionDigits, }).format(amount) } -export const convertToFiat = (amount: number, currency: Currency, rates: object): number => { +export const convertToFiat = ( + amount: number, + currency: Currency, + rates: object, +): number => { const multiplier = rates[currency.code.toLowerCase()] return (amount / 1000000000) * (multiplier || 0) } @@ -85,7 +89,9 @@ export const mapRustBalance = (rB: RustBalance): Balance => { total: parseInt(rB.total, 10), } } -export const mapRustOutputStrategy = (oS: RustOutputStrategy): OutputStrategy => { +export const mapRustOutputStrategy = ( + oS: RustOutputStrategy, +): OutputStrategy => { return { total: oS.total, fee: oS.fee, @@ -113,9 +119,10 @@ export const SLATES_DIRECTORY = RNFS.DocumentDirectoryPath + '/slates' export const APPLICATION_SUPPORT_DIRECTORY = isAndroid ? RNFS.DocumentDirectoryPath : RNFS.LibraryDirectoryPath + '/Application Support' -export const WALLET_DATA_DIRECTORY = APPLICATION_SUPPORT_DIRECTORY + '/wallet_data' +export const WALLET_DATA_DIRECTORY = + APPLICATION_SUPPORT_DIRECTORY + '/wallet_data' export const checkSlatesDirectory = () => { - RNFS.exists(SLATES_DIRECTORY).then(exists => { + RNFS.exists(SLATES_DIRECTORY).then((exists) => { if (!exists) { RNFS.mkdir(SLATES_DIRECTORY, { NSURLIsExcludedFromBackupKey: true, @@ -128,7 +135,7 @@ export const checkSlatesDirectory = () => { export const FILE_TRANSPORT_METHOD = 'file' export const HTTP_TRANSPORT_METHOD = 'http' export const checkApplicationSupportDirectory = () => { - RNFS.exists(APPLICATION_SUPPORT_DIRECTORY).then(exists => { + RNFS.exists(APPLICATION_SUPPORT_DIRECTORY).then((exists) => { if (!exists) { RNFS.mkdir(APPLICATION_SUPPORT_DIRECTORY, { NSURLIsExcludedFromBackupKey: true, @@ -139,7 +146,7 @@ export const checkApplicationSupportDirectory = () => { }) } export const checkWalletDataDirectory = () => { - return RNFS.exists(WALLET_DATA_DIRECTORY).then(exists => { + return RNFS.exists(WALLET_DATA_DIRECTORY).then((exists) => { if (!exists) { return RNFS.mkdir(WALLET_DATA_DIRECTORY, { NSURLIsExcludedFromBackupKey: true, @@ -153,7 +160,7 @@ export const checkWalletDataDirectory = () => { } export const checkApiSecret = (cb: () => void) => { const apiSecretFilePath = APPLICATION_SUPPORT_DIRECTORY + '/.api_secret' - RNFS.exists(apiSecretFilePath).then(exists => { + RNFS.exists(apiSecretFilePath).then((exists) => { if (!exists) { cb() } @@ -175,7 +182,9 @@ export const isResponseSlate = async (slate: any) => { } } export const getSlatePath = (slateId: string, isResponse: boolean) => { - return `${SLATES_DIRECTORY}/${slateId}.grinslate${isResponse ? '.response' : ''}` + return `${SLATES_DIRECTORY}/${slateId}.grinslate${ + isResponse ? '.response' : '' + }` } export const TextareaTitle = styled.Text` font-size: 20; @@ -253,7 +262,8 @@ export const parseSendLink = (query: UrlQuery) => { } } export const formatDate = (date: moment) => date.format('DD MMMM YYYY') -export const formatTime = (time: moment) => time.format('dddd, DD MMMM YYYY, HH:mm') +export const formatTime = (time: moment) => + time.format('dddd, DD MMMM YYYY, HH:mm') export const currencyList = [ { code: 'btc', diff --git a/src/common/logger.ts b/src/common/logger.ts index 9ba286f..009e26d 100644 --- a/src/common/logger.ts +++ b/src/common/logger.ts @@ -1,5 +1,8 @@ import { store } from 'src/common/redux' -export const log = (e: Error | { message: string }, showToUser: boolean = false) => { +export const log = ( + e: Error | { message: string }, + showToUser: boolean = false, +) => { if (!(e instanceof Error) && e.message) { e = new Error(e.message) } diff --git a/src/common/migrations.ts b/src/common/migrations.ts index 62f4294..1bde508 100644 --- a/src/common/migrations.ts +++ b/src/common/migrations.ts @@ -6,7 +6,8 @@ export const migrations = { settings: { ...state.settings, checkNodeApiHttpAddr: - state.settings.checkNodeApiHttpAddr === 'http://grinnode.cycle42.com:23413' + state.settings.checkNodeApiHttpAddr === + 'http://grinnode.cycle42.com:23413' ? MAINNET_DEFAULT_NODE : state.settings.checkNodeApiHttpAddr, }, diff --git a/src/common/redux.ts b/src/common/redux.ts index 6bdf423..6ae9add 100644 --- a/src/common/redux.ts +++ b/src/common/redux.ts @@ -19,14 +19,26 @@ import { Epic, combineEpics, createEpicMiddleware } from 'redux-observable' import { appEpic, appReducer } from 'src/modules/app' import { catchError } from 'rxjs/operators' import { reducer as balanceReducer } from 'src/modules/balance' -import { reducer as txReducer, sideEffects as txSideEffects } from 'src/modules/tx' -import { reducer as settingsReducer, sideEffects as settingsEffects } from 'src/modules/settings' +import { + reducer as txReducer, + sideEffects as txSideEffects, +} from 'src/modules/tx' +import { + reducer as settingsReducer, + sideEffects as settingsEffects, +} from 'src/modules/settings' import { reducer as currencyRates, sideEffects as currencyRatesEffects, } from 'src/modules/currency-rates' -import { reducer as toasterReducer, sideEffects as toasterEffects } from 'src/modules/toaster' -import { reducer as walletReducer, sideEffects as walletEffects } from 'src/modules/wallet' +import { + reducer as toasterReducer, + sideEffects as toasterEffects, +} from 'src/modules/toaster' +import { + reducer as walletReducer, + sideEffects as walletEffects, +} from 'src/modules/wallet' import { State, Action } from 'src/common/types' import { createStore, applyMiddleware } from 'redux' import { createMigrate, persistStore, persistReducer } from 'redux-persist' @@ -55,16 +67,26 @@ const currencyRatesConfig = { } export const rootReducer = combineReducers({ - balance: persistReducer(balanceConfig, balanceReducer) as typeof balanceReducer, + balance: persistReducer( + balanceConfig, + balanceReducer, + ) as typeof balanceReducer, app: persistReducer(appConfig, appReducer) as typeof appReducer, tx: txReducer, - currencyRates: persistReducer(currencyRatesConfig, currencyRates) as typeof currencyRates, + currencyRates: persistReducer( + currencyRatesConfig, + currencyRates, + ) as typeof currencyRates, settings: settingsReducer, toaster: toasterReducer, wallet: walletReducer, }) as () => State -export const rootEpic: Epic = (action$, store$, dependencies) => +export const rootEpic: Epic = ( + action$, + store$, + dependencies, +) => combineEpics(appEpic)(action$, store$, dependencies).pipe( catchError((error, source) => { console.error(error) @@ -96,10 +118,17 @@ const persistConfig = { const enhancers = [applyMiddleware(sideEffectsMiddleware, epicMiddleware)] -const composeEnhancers = (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose +const composeEnhancers = + (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose -const persistedReducer = persistReducer(persistConfig, rootReducer) -export const store = createStore(persistedReducer, composeEnhancers(...enhancers)) +const persistedReducer = persistReducer( + persistConfig, + rootReducer, +) +export const store = createStore( + persistedReducer, + composeEnhancers(...enhancers), +) export const persistor = persistStore(store) epicMiddleware.run(rootEpic) diff --git a/src/common/sideEffects.ts b/src/common/sideEffects.ts index e0eabdd..16dcad8 100644 --- a/src/common/sideEffects.ts +++ b/src/common/sideEffects.ts @@ -22,9 +22,9 @@ const isAction = (o: any): boolean => { return !!o?.type } -export const createMiddleware = (effects: Effects) => (store: Store) => (next: any) => ( - action: Action, -) => { +export const createMiddleware = (effects: Effects) => (store: Store) => ( + next: any, +) => (action: Action) => { const initAction = next(action) const effect = effects[action.type] @@ -34,7 +34,7 @@ export const createMiddleware = (effects: Effects) => (store: Store) => (next: a if (isAction(result)) { store.dispatch(result) } else if (result instanceof Promise) { - result.then(res => isAction(res) && store.dispatch(res)) + result.then((res) => isAction(res) && store.dispatch(res)) } } diff --git a/src/common/types.ts b/src/common/types.ts index 563f71c..46988a3 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -456,7 +456,10 @@ export type currencyRatesFalureAction = { } export type walletExistsRequestAction = { type: 'WALLET_EXISTS_REQUEST' } -export type walletExistsSuccessAction = { type: 'WALLET_EXISTS_SUCCESS'; exists: boolean } +export type walletExistsSuccessAction = { + type: 'WALLET_EXISTS_SUCCESS' + exists: boolean +} export type walletExistsFalureAction = { type: 'WALLET_EXISTS_FAILURE' code?: number diff --git a/src/components/Balance.tsx b/src/components/Balance.tsx index b2b7700..b71ab74 100644 --- a/src/components/Balance.tsx +++ b/src/components/Balance.tsx @@ -133,7 +133,11 @@ const BalanceComponent = ({ {hrFiat( - convertToFiat(balance.total + balance.amountLocked, currency, rates), + convertToFiat( + balance.total + balance.amountLocked, + currency, + rates, + ), currency, )} @@ -151,8 +155,12 @@ const BalanceComponent = ({ - Awaiting {minimumConfirmations} confirmations - {hrGrin(balance.amountAwaitingConfirmation)} + + Awaiting {minimumConfirmations} confirmations + + + {hrGrin(balance.amountAwaitingConfirmation)} + Currently spendable diff --git a/src/components/CardTitle.tsx b/src/components/CardTitle.tsx index 698716d..80cc17f 100644 --- a/src/components/CardTitle.tsx +++ b/src/components/CardTitle.tsx @@ -1,5 +1,11 @@ import React from 'react' -import { TouchableOpacity, StatusBar, StyleSheet, Text, View } from 'react-native' +import { + TouchableOpacity, + StatusBar, + StyleSheet, + Text, + View, +} from 'react-native' import FeatherIcon from 'react-native-vector-icons/Feather' import { isAndroid } from 'src/common' diff --git a/src/components/CustomFont.tsx b/src/components/CustomFont.tsx index 57f7b9e..5779878 100644 --- a/src/components/CustomFont.tsx +++ b/src/components/CustomFont.tsx @@ -18,7 +18,7 @@ import colors from 'src/common/colors' import { Linking } from 'react-native' export const monoSpaceFont = 'Menlo' export const Text = styled.Text` - font-size: ${props => (props.fontSize ? props.fontSize : '16px')}; + font-size: ${(props) => (props.fontSize ? props.fontSize : '16px')}; font-weight: normal; color: ${() => colors.black}; ` @@ -40,22 +40,26 @@ export const TextInput = styled.TextInput` ` function getBackgroundColor(props: any) { - return props.inverted ? 'white' : props.danger ? colors.warning : colors.primary + return props.inverted + ? 'white' + : props.danger + ? colors.warning + : colors.primary } const StyledButton = styled.TouchableOpacity` padding: 10px 15px; - background-color: ${props => getBackgroundColor(props)}; + background-color: ${(props) => getBackgroundColor(props)}; border-radius: 8; - border-width: ${props => (props.inverted ? '1' : '0')}; - opacity: ${props => (props.disabled ? '0.3' : '1')}; + border-width: ${(props) => (props.inverted ? '1' : '0')}; + opacity: ${(props) => (props.disabled ? '0.3' : '1')}; ` const ButtonTitle = styled(Text)` font-size: 21; font-weight: 500; width: auto; text-align: center; - color: ${props => (props.danger ? '#FFF' : '#000')}; + color: ${(props) => (props.danger ? '#FFF' : '#000')}; ` export const Button = (props: any) => { return ( diff --git a/src/components/HeaderSpan.tsx b/src/components/HeaderSpan.tsx index c60a110..ba4932b 100644 --- a/src/components/HeaderSpan.tsx +++ b/src/components/HeaderSpan.tsx @@ -15,8 +15,8 @@ import { Platform, Dimensions } from 'react-native' import styled from 'styled-components/native' export default styled.View` - background-color: ${props => (props.bgColor ? props.bgColor : '#fff')}; - height: ${props => + background-color: ${(props) => (props.bgColor ? props.bgColor : '#fff')}; + height: ${(props) => Platform.OS === 'ios' && Dimensions.get('window').height === 812 && Dimensions.get('window').width === 375 diff --git a/src/components/NumericInput.tsx b/src/components/NumericInput.tsx index 45d4a5b..f653945 100644 --- a/src/components/NumericInput.tsx +++ b/src/components/NumericInput.tsx @@ -39,8 +39,8 @@ const Spacer = styled(Text)` line-height: 58; ` const StyledInput = styled(TextInput)` - font-size: ${props => (props.value ? 36 : 36)}; - font-weight: ${props => (props.value ? 600 : 300)}; + font-size: ${(props) => (props.value ? 36 : 36)}; + font-weight: ${(props) => (props.value ? 600 : 300)}; flex-grow: 1; color: ${colors.black} height: 58; @@ -48,7 +48,15 @@ const StyledInput = styled(TextInput)` ` export default class NumericInput extends Component { render() { - const { units, maxLength, style, onChange, value, autoFocus, placeholder } = this.props + const { + units, + maxLength, + style, + onChange, + value, + autoFocus, + placeholder, + } = this.props return ( (props.isSent && colors.black) || colors.success}; + color: ${(props) => (props.isSent && colors.black) || colors.success}; ` const AmountFiat = styled(Text)` font-size: 14; @@ -80,7 +86,8 @@ const TxListItem = (props: Props) => { const { currency, rates } = props const { type, confirmed, creationTime, amount } = props.tx const momentCreationTime = moment(creationTime) - const isSent = type.indexOf('Sent') !== -1 || type === 'TxFinalized' || type === 'TxPosted' + const isSent = + type.indexOf('Sent') !== -1 || type === 'TxFinalized' || type === 'TxPosted' const dateField = moment().diff(momentCreationTime, 'hours', true) > 2 ? formatDate(momentCreationTime) @@ -116,7 +123,9 @@ const TxListItem = (props: Props) => { alignItems: 'flex-end', }}> {hrGrin(amount)} - {hrFiat(convertToFiat(amount, currency, rates), currency)} + + {hrFiat(convertToFiat(amount, currency, rates), currency)} + {(!confirmed && type !== 'TxPosted' && ) || diff --git a/src/components/TxPostConfirmationModal.tsx b/src/components/TxPostConfirmationModal.tsx index b4e1619..e74d229 100644 --- a/src/components/TxPostConfirmationModal.tsx +++ b/src/components/TxPostConfirmationModal.tsx @@ -99,7 +99,9 @@ class TxPostConfirmationModal extends Component { {(posted && ( - Transaction has been posted successfully! + + Transaction has been posted successfully! + )) || ( @@ -131,13 +133,13 @@ const mapStateToProps = (state: ReduxState) => ({ }) const mapDispatchToProps = (dispatch, ownProps) => ({ - txGet: txSlateId => { + txGet: (txSlateId) => { dispatch({ type: 'TX_GET_REQUEST', txSlateId, }) }, - txPost: txSlateId => { + txPost: (txSlateId) => { dispatch({ type: 'TX_POST_REQUEST', txSlateId, @@ -150,4 +152,7 @@ const mapDispatchToProps = (dispatch, ownProps) => ({ }, }) -export default connect(mapStateToProps, mapDispatchToProps)(TxPostConfirmationModal) +export default connect( + mapStateToProps, + mapDispatchToProps, +)(TxPostConfirmationModal) diff --git a/src/modules/app.ts b/src/modules/app.ts index 90a30f9..f6346af 100644 --- a/src/modules/app.ts +++ b/src/modules/app.ts @@ -1,6 +1,14 @@ import { Epic, combineEpics, ofType } from 'redux-observable' import { Client, Configuration } from 'bugsnag-react-native' -import { filter, ignoreElements, catchError, take, mergeMap, map, tap } from 'rxjs/operators' +import { + filter, + ignoreElements, + catchError, + take, + mergeMap, + map, + tap, +} from 'rxjs/operators' import RNFS from 'react-native-fs' import { Action, Slate, State as RootState } from 'src/common/types' import { getNavigation } from 'src/modules/navigation' @@ -20,7 +28,10 @@ export const initialState: State = { legalAccepted: false, } -export const appReducer = (state: State = initialState, action: Action): State => { +export const appReducer = ( + state: State = initialState, + action: Action, +): State => { switch (action.type) { case 'SLATE_LOAD_REQUEST': return { @@ -42,10 +53,17 @@ export const appReducer = (state: State = initialState, action: Action): State = } } -export const handleOpenSlateEpic: Epic = (action$, state$) => +export const handleOpenSlateEpic: Epic = ( + action$, + state$, +) => action$.pipe( ofType('VALID_PASSWORD', 'SLATE_LOAD_REQUEST'), - filter(() => !!state$.value.app.unopenedSlatePath && state$.value.wallet.password.valid), + filter( + () => + !!state$.value.app.unopenedSlatePath && + state$.value.wallet.password.valid, + ), mergeMap(async () => { const slate: Slate = await RNFS.readFile( state$.value.app.unopenedSlatePath, @@ -57,7 +75,7 @@ export const handleOpenSlateEpic: Epic = (action$, st slatePath: state$.value.app.unopenedSlatePath, } as Action }), - catchError(error => { + catchError((error) => { log(error, true) return of({ type: 'SLATE_SET_FAILURE', @@ -67,12 +85,15 @@ export const handleOpenSlateEpic: Epic = (action$, st }), ) -export const handleOpenedSlateEpic: Epic = (action$, _state$) => { +export const handleOpenedSlateEpic: Epic = ( + action$, + _state$, +) => { // const navigation = await getNavigation() const [response$, request$] = partition( action$.pipe( filter(({ type }) => type === 'SLATE_LOAD_SUCCESS'), - mergeMap(async action => { + mergeMap(async (action) => { // @ts-ignore const { slate } = action const isResponse = await isResponseSlate(slate) @@ -122,7 +143,9 @@ const thirdPartyEpic: Epic = (action$, state$) => { const configuration = new Configuration() // Run only in release builds configuration.notifyReleaseStages = [MAINNET_CHAIN, FLOONET_CHAIN] - configuration.releaseStage = __DEV__ ? 'development' : state$.value.settings.chain //stage + configuration.releaseStage = __DEV__ + ? 'development' + : state$.value.settings.chain //stage new Client(configuration) }), take(1), diff --git a/src/modules/currency-rates.ts b/src/modules/currency-rates.ts index 42a1f4f..c0de98c 100644 --- a/src/modules/currency-rates.ts +++ b/src/modules/currency-rates.ts @@ -52,13 +52,16 @@ export const reducer = (state: State = initialState, action: Action): State => { } } export const sideEffects = { - ['CURRENCY_RATES_REQUEST']: async (_action: currencyRatesRequestAction, store: Store) => { + ['CURRENCY_RATES_REQUEST']: async ( + _action: currencyRatesRequestAction, + store: Store, + ) => { try { const rates = await fetch( `https://api.coingecko.com/api/v3/simple/price?ids=grin&vs_currencies=${currencyList - .map(c => c.code) + .map((c) => c.code) .join(',')}`, - ).then(data => data.json()) + ).then((data) => data.json()) store.dispatch({ type: 'CURRENCY_RATES_SUCCESS', rates, diff --git a/src/modules/navigation.tsx b/src/modules/navigation.tsx index bdbfd19..d35a507 100644 --- a/src/modules/navigation.tsx +++ b/src/modules/navigation.tsx @@ -18,7 +18,10 @@ import { isAndroid } from 'src/common' import { State as ReduxState } from 'src/common/types' import React from 'react' import { Text, Animated } from 'react-native' -import { TransitionPresets, createStackNavigator } from '@react-navigation/stack' +import { + TransitionPresets, + createStackNavigator, +} from '@react-navigation/stack' import { NavigationContainerRef } from '@react-navigation/core' import OverviewScreen from 'src/screens/Overview' import SendScreen from 'src/screens/Send' @@ -65,7 +68,9 @@ const defaultScreenOptions = { export type RootStackParamList = { Landing: undefined - LegalDisclaimer: { nextScreen: { name: keyof RootStackParamList; params: any } } + LegalDisclaimer: { + nextScreen: { name: keyof RootStackParamList; params: any } + } NewPassword: undefined ShowPaperKey: undefined WalletScan: undefined @@ -90,8 +95,14 @@ export type RootStackParamList = { const Stack = createStackNavigator() const NotCreated = () => ( - - + + ( ) -const forFade = ({ current }: { current: { progress: Animated.AnimatedInterpolation } }) => ({ +const forFade = ({ + current, +}: { + current: { progress: Animated.AnimatedInterpolation } +}) => ({ cardStyle: { opacity: current.progress, }, @@ -134,7 +149,9 @@ const ResetButtonText = styled(Text)` ` const Created = () => ( - + ( component={TxDetailsScreen} options={ isAndroid - ? { ...TransitionPresets.DefaultTransition, title: 'Transaction Details' } + ? { + ...TransitionPresets.DefaultTransition, + title: 'Transaction Details', + } : { ...TransitionPresets.ModalPresentationIOS, headerShown: false } } /> diff --git a/src/modules/settings.ts b/src/modules/settings.ts index a5f6ed1..4d46ffc 100644 --- a/src/modules/settings.ts +++ b/src/modules/settings.ts @@ -98,16 +98,25 @@ export const reducer = (state: State = initialState, action: Action): State => { } export const apiSecretFilePath = APPLICATION_SUPPORT_DIRECTORY + '/.api_secret' export const sideEffects = { - ['SWITCH_TO_FLOONET']: async (action: switchToFloonetAction, store: Store) => { + ['SWITCH_TO_FLOONET']: async ( + action: switchToFloonetAction, + store: Store, + ) => { await RNFS.writeFile(apiSecretFilePath, FLOONET_API_SECRET) }, - ['SWITCH_TO_MAINNET']: async (action: switchToMainnetAction, store: Store) => { + ['SWITCH_TO_MAINNET']: async ( + action: switchToMainnetAction, + store: Store, + ) => { await RNFS.writeFile(apiSecretFilePath, MAINNET_API_SECRET) }, ['SET_API_SECRET']: async (action: setApiSecretAction, store: Store) => { await RNFS.writeFile(apiSecretFilePath, action.apiSecret) }, - ['CHECK_BIOMETRY_REQUEST']: async (action: checkBiometryRequestAction, store: Store) => { + ['CHECK_BIOMETRY_REQUEST']: async ( + action: checkBiometryRequestAction, + store: Store, + ) => { try { const biometryType = await Keychain.getSupportedBiometryType() store.dispatch({ @@ -122,7 +131,10 @@ export const sideEffects = { log(error, true) } }, - ['ENABLE_BIOMETRY_REQUEST']: async (action: enableBiometryRequestAction, store: Store) => { + ['ENABLE_BIOMETRY_REQUEST']: async ( + action: enableBiometryRequestAction, + store: Store, + ) => { const { value: password } = store.getState().wallet.password try { @@ -157,7 +169,10 @@ export const sideEffects = { log(error, false) } }, - ['DISABLE_BIOMETRY_REQUEST']: async (action: disableBiometryRequestAction, store: Store) => { + ['DISABLE_BIOMETRY_REQUEST']: async ( + action: disableBiometryRequestAction, + store: Store, + ) => { try { await Keychain.resetGenericPassword() store.dispatch({ @@ -171,7 +186,10 @@ export const sideEffects = { log(error, true) } }, - ['RESET_BIOMETRY_REQUEST']: async (action: resetBiometryRequestAction, store: Store) => { + ['RESET_BIOMETRY_REQUEST']: async ( + action: resetBiometryRequestAction, + store: Store, + ) => { try { await Keychain.resetGenericPassword() store.dispatch({ diff --git a/src/modules/tx.ts b/src/modules/tx.ts index 2082f9b..87a2f09 100644 --- a/src/modules/tx.ts +++ b/src/modules/tx.ts @@ -211,7 +211,9 @@ function twoStringArrayEqual(a: T[], b: T[]) { export const sideEffects = { ['TX_LIST_REQUEST']: async (action: txListRequestAction, store: Store) => { try { - let finalized = await AsyncStorage.getItem('@finalizedTxs').then(JSON.parse) + let finalized = await AsyncStorage.getItem('@finalizedTxs').then( + JSON.parse, + ) if (!finalized) { finalized = [] } @@ -251,7 +253,10 @@ export const sideEffects = { if (pos !== -1) { if (tx.confirmed) { - Countly.sendEvent({ eventName: 'tx_sent_confirmed', eventCount: 1 }) + Countly.sendEvent({ + eventName: 'tx_sent_confirmed', + eventCount: 1, + }) return tx } else { @@ -266,7 +271,10 @@ export const sideEffects = { if (!tx.confirmed) { newReceived.push(tx.tx_slate_id) } else { - Countly.sendEvent({ eventName: 'tx_received_confirmed', eventCount: 1 }) + Countly.sendEvent({ + eventName: 'tx_received_confirmed', + eventCount: 1, + }) } } @@ -274,16 +282,30 @@ export const sideEffects = { }) // TODO: This horrible parody of atomic changes should be rewritten in a proper way if ( - twoStringArrayEqual(received, await AsyncStorage.getItem('@receivedTxs').then(JSON.parse)) + twoStringArrayEqual( + received, + await AsyncStorage.getItem('@receivedTxs').then(JSON.parse), + ) ) { await AsyncStorage.setItem('@receivedTxs', JSON.stringify(newReceived)) } if ( - twoStringArrayEqual(finalized, await AsyncStorage.getItem('@finalizedTxs').then(JSON.parse)) + twoStringArrayEqual( + finalized, + await AsyncStorage.getItem('@finalizedTxs').then(JSON.parse), + ) ) { - await AsyncStorage.setItem('@finalizedTxs', JSON.stringify(newFinalized)) + await AsyncStorage.setItem( + '@finalizedTxs', + JSON.stringify(newFinalized), + ) } - if (twoStringArrayEqual(posted, await AsyncStorage.getItem('@postedTxs').then(JSON.parse))) { + if ( + twoStringArrayEqual( + posted, + await AsyncStorage.getItem('@postedTxs').then(JSON.parse), + ) + ) { await AsyncStorage.setItem('@postedTxs', JSON.stringify(newPosted)) } store.dispatch({ @@ -302,7 +324,7 @@ export const sideEffects = { }, ['TX_CANCEL_REQUEST']: (action: txCancelRequestAction, store: Store) => { return GrinBridge.txCancel(getStateForRust(store.getState()), action.id) - .then(list => { + .then((list) => { store.dispatch({ type: 'TX_CANCEL_SUCCESS', }) @@ -318,7 +340,7 @@ export const sideEffects = { refreshFromNode: false, }) }) - .catch(error => { + .catch((error) => { const e = JSON.parse(error.message) store.dispatch({ type: 'TX_CANCEL_FAILURE', @@ -329,16 +351,20 @@ export const sideEffects = { }) }, ['TX_GET_REQUEST']: async (action: txGetRequestAction, store: Store) => { - return GrinBridge.txGet(getStateForRust(store.getState()), true, action.txSlateId) + return GrinBridge.txGet( + getStateForRust(store.getState()), + true, + action.txSlateId, + ) .then((json: string) => JSON.parse(json)) - .then(result => { + .then((result) => { store.dispatch({ type: 'TX_GET_SUCCESS', isRefreshed: result[0], tx: result[1][0], }) }) - .catch(error => { + .catch((error) => { const e = JSON.parse(error.message) store.dispatch({ type: 'TX_GET_FAILURE', @@ -377,7 +403,7 @@ export const sideEffects = { refreshFromNode: false, }) }) - .catch(error => { + .catch((error) => { const e = JSON.parse(error.message) store.dispatch({ type: 'TX_CREATE_FAILURE', @@ -386,9 +412,14 @@ export const sideEffects = { log(e, true) }) }, - ['TX_SEND_HTTPS_REQUEST']: async (action: txSendHttpsRequestAction, store: Store) => { + ['TX_SEND_HTTPS_REQUEST']: async ( + action: txSendHttpsRequestAction, + store: Store, + ) => { try { - let finalized = await AsyncStorage.getItem('@finalizedTxs').then(JSON.parse) + let finalized = await AsyncStorage.getItem('@finalizedTxs').then( + JSON.parse, + ) if (!finalized) { finalized = [] @@ -422,7 +453,9 @@ export const sideEffects = { }, ['TX_POST_REQUEST']: async (action: txPostRequestAction, store: Store) => { try { - let finalized = await AsyncStorage.getItem('@finalizedTxs').then(JSON.parse) + let finalized = await AsyncStorage.getItem('@finalizedTxs').then( + JSON.parse, + ) if (!finalized) { finalized = [] @@ -434,7 +467,10 @@ export const sideEffects = { posted = [] } - await GrinBridge.txPost(getStateForRust(store.getState()), action.txSlateId) + await GrinBridge.txPost( + getStateForRust(store.getState()), + action.txSlateId, + ) Countly.sendEvent({ eventName: 'tx_sent_unconfirmed', eventCount: 1 }) posted.push(action.txSlateId) let pos = finalized.indexOf(action.txSlateId) @@ -468,7 +504,10 @@ export const sideEffects = { refreshFromNode: false, }) }, - ['TX_RECEIVE_REQUEST']: async (action: txReceiveRequestAction, store: Store) => { + ['TX_RECEIVE_REQUEST']: async ( + action: txReceiveRequestAction, + store: Store, + ) => { try { let received = await AsyncStorage.getItem('@receivedTxs').then(JSON.parse) if (!received) { @@ -510,9 +549,14 @@ export const sideEffects = { log(e, true) } }, - ['TX_FINALIZE_REQUEST']: async (action: txFinalizeRequestAction, store: Store) => { + ['TX_FINALIZE_REQUEST']: async ( + action: txFinalizeRequestAction, + store: Store, + ) => { try { - let finalized = await AsyncStorage.getItem('@finalizedTxs').then(JSON.parse) + let finalized = await AsyncStorage.getItem('@finalizedTxs').then( + JSON.parse, + ) if (!finalized) { finalized = [] @@ -542,7 +586,10 @@ export const sideEffects = { ) !== -1 ) { log( - { message: 'Slate has been already finalized. You only need to confirm it now' }, + { + message: + 'Slate has been already finalized. You only need to confirm it now', + }, true, ) } else { @@ -560,13 +607,13 @@ export const sideEffects = { ['SLATE_SET_REQUEST']: (action: slateSetRequestAction, store: Store) => { const path = getSlatePath(action.slate.id, action.isResponse) return RNFS.writeFile(path, JSON.stringify(action.slate), 'utf8') - .then(success => { + .then((success) => { store.dispatch({ type: 'SLATE_SET_SUCCESS', slate, }) }) - .catch(error => { + .catch((error) => { store.dispatch({ type: 'SLATE_SET_FAILURE', code: 1, @@ -575,17 +622,20 @@ export const sideEffects = { log(error, true) }) }, - ['SLATE_REMOVE_REQUEST']: async (action: slateRemoveRequestAction, store: Store) => { + ['SLATE_REMOVE_REQUEST']: async ( + action: slateRemoveRequestAction, + store: Store, + ) => { const path = getSlatePath(action.id, action.isResponse) if (await RNFS.exists(path)) { return RNFS.unlink(path) - .then(success => { + .then((success) => { store.dispatch({ type: 'SLATE_REMOVE_SUCCESS', }) }) - .catch(error => { + .catch((error) => { store.dispatch({ type: 'SLATE_REMOVE_FAILURE', code: 1, @@ -606,12 +656,12 @@ export const sideEffects = { type: 'application/json', showAppsToView: true, }) - .then(success => { + .then((success) => { store.dispatch({ type: 'SLATE_SHARE_SUCCESS', }) }) - .catch(error => { + .catch((error) => { store.dispatch({ type: 'SLATE_SHARE_FAILURE', code: 1, @@ -623,9 +673,12 @@ export const sideEffects = { action: txFormOutputStrategiesRequestAction, store: Store, ) => { - return GrinBridge.txStrategies(getStateForRust(store.getState()), action.amount) + return GrinBridge.txStrategies( + getStateForRust(store.getState()), + action.amount, + ) .then((json: string) => JSON.parse(json)) - .then(outputStrategies => { + .then((outputStrategies) => { if (!outputStrategies.length) { throw new Error('Not enough funds') } @@ -644,7 +697,10 @@ export const sideEffects = { }, } -const list = function(state: ListState = initialState.list, action): ListState { +const list = function ( + state: ListState = initialState.list, + action, +): ListState { switch (action.type) { case 'TX_LIST_CLEAR': return { ...state, data: [] } @@ -660,7 +716,7 @@ const list = function(state: ListState = initialState.list, action): ListState { case 'TX_LIST_SUCCESS': var txs = action.data.slice(0) - txs.sort(function(a, b) { + txs.sort(function (a, b) { return new Date(b.creation_ts) - new Date(a.creation_ts) }) return { @@ -692,7 +748,10 @@ const list = function(state: ListState = initialState.list, action): ListState { } } -const txCreate = function(state: TxCreateState = initialState.txCreate, action): TxCreateState { +const txCreate = function ( + state: TxCreateState = initialState.txCreate, + action, +): TxCreateState { switch (action.type) { case 'TX_CREATE_REQUEST': return { ...state, inProgress: true, created: false, error: null } @@ -719,7 +778,10 @@ const txCreate = function(state: TxCreateState = initialState.txCreate, action): } } -const txSend = function(state: TxSendState = initialState.txSend, action): TxSendState { +const txSend = function ( + state: TxSendState = initialState.txSend, + action, +): TxSendState { switch (action.type) { case 'TX_SEND_HTTPS_REQUEST': return { ...state, inProgress: true, sent: false, error: null } @@ -746,10 +808,18 @@ const txSend = function(state: TxSendState = initialState.txSend, action): TxSen } } -const txPost = function(state: TxPostState = initialState.txPost, action): TxPostState { +const txPost = function ( + state: TxPostState = initialState.txPost, + action, +): TxPostState { switch (action.type) { case 'TX_POST_SHOW': - return { ...state, txSlateId: action.txSlateId, showModal: true, posted: false } + return { + ...state, + txSlateId: action.txSlateId, + showModal: true, + posted: false, + } case 'TX_POST_CLOSE': return { ...state, txSlateId: null, showModal: false, posted: false } @@ -776,10 +846,18 @@ const txPost = function(state: TxPostState = initialState.txPost, action): TxPos } } -const txGet = function(state: TxGetState = initialState.txGet, action): TxGetState { +const txGet = function ( + state: TxGetState = initialState.txGet, + action, +): TxGetState { switch (action.type) { case 'TX_GET_REQUEST': - return { data: initialState.txGet.data, inProgress: true, isRefreshed: false, error: null } + return { + data: initialState.txGet.data, + inProgress: true, + isRefreshed: false, + error: null, + } case 'TX_GET_SUCCESS': return { @@ -805,7 +883,10 @@ const txGet = function(state: TxGetState = initialState.txGet, action): TxGetSta } } -const txCancel = function(state: TxCancelState = initialState.txCancel, action): TxCancelState { +const txCancel = function ( + state: TxCancelState = initialState.txCancel, + action, +): TxCancelState { switch (action.type) { case 'TX_CANCEL_REQUEST': return { ...state, inProgress: true, error: null } @@ -828,7 +909,10 @@ const txCancel = function(state: TxCancelState = initialState.txCancel, action): } } -const txReceive = function(state: TxReceiveState = initialState.txReceive, action): TxReceiveState { +const txReceive = function ( + state: TxReceiveState = initialState.txReceive, + action, +): TxReceiveState { switch (action.type) { case 'SLATE_GET_SUCCESS': case 'SLATE_LOAD_SUCCESS': @@ -856,7 +940,7 @@ const txReceive = function(state: TxReceiveState = initialState.txReceive, actio } } -const txFinalize = function( +const txFinalize = function ( state: TxFinalizeState = initialState.txFinalize, action, ): TxFinalizeState { @@ -887,7 +971,10 @@ const txFinalize = function( } } -const txForm = function(state: TxForm = initialState.txForm, action: Action): TxForm { +const txForm = function ( + state: TxForm = initialState.txForm, + action: Action, +): TxForm { switch (action.type) { case 'TX_FORM_SET_FROM_LINK': return { @@ -932,9 +1019,11 @@ const txForm = function(state: TxForm = initialState.txForm, action: Action): Tx action.outputStrategies[0].total == action.outputStrategies[1].total ? [action.outputStrategies[0]] : action.outputStrategies - const outputStrategies = strategies.map(mapRustOutputStrategy).sort((a, b) => { - return a.fee - b.fee - }) + const outputStrategies = strategies + .map(mapRustOutputStrategy) + .sort((a, b) => { + return a.fee - b.fee + }) return { ...state, outputStrategies, @@ -954,7 +1043,10 @@ const txForm = function(state: TxForm = initialState.txForm, action: Action): Tx } } -const slate = function(state: SlateState = initialState.slate, action): SlateState { +const slate = function ( + state: SlateState = initialState.slate, + action, +): SlateState { switch (action.type) { case 'SLATE_GET_REQUEST': case 'SLATE_LOAD_REQUEST': @@ -980,7 +1072,7 @@ const slate = function(state: SlateState = initialState.slate, action): SlateSta } } -const slateShare = function( +const slateShare = function ( state: SlateShareState = initialState.slateShare, action, ): SlateShareState { @@ -1010,7 +1102,8 @@ export const isTxFormValid = (txForm: TxForm, transferMethod: string) => { if ( !amount || !outputStrategy || - (transferMethod === HTTP_TRANSPORT_METHOD && url.toLowerCase().indexOf('http') === -1) + (transferMethod === HTTP_TRANSPORT_METHOD && + url.toLowerCase().indexOf('http') === -1) ) { return true } diff --git a/src/modules/wallet.ts b/src/modules/wallet.ts index 695b16d..96a5437 100644 --- a/src/modules/wallet.ts +++ b/src/modules/wallet.ts @@ -136,7 +136,7 @@ const initialState: State = { isCreated: null, } -const walletInit = function( +const walletInit = function ( state: WalletInitState = initialState.walletInit, action: Action, ): WalletInitState { @@ -181,7 +181,7 @@ const walletInit = function( } } -const walletScan = function( +const walletScan = function ( state: WalletScanState = initialState.walletScan, action: Action, ): WalletScanState { @@ -198,7 +198,9 @@ const walletScan = function( case 'WALLET_SCAN_PMMR_RANGE_SUCCESS': return { ...state, - lowestIndex: state.lowestIndex ? state.lowestIndex : action.range.lastRetrievedIndex, + lowestIndex: state.lowestIndex + ? state.lowestIndex + : action.range.lastRetrievedIndex, lastRetrievedIndex: state.lastRetrievedIndex ? state.lastRetrievedIndex : action.range.lastRetrievedIndex, @@ -220,7 +222,10 @@ const walletScan = function( const range = state.highestIndex - state.lowestIndex const progress = action.lastRetrievedIndex - state.lowestIndex - const percentageComplete = Math.min(Math.round((progress / range) * 100), 99) + const percentageComplete = Math.min( + Math.round((progress / range) * 100), + 99, + ) return { ...state, retryCount: 0, @@ -246,7 +251,7 @@ const walletScan = function( } } -const walletPhrase = function( +const walletPhrase = function ( state: WalletPhraseState = initialState.walletPhrase, action: Action, ): WalletPhraseState { @@ -265,7 +270,7 @@ const walletPhrase = function( } } -const password = function( +const password = function ( state: PasswordState = initialState.password, action: Action, ): PasswordState { @@ -318,7 +323,7 @@ const password = function( } export const reducer = combineReducers({ - isCreated: function( + isCreated: function ( state: State['isCreated'] = initialState.isCreated, action: Action, ): boolean | null { @@ -376,10 +381,17 @@ export const sideEffects = { log(error, true) }) }, - ['WALLET_INIT_REQUEST']: async (action: walletInitRequestAction, store: Store) => { + ['WALLET_INIT_REQUEST']: async ( + action: walletInitRequestAction, + store: Store, + ) => { const { password, phrase, isNew } = action await checkWalletDataDirectory() - return GrinBridge.walletInit(getStateForRust(store.getState()), phrase, password) + return GrinBridge.walletInit( + getStateForRust(store.getState()), + phrase, + password, + ) .then(() => { store.dispatch({ type: 'SET_PASSWORD', @@ -423,7 +435,9 @@ export const sideEffects = { try { const range = mapPmmrRange( - JSON.parse(await GrinBridge.walletPmmrRange(getStateForRust(store.getState()))), + JSON.parse( + await GrinBridge.walletPmmrRange(getStateForRust(store.getState())), + ), ) store.dispatch({ type: 'WALLET_SCAN_PMMR_RANGE_SUCCESS', @@ -472,7 +486,11 @@ export const sideEffects = { _action: walletScanOutputsRequestAction, store: Store, ) => { - const { lastRetrievedIndex, highestIndex, lowestIndex } = store.getState().wallet.walletScan + const { + lastRetrievedIndex, + highestIndex, + lowestIndex, + } = store.getState().wallet.walletScan if (!lowestIndex || !highestIndex) { store.dispatch({ @@ -512,7 +530,10 @@ export const sideEffects = { pmmrRangeLastUpdated, } = store.getState().wallet.walletScan - if (!pmmrRangeLastUpdated || Date.now() - pmmrRangeLastUpdated > PMMR_RANGE_UPDATE_INTERVAL) { + if ( + !pmmrRangeLastUpdated || + Date.now() - pmmrRangeLastUpdated > PMMR_RANGE_UPDATE_INTERVAL + ) { store.dispatch({ type: 'WALLET_SCAN_PMMR_RANGE_REQUEST', }) @@ -528,7 +549,10 @@ export const sideEffects = { } } }, - ['WALLET_SCAN_OUTPUTS_FAILURE']: async (action: walletScanOutputsFalureAction, store: Store) => { + ['WALLET_SCAN_OUTPUTS_FAILURE']: async ( + action: walletScanOutputsFalureAction, + store: Store, + ) => { const isPasswordSet = !!store.getState().wallet.password.value if (!isPasswordSet) { @@ -565,8 +589,14 @@ export const sideEffects = { }, 1000) // Time-out to prevent a bruteforce attack) }) }, - ['CHECK_PASSWORD_FROM_BIOMETRY']: (action: checkPasswordFromBiometryAction, store: Store) => { - return GrinBridge.checkPassword(getStateForRust(store.getState()), action.password) + ['CHECK_PASSWORD_FROM_BIOMETRY']: ( + action: checkPasswordFromBiometryAction, + store: Store, + ) => { + return GrinBridge.checkPassword( + getStateForRust(store.getState()), + action.password, + ) .then(() => { store.dispatch({ type: 'SET_PASSWORD', @@ -588,7 +618,10 @@ export const sideEffects = { text: 'Wrong password', }) }, - ['WALLET_PHRASE_REQUEST']: (_action: walletPhraseRequestAction, store: Store) => { + ['WALLET_PHRASE_REQUEST']: ( + _action: walletPhraseRequestAction, + store: Store, + ) => { // return GrinBridge.walletPhrase(getStateForRust(store.getState()), 'her') return GrinBridge.walletPhrase(getStateForRust(store.getState())) .then((phrase: string) => { @@ -605,7 +638,10 @@ export const sideEffects = { log(error, true) }) }, - ['WALLET_DESTROY_REQUEST']: async (_action: walletDestroyRequestAction, store: Store) => { + ['WALLET_DESTROY_REQUEST']: async ( + _action: walletDestroyRequestAction, + store: Store, + ) => { try { await RNFS.unlink(WALLET_DATA_DIRECTORY).then(() => { store.dispatch({ @@ -626,7 +662,10 @@ export const sideEffects = { log(error, true) } }, - ['WALLET_DESTROY_SUCCESS']: (_action: walletDestroySuccessAction, store: Store) => { + ['WALLET_DESTROY_SUCCESS']: ( + _action: walletDestroySuccessAction, + store: Store, + ) => { store.dispatch({ type: 'WALLET_CLEAR', }) @@ -646,7 +685,10 @@ export const sideEffects = { type: 'WALLET_DESTROY_REQUEST', }) }, - ['WALLET_EXISTS_REQUEST']: async (_action: walletDestroySuccessAction, store: Store) => { + ['WALLET_EXISTS_REQUEST']: async ( + _action: walletDestroySuccessAction, + store: Store, + ) => { try { const exists = await isWalletInitialized() store.dispatch({ diff --git a/src/screens/Landing.tsx b/src/screens/Landing.tsx index 3f4f743..cee0c82 100644 --- a/src/screens/Landing.tsx +++ b/src/screens/Landing.tsx @@ -64,20 +64,24 @@ type State = {} class Landing extends Component { _onVersionClick = () => { if (!this.props.isFloonet) { - return Alert.alert('Switch to floonet', 'Are you sure you want to switch to floonet?', [ - { - text: 'Cancel', - onPress: () => console.log('Cancel Pressed'), - style: 'cancel', - }, - { - text: 'Switch', - style: 'destructive', - onPress: () => { - this.props.switchToFloonet() + return Alert.alert( + 'Switch to floonet', + 'Are you sure you want to switch to floonet?', + [ + { + text: 'Cancel', + onPress: () => console.log('Cancel Pressed'), + style: 'cancel', }, - }, - ]) + { + text: 'Switch', + style: 'destructive', + onPress: () => { + this.props.switchToFloonet() + }, + }, + ], + ) } } _onNewWallet = (isNew: boolean) => { @@ -127,7 +131,10 @@ class Landing extends Component { }}> This app is configured to use testnet - switchToMainnet()} /> + switchToMainnet()} + /> )} @@ -140,7 +147,8 @@ class Landing extends Component { }} onPress={this._onVersionClick}> - Version: {DeviceInfo.getVersion()} build {DeviceInfo.getBuildNumber()} + Version: {DeviceInfo.getVersion()} build{' '} + {DeviceInfo.getBuildNumber()} diff --git a/src/screens/LegalDisclaimer.tsx b/src/screens/LegalDisclaimer.tsx index e5319d6..ac29890 100644 --- a/src/screens/LegalDisclaimer.tsx +++ b/src/screens/LegalDisclaimer.tsx @@ -18,7 +18,11 @@ import styled from 'styled-components/native' import CheckBox from 'react-native-check-box' import { Wrapper, Spacer } from 'src/common' import { Text, Link, Button } from 'src/components/CustomFont' -import { Dispatch, State as GlobalState, NavigationProps } from 'src/common/types' +import { + Dispatch, + State as GlobalState, + NavigationProps, +} from 'src/common/types' import { connect } from 'react-redux' interface OwnProps { @@ -54,11 +58,12 @@ const LegalDisclaimer = ({ acceptLegal, navigation, route }: Props) => { . - Please, if you are not familiar with the blockchain technology, learn it first. It is - important, that you know what you are doing! + Please, if you are not familiar with the blockchain technology, learn + it first. It is important, that you know what you are doing! - Then read carefully Terms of Use and Privacy Policy and only then start using the app. + Then read carefully Terms of Use and Privacy Policy and only then + start using the app. { keyboardShouldPersistTaps="handled" keyboardOpeningTime={0} getTextInputRefs={() => [this._confirmPassword]} - innerRef={view => { + innerRef={(view) => { this._scrollView = view }}> @@ -93,11 +93,11 @@ class NewPassword extends Component { returnKeyType={'done'} autoFocus={false} secureTextEntry={true} - getRef={input => { + getRef={(input) => { this._confirmPassword = input }} onChange={setConfirmPassword} - onFocus={e => { + onFocus={(e) => { if (this._scrollView) { setTimeout(() => { if (this._scrollView) { @@ -118,26 +118,30 @@ class NewPassword extends Component { if (newWallet) { navigation.navigate('ShowPaperKey') } else { - Alert.alert('Paper key', 'How many words in your paper key?', [ - { - text: '12', - onPress: () => { - navigation.navigate('VerifyPaperKey', { - title: 'Paper key', - wordsCount: 12, - }) + Alert.alert( + 'Paper key', + 'How many words in your paper key?', + [ + { + text: '12', + onPress: () => { + navigation.navigate('VerifyPaperKey', { + title: 'Paper key', + wordsCount: 12, + }) + }, }, - }, - { - text: '24', - onPress: () => { - navigation.navigate('VerifyPaperKey', { - title: 'Paper key', - wordsCount: 24, - }) + { + text: '24', + onPress: () => { + navigation.navigate('VerifyPaperKey', { + title: 'Paper key', + wordsCount: 24, + }) + }, }, - }, - ]) + ], + ) } }} disabled={!(password && password === confirmPassword)} @@ -159,19 +163,19 @@ const mapStateToProps = (state: ReduxState) => ({ }) const mapDispatchToProps = (dispatch, ownProps) => ({ - setPassword: password => { + setPassword: (password) => { dispatch({ type: 'WALLET_INIT_SET_PASSWORD', password, }) }, - setConfirmPassword: confirmPassword => { + setConfirmPassword: (confirmPassword) => { dispatch({ type: 'WALLET_INIT_SET_CONFIRM_PASSWORD', confirmPassword, }) }, - setIsNew: value => { + setIsNew: (value) => { dispatch({ type: 'WALLET_INIT_SET_IS_NEW', value, diff --git a/src/screens/Overview.tsx b/src/screens/Overview.tsx index bfc4d04..fe700fe 100644 --- a/src/screens/Overview.tsx +++ b/src/screens/Overview.tsx @@ -13,7 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. import React, { Component } from 'react' -import { Alert, TouchableHighlight, TouchableOpacity, RefreshControl, View } from 'react-native' +import { + Alert, + TouchableHighlight, + TouchableOpacity, + RefreshControl, + View, +} from 'react-native' import { connect } from 'react-redux' import styled from 'styled-components/native' import { SwipeListView, SwipeRow } from 'react-native-swipe-list-view' @@ -25,7 +31,11 @@ import { isIphoneX } from 'react-native-iphone-x-helper' import { BIOMETRY_STATUS } from 'src/modules/settings' import FeatherIcon from 'react-native-vector-icons/Feather' import { State as CurrencyRatesState } from 'src/modules/currency-rates' -import { Balance as BalanceType, State as GlobalState, Tx } from 'src/common/types' +import { + Balance as BalanceType, + State as GlobalState, + Tx, +} from 'src/common/types' import colors from 'src/common/colors' import { getBiometryTitle, ListItemSeparator } from 'src/common' import { WalletInitState } from 'src/modules/wallet' @@ -66,7 +76,7 @@ const ActionButton = styled.TouchableOpacity` justify-content: center; align-items: center; flex-direction: row; - opacity: ${props => (props.disabled ? '0.3' : '1')}; + opacity: ${(props) => (props.disabled ? '0.3' : '1')}; flex: 1; ` const ActionButtonText = styled(Text)` @@ -100,7 +110,10 @@ class Overview extends Component { const { settings, route } = this.props this.props.txsGet(false, false) - if (settings.biometryType && settings.biometryStatus === BIOMETRY_STATUS.unknown) { + if ( + settings.biometryType && + settings.biometryStatus === BIOMETRY_STATUS.unknown + ) { const biometryName = getBiometryTitle(settings.biometryType) biometryName && Alert.alert( @@ -154,8 +167,12 @@ class Overview extends Component { data={txs} ListEmptyComponent={ - {(firstLoading && Loading...) || ( - Here you will see your transactions, when you've made them! + {(firstLoading && ( + Loading... + )) || ( + + Here you will see your transactions, when you've made them! + )} } @@ -169,7 +186,9 @@ class Overview extends Component { + disableLeftSwipe={ + data.item.confirmed || data.item.type === 'TxPosted' + }> { height: '100%', justifyContent: 'center', }} - onPress={_ => txCancel(data.item.id, data.item.slateId, !data.item.storedTx)}> + onPress={(_) => + txCancel( + data.item.id, + data.item.slateId, + !data.item.storedTx, + ) + }> { { + onPress={(_) => { if (data.item.confirmed || data.item.type === 'TxPosted') { navigation.navigate('TxDetails', { txId: data.item.id, @@ -226,7 +251,7 @@ class Overview extends Component { contentContainerStyle={{ backgroundColor: '#fff', }} - keyExtractor={item => `${item.id}`} + keyExtractor={(item) => `${item.id}`} refreshControl={ ({ type: 'TX_FORM_RESET', }) }, - txConfirm: txSlateId => { + txConfirm: (txSlateId) => { dispatch({ type: 'TX_POST_SHOW', txSlateId, diff --git a/src/screens/PaperKey/Show.tsx b/src/screens/PaperKey/Show.tsx index 22785df..13b10a8 100644 --- a/src/screens/PaperKey/Show.tsx +++ b/src/screens/PaperKey/Show.tsx @@ -76,8 +76,8 @@ class Show extends Component { - Your paper key is the only way to restore your Grin wallet if your phone is lost, - stolen, broken, or upgraded. + Your paper key is the only way to restore your Grin wallet if your + phone is lost, stolen, broken, or upgraded. {!fromSettings && ' It consists of 24 words. Please write them down on a piece of paper and keep safe.'} @@ -124,7 +124,7 @@ const mapStateToProps = (state: ReduxState) => ({ }) // const mapDispatchToProps = (dispatch, ownProps) => ({ - generateSeed: length => { + generateSeed: (length) => { dispatch({ type: 'SEED_NEW_REQUEST', length, diff --git a/src/screens/PaperKey/Verify.tsx b/src/screens/PaperKey/Verify.tsx index e0917eb..afa3c2e 100644 --- a/src/screens/PaperKey/Verify.tsx +++ b/src/screens/PaperKey/Verify.tsx @@ -74,7 +74,7 @@ class Verify extends Component { // } // } - _onContinuePress = currentUserPhrase => { + _onContinuePress = (currentUserPhrase) => { return () => { const { isNew, password, createWallet } = this.props @@ -122,10 +122,13 @@ class Verify extends Component { render() { const { mnemonic, isNew } = this.props const { mnemonicWords, wordsCount } = this.state - const currentUserPhrase = mnemonicWords.map(w => w.toLowerCase()).join(' ') + const currentUserPhrase = mnemonicWords + .map((w) => w.toLowerCase()) + .join(' ') const verified = isNew ? mnemonic === currentUserPhrase - : mnemonicWords.reduce((acc, w) => acc + (w.length ? 1 : 0), 0) === wordsCount + : mnemonicWords.reduce((acc, w) => acc + (w.length ? 1 : 0), 0) === + wordsCount return ( {(wordsCount && ( @@ -138,7 +141,7 @@ class Verify extends Component { (this._scrollView = sv)} + innerRef={(sv) => (this._scrollView = sv)} style={{ paddingLeft: 16, paddingRight: 16, @@ -152,7 +155,7 @@ class Verify extends Component { return ( { + getRef={(input) => { this._inputs[i] = input }} testID={`VerifyWord${i + 1}`} @@ -170,7 +173,7 @@ class Verify extends Component { }, 100) } }} - onChange={value => { + onChange={(value) => { this.setState({ mnemonicWords: mnemonicWords.map((w, j) => { if (j === i) { diff --git a/src/screens/Password.tsx b/src/screens/Password.tsx index 034ea7d..b913a53 100644 --- a/src/screens/Password.tsx +++ b/src/screens/Password.tsx @@ -112,20 +112,24 @@ class Password extends Component { ) } _onDestroy = () => { - Alert.alert('Destroy the wallet', 'This action would remove all of your data!', [ - { - text: 'Cancel', - onPress: () => console.log('Cancel Pressed'), - style: 'cancel', - }, - { - text: 'Destroy', - style: 'destructive', - onPress: () => { - this.props.destroyWallet() + Alert.alert( + 'Destroy the wallet', + 'This action would remove all of your data!', + [ + { + text: 'Cancel', + onPress: () => console.log('Cancel Pressed'), + style: 'cancel', }, - }, - ]) + { + text: 'Destroy', + style: 'destructive', + onPress: () => { + this.props.destroyWallet() + }, + }, + ], + ) } render() { @@ -162,7 +166,7 @@ class Password extends Component { { + onChange={(password) => { setPassword(password) }} value={password} @@ -173,7 +177,9 @@ class Password extends Component { { diff --git a/src/screens/Receive.tsx b/src/screens/Receive.tsx index b26eff3..6a48638 100644 --- a/src/screens/Receive.tsx +++ b/src/screens/Receive.tsx @@ -18,7 +18,14 @@ import { connect } from 'react-redux' import styled from 'styled-components/native' import Header from 'src/components/Header' import { Text, Button } from 'src/components/CustomFont' -import { isAndroid, LoaderView, TextareaTitle, Textarea, hrGrin, Spacer } from 'src/common' +import { + isAndroid, + LoaderView, + TextareaTitle, + Textarea, + hrGrin, + Spacer, +} from 'src/common' import colors from 'src/common/colors' import { State as GlobalState, Navigation, Slate } from 'src/common/types' //Images import { NavigationProps } from 'src/common/types' @@ -102,7 +109,7 @@ const mapStateToProps = (state: GlobalState) => { } const mapDispatchToProps = (dispatch, ownProps) => ({ - txReceive: slatePath => { + txReceive: (slatePath) => { dispatch({ type: 'TX_RECEIVE_REQUEST', slatePath, diff --git a/src/screens/ReceiveGuide.tsx b/src/screens/ReceiveGuide.tsx index 44d97a4..44e982d 100644 --- a/src/screens/ReceiveGuide.tsx +++ b/src/screens/ReceiveGuide.tsx @@ -14,7 +14,9 @@ // limitations under the License. import React, { Component } from 'react' import { ScrollView, StyleSheet } from 'react-native' -import Markdown, { styles as markdownDefaultStyles } from 'react-native-markdown-renderer' +import Markdown, { + styles as markdownDefaultStyles, +} from 'react-native-markdown-renderer' import { NavigationProps } from 'src/common/types' interface OwnProps {} @@ -50,7 +52,9 @@ class ReceiveGuide extends Component { }} testID="ReceiveFromAnotherPersonGuide" showsVerticalScrollIndicator={true}> - {this.props.route.params?.guide} + + {this.props.route.params?.guide} + ) } diff --git a/src/screens/ReceiveInfo.tsx b/src/screens/ReceiveInfo.tsx index d395f6b..126468c 100644 --- a/src/screens/ReceiveInfo.tsx +++ b/src/screens/ReceiveInfo.tsx @@ -14,9 +14,16 @@ // limitations under the License. import React, { Component, Fragment } from 'react' import { FlatList } from 'react-native' -import SettingsListItem, { Props as SettingsItem } from 'src/components/SettingsListItem' +import SettingsListItem, { + Props as SettingsItem, +} from 'src/components/SettingsListItem' import { connect } from 'react-redux' -import { Dispatch, State as GlobalState, Navigation, Slate } from 'src/common/types' +import { + Dispatch, + State as GlobalState, + Navigation, + Slate, +} from 'src/common/types' import { Text } from 'src/components/CustomFont' import { Spacer } from 'src/common' import styled from 'styled-components/native' @@ -62,20 +69,27 @@ class Receive extends Component { - Grin is different from the other blockchains: to transfer funds both a sender and a - receiver need to interact. + Grin is different from the other blockchains: to transfer funds both + a sender and a receiver need to interact. - Ironbelly at the moment supports only receiving Grin via file. + + Ironbelly at the moment supports only receiving Grin via file. + - Below you can find some guides on how to receive Grin from different sources + + Below you can find some guides on how to receive Grin from different + sources + } + renderItem={({ item }: { item: SettingsItem }) => ( + + )} /> ) diff --git a/src/screens/ScanQRCode.tsx b/src/screens/ScanQRCode.tsx index 6492444..deeabb9 100644 --- a/src/screens/ScanQRCode.tsx +++ b/src/screens/ScanQRCode.tsx @@ -23,7 +23,7 @@ import urlParser from 'url' import styled from 'styled-components/native' import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons' import Ionicons from 'react-native-vector-icons/Ionicons' -import Torch from 'react-native-torch' +// import Torch from 'react-native-torch' type Props = { navigation: Navigation setFromLink: (amount: number, message: string, url: string) => void @@ -58,7 +58,7 @@ class ScanQRCode extends Component { torch: false, } qrCodeProcessing = false - _onScanQRCode = url => { + _onScanQRCode = (url) => { this.qrCodeProcessing = true const { setFromLink, setHttpAddress } = this.props const link = urlParser.parse(url, true) @@ -99,7 +99,7 @@ class ScanQRCode extends Component { async componentWillUnmount(prevProps: Props) { try { - await Torch.switchState(false) + // await Torch.switchState(false) } catch (e) { console.log(e) } @@ -143,7 +143,7 @@ class ScanQRCode extends Component { }) try { - await Torch.switchState(!torch) + // await Torch.switchState(!torch) } catch (e) { console.log(e) } @@ -173,7 +173,7 @@ const mapDispatchToProps = (dispatch, ownProps) => ({ message, url, }), - setHttpAddress: url => + setHttpAddress: (url) => dispatch({ type: 'TX_FORM_SET_URL', url, diff --git a/src/screens/Send.tsx b/src/screens/Send.tsx index b5ad8a1..12dc2c4 100644 --- a/src/screens/Send.tsx +++ b/src/screens/Send.tsx @@ -63,7 +63,7 @@ const TransportMethod = styled.TouchableOpacity` ` const TransportMethodTitle = styled.Text` font-size: 24; - color: ${props => (props.active ? colors.black : colors.grey[700])}; + color: ${(props) => (props.active ? colors.black : colors.grey[700])}; ` const AlternativeAmount = styled.Text` color: ${colors.grey[700]}; @@ -98,17 +98,17 @@ const Option = styled.TouchableOpacity` flex-direction: row; padding: 0 0 16px 0; ` -const OptioIcon = styled(FeatherIcon).attrs(props => ({ +const OptioIcon = styled(FeatherIcon).attrs((props) => ({ name: props.active ? 'check-circle' : 'circle', size: 16, }))` margin-right: 8px; - color: ${props => (props.active ? colors.black : colors.grey[700])}; + color: ${(props) => (props.active ? colors.black : colors.grey[700])}; ` const Fee = styled.Text` font-weight: 600; font-size: 24; - color: ${props => (props.active ? colors.black : colors.grey[700])}; + color: ${(props) => (props.active ? colors.black : colors.grey[700])}; ` const Locked = styled.Text` font-size: 13; @@ -251,11 +251,13 @@ const Send = ({ {hrGrin(os.fee)} {balance.amountCurrentlySpendable === os.total ? ( - All the funds would be locked for around {minimumConfirmations} min. + All the funds would be locked for around{' '} + {minimumConfirmations} min. ) : ( - {hrGrin(os.total)} would be locked for around {minimumConfirmations} min. + {hrGrin(os.total)} would be locked for around{' '} + {minimumConfirmations} min. )} @@ -273,8 +275,11 @@ const Send = ({ flexDirection: 'row', }} onPress={() => setTransportMethod(FILE_TRANSPORT_METHOD)}> - - + + File @@ -283,8 +288,11 @@ const Send = ({ flexDirection: 'row', }} onPress={() => setTransportMethod(HTTP_TRANSPORT_METHOD)}> - - + + HTTP(S) @@ -299,7 +307,7 @@ const Send = ({ }}> setUrl(url)} + onChange={(url) => setUrl(url)} value={url} placeholder="http(s)://" textContentType={'URL'} @@ -308,7 +316,8 @@ const Send = ({ multiline={true} /> {false && !url && ( - navigation.navigate('ScanQRCode')}> + navigation.navigate('ScanQRCode')}> )} @@ -357,19 +366,19 @@ const mapDispatchToProps = (dispatch, ownProps) => ({ textAmount, }) }, - getOutputStrategies: debounce(amount => { + getOutputStrategies: debounce((amount) => { dispatch({ type: 'TX_FORM_OUTPUT_STRATEGIES_REQUEST', amount, }) }, 500), - resetOutputStrategies: debounce(amount => { + resetOutputStrategies: debounce((amount) => { dispatch({ type: 'TX_FORM_OUTPUT_STRATEGIES_SUCCESS', outputStrategies: [], }) }, 100), - setOutputStrategy: outputStrategy => { + setOutputStrategy: (outputStrategy) => { dispatch({ type: 'TX_FORM_SET_OUTPUT_STRATEGY', outputStrategy, diff --git a/src/screens/Settings.tsx b/src/screens/Settings.tsx index a64387d..ac52624 100644 --- a/src/screens/Settings.tsx +++ b/src/screens/Settings.tsx @@ -18,7 +18,9 @@ import DeviceInfo from 'react-native-device-info' import NetInfo from '@react-native-community/netinfo' import { connect } from 'react-redux' import styled from 'styled-components/native' -import SettingsListItem, { Props as SettingsItem } from 'src/components/SettingsListItem' +import SettingsListItem, { + Props as SettingsItem, +} from 'src/components/SettingsListItem' import { State as ReduxState, Error, Navigation } from 'src/common/types' import colors from 'src/common/colors' import { State as SettingsState, BIOMETRY_STATUS } from 'src/modules/settings' @@ -54,20 +56,24 @@ class Settings extends Component { state = {} _onMigrateToMainnet = () => { - return Alert.alert('Switch to Mainnet', 'This would destroy your floonet wallet!', [ - { - text: 'Cancel', - onPress: () => console.log('Cancel Pressed'), - style: 'cancel', - }, - { - text: 'Switch', - style: 'destructive', - onPress: () => { - this.props.migrateToMainnet() + return Alert.alert( + 'Switch to Mainnet', + 'This would destroy your floonet wallet!', + [ + { + text: 'Cancel', + onPress: () => console.log('Cancel Pressed'), + style: 'cancel', }, - }, - ]) + { + text: 'Switch', + style: 'destructive', + onPress: () => { + this.props.migrateToMainnet() + }, + }, + ], + ) } _onDestroyWallet = () => { return Alert.alert( @@ -101,12 +107,16 @@ class Settings extends Component { "This action would check a wallet's outputs against a live node, repair and restore missing outputs if required" NetInfo.fetch().then(({ type }) => { if (type === 'none') { - Alert.alert('Device is offline', 'Wallet recovery requires connection to the internet!', [ - { - text: 'Ok', - onPress: () => {}, - }, - ]) + Alert.alert( + 'Device is offline', + 'Wallet recovery requires connection to the internet!', + [ + { + text: 'Ok', + onPress: () => {}, + }, + ], + ) return } @@ -232,7 +242,9 @@ class Settings extends Component { paddingLeft: 16, }} data={listData} - renderItem={({ item }: { item: SettingsItem }) => } + renderItem={({ item }: { item: SettingsItem }) => ( + + )} /> Version: {DeviceInfo.getVersion()} build {DeviceInfo.getBuildNumber()} diff --git a/src/screens/Settings/Currency.tsx b/src/screens/Settings/Currency.tsx index ed61a49..eeb4a79 100644 --- a/src/screens/Settings/Currency.tsx +++ b/src/screens/Settings/Currency.tsx @@ -74,8 +74,10 @@ class CurrencyList extends Component { filteredList: currencyList, } onSearch = (searchText: string) => { - const filteredList = currencyList.filter(currency => { - return currency.code.toLowerCase().indexOf(searchText.toLowerCase()) !== -1 + const filteredList = currencyList.filter((currency) => { + return ( + currency.code.toLowerCase().indexOf(searchText.toLowerCase()) !== -1 + ) }) this.setState({ searchText, @@ -112,7 +114,7 @@ class CurrencyList extends Component { contentContainerStyle={{}} ItemSeparatorComponent={ListItemSeparator} data={this.state.filteredList} - keyExtractor={item => item.code} + keyExtractor={(item) => item.code} keyboardShouldPersistTaps={'handled'} onRefresh={() => this.props.requestCurrencyRates()} renderItem={({ item }: { item: Currency }) => ( @@ -136,7 +138,7 @@ const mapStateToProps = (state: ReduxState) => ({ }) const mapDispatchToProps = (dispatch, ownProps) => ({ - setCurrency: currencyObject => { + setCurrency: (currencyObject) => { dispatch({ type: 'SET_SETTINGS', newSettings: { diff --git a/src/screens/Settings/GrinNode.tsx b/src/screens/Settings/GrinNode.tsx index 6b67dab..cf066de 100644 --- a/src/screens/Settings/GrinNode.tsx +++ b/src/screens/Settings/GrinNode.tsx @@ -79,7 +79,7 @@ class GrinNode extends Component { setNodeUrl(nodeUrl)} + onChange={(nodeUrl) => setNodeUrl(nodeUrl)} value={nodeUrl} placeholder="URL" autoCorrect={false} @@ -88,7 +88,7 @@ class GrinNode extends Component { + onChange={(apiSecret) => this.setState({ apiSecret, }) diff --git a/src/screens/TxDetails.tsx b/src/screens/TxDetails.tsx index a7f96b7..43f4f43 100644 --- a/src/screens/TxDetails.tsx +++ b/src/screens/TxDetails.tsx @@ -67,7 +67,7 @@ const TxDetails = ({ tx, navigation }: Props) => { const mapStateToProps = (state: ReduxState, ownProps: Props) => () => { return { settings: state.settings, - tx: state.tx.list.data.find(tx => tx.id === ownProps.route.params.txId), + tx: state.tx.list.data.find((tx) => tx.id === ownProps.route.params.txId), } } diff --git a/yarn.lock b/yarn.lock index db3a666..eaa4fca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6907,11 +6907,6 @@ react-native-swipe-list-view@^2.3.0: resolved "https://registry.yarnpkg.com/react-native-swipe-list-view/-/react-native-swipe-list-view-2.5.0.tgz#4740f595aa3253ccd2c8e44131f83bc957f57ddb" integrity sha512-HTsVaxA3an6myShlLroTyDZo/AOrZ6HJr+EwCaGRE2YuGdM/cFHoYfsuslOEEig5GenTw8DILUB8kqYWQ5lJtA== -react-native-torch@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/react-native-torch/-/react-native-torch-1.1.5.tgz#165a8b22b66c2b55e188d38604318712282ca0cf" - integrity sha512-o6L/HBb9MhDF59ite09RSDmdZSlgrM8ARPPV236Insg8Tt6Qw+sqnojDdXbPYbg0ZjmPZ9KMe6JAlCq+v/dAvg== - react-native-touch-id@^4.4.1: version "4.4.1" resolved "https://registry.yarnpkg.com/react-native-touch-id/-/react-native-touch-id-4.4.1.tgz#8b1bb2d04c30bac36bb9696d2d723e719c4a8b08"