mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
change default tron node to nowNodes if not already
Some checks failed
Cache Dependencies / test (push) Has been cancelled
Some checks failed
Cache Dependencies / test (push) Has been cancelled
This commit is contained in:
parent
765ae87712
commit
9706243c81
1 changed files with 15 additions and 3 deletions
|
@ -273,7 +273,19 @@ Future<void> defaultSettingsMigration(
|
||||||
newDefaultUri: newCakeWalletBitcoinUri,
|
newDefaultUri: newCakeWalletBitcoinUri,
|
||||||
currentNodePreferenceKey: PreferencesKey.currentBitcoinElectrumSererIdKey,
|
currentNodePreferenceKey: PreferencesKey.currentBitcoinElectrumSererIdKey,
|
||||||
useSSL: true,
|
useSSL: true,
|
||||||
oldUri: 'cakewallet.com',
|
oldUri: ['cakewallet.com'],
|
||||||
|
);
|
||||||
|
_changeDefaultNode(
|
||||||
|
nodes: nodes,
|
||||||
|
sharedPreferences: sharedPreferences,
|
||||||
|
type: WalletType.tron,
|
||||||
|
newDefaultUri: tronDefaultNodeUri,
|
||||||
|
currentNodePreferenceKey: PreferencesKey.currentTronNodeIdKey,
|
||||||
|
useSSL: true,
|
||||||
|
oldUri: [
|
||||||
|
'tron-rpc.publicnode.com:443',
|
||||||
|
'api.trongrid.io',
|
||||||
|
],
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -300,11 +312,11 @@ Future<void> _changeDefaultNode({
|
||||||
required String newDefaultUri,
|
required String newDefaultUri,
|
||||||
required String currentNodePreferenceKey,
|
required String currentNodePreferenceKey,
|
||||||
required bool useSSL,
|
required bool useSSL,
|
||||||
required String oldUri, // leave empty if you want to force replace the node regardless of the user's current node
|
required List<String> oldUri, // leave empty if you want to force replace the node regardless of the user's current node
|
||||||
}) async {
|
}) async {
|
||||||
final currentNodeId = sharedPreferences.getInt(currentNodePreferenceKey);
|
final currentNodeId = sharedPreferences.getInt(currentNodePreferenceKey);
|
||||||
final currentNode = nodes.values.firstWhere((node) => node.key == currentNodeId);
|
final currentNode = nodes.values.firstWhere((node) => node.key == currentNodeId);
|
||||||
final shouldReplace = currentNode.uriRaw.contains(oldUri);
|
final shouldReplace = oldUri.any((e) => currentNode.uriRaw.contains(e));
|
||||||
|
|
||||||
if (shouldReplace) {
|
if (shouldReplace) {
|
||||||
var newNodeId =
|
var newNodeId =
|
||||||
|
|
Loading…
Reference in a new issue