@@ -37,6 +37,7 @@ import { EmbedChainInfos } from "../../../../config";
3737import { DenomHelper } from "@keplr-wallet/common" ;
3838import { TokenTag } from "../../../register/enable-chains/components/chain-item" ;
3939import { SupportedPaymentType } from "@keplr-wallet/types" ;
40+ import { useTokenTag } from "../../../../hooks/use-token-tag" ;
4041
4142export const TokenFoundModal : FunctionComponent < {
4243 close : ( ) => void ;
@@ -514,6 +515,15 @@ const FoundTokenView: FunctionComponent<{
514515 }
515516 } , [ asset . currency , chainId , asset . paymentType ] ) ;
516517
518+ const tag = useTokenTag ( {
519+ token : new CoinPretty ( asset . currency , asset . amount ) ,
520+ chainInfo : chainStore . hasChain ( chainId )
521+ ? chainStore . getChain ( chainId )
522+ : chainStore . getModularChain ( chainId ) ,
523+ isFetching : false ,
524+ error : undefined ,
525+ } ) ;
526+
517527 return (
518528 < Columns sum = { 1 } gutter = "0.5rem" alignY = "center" >
519529 < Box width = "1.5rem" height = "1.5rem" >
@@ -543,35 +553,54 @@ const FoundTokenView: FunctionComponent<{
543553 }
544554 >
545555 { ( ( ) => {
546- if ( chainStore . hasChain ( chainId ) ) {
547- return chainStore
548- . getChain ( chainId )
549- . forceFindCurrency ( asset . currency . coinMinimalDenom ) . coinDenom ;
550- } else {
551- const modularChainInfo = chainStore . getModularChain ( chainId ) ;
552- const isBitcoin = "bitcoin" in modularChainInfo ;
553- const isStarknet = "starknet" in modularChainInfo ;
554- const isCosmos = "cosmos" in modularChainInfo ;
555-
556- if ( isBitcoin || isStarknet || isCosmos ) {
557- return (
558- chainStore
559- . getModularChainInfoImpl ( chainId )
560- . getCurrencies (
561- isBitcoin ? "bitcoin" : isStarknet ? "starknet" : "cosmos"
562- )
563- . find (
564- ( cur ) =>
565- cur . coinMinimalDenom === asset . currency . coinMinimalDenom
566- ) ?. coinDenom ?? asset . currency . coinDenom
567- ) ;
556+ const coinDenom = ( ( ) => {
557+ if ( chainStore . hasChain ( chainId ) ) {
558+ return chainStore
559+ . getChain ( chainId )
560+ . forceFindCurrency ( asset . currency . coinMinimalDenom ) . coinDenom ;
568561 } else {
569- return asset . currency . coinDenom ;
562+ const modularChainInfo = chainStore . getModularChain ( chainId ) ;
563+ const isBitcoin = "bitcoin" in modularChainInfo ;
564+ const isStarknet = "starknet" in modularChainInfo ;
565+ const isCosmos = "cosmos" in modularChainInfo ;
566+
567+ if ( isBitcoin || isStarknet || isCosmos ) {
568+ return (
569+ chainStore
570+ . getModularChainInfoImpl ( chainId )
571+ . getCurrencies (
572+ isBitcoin
573+ ? "bitcoin"
574+ : isStarknet
575+ ? "starknet"
576+ : "cosmos"
577+ )
578+ . find (
579+ ( cur ) =>
580+ cur . coinMinimalDenom ===
581+ asset . currency . coinMinimalDenom
582+ ) ?. coinDenom ?? asset . currency . coinDenom
583+ ) ;
584+ } else {
585+ return asset . currency . coinDenom ;
586+ }
570587 }
588+ } ) ( ) ;
589+
590+ if (
591+ asset . currency . coinMinimalDenom . startsWith ( "ibc/" ) &&
592+ coinDenom
593+ ) {
594+ const cut = coinDenom . indexOf ( " (" ) ;
595+ return cut > 0 ? coinDenom . slice ( 0 , cut ) : coinDenom ;
571596 }
597+ return coinDenom ;
572598 } ) ( ) }
573599 </ Subtitle3 >
574600 { addressTag ? < TokenTag text = { addressTag . text } /> : null }
601+ { tag && tag . text === "IBC" ? (
602+ < TokenTag text = { tag . text } tooltip = { tag . tooltip } />
603+ ) : null }
575604 </ Box >
576605
577606 < Column weight = { 1 } />
@@ -615,6 +644,7 @@ const FoundTokenView: FunctionComponent<{
615644 return uiConfigStore . hideStringIfPrivacyMode (
616645 new CoinPretty ( currency , asset . amount )
617646 . shrink ( true )
647+ . hideIBCMetadata ( true )
618648 . trim ( true )
619649 . maxDecimals ( 6 )
620650 . inequalitySymbol ( true )
0 commit comments