Ejemplo n.º 1
0
 def get_memory_pool_tx_state(self, tx_hash: str, is_full: bool = False) -> List[dict] or dict:
     url = RestfulMethod.get_mem_pool_tx_state(self._url, tx_hash)
     response = self.__get(url)
     if response.get('Result', '') == '':
         raise SDKException(ErrorCode.invalid_tx_hash(tx_hash))
     if is_full:
         return response
     return response['Result']['State']
Ejemplo n.º 2
0
 async def get_block_height_by_tx_hash(self, tx_hash: str, is_full: bool = False):
     payload = self.generate_json_rpc_payload(RpcMethod.GET_BLOCK_HEIGHT_BY_HASH, [tx_hash])
     response = await self.__post(payload)
     if response.get('result', '') == '':
         raise SDKException(ErrorCode.invalid_tx_hash(tx_hash))
     if is_full:
         return response
     return response['result']
Ejemplo n.º 3
0
 async def get_block_height_by_tx_hash(self, tx_hash: str, is_full: bool = False):
     url = RestfulMethod.get_block_height_by_tx_hash(self._url, tx_hash)
     response = await self.__get(url)
     if response.get('Result', '') == '':
         raise SDKException(ErrorCode.invalid_tx_hash(tx_hash))
     if is_full:
         return response
     return response['Result']
Ejemplo n.º 4
0
 def get_memory_pool_tx_state(self, tx_hash: str, is_full: bool = False):
     payload = self.generate_json_rpc_payload(
         RpcMethod.GET_MEM_POOL_TX_STATE, [tx_hash])
     response = self.__post(self._url, payload)
     if response.get('result', '') == '':
         raise SDKException(ErrorCode.invalid_tx_hash(tx_hash))
     if is_full:
         return response
     return response['result']['State']
Ejemplo n.º 5
0
 async def get_block_height_by_tx_hash(self,
                                       tx_hash: str,
                                       is_full: bool = False):
     if self.__id == 0:
         self.__id = self.__generate_ws_id()
     msg = dict(Action='getblockheightbytxhash',
                Id=self.__id,
                Version='1.0.0',
                Hash=tx_hash)
     response = await self.__send_recv(msg, is_full=True)
     if response.get('Result', '') == '':
         raise SDKException(ErrorCode.invalid_tx_hash(tx_hash))
     if is_full:
         return response
     return response['Result']