Skip to content

Commit

Permalink
fix: ecosystem updates [APE-1034] (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Jun 8, 2023
1 parent b541f16 commit 1018f83
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
15 changes: 9 additions & 6 deletions ape_polygon/ecosystem.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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",
)


Expand All @@ -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"))
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -79,5 +79,6 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
)
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ def runner():
@pytest.fixture
def cli():
return ape_cli


@pytest.fixture
def polygon(networks):
return networks.polygon
13 changes: 13 additions & 0 deletions tests/test_ecosystem.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1018f83

Please sign in to comment.