Merge pull request #358 from mempool/simon/fee-api-minfee
Send mempoolminfee in fee api.
This commit is contained in:
		
						commit
						b89630953c
					
				@ -1,5 +1,6 @@
 | 
			
		||||
import config from '../config';
 | 
			
		||||
import { MempoolBlock } from '../mempool.interfaces';
 | 
			
		||||
import mempool from './mempool';
 | 
			
		||||
import projectedBlocks from './mempool-blocks';
 | 
			
		||||
 | 
			
		||||
class FeeApi {
 | 
			
		||||
@ -9,12 +10,15 @@ class FeeApi {
 | 
			
		||||
 | 
			
		||||
  public getRecommendedFee() {
 | 
			
		||||
    const pBlocks = projectedBlocks.getMempoolBlocks();
 | 
			
		||||
    const mPool = mempool.getMempoolInfo();
 | 
			
		||||
    const minimumFee = Math.ceil(mPool.mempoolminfee * 100000);
 | 
			
		||||
 | 
			
		||||
    if (!pBlocks.length) {
 | 
			
		||||
      return {
 | 
			
		||||
        'fastestFee': this.defaultFee,
 | 
			
		||||
        'halfHourFee': this.defaultFee,
 | 
			
		||||
        'hourFee': this.defaultFee,
 | 
			
		||||
        'minimumFee': minimumFee,
 | 
			
		||||
      };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -26,6 +30,7 @@ class FeeApi {
 | 
			
		||||
      'fastestFee': firstMedianFee,
 | 
			
		||||
      'halfHourFee': secondMedianFee,
 | 
			
		||||
      'hourFee': thirdMedianFee,
 | 
			
		||||
      'minimumFee': minimumFee,
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -62,7 +62,7 @@ class Mempool {
 | 
			
		||||
    this.mempoolInfo = await bitcoinBaseApi.$getMempoolInfo();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public getMempoolInfo(): IBitcoinApi.MempoolInfo | undefined {
 | 
			
		||||
  public getMempoolInfo(): IBitcoinApi.MempoolInfo {
 | 
			
		||||
    return this.mempoolInfo;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user