Update local cpfp API to accept array of transactions

This commit is contained in:
natsoni
2025-01-08 15:07:37 +01:00
parent af0c78be81
commit 6c95cd2149
4 changed files with 20 additions and 16 deletions

View File

@@ -154,17 +154,17 @@ export class TransactionRawComponent implements OnInit, OnDestroy {
if (this.hasPrevouts && this.fetchCpfp) {
try {
this.isLoadingCpfpInfo = true;
const cpfpInfo: CpfpInfo = await firstValueFrom(this.apiService.getCpfpLocalTx$({
const cpfpInfo: CpfpInfo[] = await firstValueFrom(this.apiService.getCpfpLocalTx$([{
txid: transaction.txid,
weight: transaction.weight,
sigops: transaction.sigops,
fee: transaction.fee,
vin: transaction.vin,
vout: transaction.vout
}));
}]));
if (cpfpInfo && cpfpInfo.ancestors.length > 0) {
const { ancestors, effectiveFeePerVsize } = cpfpInfo;
if (cpfpInfo?.[0]?.ancestors?.length) {
const { ancestors, effectiveFeePerVsize } = cpfpInfo[0];
transaction.effectiveFeePerVsize = effectiveFeePerVsize;
this.cpfpInfo = { ancestors, effectiveFeePerVsize };
this.hasCpfp = true;

View File

@@ -569,8 +569,8 @@ export class ApiService {
return this.httpClient.post(this.apiBaseUrl + this.apiBasePath + '/api/v1/prevouts', outpoints);
}
getCpfpLocalTx$(tx: any): Observable<CpfpInfo> {
return this.httpClient.post<CpfpInfo>(this.apiBaseUrl + this.apiBasePath + '/api/v1/cpfp', tx);
getCpfpLocalTx$(tx: any[]): Observable<CpfpInfo[]> {
return this.httpClient.post<CpfpInfo[]>(this.apiBaseUrl + this.apiBasePath + '/api/v1/cpfp', tx);
}
// Cache methods