@@ -29,6 +29,7 @@ class BitcoinRoutes {
29
29
. get ( config . MEMPOOL . API_URL_PREFIX + 'difficulty-adjustment' , this . getDifficultyChange )
30
30
. get ( config . MEMPOOL . API_URL_PREFIX + 'fees/recommended' , this . getRecommendedFees )
31
31
. get ( config . MEMPOOL . API_URL_PREFIX + 'fees/mempool-blocks' , this . getMempoolBlocks )
32
+ . get ( config . MEMPOOL . API_URL_PREFIX + 'fees/recommended-lnd' , this . getRecommendedFeesForLnd )
32
33
. get ( config . MEMPOOL . API_URL_PREFIX + 'backend-info' , this . getBackendInfo )
33
34
. get ( config . MEMPOOL . API_URL_PREFIX + 'init-data' , this . getInitData )
34
35
. get ( config . MEMPOOL . API_URL_PREFIX + 'validate-address/:address' , this . validateAddress )
@@ -157,6 +158,26 @@ class BitcoinRoutes {
157
158
}
158
159
}
159
160
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
+
160
181
private getTransactionTimes ( req : Request , res : Response ) {
161
182
if ( ! Array . isArray ( req . query . txId ) ) {
162
183
res . status ( 500 ) . send ( 'Not an array' ) ;
@@ -480,7 +501,7 @@ class BitcoinRoutes {
480
501
res . status ( 500 ) . send ( e instanceof Error ? e . message : e ) ;
481
502
}
482
503
}
483
-
504
+
484
505
private async getBlockTransactions ( req : Request , res : Response ) {
485
506
try {
486
507
loadingIndicators . setProgress ( 'blocktxs-' + req . params . hash , 0 ) ;
0 commit comments