Fix USDT display in mobile wallet (show USDT instead of wUSDT)

User experience improvement:
- Display "USDT" (Tether USD) in UI instead of "wUSDT"
- Backend still uses wUSDT (asset ID 2) for blockchain transactions
- Similar to trcUSDT on Tron - users see USDT, wrapped token works behind the scenes
- Updated all references: symbol, balance keys, transaction logic

This maintains the wrapped token architecture while providing familiar USDT branding.
This commit is contained in:
Claude
2025-11-14 19:06:55 +00:00
parent a7727a9029
commit 5c742e4c90
+14 -14
View File
@@ -55,7 +55,7 @@ const WalletScreen: React.FC = () => {
const [balances, setBalances] = useState<{ [key: string]: string }>({ const [balances, setBalances] = useState<{ [key: string]: string }>({
HEZ: '0.00', HEZ: '0.00',
PEZ: '0.00', PEZ: '0.00',
wUSDT: '0.00', USDT: '0.00',
}); });
const tokens: Token[] = [ const tokens: Token[] = [
@@ -78,9 +78,9 @@ const WalletScreen: React.FC = () => {
isLive: true, isLive: true,
}, },
{ {
symbol: 'wUSDT', symbol: 'USDT',
name: 'Wrapped USDT', name: 'Tether USD',
balance: balances.wUSDT, balance: balances.USDT,
value: '$0.00', value: '$0.00',
change: '+0.00%', change: '+0.00%',
logo: '💵', logo: '💵',
@@ -152,24 +152,24 @@ const WalletScreen: React.FC = () => {
console.log('PEZ asset not found or not accessible'); console.log('PEZ asset not found or not accessible');
} }
// Fetch wUSDT balance (asset ID 2) // Fetch USDT balance (wUSDT - asset ID 2)
let wusdtBalance = '0.00'; let usdtBalance = '0.00';
try { try {
if (api.query.assets?.account) { if (api.query.assets?.account) {
const wusdtAsset: any = await api.query.assets.account(2, selectedAccount.address); const usdtAsset: any = await api.query.assets.account(2, selectedAccount.address);
if (wusdtAsset.isSome) { if (usdtAsset.isSome) {
const wusdtData = wusdtAsset.unwrap(); const usdtData = usdtAsset.unwrap();
wusdtBalance = (Number(wusdtData.balance.toString()) / 1e12).toFixed(2); usdtBalance = (Number(usdtData.balance.toString()) / 1e12).toFixed(2);
} }
} }
} catch (err) { } catch (err) {
console.log('wUSDT asset not found or not accessible'); console.log('USDT asset not found or not accessible');
} }
setBalances({ setBalances({
HEZ: hezBalance, HEZ: hezBalance,
PEZ: pezBalance, PEZ: pezBalance,
wUSDT: wusdtBalance, USDT: usdtBalance,
}); });
} catch (err) { } catch (err) {
console.error('Failed to fetch balances:', err); console.error('Failed to fetch balances:', err);
@@ -283,8 +283,8 @@ const WalletScreen: React.FC = () => {
} else if (selectedToken.symbol === 'PEZ') { } else if (selectedToken.symbol === 'PEZ') {
// Send PEZ asset (asset ID 1) // Send PEZ asset (asset ID 1)
tx = api.tx.assets.transfer(1, recipientAddress, amountInUnits); tx = api.tx.assets.transfer(1, recipientAddress, amountInUnits);
} else if (selectedToken.symbol === 'wUSDT') { } else if (selectedToken.symbol === 'USDT') {
// Send wUSDT asset (asset ID 2) // Send USDT (wUSDT on blockchain - asset ID 2)
tx = api.tx.assets.transfer(2, recipientAddress, amountInUnits); tx = api.tx.assets.transfer(2, recipientAddress, amountInUnits);
} else { } else {
throw new Error('Unsupported token'); throw new Error('Unsupported token');