@@ -42,15 +42,13 @@ export class TransactionService implements ITransactionService {
4242
4343 private readonly transactionHttp : TransactionHttp ;
4444 private readonly receiptHttp : ReceiptHttp ;
45- private readonly listener : Listener ;
4645 /**
4746 * Constructor
4847 * @param url Base catapult-rest url
4948 */
5049 constructor ( url : string ) {
5150 this . transactionHttp = new TransactionHttp ( url ) ;
5251 this . receiptHttp = new ReceiptHttp ( url ) ;
53- this . listener = new Listener ( url ) ;
5452 }
5553
5654 /**
@@ -192,35 +190,39 @@ export class TransactionService implements ITransactionService {
192190
193191 /**
194192 * @param signedTransaction Signed transaction to be announced.
193+ * @param listener Websocket listener
195194 * @returns {Observable<Transaction> }
196195 */
197- public announce ( signedTransaction : SignedTransaction ) : Observable < Transaction > {
196+ public announce ( signedTransaction : SignedTransaction , listener : Listener ) : Observable < Transaction > {
198197 return this . transactionHttp . announce ( signedTransaction ) . pipe (
199- flatMap ( ( ) => this . listener . confirmed ( signedTransaction . getSignerAddress ( ) , signedTransaction . hash ) ) ,
198+ flatMap ( ( ) => listener . confirmed ( signedTransaction . getSignerAddress ( ) , signedTransaction . hash ) ) ,
200199 ) ;
201200 }
202201
203202 /**
204203 * Announce aggregate transaction
205204 * @param signedTransaction Signed aggregate bonded transaction.
205+ * @param listener Websocket listener
206206 * @returns {Observable<AggregateTransaction> }
207207 */
208- public announceAggregateBonded ( signedTransaction : SignedTransaction ) : Observable < AggregateTransaction > {
208+ public announceAggregateBonded ( signedTransaction : SignedTransaction , listener : Listener ) : Observable < AggregateTransaction > {
209209 return this . transactionHttp . announceAggregateBonded ( signedTransaction ) . pipe (
210- flatMap ( ( ) => this . listener . aggregateBondedAdded ( signedTransaction . getSignerAddress ( ) , signedTransaction . hash ) ) ,
210+ flatMap ( ( ) => listener . aggregateBondedAdded ( signedTransaction . getSignerAddress ( ) , signedTransaction . hash ) ) ,
211211 ) ;
212212 }
213213
214214 /**
215215 * Announce aggregate bonded transaction with lock fund
216216 * @param signedHashLockTransaction Signed hash lock transaction.
217217 * @param signedAggregateTransaction Signed aggregate bonded transaction.
218+ * @param listener Websocket listener
218219 * @returns {Observable<AggregateTransaction> }
219220 */
220221 public announceHashLockAggregateBonded ( signedHashLockTransaction : SignedTransaction ,
221- signedAggregateTransaction : SignedTransaction ) : Observable < AggregateTransaction > {
222- return this . announce ( signedHashLockTransaction ) . pipe (
223- flatMap ( ( ) => this . announceAggregateBonded ( signedAggregateTransaction ) ) ,
222+ signedAggregateTransaction : SignedTransaction ,
223+ listener : Listener ) : Observable < AggregateTransaction > {
224+ return this . announce ( signedHashLockTransaction , listener ) . pipe (
225+ flatMap ( ( ) => this . announceAggregateBonded ( signedAggregateTransaction , listener ) ) ,
224226 ) ;
225227
226228 }
0 commit comments