Add electrsApiService cachedRequest function, switch outspends

This commit is contained in:
Mononaut committed 2023-11-12 07:03:28 +00:00
1 parent 8aa51c4e80
commit 09f208484a
3 files changed
+45 -3

No files matched your search

@@ -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([]);
}
@@ -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);
}