Skip to content

Commit

Permalink
chore(suite): use typedObjectKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
mroz22 committed Feb 19, 2025
1 parent 1886d64 commit a0f458e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
18 changes: 8 additions & 10 deletions packages/suite/src/actions/suite/metadataProviderActions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { notificationsActions } from '@suite-common/toast-notifications';
import { Device } from '@trezor/connect';
import { EventType, analytics } from '@trezor/suite-analytics';
import { createDeferred } from '@trezor/utils';
import { createDeferred, typedObjectKeys } from '@trezor/utils';

import { METADATA, METADATA_PROVIDER } from 'src/actions/suite/constants';
import * as modalActions from 'src/actions/suite/modalActions';
Expand Down Expand Up @@ -108,15 +108,13 @@ export const disconnectProvider =
removeMetadata?: boolean;
}) =>
async (dispatch: Dispatch) => {
(Object.keys(fetchIntervals) as FetchIntervalTrackingId[]).forEach(
(id: FetchIntervalTrackingId) => {
const [trackedDataType, trackedClientId] = id.split('-');
if (trackedDataType === dataType && trackedClientId === clientId) {
clearInterval(fetchIntervals[id]);
delete fetchIntervals[id];
}
},
);
typedObjectKeys(fetchIntervals).forEach((id: FetchIntervalTrackingId) => {
const [trackedDataType, trackedClientId] = id.split('-');
if (trackedDataType === dataType && trackedClientId === clientId) {
clearInterval(fetchIntervals[id]);
delete fetchIntervals[id];
}
});

// dispose metadata values (not keys)
if (removeMetadata) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BITCOIN_ONLY_SYMBOLS } from '@suite-common/suite-constants';
import { NetworkSymbol, getNetwork } from '@suite-common/wallet-config';
import { Button } from '@trezor/components';
import { spacings } from '@trezor/theme';
import { typedObjectKeys } from '@trezor/utils';

import { setDebugSettings } from 'src/actions/wallet/coinjoinClientActions';
import { ActionColumn, ActionSelect, SectionItem, TextColumn } from 'src/components/suite';
Expand Down Expand Up @@ -117,9 +118,7 @@ export const CoinjoinApi = () => {
return (
<>
{coinjoinSymbols.map(symbol => {
const environments = Object.keys(
COINJOIN_NETWORKS[symbol] || {},
) as CoinjoinServerEnvironment[];
const environments = typedObjectKeys(COINJOIN_NETWORKS[symbol] || {});

return (
<CoordinatorServer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styled from 'styled-components';
import { Banner, Button, Checkbox, Switch } from '@trezor/components';
import { spacingsPx } from '@trezor/theme';
import { EXPERIMENTAL_FEATURES_KB_URL } from '@trezor/urls';
import { typedObjectKeys } from '@trezor/utils';

import { SUITE } from 'src/actions/suite/constants';
import { goto } from 'src/actions/suite/routerActions';
Expand Down Expand Up @@ -109,9 +110,8 @@ export const Experimental = () => {
});
};

const experimentalFeatures = Object.keys(EXPERIMENTAL_FEATURES).filter(
feature =>
!EXPERIMENTAL_FEATURES[feature as ExperimentalFeature]?.isDisabled?.({ isDebug }),
const experimentalFeatures = typedObjectKeys(EXPERIMENTAL_FEATURES).filter(
feature => !EXPERIMENTAL_FEATURES[feature]?.isDisabled?.({ isDebug }),
);

return (
Expand Down

0 comments on commit a0f458e

Please sign in to comment.