From b56dcaca1ca787361f3c81a2122714131911d182 Mon Sep 17 00:00:00 2001 From: David Adegoke <64401859+Blazebrain@users.noreply.github.com> Date: Wed, 16 Oct 2024 02:58:41 +0100 Subject: [PATCH] fix: Issue with nownodes on older wallets (#1750) --- lib/entities/default_settings_migration.dart | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/entities/default_settings_migration.dart b/lib/entities/default_settings_migration.dart index 1c46cd605..2b8c49631 100644 --- a/lib/entities/default_settings_migration.dart +++ b/lib/entities/default_settings_migration.dart @@ -254,6 +254,7 @@ Future defaultSettingsMigration( case 41: _deselectQuantex(sharedPreferences); await _addSethNode(nodes, sharedPreferences); + await updateTronNodesWithNowNodes(sharedPreferences: sharedPreferences, nodes: nodes); break; default: break; @@ -1317,3 +1318,16 @@ Future removeMoneroWorld( await changeMoneroCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes); } } + +Future updateTronNodesWithNowNodes({ + required SharedPreferences sharedPreferences, + required Box nodes, +}) async { + final tronNowNodesUri = 'trx.nownodes.io'; + + if (nodes.values.any((node) => node.uriRaw == tronNowNodesUri)) return; + + await nodes.add(Node(uri: tronNowNodesUri, type: WalletType.tron)); + + await replaceTronDefaultNode(sharedPreferences: sharedPreferences, nodes: nodes); +}