ImportError: cannot import name 'RPCResponse' from 'solana.rpc.types'
See original GitHub issueWhile running the example code:
from pyserum.connection import get_live_markets, get_token_mints
print("tokens: ")
print(get_token_mints())
print("markets: ")
print(get_live_markets())
The error:
ImportError Traceback (most recent call last)
[<ipython-input-2-3233e15d8b3e>](https://localhost:8080/#) in <module>
----> 1 from pyserum.connection import get_live_markets, get_token_mints
2 print("tokens: ")
3 print(get_token_mints())
4 print("markets: ")
5 print(get_live_markets())
2 frames
[/usr/local/lib/python3.7/dist-packages/pyserum/market/market.py](https://localhost:8080/#) in <module>
7 from solana.publickey import PublicKey
8 from solana.rpc.api import Client
----> 9 from solana.rpc.types import RPCResponse, TxOpts
10 from solana.transaction import Transaction
11
ImportError: cannot import name 'RPCResponse' from 'solana.rpc.types' (/usr/local/lib/python3.7/dist-packages/solana/rpc/types.py)
Checking out the latest solana.rpc.types, there really is no RPCResponse.
https://github.com/michaelhly/solana-py/blob/master/src/solana/rpc/types.py
Any pointers/fixes?
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top Results From Across the Web
python - ModuleNotFoundError: No module named 'solana.rpc ...
Python will resolve to your local file first, and it fails to find the type from library. You should rename the file from...
Read more >Issues · serum-community/pyserum - GitHub
ImportError : cannot import name 'RPCResponse' from 'solana.rpc.types'. #113 opened on Oct 16 by Broever101.
Read more >python/michaelhly/solana-py/src/solana/rpc/api.py Example
"""API client to interact with the Solana JSON RPC Endpoint.""" # pylint: disable=too-many-lines from __future__ import annotations from time import sleep, ...
Read more >JSON RPC API - Solana Docs
To make a JSON-RPC request, send an HTTP POST request with a Content-Type: application/json header. The JSON request data should contain 4 fields:...
Read more >simulateTransaction - Solana RPC method documentation
If "jsonParsed" is requested but a parser cannot be found, the field falls back to binary encoding, detectable when the data field is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have my own fork now, I plan to add support for other DEXes.
https://github.com/pbharrin/py_no_broker
There is example code here, showing the current orderbook for Openbook: https://github.com/pbharrin/py_no_broker/blob/alpha/examples/show_orderbook.py
All you should need is to install solana and requests.
pip install solana pip install requests
THis fine person submitted a PR that looks like it fixes the issue. Try this branch: https://github.com/ennnas/pyserum/tree/chore/upgrade_solanapy