@@ -270,6 +270,7 @@ export const migrate: OnUpgradeFunc<SuiteDBSchema> = async (
270
270
271
271
if ( oldVersion < 26 ) {
272
272
await updateAll ( transaction , 'accounts' , account => {
273
+ // @ts -expect-error
273
274
if ( account . symbol === 'vtc' && account . accountType === 'normal' ) {
274
275
// change account type from normal to segwit
275
276
account . accountType = 'segwit' ;
@@ -280,6 +281,7 @@ export const migrate: OnUpgradeFunc<SuiteDBSchema> = async (
280
281
281
282
await updateAll ( transaction , 'discovery' , d => {
282
283
// reset discovery
284
+ // @ts -expect-error
283
285
if ( d . networks . includes ( 'vtc' ) ) {
284
286
d . index = 0 ;
285
287
d . loaded = 0 ;
@@ -1176,4 +1178,56 @@ export const migrate: OnUpgradeFunc<SuiteDBSchema> = async (
1176
1178
return account ;
1177
1179
} ) ;
1178
1180
}
1181
+
1182
+ // Deprecate Vertcoin (VTC) and other networks
1183
+ if ( oldVersion < 52 ) {
1184
+ const deprecatedNetworks = [ 'vtc' , 'btg' , 'nmc' , 'dgb' , 'dash' ] ;
1185
+
1186
+ // Remove transactions related to deprecated networks
1187
+ await updateAll ( transaction , 'txs' , tx => {
1188
+ if ( deprecatedNetworks . includes ( tx . tx . symbol ) ) {
1189
+ return null ; // Delete transaction
1190
+ }
1191
+
1192
+ return tx ;
1193
+ } ) ;
1194
+
1195
+ // Remove accounts related to deprecated networks
1196
+ await updateAll ( transaction , 'accounts' , account => {
1197
+ if ( deprecatedNetworks . includes ( account . symbol ) ) {
1198
+ return null ; // Delete account
1199
+ }
1200
+
1201
+ return account ;
1202
+ } ) ;
1203
+
1204
+ // Remove deprecated networks from enabled networks in wallet settings
1205
+ await updateAll ( transaction , 'walletSettings' , walletSettings => {
1206
+ walletSettings . enabledNetworks = walletSettings . enabledNetworks . filter (
1207
+ network => ! deprecatedNetworks . includes ( network ) , // Exclude deprecated networks from enabled networks
1208
+ ) ;
1209
+
1210
+ return walletSettings ;
1211
+ } ) ;
1212
+
1213
+ // Remove deprecated networks from discovery networks
1214
+ await updateAll ( transaction , 'discovery' , discovery => {
1215
+ discovery . networks = discovery . networks . filter (
1216
+ network => ! deprecatedNetworks . includes ( network ) , // Exclude deprecated networks from discovery
1217
+ ) ;
1218
+ discovery . failed = [ ] ; // Clear failed discovery attempts
1219
+
1220
+ return discovery ;
1221
+ } ) ;
1222
+
1223
+ // Remove deprecated networks from backend settings
1224
+ const backendSettings = transaction . objectStore ( 'backendSettings' ) ;
1225
+ for ( const network of deprecatedNetworks ) {
1226
+ await backendSettings . delete ( network as NetworkSymbol ) ; // Delete backend settings for each deprecated network
1227
+ }
1228
+
1229
+ console . log (
1230
+ 'Deprecated networks (VTC, BTG, NMC, DGB, DASH) have been deprecated successfully.' ,
1231
+ ) ;
1232
+ }
1179
1233
} ;
0 commit comments