-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from LN-Zap/bitcoind
Add support for bitcoind fee estimation source
- Loading branch information
Showing
14 changed files
with
505 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"bitcoind": { | ||
"baseUrl": "http://127.0.0.1:18445", | ||
"username": "user", | ||
"password": "pass" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
"author": "Tom Kirkpatrick <[email protected]> (https://twitter.com/mrfelton)", | ||
"license": "MIT", | ||
"dependencies": { | ||
"bitcoind-rpc": "0.9.1", | ||
"config": "3.3.9", | ||
"hono": "3.11.12", | ||
"node-cache": "5.1.2" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,48 @@ | ||
// MempoolFeeEstimates represents the fee estimates for different transaction speeds. | ||
type MempoolFeeEstimates = { | ||
[key: string]: number | undefined; | ||
fastestFee: number; | ||
halfHourFee: number; | ||
hourFee: number; | ||
economyFee: number; | ||
minimumFee: number; | ||
}; | ||
|
||
type EsploraFeeEstimates = { | ||
[key: number]: number; | ||
[key: string]: number; // dynamic keys with number as value (sat/vb) | ||
fastestFee: number; // fee for the fastest transaction speed (sat/vb) | ||
halfHourFee: number; // fee for half an hour transaction speed (sat/vb) | ||
hourFee: number; // fee for an hour transaction speed (sat/vb) | ||
economyFee: number; // fee for economy transaction speed (sat/vb) | ||
minimumFee: number; // minimum relay fee (sat/vb) | ||
}; | ||
|
||
// FeeByBlockTarget represents the fee by block target. | ||
type FeeByBlockTarget = { | ||
[key: string]: number; | ||
[key: string]: number; // fees by confirmation target | ||
}; | ||
|
||
// Estimates represents the current block hash and fee by block target. | ||
type Estimates = { | ||
current_block_hash: string | null; | ||
fee_by_block_target: FeeByBlockTarget; | ||
current_block_hash: string | null; // current block hash | ||
fee_by_block_target: FeeByBlockTarget; // fee by block target (in sat/kb) | ||
}; | ||
|
||
// BlockTargetMapping represents the mapping of block targets. | ||
type BlockTargetMapping = { | ||
[key: number]: string; | ||
[key: number]: string; // dynamic numeric keys with string as value | ||
}; | ||
|
||
// SiteData represents the data of a site. | ||
interface SiteData { | ||
title: string, | ||
subtitle: string, | ||
children?: any | ||
} | ||
title: string, // title of the site | ||
subtitle: string, // subtitle of the site | ||
children?: any // children of the site (optional) | ||
}; | ||
|
||
// ExpectedResponseType represents the expected response type for an http request. | ||
type ExpectedResponseType = 'json' | 'text'; // can be either 'json' or 'text' | ||
|
||
type ExpectedResponseType = 'json' | 'text'; | ||
// BatchRequest represents a bitcoind batch request response. | ||
interface BitcoindRpcBatchResponse { | ||
result?: EstimateSmartFeeResponse; | ||
error?: any; | ||
}; | ||
|
||
// EstimateSmartFeeResponse represents the response of the estimatesmarttee method. | ||
interface EstimateSmartFeeResponse { | ||
feerate?: number, // estimate fee rate in BTC/kB (only present if no errors were encountered) | ||
errors?: [string], // errors encountered during processing (if there are any) | ||
blocks?: number // block number where estimate was found | ||
}; |
Oops, something went wrong.