mirror of
https://github.com/mempool/mempool.git
synced 2025-03-13 11:36:07 +01:00
switch multi-address APIs to use POST
This commit is contained in:
parent
f77dc68ec7
commit
b65d00f289
2 changed files with 10 additions and 6 deletions
|
@ -142,12 +142,16 @@ export class ElectrsApiService {
|
|||
return this.httpClient.get<Transaction[]>(this.apiBaseUrl + this.apiBasePath + '/api/address/' + address + '/txs', { params });
|
||||
}
|
||||
|
||||
getAddressesTransactions$(addresses: string[], txid?: string): Observable<Transaction[]> {
|
||||
getAddressesTransactions$(addresses: string[], txid?: string): Observable<Transaction[]> {
|
||||
let params = new HttpParams();
|
||||
if (txid) {
|
||||
params = params.append('after_txid', txid);
|
||||
}
|
||||
return this.httpClient.get<Transaction[]>(this.apiBaseUrl + this.apiBasePath + `/api/addresses/txs?addresses=${addresses.join(',')}`, { params });
|
||||
return this.httpClient.post<Transaction[]>(
|
||||
this.apiBaseUrl + this.apiBasePath + '/api/addresses/txs',
|
||||
addresses,
|
||||
{ params }
|
||||
);
|
||||
}
|
||||
|
||||
getAddressSummary$(address: string, txid?: string): Observable<AddressTxSummary[]> {
|
||||
|
@ -163,7 +167,7 @@ export class ElectrsApiService {
|
|||
if (txid) {
|
||||
params = params.append('after_txid', txid);
|
||||
}
|
||||
return this.httpClient.get<AddressTxSummary[]>(this.apiBaseUrl + this.apiBasePath + `/api/addresses/txs/summary?addresses=${addresses.join(',')}`, { params });
|
||||
return this.httpClient.post<AddressTxSummary[]>(this.apiBaseUrl + this.apiBasePath + '/api/addresses/txs/summary', addresses, { params });
|
||||
}
|
||||
|
||||
getScriptHashTransactions$(script: string, txid?: string): Observable<Transaction[]> {
|
||||
|
@ -182,7 +186,7 @@ export class ElectrsApiService {
|
|||
params = params.append('after_txid', txid);
|
||||
}
|
||||
return from(Promise.all(scripts.map(script => calcScriptHash$(script)))).pipe(
|
||||
switchMap(scriptHashes => this.httpClient.get<Transaction[]>(this.apiBaseUrl + this.apiBasePath + `/api/scripthashes/txs?scripthashes=${scriptHashes.join(',')}`, { params })),
|
||||
switchMap(scriptHashes => this.httpClient.post<Transaction[]>(this.apiBaseUrl + this.apiBasePath + '/api/scripthashes/txs', scriptHashes, { params })),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -212,7 +216,7 @@ export class ElectrsApiService {
|
|||
params = params.append('after_txid', txid);
|
||||
}
|
||||
return from(Promise.all(scripts.map(script => calcScriptHash$(script)))).pipe(
|
||||
switchMap(scriptHashes => this.httpClient.get<AddressTxSummary[]>(this.apiBaseUrl + this.apiBasePath + `/api/scripthashes/txs/summary?scripthashes=${scriptHashes.join(',')}`, { params })),
|
||||
switchMap(scriptHashes => this.httpClient.post<AddressTxSummary[]>(this.apiBaseUrl + this.apiBasePath + '/api/scripthashes/txs/summary', scriptHashes, { params })),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ export class StateService {
|
|||
mempoolRemovedTransactions$ = new Subject<Transaction>();
|
||||
multiAddressTransactions$ = new Subject<{ [address: string]: { mempool: Transaction[], confirmed: Transaction[], removed: Transaction[] }}>();
|
||||
blockTransactions$ = new Subject<Transaction>();
|
||||
walletTransactions$ = new Subject<Record<string, AddressTxSummary[]>>();
|
||||
walletTransactions$ = new Subject<Transaction[]>();
|
||||
isLoadingWebSocket$ = new ReplaySubject<boolean>(1);
|
||||
isLoadingMempool$ = new BehaviorSubject<boolean>(true);
|
||||
vbytesPerSecond$ = new ReplaySubject<number>(1);
|
||||
|
|
Loading…
Add table
Reference in a new issue