Add Tether Gold(XAUT) to existing ETH Wallets (#2867)
* feat: Add Tether Gold (XAUT) to Ethereum tokens list with associated icon * feat: Add Tether Gold (XAUT) to existing Ethereum wallets --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
David Adegoke committed
Feb 5, 2026 at 18:05 UTC
8d71f004a2ed03cefbe1d74a9469a2cdd64d506c
1 file changed
+57
-9
lib/entities/default_settings_migration.dart
+57
-9
@@ -26,6 +26,8 @@ import 'package:cw_core/wallet_info.dart';
26
import 'package:cake_wallet/exchange/trade.dart';
27
import 'package:encrypt/encrypt.dart' as encrypt;
28
import 'package:collection/collection.dart';
29
+import 'package:cw_core/cake_hive.dart';
30
+import 'package:cw_core/erc20_token.dart';
31
32
const newCakeWalletMoneroUri = 'xmr-node.cakewallet.com:18081';
33
const cakeWalletBitcoinElectrumUri = 'electrum.cakewallet.com:50002';
@@ -548,7 +550,7 @@ Future<void> defaultSettingsMigration(
550
currentNodePreferenceKey: PreferencesKey.currentBaseNodeIdKey,
551
);
552
break;
551
- case 53:
553
+ case 53:
554
await addWalletNodeList(nodes: nodes, type: WalletType.arbitrum);
555
await _changeDefaultNode(
556
nodes: nodes,
@@ -557,7 +559,7 @@ Future<void> defaultSettingsMigration(
559
currentNodePreferenceKey: PreferencesKey.currentArbitrumNodeIdKey,
560
);
561
break;
560
- case 54:
562
+ case 54:
563
await _backupWowneroSeeds(havenSeedStore);
564
break;
565
case 55:
@@ -574,6 +576,8 @@ Future<void> defaultSettingsMigration(
576
PreferencesKey.syncStatusDisplayMode, SyncStatusDisplayMode.blocksRemaining.name);
577
break;
578
case 57:
579
+ await _addXautTokenToExistingEthereumWallets();
580
+
581
await addWalletNodeList(nodes: nodes, type: WalletType.bsc);
582
await _changeDefaultNode(
583
nodes: nodes,
@@ -581,6 +585,7 @@ Future<void> defaultSettingsMigration(
585
type: WalletType.bsc,
586
currentNodePreferenceKey: PreferencesKey.currentBscNodeIdKey,
587
);
588
+ break;
589
default:
590
break;
591
}
@@ -1017,7 +1022,8 @@ Future<void> updateNodeTypes({required Box<Node> nodes}) async {
1022
}
1023
1024
Future<void> addAddressesForMoneroWallets() async {
1020
- final moneroWalletsInfo = (await WalletInfo.getAll()).where((info) => info.type == WalletType.monero);
1025
+ final moneroWalletsInfo =
1026
+ (await WalletInfo.getAll()).where((info) => info.type == WalletType.monero);
1027
moneroWalletsInfo.forEach((info) async {
1028
try {
1029
final walletPath = await pathForWallet(name: info.name, type: WalletType.monero);
@@ -1078,6 +1084,7 @@ Future<void> fixBtcDerivationPaths() async {
1084
}
1085
}
1086
}
1087
+
1088
Future<void> updateBtcNanoWalletInfos() async {}
1089
// Future<void> updateBtcNanoWalletInfos() async {
1090
// for (WalletInfo walletInfo in await WalletInfo.getAll()) {
@@ -1112,8 +1119,7 @@ Future<void> checkCurrentNodes(
1119
final currentDecredNodeId = sharedPreferences.getInt(PreferencesKey.currentDecredNodeIdKey);
1120
final currentBitcoinCashNodeId =
1121
sharedPreferences.getInt(PreferencesKey.currentBitcoinCashNodeIdKey);
1115
- final currentDogecoinNodeId =
1116
- sharedPreferences.getInt(PreferencesKey.currentDogecoinNodeIdKey);
1122
+ final currentDogecoinNodeId = sharedPreferences.getInt(PreferencesKey.currentDogecoinNodeIdKey);
1123
final currentSolanaNodeId = sharedPreferences.getInt(PreferencesKey.currentSolanaNodeIdKey);
1124
final currentTronNodeId = sharedPreferences.getInt(PreferencesKey.currentTronNodeIdKey);
1125
final currentWowneroNodeId = sharedPreferences.getInt(PreferencesKey.currentWowneroNodeIdKey);
@@ -1165,8 +1171,11 @@ Future<void> checkCurrentNodes(
1171
}
1172
1173
if (currentBitcoinElectrumServer == null) {
1168
- final cakeWalletElectrum =
1169
- Node(uri: cakeWalletBitcoinElectrumUri, type: WalletType.bitcoin, useSSL: false, isEnabledForAutoSwitching: true);
1174
+ final cakeWalletElectrum = Node(
1175
+ uri: cakeWalletBitcoinElectrumUri,
1176
+ type: WalletType.bitcoin,
1177
+ useSSL: false,
1178
+ isEnabledForAutoSwitching: true);
1179
await nodeSource.add(cakeWalletElectrum);
1180
final cakeWalletElectrumTestnet =
1181
Node(uri: publicBitcoinTestnetElectrumUri, type: WalletType.bitcoin, useSSL: false);
@@ -1295,8 +1304,11 @@ Future<void> resetBitcoinElectrumServer(
1304
.firstWhereOrNull((node) => node.uriRaw.toString() == cakeWalletBitcoinElectrumUri);
1305
1306
if (cakeWalletNode == null) {
1298
- cakeWalletNode =
1299
- Node(uri: cakeWalletBitcoinElectrumUri, type: WalletType.bitcoin, useSSL: false, isEnabledForAutoSwitching: true);
1307
+ cakeWalletNode = Node(
1308
+ uri: cakeWalletBitcoinElectrumUri,
1309
+ type: WalletType.bitcoin,
1310
+ useSSL: false,
1311
+ isEnabledForAutoSwitching: true);
1312
// final cakeWalletElectrumTestnet =
1313
// Node(uri: publicBitcoinTestnetElectrumUri, type: WalletType.bitcoin, useSSL: false);
1314
// await nodeSource.add(cakeWalletElectrumTestnet);
@@ -1416,3 +1428,39 @@ Future<void> migrateExistingNodesToUseAutoSwitching(
1428
}
1429
}
1430
1431
+Future<void> _addXautTokenToExistingEthereumWallets() async {
1432
+ try {
1433
+ final xautToken = Erc20Token(
1434
+ name: "Tether Gold",
1435
+ symbol: "XAUT",
1436
+ contractAddress: "0x68749665FF8D2d112Fa859AA293F07A622782F38",
1437
+ decimal: 6,
1438
+ enabled: false,
1439
+ iconPath: "assets/images/xaut_icon.png",
1440
+ );
1441
+
1442
+ final allWallets = await WalletInfo.getAll();
1443
+
1444
+ final ethereumWallets =
1445
+ allWallets.where((wallet) => wallet.type == WalletType.ethereum).toList();
1446
+
1447
+ for (final walletInfo in ethereumWallets) {
1448
+ final sanitizedName = walletInfo.name.replaceAll(' ', '_');
1449
+ final boxName = '${sanitizedName}_${Erc20Token.ethereumBoxName}';
1450
+
1451
+ Box<Erc20Token> tokenBox;
1452
+ if (CakeHive.isBoxOpen(boxName)) {
1453
+ tokenBox = CakeHive.box<Erc20Token>(boxName);
1454
+ } else {
1455
+ tokenBox = await CakeHive.openBox<Erc20Token>(boxName);
1456
+ }
1457
+
1458
+ final xautAddress = xautToken.contractAddress;
1459
+ if (!tokenBox.containsKey(xautAddress)) {
1460
+ await tokenBox.put(xautAddress, xautToken);
1461
+ }
1462
+ }
1463
+ } catch (e) {
1464
+ printV('Error in XAUT migration: $e');
1465
+ }
1466
+}