pub struct TransactionChangesBuilder { /* private fields */ }Expand description
Builds TransactionChanges struct
Ensures uniqueness for contract addresses and component ids.
Implementations§
Source§impl TransactionChangesBuilder
impl TransactionChangesBuilder
Sourcepub fn new(tx: &Transaction) -> Self
pub fn new(tx: &Transaction) -> Self
Initialize a new builder for a transaction.
Sourcepub fn add_contract_changes(&mut self, change: &InterimContractChange)
pub fn add_contract_changes(&mut self, change: &InterimContractChange)
Register a new contract change.
Will prioritize the new change over any already present one.
Sourcepub fn changed_contracts(&self) -> impl Iterator<Item = &[u8]>
pub fn changed_contracts(&self) -> impl Iterator<Item = &[u8]>
Unique contract/account addresses that have been changed so far.
Sourcepub fn mark_component_as_updated(&mut self, component_id: &str)
pub fn mark_component_as_updated(&mut self, component_id: &str)
Marks a component as updated.
If the protocol does not follow a 1:1 logic between components and contracts. Components can be manually marked as updated using this method.
Sourcepub fn change_component_pause_state(&mut self, component_id: &str, paused: bool)
pub fn change_component_pause_state(&mut self, component_id: &str, paused: bool)
Marks a protocol component as paused or unpaused.
Enables/disables swapping on the protocol component.
§Parameters
component_id- The unique identifier of the protocol componentpaused-trueto pause the component,falseto unpause it
Sourcepub fn add_entity_change(&mut self, change: &EntityChanges)
pub fn add_entity_change(&mut self, change: &EntityChanges)
Registers a new entity change.
Will prioritize the new change over any already present one.
Sourcepub fn add_protocol_component(&mut self, component: &ProtocolComponent)
pub fn add_protocol_component(&mut self, component: &ProtocolComponent)
Adds a new protocol component.
§Note
This method is a noop, in case the component is already present. Since components are assumed to be immutable.
Sourcepub fn add_balance_change(&mut self, change: &BalanceChange)
pub fn add_balance_change(&mut self, change: &BalanceChange)
Updates a components balances
Overwrites any previous balance changes of the component if present.
Sourcepub fn add_entrypoint(&mut self, entrypoint: &EntryPoint)
pub fn add_entrypoint(&mut self, entrypoint: &EntryPoint)
Adds a new entrypoint to the transaction. It adds to the set of already existing entrypoints.
pub fn add_entrypoint_params(&mut self, entrypoint: &EntryPointParams)
pub fn build(self) -> Option<TransactionChanges>
Trait Implementations§
Source§impl Default for TransactionChangesBuilder
impl Default for TransactionChangesBuilder
Source§fn default() -> TransactionChangesBuilder
fn default() -> TransactionChangesBuilder
Auto Trait Implementations§
impl Freeze for TransactionChangesBuilder
impl RefUnwindSafe for TransactionChangesBuilder
impl Send for TransactionChangesBuilder
impl Sync for TransactionChangesBuilder
impl Unpin for TransactionChangesBuilder
impl UnwindSafe for TransactionChangesBuilder
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> 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