From ae60e4df7950a75e31dd658d94c294bd3e0189ae Mon Sep 17 00:00:00 2001 From: abel Date: Tue, 16 Jan 2024 11:52:25 -0300 Subject: [PATCH 1/2] (fix) Changed version number for dev branch --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a15c4162..a024299a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "injective-py" -version = "1.1.0" +version = "1.2.0-rc1" description = "Injective Python SDK, with Exchange API Client" authors = ["Injective Labs "] license = "Apache-2.0" From c318d0ae0bccf30ecb70e1dec2956879e9d5267a Mon Sep 17 00:00:00 2001 From: abel Date: Wed, 17 Jan 2024 10:22:45 -0300 Subject: [PATCH 2/2] (feat) Cleaned up the markets initialization logic --- pyinjective/async_client.py | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/pyinjective/async_client.py b/pyinjective/async_client.py index ec42c2ce..e8da821b 100644 --- a/pyinjective/async_client.py +++ b/pyinjective/async_client.py @@ -9,7 +9,6 @@ import grpc from google.protobuf import json_format -from pyinjective import constant from pyinjective.client.chain.grpc.chain_grpc_auth_api import ChainGrpcAuthApi from pyinjective.client.chain.grpc.chain_grpc_authz_api import ChainGrpcAuthZApi from pyinjective.client.chain.grpc.chain_grpc_bank_api import ChainGrpcBankApi @@ -2659,22 +2658,13 @@ async def _initialize_tokens_and_markets(self): ) for market_info in valid_markets: - ticker = market_info["ticker"] - if "/" in ticker: - base_token_symbol, quote_token_symbol = ticker.split(constant.TICKER_TOKENS_SEPARATOR) - else: - base_token_symbol = market_info["baseTokenMeta"]["symbol"] - quote_token_symbol = market_info["quoteTokenMeta"]["symbol"] - base_token = self._token_representation( - symbol=base_token_symbol, token_meta=market_info["baseTokenMeta"], denom=market_info["baseDenom"], tokens_by_denom=tokens_by_denom, tokens_by_symbol=tokens_by_symbol, ) quote_token = self._token_representation( - symbol=quote_token_symbol, token_meta=market_info["quoteTokenMeta"], denom=market_info["quoteDenom"], tokens_by_denom=tokens_by_denom, @@ -2704,10 +2694,7 @@ async def _initialize_tokens_and_markets(self): ) for market_info in valid_markets: - quote_token_symbol = market_info["quoteTokenMeta"]["symbol"] - quote_token = self._token_representation( - symbol=quote_token_symbol, token_meta=market_info["quoteTokenMeta"], denom=market_info["quoteDenom"], tokens_by_denom=tokens_by_denom, @@ -2769,7 +2756,6 @@ async def _initialize_tokens_and_markets(self): def _token_representation( self, - symbol: str, token_meta: Dict[str, Any], denom: str, tokens_by_denom: Dict[str, Token], @@ -2777,14 +2763,14 @@ def _token_representation( ) -> Token: if denom not in tokens_by_denom: unique_symbol = denom - for symbol_candidate in [symbol, token_meta["symbol"], token_meta["name"]]: + for symbol_candidate in [token_meta["symbol"], token_meta["name"]]: if symbol_candidate not in tokens_by_symbol: unique_symbol = symbol_candidate break token = Token( name=token_meta["name"], - symbol=symbol, + symbol=token_meta["symbol"], denom=denom, address=token_meta["address"], decimals=token_meta["decimals"],