Skip to content

Commit

Permalink
litecoin: lnd neutrino feeURL
Browse files Browse the repository at this point in the history
  • Loading branch information
losh11 committed Feb 24, 2024
1 parent 25cd8e6 commit e8c54b8
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion backend/src/api/bitcoin/bitcoin.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class BitcoinRoutes {
.get(config.MEMPOOL.API_URL_PREFIX + 'difficulty-adjustment', this.getDifficultyChange)
.get(config.MEMPOOL.API_URL_PREFIX + 'fees/recommended', this.getRecommendedFees)
.get(config.MEMPOOL.API_URL_PREFIX + 'fees/mempool-blocks', this.getMempoolBlocks)
.get(config.MEMPOOL.API_URL_PREFIX + 'fees/recommended-lnd', this.getRecommendedFeesForLnd)

This comment has been minimized.

.get(config.MEMPOOL.API_URL_PREFIX + 'backend-info', this.getBackendInfo)
.get(config.MEMPOOL.API_URL_PREFIX + 'init-data', this.getInitData)
.get(config.MEMPOOL.API_URL_PREFIX + 'validate-address/:address', this.validateAddress)
Expand Down Expand Up @@ -157,6 +158,26 @@ class BitcoinRoutes {
}
}

private async getRecommendedFeesForLnd(req: Request, res: Response) {
if (!mempool.isInSync()) {
res.statusCode = 503;
res.send('Service Unavailable');
return;
}
const currentBlockHash = await bitcoinApi.$getBlockHashTip();
const recommendedFees = feeApi.getRecommendedFee();
const result = {
"current_block_hash": currentBlockHash,
"fee_by_block_target": {
"1": recommendedFees['fastestFee'] * 1000,
"2": recommendedFees['halfHourFee'] * 1000,
"3": recommendedFees['hourFee'] * 1000,
"24": recommendedFees['economyFee'] * 1000
}
}
res.json(result);
}

private getTransactionTimes(req: Request, res: Response) {
if (!Array.isArray(req.query.txId)) {
res.status(500).send('Not an array');
Expand Down Expand Up @@ -480,7 +501,7 @@ class BitcoinRoutes {
res.status(500).send(e instanceof Error ? e.message : e);
}
}

private async getBlockTransactions(req: Request, res: Response) {
try {
loadingIndicators.setProgress('blocktxs-' + req.params.hash, 0);
Expand Down

0 comments on commit e8c54b8

Please sign in to comment.