-
Notifications
You must be signed in to change notification settings - Fork 33
Feat/permissions module support #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
97a172f
e1c526e
0ac7456
a99d7f7
2c4239d
10bf137
83c4332
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,21 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import asyncio | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from pyinjective.async_client import AsyncClient | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from pyinjective.core.network import Network | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async def main() -> None: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # select network: local, testnet, mainnet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| network = Network.testnet() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # initialize grpc client | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| client = AsyncClient(network) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| orderbook = await client.fetch_l3_derivative_orderbook( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| market_id="0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print(orderbook) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+7
to
+17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add docstring and improve error handling. The example would benefit from:
async def main() -> None:
+ """
+ Example demonstrating how to fetch Level 3 derivative orderbook data.
+
+ The market ID represents a specific derivative market on the Injective exchange.
+ Example market ID used here is for BTC/USDT perpetual futures on testnet.
+ """
# select network: local, testnet, mainnet
network = Network.testnet()
# initialize grpc client
client = AsyncClient(network)
- orderbook = await client.fetch_l3_derivative_orderbook(
- market_id="0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6",
- )
- print(orderbook)
+ try:
+ orderbook = await client.fetch_l3_derivative_orderbook(
+ market_id="0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6",
+ )
+ print(orderbook)
+ except Exception as e:
+ print(f"Error fetching orderbook: {e}")
+ finally:
+ await client.close()📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if __name__ == "__main__": | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| asyncio.get_event_loop().run_until_complete(main()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import asyncio | ||
|
|
||
| from pyinjective.async_client import AsyncClient | ||
| from pyinjective.core.network import Network | ||
|
|
||
|
|
||
| async def main() -> None: | ||
| # select network: local, testnet, mainnet | ||
| network = Network.testnet() | ||
|
|
||
| # initialize grpc client | ||
| client = AsyncClient(network) | ||
|
|
||
| orderbook = await client.fetch_l3_spot_orderbook( | ||
| market_id="0x0611780ba69656949525013d947713300f56c37b6175e02f26bffa495c3208fe", | ||
| ) | ||
| print(orderbook) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| asyncio.get_event_loop().run_until_complete(main()) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import asyncio | ||
|
|
||
| from pyinjective.async_client import AsyncClient | ||
| from pyinjective.core.network import Network | ||
|
|
||
|
|
||
| async def main() -> None: | ||
| """ | ||
| Demonstrate fetching market balance using AsyncClient. | ||
| """ | ||
| # Select network: choose between Network.mainnet(), Network.testnet(), or Network.devnet() | ||
| network = Network.testnet() | ||
|
|
||
| # Initialize the Async Client | ||
| client = AsyncClient(network) | ||
|
|
||
| try: | ||
| # Example market ID (replace with an actual market ID from the network) | ||
| market_id = "0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6" | ||
|
|
||
| # Fetch market balance | ||
| market_balance = await client.fetch_market_balance(market_id=market_id) | ||
| print("Market Balance:") | ||
| print(market_balance) | ||
|
|
||
| except Exception as ex: | ||
| print(f"Error occurred: {ex}") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| asyncio.get_event_loop().run_until_complete(main()) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import asyncio | ||
|
|
||
| from pyinjective.async_client import AsyncClient | ||
| from pyinjective.core.network import Network | ||
|
|
||
|
|
||
| async def main() -> None: | ||
| """ | ||
| Demonstrate fetching market balances using AsyncClient. | ||
| """ | ||
| # Select network: choose between Network.mainnet(), Network.testnet(), or Network.devnet() | ||
| network = Network.testnet() | ||
|
|
||
| # Initialize the Async Client | ||
| client = AsyncClient(network) | ||
|
|
||
| try: | ||
| # Fetch market balances | ||
| market_balances = await client.fetch_market_balances() | ||
| print("Market Balances:") | ||
| print(market_balances) | ||
|
|
||
| except Exception as ex: | ||
| print(f"Error occurred: {ex}") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| asyncio.get_event_loop().run_until_complete(main()) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import asyncio | ||
|
|
||
| from pyinjective.async_client import AsyncClient | ||
| from pyinjective.core.network import Network | ||
|
|
||
|
|
||
| async def main() -> None: | ||
| """ | ||
| Demonstrate fetching denom min notional using AsyncClient. | ||
| """ | ||
| # Select network: choose between Network.mainnet(), Network.testnet(), or Network.devnet() | ||
| network = Network.testnet() | ||
|
|
||
| # Initialize the Async Client | ||
| client = AsyncClient(network) | ||
|
|
||
| try: | ||
| # Example denom | ||
| denom = "factory/inj1hkhdaj2a2clmq5jq6mspsggqs32vynpk228q3r/inj_test" | ||
|
|
||
| # Fetch market balance | ||
| min_notional = await client.fetch_denom_min_notional(denom=denom) | ||
| print("Min Notional:") | ||
| print(min_notional) | ||
|
|
||
| except Exception as ex: | ||
| print(f"Error occurred: {ex}") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| asyncio.get_event_loop().run_until_complete(main()) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import asyncio | ||
|
|
||
| from pyinjective.async_client import AsyncClient | ||
| from pyinjective.core.network import Network | ||
|
|
||
|
|
||
| async def main() -> None: | ||
| """ | ||
| Demonstrate fetching denom min notionals using AsyncClient. | ||
| """ | ||
| # Select network: choose between Network.mainnet(), Network.testnet(), or Network.devnet() | ||
| network = Network.testnet() | ||
|
|
||
| # Initialize the Async Client | ||
| client = AsyncClient(network) | ||
|
|
||
| try: | ||
| # Fetch market balance | ||
| min_notionals = await client.fetch_denom_min_notionals() | ||
| print("Min Notionals:") | ||
| print(min_notionals) | ||
|
|
||
| except Exception as ex: | ||
| print(f"Error occurred: {ex}") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| asyncio.get_event_loop().run_until_complete(main()) |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Expand the changelog entry to cover all changes.
The changelog entry should document all significant changes mentioned in the PR objectives:
Additionally, consider adding a note that this version depends on the final proto definitions.
Apply this diff to expand the changelog entry:
📝 Committable suggestion
🧰 Tools
🪛 LanguageTool
[duplication] ~6-~6: Possible typo: you repeated a word.
Context: ...this file. ## [1.9.0] - 9999-99-99 ### Added - Added support for all new queries and message...
(ENGLISH_WORD_REPEAT_RULE)