Skip to main content

evmos Protobuf

This repository contains the whole evmos 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 evmos-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 evmos_protobuf.cosmos.bank.v1beta1.query_pb2_grpc as query_pb2_grpc
import evmos_protobuf.cosmos.bank.v1beta1.query_pb2 as query_pb2

host = "evmos.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)
  • evmos (this branch)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evmos_protobuf-0.0.1.tar.gz (20.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evmos_protobuf-0.0.1-py2.py3-none-any.whl (461.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file evmos_protobuf-0.0.1.tar.gz.

File metadata

  • Download URL: evmos_protobuf-0.0.1.tar.gz
  • Upload date:
  • Size: 20.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for evmos_protobuf-0.0.1.tar.gz
Algorithm Hash digest
SHA256 dc54a1719d3dc6db682518676314d476ae42d9c15ce15b312b7f441614d0c8ab
MD5 f75f01b9da7ef4302ac283c367fb4100
BLAKE2b-256 76d907c37dd3a3dd6be6707e09deb644ea4775d3efae52f2f23daa62486ef807

See more details on using hashes here.

File details

Details for the file evmos_protobuf-0.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for evmos_protobuf-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d803458d457d5521fde4b134e2502bcf67b817cdd73b9558ca3e4abc8016f492
MD5 ecbb56b1ec0e23dd24d9c63d93369d53
BLAKE2b-256 b05d98c3a5c8384e8a2cdaea4878b7a8f152d611f2eff164c9e0f2f7770da713

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

0.1.0

2 files

0.0.2

2 files

This release

0.0.1 This release

2 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