Skip to content

Commit c2daffb

Browse files
committed
feat(esplora): add get_txid_at_block_index
1 parent 26b7871 commit c2daffb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

bdk-ffi/src/esplora.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,18 @@ impl EsploraClient {
178178
.map_err(EsploraError::from)
179179
}
180180

181+
/// Get a `Txid` of a transaction given its index in a block with a given hash.
182+
pub fn get_txid_at_block_index(
183+
&self,
184+
block_hash: Arc<BlockHash>,
185+
index: u64,
186+
) -> Result<Option<Arc<Txid>>, EsploraError> {
187+
self.0
188+
.get_txid_at_block_index(&block_hash.0, index as usize)
189+
.map(|txid| txid.map(Txid).map(Arc::new))
190+
.map_err(EsploraError::from)
191+
}
192+
181193
/// Get a `Header` given a particular block hash.
182194
pub fn get_header_by_hash(&self, block_hash: Arc<BlockHash>) -> Result<Header, EsploraError> {
183195
self.0

0 commit comments

Comments
 (0)