From 70d8beb7114d5a899db8a6d08b7006a6fa8b1e4c Mon Sep 17 00:00:00 2001 From: Jose Storopoli Date: Wed, 20 Nov 2024 15:10:24 -0500 Subject: [PATCH] backport: fix(cli) don't expect a txid from the faucet api (#482) (#483) fix(cli) don't expect a txid from the faucet api (#482) * fix(cli) don't expect a txid from the faucet api * chore: clippy * chore(cli) update messaging Co-authored-by: azz --- bin/strata-cli/src/cmd/faucet.rs | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/bin/strata-cli/src/cmd/faucet.rs b/bin/strata-cli/src/cmd/faucet.rs index 93ab3cac4..05d166a54 100644 --- a/bin/strata-cli/src/cmd/faucet.rs +++ b/bin/strata-cli/src/cmd/faucet.rs @@ -3,10 +3,7 @@ use std::str::FromStr; #[cfg(feature = "strata_faucet")] use alloy::{primitives::Address as StrataAddress, providers::WalletProvider}; use argh::FromArgs; -use bdk_wallet::{ - bitcoin::{Address, Txid}, - KeychainKind, -}; +use bdk_wallet::{bitcoin::Address, KeychainKind}; use console::Term; use indicatif::ProgressBar; use rand::{distributions::uniform::SampleRange, rngs::OsRng}; @@ -20,11 +17,7 @@ use crate::{ net_type::{net_type_or_exit, NetworkType}, strata::StrataWallet, }; -use crate::{ - seed::Seed, - settings::Settings, - signet::{print_bitcoin_explorer_url, SignetWallet}, -}; +use crate::{seed::Seed, settings::Settings, signet::SignetWallet}; /// Request some bitcoin from the faucet #[derive(FromArgs, PartialEq, Debug)] @@ -168,21 +161,9 @@ pub async fn faucet(args: FaucetArgs, seed: Seed, settings: Settings) { let status = res.status(); let body = res.text().await.expect("invalid response"); if status == StatusCode::OK { - #[cfg(feature = "strata_faucet")] - if network_type == NetworkType::Signet { - let _ = print_bitcoin_explorer_url( - &Txid::from_str(&body).expect("valid txid"), - &term, - &settings, - ); - } - #[cfg(not(feature = "strata_faucet"))] - let _ = print_bitcoin_explorer_url( - &Txid::from_str(&body).expect("valid txid"), - &term, - &settings, + let _ = term.write_line( + "Successful queued request for signet bitcoin. It should arrive in your wallet soon.", ); - let _ = term.write_line(&format!("Successful. Claimed in transaction {body}")); } else { let _ = term.write_line(&format!("Failed: faucet responded with {status}: {body}")); }