| 1277 | } |
| 1278 | |
| 1279 | pub async fn get_initial_utxo(&self, address: Address, amount: Amount) -> Option<Utxo> { |
| 1280 | let utxos = self.esplora.get_address_utxo(address).await.unwrap(); |
| 1281 | |
| 1282 | let possible_utxos = utxos |
| 1283 | .into_iter() |
| 1284 | .filter(|utxo| utxo.value == amount) |
| 1285 | .collect::<Vec<_>>(); |
| 1286 | if !possible_utxos.is_empty() { |
| 1287 | Some(possible_utxos[0].clone()) |
| 1288 | } else { |
| 1289 | None |
| 1290 | } |
| 1291 | } |
| 1292 | |
| 1293 | pub async fn get_initial_utxos(&self, address: Address, amount: Amount) -> Option<Vec<Utxo>> { |
| 1294 | let utxos: Vec<Utxo> = self.esplora.get_address_utxo(address).await.unwrap(); |