@@ -197,7 +197,7 @@ impl BlockingClient {
197
197
198
198
/// Get a [`Transaction`] option given its [`Txid`]
199
199
pub fn get_tx ( & self , txid : & Txid ) -> Result < Option < Transaction > , Error > {
200
- self . get_opt_response ( & format ! ( "/tx/{}/raw" , txid ) )
200
+ self . get_opt_response ( & format ! ( "/tx/{txid }/raw" ) )
201
201
}
202
202
203
203
/// Get a [`Transaction`] given its [`Txid`].
@@ -216,44 +216,44 @@ impl BlockingClient {
216
216
block_hash : & BlockHash ,
217
217
index : usize ,
218
218
) -> Result < Option < Txid > , Error > {
219
- self . get_opt_response_txid ( & format ! ( "/block/{}/txid/{}" , block_hash , index ) )
219
+ self . get_opt_response_txid ( & format ! ( "/block/{block_hash }/txid/{index}" ) )
220
220
}
221
221
222
222
/// Get the status of a [`Transaction`] given its [`Txid`].
223
223
pub fn get_tx_status ( & self , txid : & Txid ) -> Result < TxStatus , Error > {
224
- self . get_response_json ( & format ! ( "/tx/{}/status" , txid ) )
224
+ self . get_response_json ( & format ! ( "/tx/{txid }/status" ) )
225
225
}
226
226
227
227
/// Get transaction info given it's [`Txid`].
228
228
pub fn get_tx_info ( & self , txid : & Txid ) -> Result < Option < Tx > , Error > {
229
- self . get_opt_response_json ( & format ! ( "/tx/{}" , txid ) )
229
+ self . get_opt_response_json ( & format ! ( "/tx/{txid}" ) )
230
230
}
231
231
232
232
/// Get a [`BlockHeader`] given a particular block hash.
233
233
pub fn get_header_by_hash ( & self , block_hash : & BlockHash ) -> Result < BlockHeader , Error > {
234
- self . get_response_hex ( & format ! ( "/block/{}/header" , block_hash ) )
234
+ self . get_response_hex ( & format ! ( "/block/{block_hash }/header" ) )
235
235
}
236
236
237
237
/// Get the [`BlockStatus`] given a particular [`BlockHash`].
238
238
pub fn get_block_status ( & self , block_hash : & BlockHash ) -> Result < BlockStatus , Error > {
239
- self . get_response_json ( & format ! ( "/block/{}/status" , block_hash ) )
239
+ self . get_response_json ( & format ! ( "/block/{block_hash }/status" ) )
240
240
}
241
241
242
242
/// Get a [`Block`] given a particular [`BlockHash`].
243
243
pub fn get_block_by_hash ( & self , block_hash : & BlockHash ) -> Result < Option < Block > , Error > {
244
- self . get_opt_response ( & format ! ( "/block/{}/raw" , block_hash ) )
244
+ self . get_opt_response ( & format ! ( "/block/{block_hash }/raw" ) )
245
245
}
246
246
247
247
/// Get a merkle inclusion proof for a [`Transaction`] with the given
248
248
/// [`Txid`].
249
249
pub fn get_merkle_proof ( & self , txid : & Txid ) -> Result < Option < MerkleProof > , Error > {
250
- self . get_opt_response_json ( & format ! ( "/tx/{}/merkle-proof" , txid ) )
250
+ self . get_opt_response_json ( & format ! ( "/tx/{txid }/merkle-proof" ) )
251
251
}
252
252
253
253
/// Get a [`MerkleBlock`] inclusion proof for a [`Transaction`] with the
254
254
/// given [`Txid`].
255
255
pub fn get_merkle_block ( & self , txid : & Txid ) -> Result < Option < MerkleBlock > , Error > {
256
- self . get_opt_response_hex ( & format ! ( "/tx/{}/merkleblock-proof" , txid ) )
256
+ self . get_opt_response_hex ( & format ! ( "/tx/{txid }/merkleblock-proof" ) )
257
257
}
258
258
259
259
/// Get the spending status of an output given a [`Txid`] and the output
@@ -263,7 +263,7 @@ impl BlockingClient {
263
263
txid : & Txid ,
264
264
index : u64 ,
265
265
) -> Result < Option < OutputStatus > , Error > {
266
- self . get_opt_response_json ( & format ! ( "/tx/{}/outspend/{}" , txid , index ) )
266
+ self . get_opt_response_json ( & format ! ( "/tx/{txid }/outspend/{index}" ) )
267
267
}
268
268
269
269
/// Broadcast a [`Transaction`] to Esplora
@@ -309,7 +309,7 @@ impl BlockingClient {
309
309
310
310
/// Get the [`BlockHash`] of a specific block height
311
311
pub fn get_block_hash ( & self , block_height : u32 ) -> Result < BlockHash , Error > {
312
- self . get_response_str ( & format ! ( "/block-height/{}" , block_height ) )
312
+ self . get_response_str ( & format ! ( "/block-height/{block_height}" ) )
313
313
. map ( |s| BlockHash :: from_str ( s. as_str ( ) ) . map_err ( Error :: HexToArray ) ) ?
314
314
}
315
315
@@ -354,8 +354,8 @@ impl BlockingClient {
354
354
) -> Result < Vec < Tx > , Error > {
355
355
let script_hash = sha256:: Hash :: hash ( script. as_bytes ( ) ) ;
356
356
let path = match last_seen {
357
- Some ( last_seen) => format ! ( "/scripthash/{:x}/txs/chain/{}" , script_hash , last_seen ) ,
358
- None => format ! ( "/scripthash/{:x}/txs" , script_hash ) ,
357
+ Some ( last_seen) => format ! ( "/scripthash/{script_hash :x}/txs/chain/{last_seen}" ) ,
358
+ None => format ! ( "/scripthash/{script_hash :x}/txs" ) ,
359
359
} ;
360
360
self . get_response_json ( & path)
361
361
}
@@ -367,7 +367,7 @@ impl BlockingClient {
367
367
/// esplora returns `10` while [mempool.space](https://mempool.space/docs/api) returns `15`.
368
368
pub fn get_blocks ( & self , height : Option < u32 > ) -> Result < Vec < BlockSummary > , Error > {
369
369
let path = match height {
370
- Some ( height) => format ! ( "/blocks/{}" , height ) ,
370
+ Some ( height) => format ! ( "/blocks/{height}" ) ,
371
371
None => "/blocks" . to_string ( ) ,
372
372
} ;
373
373
let blocks: Vec < BlockSummary > = self . get_response_json ( & path) ?;
0 commit comments