@@ -25,6 +25,7 @@ import {
2525 getAddressUrl ,
2626 getTransactionUrl ,
2727 isTronAddress ,
28+ isTronSpecialAsset ,
2829} from '../utils' ;
2930import { KeyringTypes } from '@metamask/keyring-controller' ;
3031import { toChecksumHexAddress } from '@metamask/controller-utils' ;
@@ -525,4 +526,28 @@ describe('MultiChain utils', () => {
525526 } ) ;
526527 } ) ;
527528 } ) ;
529+
530+ describe ( 'isTronSpecialAsset' , ( ) => {
531+ it ( 'returns false for non-Tron chain ID' , ( ) => {
532+ expect ( isTronSpecialAsset ( 'eip155:1' , 'TRX' ) ) . toBe ( false ) ;
533+ expect ( isTronSpecialAsset ( undefined , 'TRX' ) ) . toBe ( false ) ;
534+ } ) ;
535+
536+ it ( 'returns true if symbol is falsy' , ( ) => {
537+ expect ( isTronSpecialAsset ( 'tron:mainnet' , '' ) ) . toBe ( true ) ;
538+ expect ( isTronSpecialAsset ( 'tron:mainnet' , undefined ) ) . toBe ( true ) ;
539+ } ) ;
540+
541+ it ( 'returns true for known special assets' , ( ) => {
542+ expect ( isTronSpecialAsset ( 'tron:mainnet' , 'energy' ) ) . toBe ( true ) ;
543+ expect ( isTronSpecialAsset ( 'tron:mainnet' , 'bandwidth' ) ) . toBe ( true ) ;
544+ expect ( isTronSpecialAsset ( 'tron:mainnet' , 'trx-in-lock-period' ) ) . toBe ( true ) ;
545+ } ) ;
546+
547+ it ( 'returns false for valid TRON tokens with normal symbols' , ( ) => {
548+ expect ( isTronSpecialAsset ( 'tron:mainnet' , 'TRX' ) ) . toBe ( false ) ;
549+ expect ( isTronSpecialAsset ( 'tron:mainnet' , 'USDT' ) ) . toBe ( false ) ;
550+ expect ( isTronSpecialAsset ( 'tron:mainnet' , 'BTT' ) ) . toBe ( false ) ;
551+ } ) ;
552+ } ) ;
528553} ) ;
0 commit comments