@@ -38,20 +38,22 @@ function formatUnixTimestamp(timestamp: number): string {
3838}
3939
4040function inferTokenSymbol ( tokenAddress : string ) : string {
41- const known : Record < string , string | undefined > = {
42- USDC : process . env . NEXT_PUBLIC_USDC_ADDRESS ,
43- XLM : process . env . NEXT_PUBLIC_XLM_ADDRESS ,
44- EURC : process . env . NEXT_PUBLIC_EURC_ADDRESS ,
45- } ;
41+ if ( ! tokenAddress ) return "UNKNOWN" ;
4642
4743 const normalized = tokenAddress . toUpperCase ( ) ;
48- for ( const [ symbol , address ] of Object . entries ( known ) ) {
49- if ( address && address . toUpperCase ( ) === normalized ) {
50- return symbol ;
51- }
52- }
5344
54- return "TOKEN" ;
45+ // Improved mapping with FLOW added
46+ if ( normalized . includes ( "FLOW" ) ) return "FLOW" ;
47+ if ( normalized . includes ( "USDC" ) ) return "USDC" ;
48+ if ( normalized . includes ( "USDT" ) ) return "USDT" ;
49+ if ( normalized . includes ( "XLM" ) ) return "XLM" ;
50+ if ( normalized . includes ( "YUSDC" ) ) return "yUSDC" ;
51+ if ( normalized . includes ( "YXLM" ) ) return "yXLM" ;
52+
53+ // Fallback: return original if known, else shorten
54+ return tokenAddress . length > 10
55+ ? tokenAddress . slice ( 0 , 6 ) + "..." + tokenAddress . slice ( - 4 )
56+ : tokenAddress ;
5557}
5658
5759export default function StreamDetailsPage ( { params } : StreamDetailsPageProps ) {
0 commit comments