pub fn account_state_by_address(&self, address: &Address) -> QueryResult<StoredAccountState> {
        // Find the account in `account_creates` table.
        let account_create_record = account_creates::table
            .filter(account_creates::address.eq(address.as_bytes().to_vec()))
            .filter(account_creates::is_create.eq(true))
            .order(account_creates::block_number.desc())
            .first::<StorageAccountCreation>(self.0.conn())
            .optional()?;

        // If account wasn't found, we return no state for it.
        // Otherwise we obtain the account ID for the state lookup.
        let account_id = if let Some(account_create_record) = account_create_record {
            account_create_record.account_id as AccountId
        } else {
            return Ok(StoredAccountState {
                committed: None,
                verified: None,
            });
        };

        // Load committed & verified states, and return them.
        let committed = self
            .last_committed_state_for_account(account_id)?
            .map(|a| (account_id, a));
        let verified = self
            .last_verified_state_for_account(account_id)?
            .map(|a| (account_id, a));
        Ok(StoredAccountState {
            committed,
            verified,
        })
    }
/// Obtains both committed and verified state for the account by its address.
Obtains both committed and verified state for the account by its address.
Obtains both committed and verified state for the account by its address .
pub fn account_state_by_address(&self, address: &Address) -> QueryResult<StoredAccountState> {
        // Find the account in `account_creates` table.
        let account_create_record = account_creates::table
            .filter(account_creates::address.eq(address.as_bytes().to_vec()))
            .filter(account_creates::is_create.eq(true))
            .order(account_creates::block_number.desc())
            .first::<StorageAccountCreation>(self.0.conn())
            .optional()?;
        // If account wasn't found, we return no state for it.
        // Otherwise we obtain the account ID for the state lookup.
        let account_id = if let Some(account_create_record) = account_create_record {
            account_create_record.account_id as AccountId
        } else {
            return Ok(StoredAccountState {
                committed: None,
                verified: None,
            });
        };
        // Load committed & verified states, and return them.
        let committed = self
            .last_committed_state_for_account(account_id)?
            .map(|a| (account_id, a));
        let verified = self
            .last_verified_state_for_account(account_id)?
            .map(|a| (account_id, a));
        Ok(StoredAccountState {
            committed,
            verified,
        })
    }
pub fn account_state_by_address ( & self , address : & Address ) -> QueryResult < StoredAccountState > { // Find the account in `account_creates` table. let account_create_record = account_creates :: table . filter ( account_creates :: address . eq ( address . as_bytes ( ) . to_vec ( ) ) ) . filter ( account_creates :: is_create . eq ( true ) ) . order ( account_creates :: block_number . desc ( ) ) . first :: < StorageAccountCreation > ( self . 0 . conn ( ) ) . optional ( ) ? ; // If account wasn't found, we return no state for it. // Otherwise we obtain the account ID for the state lookup. let account_id = if let Some ( account_create_record ) = account_create_record { account_create_record . account_id as AccountId } else { return Ok ( StoredAccountState { committed : None , verified : None , } ) ; } ; // Load committed & verified states, and return them. let committed = self . last_committed_state_for_account ( account_id ) ? . map ( | a | ( account_id , a ) ) ; let verified = self . last_verified_state_for_account ( account_id ) ? . map ( | a | ( account_id , a ) ) ; Ok ( StoredAccountState { committed , verified , } ) }
Obtains both committed and verified state for the account by its address.
Obtains both committed and verified state for the account by its address .
&self
address
&Address