Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async getFee(blocks = NB_BLOCKS, toBTC) {
const url = `${this.network}/utils/estimatefee?nbBlocks=${blocks}`;
const response = await axios.get(url);
if (response.status === 200) {
let txFee = '';
if (toBTC) {
txFee = bitcore.Unit.fromBTC(response.data[blocks]).toBTC();
} else {
txFee = bitcore.Unit.fromBTC(response.data[blocks]).toSatoshis();
}
return txFee;
}
return false;
}