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

[Bugfix#2094] Fix handling of balances when user has no tokens. #2095

Conversation

jfarid27
Copy link
Contributor

@jfarid27 jfarid27 commented Jul 16, 2022

Description

Adds handling of user data when there is no tokens but ETH in the account.

Fixes #2094

Before

Screen Shot 2022-07-15 at 8 24 54 PM

After

Screen Shot 2022-07-15 at 8 21 05 PM

Motivation

Attempted to check an address of mine that only has ETH. Because of the token empty default line, it fails a number conversion in decimals and breaks.

Dependencies

None

How has this been tested?

  • Manual testing was done on my own address. The current tests require a mock to be added with this edge case state. Added unit test and cassete in ethplorer_model.

Checklist:

Others

  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • My code passes all the checks pylint, flake8, black, ... To speed up development you should run pre-commit install.
  • New and existing unit tests pass locally with my changes. You can test this locally using pytest tests/....

@DidierRLopes DidierRLopes added the bug Fix bug label Jul 16, 2022
@DidierRLopes
Copy link
Collaborator

@jfarid27 thanks for this!

Can you do

pytest tests/openbb_terminal/cryptocurrency/onchain/test_ethplorer_model.py --record-mode=rewrite

to fix the tests please?

@jfarid27
Copy link
Contributor Author

jfarid27 commented Jul 17, 2022

@jfarid27 thanks for this!

Can you do

pytest tests/openbb_terminal/cryptocurrency/onchain/test_ethplorer_model.py --record-mode=rewrite

to fix the tests please?

Thank you @DidierRLopes. I pushed up some updates after figuring out how to run this. Please recheck!

Copy link
Collaborator

@DidierRLopes DidierRLopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet!

Tested and it works 🚀

@DidierRLopes DidierRLopes merged commit 96ed08d into OpenBB-finance:main Jul 17, 2022
@jfarid27 jfarid27 deleted the bugfix/handling-no-token-crypto-balance branch July 17, 2022 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fix bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Crypto/Onchain Address doesn't work for users with ETH and no token values.
2 participants