fix: Issue with nownodes on older wallets (#1750)
Some checks are pending
Cache Dependencies / test (push) Waiting to run

This commit is contained in:
David Adegoke 2024-10-16 02:58:41 +01:00 committed by GitHub
parent c3019b91cd
commit b56dcaca1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -254,6 +254,7 @@ Future<void> defaultSettingsMigration(
case 41:
_deselectQuantex(sharedPreferences);
await _addSethNode(nodes, sharedPreferences);
await updateTronNodesWithNowNodes(sharedPreferences: sharedPreferences, nodes: nodes);
break;
default:
break;
@ -1317,3 +1318,16 @@ Future<void> removeMoneroWorld(
await changeMoneroCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes);
}
}
Future<void> updateTronNodesWithNowNodes({
required SharedPreferences sharedPreferences,
required Box<Node> 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);
}