pub(crate) async fn get_with_nonce(
        &self,
        storage: &mut Connection<'_, Core>,
        address: Address,
        block_number: L2BlockNumber,
    ) -> Result<(AccountType, U256), Web3Error> {
        let (ty, full_nonce) = if let Some(ty) = self.cache.get(&address) {
            let nonce_key = get_nonce_key(&address).hashed_key();
            let full_nonce = storage
                .storage_web3_dal()
                .get_historical_value_unchecked(nonce_key, block_number)
                .await
                .map_err(DalError::generalize)?;
            (ty, h256_to_u256(full_nonce))
        } else {
            let (ty, full_nonce) =
                AccountType::with_full_nonce(storage, address, block_number).await?;
            if !ty.is_default() || !full_nonce.is_zero() {
                // There's activity for the account in question; its type can be cached since it cannot change in the future.
                self.cache.insert(address, ty);
            }
            (ty, full_nonce)
        };

        let (account_nonce, deployment_nonce) = decompose_full_nonce(full_nonce);
        let effective_nonce = match ty {
            AccountType::Contract => deployment_nonce,
            AccountType::External(_) => account_nonce,
        };
        Ok((ty, effective_nonce))
    }
Returns the account type and the stored nonce for the specified address. The nonce is intelligently
selected between the account nonce and deployment nonce, depending on the account type (contract or EOA).
core/node/api_server/src/web3/receipts.rs