Skip to content

Commit 10da834

Browse files
authored
Merge pull request #411 from InjectiveLabs/chore/final_v1_19_alignment_for_release
[CHORE] final_v1_19_alignment_for_release
2 parents b928e2e + 69af88e commit 10da834

36 files changed

Lines changed: 492 additions & 128 deletions

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

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

5-
## [1.14.0] - 9999-99-99
5+
## [1.14.0] - 2026-04-27
6+
### Changed
7+
- Updated all compiled protos for compatibility with Injective core v1.19.0 and Indexer v1.19.0
68

79
## [1.13.0] - 2026-02-13
810
### Changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ clean-all:
2626
$(call clean_repos)
2727

2828
clone-injective-indexer:
29-
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.18.59 --depth 1 --single-branch
29+
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.19.0 --depth 1 --single-branch
3030

3131
clone-all: clone-injective-indexer
3232

buf.gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ inputs:
2626
# tag: v1.0.1-inj
2727
# subdir: proto
2828
- git_repo: https://github.com/InjectiveLabs/injective-core
29-
tag: v1.19.0-beta
29+
tag: v1.19.0
3030
subdir: proto
3131
# - git_repo: https://github.com/InjectiveLabs/injective-core
3232
# branch: c-655/add_chainlink_data_streams_oracle

examples/exchange_client/oracle_rpc/1_StreamPrices.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ async def main() -> None:
2323
# select network: local, testnet, mainnet
2424
network = Network.testnet()
2525
client = IndexerClient(network)
26-
market = (await client.all_derivative_markets())[
27-
"0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6"
28-
]
26+
market_response = await client.fetch_derivative_market(
27+
market_id="0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6"
28+
)
29+
market = market_response["market"]
2930

30-
base_symbol = market.oracle_base
31-
quote_symbol = market.oracle_quote
32-
oracle_type = market.oracle_type.lower()
31+
base_symbol = market["oracleBase"]
32+
quote_symbol = market["oracleQuote"]
33+
oracle_type = market["oracleType"].lower()
3334

