Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
dc8d00f
(fix) Edit version in pyproject.toml
PavelInjective Nov 14, 2024
cd67089
Merge pull request #359 from InjectiveLabs/feat/sync_dev_with_v1_8_0
PavelInjective Nov 14, 2024
97a172f
(feat) Updated queries and messages from the Permissions module to su…
aarmoa Dec 5, 2024
5c0fb1f
(fix) Edit version in pyproject.toml
PavelInjective Nov 14, 2024
240d229
Merge pull request #363 from InjectiveLabs/feat/sync_dev_with_v1_8_1
PavelInjective Dec 9, 2024
e1c526e
(feat) Updated queries and messages from the Permissions module to su…
aarmoa Dec 5, 2024
0ac7456
Merge branch 'feat/permissions_module_support' of https://github.com/…
aarmoa Jan 10, 2025
a99d7f7
(feat) Updated proto definitions with the chain and indexer versions …
aarmoa Jan 20, 2025
2c4239d
(fix) Updated version number in pyproject.toml
aarmoa Jan 20, 2025
b37a42a
Merge branch 'master' of https://github.com/InjectiveLabs/sdk-python …
aarmoa Jan 20, 2025
3da362a
Merge pull request #368 from InjectiveLabs/fix/sync_dev_with_1_8_2
aarmoa Jan 20, 2025
10bf137
Merge branch 'dev' of https://github.com/InjectiveLabs/sdk-python int…
aarmoa Jan 20, 2025
83c4332
(fix) Updated poetry.lock
aarmoa Jan 20, 2025
302f09b
Merge pull request #364 from InjectiveLabs/feat/permissions_module_su…
aarmoa Jan 20, 2025
fa5e91b
(fix) Removed old deprecated functions from Composer and AsyncClient.…
aarmoa Jan 22, 2025
1719ef5
(fix) Added back a function that was removed by mistake
aarmoa Jan 22, 2025
9d1489f
(fix) Changed the run-test.yml configuration to use windows version 2…
aarmoa Jan 22, 2025
42c994e
(fix) Changed the run-test.yml configuration to use windows version 2…
aarmoa Jan 22, 2025
9dece94
(fix) Changed the run-test.yml configuration to use windows version 2…
aarmoa Jan 22, 2025
2803a59
(fix) Updated dependencies
aarmoa Jan 22, 2025
2cd9389
(fix) Changed the run-test.yml configuration to use windows version t…
aarmoa Jan 22, 2025
436f8f6
(fix) Changed the run-test.yml configuration to use windows version t…
aarmoa Jan 22, 2025
4abdf75
(fix) Changed the run-test.yml configuration to use windows version t…
aarmoa Jan 22, 2025
e2e76d9
(fix) Disabled test to see if it is causing the Windows CI to hang
aarmoa Jan 23, 2025
5c5867a
(fix) Removed extra configuration added while debugging the run-tests CI
aarmoa Jan 23, 2025
f7ba353
Merge pull request #369 from InjectiveLabs/feat/add_missing_explorer_…
aarmoa Jan 23, 2025
68759f3
feat: updated changelog and version number for v1.9.0 release
aarmoa Feb 13, 2025
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
9 changes: 7 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
python: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-13, windows-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
OS: ${{ matrix.os }}
Expand All @@ -22,8 +22,13 @@ jobs:
with:
python-version: ${{ matrix.python }}

- name: Set ARCHFLAGS for macOS
if: runner.os == 'macOS'
run: echo "ARCHFLAGS=-arch arm64" >> $GITHUB_ENV

- name: Install poetry
run: python -m pip install poetry

- name: Cache the virtualenv
id: cache-venv
uses: actions/cache@v4
Expand All @@ -37,7 +42,7 @@ jobs:

- name: Run tests and Generate coverage
run: |
poetry run pytest --cov --cov-report=xml
poetry run pytest --cov --cov-report=xml -v --full-trace

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## [1.9.0] - 2025-02-13
### Added
- Added support for all new queries and messages from the new Permissions module

## [1.8.2] - 2024-12-13
### Changed
- Updated `protobuf` dependency version to make it more flexible
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ clean-all:
$(call clean_repos)

clone-injective-indexer:
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.13.4 --depth 1 --single-branch
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.14.1-RC.6 --depth 1 --single-branch
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify stability of RC version.

Using release candidate v1.14.1-RC.6 of injective-indexer in production code may introduce instability. Consider waiting for the final release or document any known issues.


🌐 Web query:

What is the latest stable release version of injective-indexer?

💡 Result:

The latest stable release version of injective-indexer referenced in the provided sources is v1.11.54, as indicated by its npm package @injectivelabs/indexer-api last published 4 months ago (September 2024)[4]. This version corresponds to tools for interacting with Injective’s Indexer API[8], though no newer releases are mentioned in the search results despite subsequent updates to other Injective components like injective-core (e.g., v1.14.0)[1].

