Skip to content

Commit 8d18495

Browse files
committed
tron.sha3 replaced tron.keccak
1 parent 3cb28aa commit 8d18495

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tronapi/main.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from tronapi.transactionbuilder import TransactionBuilder
3838
from tronapi.trx import Trx
3939
from tronapi.base.validation import is_address
40-
from tronapi.utils.crypto import keccak
40+
from tronapi.utils.crypto import keccak as tron_keccak
4141
from tronapi.utils.currency import to_sun, from_sun
4242
from tronapi.utils.hexadecimal import remove_0x_prefix, add_0x_prefix
4343
from tronapi.utils.types import is_integer
@@ -301,19 +301,19 @@ def solidity_sha3(self, abi_types, values):
301301
for abi_type, value
302302
in zip(abi_types, normalized_values)
303303
))
304-
return self.sha3(hexstr=hex_string)
304+
return self.keccak(hexstr=hex_string)
305305

306306
@staticmethod
307307
@apply_to_return_value(HexBytes)
308-
def sha3(primitive=None, text=None, hexstr=None):
308+
def keccak(primitive=None, text=None, hexstr=None):
309309
if isinstance(primitive, (bytes, int, type(None))):
310310
input_bytes = to_bytes(primitive, hexstr=hexstr, text=text)
311-
return keccak(input_bytes)
311+
return tron_keccak(input_bytes)
312312

313313
raise TypeError(
314-
"You called sha3 with first arg %r and keywords %r. You must call it with one of "
315-
"these approaches: sha3(text='txt'), sha3(hexstr='0x747874'), "
316-
"sha3(b'\\x74\\x78\\x74'), or sha3(0x747874)." % (
314+
"You called keccak with first arg %r and keywords %r. You must call it with one of "
315+
"these approaches: keccak(text='txt'), keccak(hexstr='0x747874'), "
316+
"keccak(b'\\x74\\x78\\x74'), or keccak(0x747874)." % (
317317
primitive,
318318
{'text': text, 'hexstr': hexstr}
319319
)

0 commit comments

Comments
 (0)