Skip to content

Commit

Permalink
Avoid calling utxo endpoint without addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
lserra-iov authored and ronaldsg20 committed Nov 17, 2023
1 parent 1203749 commit 9da11cb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/common/services/ApiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ export default class ApiService {

public static getUtxos(addressList: string[]): Promise<BlockbookUtxo[]> {
return new Promise<BlockbookUtxo[]>((resolve, reject) => {
axios.post(`${ApiService.baseURL}/utxo`, { addressList })
.then((response) => resolve(response.data.data))
.catch(reject);
if (addressList.length > 0) {
axios.post(`${ApiService.baseURL}/utxo`, { addressList })
.then((response) => resolve(response.data.data))
.catch(reject);
} else {
resolve([]);
}
});
}

Expand Down

0 comments on commit 9da11cb

Please sign in to comment.