Esempio n. 1
0
 def test_converter_transactions(self):
     """
     Test with different sample transactions which made from JSON RPC API V2 or V3.
     """
     for transaction in self.transactions:
         convert_transaction(transaction)
         self.assertTrue(validate_transaction(transaction))
Esempio n. 2
0
    def get_transaction(self, tx_hash: str):
        """
        Returns the transaction information requested by transaction hash.
        Delegates to icx_getTransactionByHash RPC method.

        :param tx_hash: Transaction hash prefixed with '0x'
        :return: Information about a transaction
        """
        if is_T_HASH(tx_hash):
            params = {'txHash': tx_hash}
            result = self.__provider.make_request('icx_getTransactionByHash', params)
            convert_transaction(result)
            return result
        else:
            raise DataTypeException("This hash value is unrecognized.")
Esempio n. 3
0
    def get_transaction(self,
                        tx_hash: str,
                        full_response: bool = False) -> dict:
        """
        Returns the transaction information requested by transaction hash.
        Delegates to icx_getTransactionByHash RPC method.

        :param tx_hash: Transaction hash prefixed with '0x'
        :param full_response: Boolean to check whether get naive dict or refined data from server
        :return: Information about a transaction
        """
        if not is_T_HASH(tx_hash):
            raise DataTypeException("This hash value is unrecognized.")

        params = {'txHash': tx_hash}
        result = self.__provider.make_request('icx_getTransactionByHash',
                                              params, full_response)

        if not full_response:
            convert_transaction(result)

        return result