{"id":13589462,"url":"https://github.com/ctrl-Felix/cosmospy-protobuf","last_synced_at":"2025-04-08T09:32:53.376Z","repository":{"id":36997027,"uuid":"487660875","full_name":"ctrl-Felix/cosmospy-protobuf","owner":"ctrl-Felix","description":"Cosmos Protobuf library","archived":false,"fork":false,"pushed_at":"2023-12-30T21:37:00.000Z","size":1378,"stargazers_count":20,"open_issues_count":6,"forks_count":14,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T04:04:31.920Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ctrl-Felix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-05-01T23:00:20.000Z","updated_at":"2025-02-19T10:01:57.000Z","dependencies_parsed_at":"2023-12-17T17:38:15.847Z","dependency_job_id":"a00d0e89-74d0-466e-8acc-baae0594b04a","html_url":"https://github.com/ctrl-Felix/cosmospy-protobuf","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrl-Felix%2Fcosmospy-protobuf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrl-Felix%2Fcosmospy-protobuf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrl-Felix%2Fcosmospy-protobuf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrl-Felix%2Fcosmospy-protobuf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ctrl-Felix","download_url":"https://codeload.github.com/ctrl-Felix/cosmospy-protobuf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247814216,"owners_count":21000522,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T16:00:30.478Z","updated_at":"2025-04-08T09:32:52.547Z","avatar_url":"https://github.com/ctrl-Felix.png","language":"Python","funding_links":[],"categories":["Client Libraries"],"sub_categories":["Python"],"readme":"# Cosmos Protobuf\n\nThis repository compains the whole cosmos protobuf files compiled for python and ready to use with grpc. Please use the according .proto file as documentation for each python file.\n\n## Installation\n\nYou can install this package directly from the repository by using:\n\n```\npython -m pip install cosmospy-protobuf\n```\n\n## Usage\n\nThe following code snippet will query the balances for the address `osmo15hzhcvgs2ljfng6unghvr5l32prwqdyq4aguxn`. The according query.proto file in the bank subdirectory contains the Request and the Response for this request. The details for the response are defined in `QueryAllBalancesResponse`. It contains the balances and pagination attribute which can be accessed as shown in the example below.\n\n```python\nimport grpc # using grpcio\nimport cosmospy_protobuf.cosmos.bank.v1beta1.query_pb2_grpc as query_pb2_grpc # for gprcio\n#import cosmospy_protobuf.cosmos.bank.v1beta1.query_grpc as query_grpc # for gprclib\nimport cosmospy_protobuf.cosmos.bank.v1beta1.query_pb2 as query_pb2\n\nhost = \"osmosis.strange.love\"\nport = \"9090\"\n\nc = grpc.insecure_channel(f'{host}:{port}')\nstub = query_pb2_grpc.QueryStub(c)\n\nr = stub.AllBalances(query_pb2.QueryAllBalancesRequest(address=\"osmo15hzhcvgs2ljfng6unghvr5l32prwqdyq4aguxn\"))\nprint(r.balances)\n\n```\n\n## Build yourself\n\nThere are two scripts helping you to fork this repository to work with any cosmos based coin.\n\nAddititional Requirements:\n\n1. `grpcio-tools`\n2. `grpclib`\n3. `GitPython`\n4. `protoletariat`\n\nSteps:\n\n1. Create a config in `configs` and take a existing one as example\n2. Run the `aggregate.py` file with your filename without `.json` (Example `python aggregate.py cosmos`)\n3. Run the `compile.py` to compile all your files to protobuf\n4. Build your package. You're done!\n\n## Protobuf compilation\n\nThe files are compiled using the `grpc_tools.protoc` command from the [grpcio-tools](https://pypi.org/project/grpcio-tools/) library.\nTo compile a .proto file manually use following command:\n\n```\npython -m grpc_tools.protoc -I \u003cabsolute path to project root\u003e --python_out=. --grpc_python_out=. --grpclib_python_out=. \u003cabsolute path to .proto file\u003e\n```\n\nAfter compiling all the files with protoc you need to fix the imports by using [protoletariat](https://github.com/cpcloud/protoletariat)\n\nNote:\n\n- The --grpc_python_out=. and --grpclib_python_out=. is only needed when compiling a query.proto file as these define the actual grpc query\n- To compile the whole project it is favorable to match all proto files by using `*.proto` instead of each individual file. You can also match the whole folders to compile multiple folders at the same time. Not that the folders might contain sub-folders.\n\n## Other Cosmos based coins\n\nCurrently following coins are maintained by me:\n\n- Cosmos (this branch)\n- Evmos (branch: `chain/evmos`, package name: `evmos-protobuf`)\n- Osmosis (branch: `chain/osmosis`, package name: `osmosis-protobuf`)\n- Stargaze (branch: `chain/stargaze`, package name: `stargaze-protobuf`)\n\nMaintained by external contributors:\n\n- Sentinel (branch: `chain/sentinel`, package name: `sentinel-protobuf`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctrl-Felix%2Fcosmospy-protobuf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fctrl-Felix%2Fcosmospy-protobuf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctrl-Felix%2Fcosmospy-protobuf/lists"}