def sign_transaction(self, tx_data): """Creates a signed P2PKH transaction using previously prepared transaction data. :param tx_data: Output of :func:`~bitcashcn.PrivateKeyTestnet.prepare_transaction`. :type tx_data: ``str`` :returns: The signed transaction as hex. :rtype: ``str`` """ data = json.loads(tx_data) unspents = [Unspent.from_dict(unspent) for unspent in data['unspents']] outputs = data['outputs'] return create_p2pkh_transaction(self, unspents, outputs)
def test_dict_conversion(self): unspent = Unspent(10000, 7, 'script', 'txid', 0) assert unspent == Unspent.from_dict(unspent.to_dict())