Sending between multiple addresses works nicely
This commit is contained in:
@@ -22,9 +22,10 @@ const PARALLEL_REQUESTS: usize = 5;
|
||||
|
||||
/// A wallet that uses the Esplora client to interact with the Bitcoin network.
|
||||
pub struct EsploraWallet {
|
||||
wallet: Wallet,
|
||||
db: Store<KeychainKind, ConfirmationTimeHeightAnchor>,
|
||||
client: AsyncClient,
|
||||
db: Store<KeychainKind, ConfirmationTimeHeightAnchor>,
|
||||
name: String,
|
||||
wallet: Wallet,
|
||||
}
|
||||
|
||||
impl EsploraWallet {
|
||||
@@ -107,7 +108,10 @@ impl EsploraWallet {
|
||||
if let Some(changeset) = self.wallet.take_staged() {
|
||||
self.db.write(&changeset)?;
|
||||
}
|
||||
println!("Generated Address: {}", address);
|
||||
println!(
|
||||
"Generated address: https://mutinynet.com/address/{}",
|
||||
address
|
||||
);
|
||||
Ok(address)
|
||||
}
|
||||
|
||||
@@ -121,6 +125,11 @@ impl EsploraWallet {
|
||||
&self,
|
||||
tx: &bitcoin::Transaction,
|
||||
) -> Result<(), esplora_client::Error> {
|
||||
println!(
|
||||
"{} broadcasting tx https://mutinynet.com/tx/{}",
|
||||
self.name,
|
||||
tx.compute_txid()
|
||||
);
|
||||
self.client.broadcast(tx).await
|
||||
}
|
||||
}
|
||||
@@ -166,7 +175,12 @@ pub(crate) fn create_wallet(name: &str, network: Network) -> anyhow::Result<Espl
|
||||
.build_async()
|
||||
.expect("couldn't build esplora client");
|
||||
|
||||
let esplora = EsploraWallet { wallet, db, client };
|
||||
let esplora = EsploraWallet {
|
||||
name: name.to_string(),
|
||||
wallet,
|
||||
db,
|
||||
client,
|
||||
};
|
||||
|
||||
Ok(esplora)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user