Add electrsApiService cachedRequest function, switch outspends

This commit is contained in:
Mononaut
2023-11-12 06:38:18 +00:00
parent 8aa51c4e80
commit 09f208484a
3 changed files with 45 additions and 3 deletions

View File

@@ -75,7 +75,7 @@ export class TransactionsListComponent implements OnInit, OnChanges {
for (let i = 0; i < txIds.length; i += 50) {
batches.push(txIds.slice(i, i + 50));
}
return forkJoin(batches.map(batch => this.electrsApiService.getOutspendsBatched$(batch)));
return forkJoin(batches.map(batch => { return this.electrsApiService.cachedRequest(this.electrsApiService.getOutspendsBatched$, 250, batch); }));
} else {
return of([]);
}

View File

@@ -124,7 +124,7 @@ export class TxBowtieGraphComponent implements OnInit, OnChanges {
.pipe(
switchMap((txid) => {
if (!this.cached) {
return this.electrsApiService.getOutspendsBatched$([txid]);
return this.electrsApiService.cachedRequest(this.electrsApiService.getOutspendsBatched$, 250, [txid]);
} else {
return of(null);
}