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

Graph: Add finalized block query #139

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sw-utils"
version = "v0.7.5"
version = "v0.7.6"
description = "StakeWise Python utils"
authors = ["StakeWise Labs <info@stakewise.io>"]
license = "GPL-3.0-or-later"
Expand Down
19 changes: 18 additions & 1 deletion sw_utils/graph/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from gql import Client
from eth_typing import BlockNumber
from gql import Client, gql
from gql.transport.aiohttp import AIOHTTPTransport
from graphql import DocumentNode

Expand Down Expand Up @@ -57,3 +58,19 @@ async def fetch_pages(
skip += page_size

return all_items

async def get_last_synced_block(self) -> BlockNumber:
query = gql(
"""
query getBlock {
_meta {
block {
number
}
}
}
"""
)

res = await self.run_query(query)
return BlockNumber(res['_meta']['block']['number'])
Loading