Skip to content

Commit

Permalink
feat: expose ElectrumClient::estimate_fee method
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Jan 6, 2025
1 parent 38b8750 commit 6518846
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bdk-ffi/src/bdk.udl
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,10 @@ interface ElectrumClient {
/// Returns the capabilities of the server.
[Throws=ElectrumError]
ServerFeaturesRes server_features();

/// Estimates the fee required in bitcoin per kilobyte to confirm a transaction in `number` blocks.
[Throws=ElectrumError]
f64 estimate_fee(u64 number);
};

/// Response to an ElectrumClient.server_features request.
Expand Down
7 changes: 7 additions & 0 deletions bdk-ffi/src/electrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ impl ElectrumClient {
.map_err(ElectrumError::from)
.map(ServerFeaturesRes::from)
}

pub fn estimate_fee(&self, number: u64) -> Result<f64, ElectrumError> {
self.0
.inner
.estimate_fee(number as usize)
.map_err(ElectrumError::from)
}
}

pub struct ServerFeaturesRes {
Expand Down

0 comments on commit 6518846

Please sign in to comment.