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.
Auto Trait Implementations§
impl Freeze for OnchainPayment
impl !RefUnwindSafe for OnchainPayment
impl Send for OnchainPayment
impl Sync for OnchainPayment
impl Unpin for OnchainPayment
impl !UnwindSafe for OnchainPayment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more