Skip to content

Commit

Permalink
Add SwapBundle struct
Browse files Browse the repository at this point in the history
  • Loading branch information
ConstanceBeguier committed Oct 11, 2024
1 parent 1c73f78 commit d1f9b76
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use crate::{
note::{AssetBase, Note},
note_encryption::{OrchardDomain, OrchardDomainCommon},
orchard_flavor::OrchardFlavor,
orchard_flavor::OrchardZSA,
primitives::redpallas::{self, Binding, SpendAuth},
tree::Anchor,
value::{NoteValue, ValueCommitTrapdoor, ValueCommitment, ValueSum},
Expand Down Expand Up @@ -456,6 +457,21 @@ impl<A: Authorization, V, D: OrchardDomainCommon> Bundle<A, V, D> {
}
}

/// A swap bundle to be applied to the ledger.
#[derive(Clone, Debug)]
pub struct SwapBundle<V> {
/// The list of action groups that make up this swap bundle.
action_groups: Vec<Bundle<Authorized, V, OrchardZSA>>,
/// Orchard-specific transaction-level flags for this swap.
flags: Flags,
/// The net value moved out of this swap.
///
/// This is the sum of Orchard spends minus the sum of Orchard outputs.
value_balance: V,
/// The binding signature for this swap.
binding_signature: redpallas::Signature<Binding>,
}

pub(crate) fn derive_bvk<'a, A: 'a, V: Clone + Into<i64>, FL: 'a + OrchardFlavor>(
actions: impl IntoIterator<Item = &'a Action<A, FL>>,
value_balance: V,
Expand Down

0 comments on commit d1f9b76

Please sign in to comment.