Batch esplora outspends requests

This commit is contained in:
Mononaut
2023-08-16 02:25:48 +09:00
parent 823f06451c
commit 8aa51c4e80
6 changed files with 38 additions and 20 deletions

View File

@@ -138,14 +138,6 @@ export class ApiService {
return this.httpClient.get<number[]>(this.apiBaseUrl + this.apiBasePath + '/api/v1/transaction-times', { params });
}
getOutspendsBatched$(txIds: string[]): Observable<Outspend[][]> {
let params = new HttpParams();
txIds.forEach((txId: string) => {
params = params.append('txId[]', txId);
});
return this.httpClient.get<Outspend[][]>(this.apiBaseUrl + this.apiBasePath + '/api/v1/outspends', { params });
}
getAboutPageProfiles$(): Observable<any[]> {
return this.httpClient.get<any[]>(this.apiBaseUrl + '/api/v1/services/sponsors');
}

View File

@@ -54,6 +54,12 @@ export class ElectrsApiService {
return this.httpClient.get<Outspend[]>(this.apiBaseUrl + this.apiBasePath + '/api/tx/' + hash + '/outspends');
}
getOutspendsBatched$(txids: string[]): Observable<Outspend[][]> {
let params = new HttpParams();
params = params.append('txids', txids.join(','));
return this.httpClient.get<Outspend[][]>(this.apiBaseUrl + this.apiBasePath + '/api/txs/outspends', { params });
}
getBlockTransactions$(hash: string, index: number = 0): Observable<Transaction[]> {
return this.httpClient.get<Transaction[]>(this.apiBaseUrl + this.apiBasePath + '/api/block/' + hash + '/txs/' + index);
}