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

Added implementations for get_token_largest_accounts() and get_token_supply() #104

Merged
merged 6 commits into from
Sep 24, 2021

Conversation

whdev1
Copy link
Contributor

@whdev1 whdev1 commented Sep 23, 2021

I have added implementations for the get_token_largest_accounts() and get_token_supply() methods in the synchronous RPC client as well as their respective _args methods in rpc.core.

@michaelhly
Copy link
Owner

michaelhly commented Sep 23, 2021

Would you mind fixing the lint issue and writing a couple integration tests for these?

@codecov
Copy link

codecov bot commented Sep 23, 2021

Codecov Report

Merging #104 (722ae9c) into master (4a7ffe9) will increase coverage by 0.22%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #104      +/-   ##
==========================================
+ Coverage   88.85%   89.08%   +0.22%     
==========================================
  Files          32       32              
  Lines        2199     2207       +8     
==========================================
+ Hits         1954     1966      +12     
+ Misses        245      241       -4     

@whdev1
Copy link
Contributor Author

whdev1 commented Sep 23, 2021

I've gone ahead and fixed the formatting issues and this latest commit is passing with Black. I also wrote integration tests for both methods.

I created a stubbed_token_addr() method for testing as both of the new functions require a known valid token address to return results instead of an error.

Copy link
Owner

@michaelhly michaelhly left a comment

Choose a reason for hiding this comment

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

tests/conftest.py Outdated Show resolved Hide resolved
tests/integration/test_http_client.py Outdated Show resolved Hide resolved
tests/integration/test_http_client.py Outdated Show resolved Hide resolved
@whdev1
Copy link
Contributor Author

whdev1 commented Sep 23, 2021

Thank you, was not aware of the constant. I went ahead and made all of the suggested changes in this new commit and added an import for WRAPPED_SOL_MINT in test_http_client.py

@kevinheavey
Copy link
Collaborator

@whdev1 Would you mind adding the async methods and tests too? If you're not familiar with async stuff in Python, you can look at async_api.py and test_async_http_client.py and just mimic those. Will just be a matter of copy-pasting and changing a few characters (Python forces a bit of duplication when it comes to sync/async stuff)

@whdev1 whdev1 changed the title Added implementations for synchronous get_token_largest_accounts() and get_token_supply() Added implementations for get_token_largest_accounts() and get_token_supply() Sep 24, 2021
@whdev1
Copy link
Contributor Author

whdev1 commented Sep 24, 2021

@kevinheavey Definitely. I just added a new commit with the async implementations for both. I've also changed the title of the PR to reflect this.

@whdev1
Copy link
Contributor Author

whdev1 commented Sep 24, 2021

Thank you, just fixed both of those issues.

@pytest.mark.asyncio
async def test_get_token_largest_accounts(test_http_client_async):
"""Test get token largest accounts."""
resp = test_http_client_async.get_token_largest_accounts(WRAPPED_SOL_MINT)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
resp = test_http_client_async.get_token_largest_accounts(WRAPPED_SOL_MINT)
resp = await test_http_client_async.get_token_largest_accounts(WRAPPED_SOL_MINT)

@kevinheavey
Copy link
Collaborator

lgtm, @michaelhly does it look good to you?

Copy link
Owner

@michaelhly michaelhly left a comment

Choose a reason for hiding this comment

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

LGTM.

@michaelhly michaelhly merged commit b87e3c9 into michaelhly:master Sep 24, 2021
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