Exemplo n.º 1
0
 async def get_block_record_by_height(self,
                                      height) -> Optional[BlockRecord]:
     try:
         response = await self.fetch("get_block_record_by_height",
                                     {"height": height})
     except Exception:
         return None
     return BlockRecord.from_json_dict(response["block_record"])
 async def get_block_record(self, header_hash) -> Optional[BlockRecord]:
     try:
         response = await self.fetch("get_block_record", {"header_hash": header_hash.hex()})
         if response["block_record"] is None:
             return None
     except Exception:
         return None
     return BlockRecord.from_json_dict(response["block_record"])
Exemplo n.º 3
0
 async def get_blockchain_state(self) -> Dict:
     response = await self.fetch("get_blockchain_state", {})
     if response["blockchain_state"]["peak"] is not None:
         response["blockchain_state"]["peak"] = BlockRecord.from_json_dict(
             response["blockchain_state"]["peak"])
     return response["blockchain_state"]