Citations:


Action Required: Reevaluate Usage of RC Version in Production

The Makefile currently clones injective-indexer using release candidate version v1.14.1-RC.6. However, based on the latest web data, the latest stable release is v1.11.54. Using an RC version in production can lead to unforeseen instability. Please verify whether the features or fixes in the RC version are essential. If not, consider switching to the stable version. Otherwise, ensure that any known issues are well documented and that thorough testing has been performed.

  • File: Makefile (Line 34)
  • Recommendation:
    • Assess if the RC version is necessary.
    • Consider using stable version v1.11.54 for production environments.
    • Document and test any known issues if continuing with the RC version.


clone-all: clone-injective-indexer

Expand Down
12 changes: 6 additions & 6 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ inputs:
- module: buf.build/googleapis/googleapis
- module: buf.build/cosmos/ics23
- git_repo: https://github.com/InjectiveLabs/cosmos-sdk
tag: v0.50.8-inj-0
tag: v0.50.9-inj-2
- git_repo: https://github.com/InjectiveLabs/ibc-go
tag: v8.3.2-inj-0
- git_repo: https://github.com/InjectiveLabs/wasmd
tag: v0.51.0-inj-0
tag: v0.53.2-inj-1
# - git_repo: https://github.com/InjectiveLabs/wasmd
# branch: v0.51.x-inj
# subdir: proto
- git_repo: https://github.com/InjectiveLabs/injective-core
tag: v1.13.0
tag: v1.14.0
subdir: proto
# - git_repo: https://github.com/InjectiveLabs/injective-core
# branch: master
# subdir: proto
# - git_repo: https://github.com/InjectiveLabs/injective-core
# branch: testnet
# subdir: proto
- directory: proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ async def main() -> None:
min_price_tick_size=Decimal("0.001"),
min_quantity_tick_size=Decimal("0.01"),
min_notional=Decimal("1"),
base_decimals=18,
quote_decimals=6,
)

# broadcast the transaction
Expand Down
21 changes: 21 additions & 0 deletions examples/chain_client/exchange/query/56_L3DerivativeOrderBook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import asyncio

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


async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()

# initialize grpc client
client = AsyncClient(network)

orderbook = await client.fetch_l3_derivative_orderbook(
market_id="0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6",
)
print(orderbook)


if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(main())
21 changes: 21 additions & 0 deletions examples/chain_client/exchange/query/57_L3SpotOrderBook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import asyncio

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


async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()

# initialize grpc client
client = AsyncClient(network)

orderbook = await client.fetch_l3_spot_orderbook(
market_id="0x0611780ba69656949525013d947713300f56c37b6175e02f26bffa495c3208fe",
)
print(orderbook)


if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(main())
31 changes: 31 additions & 0 deletions examples/chain_client/exchange/query/58_MarketBalance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import asyncio

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


async def main() -> None:
"""
Demonstrate fetching market balance using AsyncClient.
"""
# Select network: choose between Network.mainnet(), Network.testnet(), or Network.devnet()
network = Network.testnet()

# Initialize the Async Client
client = AsyncClient(network)

try:
# Example market ID (replace with an actual market ID from the network)
market_id = "0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6"

# Fetch market balance
market_balance = await client.fetch_market_balance(market_id=market_id)
print("Market Balance:")
print(market_balance)

except Exception as ex:
print(f"Error occurred: {ex}")


if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(main())
28 changes: 28 additions & 0 deletions examples/chain_client/exchange/query/59_MarketBalances.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import asyncio

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


async def main() -> None:
"""
Demonstrate fetching market balances using AsyncClient.
"""
# Select network: choose between Network.mainnet(), Network.testnet(), or Network.devnet()
network = Network.testnet()

# Initialize the Async Client
client = AsyncClient(network)

try:
# Fetch market balances
market_balances = await client.fetch_market_balances()
print("Market Balances:")
print(market_balances)

except Exception as ex:
print(f"Error occurred: {ex}")


if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(main())
Comment on lines +27 to +28
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Update event loop usage to follow current best practices.

get_event_loop() is deprecated. Use asyncio.run() instead for a more modern approach.

-if __name__ == "__main__":
-    asyncio.get_event_loop().run_until_complete(main())
+if __name__ == "__main__":
+    asyncio.run(main())
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(main())
if __name__ == "__main__":
asyncio.run(main())

31 changes: 31 additions & 0 deletions examples/chain_client/exchange/query/60_DenomMinNotional.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import asyncio

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


async def main() -> None:
"""
Demonstrate fetching denom min notional using AsyncClient.
"""
# Select network: choose between Network.mainnet(), Network.testnet(), or Network.devnet()
network = Network.testnet()

