Use cosmpy with a different Cosmo chain
Prerequisites
- [X] I am running the latest CosmPy version.
- [X] I checked the documentation and found no answer to my problem.
- [X] I checked the existing issues to make sure my problem has not already been reported.
- [X] I have read the code of conduct before creating this issue.
Expected Behavior
We used protoc to generate the proto types and clients for a different Cosmo chain, and tried to use cosmpy to interact with it.
I expect to use cosmpy to sign message for the chain-specific functions to send transactions.
Current Behavior
It works until if the code import both cosmpy and proto types from the other chain.
cosmpy includes standard Cosmo types and clients, which conflict with the Cosmo types from the other chain. As far as I can tell, the only way to get around it is to have exactly the same Cosmo SDK version, Python version, and protoc/protobuf versions.
To Reproduce
No response
Context
Latest Cosmpy version
Failure Logs
No response
I want to call osmosis/gamm/swap-exact-amount-in on cosmpy. Do I need to generate the proto file for osmosis myself? Is there a tutorial or method to generate it, similar to https://github.com/ctrl-Felix/cosmospy-protobuf, which can make cosmpy more versatile? @johnqh
i try use
python -m grpc_tools.protoc --proto_path=$(OSMOSIS_SDK_DIR)/proto --proto_path=$(OSMOSIS_SDK_DIR)/third_party/proto --python_out=$(OSMOSIS_PROTOS_DIR) --grpc_python_out=$(OSMOSIS_PROTOS_DIR) $(shell find $(OSMOSIS_SDK_DIR) \( -path */proto/* -or -path */third_party/proto/* \) -type f -name *.proto)
but get this error
osmosis/protorev/v1beta1/tx.proto:63:12: "TokenPairArbRoutes" is not defined.
osmosis/protorev/v1beta1/tx.proto:97:3: "PoolWeights" is not defined.
osmosis/protorev/v1beta1/tx.proto:150:12: "BaseDenom" is not defined.
make: *** [generate_proto_types] Error 1
protoc --version libprotoc 23.2
The GeneratedProtocolMessageType is missing in the proto I generated. What version of protoc is being used in cosmpy?
@MissingNO57
protoc --version libprotoc 3.20.3
Still unable to generate GeneratedProtocolMessageType
Check this repo. It has all the compiled protos for osmosis:
https://github.com/ctrl-Felix/cosmospy-protobuf/tree/chain/osmosis
You can also use it to compile protos for any chain. Question is how would I use this with cosmpy?
yep,I was also considering using ctrl-Felix before, but it's obvious that the protobuf generated by ctrl-Felix is different. I had to give up this option. I have now switched to TypeScript to meet my needs. Hopefully, there will be more iterations in Python, but obviously, the development ecosystem of Cosmos is too scattered and there are no good building tools available. It's a pity.