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

feat/ibc_connection_module_queries #322

Merged
merged 5 commits into from
Apr 25, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5

- name: Install poetry
run: python -m pip install poetry
- name: Cache the virtualenv
id: cache-venv
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./.venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
- name: Install poetry
run: python -m pip install poetry
- name: Publish package
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ jobs:
strategy:
matrix:
python: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
runs-on: ${{ matrix.os }}
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install poetry
run: python -m pip install poetry
- name: Cache the virtualenv
id: cache-venv
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./.venv
key: ${{ runner.os }}-${{ matrix.python }}-venv-${{ hashFiles('**/poetry.lock') }}
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
- Support for all queries in the "IBC Transfer" module
- Support for all queries in the "IBC Channel" module
- Support for all queries in the "IBC Client" module
- Support for all queries in the "IBC Connection" module

### Changed
- Refactored cookies management logic to use all gRPC calls' responses to update the current cookies
Expand Down
21 changes: 21 additions & 0 deletions examples/chain_client/ibc/connection/query/1_Connection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import asyncio

from google.protobuf import symbol_database

from pyinjective.async_client import AsyncClient
from pyinjective.core.network import Network


async def main() -> None:
network = Network.testnet()
client = AsyncClient(network)

connection_id = "connection-0"

connection = await client.fetch_ibc_connection(connection_id=connection_id)
print(connection)


if __name__ == "__main__":
symbol_db = symbol_database.Default()
asyncio.get_event_loop().run_until_complete(main())
22 changes: 22 additions & 0 deletions examples/chain_client/ibc/connection/query/2_Connections.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import asyncio

from google.protobuf import symbol_database

from pyinjective.async_client import AsyncClient
from pyinjective.client.model.pagination import PaginationOption
from pyinjective.core.network import Network


async def main() -> None:
network = Network.testnet()
client = AsyncClient(network)

pagination = PaginationOption(skip=2, limit=4)

connections = await client.fetch_ibc_connections(pagination=pagination)
print(connections)


if __name__ == "__main__":
symbol_db = symbol_database.Default()
asyncio.get_event_loop().run_until_complete(main())
21 changes: 21 additions & 0 deletions examples/chain_client/ibc/connection/query/3_ClientConnections.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import asyncio

from google.protobuf import symbol_database

from pyinjective.async_client import AsyncClient
from pyinjective.core.network import Network


async def main() -> None:
network = Network.testnet()
client = AsyncClient(network)

client_id = "07-tendermint-0"

connections = await client.fetch_ibc_client_connections(client_id=client_id)
print(connections)


if __name__ == "__main__":
symbol_db = symbol_database.Default()
asyncio.get_event_loop().run_until_complete(main())
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import asyncio

from google.protobuf import symbol_database

from pyinjective.async_client import AsyncClient
from pyinjective.core.network import Network


async def main() -> None:
network = Network.testnet()
client = AsyncClient(network)

connection_id = "connection-0"

state = await client.fetch_ibc_connection_client_state(connection_id=connection_id)
print(state)


if __name__ == "__main__":
symbol_db = symbol_database.Default()
asyncio.get_event_loop().run_until_complete(main())
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import asyncio

from google.protobuf import symbol_database

from pyinjective.async_client import AsyncClient
from pyinjective.core.network import Network


async def main() -> None:
network = Network.testnet()
client = AsyncClient(network)

connection_id = "connection-0"
revision_number = 0
revision_height = 7379538

state = await client.fetch_ibc_connection_consensus_state(
connection_id=connection_id, revision_number=revision_number, revision_height=revision_height
)
print(state)


if __name__ == "__main__":
symbol_db = symbol_database.Default()
asyncio.get_event_loop().run_until_complete(main())
25 changes: 25 additions & 0 deletions examples/chain_client/ibc/connection/query/6_ConnectionParams.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import asyncio

from google.protobuf import symbol_database

from pyinjective.async_client import AsyncClient
from pyinjective.core.network import Network


async def main() -> None:
network = Network.testnet()
client = AsyncClient(network)

connection_id = "connection-0"
revision_number = 0
revision_height = 7379538

state = await client.fetch_ibc_connection_consensus_state(
connection_id=connection_id, revision_number=revision_number, revision_height=revision_height
)
print(state)


if __name__ == "__main__":
symbol_db = symbol_database.Default()
asyncio.get_event_loop().run_until_complete(main())
Comment on lines +1 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for potential file duplication or incorrect content.

This script appears identical to 5_ConnectionConsensusState.py. Please verify if this is intentional or if there has been a mistake in file naming or content duplication.

Loading
Loading