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

Use cosmpy with a different Cosmo chain #347

Open
4 tasks done
johnqh opened this issue Apr 24, 2023 · 7 comments
Open
4 tasks done

Use cosmpy with a different Cosmo chain #347

johnqh opened this issue Apr 24, 2023 · 7 comments

Comments

@johnqh
Copy link

johnqh commented Apr 24, 2023

Prerequisites

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

@thejoven
Copy link

thejoven commented Jun 7, 2023

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

@thejoven
Copy link

thejoven commented Jun 7, 2023

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

@thejoven
Copy link

thejoven commented Jun 7, 2023

protoc --version
libprotoc 23.2

The GeneratedProtocolMessageType is missing in the proto I generated. What version of protoc is being used in cosmpy?

@MissingNO57

@thejoven
Copy link

thejoven commented Jun 7, 2023

protoc --version
libprotoc 3.20.3

Still unable to generate GeneratedProtocolMessageType
image

@freQniK
Copy link

freQniK commented Jun 11, 2023

Check this repo. It has all the compiled protos for osmosis:

https://github.com/ctrl-Felix/cosmospy-protobuf/tree/chain/osmosis

@freQniK
Copy link

freQniK commented Jun 11, 2023

You can also use it to compile protos for any chain. Question is how would I use this with cosmpy?

@thejoven
Copy link

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.

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

No branches or pull requests

3 participants