2121 service_pb2_grpc as tx_service_grpc ,
2222 service_pb2 as tx_service ,
2323)
24+
2425from .proto .exchange import (
2526 injective_accounts_rpc_pb2 as exchange_accounts_rpc_pb ,
2627 injective_accounts_rpc_pb2_grpc as exchange_accounts_rpc_grpc ,
3334 injective_derivative_exchange_rpc_pb2 as derivative_exchange_rpc_pb ,
3435 injective_derivative_exchange_rpc_pb2_grpc as derivative_exchange_rpc_grpc ,
3536 injective_meta_rpc_pb2 as exchange_meta_rpc_pb ,
36- injective_meta_rpc_pb2_grpc as exchange_meta_rpc_grpc
37+ injective_meta_rpc_pb2_grpc as exchange_meta_rpc_grpc ,
38+ injective_explorer_rpc_pb2 as explorer_rpc_pb ,
39+ injective_explorer_rpc_pb2_grpc as explorer_rpc_grpc ,
40+ injective_auction_rpc_pb2 as auction_rpc_pb ,
41+ injective_auction_rpc_pb2_grpc as auction_rpc_grpc
3742)
3843
3944from .constant import Network
@@ -73,6 +78,8 @@ def __init__(
7378 self .stubInsurance = insurance_rpc_grpc .InjectiveInsuranceRPCStub (self .exchange_channel )
7479 self .stubSpotExchange = spot_exchange_rpc_grpc .InjectiveSpotExchangeRPCStub (self .exchange_channel )
7580 self .stubDerivativeExchange = derivative_exchange_rpc_grpc .InjectiveDerivativeExchangeRPCStub (self .exchange_channel )
81+ self .stubExplorer = explorer_rpc_grpc .InjectiveExplorerRPCStub (self .exchange_channel )
82+ self .stubAuction = auction_rpc_grpc .InjectiveAuctionRPCStub (self .exchange_channel )
7683
7784 # default client methods
7885 async def get_latest_block (self ) -> tendermint_query .GetLatestBlockResponse :
@@ -135,6 +142,21 @@ async def get_chain_id(self) -> str:
135142
136143 # Injective Exchange client methods
137144
145+ # Auction RPC
146+
147+ async def get_auction (self , bid_round : int ):
148+ req = auction_rpc_pb .AuctionRequest (round = bid_round )
149+ return await self .stubAuction .AuctionEndpoint (req )
150+
151+ async def get_auctions (self ):
152+ req = auction_rpc_pb .AuctionsRequest ()
153+ return await self .stubAuction .Auctions (req )
154+
155+ async def stream_bids (self ):
156+ req = auction_rpc_pb .StreamBidsRequest ()
157+ return await self .stubAuction .StreamBids (req )
158+
159+
138160 # Meta RPC
139161
140162 async def ping (self ):
@@ -155,6 +177,12 @@ async def stream_keepalive(self):
155177 req = exchange_meta_rpc_pb .StreamKeepaliveRequest ()
156178 return self .stubMeta .StreamKeepalive (req )
157179
180+ # Explorer RPC
181+
182+ async def get_tx_by_hash (self , tx_hash : str ):
183+ req = explorer_rpc_pb .GetTxByTxHashRequest (hash = tx_hash )
184+ return await self .stubExplorer .GetTxByTxHash (req )
185+
158186 #AccountsRPC
159187
160188 async def stream_subaccount_balance (self , subaccount_id : str ):
@@ -192,6 +220,10 @@ async def get_order_states(
192220 )
193221 return await self .stubExchangeAccount .OrderStates (req )
194222
223+ async def get_portfolio (self , account_address : str ):
224+ req = exchange_accounts_rpc_pb .PortfolioRequest (account_address = account_address )
225+ return await self .stubExchangeAccount .Portfolio (req )
226+
195227
196228 # OracleRPC
197229
@@ -218,6 +250,7 @@ async def get_redemptions(self, redeemer: str = '', redemption_denom: str = '',
218250 req = insurance_rpc_pb .RedemptionsRequest (redeemer = redeemer , redemption_denom = redemption_denom , status = status )
219251 return await self .stubInsurance .Redemptions (req )
220252
253+
221254 # SpotRPC
222255
223256 async def get_spot_market (self , market_id : str ):
@@ -333,4 +366,4 @@ async def get_derivative_subaccount_trades(self, subaccount_id: str, market_id:
333366
334367 async def get_funding_payments (self , subaccount_id : str , market_id : str = '' ):
335368 req = derivative_exchange_rpc_pb .FundingPaymentsRequest (subaccount_id = subaccount_id , market_id = market_id )
336- return await self .stubDerivativeExchange .FundingPayments (req )
369+ return await self .stubDerivativeExchange .FundingPayments (req )
0 commit comments