Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnknownCairoTypeError: type 'felt' is not defined. #1230

Closed
1 task done
zoolaxyofficial opened this issue Nov 27, 2023 · 1 comment
Closed
1 task done

UnknownCairoTypeError: type 'felt' is not defined. #1230

zoolaxyofficial opened this issue Nov 27, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@zoolaxyofficial
Copy link

What happened

When creating a Contract instance with the ABI:

[
{
"name": "function_name",
"type": "function",
"inputs": [
{
"name": "input_name",
"type": "felt"
}
],
"outputs": []
}
]

the following error occurs: UnknownCairoTypeError: type 'felt' is not defined.

Stack trace

in get_contract
contract = Contract(
^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/starknet_py/contract.py", line 558, in init
self._functions = self._make_functions(
^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/starknet_py/contract.py", line 804, in _make_functions
repository[name] = ContractFunction(
^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/starknet_py/contract.py", line 433, in init
function = contract_data.parsed_abi.functions.get(name)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/functools.py", line 1001, in get
val = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/starknet_py/contract.py", line 80, in parsed_abi
return AbiV1Parser(self.abi).parse()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/starknet_py/abi/v1/parser.py", line 88, in parse
functions={
^
File "/opt/homebrew/lib/python3.11/site-packages/starknet_py/abi/v1/parser.py", line 89, in
name: self._parse_function(entry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/starknet_py/abi/v1/parser.py", line 173, in _parse_function
inputs=self._parse_members(function["inputs"], function["name"]),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/starknet_py/abi/v1/parser.py", line 191, in _parse_members
return OrderedDict(
^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/starknet_py/abi/v1/parser.py", line 192, in
(name, self.type_parser.parse_inline_type(param["type"]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/starknet_py/cairo/v1/type_parser.py", line 57, in parse_inline_type
raise UnknownCairoTypeError(parsed.name)
starknet_py.cairo.v1.type_parser.UnknownCairoTypeError: Type 'felt' is not defined. Please report this issue at https://github.com/software-mansion/starknet.py/issues

Steps to reproduce

SDK Version

.

Python version

3.11.3

What operating system are you using?

Mac

Is there an existing issue for this?

  • I have searched the existing issues and verified no issue exits for this problem.
@zoolaxyofficial zoolaxyofficial added the bug Something isn't working label Nov 27, 2023
@harshnaicker
Copy link

How was this issue actually solved ? I cannot find any PR linked to this issue.
I am trying to use Starknet pr v0.24 and am encountering this issue when initializing the Contract instance using the ABI json file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants