pub struct AccountChangesWithTx {
pub account_deltas: HashMap<Address, AccountDelta>,
pub protocol_components: HashMap<ComponentId, ProtocolComponent>,
pub component_balances: HashMap<ComponentId, HashMap<Address, ComponentBalance>>,
pub account_balances: HashMap<Address, HashMap<Address, AccountBalance>>,
pub tx: Transaction,
}Expand description
Updates grouped by their respective transaction.
Fields§
§account_deltas: HashMap<Address, AccountDelta>§protocol_components: HashMap<ComponentId, ProtocolComponent>§component_balances: HashMap<ComponentId, HashMap<Address, ComponentBalance>>§account_balances: HashMap<Address, HashMap<Address, AccountBalance>>§tx: TransactionImplementations§
Source§impl AccountChangesWithTx
impl AccountChangesWithTx
pub fn new( account_deltas: HashMap<Address, AccountDelta>, protocol_components: HashMap<ComponentId, ProtocolComponent>, component_balances: HashMap<ComponentId, HashMap<Address, ComponentBalance>>, account_balances: HashMap<Address, HashMap<Address, AccountBalance>>, tx: Transaction, ) -> Self
Sourcepub fn merge(&mut self, other: &AccountChangesWithTx) -> Result<(), MergeError>
pub fn merge(&mut self, other: &AccountChangesWithTx) -> Result<(), MergeError>
Merges this update with another one.
The method combines two AccountUpdateWithTx instances under certain
conditions:
- The block from which both updates came should be the same. If the updates are from different blocks, the method will return an error.
- The transactions for each of the updates should be distinct. If they come from the same transaction, the method will return an error.
- The order of the transaction matters. The transaction from
othermust have occurred later than the self transaction. If the self transaction has a higher index thanother, the method will return an error.
The merged update keeps the transaction of other.
§Errors
This method will return an error if any of the above conditions is violated.
Trait Implementations§
Source§impl Clone for AccountChangesWithTx
impl Clone for AccountChangesWithTx
Source§fn clone(&self) -> AccountChangesWithTx
fn clone(&self) -> AccountChangesWithTx
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AccountChangesWithTx
impl Debug for AccountChangesWithTx
Source§impl From<&AccountChangesWithTx> for Vec<Account>
impl From<&AccountChangesWithTx> for Vec<Account>
Source§fn from(value: &AccountChangesWithTx) -> Self
fn from(value: &AccountChangesWithTx) -> Self
Creates a full account from a change.
This can be used to get an insertable an account if we know the update is actually a creation.
Assumes that all relevant changes are set on self if something is
missing, it will use the corresponding types default.
Will use the associated transaction as creation, balance and code modify
transaction.
Source§impl From<AccountChangesWithTx> for TxWithChanges
impl From<AccountChangesWithTx> for TxWithChanges
Source§fn from(value: AccountChangesWithTx) -> Self
fn from(value: AccountChangesWithTx) -> Self
Converts to this type from the input type.
Source§impl PartialEq for AccountChangesWithTx
impl PartialEq for AccountChangesWithTx
impl StructuralPartialEq for AccountChangesWithTx
Auto Trait Implementations§
impl !Freeze for AccountChangesWithTx
impl RefUnwindSafe for AccountChangesWithTx
impl Send for AccountChangesWithTx
impl Sync for AccountChangesWithTx
impl Unpin for AccountChangesWithTx
impl UnwindSafe for AccountChangesWithTx
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
Mutably borrows from an owned value. Read more