Skip to content

Commit a99d7f7

Browse files
committed
(feat) Updated proto definitions with the chain and indexer versions used for the v1.14 Testnet upgrade. Included the new fields and endpoints in the SDK API components and updated the example scripts
1 parent 0ac7456 commit a99d7f7

File tree

64 files changed

+2544
-738
lines changed

Some content is hidden

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

64 files changed

+2544
-738
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.13.4 --depth 1 --single-branch
34+
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.13.117_RC1 --depth 1 --single-branch
3535

3636
clone-all: clone-injective-indexer
3737

buf.gen.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ inputs:
1212
- module: buf.build/googleapis/googleapis
1313
- module: buf.build/cosmos/ics23
1414
- git_repo: https://github.com/InjectiveLabs/cosmos-sdk
15-
tag: v0.50.8-inj-0
15+
tag: v0.50.9-inj-2
1616
- git_repo: https://github.com/InjectiveLabs/ibc-go
1717
tag: v8.3.2-inj-0
1818
- git_repo: https://github.com/InjectiveLabs/wasmd
19-
tag: v0.51.0-inj-0
19+
tag: v0.53.2-inj-1
2020
# - git_repo: https://github.com/InjectiveLabs/wasmd
2121
# branch: v0.51.x-inj
2222
# subdir: proto
2323
# - git_repo: https://github.com/InjectiveLabs/injective-core
2424
# tag: v1.13.0
2525
# subdir: proto
2626
- git_repo: https://github.com/InjectiveLabs/injective-core
27-
branch: f/permissions-rework
27+
branch: testnet
2828
subdir: proto
2929
- directory: proto
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import asyncio
2+
3+
from pyinjective.async_client import AsyncClient
4+
from pyinjective.core.network import Network
5+
6+
7+
async def main() -> None:
8+
# select network: local, testnet, mainnet
9+
network = Network.testnet()
10+
11+
# initialize grpc client
12+
client = AsyncClient(network)
13+
14+
orderbook = await client.fetch_l3_derivative_orderbook(
15+
market_id="0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6",
16+
)
17+
print(orderbook)
18+
19+
20+
if __name__ == "__main__":
21+
asyncio.get_event_loop().run_until_complete(main())
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import asyncio
2+
3+
from pyinjective.async_client import AsyncClient
4+
from pyinjective.core.network import Network
5+
6+
7+
async def main() -> None:
8+
# select network: local, testnet, mainnet
9+
network = Network.testnet()
10+
11+
# initialize grpc client
12+
client = AsyncClient(network)
13+
14+
orderbook = await client.fetch_l3_spot_orderbook(
15+
market_id="0x0611780ba69656949525013d947713300f56c37b6175e02f26bffa495c3208fe",
16+
)
17+
print(orderbook)
18+
19+
20+
if __name__ == "__main__":
21+
asyncio.get_event_loop().run_until_complete(main())
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import asyncio
2+
3+
from pyinjective.async_client import AsyncClient
4+
from pyinjective.core.network import Network
5+
6+
7+
async def main() -> None:
8+
"""
9+
Demonstrate fetching market balance using AsyncClient.
10+
"""
11+
# Select network: choose between Network.mainnet(), Network.testnet(), or Network.devnet()
12+
network = Network.testnet()
13+
14+
# Initialize the Async Client
15+
client = AsyncClient(network)
16+
17+
try:
18+
# Example market ID (replace with an actual market ID from the network)
19+
market_id = "0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6"
20+
21+
# Fetch market balance
22+
market_balance = await client.fetch_market_balance(market_id=market_id)
23+
print("Market Balance:")
24+
print(market_balance)
25+
26+
except Exception as ex:
27+
print(f"Error occurred: {ex}")
28+
29+
30+
if __name__ == "__main__":
31+
asyncio.get_event_loop().run_until_complete(main())
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import asyncio
2+
3+
from pyinjective.async_client import AsyncClient
4+
from pyinjective.core.network import Network
5+
6+
7+
async def main() -> None:
8+
"""
9+
Demonstrate fetching market balances using AsyncClient.
10+
"""
11+
# Select network: choose between Network.mainnet(), Network.testnet(), or Network.devnet()
12+
network = Network.testnet()
13+
14+
# Initialize the Async Client
15+
client = AsyncClient(network)
16+
17+
try:
18+
# Fetch market balances
19+
market_balances = await client.fetch_market_balances()
20+
print("Market Balances:")
21+
print(market_balances)
22+
23+
except Exception as ex:
24+
print(f"Error occurred: {ex}")
25+
26+
27+
if __name__ == "__main__":
28+
asyncio.get_event_loop().run_until_complete(main())
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import asyncio
2+
3+
from pyinjective.async_client import AsyncClient
4+
from pyinjective.core.network import Network
5+
6+
7+
async def main() -> None:
8+
"""
9+
Demonstrate fetching denom min notional using AsyncClient.
10+
"""
11+
# Select network: choose between Network.mainnet(), Network.testnet(), or Network.devnet()
12+
network = Network.testnet()
13+
14+
# Initialize the Async Client
15+
client = AsyncClient(network)
16+
17+
try:
18+
# Example denom
19+
denom = "factory/inj1hkhdaj2a2clmq5jq6mspsggqs32vynpk228q3r/inj_test"
20+
21+
# Fetch market balance
22+
min_notional = await client.fetch_denom_min_notional(denom=denom)
23+
print("Min Notional:")
24+
print(min_notional)
25+
26+
except Exception as ex:
27+
print(f"Error occurred: {ex}")
28+
29+
30+
if __name__ == "__main__":
31+
asyncio.get_event_loop().run_until_complete(main())
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import asyncio
2+
3+
from pyinjective.async_client import AsyncClient
4+
from pyinjective.core.network import Network
5+
6+
7+
async def main() -> None:
8+
"""
9+
Demonstrate fetching denom min notionals using AsyncClient.
10+
"""
11+
# Select network: choose between Network.mainnet(), Network.testnet(), or Network.devnet()
12+
network = Network.testnet()
13+
14+
# Initialize the Async Client
15+
client = AsyncClient(network)
16+
17+
try:
18+
# Fetch market balance
19+
min_notionals = await client.fetch_denom_min_notionals()
20+
print("Min Notionals:")
21+
print(min_notionals)
22+
23+
except Exception as ex:
24+
print(f"Error occurred: {ex}")
25+
26+
27+
if __name__ == "__main__":
28+
asyncio.get_event_loop().run_until_complete(main())
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import asyncio
2+
3+
from pyinjective.async_client import AsyncClient
4+
from pyinjective.core.network import Network
5+
6+
7+
async def main():
8+
# Select network: testnet, mainnet, or local
9+
network = Network.testnet()
10+
11+
# Initialize AsyncClient
12+
client = AsyncClient(network)
13+
14+
try:
15+
# Fetch INJ burnt amount
16+
inj_burnt_response = await client.fetch_inj_burnt()
17+
print("INJ Burnt Endpoint Response:")
18+
print(inj_burnt_response)
19+
20+
except Exception as e:
21+
print(f"Error fetching INJ burnt amount: {e}")
22+
23+
24+
if __name__ == "__main__":
25+
asyncio.get_event_loop().run_until_complete(main())

examples/exchange_client/derivative_exchange_rpc/9_StreamPositions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async def main() -> None:
2727
subaccount_ids = ["0xea98e3aa091a6676194df40ac089e40ab4604bf9000000000000000000000000"]
2828

2929
task = asyncio.get_event_loop().create_task(
30-
client.listen_derivative_positions_updates(
30+
client.listen_derivative_positions_v2_updates(
3131
callback=positions_event_processor,
3232
on_end_callback=stream_closed_processor,
3333
on_status_callback=stream_error_processor,

0 commit comments

Comments
 (0)