I'm trying to prepare a transaction using "PrivateKeyTestnet.prepareTransaction".
The following code works as expected:
tx_data = PrivateKeyTestnet.prepare_transaction(key.address, [(key.address, amount, currency)], leftover=key.address)
I'm able to prepare the transaction and sign it. I then send the transaction with a rpc call to a node installed on my machine that broadcast it.
When I do the following I receive an error:
tx_data = PrivateKeyTestnet.prepare_transaction(key.address, [(key.address, amount, currency)], leftover=key.address, message=message)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\biotech4\Documents\Progetti\bch_interact\venv\lib\site-packages\bitcash\wallet.py", line 658, in prepare_transaction
return json.dumps(data, separators=(',', ':'))
File "C:\Users\biotech4\AppData\Local\Programs\Python\Python38-32\lib\json\__init__.py", line 234, in dumps
return cls(
File "C:\Users\biotech4\AppData\Local\Programs\Python\Python38-32\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Users\biotech4\AppData\Local\Programs\Python\Python38-32\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "C:\Users\biotech4\AppData\Local\Programs\Python\Python38-32\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable
I'm trying to prepare a transaction using "PrivateKeyTestnet.prepareTransaction".
The following code works as expected:
tx_data = PrivateKeyTestnet.prepare_transaction(key.address, [(key.address, amount, currency)], leftover=key.address)
I'm able to prepare the transaction and sign it. I then send the transaction with a rpc call to a node installed on my machine that broadcast it.
When I do the following I receive an error:
tx_data = PrivateKeyTestnet.prepare_transaction(key.address, [(key.address, amount, currency)], leftover=key.address, message=message)
Message is a str, as by documentation (https://pybitcash.github.io/bitcash/dev/api.html#bitcash.PrivateKey.prepare_transaction). I also tried sending a hex string.