iexbase/tron-api-python

TypeError: encoding without a string argument

Closed this issue · 3 comments

if self._private_key and _private_base58 != _base58:

When Tron class init, the default_address param should be Base58 format, otherwise the private_key would be None. because _private_base58 != _base58.

Traceback (most recent call last):
File "/home/an/Desktop/python/walletserver/exjrpc/tron_rpc.py", line 82, in
print(client.withdrawal(TRON_WALLET_ADDRESS_HEX, 0.9))
File "/home/an/Desktop/python/walletserver/exjrpc/tron_rpc.py", line 69, in withdrawal
tx = self.trx.send_trx(to_address, amount)
File "/home/an/virtualenvs/env/lib/python3.6/site-packages/tronapi/trx.py", line 375, in send_trx
return self.send_transaction(to, amount, options)
File "/home/an/virtualenvs/env/lib/python3.6/site-packages/tronapi/trx.py", line 404, in send_transaction
sign = self.sign(tx)
File "/home/an/virtualenvs/env/lib/python3.6/site-packages/tronapi/trx.py", line 549, in sign
address = self.tron.address.from_private_key(self.tron.private_key).hex.lower()
File "/home/an/virtualenvs/env/lib/python3.6/site-packages/tronapi/common/account.py", line 59, in from_private_key
return PrivateKey(private_key).address
File "/home/an/virtualenvs/env/lib/python3.6/site-packages/tronapi/common/account.py", line 70, in init
_private = unhexlify(bytes(private_key, encoding='utf8'))
TypeError: encoding without a string argument