# Initialize the Async Client
client = AsyncClient(network)

try:
# Example denom
denom = "factory/inj1hkhdaj2a2clmq5jq6mspsggqs32vynpk228q3r/inj_test"

# Fetch market balance
min_notional = await client.fetch_denom_min_notional(denom=denom)
print("Min Notional:")
print(min_notional)

except Exception as ex:
print(f"Error occurred: {ex}")


if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(main())
28 changes: 28 additions & 0 deletions examples/chain_client/exchange/query/61_DenomMinNotionals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import asyncio

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


async def main() -> None:
"""
Demonstrate fetching denom min notionals using AsyncClient.
"""
# Select network: choose between Network.mainnet(), Network.testnet(), or Network.devnet()
network = Network.testnet()

# Initialize the Async Client
client = AsyncClient(network)

try:
# Fetch market balance
min_notionals = await client.fetch_denom_min_notionals()
print("Min Notionals:")
print(min_notionals)

except Exception as ex:
print(f"Error occurred: {ex}")


if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(main())
Comment on lines +27 to +28
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Update event loop usage to follow current best practices.

get_event_loop() is deprecated. Use asyncio.run() instead for a more modern approach.

-if __name__ == "__main__":
-    asyncio.get_event_loop().run_until_complete(main())
+if __name__ == "__main__":
+    asyncio.run(main())
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(main())
if __name__ == "__main__":
asyncio.run(main())

68 changes: 55 additions & 13 deletions examples/chain_client/permissions/1_MsgCreateNamespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,68 @@ async def main() -> None:
pub_key = priv_key.to_public_key()
address = pub_key.to_address()

blocked_address = "inj1hkhdaj2a2clmq5jq6mspsggqs32vynpk228q3r"
denom = "factory/inj1hkhdaj2a2clmq5jq6mspsggqs32vynpk228q3r/inj_test"
role1 = composer.permissions_role(
role=composer.DEFAULT_PERMISSIONS_EVERYONE_ROLE,
permissions=composer.MINT_ACTION_PERMISSION
| composer.RECEIVE_ACTION_PERMISSION
| composer.BURN_ACTION_PERMISSION,
name="EVERYONE",
role_id=0,
permissions=composer.PERMISSIONS_ACTION["RECEIVE"] | composer.PERMISSIONS_ACTION["SEND"],
)
role2 = composer.permissions_role(
name="admin",
role_id=1,
permissions=composer.PERMISSIONS_ACTION["MODIFY_ROLE_PERMISSIONS"]
| composer.PERMISSIONS_ACTION["MODIFY_ADDRESS_ROLES"],
)
role3 = composer.permissions_role(
name="user",
role_id=2,
permissions=composer.PERMISSIONS_ACTION["MINT"]
| composer.PERMISSIONS_ACTION["RECEIVE"]
| composer.PERMISSIONS_ACTION["BURN"]
| composer.PERMISSIONS_ACTION["SEND"],
)

actor_role1 = composer.permissions_actor_roles(
actor="inj1specificactoraddress",
roles=["admin"],
)
actor_role2 = composer.permissions_actor_roles(
actor="inj1anotheractoraddress",
roles=["user"],
)

role_manager = composer.permissions_role_manager(
manager="inj1manageraddress",
roles=["admin"],
)

policy_status1 = composer.permissions_policy_status(
action=composer.PERMISSIONS_ACTION["MINT"],
is_disabled=False,
is_sealed=False,
)
policy_status2 = composer.permissions_policy_status(
action=composer.PERMISSIONS_ACTION["BURN"],
is_disabled=False,
is_sealed=False,
)

policy_manager_capability = composer.permissions_policy_manager_capability(
manager="inj1policymanageraddress",
action=composer.PERMISSIONS_ACTION["MODIFY_CONTRACT_HOOK"],
can_disable=True,
can_seal=False,
)
role2 = composer.permissions_role(role="blacklisted", permissions=composer.UNDEFINED_ACTION_PERMISSION)
address_role1 = composer.permissions_address_roles(address=blocked_address, roles=["blacklisted"])

message = composer.msg_create_namespace(
sender=address.to_acc_bech32(),
denom=denom,
wasm_hook="",
mints_paused=False,
sends_paused=False,
burns_paused=False,
role_permissions=[role1, role2],
address_roles=[address_role1],
contract_hook="",
role_permissions=[role1, role2, role3],
actor_roles=[actor_role1, actor_role2],
role_managers=[role_manager],
policy_statuses=[policy_status1, policy_status2],
policy_manager_capabilities=[policy_manager_capability],
)

# broadcast the transaction
Expand Down
42 changes: 0 additions & 42 deletions examples/chain_client/permissions/2_MsgDeleteNamespace.py

This file was deleted.

Loading
Loading