3435
task = asyncio.get_event_loop().create_task(
3536
client.listen_oracle_prices_updates(
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import asyncio
2+
from typing import Any, Dict
3+
4+
from grpc import RpcError
5+
6+
from pyinjective.core.network import Network
7+
from pyinjective.indexer_client import IndexerClient
8+
9+
10+
async def oracle_list_event_processor(event: Dict[str, Any]):
11+
print(event)
12+
13+
14+
def stream_error_processor(exception: RpcError):
15+
print(f"There was an error listening to oracle list updates ({exception})")
16+
17+
18+
def stream_closed_processor():
19+
print("The oracle list updates stream has been closed")
20+
21+
22+
async def main() -> None:
23+
network = Network.testnet()
24+
client = IndexerClient(network)
25+
26+
task = asyncio.get_event_loop().create_task(
27+
client.listen_oracle_list_updates(
28+
callback=oracle_list_event_processor,
29+
on_end_callback=stream_closed_processor,
30+
on_status_callback=stream_error_processor,
31+
oracle_type="provider",
32+
symbols=["TIA"],
33+
)
34+
)
35+
36+
await asyncio.sleep(delay=60)
37+
task.cancel()
38+
39+
40+
if __name__ == "__main__":
41+
asyncio.get_event_loop().run_until_complete(main())
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import asyncio
2+
from typing import Any, Dict
3+
4+
from grpc import RpcError
5+
6+
from pyinjective.core.network import Network
7+
from pyinjective.indexer_client import IndexerClient
8+
9+
10+
async def price_event_processor(event: Dict[str, Any]):
11+
print(event)
12+
13+
14+
def stream_error_processor(exception: RpcError):
15+
print(f"There was an error listening to oracle prices by markets updates ({exception})")
16+
17+
18+
def stream_closed_processor():
19+
print("The oracle prices by markets updates stream has been closed")
20+
21+
22+
async def main() -> None:
23+
network = Network.testnet()
24+
client = IndexerClient(network)
25+
market_id = "0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6"
26+
27+
task = asyncio.get_event_loop().create_task(
28+
client.listen_oracle_prices_by_markets_updates(
29+
market_ids=[market_id],
30+
callback=price_event_processor,
31+
on_end_callback=stream_closed_processor,
32+
on_status_callback=stream_error_processor,
33+
)
34+
)
35+
36+
await asyncio.sleep(delay=60)
37+
task.cancel()
38+
39+
40+
if __name__ == "__main__":
41+
asyncio.get_event_loop().run_until_complete(main())

pyinjective/client/indexer/grpc_stream/indexer_grpc_oracle_stream.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class IndexerGrpcOracleStream:
1414
def __init__(self, channel: Channel, cookie_assistant: CookieAssistant):
15-
self._stub = self._stub = exchange_oracle_grpc.InjectiveOracleRPCStub(channel)
15+
self._stub = exchange_oracle_grpc.InjectiveOracleRPCStub(channel)
1616
self._assistant = GrpcApiStreamAssistant(cookie_assistant=cookie_assistant)
1717

1818
async def stream_oracle_prices(
@@ -38,6 +38,27 @@ async def stream_oracle_prices(
3838
on_status_callback=on_status_callback,
3939
)
4040

41+
async def stream_oracle_list(
42+
self,
43+
callback: Callable,
44+
on_end_callback: Optional[Callable] = None,
45+
on_status_callback: Optional[Callable] = None,
46+
oracle_type: Optional[str] = None,
47+
symbols: Optional[List[str]] = None,
48+
):
49+
request = exchange_oracle_pb.StreamOracleListRequest(
50+
oracle_type=oracle_type,
51+
symbols=symbols or [],
52+
)
53+
54+
await self._assistant.listen_stream(
55+
call=self._stub.StreamOracleList,
56+
request=request,
57+
callback=callback,
58+
on_end_callback=on_end_callback,
59+
on_status_callback=on_status_callback,
60+
)
61+
4162
async def stream_oracle_prices_by_markets(
4263
self,
4364
market_ids: List[str],

pyinjective/indexer_client.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,36 @@ async def listen_oracle_prices_updates(
663663
oracle_type=oracle_type,
664664
)
665665

666+
async def listen_oracle_list_updates(
667+
self,
668+
callback: Callable,
669+
on_end_callback: Optional[Callable] = None,
670+
on_status_callback: Optional[Callable] = None,
671+
oracle_type: Optional[str] = None,
672+
symbols: Optional[List[str]] = None,
673+
):
674+
await self.oracle_stream_api.stream_oracle_list(
675+
callback=callback,
676+
on_end_callback=on_end_callback,
677+
on_status_callback=on_status_callback,
678+
oracle_type=oracle_type,
679+
symbols=symbols,
680+
)
681+
682+
async def listen_oracle_prices_by_markets_updates(
683+
self,
684+
market_ids: List[str],
685+
callback: Callable,
686+
on_end_callback: Optional[Callable] = None,
687+
on_status_callback: Optional[Callable] = None,
688+
):
689+
await self.oracle_stream_api.stream_oracle_prices_by_markets(
690+
market_ids=market_ids,
691+
callback=callback,
692+
on_end_callback=on_end_callback,
693+
on_status_callback=on_status_callback,
694+
)
695+
666696
# endregion
667697

668698
# region portfolio

pyinjective/proto/exchange/injective_oracle_rpc_pb2.py

Lines changed: 11 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyinjective/proto/exchange/injective_oracle_rpc_pb2_grpc.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ def __init__(self, channel):
3535
request_serializer=exchange_dot_injective__oracle__rpc__pb2.StreamPricesRequest.SerializeToString,
3636
response_deserializer=exchange_dot_injective__oracle__rpc__pb2.StreamPricesResponse.FromString,
3737
_registered_method=True)
38+
self.StreamOracleList = channel.unary_stream(
39+
'/injective_oracle_rpc.InjectiveOracleRPC/StreamOracleList',
40+
request_serializer=exchange_dot_injective__oracle__rpc__pb2.StreamOracleListRequest.SerializeToString,
41+
response_deserializer=exchange_dot_injective__oracle__rpc__pb2.StreamOracleListResponse.FromString,
42+
_registered_method=True)
3843
self.StreamPricesByMarkets = channel.unary_stream(
3944
'/injective_oracle_rpc.InjectiveOracleRPC/StreamPricesByMarkets',
4045
request_serializer=exchange_dot_injective__oracle__rpc__pb2.StreamPricesByMarketsRequest.SerializeToString,
@@ -75,6 +80,14 @@ def StreamPrices(self, request, context):
7580
context.set_details('Method not implemented!')
7681
raise NotImplementedError('Method not implemented!')
7782

83+
def StreamOracleList(self, request, context):
84+
"""StreamOracleList streams oracle data updates filtered by oracle type and
85+
optionally by symbols.
86+
"""
87+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
88+
context.set_details('Method not implemented!')
89+
raise NotImplementedError('Method not implemented!')
90+
7891
def StreamPricesByMarkets(self, request, context):
7992
"""StreamPrices streams new price changes markets
8093
"""
@@ -105,6 +118,11 @@ def add_InjectiveOracleRPCServicer_to_server(servicer, server):
105118
request_deserializer=exchange_dot_injective__oracle__rpc__pb2.StreamPricesRequest.FromString,
106119
response_serializer=exchange_dot_injective__oracle__rpc__pb2.StreamPricesResponse.SerializeToString,
107120
),
121+
'StreamOracleList': grpc.unary_stream_rpc_method_handler(
122+
servicer.StreamOracleList,
123+
request_deserializer=exchange_dot_injective__oracle__rpc__pb2.StreamOracleListRequest.FromString,
124+
response_serializer=exchange_dot_injective__oracle__rpc__pb2.StreamOracleListResponse.SerializeToString,
125+
),
108126
'StreamPricesByMarkets': grpc.unary_stream_rpc_method_handler(
109127
servicer.StreamPricesByMarkets,
110128
request_deserializer=exchange_dot_injective__oracle__rpc__pb2.StreamPricesByMarketsRequest.FromString,
@@ -230,6 +248,33 @@ def StreamPrices(request,
230248
metadata,
231249
_registered_method=True)
232250

251+
@staticmethod
252+
def StreamOracleList(request,
253+
target,
254+
options=(),
255+
channel_credentials=None,
256+
call_credentials=None,
257+
insecure=False,
258+
compression=None,
259+
wait_for_ready=None,
260+
timeout=None,
261+
metadata=None):
262+
return grpc.experimental.unary_stream(
263+
request,
264+
target,
265+
'/injective_oracle_rpc.InjectiveOracleRPC/StreamOracleList',
266+
exchange_dot_injective__oracle__rpc__pb2.StreamOracleListRequest.SerializeToString,
267+
exchange_dot_injective__oracle__rpc__pb2.StreamOracleListResponse.FromString,
268+
options,
269+
channel_credentials,
270+
insecure,
271+
call_credentials,
272+
compression,
273+
wait_for_ready,
274+
timeout,
275+
metadata,
276+
_registered_method=True)
277+
233278
@staticmethod
234279
def StreamPricesByMarkets(request,
235280
target,

0 commit comments

Comments
 (0)