Skip to main content

Osmosis Protobuf

This repository contains the whole osmosis protobuf files compiled for python and ready to use with grpc. Please use the according .proto file as documentation for each python file.

Installation

You can install this package directly from the repository by using:

python -m pip install osmosis-protobuf

Usage

The 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.

import grpc
import osmosis_protobuf.cosmos.bank.v1beta1.query_pb2_grpc as query_pb2_grpc
import osmosis_protobuf.cosmos.bank.v1beta1.query_pb2 as query_pb2

host = "osmosis.strange.love"
port = "9090"

c = grpc.insecure_channel(f'{host}:{port}')
stub = query_pb2_grpc.QueryStub(c)

r = stub.AllBalances(query_pb2.QueryAllBalancesRequest(address="osmo15hzhcvgs2ljfng6unghvr5l32prwqdyq4aguxn"))
print(r.balances)

Build yourself

There are two scripts helping you to fork this repository to work with any cosmos based coin.

  1. Create a config in configs and take a existing one as example
  2. Run the aggregate.py file with your filename without .json (Example python aggregate.py cosmos)
  3. Run the compile.py to compile all your files to protobuf
  4. Build your package. You're done!

Protobuf compilation

The files are compiled using the grpc_tools.protoc command from the grpcio-tools library. To compile a .proto file manually use following command:

python -m grpc_tools.protoc -I <absolute path to project root> --python_out=. --grpc_python_out=. <absolute path to .proto file>

After compiling all the files with protoc you need to fix the imports by using protoletariat

Note:

  • The --grpc_python_out=. is only needed when compiling a query.proto file as these define the actual grpc query
  • 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.

Other Cosmos based coins

Currently following coins are maintained by me:

  • Cosmos (branch: main)
  • Osmosis (this branch)

Metadata

Release files for osmosis-protobuf 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for osmosis-protobuf 0.1.2
File Size Uploaded
osmosis_protobuf-0.1.2.tar.gz 18.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for osmosis-protobuf 0.1.2
File Interpreter ABI Platform
osmosis_protobuf-0.1.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 19.0 MB

Release files / osmosis_protobuf-0.1.2.tar.gz

Download URL osmosis_protobuf-0.1.2.tar.gz
Size 18.3 MB
Tags Source
SHA-256 checksum
How to use checksums
aebe4184260040ed8f91c3b6bb2d0d1c5a79449abffe4a1bcdc1ea0f8b4255fd
BLAKE2b-256 checksum
How to use checksums
277caabd6aa9a586caf4f82f2db1e35453ec0ee3520f018c807c71c7531e53a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / osmosis_protobuf-0.1.2-py2.py3-none-any.whl

Download URL osmosis_protobuf-0.1.2-py2.py3-none-any.whl
Size 642.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f6bb817c2762ebb785db42418744061490ac6be6557e0b0519fa8ae701a168b9
BLAKE2b-256 checksum
How to use checksums
7ff38e455cfc031682ba7c0eb1aff659f0d826eea53cada0cc8d32ad03183f79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

This release

0.1.2 This release

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page