@@ -20,7 +20,7 @@ import { BlockInfoDTO } from 'symbol-openapi-typescript-fetch-client';
2020import * as WebSocket from 'ws' ;
2121import { parseObjectProperties } from '../core/format/Utilities' ;
2222import { DtoMapping , MultisigChildrenTreeObject , MultisigGraphUtils } from '../core/utils' ;
23- import { MultisigAccountInfo , UnresolvedAddress } from '../model' ;
23+ import { MultisigAccountInfo , NamespaceId , UnresolvedAddress } from '../model' ;
2424import { Address } from '../model/account/Address' ;
2525import { PublicAccount } from '../model/account/PublicAccount' ;
2626import { FinalizedBlock } from '../model/blockchain/FinalizedBlock' ;
@@ -270,7 +270,6 @@ export class Listener implements IListener {
270270 return this . messageSubject . asObservable ( ) . pipe (
271271 share ( ) ,
272272 filter ( ( _ ) => _ . channelName === ListenerChannelName . block ) ,
273- filter ( ( _ ) => _ . message instanceof NewBlock ) ,
274273 map ( ( _ ) => _ . message as NewBlock ) ,
275274 ) ;
276275 }
@@ -287,7 +286,6 @@ export class Listener implements IListener {
287286 return this . messageSubject . asObservable ( ) . pipe (
288287 share ( ) ,
289288 filter ( ( _ ) => _ . channelName === ListenerChannelName . finalizedBlock ) ,
290- filter ( ( _ ) => _ . message instanceof FinalizedBlock ) ,
291289 map ( ( _ ) => _ . message as FinalizedBlock ) ,
292290 ) ;
293291 }
@@ -360,7 +358,6 @@ export class Listener implements IListener {
360358 switchMap ( ( subscribers ) => {
361359 return this . messageSubject . asObservable ( ) . pipe (
362360 filter ( ( listenerMessage ) => listenerMessage . channelName === channel ) ,
363- filter ( ( listenerMessage ) => listenerMessage . message instanceof Transaction ) ,
364361 distinctUntilChanged ( ( prev , curr ) => {
365362 const currentHash = ( curr . message as Transaction ) . transactionInfo ! . hash ;
366363 const previousHash = ( prev . message as Transaction ) . transactionInfo ! . hash ;
@@ -470,7 +467,6 @@ export class Listener implements IListener {
470467 this . subscribeTo ( `status/${ address . plain ( ) } ` ) ;
471468 return this . messageSubject . asObservable ( ) . pipe (
472469 filter ( ( _ ) => _ . channelName === ListenerChannelName . status ) ,
473- filter ( ( _ ) => _ . message instanceof TransactionStatusError ) ,
474470 filter ( ( _ ) => _ . channelParam . toUpperCase ( ) === address . plain ( ) ) ,
475471 map ( ( _ ) => _ . message as TransactionStatusError ) ,
476472 filter ( ( _ ) => ! transactionHash || _ . hash . toUpperCase ( ) == transactionHash . toUpperCase ( ) ) ,
@@ -507,7 +503,6 @@ export class Listener implements IListener {
507503 switchMap ( ( subscribers ) => {
508504 return this . messageSubject . asObservable ( ) . pipe (
509505 filter ( ( _ ) => _ . channelName . toUpperCase ( ) === ListenerChannelName . cosignature . toUpperCase ( ) ) ,
510- filter ( ( _ ) => _ . message instanceof CosignatureSignedTransaction ) ,
511506 filter ( ( _ ) => subscribers . includes ( _ . channelParam . toUpperCase ( ) ) ) ,
512507 map ( ( _ ) => _ . message as CosignatureSignedTransaction ) ,
513508 ) ;
@@ -535,20 +530,18 @@ export class Listener implements IListener {
535530 * @returns {Address }
536531 */
537532 private getResolvedAddress ( unresolvedAddress : UnresolvedAddress ) : Observable < Address > {
538- if ( unresolvedAddress instanceof Address ) {
539- return of ( unresolvedAddress ) ;
533+ if ( unresolvedAddress . isAddress ( ) ) {
534+ return of ( unresolvedAddress as Address ) ;
540535 }
541536
542- return this . namespaceRepository . getLinkedAddress ( unresolvedAddress ) . pipe (
537+ const namespaceId = unresolvedAddress as NamespaceId ;
538+ return this . namespaceRepository . getLinkedAddress ( namespaceId ) . pipe (
543539 map ( ( address ) => {
544540 if ( ! address ) {
545- throw new Error ( `Invalid unresolvedAddress: ${ unresolvedAddress . toHex ( ) } ` ) ;
541+ throw new Error ( `Invalid unresolvedAddress: ${ namespaceId . toHex ( ) } ` ) ;
546542 }
547543 return address ;
548544 } ) ,
549- catchError ( ( err ) => {
550- throw new Error ( err ) ;
551- } ) ,
552545 ) ;
553546 }
554547
0 commit comments