Skip to content

Commit

Permalink
fix(suite-native): fetch token definitions and show them for enabled …
Browse files Browse the repository at this point in the history
…symbols
  • Loading branch information
vytick committed Jan 20, 2025
1 parent bf1c3da commit 1de9499
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions suite-native/discovery/src/discoveryConfigSlice.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { A, F, pipe } from '@mobily/ts-belt';
import { A, pipe } from '@mobily/ts-belt';

import { createWeakMapSelector, returnStableArrayIfEmpty } from '@suite-common/redux-utils';
import {
Expand All @@ -23,6 +23,7 @@ import {
selectIsFeatureFlagEnabled,
} from '@suite-native/feature-flags';
import {
isCoinWithTokens,
selectNetworkSymbolsOfAccountsWithTokensAllowed,
TokensRootState,
} from '@suite-native/tokens';
Expand Down Expand Up @@ -185,7 +186,11 @@ export const selectTokenDefinitionsEnabledNetworks = createMemoizedSelector(
[selectEnabledDiscoveryNetworkSymbols, selectNetworkSymbolsOfAccountsWithTokensAllowed],
(enabledNetworkSymbols, accountNetworkSymbols) =>
returnStableArrayIfEmpty(
F.toMutable(A.uniq([...enabledNetworkSymbols, ...accountNetworkSymbols])),
pipe(
[...enabledNetworkSymbols, ...accountNetworkSymbols],
A.filter(s => isCoinWithTokens(s)),
A.uniq,
),
),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
selectFilterKnownTokens,
selectNetworkTokenDefinitions,
} from '@suite-common/token-definitions';
import { isCoinWithTokens } from '@suite-native/tokens';

import { paymentTypeToAccountType } from './constants';

Expand Down Expand Up @@ -120,7 +121,7 @@ export const getAccountInfoThunk = createThunk<
const tokenDefinitions = selectNetworkTokenDefinitions(getState(), symbol);

// fetch token definitions for this network in case they are needed
if (!tokenDefinitions) {
if (!tokenDefinitions && isCoinWithTokens(symbol)) {
const definitionTypes = getSupportedDefinitionTypes(symbol);

definitionTypes.forEach(async type => {
Expand Down

0 comments on commit 1de9499

Please sign in to comment.