@@ -33,11 +33,11 @@ class DB {
3333 static const String boxNameTrades = "exchangeTransactionsBox" ;
3434 static const String boxNameAllWalletsData = "wallets" ;
3535 static const String boxNameFavoriteWallets = "favoriteWallets" ;
36+ static const String boxNamePrimaryNodesDeprecated = "primaryNodes" ;
3637
3738 // in use
3839 // TODO: migrate
3940 static const String boxNameNodeModels = "nodeModels" ;
40- static const String boxNamePrimaryNodes = "primaryNodes" ;
4141 static const String boxNameNotifications = "notificationModels" ;
4242 static const String boxNameWatchedTransactions =
4343 "watchedTxNotificationModels" ;
@@ -127,29 +127,27 @@ class DB {
127127 _boxNodeModels = await hive.openBox <NodeModel >(boxNameNodeModels);
128128 }
129129
130- if (hive.isBoxOpen (boxNamePrimaryNodes)) {
131- _boxPrimaryNodes = hive.box <NodeModel >(boxNamePrimaryNodes);
132- } else {
133- _boxPrimaryNodes = await hive.openBox <NodeModel >(boxNamePrimaryNodes);
134- }
135-
136130 if (hive.isBoxOpen (boxNameAllWalletsData)) {
137131 _boxAllWalletsData = hive.box <dynamic >(boxNameAllWalletsData);
138132 } else {
139133 _boxAllWalletsData = await hive.openBox <dynamic >(boxNameAllWalletsData);
140134 }
141135
142- _boxNotifications =
143- await hive.openBox <NotificationModel >(boxNameNotifications);
144- _boxWatchedTransactions =
145- await hive.openBox <NotificationModel >(boxNameWatchedTransactions);
146- _boxWatchedTrades =
147- await hive.openBox <NotificationModel >(boxNameWatchedTrades);
136+ _boxNotifications = await hive.openBox <NotificationModel >(
137+ boxNameNotifications,
138+ );
139+ _boxWatchedTransactions = await hive.openBox <NotificationModel >(
140+ boxNameWatchedTransactions,
141+ );
142+ _boxWatchedTrades = await hive.openBox <NotificationModel >(
143+ boxNameWatchedTrades,
144+ );
148145 _boxTradesV2 = await hive.openBox <Trade >(boxNameTradesV2);
149146 _boxTradeNotes = await hive.openBox <String >(boxNameTradeNotes);
150147 _boxTradeLookup = await hive.openBox <TradeWalletLookup >(boxNameTradeLookup);
151148 _walletInfoSource = await hive.openBox< lib_monero_compat.WalletInfo > (
152- lib_monero_compat.WalletInfo .boxName);
149+ lib_monero_compat.WalletInfo .boxName,
150+ );
153151 _boxFavoriteWallets = await hive.openBox <String >(boxNameFavoriteWallets);
154152
155153 await Future .wait ([
@@ -183,11 +181,13 @@ class DB {
183181
184182 for (final entry in mapped.entries) {
185183 if (hive.isBoxOpen (entry.value.walletId)) {
186- _walletBoxes[entry.value.walletId] =
187- hive.box <dynamic >(entry.value.walletId);
184+ _walletBoxes[entry.value.walletId] = hive.box <dynamic >(
185+ entry.value.walletId,
186+ );
188187 } else {
189- _walletBoxes[entry.value.walletId] =
190- await hive.openBox <dynamic >(entry.value.walletId);
188+ _walletBoxes[entry.value.walletId] = await hive.openBox <dynamic >(
189+ entry.value.walletId,
190+ );
191191 }
192192 }
193193 }
@@ -196,8 +196,9 @@ class DB {
196196 if (_txCacheBoxes[currency.identifier]? .isOpen != true ) {
197197 _txCacheBoxes.remove (currency.identifier);
198198 }
199- return _txCacheBoxes[currency.identifier] ?? =
200- await hive.openBox <dynamic >(_boxNameTxCache (currency: currency));
199+ return _txCacheBoxes[currency.identifier] ?? = await hive.openBox <dynamic >(
200+ _boxNameTxCache (currency: currency),
201+ );
201202 }
202203
203204 Future <void > closeTxCacheBox ({required CryptoCurrency currency}) async {
@@ -210,8 +211,9 @@ class DB {
210211 if (_setCacheBoxes[currency.identifier]? .isOpen != true ) {
211212 _setCacheBoxes.remove (currency.identifier);
212213 }
213- return _setCacheBoxes[currency.identifier] ?? =
214- await hive.openBox <dynamic >(_boxNameSetCache (currency: currency));
214+ return _setCacheBoxes[currency.identifier] ?? = await hive.openBox <dynamic >(
215+ _boxNameSetCache (currency: currency),
216+ );
215217 }
216218
217219 Future <void > closeAnonymitySetCacheBox ({
@@ -226,10 +228,8 @@ class DB {
226228 if (_usedSerialsCacheBoxes[currency.identifier]? .isOpen != true ) {
227229 _usedSerialsCacheBoxes.remove (currency.identifier);
228230 }
229- return _usedSerialsCacheBoxes[currency.identifier] ?? =
230- await hive.openBox <dynamic >(
231- _boxNameUsedSerialsCache (currency: currency),
232- );
231+ return _usedSerialsCacheBoxes[currency.identifier] ?? = await hive
232+ .openBox <dynamic >(_boxNameUsedSerialsCache (currency: currency));
233233 }
234234
235235 Future <void > closeUsedSerialsCacheBox ({
@@ -274,10 +274,7 @@ class DB {
274274 List <T > values <T >({required String boxName}) =>
275275 hive.box <T >(boxName).values.toList (growable: false );
276276
277- T ? get <T >({
278- required String boxName,
279- required dynamic key,
280- }) =>
277+ T ? get <T >({required String boxName, required dynamic key}) =>
281278 hive.box <T >(boxName).get (key);
282279
283280 bool containsKey <T >({required String boxName, required dynamic key}) =>
@@ -289,19 +286,19 @@ class DB {
289286 required String boxName,
290287 required dynamic key,
291288 required T value,
292- }) async =>
293- await mutex
294- . protect (() async => await hive. box < T >(boxName). put (key, value) );
289+ }) async => await mutex. protect (
290+ () async => await hive. box < T >(boxName). put (key, value),
291+ );
295292
296293 Future <void > add <T >({required String boxName, required T value}) async =>
297294 await mutex.protect (() async => await hive.box <T >(boxName).add (value));
298295
299296 Future <void > addAll <T >({
300297 required String boxName,
301298 required Iterable <T > values,
302- }) async =>
303- await mutex
304- . protect (() async => await hive. box < T >(boxName). addAll (values) );
299+ }) async => await mutex. protect (
300+ () async => await hive. box < T >(boxName). addAll (values),
301+ );
305302
306303 Future <void > delete <T >({
307304 required dynamic key,
@@ -325,20 +322,21 @@ class DB {
325322 await DB .instance.deleteBoxFromDisk (boxName: DB .boxNameAddressBook);
326323 await DB .instance.deleteBoxFromDisk (boxName: "debugInfoBox" );
327324 await DB .instance.deleteBoxFromDisk (boxName: DB .boxNameNodeModels);
328- await DB .instance.deleteBoxFromDisk (boxName: DB .boxNamePrimaryNodes);
329325 await DB .instance.deleteBoxFromDisk (boxName: DB .boxNameAllWalletsData);
330326 await DB .instance.deleteBoxFromDisk (boxName: DB .boxNameNotifications);
331- await DB .instance
332- .deleteBoxFromDisk (boxName: DB .boxNameWatchedTransactions);
327+ await DB .instance.deleteBoxFromDisk (
328+ boxName: DB .boxNameWatchedTransactions,
329+ );
333330 await DB .instance.deleteBoxFromDisk (boxName: DB .boxNameWatchedTrades);
334331 await DB .instance.deleteBoxFromDisk (boxName: DB .boxNameTrades);
335332 await DB .instance.deleteBoxFromDisk (boxName: DB .boxNameTradesV2);
336333 await DB .instance.deleteBoxFromDisk (boxName: DB .boxNameTradeNotes);
337334 await DB .instance.deleteBoxFromDisk (boxName: DB .boxNameTradeLookup);
338335 await DB .instance.deleteBoxFromDisk (boxName: DB .boxNameFavoriteWallets);
339336 await DB .instance.deleteBoxFromDisk (boxName: DB .boxNamePrefs);
340- await DB .instance
341- .deleteBoxFromDisk (boxName: DB .boxNameWalletsToDeleteOnStart);
337+ await DB .instance.deleteBoxFromDisk (
338+ boxName: DB .boxNameWalletsToDeleteOnStart,
339+ );
342340 await DB .instance.deleteBoxFromDisk (boxName: DB .boxNamePriceCache);
343341 await DB .instance.deleteBoxFromDisk (boxName: DB .boxNameDBInfo);
344342 await DB .instance.deleteBoxFromDisk (boxName: "theme" );
0 commit comments