Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/images/xau_sol.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions cw_solana/lib/default_spl_tokens.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ class DefaultSPLTokens {
iconPath: 'assets/images/avdo_icon.png',
enabled: false,
),
SPLToken(
name: "Tether Gold",
symbol: "XAUT0",
mintAddress: "AymATz4TCL9sWNEEV9Kvyz45CHVhDZ6kUgjTJPzLpU9P",
decimal: 6,
mint: 'xaut0',
enabled: false,
iconPath: "assets/images/xau_sol.png",
),
SPLToken(
name: 'Abbott xStock',
symbol: 'ABTx',
Expand Down
40 changes: 40 additions & 0 deletions lib/entities/default_settings_migration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import 'package:cake_wallet/entities/sync_status_display_mode.dart';
import 'package:cake_wallet/wownero/wownero.dart';
import 'package:cw_core/pathForWallet.dart';
import 'package:cw_core/root_dir.dart';
import 'package:cw_core/spl_token.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wallet_type.dart';
Expand Down Expand Up @@ -611,6 +612,9 @@ Future<void> defaultSettingsMigration(
enabled: false,
);
break;
case 63:
await _addXaut0TokenToExistingSolanaWallets();
break;
default:
break;
}
Expand Down Expand Up @@ -1489,3 +1493,39 @@ Future<void> _addXautTokenToExistingEthereumWallets() async {
printV('Error in XAUT migration: $e');
}
}
Future<void> _addXaut0TokenToExistingSolanaWallets() async {
try {
final xaut0Token = SPLToken(
name: "Tether Gold",
symbol: "XAUT0",
mintAddress: "AymATz4TCL9sWNEEV9Kvyz45CHVhDZ6kUgjTJPzLpU9P",
decimal: 6,
mint: 'xaut0',
enabled: false,
iconPath: "assets/images/xau_sol.png",
);

final allWallets = await WalletInfo.getAll();

final solanaWallets = allWallets.where((wallet) => wallet.type == WalletType.solana).toList();

for (final walletInfo in solanaWallets) {
final sanitizedName = walletInfo.name.replaceAll(' ', '_');
final boxName = '${sanitizedName}_${SPLToken.boxName}';

Box<SPLToken> tokenBox;
if (CakeHive.isBoxOpen(boxName)) {
tokenBox = CakeHive.box<SPLToken>(boxName);
} else {
tokenBox = await CakeHive.openBox<SPLToken>(boxName);
}

final xaut0Address = xaut0Token.mintAddress;
if (!tokenBox.containsKey(xaut0Address)) {
await tokenBox.put(xaut0Address, xaut0Token);
}
}
} catch (e) {
printV('Error in XAUT0 migration: $e');
}
}
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ Future<void> initializeAppConfigs({bool loadWallet = true}) async {
payjoinSessionSource: payjoinSessionSource,
anonpayInvoiceInfo: anonpayInvoiceInfo,
havenSeedStore: havenSeedStore,
initialMigrationVersion: 62,
initialMigrationVersion: 63,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class AssetDetailsModal extends StatelessWidget {
child: Stack(
children: [
if (iconPath.isNotEmpty)
Image.asset(iconPath, width: 75, height: 75)
CakeImageWidget(imageUrl: iconPath, width: 75, height: 75)
else
Container(
width: 75,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class AssetTile extends StatelessWidget {
child: Stack(
children: [
if((iconPath).isNotEmpty)
Image.asset(iconPath)
CakeImageWidget(imageUrl: iconPath)
else
Container(
width: 45,
Expand Down
Loading