File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed
Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 1+ import asyncio
2+ import logging
3+
4+ from pyinjective .async_client import AsyncClient
5+ from pyinjective .constant import Network
6+
7+ async def main () -> None :
8+ network = Network .testnet ()
9+ client = AsyncClient (network , insecure = False )
10+ address = "inj1knhahceyp57j5x7xh69p7utegnnnfgxavmahjr"
11+ acc = await client .get_account (address = address )
12+ print (acc )
13+
14+ if __name__ == '__main__' :
15+ logging .basicConfig (level = logging .INFO )
16+ asyncio .get_event_loop ().run_until_complete (main ())
Original file line number Diff line number Diff line change 5858 injective_auction_rpc_pb2_grpc as auction_rpc_grpc ,
5959)
6060
61+ from proto .injective .types .v1beta1 import (
62+ account_pb2
63+ )
64+
6165from .constant import Network
6266
6367DEFAULT_TIMEOUTHEIGHT_SYNC_INTERVAL = 20 # seconds
@@ -270,12 +274,13 @@ async def get_latest_block(self) -> tendermint_query.GetLatestBlockResponse:
270274 req = tendermint_query .GetLatestBlockRequest ()
271275 return await self .stubCosmosTendermint .GetLatestBlock (req )
272276
273- async def get_account (self , address : str ) -> Optional [auth_type . BaseAccount ]:
277+ async def get_account (self , address : str ) -> Optional [account_pb2 . EthAccount ]:
274278 try :
275- account_any = await self .stubAuth .Account (
276- auth_query .QueryAccountRequest (address = address )
277- ).account
278- account = auth_type .BaseAccount ()
279+ metadata = await self .load_cookie (type = "chain" )
280+ account_any = (await self .stubAuth .Account (
281+ auth_query .QueryAccountRequest .__call__ (address = address , metadata = metadata )
282+ )).account
283+ account = account_pb2 .EthAccount ()
279284 if account_any .Is (account .DESCRIPTOR ):
280285 account_any .Unpack (account )
281286 return account
You can’t perform that action at this time.
0 commit comments