Skip to content

Commit e8c54b8

Browse files
committed
litecoin: lnd neutrino feeURL
1 parent 25cd8e6 commit e8c54b8

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

backend/src/api/bitcoin/bitcoin.routes.ts

+22-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class BitcoinRoutes {
2929
.get(config.MEMPOOL.API_URL_PREFIX + 'difficulty-adjustment', this.getDifficultyChange)
3030
.get(config.MEMPOOL.API_URL_PREFIX + 'fees/recommended', this.getRecommendedFees)
3131
.get(config.MEMPOOL.API_URL_PREFIX + 'fees/mempool-blocks', this.getMempoolBlocks)
32+
.get(config.MEMPOOL.API_URL_PREFIX + 'fees/recommended-lnd', this.getRecommendedFeesForLnd)
3233
.get(config.MEMPOOL.API_URL_PREFIX + 'backend-info', this.getBackendInfo)
3334
.get(config.MEMPOOL.API_URL_PREFIX + 'init-data', this.getInitData)
3435
.get(config.MEMPOOL.API_URL_PREFIX + 'validate-address/:address', this.validateAddress)
@@ -157,6 +158,26 @@ class BitcoinRoutes {
157158
}
158159
}
159160

161+
private async getRecommendedFeesForLnd(req: Request, res: Response) {
162+
if (!mempool.isInSync()) {
163+
res.statusCode = 503;
164+
res.send('Service Unavailable');
165+
return;
166+
}
167+
const currentBlockHash = await bitcoinApi.$getBlockHashTip();
168+
const recommendedFees = feeApi.getRecommendedFee();
169+
const result = {
170+
"current_block_hash": currentBlockHash,
171+
"fee_by_block_target": {
172+
"1": recommendedFees['fastestFee'] * 1000,
173+
"2": recommendedFees['halfHourFee'] * 1000,
174+
"3": recommendedFees['hourFee'] * 1000,
175+
"24": recommendedFees['economyFee'] * 1000
176+
}
177+
}
178+
res.json(result);
179+
}
180+
160181
private getTransactionTimes(req: Request, res: Response) {
161182
if (!Array.isArray(req.query.txId)) {
162183
res.status(500).send('Not an array');
@@ -480,7 +501,7 @@ class BitcoinRoutes {
480501
res.status(500).send(e instanceof Error ? e.message : e);
481502
}
482503
}
483-
504+
484505
private async getBlockTransactions(req: Request, res: Response) {
485506
try {
486507
loadingIndicators.setProgress('blocktxs-' + req.params.hash, 0);

0 commit comments

Comments
 (0)