Replace Zano default node

This commit is contained in:
OmarHatem
2025-08-13 00:19:47 +03:00
parent af35c28152
commit 66adb00d16
3 changed files with 15 additions and 39 deletions
+1 -1
View File
@@ -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
+13 -37
View File
@@ -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<void> 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<void> 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<Node> nodes, required WalletType type}) {
nodes.values.firstWhereOrNull((node) => node.type == type);
}
Node getWowneroDefaultNode({required Box<Node> 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<void> insecureStorageMigration({
required SharedPreferences sharedPreferences,
required SecureStorage secureStorage,
@@ -1240,14 +1224,6 @@ Future<void> migrateExchangeStatus(SharedPreferences sharedPreferences) async {
await sharedPreferences.remove(PreferencesKey.disableExchangeKey);
}
Future<void> changeWowneroCurrentNodeToDefault(
{required SharedPreferences sharedPreferences, required Box<Node> nodes}) async {
final node = getWowneroDefaultNode(nodes: nodes);
final nodeId = node.key as int? ?? 0;
await sharedPreferences.setInt(PreferencesKey.currentWowneroNodeIdKey, nodeId);
}
Future<void> addNanoPowNodeList({required Box<Node> nodes}) async {
final nodeList = await loadDefaultNanoPowNodes();
for (var node in nodeList) {
+1 -1
View File
@@ -6,7 +6,7 @@ import 'package:cw_core/utils/proxy_wrapper.dart';
class ZanoAlias {
static Future<String?> 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({