File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -252,6 +252,12 @@ impl LiquidClient for ElectrumLiquidClient {
252252 ) )
253253 }
254254
255+ async fn get_tx ( & self , txid : elements:: Txid ) -> Result < elements:: Transaction , Error > {
256+ let bitcoin_txid = bitcoin:: Txid :: from_raw_hash ( txid. to_raw_hash ( ) . into ( ) ) ;
257+ let raw_tx = self . inner . transaction_get_raw ( & bitcoin_txid) ?;
258+ Ok ( elements:: encode:: deserialize ( & raw_tx) ?)
259+ }
260+
255261 async fn broadcast_tx ( & self , signed_tx : & elements:: Transaction ) -> Result < String , Error > {
256262 let serialized = serialize ( signed_tx) ;
257263 Ok ( self
Original file line number Diff line number Diff line change @@ -264,6 +264,14 @@ impl LiquidClient for EsploraLiquidClient {
264264 Ok ( elements:: BlockHash :: from_str ( & text) ?)
265265 }
266266
267+ async fn get_tx ( & self , txid : elements:: Txid ) -> Result < elements:: Transaction , Error > {
268+ let url = format ! ( "{}/tx/{txid}/raw" , self . base_url) ;
269+ let response = get_with_retry ( & self . client , & url, self . timeout ) . await ?;
270+ let raw_tx = response. bytes ( ) . await ?;
271+
272+ Ok ( elements:: encode:: deserialize ( & raw_tx) ?)
273+ }
274+
267275 async fn broadcast_tx ( & self , signed_tx : & elements:: Transaction ) -> Result < String , Error > {
268276 let url = format ! ( "{}/tx" , self . base_url) ;
269277 let tx_hex = signed_tx. serialize ( ) . to_hex ( ) ;
Original file line number Diff line number Diff line change @@ -156,6 +156,8 @@ pub trait LiquidClient: Send + Sync {
156156
157157 async fn get_genesis_hash ( & self ) -> Result < elements:: BlockHash , Error > ;
158158
159+ async fn get_tx ( & self , txid : elements:: Txid ) -> Result < elements:: Transaction , Error > ;
160+
159161 async fn broadcast_tx ( & self , signed_tx : & elements:: Transaction ) -> Result < String , Error > ;
160162
161163 fn network ( & self ) -> LiquidChain ;
You can’t perform that action at this time.
0 commit comments