dragonchain/lib/dto/bnb.py
def is_transaction_confirmed(self, transaction_hash: str) -> bool:
        """Check if a transaction is considered confirmed
        Args:
            transaction_hash: The hash (or equivalent, i.e. id) of the transaction to check
        Returns:
            Boolean if the transaction has received enough confirmations to be considered confirmed
        Raises:
            exceptions.TransactionNotFound: When the transaction could not be found (may have been dropped)
        """
        _log.info(f"[BINANCE] Getting confirmations for {transaction_hash}")
        # txn_hash is expected to be base64, not hex:
        transaction_hash = base64.b64encode(bytes.fromhex(transaction_hash)).decode("ascii")
        response = self._call_node_rpc("tx", {"hash": transaction_hash, "prove": True}).json()
        if response.get("error") is not None:  # can't use HTTP status codes, it is a 200
            if "not found" in response["error"]["data"]:  # transaction wasn't found!
                _log.warning(f"[BINANCE] response error: {response['error']['data']}")
                raise exceptions.TransactionNotFound(f"[BINANCE] Transaction {transaction_hash} not found")
        transaction_block_number = int(response["result"]["height"])
        latest_block_number = self.get_current_block()
        _log.info(f"[BINANCE] Latest block number: {latest_block_number} | Block number of transaction: {transaction_block_number}")
        return (latest_block_number - transaction_block_number) >= CONFIRMATIONS_CONSIDERED_FINAL
Check if a transaction is considered confirmed
        Args:
            transaction_hash: The hash (or equivalent, i.e. id) of the transaction to check
        Returns:
            Boolean if the transaction has received enough confirmations to be considered confirmed
        Raises:
            exceptions.TransactionNotFound: When the transaction could not be found (may have been dropped)
        
Check if a transaction is considered confirmed
Check if a transaction is considered confirmed
def is_transaction_confirmed(self, transaction_hash: str) -> bool:
        _log.info(f"[BINANCE] Getting confirmations for {transaction_hash}")
        transaction_hash = base64.b64encode(bytes.fromhex(transaction_hash)).decode("ascii")
        response = self._call_node_rpc("tx", {"hash": transaction_hash, "prove": True}).json()
        if response.get("error") is not None:  
            if "not found" in response["error"]["data"]:  
                _log.warning(f"[BINANCE] response error: {response['error']['data']}")
                raise exceptions.TransactionNotFound(f"[BINANCE] Transaction {transaction_hash} not found")
        transaction_block_number = int(response["result"]["height"])
        latest_block_number = self.get_current_block()
        _log.info(f"[BINANCE] Latest block number: {latest_block_number} | Block number of transaction: {transaction_block_number}")
        return (latest_block_number - transaction_block_number) >= CONFIRMATIONS_CONSIDERED_FINAL
def is_transaction_confirmed ( self , transaction_hash : str ) -> bool : _log . info ( f"[BINANCE] Getting confirmations for {transaction_hash}" ) transaction_hash = base64 . b64encode ( bytes . fromhex ( transaction_hash ) ) . decode ( "ascii" ) response = self . _call_node_rpc ( "tx" , { "hash" : transaction_hash , "prove" : True } ) . json ( ) if response . get ( "error" ) is not None : if "not found" in response [ "error" ] [ "data" ] : _log . warning ( f"[BINANCE] response error: {response['error']['data']}" ) raise exceptions . TransactionNotFound ( f"[BINANCE] Transaction {transaction_hash} not found" ) transaction_block_number = int ( response [ "result" ] [ "height" ] ) latest_block_number = self . get_current_block ( ) _log . info ( f"[BINANCE] Latest block number: {latest_block_number} | Block number of transaction: {transaction_block_number}" ) return ( latest_block_number - transaction_block_number ) >= CONFIRMATIONS_CONSIDERED_FINAL
Check if a transaction is considered confirmed
Check if a transaction is considered confirmed
"""Check if a transaction is considered confirmed
        Args:
            transaction_hash: The hash (or equivalent, i.e. id) of the transaction to check
        Returns:
            Boolean if the transaction has received enough confirmations to be considered confirmed
        Raises:
            exceptions.TransactionNotFound: When the transaction could not be found (may have been dropped)
        """ # txn_hash is expected to be base64, not hex: # can't use HTTP status codes, it is a 200 # transaction wasn't found!
Boolean if the transaction has received enough confirmations to be considered confirmed
Boolean if the transaction has received enough confirmations to be considered confirmed
When the transaction could not be found (may have been dropped)
When the transaction could not be found ( may have been dropped )
exceptions.TransactionNotFound
self
transaction_hash
str
The hash (or equivalent, i.e. id) of the transaction to check
The hash ( or equivalent i . e . id ) of the transaction to check