File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,17 +104,23 @@ export const fetchRwaStats = async (): Promise<RwaStats> => {
104104 volume24hUSD : sum ( ( asset ) => asset . stats ?. volume24hUSD ) ,
105105 } ;
106106
107- // Guard against a partial/empty payload leaving a field at zero.
107+ // Guard against a partial/empty payload: if no relevant assets surfaced,
108+ // all derived aggregates would be zero/stale so fall back entirely.
109+ if ( stats . totalAssets === 0 ) {
110+ return FALLBACK_STATS ;
111+ }
112+
108113 return {
109114 treasuries : stats . treasuries || FALLBACK_STATS . treasuries ,
110115 etfs : stats . etfs || FALLBACK_STATS . etfs ,
111116 commodities : stats . commodities || FALLBACK_STATS . commodities ,
112117 stocks : stats . stocks || FALLBACK_STATS . stocks ,
113- totalAssets : stats . totalAssets || FALLBACK_STATS . totalAssets ,
118+ totalAssets : stats . totalAssets ,
114119 totalValueUSD : stats . totalValueUSD || FALLBACK_STATS . totalValueUSD ,
115- volume24hUSD : stats . volume24hUSD || FALLBACK_STATS . volume24hUSD ,
120+ volume24hUSD : stats . volume24hUSD ,
116121 } ;
117- } catch {
122+ } catch ( err ) {
123+ console . error ( "[fetchRwaStats] failed, using fallback stats:" , err ) ;
118124 return FALLBACK_STATS ;
119125 } finally {
120126 clearTimeout ( timeout ) ;
You can’t perform that action at this time.
0 commit comments