Noted that we're signing as well as building tx in the method signature
This commit is contained in:
@@ -34,7 +34,7 @@ impl EsploraWallet {
|
|||||||
/// Does NOT send it, you must call `broadcast` to do that.
|
/// Does NOT send it, you must call `broadcast` to do that.
|
||||||
///
|
///
|
||||||
/// We could split the creation and signing easily if needed.
|
/// We could split the creation and signing easily if needed.
|
||||||
pub(crate) fn build_send_tx(
|
pub(crate) fn build_and_sign_send_tx(
|
||||||
&mut self,
|
&mut self,
|
||||||
recipient: Address,
|
recipient: Address,
|
||||||
amount: Amount,
|
amount: Amount,
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ use crate::bitcoin::clients;
|
|||||||
///
|
///
|
||||||
/// Also, it very handily works with the mutinynet.com esplora server, which is configured
|
/// Also, it very handily works with the mutinynet.com esplora server, which is configured
|
||||||
/// with 30 second block times.
|
/// with 30 second block times.
|
||||||
pub(crate) async fn run() -> Result<(), anyhow::Error> {
|
pub(crate) async fn run() -> Result<(), anyhow::Error> {}
|
||||||
|
|
||||||
|
async fn simple_transfer() -> Result<(), anyhow::Error> {
|
||||||
let mut dave = clients::esplora::create_wallet("dave", Network::Signet)?;
|
let mut dave = clients::esplora::create_wallet("dave", Network::Signet)?;
|
||||||
let mut sammy = clients::esplora::create_wallet("sammy", Network::Signet)?;
|
let mut sammy = clients::esplora::create_wallet("sammy", Network::Signet)?;
|
||||||
|
|
||||||
@@ -51,7 +53,7 @@ pub(crate) async fn run() -> Result<(), anyhow::Error> {
|
|||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
let tx = dave.build_send_tx(sammy_address, send_amount)?;
|
let tx = dave.build_and_sign_send_tx(sammy_address, send_amount)?;
|
||||||
dave.broadcast(&tx).await?;
|
dave.broadcast(&tx).await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user