michaelhly / solana-py

Solana Python SDK
https://michaelhly.github.io/solana-py
MIT License
979 stars 252 forks source link

blockSubscribe RPC Method #416

Closed ruiqic closed 5 months ago

michaelhly commented 5 months ago

Hi, thanks for opening a PR! Would you mind fixing the lint issue and also writing a test?

You can run make lint to run the linter, and make format to format your code. Here is an example of a test: https://github.com/michaelhly/solana-py/blob/53adfce3b5b8d284826658764b434628f70083d7/tests/integration/test_websockets.py#L283-L292

ruiqic commented 5 months ago

Hi, thanks for checking. I just added a simple test for slot and used make format to fix all black issues. Let me know.

ruiqic commented 5 months ago

Test not passing maybe because not all RPCs support this method:

UNSTABLE METHOD This subscription is considered unstable and is only available if the validator was started with the --rpc-pubsub-enable-block-subscription flag. The format of this subscription may change in the future. (https://solana.com/docs/rpc/websocket/blocksubscribe)

michaelhly commented 5 months ago

Hi @ruiqic. You can add the flag here: https://github.com/michaelhly/solana-py/blob/53adfce3b5b8d284826658764b434628f70083d7/tests/docker-compose.yml#L11

michaelhly commented 5 months ago

Also, would you mind reverting all the formatting changes not related to this PR?

ruiqic commented 5 months ago

Hi, thanks for checking the code. How can the coverage test be fixed?

michaelhly commented 5 months ago

I'll fix that separately. @ruiqic, would you mind giving me push access to your forked repo? I just want to push some clean up.

ruiqic commented 5 months ago

Thanks. I already had Allowing edits by maintainers checked but I invited you as collaborator too.