Skip to content

Commit

Permalink
Merge pull request #322 from InjectiveLabs/feat/ibc_connection_module…
Browse files Browse the repository at this point in the history
…_queries

feat/ibc_connection_module_queries
  • Loading branch information
aarmoa authored Apr 25, 2024
2 parents 71e7f0c + 0631678 commit 0de78e7
Show file tree
Hide file tree
Showing 22 changed files with 1,241 additions and 455 deletions.
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())
Loading

0 comments on commit 0de78e7

Please sign in to comment.