Skip to content

Commit ad289d5

Browse files
authored
Merge pull request #391 from InjectiveLabs/release/v1_11_for_chain_v1_16
Release/v1.11 for chain v1.16
2 parents f9b9b3f + c8d23f1 commit ad289d5

File tree

600 files changed

+35967
-6373
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

600 files changed

+35967
-6373
lines changed

.github/workflows/run-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ jobs:
88
run-tests:
99
strategy:
1010
matrix:
11-
python: ["3.9", "3.10", "3.11"]
12-
os: [ubuntu-latest, macos-latest, windows-latest]
11+
python: ["3.10", "3.11", "3.12"]
12+
os: [ubuntu-latest, macos-latest]
1313
runs-on: ${{ matrix.os }}
1414
env:
1515
OS: ${{ matrix.os }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,4 @@ cython_debug/
145145
.exchange_cookie
146146

147147
.flakeheaven_cache
148+
.vscode/settings.json

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

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

5+
## [1.11.0] - 2025-07-29
6+
### Added
7+
- Added support for Exchange V2 proto queries and types
8+
- Added support for ERC20 proto queries and types
9+
- Added support for EVM proto queries and types
10+
- Updated all chain exchange module examples to use the new Exchange V2 proto queries and types
11+
- Added examples for ERC20 queries and messages
12+
- Added examples for EVM queries
13+
- Created a new AsyncClient in the pyinjective.async_client_v2 module. This new AsyncClient provides support for the new v2 exchange endpoints. AsyncClient in pyinjective.async_client module still provides access to the v1 exchange endpoints.
14+
- Created a new Composer in the pyinjective.composer_v2 module. This new Composer provides support to create exchange v2 objects. Composer in pyinjective.composer module still provides access to the v1 exchange objects.
15+
- Created the IndexerClient class to have all indexer queries. AsyncClient v2 now does not include any logic related to the indexer endpoints. The original AsyncClient still does support indexer endpoints (for backwards compatibility) but it does that by using an instance of the IndexerClient
16+
17+
### Removed
18+
- Removed all methods marked as deprecated in AsyncClient and Composer
19+
520
## [1.10.0] - 2025-04-16
621
### Added
722
- Added support for the queries in the new TXFees module

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ gen-client: clone-all copy-proto
99
$(call clean_repos)
1010
$(MAKE) fix-generated-proto-imports
1111

12-
PROTO_MODULES := cosmwasm exchange gogoproto cosmos_proto cosmos testpb ibc amino tendermint injective
12+
PROTO_MODULES := cosmwasm exchange gogoproto cosmos_proto cosmos testpb ibc amino tendermint cometbft injective
1313

1414
fix-generated-proto-imports:
1515
@touch pyinjective/proto/__init__.py
@@ -31,7 +31,7 @@ clean-all:
3131
$(call clean_repos)
3232

3333
clone-injective-indexer:
34-
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.15.6 --depth 1 --single-branch
34+
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.16.54 --depth 1 --single-branch
3535

3636
clone-all: clone-injective-indexer
3737

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,62 @@ Upgrade `pip` to the latest version, if you see these warnings:
7070
poetry run pytest -v
7171
```
7272

73+
---
74+
75+
## Choose Exchange V1 or Exchange V2 queries
76+
77+
The Injective Python SDK provides two different clients for interacting with the exchange:
78+
79+
1. **Exchange V1 Client** (`async_client` module):
80+
- Use this client if you need to interact with the original Injective Exchange API
81+
- Import using: `from injective.async_client import AsyncClient`
82+
- Suitable for applications that need to maintain compatibility with the original exchange interface
83+
- Example:
84+
```python
85+
from injective.async_client import AsyncClient
86+
from injective.network import Network
87+
88+
async def main():
89+
# Initialize client with mainnet
90+
client = AsyncClient(network=Network.mainnet())
91+
# Or use testnet
92+
# client = AsyncClient(network=Network.testnet())
93+
# Use V1 exchange queries here
94+
```
95+
96+
2. **Exchange V2 Client** (`async_client_v2` module):
97+
- Use this client for the latest exchange features and improvements
98+
- Import using: `from injective.async_client_v2 import AsyncClient`
99+
- Recommended for new applications and when you need access to the latest exchange features
100+
- Example:
101+
```python
102+
from injective.async_client_v2 import AsyncClient
103+
from injective.network import Network
104+
105+
async def main():
106+
# Initialize client with mainnet
107+
client = AsyncClient(network=Network.mainnet())
108+
# Or use testnet
109+
# client = AsyncClient(network=Network.testnet())
110+
# Use V2 exchange queries here
111+
```
112+
113+
Both clients provide similar interfaces but with different underlying implementations. Choose V2 for new projects unless you have specific requirements for V1 compatibility.
114+
115+
> **Market Format Differences**:
116+
> - V1 AsyncClient: Markets are initialized with values in chain format (raw blockchain values)
117+
> - V2 AsyncClient: Markets are initialized with values in human-readable format (converted to standard decimal numbers)
118+
>
119+
> **Exchange Endpoint Format Differences**:
120+
> - V1 Exchange endpoints: All values (amounts, prices, margins, notionals) are returned in chain format
121+
> - V2 Exchange endpoints:
122+
> - Human-readable format for: amounts, prices, margins, and notionals
123+
> - Chain format for: deposit-related information (to maintain consistency with the Bank module)
124+
>
125+
> **Important Note**: The ChainClient (V1) will not receive any new endpoints added to the Exchange module. If you need access to new exchange-related endpoints or features, you should migrate to the V2 client. The V2 client ensures you have access to all the latest exchange functionality and improvements.
126+
127+
___
128+
73129
## License
74130

75131
Copyright © 2021 - 2025 Injective Labs Inc. (https://injectivelabs.org/)

buf.gen.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@ inputs:
1111
- module: buf.build/cosmos/gogo-proto
1212
- module: buf.build/googleapis/googleapis
1313
- module: buf.build/cosmos/ics23
14-
- git_repo: https://github.com/InjectiveLabs/cosmos-sdk
15-
tag: v0.50.9-inj.5
1614
- git_repo: https://github.com/InjectiveLabs/ibc-go
17-
tag: v8.7.0-inj
15+
tag: v8.7.0-evm-comet1-inj
1816
- git_repo: https://github.com/InjectiveLabs/wasmd
19-
tag: v0.53.2-inj.2
17+
tag: v0.53.3-evm-comet1-inj
18+
- git_repo: https://github.com/InjectiveLabs/cometbft
19+
tag: v1.0.1-inj.2
20+
- git_repo: https://github.com/InjectiveLabs/cosmos-sdk
21+
tag: v0.50.13-evm-comet1-inj.3
2022
# - git_repo: https://github.com/InjectiveLabs/wasmd
2123
# branch: v0.51.x-inj
2224
# subdir: proto
2325
- git_repo: https://github.com/InjectiveLabs/injective-core
24-
tag: v1.15.0
26+
tag: v1.16.0
2527
subdir: proto
2628
# - git_repo: https://github.com/InjectiveLabs/injective-core
27-
# branch: release/v1.15.x
29+
# branch: master
2830
# subdir: proto
2931
- directory: proto

examples/chain_client/1_LocalOrderHash.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import asyncio
2+
import json
23
import os
34
import uuid
45
from decimal import Decimal
56

67
import dotenv
78

8-
from pyinjective.async_client import AsyncClient
9+
from pyinjective.async_client_v2 import AsyncClient
910
from pyinjective.constant import GAS_FEE_BUFFER_AMOUNT
1011
from pyinjective.core.network import Network
1112
from pyinjective.orderhash import OrderHashManager
@@ -132,7 +133,7 @@ async def main() -> None:
132133

133134
# broadcast tx: send_tx_async_mode, send_tx_sync_mode, send_tx_block_mode
134135
res = await client.broadcast_tx_sync_mode(tx_raw_bytes)
135-
print(res)
136+
print(json.dumps(res, indent=2))
136137
print("gas wanted: {}".format(gas_limit))
137138
print("gas fee: {} INJ".format(gas_fee))
138139

@@ -173,7 +174,7 @@ async def main() -> None:
173174

174175
# broadcast tx: send_tx_async_mode, send_tx_sync_mode, send_tx_block_mode
175176
res = await client.broadcast_tx_sync_mode(tx_raw_bytes)
176-
print(res)
177+
print(json.dumps(res, indent=2))
177178
print("gas wanted: {}".format(gas_limit))
178179
print("gas fee: {} INJ".format(gas_fee))
179180

@@ -269,7 +270,7 @@ async def main() -> None:
269270

270271
# broadcast tx: send_tx_async_mode, send_tx_sync_mode, send_tx_block_mode
271272
res = await client.broadcast_tx_sync_mode(tx_raw_bytes)
272-
print(res)
273+
print(json.dumps(res, indent=2))
273274
print("gas wanted: {}".format(gas_limit))
274275
print("gas fee: {} INJ".format(gas_fee))
275276

examples/chain_client/2_StreamEventOrderFail.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ async def main() -> None:
1111
network = Network.mainnet()
1212
event_filter = (
1313
"tm.event='Tx' AND message.sender='inj1rwv4zn3jptsqs7l8lpa3uvzhs57y8duemete9e' "
14-
"AND message.action='/injective.exchange.v1beta1.MsgBatchUpdateOrders' "
15-
"AND injective.exchange.v1beta1.EventOrderFail.flags EXISTS"
14+
"AND message.action='/injective.exchange.v2.MsgBatchUpdateOrders' "
15+
"AND injective.exchange.v2.EventOrderFail.flags EXISTS"
1616
)
1717
query = json.dumps(
1818
{
@@ -32,8 +32,8 @@ async def main() -> None:
3232
if result == {}:
3333
continue
3434

35-
failed_order_hashes = json.loads(result["events"]["injective.exchange.v1beta1.EventOrderFail.hashes"][0])
36-
failed_order_codes = json.loads(result["events"]["injective.exchange.v1beta1.EventOrderFail.flags"][0])
35+
failed_order_hashes = json.loads(result["events"]["injective.exchange.v2.EventOrderFail.hashes"][0])
36+
failed_order_codes = json.loads(result["events"]["injective.exchange.v2.EventOrderFail.flags"][0])
3737

3838
dict = {}
3939
for i, order_hash in enumerate(failed_order_hashes):

examples/chain_client/3_MessageBroadcaster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import dotenv
88

9-
from pyinjective.async_client import AsyncClient
9+
from pyinjective.async_client_v2 import AsyncClient
1010
from pyinjective.core.broadcaster import MsgBroadcasterWithPk
1111
from pyinjective.core.network import Network
1212
from pyinjective.wallet import PrivateKey

examples/chain_client/4_MessageBroadcasterWithGranteeAccount.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import dotenv
88

9-
from pyinjective.async_client import AsyncClient
9+
from pyinjective.async_client_v2 import AsyncClient
1010
from pyinjective.core.broadcaster import MsgBroadcasterWithPk
1111
from pyinjective.core.network import Network
1212
from pyinjective.wallet import Address, PrivateKey

0 commit comments

Comments
 (0)