@@ -605,68 +605,27 @@ export default class MarketsPage extends BasePage {
605605 isSupported : boolean ;
606606 text : string ;
607607 } {
608- const { market } = this
609- const [ base , quote ] = [ market . base , market . quote ]
608+ const { market : { base, quote, baseCfg, quoteCfg } } = this
610609 if ( ! base || ! quote ) {
611- const symbol = market . base ? market . quoteCfg . symbol : market . baseCfg . symbol
610+ const symbol = base ? quoteCfg . symbol : baseCfg . symbol
612611 return {
613612 isSupported : false ,
614613 text : intl . prep ( intl . ID_NOT_SUPPORTED , { asset : symbol . toUpperCase ( ) } )
615614 }
616615 }
617- const { baseCfg, quoteCfg } = this . market
618616 // check if versions are supported. If asset is a token, we check if its
619617 // parent supports the version.
620- let text = ''
621- if ( base . token && quote . token ) {
622- const bParent = app ( ) . assets [ base . token . parentID ]
623- const qParent = app ( ) . assets [ quote . token . parentID ]
624- if ( ! bParent . info ?. versions . includes ( baseCfg . version ) ) {
625- text = intl . prep ( intl . ID_VERSION_NOT_SUPPORTED , { asset : bParent . symbol . toUpperCase ( ) , version : baseCfg . version + '' } )
626- }
627- if ( ! qParent . info ?. versions . includes ( quoteCfg . version ) ) {
628- text = intl . prep ( intl . ID_VERSION_NOT_SUPPORTED , { asset : qParent . symbol . toUpperCase ( ) , version : quoteCfg . version + '' } )
629- }
630- return {
631- isSupported : ! ! qParent . info ?. versions . includes ( quoteCfg . version ) && ! ! bParent . info ?. versions . includes ( baseCfg . version ) ,
632- text
633- }
634- }
635- if ( base . token ) {
636- const bParent = app ( ) . assets [ base . token . parentID ]
637- if ( ! bParent . info ?. versions . includes ( baseCfg . version ) ) {
638- text = intl . prep ( intl . ID_VERSION_NOT_SUPPORTED , { asset : bParent . symbol . toUpperCase ( ) , version : baseCfg . version + '' } )
639- }
640- if ( ! quote . info ?. versions . includes ( quoteCfg . version ) ) {
641- text = intl . prep ( intl . ID_VERSION_NOT_SUPPORTED , { asset : quote . symbol . toUpperCase ( ) , version : quoteCfg . version + '' } )
642- }
643- return {
644- isSupported : ! ! quote . info ?. versions . includes ( quoteCfg . version ) && ! ! bParent . info ?. versions . includes ( baseCfg . version ) ,
645- text
646- }
647- }
648- if ( quote . token ) {
649- const qParent = app ( ) . assets [ quote . token . parentID ]
650- if ( ! base . info ?. versions . includes ( baseCfg . version ) ) {
651- text = intl . prep ( intl . ID_VERSION_NOT_SUPPORTED , { asset : base . symbol . toUpperCase ( ) , version : baseCfg . version + '' } )
652- }
653- if ( ! qParent . info ?. versions . includes ( quoteCfg . version ) ) {
654- text = intl . prep ( intl . ID_VERSION_NOT_SUPPORTED , { asset : quote . symbol . toUpperCase ( ) , version : quoteCfg . version + '' } )
655- }
656- return {
657- isSupported : ! ! base . info ?. versions . includes ( baseCfg . version ) && ! ! qParent . info ?. versions . includes ( quoteCfg . version ) ,
658- text
659- }
660- }
618+ const bVers = ( base . token ? app ( ) . assets [ base . token . parentID ] . info ?. versions : base . info ?. versions ) as number [ ]
619+ const qVers = ( quote . token ? app ( ) . assets [ quote . token . parentID ] . info ?. versions : quote . info ?. versions ) as number [ ]
661620 // if none them are token, just check if own asset is supported.
662- if ( ! base . info ?. versions . includes ( baseCfg . version ) ) {
621+ let text = ''
622+ if ( ! bVers . includes ( baseCfg . version ) ) {
663623 text = intl . prep ( intl . ID_VERSION_NOT_SUPPORTED , { asset : base . symbol . toUpperCase ( ) , version : baseCfg . version + '' } )
664- }
665- if ( ! quote . info ?. versions . includes ( quoteCfg . version ) ) {
624+ } else if ( ! qVers . includes ( quoteCfg . version ) ) {
666625 text = intl . prep ( intl . ID_VERSION_NOT_SUPPORTED , { asset : quote . symbol . toUpperCase ( ) , version : quoteCfg . version + '' } )
667626 }
668627 return {
669- isSupported : ! ! base . info ?. versions . includes ( baseCfg . version ) && ! ! quote . info ?. versions . includes ( quoteCfg . version ) ,
628+ isSupported : bVers . includes ( baseCfg . version ) && qVers . includes ( quoteCfg . version ) ,
670629 text
671630 }
672631 }
0 commit comments