pub trait BarkPersister:
Send
+ Sync
+ 'static {
Show 43 methods
// Required methods
fn init_wallet<'life0, 'life1, 'async_trait>(
&'life0 self,
properties: &'life1 WalletProperties,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn initialize_bdk_wallet<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ChangeSet>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn store_bdk_wallet_changeset<'life0, 'life1, 'async_trait>(
&'life0 self,
changeset: &'life1 ChangeSet,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_properties<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<WalletProperties>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn check_recipient_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
recipient: &'life1 PaymentMethod,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn create_new_movement<'life0, 'life1, 'async_trait>(
&'life0 self,
status: MovementStatus,
subsystem: &'life1 MovementSubsystem,
time: DateTime<Local>,
) -> Pin<Box<dyn Future<Output = Result<MovementId>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn update_movement<'life0, 'life1, 'async_trait>(
&'life0 self,
movement: &'life1 Movement,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_movement_by_id<'life0, 'async_trait>(
&'life0 self,
movement_id: MovementId,
) -> Pin<Box<dyn Future<Output = Result<Movement>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_all_movements<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Movement>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn store_pending_board<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
vtxo: &'life1 Vtxo,
funding_tx: &'life2 Transaction,
movement_id: MovementId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn remove_pending_board<'life0, 'life1, 'async_trait>(
&'life0 self,
vtxo_id: &'life1 VtxoId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_all_pending_board_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<VtxoId>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_pending_board_by_vtxo_id<'life0, 'async_trait>(
&'life0 self,
vtxo_id: VtxoId,
) -> Pin<Box<dyn Future<Output = Result<Option<PendingBoard>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn store_round_state_lock_vtxos<'life0, 'life1, 'async_trait>(
&'life0 self,
round_state: &'life1 RoundState,
) -> Pin<Box<dyn Future<Output = Result<RoundStateId>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn update_round_state<'life0, 'life1, 'async_trait>(
&'life0 self,
round_state: &'life1 StoredRoundState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn remove_round_state<'life0, 'life1, 'async_trait>(
&'life0 self,
round_state: &'life1 StoredRoundState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn load_round_states<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredRoundState>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn store_vtxos<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
vtxos: &'life1 [(&'life2 Vtxo, &'life3 VtxoState)],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn get_wallet_vtxo<'life0, 'async_trait>(
&'life0 self,
id: VtxoId,
) -> Pin<Box<dyn Future<Output = Result<Option<WalletVtxo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_all_vtxos<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<WalletVtxo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_vtxos_by_state<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 [VtxoStateKind],
) -> Pin<Box<dyn Future<Output = Result<Vec<WalletVtxo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn remove_vtxo<'life0, 'async_trait>(
&'life0 self,
id: VtxoId,
) -> Pin<Box<dyn Future<Output = Result<Option<Vtxo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn has_spent_vtxo<'life0, 'async_trait>(
&'life0 self,
id: VtxoId,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn store_vtxo_key<'life0, 'async_trait>(
&'life0 self,
index: u32,
public_key: PublicKey,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_last_vtxo_key_index<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_public_key_idx<'life0, 'life1, 'async_trait>(
&'life0 self,
public_key: &'life1 PublicKey,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn store_new_pending_lightning_send<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
invoice: &'life1 Invoice,
amount: &'life2 Amount,
vtxos: &'life3 [VtxoId],
movement_id: MovementId,
) -> Pin<Box<dyn Future<Output = Result<LightningSend>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn get_all_pending_lightning_send<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<LightningSend>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn finish_lightning_send<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
preimage: Option<Preimage>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn remove_lightning_send<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_lightning_send<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<Option<LightningSend>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn store_lightning_receive<'life0, 'life1, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
preimage: Preimage,
invoice: &'life1 Bolt11Invoice,
htlc_recv_cltv_delta: BlockDelta,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_all_pending_lightning_receives<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<LightningReceive>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_preimage_revealed<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_lightning_receive<'life0, 'life1, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
htlc_vtxo_ids: &'life1 [VtxoId],
movement_id: MovementId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fetch_lightning_receive_by_payment_hash<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<Option<LightningReceive>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn finish_pending_lightning_receive<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn store_exit_vtxo_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
exit: &'life1 StoredExit,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn remove_exit_vtxo_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 VtxoId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_exit_vtxo_entries<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredExit>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn store_exit_child_tx<'life0, 'life1, 'async_trait>(
&'life0 self,
exit_txid: Txid,
child_tx: &'life1 Transaction,
origin: ExitTxOrigin,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_exit_child_tx<'life0, 'async_trait>(
&'life0 self,
exit_txid: Txid,
) -> Pin<Box<dyn Future<Output = Result<Option<(Transaction, ExitTxOrigin)>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_vtxo_state_checked<'life0, 'life1, 'async_trait>(
&'life0 self,
vtxo_id: VtxoId,
new_state: VtxoState,
allowed_old_states: &'life1 [VtxoStateKind],
) -> Pin<Box<dyn Future<Output = Result<WalletVtxo>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Storage interface for Bark wallets.
Implement this trait to plug a custom persistence backend. The wallet uses it to:
- Initialize and read wallet properties and configuration.
- Record movements (spends/receives), recipients, and enforce Vtxo state transitions.
- Manage round lifecycles (attempts, pending confirmation, confirmations/cancellations).
- Persist ephemeral protocol artifacts (e.g., secret nonces) transactionally.
- Track Lightning receives and preimage revelation.
- Track exit-related data and associated child transactions.
- Persist the last synchronized Ark block height.
Feature integration:
- With the
onchain_bdkfeature, methods are provided to initialize and persist a BDK wallet ChangeSet in the same storage.
Notes for implementors:
- Ensure that operations that change multiple records (e.g., registering a movement, storing round state transitions) are executed transactionally.
- Enforce state integrity by verifying allowed_old_states before updating a Vtxo state.
- If your backend is not thread-safe, prefer a short-lived connection per call or use an internal pool with checked-out connections per operation.
- Return precise errors so callers can surface actionable diagnostics.
Required Methods§
Sourcefn init_wallet<'life0, 'life1, 'async_trait>(
&'life0 self,
properties: &'life1 WalletProperties,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn init_wallet<'life0, 'life1, 'async_trait>(
&'life0 self,
properties: &'life1 WalletProperties,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Initialize a wallet in storage with the provided properties.
Call exactly once per wallet database. Subsequent calls should fail to prevent accidental re-initialization.
Parameters:
- properties: WalletProperties to persist (e.g., network, descriptors, metadata).
Returns:
Ok(())on success.
Errors:
- Returns an error if the wallet is already initialized or if persistence fails.
Sourcefn initialize_bdk_wallet<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ChangeSet>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize_bdk_wallet<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ChangeSet>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initialize the onchain BDK wallet and return any previously stored ChangeSet.
Must be called before storing any new BDK changesets to bootstrap the BDK state.
Feature: only available with onchain_bdk.
Returns:
Ok(ChangeSet)containing the previously persisted BDK state (possibly empty).
Errors:
- Returns an error if the BDK state cannot be created or loaded.
Sourcefn store_bdk_wallet_changeset<'life0, 'life1, 'async_trait>(
&'life0 self,
changeset: &'life1 ChangeSet,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_bdk_wallet_changeset<'life0, 'life1, 'async_trait>(
&'life0 self,
changeset: &'life1 ChangeSet,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persist an incremental BDK ChangeSet.
The changeset should be applied atomically. Callers typically obtain the changeset from a BDK wallet instance after mutating wallet state (e.g., sync).
Feature: only available with onchain_bdk.
Parameters:
- changeset: The BDK ChangeSet to persist.
Errors:
- Returns an error if the changeset cannot be written.
Sourcefn read_properties<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<WalletProperties>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_properties<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<WalletProperties>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read wallet properties from storage.
Returns:
Ok(Some(WalletProperties))if the wallet has been initialized.Ok(None)if no wallet exists yet.
Errors:
- Returns an error on I/O or deserialization failures.
Sourcefn check_recipient_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
recipient: &'life1 PaymentMethod,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check_recipient_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
recipient: &'life1 PaymentMethod,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check whether a recipient identifier already exists.
Useful to avoid storing duplicate recipients for the same logical payee or duplicated lightning invoice payments (unsafe)
Parameters:
- recipient: A recipient identifier (e.g., invoice).
Returns:
Ok(true)if the recipient exists,Ok(false)otherwise.
Errors:
- Returns an error if the lookup fails.
Sourcefn create_new_movement<'life0, 'life1, 'async_trait>(
&'life0 self,
status: MovementStatus,
subsystem: &'life1 MovementSubsystem,
time: DateTime<Local>,
) -> Pin<Box<dyn Future<Output = Result<MovementId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_new_movement<'life0, 'life1, 'async_trait>(
&'life0 self,
status: MovementStatus,
subsystem: &'life1 MovementSubsystem,
time: DateTime<Local>,
) -> Pin<Box<dyn Future<Output = Result<MovementId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a new movement in the given state, ready to be updated.
Parameters:
- status: The desired status for the new movement.
- subsystem: The subsystem that created the movement.
- time: The time the movement should be marked as created.
Returns:
Ok(MovementId)of the newly created movement.
Errors:
- Returns an error if the movement is unable to be created.
Sourcefn update_movement<'life0, 'life1, 'async_trait>(
&'life0 self,
movement: &'life1 Movement,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_movement<'life0, 'life1, 'async_trait>(
&'life0 self,
movement: &'life1 Movement,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persists the given movement state.
Parameters:
- movement: The movement and its associated data to be persisted.
Errors:
- Returns an error if updating the movement fails for any reason.
Sourcefn get_movement_by_id<'life0, 'async_trait>(
&'life0 self,
movement_id: MovementId,
) -> Pin<Box<dyn Future<Output = Result<Movement>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_movement_by_id<'life0, 'async_trait>(
&'life0 self,
movement_id: MovementId,
) -> Pin<Box<dyn Future<Output = Result<Movement>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets the movement with the given MovementId.
Parameters:
- movement_id: The ID of the movement to retrieve.
Returns:
Ok(Movement)if the movement exists.
Errors:
- If the movement does not exist.
- If retrieving the movement fails.
Sourcefn get_all_movements<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Movement>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_all_movements<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Movement>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets every stored movement.
Returns:
Ok(Vec<Movement>)containing all movements, empty if none exist.
Errors:
- If retrieving the movements fails.
Sourcefn store_pending_board<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
vtxo: &'life1 Vtxo,
funding_tx: &'life2 Transaction,
movement_id: MovementId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn store_pending_board<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
vtxo: &'life1 Vtxo,
funding_tx: &'life2 Transaction,
movement_id: MovementId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store a pending board.
Parameters:
- vtxo: The Vtxo to store.
- funding_txid: The funding Txid.
- movement_id: The MovementId associated with this board.
Errors:
- Returns an error if the board cannot be stored.
Sourcefn remove_pending_board<'life0, 'life1, 'async_trait>(
&'life0 self,
vtxo_id: &'life1 VtxoId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_pending_board<'life0, 'life1, 'async_trait>(
&'life0 self,
vtxo_id: &'life1 VtxoId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove a pending board.
Parameters:
- vtxo_id: The VtxoId to remove.
Errors:
- Returns an error if the board cannot be removed.
Sourcefn get_all_pending_board_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<VtxoId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_all_pending_board_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<VtxoId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the VtxoId for each pending board.
Returns:
Ok(Vec<VtxoId>)possibly empty.
Errors:
- Returns an error if the query fails.
Sourcefn get_pending_board_by_vtxo_id<'life0, 'async_trait>(
&'life0 self,
vtxo_id: VtxoId,
) -> Pin<Box<dyn Future<Output = Result<Option<PendingBoard>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_pending_board_by_vtxo_id<'life0, 'async_trait>(
&'life0 self,
vtxo_id: VtxoId,
) -> Pin<Box<dyn Future<Output = Result<Option<PendingBoard>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the PendingBoard associated with the given VtxoId.
Returns:
Ok(Some(PendingBoard))if a matching board existsOk(None)if no matching board exists
Errors:
- Returns an error if the query fails.
Sourcefn store_round_state_lock_vtxos<'life0, 'life1, 'async_trait>(
&'life0 self,
round_state: &'life1 RoundState,
) -> Pin<Box<dyn Future<Output = Result<RoundStateId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_round_state_lock_vtxos<'life0, 'life1, 'async_trait>(
&'life0 self,
round_state: &'life1 RoundState,
) -> Pin<Box<dyn Future<Output = Result<RoundStateId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store a new ongoing round state and lock the VTXOs in round
Parameters:
round_state: the state to store
Returns:
RoundStateId: the storaged ID of the new state
Errors:
- returns an error of the new round state could not be stored or the VTXOs couldn’t be marked as locked
Sourcefn update_round_state<'life0, 'life1, 'async_trait>(
&'life0 self,
round_state: &'life1 StoredRoundState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_round_state<'life0, 'life1, 'async_trait>(
&'life0 self,
round_state: &'life1 StoredRoundState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update an existing stored pending round state
Parameters:
round_state: the round state to update
Errors:
- returns an error of the existing round state could not be found or updated
Sourcefn remove_round_state<'life0, 'life1, 'async_trait>(
&'life0 self,
round_state: &'life1 StoredRoundState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_round_state<'life0, 'life1, 'async_trait>(
&'life0 self,
round_state: &'life1 StoredRoundState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove a pending round state from the db
Parameters:
round_state: the round state to remove
Errors:
- returns an error of the existing round state could not be found or removed
Sourcefn load_round_states<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredRoundState>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_round_states<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredRoundState>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load all pending round states from the db
Returns:
Vec<StoredRoundState>: unordered vector with all stored round states
Errors:
- returns an error of the states could not be succesfully retrieved
Sourcefn store_vtxos<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
vtxos: &'life1 [(&'life2 Vtxo, &'life3 VtxoState)],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn store_vtxos<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
vtxos: &'life1 [(&'life2 Vtxo, &'life3 VtxoState)],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Stores VTXOs with their initial state.
This operation is idempotent: if a VTXO already exists (same id), the
implementation should succeed without modifying the existing VTXO or its
state. This allows safe retries during crash recovery scenarios.
§Parameters
vtxos: Slice of VTXO and state pairs to store.
§Behavior
- For each VTXO that does not exist: inserts the VTXO and its initial state.
- For each VTXO that already exists: no-op for that VTXO.
§Errors
- Returns an error if the storage operation fails.
Sourcefn get_wallet_vtxo<'life0, 'async_trait>(
&'life0 self,
id: VtxoId,
) -> Pin<Box<dyn Future<Output = Result<Option<WalletVtxo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_wallet_vtxo<'life0, 'async_trait>(
&'life0 self,
id: VtxoId,
) -> Pin<Box<dyn Future<Output = Result<Option<WalletVtxo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn get_all_vtxos<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<WalletVtxo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_all_vtxos<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<WalletVtxo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fetch all wallet VTXOs in the database.
Returns:
Ok(Vec<WalletVtxo>)possibly empty.
Errors:
- Returns an error if the query fails.
Sourcefn get_vtxos_by_state<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 [VtxoStateKind],
) -> Pin<Box<dyn Future<Output = Result<Vec<WalletVtxo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_vtxos_by_state<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 [VtxoStateKind],
) -> Pin<Box<dyn Future<Output = Result<Vec<WalletVtxo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch all wallet VTXOs whose state matches any of the provided kinds.
Parameters:
- state: Slice of
VtxoStateKindfilters.
Returns:
Ok(Vec<WalletVtxo>)possibly empty.
Errors:
- Returns an error if the query fails.
Sourcefn remove_vtxo<'life0, 'async_trait>(
&'life0 self,
id: VtxoId,
) -> Pin<Box<dyn Future<Output = Result<Option<Vtxo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remove_vtxo<'life0, 'async_trait>(
&'life0 self,
id: VtxoId,
) -> Pin<Box<dyn Future<Output = Result<Option<Vtxo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn has_spent_vtxo<'life0, 'async_trait>(
&'life0 self,
id: VtxoId,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn has_spent_vtxo<'life0, 'async_trait>(
&'life0 self,
id: VtxoId,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check whether a Vtxo is already marked spent.
Parameters:
- id: VtxoId to check.
Returns:
Ok(true)if spent,Ok(false)if not found or not spent.
Errors:
- Returns an error if the lookup fails.
Sourcefn store_vtxo_key<'life0, 'async_trait>(
&'life0 self,
index: u32,
public_key: PublicKey,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_vtxo_key<'life0, 'async_trait>(
&'life0 self,
index: u32,
public_key: PublicKey,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Store a newly derived/assigned Vtxo public key index mapping.
Parameters:
- index: Derivation index.
- public_key: PublicKey at that index.
Errors:
- Returns an error if the mapping cannot be stored.
Sourcefn get_last_vtxo_key_index<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_last_vtxo_key_index<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the last revealed/used Vtxo key index.
Returns:
Ok(Some(u32))if a key was storedOk(None)otherwise.
Errors:
- Returns an error if the query fails.
Sourcefn get_public_key_idx<'life0, 'life1, 'async_trait>(
&'life0 self,
public_key: &'life1 PublicKey,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_public_key_idx<'life0, 'life1, 'async_trait>(
&'life0 self,
public_key: &'life1 PublicKey,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves the derivation index of the provided PublicKey from the database
Returns:
Ok(Some(u32))if the key was stored.Ok(None)if the key was not stored.
Errors:
- Returns an error if the query fails.
Sourcefn store_new_pending_lightning_send<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
invoice: &'life1 Invoice,
amount: &'life2 Amount,
vtxos: &'life3 [VtxoId],
movement_id: MovementId,
) -> Pin<Box<dyn Future<Output = Result<LightningSend>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn store_new_pending_lightning_send<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
invoice: &'life1 Invoice,
amount: &'life2 Amount,
vtxos: &'life3 [VtxoId],
movement_id: MovementId,
) -> Pin<Box<dyn Future<Output = Result<LightningSend>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Store a new pending lightning send.
Parameters:
- invoice: The invoice of the pending lightning send.
- amount: The amount of the pending lightning send.
- vtxos: The vtxos of the pending lightning send.
Errors:
- Returns an error if the pending lightning send cannot be stored.
Sourcefn get_all_pending_lightning_send<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<LightningSend>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_all_pending_lightning_send<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<LightningSend>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get all pending lightning sends.
Returns:
Ok(Vec<LightningSend>)possibly empty.
Errors:
- Returns an error if the query fails.
Sourcefn finish_lightning_send<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
preimage: Option<Preimage>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn finish_lightning_send<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
preimage: Option<Preimage>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Mark a lightning send as finished.
Parameters:
- payment_hash: The PaymentHash of the lightning send to update.
- preimage: The Preimage of the successful lightning send.
Errors:
- Returns an error if the lightning send cannot be updated.
Sourcefn remove_lightning_send<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remove_lightning_send<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Remove a lightning send.
Parameters:
- payment_hash: The PaymentHash of the lightning send to remove.
Errors:
- Returns an error if the lightning send cannot be removed.
Sourcefn get_lightning_send<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<Option<LightningSend>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_lightning_send<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<Option<LightningSend>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get a lightning send by payment hash
Parameters:
- payment_hash: The PaymentHash of the lightning send to get.
Errors:
- Returns an error if the lookup fails.
Sourcefn store_lightning_receive<'life0, 'life1, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
preimage: Preimage,
invoice: &'life1 Bolt11Invoice,
htlc_recv_cltv_delta: BlockDelta,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_lightning_receive<'life0, 'life1, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
preimage: Preimage,
invoice: &'life1 Bolt11Invoice,
htlc_recv_cltv_delta: BlockDelta,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store an incoming Lightning receive record.
Parameters:
- payment_hash: Unique payment hash.
- preimage: Payment preimage (kept until disclosure).
- invoice: The associated BOLT11 invoice.
- htlc_recv_cltv_delta: The CLTV delta for the HTLC VTXO.
Errors:
- Returns an error if the receive cannot be stored.
Sourcefn get_all_pending_lightning_receives<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<LightningReceive>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_all_pending_lightning_receives<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<LightningReceive>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns a list of all pending lightning receives
Returns:
Ok(Vec<LightningReceive>)possibly empty.
Errors:
- Returns an error if the query fails.
Sourcefn set_preimage_revealed<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_preimage_revealed<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Mark a Lightning receive preimage as revealed (e.g., after settlement).
Parameters:
- payment_hash: The payment hash identifying the receive.
Errors:
- Returns an error if the update fails or the receive does not exist.
Sourcefn update_lightning_receive<'life0, 'life1, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
htlc_vtxo_ids: &'life1 [VtxoId],
movement_id: MovementId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_lightning_receive<'life0, 'life1, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
htlc_vtxo_ids: &'life1 [VtxoId],
movement_id: MovementId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Set the VTXO IDs and MovementId for a LightningReceive.
Parameters:
- payment_hash: The payment hash identifying the receive.
- htlc_vtxo_ids: The VTXO IDs to set.
- movement_id: The movement ID associated with the invoice.
Errors:
- Returns an error if the update fails or the receive does not exist.
Sourcefn fetch_lightning_receive_by_payment_hash<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<Option<LightningReceive>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn fetch_lightning_receive_by_payment_hash<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<Option<LightningReceive>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fetch a Lightning receive by its payment hash.
Parameters:
- payment_hash: The payment hash to look up.
Returns:
Ok(Some(LightningReceive))if found,Ok(None)otherwise.
Errors:
- Returns an error if the lookup fails.
Sourcefn finish_pending_lightning_receive<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn finish_pending_lightning_receive<'life0, 'async_trait>(
&'life0 self,
payment_hash: PaymentHash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Remove a Lightning receive by its payment hash.
Parameters:
- payment_hash: The payment hash of the record to remove.
Errors:
- Returns an error if the removal fails.
Sourcefn store_exit_vtxo_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
exit: &'life1 StoredExit,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_exit_vtxo_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
exit: &'life1 StoredExit,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store an entry indicating a Vtxo is being exited.
Parameters:
- exit: StoredExit describing the exit operation.
Errors:
- Returns an error if the entry cannot be stored.
Sourcefn remove_exit_vtxo_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 VtxoId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_exit_vtxo_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 VtxoId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove an exit entry for a given Vtxo ID.
Parameters:
- id: VtxoId to remove from exit tracking.
Errors:
- Returns an error if the removal fails.
Sourcefn get_exit_vtxo_entries<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredExit>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_exit_vtxo_entries<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredExit>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all VTXOs currently tracked as being exited.
Returns:
Ok(Vec<StoredExit>)possibly empty.
Errors:
- Returns an error if the query fails.
Sourcefn store_exit_child_tx<'life0, 'life1, 'async_trait>(
&'life0 self,
exit_txid: Txid,
child_tx: &'life1 Transaction,
origin: ExitTxOrigin,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_exit_child_tx<'life0, 'life1, 'async_trait>(
&'life0 self,
exit_txid: Txid,
child_tx: &'life1 Transaction,
origin: ExitTxOrigin,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store a child transaction related to an exit transaction.
Parameters:
- exit_txid: The parent exit transaction ID.
- child_tx: The child bitcoin Transaction to store.
- origin: Metadata describing where the child came from (ExitTxOrigin).
Errors:
- Returns an error if the transaction cannot be stored.
Sourcefn get_exit_child_tx<'life0, 'async_trait>(
&'life0 self,
exit_txid: Txid,
) -> Pin<Box<dyn Future<Output = Result<Option<(Transaction, ExitTxOrigin)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_exit_child_tx<'life0, 'async_trait>(
&'life0 self,
exit_txid: Txid,
) -> Pin<Box<dyn Future<Output = Result<Option<(Transaction, ExitTxOrigin)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieve a stored child transaction for a given exit transaction ID.
Parameters:
- exit_txid: The parent exit transaction ID.
Returns:
Ok(Some((Transaction, ExitTxOrigin)))if found,Ok(None)otherwise.
Errors:
- Returns an error if the lookup fails.
Sourcefn update_vtxo_state_checked<'life0, 'life1, 'async_trait>(
&'life0 self,
vtxo_id: VtxoId,
new_state: VtxoState,
allowed_old_states: &'life1 [VtxoStateKind],
) -> Pin<Box<dyn Future<Output = Result<WalletVtxo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_vtxo_state_checked<'life0, 'life1, 'async_trait>(
&'life0 self,
vtxo_id: VtxoId,
new_state: VtxoState,
allowed_old_states: &'life1 [VtxoStateKind],
) -> Pin<Box<dyn Future<Output = Result<WalletVtxo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Updates the state of the VTXO corresponding to the given VtxoId, provided that their
current state is one of the given allowed_states.
§Parameters
vtxo_id: The ID of the Vtxo to update.state: The new state to be set for the specified Vtxo.allowed_states: An iterable collection of allowed states (VtxoStateKind) that the Vtxo must currently be in for their state to be updated to the newstate.
§Returns
Ok(WalletVtxo)if the state update is successful.Err(anyhow::Error)if the VTXO fails to meet the required conditions, or if another error occurs during the operation.
§Errors
- Returns an error if the current state is not within the
allowed_states. - Returns an error for any other issues encountered during the operation.