andelf / andelf/tronpy

How to encode 'trcToken'?

Aperta
#155 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
245
Fork
106
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hi, I use:
```
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()}")
```
but get error:
```
venv/lib/python3.13/site-packages/tronpy/abi.py:94: in encode_abi
return super().encode(types, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
__class__ =
args = [1000001]
self =
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 =
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 =
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__ =
coder =
mapping =
self =
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 =
cls =
expected_base = 'uint'
normalized_type_str = 'trcToken'
old_from_type_str =
registry =
type_str = 'trcToken'
type_str_repr = "'trcToken'"
with_arrlist = False
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.