Skip to content
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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.

## [Unreleased] - 9999-99-99

## [1.11.2] - 2025-09-24
### Added
- Added support in v2 Composer to create the new exchange module MsgCancelPostOnlyMode message

### Changed
- Updated all compiled protos for compatibility with Injective core v1.16.4 and Indexer v1.16.91
- Marked the v1 Composer as deprecated

## [1.11.1] - 2025-08-20
### Changed
- Marked the v1 AsyncClient as deprecated

### Fixed
- Fixed the Indexer orderbooks queries in the v1 AsyncClient to include the depth parameter

## [1.11.0] - 2025-07-29
### Added
- Added support for Exchange V2 proto queries and types
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.16.54 --depth 1 --single-branch
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.16.91 --depth 1 --single-branch

clone-all: clone-injective-indexer

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ The Injective Python SDK provides two different clients for interacting with the

1. **Exchange V1 Client** (`async_client` module):
- Use this client if you need to interact with the original Injective Exchange API
- Import using: `from injective.async_client import AsyncClient`
- Import using: `from pyinjective.async_client import AsyncClient`
- Suitable for applications that need to maintain compatibility with the original exchange interface
- Example:
```python
from injective.async_client import AsyncClient
from injective.network import Network
from pyinjective.async_client import AsyncClient
from pyinjective.network import Network

async def main():
# Initialize client with mainnet
Expand All @@ -95,12 +95,12 @@ The Injective Python SDK provides two different clients for interacting with the

2. **Exchange V2 Client** (`async_client_v2` module):
- Use this client for the latest exchange features and improvements
- Import using: `from injective.async_client_v2 import AsyncClient`
- Import using: `from pyinjective.async_client_v2 import AsyncClient`
- Recommended for new applications and when you need access to the latest exchange features
- Example:
```python
from injective.async_client_v2 import AsyncClient
from injective.network import Network
from pyinjective.async_client_v2 import AsyncClient
from pyinjective.network import Network

async def main():
# Initialize client with mainnet
Expand Down
6 changes: 3 additions & 3 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ inputs:
- git_repo: https://github.com/InjectiveLabs/wasmd
tag: v0.53.3-evm-comet1-inj
- git_repo: https://github.com/InjectiveLabs/cometbft
tag: v1.0.1-inj.2
tag: v1.0.1-inj.3
- git_repo: https://github.com/InjectiveLabs/cosmos-sdk
tag: v0.50.13-evm-comet1-inj.3
tag: v0.50.13-evm-comet1-inj.6
# - git_repo: https://github.com/InjectiveLabs/wasmd
# branch: v0.51.x-inj
# subdir: proto
- git_repo: https://github.com/InjectiveLabs/injective-core
tag: v1.16.0
tag: v1.16.4
subdir: proto
# - git_repo: https://github.com/InjectiveLabs/injective-core
# branch: master
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def main() -> None:
oracle_symbol="UFC-KHABIB-TKO-05/30/2023",
oracle_provider="UFC",
oracle_type="Provider",
oracle_scale_factor=6,
oracle_scale_factor=0,
maker_fee_rate=Decimal("0.0005"), # 0.05%
taker_fee_rate=Decimal("0.0010"), # 0.10%
expiration_timestamp=1680730982,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def main() -> None:
quote_denom="factory/inj17vytdwqczqz72j65saukplrktd4gyfme5agf6c/usdc",
oracle_base="INJ",
oracle_quote="USDC",
oracle_scale_factor=6,
oracle_scale_factor=0,
oracle_type="Band",
maker_fee_rate=Decimal("-0.0001"),
taker_fee_rate=Decimal("0.001"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def main() -> None:
quote_denom="factory/inj17vytdwqczqz72j65saukplrktd4gyfme5agf6c/usdc",
oracle_base="INJ",
oracle_quote="USDC",
oracle_scale_factor=6,
oracle_scale_factor=0,
oracle_type="Band",
expiry=2000000000,
maker_fee_rate=Decimal("-0.0001"),
Expand Down
1,892 changes: 974 additions & 918 deletions poetry.lock

Large diffs are not rendered by default.

24 changes: 16 additions & 8 deletions pyinjective/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ def __init__(
self,
network: Network,
):
warn(
"AsyncClient from pyinjective.async_client is deprecated. "
"Please use AsyncClient from pyinjective.async_client_v2 instead.",
DeprecationWarning,
stacklevel=2,
)
self.addr = ""
self.number = 0
self.sequence = 0
Expand Down Expand Up @@ -1337,11 +1343,11 @@ async def listen_spot_markets_updates(
market_ids=market_ids,
)

async def fetch_spot_orderbook_v2(self, market_id: str) -> Dict[str, Any]:
return await self.indexer_client.fetch_spot_orderbook_v2(market_id=market_id)
async def fetch_spot_orderbook_v2(self, market_id: str, depth: Optional[int] = None) -> Dict[str, Any]:
return await self.indexer_client.fetch_spot_orderbook_v2(market_id=market_id, depth=depth or 0)

async def fetch_spot_orderbooks_v2(self, market_ids: List[str]) -> Dict[str, Any]:
return await self.indexer_client.fetch_spot_orderbooks_v2(market_ids=market_ids)
async def fetch_spot_orderbooks_v2(self, market_ids: List[str], depth: Optional[int] = None) -> Dict[str, Any]:
return await self.indexer_client.fetch_spot_orderbooks_v2(market_ids=market_ids, depth=depth or 0)

async def fetch_spot_orders(
self,
Expand Down Expand Up @@ -1608,11 +1614,13 @@ async def listen_derivative_market_updates(
market_ids=market_ids,
)

async def fetch_derivative_orderbook_v2(self, market_id: str) -> Dict[str, Any]:
return await self.indexer_client.fetch_derivative_orderbook_v2(market_id=market_id)
async def fetch_derivative_orderbook_v2(self, market_id: str, depth: Optional[int] = None) -> Dict[str, Any]:
return await self.indexer_client.fetch_derivative_orderbook_v2(market_id=market_id, depth=depth or 0)

async def fetch_derivative_orderbooks_v2(self, market_ids: List[str]) -> Dict[str, Any]:
return await self.indexer_client.fetch_derivative_orderbooks_v2(market_ids=market_ids)
async def fetch_derivative_orderbooks_v2(
self, market_ids: List[str], depth: Optional[int] = None
) -> Dict[str, Any]:
return await self.indexer_client.fetch_derivative_orderbooks_v2(market_ids=market_ids, depth=depth or 0)

async def fetch_derivative_orders(
self,
Expand Down
7 changes: 7 additions & 0 deletions pyinjective/composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ def __init__(


"""

warn(
"Composer from pyinjective.composer is deprecated. "
"Please use Composer from pyinjective.composer_v2 instead.",
DeprecationWarning,
stacklevel=2,
)
self.network = network
self.spot_markets = spot_markets or dict()
self.derivative_markets = derivative_markets or dict()
Expand Down
3 changes: 3 additions & 0 deletions pyinjective/composer_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,9 @@ def msg_activate_stake_grant(self, sender: str, granter: str) -> injective_excha
granter=granter,
)

def msg_cancel_post_only_mode(self, sender: str) -> injective_exchange_tx_v2_pb.MsgCancelPostOnlyMode:
return injective_exchange_tx_v2_pb.MsgCancelPostOnlyMode(sender=sender)

# endregion

# region Insurance module
Expand Down
16 changes: 12 additions & 4 deletions pyinjective/core/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ def devnet(cls):
chain_cookie_assistant=DisabledCookieAssistant(),
exchange_cookie_assistant=DisabledCookieAssistant(),
explorer_cookie_assistant=DisabledCookieAssistant(),
official_tokens_list_url="https://github.com/InjectiveLabs/injective-lists/raw/master/tokens/devnet.json",
official_tokens_list_url=(
"https://github.com/InjectiveLabs/injective-lists/raw/master/json/tokens/devnet.json"
),
)

@classmethod
Expand Down Expand Up @@ -211,7 +213,9 @@ def testnet(cls, node="lb"):
grpc_exchange_channel_credentials=grpc_exchange_channel_credentials,
grpc_explorer_channel_credentials=grpc_explorer_channel_credentials,
chain_stream_channel_credentials=chain_stream_channel_credentials,
official_tokens_list_url="https://github.com/InjectiveLabs/injective-lists/raw/master/tokens/testnet.json",
official_tokens_list_url=(
"https://github.com/InjectiveLabs/injective-lists/raw/master/json/tokens/testnet.json"
),
)

@classmethod
Expand Down Expand Up @@ -253,7 +257,9 @@ def mainnet(cls, node="lb"):
grpc_exchange_channel_credentials=grpc_exchange_channel_credentials,
grpc_explorer_channel_credentials=grpc_explorer_channel_credentials,
chain_stream_channel_credentials=chain_stream_channel_credentials,
official_tokens_list_url="https://github.com/InjectiveLabs/injective-lists/raw/master/tokens/mainnet.json",
official_tokens_list_url=(
"https://github.com/InjectiveLabs/injective-lists/raw/master/json/tokens/mainnet.json"
),
)

@classmethod
Expand All @@ -271,7 +277,9 @@ def local(cls):
chain_cookie_assistant=DisabledCookieAssistant(),
exchange_cookie_assistant=DisabledCookieAssistant(),
explorer_cookie_assistant=DisabledCookieAssistant(),
official_tokens_list_url="https://github.com/InjectiveLabs/injective-lists/raw/master/tokens/mainnet.json",
official_tokens_list_url=(
"https://github.com/InjectiveLabs/injective-lists/raw/master/json/tokens/mainnet.json"
),
)

@classmethod
Expand Down
10 changes: 10 additions & 0 deletions pyinjective/ofac.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"0x0931ca4d13bb4ba75d9b7132ab690265d749a5e7",
"0x098b716b8aaf21512996dc57eb0615e2383e2f96",
"0x0ee5067b06776a89ccc7dc8ee369984ad7db5e06",
"0x12de548f79a50d2bd05481c8515c1ef5183666a9",
"0x175d44451403edf28469df03a9280c1197adb92c",
"0x1967d8af5bd86a497fb3dd7899a020e47560daaf",
"0x1999ef52700c34de7ec2b68a28aafb37db0c5ade",
Expand All @@ -26,8 +27,10 @@
"0x4f47bc496083c727c5fbe3ce9cdf2b0f6496270c",
"0x502371699497d08d5339c870851898d6d72521dd",
"0x530a64c0ce595026a4a556b703644228179e2d57",
"0x532b77b33a040587e9fd1800088225f99b8b0e8a",
"0x53b6936513e738f44fb50d2b9476730c0ab3bfc1",
"0x5512d943ed1f7c8a43f3435c85f7ab68b30121b0",
"0x57ec89a0c056163a0314e413320f9b3abe761259",
"0x5a14e72060c11313e38738009254a90968f58f51",
"0x5a7a51bfb49f190e5a6060a5bc6052ac14a3b59f",
"0x5f48c2a71b2cc96e3f0ccae4e39318ff0dc375b2",
Expand All @@ -36,12 +39,14 @@
"0x6f1ca141a28907f78ebaa64fb83a9088b02a8352",
"0x72a5843cc08275c8171e582972aa4fda8c397b2a",
"0x797d7ae72ebddcdea2a346c1834e04d1f8df102b",
"0x7ced75026204ac29c34bea98905d4c949f27361e",
"0x7db418b5d567a4e0e8c59ad71be1fce48f3e6107",
"0x7f19720a857f834887fc9a7bc0a0fbe7fc7f8102",
"0x7f367cc41522ce07553e823bf3be79a889debe1b",
"0x7ff9cfad3877f21d41da833e2f775db0569ee3d9",
"0x83e5bc4ffa856bb84bb88581f5dd62a433a25e0d",
"0x8576acc5c05d6ce88f4e49bf65bdf0c62f91353c",
"0x8dce2aac0de82bdcaf6b4373b79f94331b8e4995",
"0x901bb9583b24d97e995513c6778dc6888ab6870e",
"0x931546d9e66836abf687d2bc64b30407bac8c568",
"0x961c5be54a2ffc17cf4cb021d863c42dacd47fc1",
Expand All @@ -51,19 +56,24 @@
"0x9f4cda013e354b8fc285bf4b9a60460cee7f7ea9",
"0xa0e1c89ef1a489c9c7de96311ed5ce5d32c20e4b",
"0xa7e5d5a720f06526557c513402f2e6b5fa20b008",
"0xb338962b92cd818d6aef0a32a9ecd01212a71f33",
"0xb6f5ec1a0a9cd1526536d3f0426c429529471f40",
"0xc2a3829f459b3edd87791c74cd45402ba0a20be3",
"0xc455f7fd3e0e12afd51fba5c106909934d8a0e4a",
"0xd0975b32cea532eadddfc9c60481976e39db3472",
"0xd5ed34b52ac4ab84d8fa8a231a3218bbf01ed510",
"0xd8500c631dc32fa18645b7436344a99e4825e10e",
"0xd882cfc20f52f2599d84b8e8d58c7fb62cfe344b",
"0xdb2720ebad55399117ddb4c4a4afd9a4ccada8fe",
"0xdcbeffbecce100cce9e4b153c4e15cb885643193",
"0xe1d865c3d669dcc8c57c8d023140cb204e672ee4",
"0xe3d35f68383732649669aa990832e017340dbca5",
"0xe7aa314c77f4233c18c6cc84384a9247c0cf367b",
"0xe950dc316b836e4eefb8308bf32bf7c72a1358ff",
"0xed6e0a7e4ac94d976eebfb82ccf777a3c6bad921",
"0xefe301d259f525ca1ba74a7977b80d5b060b3cca",
"0xf3701f445b6bdafedbca97d1e477357839e4120d",
"0xf4377eda661e04b6dda78969796ed31658d602d4",
"0xf7b31119c2682c88d88d455dbb9d5932c65cf1be",
"0xfac583c0cf07ea434052c49115a4682172ab6b4f",
"0xfec8a60023265364d066a1212fde3930f6ae8da7",
Expand Down
Loading