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:
parent
cb35f21661
commit
04545c86a5
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue