diff --git a/ape_polygon/ecosystem.py b/ape_polygon/ecosystem.py index c20eb49..4d267e1 100644 --- a/ape_polygon/ecosystem.py +++ b/ape_polygon/ecosystem.py @@ -1,4 +1,4 @@ -from typing import Optional +from typing import cast from ape.api.config import PluginConfig from ape.api.networks import LOCAL_NETWORK_NAME @@ -19,9 +19,12 @@ def _create_network_config( ) -def _create_local_config(default_provider: Optional[str] = None) -> NetworkConfig: +def _create_local_config() -> NetworkConfig: return _create_network_config( - required_confirmations=0, block_time=0, default_provider=default_provider + required_confirmations=0, + block_time=0, + default_provider="test", + gas_limit="max", ) @@ -30,11 +33,11 @@ class PolygonConfig(PluginConfig): mainnet_fork: NetworkConfig = _create_local_config() mumbai: NetworkConfig = _create_network_config() mumbai_fork: NetworkConfig = _create_local_config() - local: NetworkConfig = NetworkConfig(default_provider="test") + local: NetworkConfig = _create_local_config() default_network: str = LOCAL_NETWORK_NAME class Polygon(Ethereum): @property - def config(self) -> PolygonConfig: # type: ignore - return self.config_manager.get_config("polygon") # type: ignore + def config(self) -> PolygonConfig: # type: ignore[override] + return cast(PolygonConfig, self.config_manager.get_config("polygon")) diff --git a/setup.py b/setup.py index ed66c54..79b1d49 100644 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ "eth-ape>=0.6.0,<0.7", "typing-extensions==4.5.0", # Can remove once Pydantic patched and ape updated. ], - python_requires=">=3.8,<3.11", + python_requires=">=3.8,<4", extras_require=extras_require, py_modules=["ape_polygon"], license="Apache-2.0", @@ -79,5 +79,6 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", ], ) diff --git a/tests/conftest.py b/tests/conftest.py index 278ae0f..27508ea 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -22,3 +22,8 @@ def runner(): @pytest.fixture def cli(): return ape_cli + + +@pytest.fixture +def polygon(networks): + return networks.polygon diff --git a/tests/test_ecosystem.py b/tests/test_ecosystem.py new file mode 100644 index 0000000..39be27a --- /dev/null +++ b/tests/test_ecosystem.py @@ -0,0 +1,13 @@ +import pytest +from ape_ethereum.transactions import TransactionType + + +def test_gas_limit(polygon): + assert polygon.config.local.gas_limit == "max" + + +@pytest.mark.parametrize("type", (0, "0x0")) +def test_create_transaction(polygon, type): + with polygon.local.use_provider("test"): + txn = polygon.create_transaction(type=type) + assert txn.type == TransactionType.STATIC.value