From 1de9499bd9e1d0f844f3decfb19fcb0381d1bfcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Vytick=20Vytrhl=C3=ADk?= Date: Fri, 17 Jan 2025 23:11:29 +0100 Subject: [PATCH] fix(suite-native): fetch token definitions and show them for enabled symbols --- suite-native/discovery/src/discoveryConfigSlice.ts | 9 +++++++-- .../module-accounts-import/src/accountsImportThunks.ts | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/suite-native/discovery/src/discoveryConfigSlice.ts b/suite-native/discovery/src/discoveryConfigSlice.ts index c1b2205bfe2..293baff5c26 100644 --- a/suite-native/discovery/src/discoveryConfigSlice.ts +++ b/suite-native/discovery/src/discoveryConfigSlice.ts @@ -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 { @@ -23,6 +23,7 @@ import { selectIsFeatureFlagEnabled, } from '@suite-native/feature-flags'; import { + isCoinWithTokens, selectNetworkSymbolsOfAccountsWithTokensAllowed, TokensRootState, } from '@suite-native/tokens'; @@ -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, + ), ), ); diff --git a/suite-native/module-accounts-import/src/accountsImportThunks.ts b/suite-native/module-accounts-import/src/accountsImportThunks.ts index 12d9a9dbcb2..1ce21800f16 100644 --- a/suite-native/module-accounts-import/src/accountsImportThunks.ts +++ b/suite-native/module-accounts-import/src/accountsImportThunks.ts @@ -23,6 +23,7 @@ import { selectFilterKnownTokens, selectNetworkTokenDefinitions, } from '@suite-common/token-definitions'; +import { isCoinWithTokens } from '@suite-native/tokens'; import { paymentTypeToAccountType } from './constants'; @@ -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 => {