diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bc320dc..ef98bfb 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -48,7 +48,7 @@ jobs: strategy: matrix: - python-version: [3.6, 3.7, 3.8] + python-version: [3.7, 3.8, 3.9] steps: - uses: actions/checkout@v2 @@ -63,6 +63,8 @@ jobs: - name: Run Tests run: pytest -m "not fuzzing" + env: + WEB3_INFURA_PROJECT_ID: ${{ secrets.WEB3_INFURA_PROJECT_ID }} # NOTE: uncomment this block after you've marked tests with @pytest.mark.fuzzing # fuzzing: diff --git a/ape_infura/providers.py b/ape_infura/providers.py index 5bd6d51..8aaaf88 100644 --- a/ape_infura/providers.py +++ b/ape_infura/providers.py @@ -1,11 +1,10 @@ import os from typing import Iterator +from ape.api import ProviderAPI, ReceiptAPI, TransactionAPI from web3 import HTTPProvider, Web3 # type: ignore from web3.gas_strategies.rpc import rpc_gas_price_strategy -from ape.api import ProviderAPI, ReceiptAPI, TransactionAPI - class Infura(ProviderAPI): _web3: Web3 = None # type: ignore @@ -24,6 +23,10 @@ def disconnect(self): def update_settings(self, new_settings: dict): pass + @property + def chain_id(self) -> int: + return self._web3.eth.chain_id + def estimate_gas_cost(self, txn: TransactionAPI) -> int: return self._web3.eth.estimate_gas(txn.as_dict()) # type: ignore diff --git a/setup.py b/setup.py index e014d08..44b61b6 100644 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ url="https://github.com/ApeWorX/ape-infura", include_package_data=True, install_requires=[ - "eth-ape>=0.1.0a14", + "eth-ape>=0.1.0a21", "importlib-metadata ; python_version<'3.8'", ], # NOTE: Add 3rd party libraries here python_requires=">=3.6,<4", @@ -79,7 +79,6 @@ "Operating System :: MacOS", "Operating System :: POSIX", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", diff --git a/tests/test_provider.py b/tests/test_provider.py new file mode 100644 index 0000000..1f9f834 --- /dev/null +++ b/tests/test_provider.py @@ -0,0 +1,9 @@ +from ape import networks + +from ape_infura.providers import Infura + + +def test_provider_works(): + with networks.ethereum.mainnet.use_provider("infura") as provider: + assert isinstance(provider, Infura) + assert provider.get_balance("0x0000000000000000000000000000000000000000") > 0