tfchain/TFChainClient.py
def unlockhash_get(self, target):
        """
        Get all transactions linked to the given unlockhash (target),
        as well as other information such as the multisig addresses linked to the given unlockhash (target).

        target can be any of:
            - None: unlockhash of the Free-For-All wallet will be used
            - str (or unlockhash/bytes/bytearray): target is assumed to be the unlockhash of a personal wallet
            - list: target is assumed to be the addresses of a MultiSig wallet where all owners (specified as a list of addresses) have to sign
            - tuple (addresses, sigcount): target is a sigcount-of-addresscount MultiSig wallet

        @param target: the target wallet to look up transactions for in the explorer, see above for more info
        """
        unlockhash = str(ConditionTypes.from_recipient(target).unlockhash)
        endpoint = "/explorer/hashes/"+unlockhash
        resp = self.explorer_get(endpoint=endpoint)
        resp = json_loads(resp)
        try:
            if resp['hashtype'] != 'unlockhash':
                raise tfchain.errors.ExplorerInvalidResponse("expected hash type 'unlockhash' not '{}'".format(resp['hashtype']), endpoint, resp)
            # parse the transactions
            transactions = []
            for etxn in resp['transactions']:
                # parse the explorer transaction
                transaction = self._transaction_from_explorer_transaction(etxn, endpoint=endpoint, resp=resp)
                # append the transaction to the list of transactions
                transactions.append(transaction)
            # collect all multisig addresses
            multisig_addresses = [UnlockHash.from_json(obj=uh) for uh in resp.get('multisigaddresses', None) or []]
            for addr in multisig_addresses:
                if addr.type != UnlockHashType.MULTI_SIG:
                    raise tfchain.errors.ExplorerInvalidResponse("invalid unlock hash type {} for MultiSignature Address (expected: 3)".format(addr.type), endpoint, resp)
            erc20_info = None
            if 'erc20info' in resp:
                info = resp['erc20info']
                erc20_info = ERC20AddressInfo(
                    address_tft=UnlockHash.from_json(info['tftaddress']),
                    address_erc20=ERC20Address.from_json(info['erc20address']),
                    confirmations=int(info['confirmations']),
                )

            # sort the transactions by height
            transactions.sort(key=(lambda txn: sys.maxsize if txn.height < 0 else txn.height), reverse=True)

            # return explorer data for the unlockhash
            return ExplorerUnlockhashResult(
                unlockhash=UnlockHash.from_json(unlockhash),
                transactions=transactions,
                multisig_addresses=multisig_addresses,
                erc20_info=erc20_info,
                client=self)
        except KeyError as exc:
            # return a KeyError as an invalid Explorer Response
            raise tfchain.errors.ExplorerInvalidResponse(str(exc), endpoint, resp) from exc

        Get all transactions linked to the given unlockhash (target),
        as well as other information such as the multisig addresses linked to the given unlockhash (target).

        target can be any of:
            - None: unlockhash of the Free-For-All wallet will be used
            - str (or unlockhash/bytes/bytearray): target is assumed to be the unlockhash of a personal wallet
            - list: target is assumed to be the addresses of a MultiSig wallet where all owners (specified as a list of addresses) have to sign
            - tuple (addresses, sigcount): target is a sigcount-of-addresscount MultiSig wallet

        @param target: the target wallet to look up transactions for in the explorer, see above for more info
        
Get all transactions linked to the given unlockhash (target),
as well as other information such as the multisig addresses linked to the given unlockhash (target).


