Skip to content

Commit 4e97c01

Browse files
author
abel
committed
Merge branch 'dev' of https://github.com/InjectiveLabs/sdk-python into feat/add_chain_streams_support
2 parents 4c5d090 + f4f56ca commit 4e97c01

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import asyncio
2+
3+
from google.protobuf import json_format
4+
5+
from pyinjective.async_client import AsyncClient
6+
from pyinjective.core.network import Network
7+
8+
9+
async def main() -> None:
10+
network = Network.testnet()
11+
client = AsyncClient(network)
12+
market_id = "0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6"
13+
skip = 10
14+
limit = 3
15+
positions = await client.get_derivative_liquidable_positions(
16+
market_id=market_id,
17+
skip=skip,
18+
limit=limit,
19+
)
20+
print(
21+
json_format.MessageToJson(
22+
message=positions,
23+
including_default_value_fields=True,
24+
preserving_proto_field_name=True,
25+
)
26+
)
27+
28+
29+
if __name__ == "__main__":
30+
asyncio.get_event_loop().run_until_complete(main())

pyinjective/core/network.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,6 @@ def mainnet(cls, node="lb"):
250250
nodes = [
251251
"lb", # us, asia, prod
252252
"lb_k8s",
253-
"sentry0", # ca, prod
254-
"sentry1", # ca, prod
255-
"sentry3", # us, prod
256253
]
257254
if node not in nodes:
258255
raise ValueError("Must be one of {}".format(nodes))
@@ -266,7 +263,7 @@ def mainnet(cls, node="lb"):
266263
chain_stream_endpoint = "sentry.chain.stream.injective.network:443"
267264
cookie_assistant = BareMetalLoadBalancedCookieAssistant()
268265
use_secure_connection = True
269-
elif node == "lb_k8s":
266+
else:
270267
lcd_endpoint = "https://k8s.global.mainnet.lcd.injective.network:443"
271268
tm_websocket_endpoint = "wss://k8s.global.mainnet.tm.injective.network:443/websocket"
272269
grpc_endpoint = "k8s.global.mainnet.chain.grpc.injective.network:443"
@@ -275,15 +272,6 @@ def mainnet(cls, node="lb"):
275272
chain_stream_endpoint = "k8s.global.mainnet.chain.stream.injective.network:443"
276273
cookie_assistant = KubernetesLoadBalancedCookieAssistant()
277274
use_secure_connection = True
278-
else:
279-
lcd_endpoint = f"http://{node}.injective.network:10337"
280-
tm_websocket_endpoint = f"ws://{node}.injective.network:26657/websocket"
281-
grpc_endpoint = f"{node}.injective.network:9900"
282-
grpc_exchange_endpoint = f"{node}.injective.network:9910"
283-
grpc_explorer_endpoint = f"{node}.injective.network:9911"
284-
chain_stream_endpoint = f"{node}.injective.network:9999"
285-
cookie_assistant = DisabledCookieAssistant()
286-
use_secure_connection = False
287275

288276
return cls(
289277
lcd_endpoint=lcd_endpoint,

0 commit comments

Comments
 (0)