Skip to content

Commit

Permalink
Merge pull request #371 from InjectiveLabs/feat/release_v1_9_0
Browse files Browse the repository at this point in the history
Feat/release v1.9.0
  • Loading branch information
aarmoa authored Feb 13, 2025
2 parents 10c7a90 + 68759f3 commit b09a7a0
Show file tree
Hide file tree
Showing 132 changed files with 6,301 additions and 6,996 deletions.
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

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())
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())
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

0 comments on commit b09a7a0

Please sign in to comment.