Skip to content

Commit 03a6a77

Browse files
committed
fix: lint errors
1 parent 7ee0152 commit 03a6a77

File tree

7 files changed

+38
-50
lines changed

7 files changed

+38
-50
lines changed

src/screens/Settings/CoinSelectPreference/index.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ import React, { memo, ReactElement, useCallback, useMemo } from 'react';
22
import { useTranslation } from 'react-i18next';
33
import { useAppDispatch, useAppSelector } from '../../../hooks/redux';
44

5+
import { ECoinSelectPreference } from 'beignet';
56
import { EItemType, IListData } from '../../../components/List';
6-
import { updateSettings } from '../../../store/slices/settings';
77
import {
88
coinSelectAutoSelector,
99
coinSelectPreferenceSelector,
1010
} from '../../../store/reselect/settings';
11-
import { ECoinSelectPreference } from "beignet";
12-
import { updateCoinSelectPreference } from "../../../utils/settings";
11+
import { updateSettings } from '../../../store/slices/settings';
12+
import { updateCoinSelectPreference } from '../../../utils/settings';
13+
import { getOnChainWalletAsync } from '../../../utils/wallet';
1314
import SettingsView from '../SettingsView';
14-
import { getOnChainWalletAsync } from "../../../utils/wallet";
1515

