|
37 | 37 | from tronapi.transactionbuilder import TransactionBuilder |
38 | 38 | from tronapi.trx import Trx |
39 | 39 | from tronapi.base.validation import is_address |
40 | | -from tronapi.utils.crypto import keccak |
| 40 | +from tronapi.utils.crypto import keccak as tron_keccak |
41 | 41 | from tronapi.utils.currency import to_sun, from_sun |
42 | 42 | from tronapi.utils.hexadecimal import remove_0x_prefix, add_0x_prefix |
43 | 43 | from tronapi.utils.types import is_integer |
@@ -301,19 +301,19 @@ def solidity_sha3(self, abi_types, values): |
301 | 301 | for abi_type, value |
302 | 302 | in zip(abi_types, normalized_values) |
303 | 303 | )) |
304 | | - return self.sha3(hexstr=hex_string) |
| 304 | + return self.keccak(hexstr=hex_string) |
305 | 305 |
|
306 | 306 | @staticmethod |
307 | 307 | @apply_to_return_value(HexBytes) |
308 | | - def sha3(primitive=None, text=None, hexstr=None): |
| 308 | + def keccak(primitive=None, text=None, hexstr=None): |
309 | 309 | if isinstance(primitive, (bytes, int, type(None))): |
310 | 310 | input_bytes = to_bytes(primitive, hexstr=hexstr, text=text) |
311 | | - return keccak(input_bytes) |
| 311 | + return tron_keccak(input_bytes) |
312 | 312 |
|
313 | 313 | 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)." % ( |
317 | 317 | primitive, |
318 | 318 | {'text': text, 'hexstr': hexstr} |
319 | 319 | ) |
|
0 commit comments