Skip to content

Commit

Permalink
refactor: use network singltone for get_network_height
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcgroul committed Feb 12, 2024
1 parent 590401c commit cf133bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ape_subsquid/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from ape import plugins

from ape_subsquid.query import SubsquidQueryEngine, get_gateway_height
from ape_subsquid.query import SubsquidQueryEngine, get_network_height

__all__ = ["exceptions", "get_gateway_height"]
__all__ = ["exceptions", "get_network_height"]


@plugins.register(plugins.QueryPlugin)
Expand Down
5 changes: 3 additions & 2 deletions ape_subsquid/query.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Iterator, Optional, Type, TypeVar, cast

from ape import networks
from ape.api import BlockAPI, ReceiptAPI
from ape.api.query import (
AccountTransactionQuery,
Expand Down Expand Up @@ -215,7 +216,7 @@ def gateway_ingest(gateway: SubsquidGateway, network: str, query: Query) -> Iter
query["fromBlock"] = last_block + 1


def get_gateway_height(network_manager) -> int:
network = get_network(network_manager)
def get_network_height() -> int:
network = get_network(networks)
height = gateway.get_height(network)
return height

0 comments on commit cf133bf

Please sign in to comment.