Rename `build_tx_lock_psbt` to `send_to_address`

Being defined on the wallet itself, a more generic name fits better
on what this function actually does.
pull/236/head
Thomas Eizinger 3 years ago
parent 67fe01a2ef
commit 32cb0eb896
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96

@ -19,7 +19,7 @@ impl TxLock {
.address(wallet.get_network().await)
.expect("can derive address from descriptor");
let psbt = wallet.build_tx_lock_psbt(address, amount).await?;
let psbt = wallet.send_to_address(address, amount).await?;
Ok(Self {
inner: psbt,

@ -111,19 +111,18 @@ impl Wallet {
Ok(())
}
pub async fn build_tx_lock_psbt(
pub async fn send_to_address(
&self,
output_address: Address,
output_amount: Amount,
address: Address,
amount: Amount,
) -> Result<PartiallySignedTransaction> {
tracing::debug!("building tx lock");
let wallet = self.inner.lock().await;
let mut tx_builder = wallet.build_tx();
tx_builder.add_recipient(output_address.script_pubkey(), output_amount.as_sat());
tx_builder.fee_rate(FeeRate::from_sat_per_vb(5.0)); // todo: get actual fee
tx_builder.add_recipient(address.script_pubkey(), amount.as_sat());
tx_builder.fee_rate(FeeRate::from_sat_per_vb(5.0)); // todo: make dynamic
let (psbt, _details) = tx_builder.finish()?;
tracing::debug!("tx lock built");
Ok(psbt)
}

Loading…
Cancel
Save