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

Contract: Handle TypeError #2300

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

satwikkansal
Copy link

Handles TypeError in methods when either self.args or self.kwargs is None

What was wrong?

I was interacting with avalanche testnet, and one of the contract function threw these errors;

TypeError: call_contract_function() argument after * must be an iterable, not NoneType
TypeError: call_contract_function() argument after*** must be a mapping, not NoneType

Looking at the code I realized that it is because of None values getting unpacked.

How was it fixed?

I added a conditional assignment to handle None values. I'm not sure if this is the right way to do it though because I didn't find this issue encountered by anyone else on the repository issues. It might be that I'm doing something wrong during initialization.

However from the type definition of ContractFunction it seems that args and kwargs are initialized to None, so unless there's a logic that'll always make sure that neither of this are None when *, and ** are used, the chances of these errors will be there.

Let me know if my analysis is correct 😅

Todo:

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

Handles TypeError in methods when either self.args or self.kwargs is None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant