Skip to content

Commit 8645426

Browse files
authored
Merge pull request #400 from InjectiveLabs/cp-652/update_protos_for_v1_17_0
[CP-652] update protos for v1.17.0 upgrade
2 parents 226c092 + 74bd9d2 commit 8645426

File tree

103 files changed

+8783
-3171
lines changed

Some content is hidden

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

103 files changed

+8783
-3171
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased] - 9999-99-99
66

7+
## [1.12.0] - 2025-11-10
8+
### Changed
9+
- Updated all compiled protos for compatibility with Injective core v1.17.0 and Indexer v1.17.16
10+
711
## [1.11.2] - 2025-09-24
812
### Added
913
- Added support in v2 Composer to create the new exchange module MsgCancelPostOnlyMode message

Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,14 @@ fix-generated-proto-imports:
1919
@find ./pyinjective/proto -type f -name "*.py" -exec sed -i "" -e "s/from google.api/from pyinjective.proto.google.api/g" {} \;
2020

2121
define clean_repos
22-
rm -Rf cosmos-sdk
23-
rm -Rf ibc-go
24-
rm -Rf cometbft
25-
rm -Rf wasmd
26-
rm -Rf injective-core
2722
rm -Rf injective-indexer
2823
endef
2924

3025
clean-all:
3126
$(call clean_repos)
3227

3328
clone-injective-indexer:
34-
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.16.91 --depth 1 --single-branch
29+
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.17.16 --depth 1 --single-branch
3530

3631
clone-all: clone-injective-indexer
3732

buf.gen.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,21 @@ inputs:
1212
- module: buf.build/googleapis/googleapis
1313
- module: buf.build/cosmos/ics23
1414
- git_repo: https://github.com/InjectiveLabs/ibc-go
15-
tag: v8.7.0-evm-comet1-inj
15+
tag: v8.7.0-inj.3
1616
- git_repo: https://github.com/InjectiveLabs/wasmd
17-
tag: v0.53.3-evm-comet1-inj
17+
tag: v0.53.3-inj.2
1818
- git_repo: https://github.com/InjectiveLabs/cometbft
19-
tag: v1.0.1-inj.3
19+
tag: v1.0.1-inj.4
2020
- git_repo: https://github.com/InjectiveLabs/cosmos-sdk
21-
tag: v0.50.13-evm-comet1-inj.6
21+
tag: v0.50.14-inj
2222
# - git_repo: https://github.com/InjectiveLabs/wasmd
2323
# branch: v0.51.x-inj
2424
# subdir: proto
25+
- git_repo: https://github.com/InjectiveLabs/hyperlane-cosmos
26+
tag: v1.0.1-inj
27+
subdir: proto
2528
- git_repo: https://github.com/InjectiveLabs/injective-core
26-
tag: v1.16.4
29+
tag: v1.17.0
2730
subdir: proto
2831
# - git_repo: https://github.com/InjectiveLabs/injective-core
2932
# branch: master

examples/chain_client/7_ChainStream.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ async def main() -> None:
5050
subaccount_ids=[subaccount_id], market_ids=[inj_usdt_perp_market]
5151
)
5252
oracle_price_filter = composer.chain_stream_oracle_price_filter(symbols=["INJ", "USDT"])
53+
order_failures_filter = composer.chain_stream_order_failures_filter(
54+
accounts=["inj1hkhdaj2a2clmq5jq6mspsggqs32vynpk228q3r"]
55+
)
56+
conditional_order_trigger_failures_filter = composer.chain_stream_conditional_order_trigger_failures_filter(
57+
subaccount_ids=[subaccount_id], market_ids=[inj_usdt_perp_market]
58+
)
5359

5460
task = asyncio.get_event_loop().create_task(
5561
client.listen_chain_stream_updates(
@@ -66,6 +72,8 @@ async def main() -> None:
6672
derivative_orderbooks_filter=derivative_orderbooks_filter,
6773
positions_filter=positions_filter,
6874
oracle_price_filter=oracle_price_filter,
75+
order_failures_filter=order_failures_filter,
76+
conditional_order_trigger_failures_filter=conditional_order_trigger_failures_filter,
6977
)
7078
)
7179

examples/chain_client/exchange/13_MsgInstantBinaryOptionsMarketLaunch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ async def main() -> None:
5757
min_price_tick_size=Decimal("0.01"),
5858
min_quantity_tick_size=Decimal("0.01"),
5959
min_notional=Decimal("1"),
60+
open_notional_cap=composer.uncapped_open_notional_cap(),
6061
)
6162

6263
# broadcast the transaction

examples/chain_client/exchange/25_MsgUpdateDerivativeMarket.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ async def main() -> None:
5252
new_initial_margin_ratio=Decimal("0.40"),
5353
new_maintenance_margin_ratio=Decimal("0.085"),
5454
new_reduce_margin_ratio=Decimal("3.5"),
55+
new_open_notional_cap=composer.uncapped_open_notional_cap(),
5556
)
5657

5758
# broadcast the transaction
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import asyncio
2+
import json
3+
import os
4+
5+
import dotenv
6+
7+
from pyinjective.async_client_v2 import AsyncClient
8+
from pyinjective.core.broadcaster import MsgBroadcasterWithPk
9+
from pyinjective.core.network import Network
10+
from pyinjective.wallet import PrivateKey
11+
12+
13+
async def main() -> None:
14+
dotenv.load_dotenv()
15+
configured_private_key = os.getenv("INJECTIVE_PRIVATE_KEY")
16+
17+
# select network: local, testnet, mainnet
18+
network = Network.testnet()
19+
20+
# initialize grpc client
21+
client = AsyncClient(network)
22+
await client.initialize_tokens_from_chain_denoms()
23+
composer = await client.composer()
24+
25+
gas_price = await client.current_chain_gas_price()
26+
# adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted
27+
gas_price = int(gas_price * 1.1)
28+
29+
message_broadcaster = MsgBroadcasterWithPk.new_using_simulation(
30+
network=network,
31+
private_key=configured_private_key,
32+
gas_price=gas_price,
33+
client=client,
34+
composer=composer,
35+
)
36+
37+
# load account
38+
priv_key = PrivateKey.from_hex(configured_private_key)
39+
pub_key = priv_key.to_public_key()
40+
address = pub_key.to_address()
41+
await client.fetch_account(address.to_acc_bech32())
42+
43+
offsetting_subaccount_ids = {
44+
"0xbdaedec95d563fb05240d6e01821008454c24c36000000000000000000000000",
45+
"0xaf79152ac5df276d9a8e1e2e22822f9713474902000000000000000000000000",
46+
}
47+
48+
# prepare tx msg
49+
message = composer.msg_offset_position(
50+
sender=address.to_acc_bech32(),
51+
subaccount_id=address.get_subaccount_id(index=0),
52+
market_id="0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6",
53+
offsetting_subaccount_ids=offsetting_subaccount_ids,
54+
)
55+
56+
# broadcast the transaction
57+
result = await message_broadcaster.broadcast([message])
58+
print("---Transaction Response---")
59+
print(json.dumps(result, indent=2))
60+
61+
gas_price = await client.current_chain_gas_price()
62+
# adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted
63+
gas_price = int(gas_price * 1.1)
64+
message_broadcaster.update_gas_price(gas_price=gas_price)
65+
66+
67+
if __name__ == "__main__":
68+
asyncio.get_event_loop().run_until_complete(main())

examples/chain_client/exchange/4_MsgInstantPerpetualMarketLaunch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ async def main() -> None:
5858
min_price_tick_size=Decimal("0.001"),
5959
min_quantity_tick_size=Decimal("0.01"),
6060
min_notional=Decimal("1"),
61+
open_notional_cap=composer.uncapped_open_notional_cap(),
6162
)
6263

6364
# broadcast the transaction

examples/chain_client/exchange/5_MsgInstantExpiryFuturesMarketLaunch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ async def main() -> None:
5858
min_price_tick_size=Decimal("0.001"),
5959
min_quantity_tick_size=Decimal("0.01"),
6060
min_notional=Decimal("1"),
61+
open_notional_cap=composer.uncapped_open_notional_cap(),
6162
)
6263

6364
# broadcast the transaction

examples/chain_client/exchange/9_MsgBatchUpdateOrders.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,21 @@ async def main() -> None:
104104
),
105105
]
106106

107+
derivative_market_orders_to_create = [
108+
composer.derivative_order(
109+
market_id=derivative_market_id_create,
110+
subaccount_id=subaccount_id,
111+
fee_recipient=fee_recipient,
112+
price=Decimal(25100),
113+
quantity=Decimal(0.1),
114+
margin=composer.calculate_margin(
115+
quantity=Decimal(0.1), price=Decimal(25100), leverage=Decimal(1), is_reduce_only=False
116+
),
117+
order_type="BUY",
118+
cid=str(uuid.uuid4()),
119+
),
120+
]
121+
107122
spot_orders_to_create = [
108123
composer.spot_order(
109124
market_id=spot_market_id_create,
@@ -125,13 +140,27 @@ async def main() -> None:
125140
),
126141
]
127142

143+
spot_market_orders_to_create = [
144+
composer.spot_order(
145+
market_id=spot_market_id_create,
146+
subaccount_id=subaccount_id,
147+
fee_recipient=fee_recipient,
148+
price=Decimal("3.5"),
149+
quantity=Decimal("1"),
150+
order_type="BUY",
151+
cid=str(uuid.uuid4()),
152+
),
153+
]
154+
128155
# prepare tx msg
129156
msg = composer.msg_batch_update_orders(
130157
sender=address.to_acc_bech32(),
131158
derivative_orders_to_create=derivative_orders_to_create,
132159
spot_orders_to_create=spot_orders_to_create,
133160
derivative_orders_to_cancel=derivative_orders_to_cancel,
134161
spot_orders_to_cancel=spot_orders_to_cancel,
162+
spot_market_orders_to_create=spot_market_orders_to_create,
163+
derivative_market_orders_to_create=derivative_market_orders_to_create,
135164
)
136165

137166
# broadcast the transaction

0 commit comments

Comments
 (0)