@@ -20,7 +20,7 @@ import { BlockInfoDTO } from 'symbol-openapi-typescript-fetch-client';
20
20
import * as WebSocket from 'ws' ;
21
21
import { parseObjectProperties } from '../core/format/Utilities' ;
22
22
import { DtoMapping , MultisigChildrenTreeObject , MultisigGraphUtils } from '../core/utils' ;
23
- import { MultisigAccountInfo , UnresolvedAddress } from '../model' ;
23
+ import { MultisigAccountInfo , NamespaceId , UnresolvedAddress } from '../model' ;
24
24
import { Address } from '../model/account/Address' ;
25
25
import { PublicAccount } from '../model/account/PublicAccount' ;
26
26
import { FinalizedBlock } from '../model/blockchain/FinalizedBlock' ;
@@ -270,7 +270,6 @@ export class Listener implements IListener {
270
270
return this . messageSubject . asObservable ( ) . pipe (
271
271
share ( ) ,
272
272
filter ( ( _ ) => _ . channelName === ListenerChannelName . block ) ,
273
- filter ( ( _ ) => _ . message instanceof NewBlock ) ,
274
273
map ( ( _ ) => _ . message as NewBlock ) ,
275
274
) ;
276
275
}
@@ -287,7 +286,6 @@ export class Listener implements IListener {
287
286
return this . messageSubject . asObservable ( ) . pipe (
288
287
share ( ) ,
289
288
filter ( ( _ ) => _ . channelName === ListenerChannelName . finalizedBlock ) ,
290
- filter ( ( _ ) => _ . message instanceof FinalizedBlock ) ,
291
289
map ( ( _ ) => _ . message as FinalizedBlock ) ,
292
290
) ;
293
291
}
@@ -360,7 +358,6 @@ export class Listener implements IListener {
360
358
switchMap ( ( subscribers ) => {
361
359
return this . messageSubject . asObservable ( ) . pipe (
362
360
filter ( ( listenerMessage ) => listenerMessage . channelName === channel ) ,
363
- filter ( ( listenerMessage ) => listenerMessage . message instanceof Transaction ) ,
364
361
distinctUntilChanged ( ( prev , curr ) => {
365
362
const currentHash = ( curr . message as Transaction ) . transactionInfo ! . hash ;
366
363
const previousHash = ( prev . message as Transaction ) . transactionInfo ! . hash ;
@@ -470,7 +467,6 @@ export class Listener implements IListener {
470
467
this . subscribeTo ( `status/${ address . plain ( ) } ` ) ;
471
468
return this . messageSubject . asObservable ( ) . pipe (
472
469
filter ( ( _ ) => _ . channelName === ListenerChannelName . status ) ,
473
- filter ( ( _ ) => _ . message instanceof TransactionStatusError ) ,
474
470
filter ( ( _ ) => _ . channelParam . toUpperCase ( ) === address . plain ( ) ) ,
475
471
map ( ( _ ) => _ . message as TransactionStatusError ) ,
476
472
filter ( ( _ ) => ! transactionHash || _ . hash . toUpperCase ( ) == transactionHash . toUpperCase ( ) ) ,
@@ -507,7 +503,6 @@ export class Listener implements IListener {
507
503
switchMap ( ( subscribers ) => {
508
504
return this . messageSubject . asObservable ( ) . pipe (
509
505
filter ( ( _ ) => _ . channelName . toUpperCase ( ) === ListenerChannelName . cosignature . toUpperCase ( ) ) ,
510
- filter ( ( _ ) => _ . message instanceof CosignatureSignedTransaction ) ,
511
506
filter ( ( _ ) => subscribers . includes ( _ . channelParam . toUpperCase ( ) ) ) ,
512
507
map ( ( _ ) => _ . message as CosignatureSignedTransaction ) ,
513
508
) ;
@@ -535,20 +530,18 @@ export class Listener implements IListener {
535
530
* @returns {Address }
536
531
*/
537
532
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 ) ;
540
535
}
541
536
542
- return this . namespaceRepository . getLinkedAddress ( unresolvedAddress ) . pipe (
537
+ const namespaceId = unresolvedAddress as NamespaceId ;
538
+ return this . namespaceRepository . getLinkedAddress ( namespaceId ) . pipe (
543
539
map ( ( address ) => {
544
540
if ( ! address ) {
545
- throw new Error ( `Invalid unresolvedAddress: ${ unresolvedAddress . toHex ( ) } ` ) ;
541
+ throw new Error ( `Invalid unresolvedAddress: ${ namespaceId . toHex ( ) } ` ) ;
546
542
}
547
543
return address ;
548
544
} ) ,
549
- catchError ( ( err ) => {
550
- throw new Error ( err ) ;
551
- } ) ,
552
545
) ;
553
546
}
554
547
0 commit comments