mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-11-15 18:12:53 +00:00
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.
This commit is contained in:
parent
67fe01a2ef
commit
32cb0eb896
@ -19,7 +19,7 @@ impl TxLock {
|
|||||||
.address(wallet.get_network().await)
|
.address(wallet.get_network().await)
|
||||||
.expect("can derive address from descriptor");
|
.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 {
|
Ok(Self {
|
||||||
inner: psbt,
|
inner: psbt,
|
||||||
|
@ -111,19 +111,18 @@ impl Wallet {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn build_tx_lock_psbt(
|
pub async fn send_to_address(
|
||||||
&self,
|
&self,
|
||||||
output_address: Address,
|
address: Address,
|
||||||
output_amount: Amount,
|
amount: Amount,
|
||||||
) -> Result<PartiallySignedTransaction> {
|
) -> Result<PartiallySignedTransaction> {
|
||||||
tracing::debug!("building tx lock");
|
|
||||||
let wallet = self.inner.lock().await;
|
let wallet = self.inner.lock().await;
|
||||||
|
|
||||||
let mut tx_builder = wallet.build_tx();
|
let mut tx_builder = wallet.build_tx();
|
||||||
tx_builder.add_recipient(output_address.script_pubkey(), output_amount.as_sat());
|
tx_builder.add_recipient(address.script_pubkey(), amount.as_sat());
|
||||||
tx_builder.fee_rate(FeeRate::from_sat_per_vb(5.0)); // todo: get actual fee
|
tx_builder.fee_rate(FeeRate::from_sat_per_vb(5.0)); // todo: make dynamic
|
||||||
let (psbt, _details) = tx_builder.finish()?;
|
let (psbt, _details) = tx_builder.finish()?;
|
||||||
tracing::debug!("tx lock built");
|
|
||||||
Ok(psbt)
|
Ok(psbt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user