Skip to content

Commit a618aa5

Browse files
committed
[DDW-1076] Clean up logs
1 parent 2a0ab53 commit a618aa5

File tree

7 files changed

+11
-87
lines changed

7 files changed

+11
-87
lines changed

source/renderer/app/components/wallet/WalletSendForm.tsx

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ export interface FormData {
7575
adaAmount: number;
7676
}
7777

78+
export type ConfirmationDialogData = Omit<FormData, 'coinSelection'>;
79+
7880
type Props = {
7981
currencyMaxIntegerDigits: number;
8082
currencyMaxFractionalDigits: number;
@@ -109,7 +111,7 @@ type Props = {
109111
walletName: string;
110112
onTokenPickerDialogOpen: (...args: Array<any>) => any;
111113
onTokenPickerDialogClose: (...args: Array<any>) => any;
112-
confirmationDialogData?: FormData;
114+
confirmationDialogData?: ConfirmationDialogData;
113115
validationDebounceWait?: number;
114116
};
115117

@@ -140,10 +142,6 @@ type State = {
140142
hasPendingRequestTokens: boolean;
141143
adaInputState: AdaInputState;
142144
coinSelection?: CoinSelectionsResponse;
143-
coinSelections?: Array<{
144-
adaAmount: number;
145-
coinSelection: CoinSelectionsResponse;
146-
}>;
147145
adaAmount: number;
148146
};
149147

@@ -178,7 +176,6 @@ class WalletSendForm extends Component<Props, State> {
178176
hasPendingRequestTokens: false,
179177
coinSelection: null,
180178
adaAmount: 0,
181-
coinSelections: [],
182179
};
183180
// We need to track the mounted state in order to avoid calling
184181
// setState promise handling code after the component was already unmounted:
@@ -668,10 +665,6 @@ class WalletSendForm extends Component<Props, State> {
668665
adaInputState: this.state.adaInputState,
669666
coinSelection,
670667
adaAmount,
671-
coinSelections: [
672-
...this.state.coinSelections,
673-
{ adaAmount, coinSelection },
674-
],
675668
};
676669

677670
if (shouldUpdateMinimumAdaAmount) {
@@ -1349,39 +1342,6 @@ class WalletSendForm extends Component<Props, State> {
13491342
</div>
13501343
</BorderedBox>
13511344
)}
1352-
{this.state.coinSelections.map((c, idx) => (
1353-
<div
1354-
style={{
1355-
margin: '20px',
1356-
border: '1px dashed #333',
1357-
}}
1358-
key={idx}
1359-
>
1360-
<b>ada amount: {c.adaAmount}</b>
1361-
<br />
1362-
<b>inputs:</b>
1363-
<p
1364-
style={{
1365-
whiteSpace: 'break-spaces',
1366-
lineHeight: '20px',
1367-
fontSize: '14px',
1368-
}}
1369-
>
1370-
{JSON.stringify(c.coinSelection.inputs, null, 2)}
1371-
</p>
1372-
<b>outputs:</b>
1373-
<p
1374-
style={{
1375-
whiteSpace: 'break-spaces',
1376-
lineHeight: '20px',
1377-
fontSize: '14px',
1378-
}}
1379-
>
1380-
{JSON.stringify(c.coinSelection.outputs, null, 2)}
1381-
</p>
1382-
</div>
1383-
))}
1384-
13851345
{isDialogOpen(WalletSendConfirmationDialogView) &&
13861346
confirmationDialogData ? (
13871347
<WalletSendConfirmationDialogContainer
@@ -1401,8 +1361,6 @@ class WalletSendForm extends Component<Props, State> {
14011361
formattedTotalAmount={confirmationDialogData.totalAmount.toFormat(
14021362
currencyMaxFractionalDigits
14031363
)}
1404-
adaAmount={confirmationDialogData.adaAmount}
1405-
coinSelection={confirmationDialogData.coinSelection}
14061364
/>
14071365
) : null}
14081366
{isDialogOpen(WalletTokenPicker) && (

source/renderer/app/containers/wallet/WalletSendPage.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from '../../config/numbersConfig';
88
import WalletSendForm, {
99
FormData,
10+
ConfirmationDialogData,
1011
} from '../../components/wallet/WalletSendForm';
1112
import { WalletSendConfirmationDialogView } from './dialogs/send-confirmation/SendConfirmation.view';
1213
import WalletTokenPicker from '../../components/wallet/tokens/wallet-token-picker/WalletTokenPicker';
@@ -18,7 +19,7 @@ import { CoinSelectionsResponse } from '../../api/transactions/types';
1819

1920
type Props = InjectedProps;
2021
type State = {
21-
formData: FormData;
22+
confirmationDialogData: ConfirmationDialogData;
2223
};
2324

2425
@inject('stores', 'actions')
@@ -29,8 +30,8 @@ class WalletSendPage extends Component<Props, State> {
2930
stores: null,
3031
};
3132

32-
state = {
33-
formData: null,
33+
state: State = {
34+
confirmationDialogData: null,
3435
};
3536

3637
calculateTransactionFee = async (params: {
@@ -100,7 +101,7 @@ class WalletSendPage extends Component<Props, State> {
100101
});
101102
}
102103

103-
this.setState({ formData: { ...data, coinSelection } });
104+
this.setState({ confirmationDialogData: { ...data } });
104105
};
105106

106107
openTokenPickerDialog = () => {
@@ -185,7 +186,7 @@ class WalletSendPage extends Component<Props, State> {
185186
walletName={walletName}
186187
onTokenPickerDialogOpen={this.openTokenPickerDialog}
187188
onTokenPickerDialogClose={this.closeTokenPickerDialog}
188-
confirmationDialogData={this.state.formData}
189+
confirmationDialogData={this.state.confirmationDialogData}
189190
/>
190191
);
191192
}

source/renderer/app/containers/wallet/dialogs/send-confirmation/SendConfirmation.container.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ export const Containter = ({
1818
hwDeviceStatus,
1919
isHardwareWallet,
2020
formattedTotalAmount,
21-
adaAmount,
22-
coinSelection,
2321
}: Props) => {
2422
const { isFlight } = global;
2523
const {
@@ -113,8 +111,6 @@ export const Containter = ({
113111
onSubmitCb={onSubmitCb}
114112
onTermsCheckboxClick={onTermsCheckboxClick}
115113
onExternalLinkClick={onExternalLinkClick}
116-
adaAmount={adaAmount}
117-
coinSelection={coinSelection}
118114
/>
119115
);
120116
};

source/renderer/app/containers/wallet/dialogs/send-confirmation/SendConfirmation.view.tsx

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
isPasswordValid,
2424
} from './helpers';
2525
import styles from './styles.scss';
26-
import { toFixedUserFormat } from '../../../../utils/formatters';
2726

2827
const View = ({
2928
intl,
@@ -48,8 +47,6 @@ const View = ({
4847
onSubmitCb,
4948
onTermsCheckboxClick,
5049
onCopyAssetParam,
51-
adaAmount,
52-
coinSelection,
5350
}: Props) => {
5451
const {
5552
passphraseField,
@@ -107,28 +104,6 @@ const View = ({
107104
className={styles.root}
108105
closeButton={<DialogCloseButton />}
109106
>
110-
<b>ada amount: {toFixedUserFormat(adaAmount, 0)} </b>
111-
<br />
112-
<b>inputs:</b>
113-
<p
114-
style={{
115-
whiteSpace: 'break-spaces',
116-
lineHeight: '20px',
117-
fontSize: '14px',
118-
}}
119-
>
120-
{JSON.stringify(coinSelection.inputs, null, 2)}
121-
</p>
122-
<b>outputs:</b>{' '}
123-
<p
124-
style={{
125-
whiteSpace: 'break-spaces',
126-
lineHeight: '20px',
127-
fontSize: '14px',
128-
}}
129-
>
130-
{JSON.stringify(coinSelection.outputs, null, 2)}
131-
</p>
132107
{shouldShowEmptyWalletWarning(
133108
totalAmount,
134109
wallet,

source/renderer/app/containers/wallet/dialogs/send-confirmation/types.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import BigNumber from 'bignumber.js';
22
import { Field } from 'mobx-react-form';
3-
import { CoinSelectionsResponse } from 'source/renderer/app/api/transactions/types';
43
import { Intl } from '../../../../types/i18nTypes';
54
import { StoresMap } from '../../../../stores/index';
65
import { ActionsMap } from '../../../../actions/index';
@@ -19,8 +18,6 @@ type CommonProps = {
1918
totalAmount: BigNumber;
2019
transactionFee: string | null | undefined;
2120
onExternalLinkClick: (...args: Array<any>) => any;
22-
adaAmount?: number;
23-
coinSelection?: CoinSelectionsResponse;
2421
};
2522

2623
export type ContainerProps = CommonProps & {

source/renderer/app/stores/HardwareWalletsStore.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ export default class HardwareWalletsStore extends Store {
644644
},
645645
metadata,
646646
});
647+
this.selectCoinsRequest.reset();
647648
// @ts-ignore ts-migrate(1320) FIXME: Type of 'await' operand must either be a valid pro... Remove this comment to see the full error message
648649
const coinSelection: CoinSelectionsResponse = await this.selectCoinsRequest.execute(
649650
{

source/renderer/app/utils/logging.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ const logToLevel = (level: LoggingLevel) => (
2727
message: string,
2828
data: Record<string, any> | null | undefined
2929
) => {
30-
if (!message.includes('selectCoins')) {
31-
return;
32-
}
33-
3430
const args = [
3531
formatContext({ ...messageContext, level }),
3632
{
@@ -43,7 +39,7 @@ const logToLevel = (level: LoggingLevel) => (
4339
};
4440

4541
export const logger: Logger = {
46-
debug: logToLevel('info'),
42+
debug: logToLevel('debug'),
4743
info: logToLevel('info'),
4844
error: logToLevel('error'),
4945
warn: logToLevel('warn'),

0 commit comments

Comments
 (0)