@@ -10,10 +10,7 @@ import { MPT_ROUTE } from '../../App/routes'
1010import SocketContext from '../../shared/SocketContext'
1111import { getMPTIssuance } from '../../../rippled/lib/rippled'
1212import { parseVaultWebsite } from '../utils'
13- import {
14- shortenVaultID ,
15- shortenAccount ,
16- } from '../../shared/utils'
13+ import { shortenVaultID , shortenAccount } from '../../shared/utils'
1714import './styles.scss'
1815import { useAnalytics } from '../../shared/analytics'
1916import { parseAmount } from '../../shared/NumberFormattingUtils'
@@ -63,7 +60,11 @@ export const VaultHeader = ({ data, vaultId, displayCurrency }: Props) => {
6360 const { t } = useTranslation ( )
6461 const { trackException } = useAnalytics ( )
6562 const rippledSocket = useContext ( SocketContext )
66- const { rate : tokenToUsdRate } = useTokenToUSDRate ( data . Asset )
63+ const { rate : tokenToUsdRate } = useTokenToUSDRate (
64+ data . Asset ?. currency
65+ ? { currency : data . Asset . currency , issuer : data . Asset . issuer }
66+ : undefined ,
67+ )
6768
6869 const {
6970 Owner : owner ,
@@ -271,7 +272,11 @@ export const VaultHeader = ({ data, vaultId, displayCurrency }: Props) => {
271272 }
272273 const amount = convertedAmount ?? assetsTotal
273274 if ( amount === undefined ) return '--'
274- if ( [ '0' , '0.00' , '0.0000' ] . includes ( parseAmount ( amount ?? '0' , 2 ) ) )
275+ if (
276+ [ '0' , '0.00' , '0.0000' ] . includes (
277+ parseAmount ( amount ?? '0' , 2 ) ,
278+ )
279+ )
275280 return '--'
276281 // Note: As per the NumberFormat policy, prices in the range of [10_000, 1M] do not display decimal values
277282 // Very large prices (greater than 1M must have two decimal places)
@@ -284,14 +289,12 @@ export const VaultHeader = ({ data, vaultId, displayCurrency }: Props) => {
284289 < TokenTableRow
285290 label = { t ( 'max_total_supply' ) }
286291 value = { ( ( ) => {
287- if ( assetsMaximum === undefined )
288- return t ( 'no_limit' )
292+ if ( assetsMaximum === undefined ) return t ( 'no_limit' )
289293
290294 const parsedAmt = parseAmount ( assetsMaximum , 2 )
291- if ( [ '0' , '0.00' , '0.0000' ] . includes ( parsedAmt ) )
292- return '--'
295+ if ( [ '0' , '0.00' , '0.0000' ] . includes ( parsedAmt ) ) return '--'
293296
294- return parsedAmt + ' ' + getAssetCurrency ( asset )
297+ return ` ${ parsedAmt } ${ getAssetCurrency ( asset ) } `
295298 } ) ( ) }
296299 />
297300 < TokenTableRow
@@ -302,18 +305,16 @@ export const VaultHeader = ({ data, vaultId, displayCurrency }: Props) => {
302305 label = { t ( 'available_to_borrow' ) }
303306 value = { ( ( ) => {
304307 const parsedAmt = parseAmount ( assetsAvailable ?? '0' , 2 )
305- if ( [ '0' , '0.00' , '0.0000' ] . includes ( parsedAmt ) )
306- return '--'
307- return parsedAmt + ' ' + getAssetCurrency ( asset )
308+ if ( [ '0' , '0.00' , '0.0000' ] . includes ( parsedAmt ) ) return '--'
309+ return `${ parsedAmt } ${ getAssetCurrency ( asset ) } `
308310 } ) ( ) }
309311 />
310312 < TokenTableRow
311313 label = { t ( 'unrealized_loss' ) }
312314 value = { ( ( ) => {
313315 const parsedAmt = parseAmount ( lossUnrealized ?? '0' , 2 )
314- if ( [ '0' , '0.00' , '0.0000' ] . includes ( parsedAmt ) )
315- return '--'
316- return parsedAmt + ' ' + getAssetCurrency ( asset )
316+ if ( [ '0' , '0.00' , '0.0000' ] . includes ( parsedAmt ) ) return '--'
317+ return `${ parsedAmt } ${ getAssetCurrency ( asset ) } `
317318 } ) ( ) }
318319 />
319320 </ tbody >
0 commit comments