Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adhoc network connection fix #2468

Merged
merged 3 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/ape_ethereum/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,7 @@ def estimate_gas_cost(self, txn: TransactionAPI, block_id: Optional["BlockID"] =
@cached_property
def chain_id(self) -> int:
default_chain_id = None

if self.network.is_custom or not self.network.is_dev:
if (not self.network.is_adhoc and self.network.is_custom) and not self.network.is_dev:
# If using a live network, the chain ID is hardcoded.
default_chain_id = self.network.chain_id

Expand Down
5 changes: 5 additions & 0 deletions tests/functional/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ def test_chain_id_when_disconnected(eth_tester_provider):
eth_tester_provider.connect()


def test_chain_id_adhoc(networks):
with networks.parse_network_choice("'https://www.shibrpc.com") as bor:
assert bor.chain_id == 109


def test_get_receipt_not_exists_with_timeout(eth_tester_provider):
unknown_txn = "0x053cba5c12172654d894f66d5670bab6215517a94189a9ffc09bc40a589ec04d"
expected = (
Expand Down
Loading