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

api: fix type error when contract state not found #303

Merged
merged 2 commits into from
Mar 20, 2024

Conversation

meevee98
Copy link
Contributor

@meevee98 meevee98 commented Mar 1, 2024

When contract state is not found the results in response returns None, because of this interactions using find_states result fail with TypeError (since None cannot be iterated)

@coveralls
Copy link

coveralls commented Mar 1, 2024

Coverage Status

coverage: 80.514% (+0.02%) from 80.493%
when pulling d73374b on type-error-empty-storage
into e16f79c on master.

@ixje
Copy link
Member

ixje commented Mar 20, 2024

When contract state is not found the results in response returns None, because of this interactions using find_states result fail with TypeError (since None cannot be iterated)

This is an issue with neo-go because the C# client returns an empty list.
Note that the proposed solution will still throw a KeyError. We can work around it using response.get("results", ()) although I'd rather see neo-go fix it.

@ixje
Copy link
Member

ixje commented Mar 20, 2024

actually, you're solution is correct. Ignore that part

@ixje ixje merged commit 1823903 into master Mar 20, 2024
12 checks passed
@ixje
Copy link
Member

ixje commented Mar 20, 2024

Thanks!

@ixje ixje deleted the type-error-empty-storage branch March 20, 2024 16:13
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.

3 participants