Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions src/infrastructure/Listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class Listener {
share(),
filter((_) => _.channelName === ListenerChannelName.block),
filter((_) => _.message instanceof BlockInfo),
map((_) => _.message as BlockInfo),);
map((_) => _.message as BlockInfo));
}

/**
Expand All @@ -206,7 +206,7 @@ export class Listener {
filter((_) => _.channelName === ListenerChannelName.confirmedAdded),
filter((_) => _.message instanceof Transaction),
map((_) => _.message as Transaction),
filter((_) => this.transactionFromAddress(_, address)),);
filter((_) => this.transactionFromAddress(_, address)));
}

/**
Expand All @@ -223,7 +223,7 @@ export class Listener {
filter((_) => _.channelName === ListenerChannelName.unconfirmedAdded),
filter((_) => _.message instanceof Transaction),
map((_) => _.message as Transaction),
filter((_) => this.transactionFromAddress(_, address)),);
filter((_) => this.transactionFromAddress(_, address)));
}

/**
Expand All @@ -239,7 +239,7 @@ export class Listener {
return this.messageSubject.asObservable().pipe(
filter((_) => _.channelName === ListenerChannelName.unconfirmedRemoved),
filter((_) => typeof _.message === 'string'),
map((_) => _.message as string),);
map((_) => _.message as string));
}

/**
Expand All @@ -256,7 +256,7 @@ export class Listener {
filter((_) => _.channelName === ListenerChannelName.aggregateBondedAdded),
filter((_) => _.message instanceof AggregateTransaction),
map((_) => _.message as AggregateTransaction),
filter((_) => this.transactionFromAddress(_, address)),);
filter((_) => this.transactionFromAddress(_, address)));
}

/**
Expand All @@ -272,7 +272,7 @@ export class Listener {
return this.messageSubject.asObservable().pipe(
filter((_) => _.channelName === ListenerChannelName.aggregateBondedRemoved),
filter((_) => typeof _.message === 'string'),
map((_) => _.message as string),);
map((_) => _.message as string));
}

/**
Expand All @@ -288,7 +288,7 @@ export class Listener {
return this.messageSubject.asObservable().pipe(
filter((_) => _.channelName === ListenerChannelName.status),
filter((_) => _.message instanceof TransactionStatusError),
map((_) => _.message as TransactionStatusError),);
map((_) => _.message as TransactionStatusError));
}

/**
Expand All @@ -304,7 +304,7 @@ export class Listener {
return this.messageSubject.asObservable().pipe(
filter((_) => _.channelName === ListenerChannelName.cosignature),
filter((_) => _.message instanceof CosignatureSignedTransaction),
map((_) => _.message as CosignatureSignedTransaction),);
map((_) => _.message as CosignatureSignedTransaction));
}

/**
Expand All @@ -320,6 +320,18 @@ export class Listener {
this.webSocket.send(JSON.stringify(subscriptionMessage));
}

/**
* @internal
* @param channel - Channel to unsubscribe
*/
private unsubscribeTo(channel: string) {
const unsubscribeMessage = {
uid: this.uid,
unsubscribe: channel,
};
this.webSocket.send(JSON.stringify(unsubscribeMessage));
}

/**
* @internal
* Filters if a transaction has been initiated or signed by an address
Expand Down