Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/infrastructure/BlockHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class BlockHttp extends Http implements BlockRepository {
* @returns Observable<BlockInfo>
*/
public getBlockByHeight(height: UInt64): Observable<BlockInfo> {
return this.call(this.blockRoutesApi.getBlockByHeight(height.toString()), (body) => this.toBlockInfo(body));
return this.call(this.blockRoutesApi.getBlockByHeight(height.toString()), (body) => BlockHttp.toBlockInfo(body));
}

/**
Expand Down Expand Up @@ -87,7 +87,7 @@ export class BlockHttp extends Http implements BlockRepository {
*/
public getBlocksByHeightWithLimit(height: UInt64, limit: number): Observable<BlockInfo[]> {
return this.call(this.blockRoutesApi.getBlocksByHeightWithLimit(height.toString(), limit), (body) =>
body.map((blockDTO) => this.toBlockInfo(blockDTO)),
body.map((blockDTO) => BlockHttp.toBlockInfo(blockDTO)),
);
}

Expand All @@ -98,7 +98,7 @@ export class BlockHttp extends Http implements BlockRepository {
* @param {BlockInfoDTO} dto the dto object from rest.
* @returns {BlockInfo} a BlockInfo model
*/
private toBlockInfo(dto: BlockInfoDTO): BlockInfo {
public static toBlockInfo(dto: BlockInfoDTO): BlockInfo {
const networkType = dto.block.network.valueOf();
return new BlockInfo(
dto.meta.hash,
Expand Down
12 changes: 8 additions & 4 deletions src/infrastructure/IListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,21 @@ export interface IListener {
* it emits a new Transaction in the event stream.
*
* @param address address we listen when a transaction is in unconfirmed state
* @param transactionHash transactionHash for filtering multiple transactions
* @return an observable stream of Transaction with state unconfirmed
*/
unconfirmedAdded(address: Address): Observable<Transaction>;
unconfirmedAdded(address: Address, transactionHash?: string): Observable<Transaction>;

/**
* Returns an observable stream of Transaction Hashes for specific address.
* Each time a transaction with state unconfirmed changes its state,
* it emits a new message with the transaction hash in the event stream.
*
* @param address address we listen when a transaction is removed from unconfirmed state
* @param transactionHash the transaction hash filter.
* @return an observable stream of Strings with the transaction hash
*/
unconfirmedRemoved(address: Address): Observable<string>;
unconfirmedRemoved(address: Address, transactionHash?: string): Observable<string>;

/**
* Return an observable of {@link AggregateTransaction} for specific address.
Expand All @@ -102,19 +104,21 @@ export interface IListener {
* it emits a new message with the transaction hash in the event stream.
*
* @param address address we listen when a transaction is confirmed or rejected
* @param transactionHash the transaction hash filter.
* @return an observable stream of Strings with the transaction hash
*/
aggregateBondedRemoved(address: Address): Observable<string>;
aggregateBondedRemoved(address: Address, transactionHash?: string): Observable<string>;

/**
* Returns an observable stream of {@link TransactionStatusError} for specific address.
* Each time a transaction contains an error,
* it emits a new message with the transaction status error in the event stream.
*
* @param address address we listen to be notified when some error happened
* @param transactionHash transactionHash for filtering multiple transactions
* @return an observable stream of {@link TransactionStatusError}
*/
status(address: Address): Observable<TransactionStatusError>;
status(address: Address, transactionHash?: string): Observable<TransactionStatusError>;

/**
* Returns an observable stream of {@link CosignatureSignedTransaction} for specific address.
Expand Down
Loading