From 66adb00d16920e10ad4944f40d0d06f855da4d66 Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Wed, 13 Aug 2025 00:19:47 +0300 Subject: [PATCH] Replace Zano default node --- assets/zano_node_list.yml | 2 +- lib/entities/default_settings_migration.dart | 50 +++++--------------- lib/entities/zano_alias.dart | 2 +- 3 files changed, 15 insertions(+), 39 deletions(-) diff --git a/assets/zano_node_list.yml b/assets/zano_node_list.yml index 26a1b797d..17bba5f44 100644 --- a/assets/zano_node_list.yml +++ b/assets/zano_node_list.yml @@ -1,9 +1,9 @@ - uri: 37.27.100.59:10500 + is_default: true useSSL: false isEnabledForAutoSwitching: true - uri: zano.cakewallet.com:11211 - is_default: true useSSL: false isEnabledForAutoSwitching: true \ No newline at end of file diff --git a/lib/entities/default_settings_migration.dart b/lib/entities/default_settings_migration.dart index 0d573195f..6077ade30 100644 --- a/lib/entities/default_settings_migration.dart +++ b/lib/entities/default_settings_migration.dart @@ -43,7 +43,7 @@ const solanaDefaultNodeUri = 'solana-mainnet.core.chainstack.com'; const tronDefaultNodeUri = 'api.trongrid.io'; const newCakeWalletBitcoinUri = 'btc-electrum.cakewallet.com:50002'; const wowneroDefaultNodeUri = 'node3.monerodevs.org:34568'; -const zanoDefaultNodeUri = 'zano.cakewallet.com:11211'; +const zanoDefaultNodeUri = '37.27.100.59:10500'; const moneroWorldNodeUri = '.moneroworld.com'; const decredDefaultUri = "default-spv-nodes"; const dogecoinDefaultNodeUri = 'dogecoin.stackwallet.com:50022'; @@ -348,8 +348,12 @@ Future defaultSettingsMigration( break; case 36: await addWalletNodeList(nodes: nodes, type: WalletType.wownero); - await changeWowneroCurrentNodeToDefault( - sharedPreferences: sharedPreferences, nodes: nodes); + await _changeDefaultNode( + nodes: nodes, + sharedPreferences: sharedPreferences, + type: WalletType.wownero, + currentNodePreferenceKey: PreferencesKey.currentWowneroNodeIdKey, + ); break; case 37: // removed as it would be replaced again anyway @@ -516,6 +520,12 @@ Future defaultSettingsMigration( migrateExistingNodesToUseAutoSwitching(nodes: nodes, powNodes: powNodes); break; case 51: + _changeDefaultNode( + nodes: nodes, + sharedPreferences: sharedPreferences, + type: WalletType.zano, + currentNodePreferenceKey: PreferencesKey.currentZanoNodeIdKey, + ); await addWalletNodeList(nodes: nodes, type: WalletType.dogecoin); await _changeDefaultNode( nodes: nodes, @@ -828,32 +838,6 @@ Node? getDefaultNode({required Box nodes, required WalletType type}) { nodes.values.firstWhereOrNull((node) => node.type == type); } -Node getWowneroDefaultNode({required Box nodes}) { - final timeZone = DateTime.now().timeZoneOffset.inHours; - var nodeUri = ''; - - if (timeZone >= 1) { - // Eurasia - nodeUri = 'node2.monerodevs.org.lol:34568'; - } else if (timeZone <= -4) { - // America - nodeUri = 'node3.monerodevs.org:34568'; - } - - if (nodeUri == '') { - return nodes.values.where((element) => element.type == WalletType.wownero).first; - } - - try { - return nodes.values.firstWhere( - (Node node) => node.uriRaw == nodeUri, - orElse: () => nodes.values.where((element) => element.type == WalletType.wownero).first, - ); - } catch (_) { - return nodes.values.where((element) => element.type == WalletType.wownero).first; - } -} - Future insecureStorageMigration({ required SharedPreferences sharedPreferences, required SecureStorage secureStorage, @@ -1240,14 +1224,6 @@ Future migrateExchangeStatus(SharedPreferences sharedPreferences) async { await sharedPreferences.remove(PreferencesKey.disableExchangeKey); } -Future changeWowneroCurrentNodeToDefault( - {required SharedPreferences sharedPreferences, required Box nodes}) async { - final node = getWowneroDefaultNode(nodes: nodes); - final nodeId = node.key as int? ?? 0; - - await sharedPreferences.setInt(PreferencesKey.currentWowneroNodeIdKey, nodeId); -} - Future addNanoPowNodeList({required Box nodes}) async { final nodeList = await loadDefaultNanoPowNodes(); for (var node in nodeList) { diff --git a/lib/entities/zano_alias.dart b/lib/entities/zano_alias.dart index ec966e225..3d1c74969 100644 --- a/lib/entities/zano_alias.dart +++ b/lib/entities/zano_alias.dart @@ -6,7 +6,7 @@ import 'package:cw_core/utils/proxy_wrapper.dart'; class ZanoAlias { static Future fetchZanoAliasAddress(String alias) async { try { - final uri = Uri.parse("http://zano.cakewallet.com:11211/json_rpc"); + final uri = Uri.parse("http://37.27.100.59:10500/json_rpc"); final response = await ProxyWrapper().post( clearnetUri: uri, body: json.encode({