Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coins deprecation #16131

Merged
merged 5 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/product-components/src/components/CoinLogo/coins.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import { NetworkSymbol } from '@suite-common/wallet-config';

// These coins are not supported in Suite, but exist in Trezor Connect
export type LegacyNetworkSymbol = 'eos' | 'nem' | 'xlm' | 'xtz';
export type LegacyNetworkSymbol =
| 'eos'
| 'nem'
| 'xlm'
| 'xtz'
| 'dash'
| 'dgb'
| 'nmc'
| 'vtc'
| 'btg';

export const COINS: Record<NetworkSymbol | LegacyNetworkSymbol, string> = {
ada: require('../../images/coins/ada.svg'),
Expand Down
16 changes: 1 addition & 15 deletions packages/suite-web/e2e/tests/wallet/discovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,7 @@ import { onNavBar } from '../../support/pageObjects/topBarObject';
// discovery should end within this time frame
const DISCOVERY_LIMIT = 1000 * 60 * 2;

const coinsToActivate = [
'ltc',
'eth',
'etc',
'dash',
'btg',
'bch',
'doge',
'vtc',
'ada',
'xrp',
'dgb',
'zec',
'nmc',
];
const coinsToActivate = ['ltc', 'eth', 'etc', 'bch', 'doge', 'ada', 'xrp', 'zec'];
describe('Discovery', () => {
beforeEach(() => {
cy.task('startEmu', { wipe: true });
Expand Down
4 changes: 4 additions & 0 deletions packages/suite/src/storage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Storage changelog

## 52

- Deprecated Vertcoin (VTC), Bitcoin Gold (BTG), Namecoin (NMC), DigiByte (DGB), and Dash (DASH) networks. Removed related transactions, accounts, and settings.

## 51

- Changed `metadata.key` on non-eth EVM networks accounts to be `descriptor-chainId`
Expand Down
2 changes: 1 addition & 1 deletion packages/suite/src/storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { reloadApp } from 'src/utils/suite/reload';
import { migrate } from './migrations';
import type { SuiteDBSchema } from './definitions';

const VERSION = 51; // don't forget to add migration and CHANGELOG when changing versions!
const VERSION = 52; // don't forget to add migration and CHANGELOG when changing versions!

/**
* If the object stores don't already exist then creates them.
Expand Down
50 changes: 50 additions & 0 deletions packages/suite/src/storage/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ export const migrate: OnUpgradeFunc<SuiteDBSchema> = async (

if (oldVersion < 26) {
await updateAll(transaction, 'accounts', account => {
// @ts-expect-error
if (account.symbol === 'vtc' && account.accountType === 'normal') {
// change account type from normal to segwit
account.accountType = 'segwit';
Expand All @@ -280,6 +281,7 @@ export const migrate: OnUpgradeFunc<SuiteDBSchema> = async (

await updateAll(transaction, 'discovery', d => {
// reset discovery
// @ts-expect-error
if (d.networks.includes('vtc')) {
d.index = 0;
d.loaded = 0;
Expand Down Expand Up @@ -1176,4 +1178,52 @@ export const migrate: OnUpgradeFunc<SuiteDBSchema> = async (
return account;
});
}

// Deprecate Vertcoin (VTC) and other networks
if (oldVersion < 52) {
tomasklim marked this conversation as resolved.
Show resolved Hide resolved
const deprecatedNetworks = ['vtc', 'btg', 'nmc', 'dgb', 'dash'];

// Remove transactions related to deprecated networks
await updateAll(transaction, 'txs', tx => {
tomasklim marked this conversation as resolved.
Show resolved Hide resolved
if (deprecatedNetworks.includes(tx.tx.symbol)) {
return null; // Delete transaction
}

return tx;
});

// Remove accounts related to deprecated networks
await updateAll(transaction, 'accounts', account => {
if (deprecatedNetworks.includes(account.symbol)) {
return null; // Delete account
}

return account;
});

// Remove deprecated networks from enabled networks in wallet settings
await updateAll(transaction, 'walletSettings', walletSettings => {
walletSettings.enabledNetworks = walletSettings.enabledNetworks.filter(
network => !deprecatedNetworks.includes(network), // Exclude deprecated networks from enabled networks
);

return walletSettings;
});

// Remove deprecated networks from discovery networks
await updateAll(transaction, 'discovery', discovery => {
discovery.networks = discovery.networks.filter(
network => !deprecatedNetworks.includes(network), // Exclude deprecated networks from discovery
);
discovery.failed = []; // Clear failed discovery attempts

return discovery;
});

// Remove deprecated networks from backend settings
const backendSettings = transaction.objectStore('backendSettings');
for (const network of deprecatedNetworks) {
await backendSettings.delete(network as NetworkSymbol); // Delete backend settings for each deprecated network
}
}
};
5 changes: 0 additions & 5 deletions packages/theme/src/coinsColors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,20 @@ export const coinsColors: CoinsColors = {
bch: '#0ac18e',
bsc: '#f0b90b',
btc: '#f29937',
btg: '#3b5185',
dash: '#1796e4',
dgb: '#3a75c9',
doge: '#c8af47',
dsol: '#9945ff',
etc: '#60c67e',
eth: '#454a75',
ltc: '#a6a8a9',
op: '#ff0720',
pol: '#7b3fe4',
nmc: '#186c9d',
regtest: '#e75f5f',
sol: '#9945ff',
tada: '#3468d1',
test: '#e75f5f',
thol: '#454a75',
tsep: '#454a75',
txrp: '#e75f5f',
vtc: '#1b9065',
xrp: '#24292e',
zec: '#f5b300',
};
14 changes: 0 additions & 14 deletions suite-common/suite-constants/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ export type Protocol =
| 'btc'
| 'litecoin'
| 'bitcoincash'
| 'bitcoingold'
| 'dash'
| 'digibyte'
| 'dogecoin'
| 'namecoin'
| 'vertcoin'
tomasklim marked this conversation as resolved.
Show resolved Hide resolved
| 'zcash'
| 'ethereum'
| 'ethclassic'
Expand All @@ -27,11 +22,7 @@ export type Protocol =
| 'bch'
| 'bsc'
| 'bnb'
| 'btg'
| 'dgb'
| 'doge'
| 'nmc'
| 'vtc'
| 'zec'
| 'eth'
| 'etc'
Expand All @@ -58,12 +49,7 @@ export const NETWORK_TO_PROTOCOLS: Record<NetworkSymbol, Protocol[]> = {
btc: ['bitcoin', 'btc'],
ltc: ['litecoin', 'ltc'],
bch: ['bitcoincash', 'bch'],
btg: ['bitcoingold', 'btg'],
dash: ['dash'],
dgb: ['digibyte', 'dgb'],
doge: ['dogecoin', 'doge'],
nmc: ['namecoin', 'nmc'],
vtc: ['vertcoin', 'vtc'],
zec: ['zcash', 'zec'],
eth: ['ethereum', 'eth'],
etc: ['ethclassic', 'etc'],
Expand Down
94 changes: 0 additions & 94 deletions suite-common/wallet-config/src/networksConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,100 +361,6 @@ export const networks = {
coingeckoId: 'zcash',
tradeCryptoId: 'zcash',
},
dash: {
symbol: 'dash',
displaySymbol: 'DASH',
name: 'Dash',
networkType: 'bitcoin',
bip43Path: "m/44'/5'/i'",
decimals: 8,
testnet: false,
explorer: getExplorerUrls('https://dash1.trezor.io', 'bitcoin'),
features: ['sign-verify'],
backendTypes: ['blockbook'],
accountTypes: {},
coingeckoId: 'dash',
tradeCryptoId: 'dash',
},
btg: {
symbol: 'btg',
displaySymbol: 'BTG',
name: 'Bitcoin Gold',
networkType: 'bitcoin',
bip43Path: "m/49'/156'/i'",
decimals: 8,
testnet: false,
explorer: getExplorerUrls('https://btg1.trezor.io', 'bitcoin'),
features: ['sign-verify'],
backendTypes: ['blockbook'],
accountTypes: {
legacy: {
accountType: 'legacy',
bip43Path: "m/44'/156'/i'",
},
},
coingeckoId: 'bitcoin-gold',
tradeCryptoId: 'bitcoin-gold',
},
dgb: {
symbol: 'dgb',
displaySymbol: 'DGB',
name: 'DigiByte',
networkType: 'bitcoin',
bip43Path: "m/49'/20'/i'",
decimals: 8,
testnet: false,
explorer: getExplorerUrls('https://dgb1.trezor.io', 'bitcoin'),
features: ['sign-verify'],
backendTypes: ['blockbook'],
accountTypes: {
legacy: {
accountType: 'legacy',
bip43Path: "m/44'/20'/i'",
},
},
coingeckoId: 'digibyte',
tradeCryptoId: 'digibyte',
},
nmc: {
symbol: 'nmc',
displaySymbol: 'NMC',
name: 'Namecoin',
networkType: 'bitcoin',
bip43Path: "m/44'/7'/i'",
decimals: 8,
testnet: false,
explorer: getExplorerUrls('https://nmc1.trezor.io', 'bitcoin'),
features: ['sign-verify'],
backendTypes: ['blockbook'],
accountTypes: {},
coingeckoId: 'namecoin',
tradeCryptoId: 'namecoin',
},
vtc: {
symbol: 'vtc',
displaySymbol: 'VTC',
name: 'Vertcoin',
networkType: 'bitcoin',
bip43Path: "m/84'/28'/i'",
decimals: 8,
testnet: false,
explorer: getExplorerUrls('https://vtc1.trezor.io', 'bitcoin'),
features: ['sign-verify'],
backendTypes: ['blockbook'],
accountTypes: {
segwit: {
accountType: 'segwit',
bip43Path: "m/49'/28'/i'",
},
legacy: {
accountType: 'legacy',
bip43Path: "m/44'/28'/i'",
},
},
coingeckoId: 'vertcoin',
tradeCryptoId: 'vertcoin',
},
// testnets
test: {
symbol: 'test',
Expand Down
5 changes: 0 additions & 5 deletions suite-common/wallet-config/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ export type NetworkSymbol =
| 'etc'
| 'xrp'
| 'bch'
| 'btg'
| 'dash'
| 'dgb'
| 'doge'
| 'nmc'
| 'vtc'
| 'zec'
| 'ada'
| 'sol'
Expand Down
27 changes: 2 additions & 25 deletions suite-native/config/src/supportedNetworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,10 @@ const discoveryBlacklist: NetworkSymbol[] = ['op', 'base', 'arb'];

// All supported coins for device discovery
export const networkSymbolsWhitelistMap: Record<'mainnet' | 'testnet', readonly NetworkSymbol[]> = {
mainnet: [
'btc',
'eth',
'pol',
'sol',
'bsc',
'ltc',
'etc',
'ada',
'xrp',
'bch',
'btg',
'dash',
'dgb',
'doge',
'nmc',
'vtc',
'zec',
],
mainnet: ['btc', 'eth', 'pol', 'sol', 'bsc', 'ltc', 'etc', 'ada', 'xrp', 'bch', 'doge', 'zec'],
testnet: ['test', 'regtest', 'tsep', 'thol', 'dsol', 'tada', 'txrp'],
tomasklim marked this conversation as resolved.
Show resolved Hide resolved
};

// Blacklisting coins that are allowed inside `networkSymbolsWhitelistMap` so that we don't have to configs and just filter these out
const portfolioTrackerBlacklist: readonly NetworkSymbol[] = ['btg', 'dash', 'dgb', 'nmc', 'vtc'];

export const discoverySupportedNetworks = [
...networkSymbolsWhitelistMap.mainnet,
...networkSymbolsWhitelistMap.testnet,
Expand Down Expand Up @@ -79,9 +58,7 @@ export const filterBlacklistedNetworks = (
);

export const portfolioTrackerMainnets = sortNetworks(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I see correctly, if we remove the portfolio blacklist, we can remove portfolioTrackerMainnets and getPortfolioTrackerTestnets completely and use networkSymbolsWhitelistMap.mainnets and networkSymbolsWhitelistMap.testnets instead, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to create issue for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In here - #16683

getMainnets()
.filter(network => networkSymbolsWhitelistMap.mainnet.includes(network.symbol))
.filter(network => !portfolioTrackerBlacklist.includes(network.symbol)),
getMainnets().filter(network => networkSymbolsWhitelistMap.mainnet.includes(network.symbol)),
).map(network => network.symbol);

const getPortfolioTrackerTestnets = () =>
Expand Down
5 changes: 0 additions & 5 deletions suite-native/discovery/src/discoveryThunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ const DISCOVERY_DEFAULT_BATCH_SIZE = 2;

const DISCOVERY_BATCH_SIZE_PER_SYMBOL: Partial<Record<NetworkSymbol, number>> = {
bch: 1,
dash: 1,
btg: 1,
dgb: 1,
nmc: 1,
vtc: 1,
zec: 1,
etc: 1,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ const devXpubs: Partial<Record<NetworkSymbol, string | DevXpub[]>> = {
doge: 'dgub8sbe5Mi8LA4dXB9zPfLZW8armvaRkaqT37y6xfT1QA12ErATDf8iGEG8y7kamAnjLuEk9AMpTMMp6EK9Vjp2HHx91xdDEmWYpmD49fpoUYF',
ltc: 'zpub6qhzAgn63nQAJZiY829GUUb1eXFDqpLbeShTdAbTEKyZa8n2VbkLwbRhq9xqPyj5Yet5TBdbCZDgiw53NQ2qwib4mygybFq66i7ZcXUcwgU',
bch: 'xpub6DFYZ2FZwJHL4WULnRKTyMAaE9sM5Vi3QoWW9kYWGzR4HxDJ42Gbbdj7bpBAtATpaNeSVqSD3gdFFmZZYK9BVo96rhxPY7SWZWsfmdHpZ7e',
btg: 'ypub6WVGAPrpnuTJN8AULEnWNNpvFR5Xcckn66fp8sL4FgEy5Z4oig1CbwySvj8v4iFVSANcHJVWzK211Bb8u71bCTVW9vY1PbAn59KmCzq99YW',
dgb: 'ypub6X7pNV6ouYFiDGHjxCtbnV9EaCdq5uyVysMbR5Q79LHa3SWV93J7ubun37EJhfFQqsSGQBfz3UrAzNtYNhb5JsoPJbNKvbF9wKxBjgxfXkH',
zec: 'xpub6DNsg962rV1MeqmathySUG2oKso9MfT2hMXCsMp6qemGWwD9xssVM61DfcAUUEaX2G8tjaaoKKppoKtFcSK8KVaMFHmZjAgyqod4DwXopPE',
eth: [
{ title: 'balance, few tokens', address: '0x62270860B9a5337e46bE8563c512c9137AFa0384' },
Expand Down
Loading
Loading