-
Notifications
You must be signed in to change notification settings - Fork 286
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
Conversation
…d get_token_supply()
Would you mind fixing the lint issue and writing a couple integration tests for these? |
Codecov Report
@@ 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 |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use this mint instead:
https://michaelhly.github.io/solana-py/spl.html#spl.token.constants.WRAPPED_SOL_MINT
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 |
@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) |
@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. |
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
lgtm, @michaelhly does it look good to you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
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.