pub trait AccountFundsRead: Send + Sync {
// Required methods
fn get_latest_account_amount(
&self,
account_id: &AccumulatorObjId,
) -> (u128, SequenceNumber);
fn get_account_amount_at_version(
&self,
account_id: &AccumulatorObjId,
version: SequenceNumber,
) -> u128;
// Provided method
fn check_amounts_available(
&self,
requested_amounts: &BTreeMap<AccumulatorObjId, u64>,
) -> SuiResult { ... }
}Required Methods§
Sourcefn get_latest_account_amount(
&self,
account_id: &AccumulatorObjId,
) -> (u128, SequenceNumber)
fn get_latest_account_amount( &self, account_id: &AccumulatorObjId, ) -> (u128, SequenceNumber)
Gets latest amount in account together with the version of the accumulator root object. If the account does not exist, returns the current root accumulator version. It guarantees no data race between the read of the account object and the root accumulator version.
Sourcefn get_account_amount_at_version(
&self,
account_id: &AccumulatorObjId,
version: SequenceNumber,
) -> u128
fn get_account_amount_at_version( &self, account_id: &AccumulatorObjId, version: SequenceNumber, ) -> u128
Read the amount at a precise version. Care must be taken to only call this function if we can guarantee that objects behind this version have not yet been pruned.
Provided Methods§
Sourcefn check_amounts_available(
&self,
requested_amounts: &BTreeMap<AccumulatorObjId, u64>,
) -> SuiResult
fn check_amounts_available( &self, requested_amounts: &BTreeMap<AccumulatorObjId, u64>, ) -> SuiResult
Checks if given amounts are available in the latest versions of the referenced acccumulator objects. This does un-sequenced reads and can only be used on the signing/voting path where deterministic results are not required.