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.
§Parameters
- 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.
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) -> Result<()>
pub async fn start_exit_for_entire_wallet(&mut self) -> 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<'a>(
&mut self,
vtxos: &[impl Borrow<Vtxo>],
) -> Result<()>
pub async fn start_exit_for_vtxos<'a>( &mut self, vtxos: &[impl Borrow<Vtxo>], ) -> 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 async fn progress_exits(
&mut self,
wallet: &Wallet,
onchain: &mut dyn ExitUnilaterally,
fee_rate_override: Option<FeeRate>,
) -> Result<Option<Vec<ExitProgressStatus>>>
pub async fn progress_exits( &mut self, wallet: &Wallet, onchain: &mut dyn ExitUnilaterally, fee_rate_override: Option<FeeRate>, ) -> Result<Option<Vec<ExitProgressStatus>>>
Iterates over each registered VTXO and attempts to progress their unilateral exit. Note that Exit::sync or Exit::sync_no_progress should be called before calling this method.
§Parameters
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.
§Returns
The exit status of each VTXO being exited which has also not yet been spent
Sourcepub async fn sync(
&mut self,
wallet: &Wallet,
onchain: &mut dyn ExitUnilaterally,
) -> Result<()>
pub async fn sync( &mut self, wallet: &Wallet, onchain: &mut dyn ExitUnilaterally, ) -> Result<()>
For use when syncing. Pending exits will be initialized, the network status of each ExitTransactionPackage will be updated, and finally, any unilateral exits that are waiting for network updates will be progressed.
Sourcepub async fn sync_no_progress(
&mut self,
onchain: &dyn ExitUnilaterally,
) -> Result<()>
pub async fn sync_no_progress( &mut self, onchain: &dyn ExitUnilaterally, ) -> Result<()>
For use when syncing. Initializes pending exits and syncs any confirmed or broadcast child transactions. This differs from Exit::sync in that it doesn’t update the ExitState of a unilateral exit. This must be done manually by calling Exit::progress_exits. This permits the use of a read-only reference to the onchain wallet.
Sourcepub fn list_claimable(&self) -> Vec<&ExitVtxo>
pub fn list_claimable(&self) -> Vec<&ExitVtxo>
Lists all exits that are claimable
Sourcepub async fn sign_exit_claim_inputs(
&self,
psbt: &mut Psbt,
wallet: &Wallet,
) -> Result<()>
pub async 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