pub struct Exit { /* private fields */ }Expand description
Handles the process of ongoing VTXO exits.
Implementations§
Source§impl Exit
impl Exit
Sourcepub async fn get_exit_status(
&self,
vtxo_id: VtxoId,
include_history: bool,
include_transactions: bool,
) -> Result<Option<ExitTransactionStatus>, ExitError>
pub async fn get_exit_status( &self, vtxo_id: VtxoId, include_history: bool, include_transactions: bool, ) -> Result<Option<ExitTransactionStatus>, ExitError>
Returns the unilateral exit status for a given VTXO, if any.
- vtxo_id: The ID of the VTXO to check.
- include_history: Whether to include the full state machine history of the exit
- include_transactions: Whether to include the full set of transactions related to the exit. Errors if status retrieval fails.
Sourcepub fn get_exit_vtxo(&self, vtxo_id: VtxoId) -> Option<&ExitVtxo>
pub fn get_exit_vtxo(&self, vtxo_id: VtxoId) -> Option<&ExitVtxo>
Returns a reference to the tracked ExitVtxo if it exists.
Sourcepub fn get_exit_vtxos(&self) -> &Vec<ExitVtxo>
pub fn get_exit_vtxos(&self) -> &Vec<ExitVtxo>
Returns all known unilateral exits in this wallet.
Sourcepub fn has_pending_exits(&self) -> bool
pub fn has_pending_exits(&self) -> bool
True if there are any unilateral exits which have been started but are not yet claimable.
Sourcepub fn pending_total(&self) -> Amount
pub fn pending_total(&self) -> Amount
Returns the total amount of all VTXOs requiring more txs to be confirmed
Sourcepub async fn all_claimable_at_height(&self) -> Option<BlockHeight>
pub async fn all_claimable_at_height(&self) -> Option<BlockHeight>
Returns the earliest block height at which all tracked exits will be claimable
Sourcepub async fn start_exit_for_entire_wallet(
&mut self,
onchain: &dyn ExitUnilaterally,
) -> Result<()>
pub async fn start_exit_for_entire_wallet( &mut self, onchain: &dyn ExitUnilaterally, ) -> Result<()>
Starts the unilateral exit process for the entire wallet (all eligible VTXOs).
It does not block until completion, you must use Exit::progress_exits to advance each exit.
It’s recommended to sync the wallet, by using something like Wallet::maintenance being doing this.
Sourcepub async fn start_exit_for_vtxos<V: Borrow<Vtxo>>(
&mut self,
vtxos: &[V],
onchain: &dyn ExitUnilaterally,
) -> Result<()>
pub async fn start_exit_for_vtxos<V: Borrow<Vtxo>>( &mut self, vtxos: &[V], onchain: &dyn ExitUnilaterally, ) -> Result<()>
Starts the unilateral exit process for the given VTXOs.
It does not block until completion, you must use Exit::progress_exits to advance each exit.
It’s recommended to sync the wallet, by using something like Wallet::maintenance being doing this.
Sourcepub fn list_vtxos_to_exit(&self) -> Vec<VtxoId>
pub fn list_vtxos_to_exit(&self) -> Vec<VtxoId>
Lists the IDs of VTXOs marked for unilateral exit.
Sourcepub async fn mark_vtxos_for_exit<'a>(
&mut self,
vtxos: &[impl Borrow<Vtxo>],
) -> Result<()>
pub async fn mark_vtxos_for_exit<'a>( &mut self, vtxos: &[impl Borrow<Vtxo>], ) -> Result<()>
Mark a vtxo for unilateral exit.
This is a lower level primitive used as a buffer to mark vtxos for exit without having to provide an onchain wallet. The actual exit process is started with Exit::start_vtxo_exits.
Sourcepub async fn start_vtxo_exits(
&mut self,
onchain: &dyn ExitUnilaterally,
) -> Result<()>
pub async fn start_vtxo_exits( &mut self, onchain: &dyn ExitUnilaterally, ) -> Result<()>
Starts the unilateral exit process for any VTXOs marked for exit.
This is a lower level primitive to be used in conjunction with Exit::mark_vtxos_for_exit.
Sourcepub async fn progress_exits(
&mut self,
onchain: &mut dyn ExitUnilaterally,
fee_rate_override: Option<FeeRate>,
) -> Result<Option<Vec<ExitProgressStatus>>>
pub async fn progress_exits( &mut self, onchain: &mut dyn ExitUnilaterally, fee_rate_override: Option<FeeRate>, ) -> Result<Option<Vec<ExitProgressStatus>>>
Returns a list of per-VTXO progress statuses if any changes occurred, or None if there was nothing to do.
Iterates over each registered VTXO and attempts to progress their unilateral exit
§Arguments
onchainis used to build the CPFP transaction package we use to broadcast the unilateral exit transactionfee_rate_overridesets the desired fee-rate in sats/kvB to use broadcasting exit transactions. Note that due to rules imposed by the network with regard to RBF fee bumping, replaced transactions may have a higher fee rate than you specify here.
§Return
The exit status of each VTXO being exited which has also not yet been spent
Sourcepub async fn sync_exit(
&mut self,
onchain: &mut dyn ExitUnilaterally,
) -> Result<()>
pub async fn sync_exit( &mut self, onchain: &mut dyn ExitUnilaterally, ) -> Result<()>
For use when syncing. This progresses any unilateral exit in a state that needs updating such as a when claimable exit may have been spent onchain.
Sourcepub fn list_claimable(&self) -> Vec<&ExitVtxo>
pub fn list_claimable(&self) -> Vec<&ExitVtxo>
Lists all exits that are claimable
Sourcepub fn sign_exit_claim_inputs(
&self,
psbt: &mut Psbt,
wallet: &Wallet,
) -> Result<()>
pub fn sign_exit_claim_inputs( &self, psbt: &mut Psbt, wallet: &Wallet, ) -> Result<()>
Sign any inputs of the PSBT that is an exit claim input
Can take the result PSBT of bdk_wallet::TxBuilder::finish on which
crate::onchain::TxBuilderExt::add_exit_claim_inputs has been used
Note: This doesn’t mark the exit output as spent, it’s up to the caller to do that, or it will be done once the transaction is seen in the network
Sourcepub async fn drain_exits<'a>(
&self,
inputs: &[impl Borrow<ExitVtxo>],
wallet: &Wallet,
address: Address,
fee_rate_override: Option<FeeRate>,
) -> Result<Psbt, ExitError>
pub async fn drain_exits<'a>( &self, inputs: &[impl Borrow<ExitVtxo>], wallet: &Wallet, address: Address, fee_rate_override: Option<FeeRate>, ) -> Result<Psbt, ExitError>
Builds a PSBT that drains the provided claimable unilateral exits to the given address.
inputs: Claimable unilateral exits.wallet: The bark wallet containing the keys needed to spend the unilateral exits.address: Destination address for the claim.fee_rate_override: Optional fee rate to use.
Returns a PSBT ready to be broadcast.
Auto Trait Implementations§
impl Freeze for Exit
impl !RefUnwindSafe for Exit
impl Send for Exit
impl Sync for Exit
impl Unpin for Exit
impl !UnwindSafe for Exit
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request