Struct Exit

Source
pub struct Exit { /* private fields */ }
Expand description

Handles the process of ongoing VTXO exits.

Implementations§

Source§

impl Exit

Source

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.
Source

pub fn get_exit_vtxo(&self, vtxo_id: VtxoId) -> Option<&ExitVtxo>

Returns a reference to the tracked ExitVtxo if it exists.

Source

pub fn get_exit_vtxos(&self) -> &Vec<ExitVtxo>

Returns all known unilateral exits in this wallet.

Source

pub fn has_pending_exits(&self) -> bool

True if there are any unilateral exits which have been started but are not yet claimable.

Source

pub fn pending_total(&self) -> Amount

Returns the total amount of all VTXOs requiring more txs to be confirmed

Source

pub async fn all_claimable_at_height(&self) -> Option<BlockHeight>

Returns the earliest block height at which all tracked exits will be claimable

Source

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.

Source

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.

Source

pub fn list_vtxos_to_exit(&self) -> Vec<VtxoId>

Lists the IDs of VTXOs marked for unilateral exit.

Source

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.

Source

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.

Source

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
  • onchain is used to build the CPFP transaction package we use to broadcast the unilateral exit transaction
  • fee_rate_override sets 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

Source

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.

Source

pub fn list_claimable(&self) -> Vec<&ExitVtxo>

Lists all exits that are claimable

Source

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

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,