format swap token symbols
This commit is contained in:
parent
b9ae7aa558
commit
821cc56328
|
@ -11,6 +11,7 @@ import useJupiterMints from 'hooks/useJupiterMints'
|
|||
import useMangoGroup from 'hooks/useMangoGroup'
|
||||
import { PublicKey } from '@solana/web3.js'
|
||||
import FormatNumericValue from '@components/shared/FormatNumericValue'
|
||||
import { formatTokenSymbol } from 'utils/tokens'
|
||||
|
||||
// const generateSearchTerm = (item: Token, searchValue: string) => {
|
||||
// const normalizedSearchValue = searchValue.toLowerCase()
|
||||
|
@ -72,7 +73,7 @@ const TokenItem = ({
|
|||
</picture>
|
||||
<div className="ml-2.5">
|
||||
<p className="text-left text-th-fgd-2">
|
||||
{symbol || 'unknown'}
|
||||
{bank?.name ? formatTokenSymbol(bank.name) : symbol || 'unknown'}
|
||||
{bank?.reduceOnly ? (
|
||||
<span className="ml-1.5 text-xxs text-th-warning">
|
||||
{t('reduce-only')}
|
||||
|
|
|
@ -7,6 +7,7 @@ import useMangoGroup from 'hooks/useMangoGroup'
|
|||
import useJupiterMints from 'hooks/useJupiterMints'
|
||||
import { Bank } from '@blockworks-foundation/mango-v4'
|
||||
import { Dispatch, SetStateAction } from 'react'
|
||||
import { formatTokenSymbol } from 'utils/tokens'
|
||||
|
||||
type TokenSelectProps = {
|
||||
bank: Bank | undefined
|
||||
|
@ -41,7 +42,9 @@ const TokenSelect = ({ bank, showTokenList, type }: TokenSelectProps) => {
|
|||
)}
|
||||
</div>
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<div className="text-xl font-bold text-th-fgd-1">{bank?.name}</div>
|
||||
<div className="text-xl font-bold text-th-fgd-1">
|
||||
{formatTokenSymbol(bank!.name)}
|
||||
</div>
|
||||
<ChevronDownIcon className="h-6 w-6" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -102,5 +102,10 @@ export const fetchNftsFromHolaplexIndexer = async (owner: PublicKey) => {
|
|||
return body.data
|
||||
}
|
||||
|
||||
export const formatTokenSymbol = (symbol: string) =>
|
||||
symbol === 'MSOL' ? 'mSOL' : symbol
|
||||
export const formatTokenSymbol = (symbol: string) => {
|
||||
if (symbol.toLowerCase().includes('portal')) {
|
||||
const truncSymbol = symbol.split(' ')[0]
|
||||
return truncSymbol === 'WBTC' ? 'wBTC' : truncSymbol
|
||||
}
|
||||
return symbol === 'MSOL' ? 'mSOL' : symbol
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue