diff --git a/suite-native/storage/src/migrations/discovery/v3.ts b/suite-native/storage/src/migrations/discovery/v3.ts new file mode 100644 index 00000000000..09926650cc1 --- /dev/null +++ b/suite-native/storage/src/migrations/discovery/v3.ts @@ -0,0 +1,10 @@ +import { NetworkSymbol } from '@suite-common/wallet-config'; +// @ts-expect-error +const deprecatedNetworks: NetworkSymbol[] = ['dash', 'btg', 'nmc', 'vtc', 'dgb']; + +export const migrateDiscoveryDeprecateNetworks = ( + oldEnabledDiscoveryNetworkSymbols: NetworkSymbol[], +): NetworkSymbol[] => + oldEnabledDiscoveryNetworkSymbols.filter( + networkSymbol => !deprecatedNetworks.includes(networkSymbol), + ); diff --git a/suite-native/storage/src/migrations/wallet/accounts/v3.ts b/suite-native/storage/src/migrations/wallet/accounts/v3.ts new file mode 100644 index 00000000000..17793e2667a --- /dev/null +++ b/suite-native/storage/src/migrations/wallet/accounts/v3.ts @@ -0,0 +1,11 @@ +type Account = { + symbol: string; + key: string; +}; + +const deprecatedNetworks: string[] = ['dash', 'btg', 'nmc', 'vtc', 'dgb']; + +export const migrateAccountsDeprecateNetworks = ( + oldAccounts: Account[] | undefined, +): Account[] | undefined => + oldAccounts?.filter(account => !deprecatedNetworks.includes(account.symbol)); diff --git a/suite-native/storage/src/migrations/wallet/transactions/v3.ts b/suite-native/storage/src/migrations/wallet/transactions/v3.ts new file mode 100644 index 00000000000..1be4ec49104 --- /dev/null +++ b/suite-native/storage/src/migrations/wallet/transactions/v3.ts @@ -0,0 +1,26 @@ +type TransactionStub = { + symbol: string; +}; + +type AccountTransactionsType = { + [x: string]: TransactionStub[]; +}; + +const deprecatedNetworks: string[] = ['dash', 'btg', 'nmc', 'vtc', 'dgb']; + +export const migrateTransactionsDeprecateNetworks = ( + oldTransactions: AccountTransactionsType | undefined, +): AccountTransactionsType | undefined => { + const newTransactions: AccountTransactionsType = {}; + + for (const oldKey in oldTransactions) { + const oldTxns = oldTransactions[oldKey]; + + const newTxns = oldTxns.filter(txn => !deprecatedNetworks.includes(txn.symbol)); + if (newTxns.length > 0) { + newTransactions[oldKey] = newTxns; + } + } + + return newTransactions; +};