Repository: ethereum/web3.py

Issue:
Add 'account' to AsyncEth?
Hey 👋 Is there a reason `account` is not available in `AsyncEth`?

So far, I had to create a non-async w3 object to sign transactions. However, I just found out that when I subclass AsyncEth like this
```python
class CustomAsyncEth(AsyncEth):
    account = Account()
```
signing transactions works just fine.


Discussion:
No reason other than we haven't gotten there yet :) I'll leave this open to track `account` specifically. Feel free to PR the change if you have the time, otherwise know that it's in our queue!

Resolving patch:
diff --git a/web3/eth.py b/web3/eth.py
--- a/web3/eth.py
+++ b/web3/eth.py
@@ -115,6 +115,7 @@ class BaseEth(Module):
     _default_account: Union[ChecksumAddress, Empty] = empty
     _default_block: BlockIdentifier = "latest"
     gasPriceStrategy = None
+    account = Account()
     defaultContractFactory: Any = None
 
     _gas_price: Method[Callable[[], Wei]] = Method(
@@ -598,7 +599,6 @@ async def get_storage_at(
 
 
 class Eth(BaseEth):
-    account = Account()
     defaultContractFactory: Type[Union[Contract, ContractCaller]] = Contract
 
     def namereg(self) -> NoReturn:


Test patch:
diff --git a/tests/core/eth-module/test_accounts.py b/tests/core/eth-module/test_accounts.py
--- a/tests/core/eth-module/test_accounts.py
+++ b/tests/core/eth-module/test_accounts.py
@@ -1,11 +1,18 @@
 # coding=utf-8
 
 import pytest
+from unittest.mock import (
+    patch,
+)
 
 from eth_account.messages import (
     encode_defunct,
 )
+from eth_account.signers.local import (
+    LocalAccount,
+)
 from eth_utils import (
+    is_bytes,
     is_checksum_address,
     to_bytes,
     to_hex,
@@ -21,9 +28,16 @@
     Account,
     Web3,
 )
+from web3.eth import (
+    AsyncEth,
+    BaseEth,
+)
 from web3.providers.eth_tester import (
     EthereumTesterProvider,
 )
+from web3.providers.eth_tester.main import (
+    AsyncEthereumTesterProvider,
+)
 
 # from https://github.com/ethereum/tests/blob/3930ca3a9a377107d5792b3e7202f79c688f1a67/BasicTests/txtest.json # noqa: 501
 ETH_TEST_TRANSACTIONS = [
@@ -77,7 +91,7 @@ def web3js_password():
 @pytest.fixture(params=["instance", "class"])
 def acct(request, w3):
     if request.param == "instance":
-        return w3.eth.account
+        return BaseEth(w3).account
     elif request.param == "class":
         return Account
     raise Exception("Unreachable!")
@@ -536,3 +550,26 @@ def test_eth_account_sign_and_send_EIP155_transaction_to_eth_tester(
     assert actual_txn.r == r
     assert actual_txn.s == s
     assert actual_txn.v == v
+
+
+# -- async -- #
+
+
+@pytest.fixture()
+def async_w3():
+    return Web3(AsyncEthereumTesterProvider(), modules={"eth": [AsyncEth]})
+
+
+@patch("web3.eth.BaseEth.account", "wired via BaseEth")
+def test_account_is_wired_via_base_eth_for_sync_and_async(w3, async_w3):
+    # this gives us some comfort that all the `w3` tests would apply for `async_w3` as
+    # well, since `Account` is static and not actually awaited
+    assert w3.eth.account == "wired via BaseEth"
+    assert async_w3.eth.account == "wired via BaseEth"
+
+
+def test_async_eth_account_creates_account(async_w3):
+    account = async_w3.eth.account.create()
+    assert isinstance(account, LocalAccount)
+    assert is_checksum_address(account.address)
+    assert is_bytes(account.privateKey)