pub trait DiemInterface {
// Required methods
fn diem_timestamp(&self) -> Result<u64, Error>;
fn last_reconfiguration(&self) -> Result<u64, Error>;
fn retrieve_sequence_number(
&self,
account: AccountAddress
) -> Result<u64, Error>;
fn submit_transaction(&self, transaction: Transaction) -> Result<(), Error>;
fn retrieve_validator_config(
&self,
account: AccountAddress
) -> Result<ValidatorConfig, Error>;
fn retrieve_validator_info(
&self,
account: AccountAddress
) -> Result<ValidatorInfo, Error>;
fn retrieve_account_state(
&self,
account: AccountAddress
) -> Result<AccountState, Error>;
}
Expand description
This defines a generic trait used to interact with the Diem blockchain. In production, this will be talking to a JSON-RPC service. For tests, this may be an executor and storage directly.
Required Methods§
sourcefn diem_timestamp(&self) -> Result<u64, Error>
fn diem_timestamp(&self) -> Result<u64, Error>
Retrieves the current time from the blockchain, this is returned as microseconds.
sourcefn last_reconfiguration(&self) -> Result<u64, Error>
fn last_reconfiguration(&self) -> Result<u64, Error>
Retrieves the last reconfiguration time from the blockchain, this is returned as microseconds.
sourcefn retrieve_sequence_number(&self, account: AccountAddress) -> Result<u64, Error>
fn retrieve_sequence_number(&self, account: AccountAddress) -> Result<u64, Error>
Retrieve current sequence number for the provided account.
sourcefn submit_transaction(&self, transaction: Transaction) -> Result<(), Error>
fn submit_transaction(&self, transaction: Transaction) -> Result<(), Error>
Submits a transaction to the block chain and returns successfully if the transaction was successfully submitted. It does not necessarily mean the transaction successfully executed.
sourcefn retrieve_validator_config(
&self,
account: AccountAddress
) -> Result<ValidatorConfig, Error>
fn retrieve_validator_config( &self, account: AccountAddress ) -> Result<ValidatorConfig, Error>
Retrieves the ValidatorConfig at the specified AccountAddress if one exists.
sourcefn retrieve_validator_info(
&self,
account: AccountAddress
) -> Result<ValidatorInfo, Error>
fn retrieve_validator_info( &self, account: AccountAddress ) -> Result<ValidatorInfo, Error>
Retrieves the ValidatorInfo for the specified account from the current ValidatorSet if one exists.
sourcefn retrieve_account_state(
&self,
account: AccountAddress
) -> Result<AccountState, Error>
fn retrieve_account_state( &self, account: AccountAddress ) -> Result<AccountState, Error>
Fetches the AccountState associated with a specific account. This is currently only used by test code, but it’s not completely inconceivable that non-test code will want access to this in the future.