Get all transactions linked to the given unlockhash ( target ) as well as other information such as the multisig addresses linked to the given unlockhash ( target ) .
def unlockhash_get(self, target):
        unlockhash = str(ConditionTypes.from_recipient(target).unlockhash)
        endpoint = "/explorer/hashes/"+unlockhash
        resp = self.explorer_get(endpoint=endpoint)
        resp = json_loads(resp)
        try:
            if resp['hashtype'] != 'unlockhash':
                raise tfchain.errors.ExplorerInvalidResponse("expected hash type 'unlockhash' not '{}'".format(resp['hashtype']), endpoint, resp)
            transactions = []
            for etxn in resp['transactions']:
                transaction = self._transaction_from_explorer_transaction(etxn, endpoint=endpoint, resp=resp)
                transactions.append(transaction)
            multisig_addresses = [UnlockHash.from_json(obj=uh) for uh in resp.get('multisigaddresses', None) or []]
            for addr in multisig_addresses:
                if addr.type != UnlockHashType.MULTI_SIG:
                    raise tfchain.errors.ExplorerInvalidResponse("invalid unlock hash type {} for MultiSignature Address (expected: 3)".format(addr.type), endpoint, resp)
            erc20_info = None
            if 'erc20info' in resp:
                info = resp['erc20info']
                erc20_info = ERC20AddressInfo(
                    address_tft=UnlockHash.from_json(info['tftaddress']),
                    address_erc20=ERC20Address.from_json(info['erc20address']),
                    confirmations=int(info['confirmations']),
                )
            transactions.sort(key=(lambda txn: sys.maxsize if txn.height < 0 else txn.height), reverse=True)
            return ExplorerUnlockhashResult(
                unlockhash=UnlockHash.from_json(unlockhash),
                transactions=transactions,
                multisig_addresses=multisig_addresses,
                erc20_info=erc20_info,
                client=self)
        except KeyError as exc:
            raise tfchain.errors.ExplorerInvalidResponse(str(exc), endpoint, resp) from exc
def unlockhash_get ( self , target ) : unlockhash = str ( ConditionTypes . from_recipient ( target ) . unlockhash ) endpoint = "/explorer/hashes/" + unlockhash resp = self . explorer_get ( endpoint = endpoint ) resp = json_loads ( resp ) try : if resp [ 'hashtype' ] != 'unlockhash' : raise tfchain . errors . ExplorerInvalidResponse ( "expected hash type 'unlockhash' not '{}'" . format ( resp [ 'hashtype' ] ) , endpoint , resp ) transactions = [ ] for etxn in resp [ 'transactions' ] : transaction = self . _transaction_from_explorer_transaction ( etxn , endpoint = endpoint , resp = resp ) transactions . append ( transaction ) multisig_addresses = [ UnlockHash . from_json ( obj = uh ) for uh in resp . get ( 'multisigaddresses' , None ) or [ ] ] for addr in multisig_addresses : if addr . type != UnlockHashType . MULTI_SIG : raise tfchain . errors . ExplorerInvalidResponse ( "invalid unlock hash type {} for MultiSignature Address (expected: 3)" . format ( addr . type ) , endpoint , resp ) erc20_info = None if 'erc20info' in resp : info = resp [ 'erc20info' ] erc20_info = ERC20AddressInfo ( address_tft = UnlockHash . from_json ( info [ 'tftaddress' ] ) , address_erc20 = ERC20Address . from_json ( info [ 'erc20address' ] ) , confirmations = int ( info [ 'confirmations' ] ) , ) transactions . sort ( key = ( lambda txn : sys . maxsize if txn . height < 0 else txn . height ) , reverse = True ) return ExplorerUnlockhashResult ( unlockhash = UnlockHash . from_json ( unlockhash ) , transactions = transactions , multisig_addresses = multisig_addresses , erc20_info = erc20_info , client = self ) except KeyError as exc : raise tfchain . errors . ExplorerInvalidResponse ( str ( exc ) , endpoint , resp ) from exc
Get all transactions linked to the given unlockhash (target),
as well as other information such as the multisig addresses linked to the given unlockhash (target).
Get all transactions linked to the given unlockhash ( target ) as well as other information such as the multisig addresses linked to the given unlockhash ( target ) .
"""
        Get all transactions linked to the given unlockhash (target),
        as well as other information such as the multisig addresses linked to the given unlockhash (target).

        target can be any of:
            - None: unlockhash of the Free-For-All wallet will be used
            - str (or unlockhash/bytes/bytearray): target is assumed to be the unlockhash of a personal wallet
            - list: target is assumed to be the addresses of a MultiSig wallet where all owners (specified as a list of addresses) have to sign
            - tuple (addresses, sigcount): target is a sigcount-of-addresscount MultiSig wallet

        @param target: the target wallet to look up transactions for in the explorer, see above for more info
        """ # parse the transactions # parse the explorer transaction # append the transaction to the list of transactions # collect all multisig addresses # sort the transactions by height # return explorer data for the unlockhash # return a KeyError as an invalid Explorer Response
self
target
the target wallet to look up transactions for in the explorer, see above for more info
the target wallet to look up transactions for in the explorer see above for more info