pub struct OnchainPayment { /* private fields */ }Expand description
A payment handler allowing to send and receive on-chain payments.
Should be retrieved by calling Node::onchain_payment.
Implementations§
Source§impl OnchainPayment
impl OnchainPayment
Sourcepub fn new_address(&self) -> Result<Address, Error>
pub fn new_address(&self) -> Result<Address, Error>
Retrieve a new on-chain/funding address.
Sourcepub fn send_to_address(
&self,
address: &Address,
amount_sats: u64,
fee_rate: Option<FeeRate>,
) -> Result<Txid, Error>
pub fn send_to_address( &self, address: &Address, amount_sats: u64, fee_rate: Option<FeeRate>, ) -> Result<Txid, Error>
Send an on-chain payment to the given address.
This will respect any on-chain reserve we need to keep, i.e., won’t allow to cut into
BalanceDetails::total_anchor_channels_reserve_sats.
If fee_rate is set it will be used on the resulting transaction. Otherwise we’ll retrieve
a reasonable estimate from the configured chain source.
Sourcepub fn send_all_to_address(
&self,
address: &Address,
retain_reserves: bool,
fee_rate: Option<FeeRate>,
) -> Result<Txid, Error>
pub fn send_all_to_address( &self, address: &Address, retain_reserves: bool, fee_rate: Option<FeeRate>, ) -> Result<Txid, Error>
Send an on-chain payment to the given address, draining the available funds.
This is useful if you have closed all channels and want to migrate funds to another on-chain wallet.
Please note that if retain_reserves is set to false this will not retain any on-chain reserves, which might be potentially
dangerous if you have open Anchor channels for which you can’t trust the counterparty to
spend the Anchor output after channel closure. If retain_reserves is set to true, this
will try to send all spendable onchain funds, i.e.,
BalanceDetails::spendable_onchain_balance_sats.
If fee_rate is set it will be used on the resulting transaction. Otherwise a reasonable
we’ll retrieve an estimate from the configured chain source.