1616
const CoinSelectSettings = (): ReactElement => {
1717
const { t } = useTranslation('settings');
@@ -32,7 +32,9 @@ const CoinSelectSettings = (): ReactElement => {
3232
// Update the coin selection preference in beignet.
3333
const wallet = await getOnChainWalletAsync();
3434
// Set beignet to consolidate if manual coin control is enabled in Bitkit.
35-
wallet.updateCoinSelectPreference(ECoinSelectPreference.consolidate);
35+
wallet.updateCoinSelectPreference(
36+
ECoinSelectPreference.consolidate,
37+
);
3638
dispatch(updateSettings({ coinSelectAuto: false }));
3739
},
3840
},
@@ -85,7 +87,8 @@ const CoinSelectSettings = (): ReactElement => {
8587
{
8688
title: t('adv.cs_first_in_first_out'),
8789
description: t('adv.cs_first_in_first_out_description'),
88-
value: coinSelectPreference === ECoinSelectPreference.firstInFirstOut,
90+
value:
91+
coinSelectPreference === ECoinSelectPreference.firstInFirstOut,
8992
type: EItemType.button,
9093
hide: !selectedAutoPilot,
9194
onPress: (): void => {
@@ -95,7 +98,8 @@ const CoinSelectSettings = (): ReactElement => {
9598
{
9699
title: t('adv.cs_last_in_last_out'),
97100
description: t('adv.cs_last_in_last_out_description'),
98-
value: coinSelectPreference === ECoinSelectPreference.lastInFirstOut,
101+
value:
102+
coinSelectPreference === ECoinSelectPreference.lastInFirstOut,
99103
type: EItemType.button,
100104
hide: !selectedAutoPilot,
101105
onPress: (): void => {

src/store/reselect/settings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { createSelector } from '@reduxjs/toolkit';
22

3+
import { ECoinSelectPreference } from 'beignet';
34
import { RootState } from '..';
45
import themes, { IThemeColors } from '../../styles/themes';
56
import { TSettings } from '../slices/settings';
67
import {
78
ETransactionSpeed,
89
ICustomElectrumPeer,
9-
TCoinSelectPreference,
1010
TCustomElectrumPeers,
1111
TReceiveOption,
1212
TTheme,
@@ -63,7 +63,7 @@ export const pinOnIdleSelector = (state: RootState): boolean => {
6363
};
6464
export const coinSelectPreferenceSelector = (
6565
state: RootState,
66-
): TCoinSelectPreference => {
66+
): ECoinSelectPreference => {
6767
return state.settings.coinSelectPreference;
6868
};
6969
export const rapidGossipSyncUrlSelector = (state: RootState): string => {

src/store/types/settings.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export enum ETransactionSpeed {
1717
custom = 'custom',
1818
}
1919

20-
2120
export interface ICustomElectrumPeer {
2221
host: string;
2322
ssl: number; //ssl port

src/utils/helpers.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,7 @@ import isPlainObject from 'lodash/isPlainObject';
55
import keys from 'lodash/keys';
66
import { Linking, Vibration } from 'react-native';
77
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
8-
9-
import { TServer } from 'beignet';
10-
import {
11-
TLastUsedTags,
12-
TPendingInvoice,
13-
TSlashTagsUrls,
14-
TTags,
15-
TTxComments,
16-
} from '../store/types/metadata';
17-
import {
18-
ETransactionSpeed,
19-
TChest,
20-
TCoinSelectPreference,
21-
TReceiveOption,
22-
TTheme,
23-
} from '../store/types/settings';
24-
import { EDenomination, EUnit } from '../store/types/wallet';
25-
import { TWidgets } from '../store/types/widgets';
268
import { i18nTime } from '../utils/i18n';
27-
import { EAvailableNetwork } from './networks';
289

2910
/**
3011
* Returns the result of a promise, or an error if the promise takes too long to resolve.

src/utils/settings/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { ECoinSelectPreference } from 'beignet';
12
import { PIN_ATTEMPTS } from '../../constants/app';
23
import { dispatch } from '../../store/helpers';
34
import { updateSettings } from '../../store/slices/settings';
45
import { resetKeychainValue, setKeychainValue } from '../keychain';
5-
import { ECoinSelectPreference } from "beignet";
6-
import { getOnChainWalletAsync } from "../wallet";
6+
import { getOnChainWalletAsync } from '../wallet';
77

88
/**
99
* @async
@@ -50,9 +50,11 @@ export const removePin = async (): Promise<void> => {
5050
};
5151

5252
export const updateCoinSelectPreference = async (
53-
preference: ECoinSelectPreference
53+
preference: ECoinSelectPreference,
5454
): Promise<void> => {
5555
const wallet = await getOnChainWalletAsync();
5656
wallet.updateCoinSelectPreference(preference);
57-
dispatch(updateSettings({ coinSelectAuto: true, coinSelectPreference: preference }));
58-
}
57+
dispatch(
58+
updateSettings({ coinSelectAuto: true, coinSelectPreference: preference }),
59+
);
60+
};

src/utils/wallet/index.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Result, err, ok } from '@synonymdev/result';
66
import {
77
EAddressType,
88
EAvailableNetworks,
9+
ECoinSelectPreference,
910
EElectrumNetworks,
1011
IAddress,
1112
ICustomGetAddress,
@@ -28,7 +29,6 @@ import {
2829
TServer,
2930
TTransactionMessage,
3031
Wallet,
31-
ECoinSelectPreference
3232
} from 'beignet';
3333
import type { Electrum } from 'beignet/dist/types/electrum';
3434
import type { Transaction } from 'beignet/dist/types/transaction';
@@ -1114,11 +1114,7 @@ export const setupOnChainWallet = async ({
11141114
};
11151115
}
11161116
updateExchangeRates();
1117-
const {
1118-
coinSelectAuto,
1119-
coinSelectPreference,
1120-
rbf
1121-
} = getSettingsStore();
1117+
const { coinSelectAuto, coinSelectPreference, rbf } = getSettingsStore();
11221118
const createWalletResponse = await Wallet.create({
11231119
rbf,
11241120
name,
@@ -1138,7 +1134,9 @@ export const setupOnChainWallet = async ({
11381134
customGetScriptHash: getCustomScriptHash,
11391135
disableMessagesOnCreate,
11401136
addressTypesToMonitor,
1141-
coinSelectPreference: coinSelectAuto ? coinSelectPreference : ECoinSelectPreference.consolidate // Use consolidate if manual coin control is enabled.
1137+
coinSelectPreference: coinSelectAuto
1138+
? coinSelectPreference
1139+
: ECoinSelectPreference.consolidate, // Use consolidate if manual coin control is enabled.
11421140
});
11431141
if (createWalletResponse.isErr()) {
11441142
return err(createWalletResponse.error.message);

src/utils/wallet/transactions.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ import {
2222
} from '../../store/helpers';
2323
import { removeActivityItem } from '../../store/slices/activity';
2424
import { requireBackup } from '../../store/slices/backup';
25-
import {
26-
ETransactionSpeed,
27-
} from '../../store/types/settings';
25+
import { ETransactionSpeed } from '../../store/types/settings';
2826
import { TWalletName } from '../../store/types/wallet';
2927
import { EBackupCategory } from '../../store/utils/backup';
3028
import { reduceValue } from '../helpers';
@@ -96,22 +94,28 @@ export const createTransaction = async (
9694
}
9795
};
9896

99-
export const autoCoinSelect = async (txData: ISendTransaction): Promise<Result<ICoinSelectResponse>> => {
97+
export const autoCoinSelect = async (
98+
txData: ISendTransaction,
99+
): Promise<Result<ICoinSelectResponse>> => {
100100
const transaction = await getOnChainWalletTransactionAsync();
101-
const { coinSelectAuto, coinSelectPreference} = getSettingsStore();
101+
const { coinSelectAuto, coinSelectPreference } = getSettingsStore();
102102
return await transaction.autoCoinSelect({
103103
inputs: txData.inputs,
104104
outputs: txData.outputs,
105105
satsPerByte: txData.satsPerByte,
106106
message: txData.message,
107-
coinSelectPreference: coinSelectAuto ? coinSelectPreference : ECoinSelectPreference.consolidate,
107+
coinSelectPreference: coinSelectAuto
108+
? coinSelectPreference
109+
: ECoinSelectPreference.consolidate,
108110
});
109-
}
111+
};
110112

111-
export const applyAutoCoinSelect = async (coinSelectRes: ICoinSelectResponse): Promise<Result<ISendTransaction>> => {
113+
export const applyAutoCoinSelect = async (
114+
coinSelectRes: ICoinSelectResponse,
115+
): Promise<Result<ISendTransaction>> => {
112116
const transaction = await getOnChainWalletTransactionAsync();
113117
return await transaction.applyAutoCoinSelect({ coinSelectRes });
114-
}
118+
};
115119

116120
/**
117121
* Returns onchain transaction data related to the specified network and wallet.

0 commit comments

Comments
 (0)