(&self, utxo_arg: Option<&String>)
| 81 | } |
| 82 | |
| 83 | async fn get_funding_utxo_input(&self, utxo_arg: Option<&String>) -> io::Result<Input> { |
| 84 | let utxo = utxo_arg.expect("Missing UTXO argument, please see help."); |
| 85 | let outpoint = OutPoint::from_str(utxo) |
| 86 | .expect("Could not parse the provided UTXO, please see help for the correct format."); |
| 87 | let tx = self |
| 88 | .client |
| 89 | .esplora |
| 90 | .get_tx(&outpoint.txid) |
| 91 | .await |
| 92 | .map_err(|e| { |
| 93 | io::Error::new( |
| 94 | io::ErrorKind::Other, |
| 95 | format!("Esplora failed to retrieve tx: {e}"), |
| 96 | ) |
| 97 | })?; |
| 98 | let tx = tx.expect(&format!("Esplora did not find a txid {}", outpoint.txid)); |
| 99 | |
| 100 | Ok(Input { |
| 101 | outpoint, |
| 102 | amount: tx.output[outpoint.vout as usize].value, |
| 103 | }) |
| 104 | } |
| 105 | |
| 106 | pub fn get_funding_amounts_command() -> Command { |
| 107 | Command::new("get-funding-amounts") |
no outgoing calls
no test coverage detected