from tronpy.abi import trx_abi
# Assuming you have a TRC10 token ID
token_id = 1000001 # Example TRC10 token ID
# Encode the token ID using 'trcToken' type
encoded_data = trx_abi.encode_abi(['trcToken'], [token_id])
print(f"Encoded TRC10 token ID: {encoded_data.hex()}")
venv/lib/python3.13/site-packages/tronpy/abi.py:94: in encode_abi
return super().encode(types, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
__class__ = <class 'tronpy.abi.ABICodec'>
args = [1000001]
self = <tronpy.abi.ABICodec object at 0x105161be0>
types = ['trcToken']
venv/lib/python3.13/site-packages/eth_abi/codec.py:71: in encode
encoders = [self._registry.get_encoder(type_str) for type_str in types]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
args = [1000001]
self = <tronpy.abi.ABICodec object at 0x105161be0>
types = ['trcToken']
venv/lib/python3.13/site-packages/eth_abi/registry.py:457: in _get_encoder_uncached
return self._get_registration(self._encoders, type_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
self = <eth_abi.registry.ABIRegistry object at 0x10511dd10>
type_str = 'trcToken'
venv/lib/python3.13/site-packages/eth_abi/registry.py:354: in _get_registration
return coder.from_type_str(type_str, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
__class__ = <class 'eth_abi.registry.ABIRegistry'>
coder = <class 'eth_abi.encoding.UnsignedIntegerEncoder'>
mapping = <eth_abi.registry.PredicateMapping object at 0x104fb98c0>
self = <eth_abi.registry.ABIRegistry object at 0x10511dd10>
type_str = 'trcToken'
venv/lib/python3.13/site-packages/eth_abi/base.py:41: in new_from_type_str
raise ValueError(
E ValueError: Cannot create UnsignedIntegerEncoder for type 'trcToken': expected type with base 'uint'
abi_type = <BasicType 'trcToken'>
cls = <class 'eth_abi.encoding.UnsignedIntegerEncoder'>
expected_base = 'uint'
normalized_type_str = 'trcToken'
old_from_type_str = <function UnsignedIntegerEncoder.from_type_str at 0x1052318a0>
registry = <eth_abi.registry.ABIRegistry object at 0x10511dd10>
type_str = 'trcToken'
type_str_repr = "'trcToken'"
with_arrlist = False
Hi, I use:
but get error: