fix(mobile-app): fetch wallet address from server API instead of local storage

The wallet address displayed in long-press mode was incorrectly showing
another user's address from local storage cache. Now fetches the correct
address from the /me API endpoint for the currently logged-in user.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-04 10:00:33 -08:00
parent cb35f21661
commit 04545c86a5
1 changed files with 17 additions and 3 deletions

View File

@ -99,14 +99,28 @@ class _DepositUsdtPageState extends ConsumerState<DepositUsdtPage> {
final walletService = ref.read(walletServiceProvider);
final walletResponse = await walletService.getMyWallet();
//
final walletAddresses = await accountService.getWalletAddresses();
// API
// 使
String? kavaAddress;
try {
final meResponse = await accountService.getMe();
// walletAddresses KAVA
for (final addr in meResponse.walletAddresses) {
if (addr.chainType.toUpperCase() == 'KAVA') {
kavaAddress = addr.address;
break;
}
}
debugPrint('[DepositUsdtPage] 从服务器获取 KAVA 地址: $kavaAddress');
} catch (e) {
debugPrint('[DepositUsdtPage] 获取钱包地址失败: $e');
}
// USDT
if (mounted) {
setState(() {
_balance = walletResponse.balances.usdt.available.toStringAsFixed(2);
_realWalletAddress = walletAddresses?.kava;
_realWalletAddress = kavaAddress;
_isLoading = false;
});
}