pub struct Transaction<'a, 'b, 'c, 'info, const NR_CHECKED_INPUTS: usize, const NR_LEAVES: usize, const NR_NULLIFIERS: usize, const NR_PUBLIC_INPUTS: usize, A: LightAccounts<'info>> {
pub input: TransactionInput<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, A>,
pub merkle_root: [u8; 32],
pub tx_integrity_hash: [u8; 32],
pub mint_pubkey: [u8; 32],
pub transferred_funds: bool,
pub computed_tx_integrity_hash: bool,
pub verified_proof: bool,
pub inserted_leaves: bool,
pub inserted_nullifier: bool,
pub fetched_root: bool,
pub fetched_mint: bool,
}Fields§
§input: TransactionInput<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, A>§merkle_root: [u8; 32]§tx_integrity_hash: [u8; 32]§mint_pubkey: [u8; 32]§transferred_funds: bool§computed_tx_integrity_hash: bool§verified_proof: bool§inserted_leaves: bool§inserted_nullifier: bool§fetched_root: bool§fetched_mint: boolImplementations§
Source§impl<'a, 'b, 'c, 'info, const NR_CHECKED_INPUTS: usize, const NR_LEAVES: usize, const NR_NULLIFIERS: usize, const NR_PUBLIC_INPUTS: usize, A: LightAccounts<'info>> Transaction<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, NR_PUBLIC_INPUTS, A>
impl<'a, 'b, 'c, 'info, const NR_CHECKED_INPUTS: usize, const NR_LEAVES: usize, const NR_NULLIFIERS: usize, const NR_PUBLIC_INPUTS: usize, A: LightAccounts<'info>> Transaction<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, NR_PUBLIC_INPUTS, A>
pub fn new( input: TransactionInput<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, A>, ) -> Transaction<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, NR_PUBLIC_INPUTS, A>
Sourcepub fn transact(&mut self) -> Result<()>
pub fn transact(&mut self) -> Result<()>
Transact is a wrapper function which computes the integrity hash, checks the root, verifies the zero knowledge proof, inserts leaves, inserts nullifiers, transfers funds and fees.
pub fn emit_indexer_transaction_event(&mut self) -> Result<()>
Sourcepub fn verify(&mut self) -> Result<()>
pub fn verify(&mut self) -> Result<()>
Verifies a Goth16 zero knowledge proof over the bn254 curve.
Sourcepub fn compute_tx_integrity_hash(&mut self) -> Result<()>
pub fn compute_tx_integrity_hash(&mut self) -> Result<()>
Computes the integrity hash of the transaction. This hash is an input to the ZKP, and ensures that the relayer cannot change parameters of the internal or unshield transaction. H(recipient_spl||recipient_sol||signer||relayer_fee||encrypted_utxos).
Sourcepub fn fetch_root(&mut self) -> Result<()>
pub fn fetch_root(&mut self) -> Result<()>
Fetches the root according to an index from the passed-in Merkle tree.
Sourcepub fn fetch_mint(&mut self) -> Result<()>
pub fn fetch_mint(&mut self) -> Result<()>
Fetches the token mint from passed in sender_spl account. If the sender_spl account is not a token account, native mint is assumed.
Sourcepub fn insert_leaves(&mut self) -> Result<()>
pub fn insert_leaves(&mut self) -> Result<()>
Calls the Merkle tree program via cpi to insert transaction leaves.
Sourcepub fn insert_nullifiers(&mut self) -> Result<()>
pub fn insert_nullifiers(&mut self) -> Result<()>
Calls merkle tree via cpi to insert nullifiers.
Sourcepub fn transfer_user_funds(&mut self) -> Result<()>
pub fn transfer_user_funds(&mut self) -> Result<()>
Transfers user funds either to or from a merkle tree liquidity pool.
Sourcepub fn transfer_fee(&self) -> Result<()>
pub fn transfer_fee(&self) -> Result<()>
Transfers the relayer fee to or from a merkle tree liquidity pool.
Sourcepub fn is_shield_spl(&self) -> bool
pub fn is_shield_spl(&self) -> bool
Checks whether a transaction is a shield by inspecting the public amount.
Sourcepub fn is_shield_sol(&self) -> bool
pub fn is_shield_sol(&self) -> bool
Checks whether a transaction is a deposit by inspecting the public amount.
pub fn check_sol_pool_account_derivation( &self, pubkey: &Pubkey, data: &[u8], ) -> Result<()>
pub fn check_spl_pool_account_derivation( &self, pubkey: &Pubkey, mint: &Pubkey, ) -> Result<()>
pub fn check_completion(&self) -> Result<()>
pub fn check_amount( &self, relayer_fee: u64, amount: [u8; 32], ) -> Result<(u64, u64)>
Trait Implementations§
Source§impl<'a, 'b, 'c, 'info, const NR_CHECKED_INPUTS: usize, const NR_LEAVES: usize, const NR_NULLIFIERS: usize, const NR_PUBLIC_INPUTS: usize, A: Clone + LightAccounts<'info>> Clone for Transaction<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, NR_PUBLIC_INPUTS, A>
impl<'a, 'b, 'c, 'info, const NR_CHECKED_INPUTS: usize, const NR_LEAVES: usize, const NR_NULLIFIERS: usize, const NR_PUBLIC_INPUTS: usize, A: Clone + LightAccounts<'info>> Clone for Transaction<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, NR_PUBLIC_INPUTS, A>
Source§fn clone(
&self,
) -> Transaction<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, NR_PUBLIC_INPUTS, A>
fn clone( &self, ) -> Transaction<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, NR_PUBLIC_INPUTS, A>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<'a, 'b, 'c, 'info, const NR_CHECKED_INPUTS: usize, const NR_LEAVES: usize, const NR_NULLIFIERS: usize, const NR_PUBLIC_INPUTS: usize, A> !RefUnwindSafe for Transaction<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, NR_PUBLIC_INPUTS, A>
impl<'a, 'b, 'c, 'info, const NR_CHECKED_INPUTS: usize, const NR_LEAVES: usize, const NR_NULLIFIERS: usize, const NR_PUBLIC_INPUTS: usize, A> !Send for Transaction<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, NR_PUBLIC_INPUTS, A>
impl<'a, 'b, 'c, 'info, const NR_CHECKED_INPUTS: usize, const NR_LEAVES: usize, const NR_NULLIFIERS: usize, const NR_PUBLIC_INPUTS: usize, A> !Sync for Transaction<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, NR_PUBLIC_INPUTS, A>
impl<'a, 'b, 'c, 'info, const NR_CHECKED_INPUTS: usize, const NR_LEAVES: usize, const NR_NULLIFIERS: usize, const NR_PUBLIC_INPUTS: usize, A> !UnwindSafe for Transaction<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, NR_PUBLIC_INPUTS, A>
impl<'a, 'b, 'c, 'info, const NR_CHECKED_INPUTS: usize, const NR_LEAVES: usize, const NR_NULLIFIERS: usize, const NR_PUBLIC_INPUTS: usize, A> Freeze for Transaction<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, NR_PUBLIC_INPUTS, A>
impl<'a, 'b, 'c, 'info, const NR_CHECKED_INPUTS: usize, const NR_LEAVES: usize, const NR_NULLIFIERS: usize, const NR_PUBLIC_INPUTS: usize, A> Unpin for Transaction<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, NR_PUBLIC_INPUTS, A>
impl<'a, 'b, 'c, 'info, const NR_CHECKED_INPUTS: usize, const NR_LEAVES: usize, const NR_NULLIFIERS: usize, const NR_PUBLIC_INPUTS: usize, A> UnsafeUnpin for Transaction<'a, 'b, 'c, 'info, NR_CHECKED_INPUTS, NR_LEAVES, NR_NULLIFIERS, NR_PUBLIC_INPUTS, A>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more