Skip to main content

This package contains a compiled python version of all evmos protobuf files with their dependencies

Project description

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)

Project details


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.2.0.tar.gz (26.0 MB view details)

Uploaded Source

Built Distribution

evmos_protobuf-0.2.0-py2.py3-none-any.whl (745.5 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for evmos_protobuf-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fcd6e96f18f786c2602af87f239eacdbb3a5e2941d07cbb3d1040d2eb945dc63
MD5 c47cfc5e2ed0d6ebc6ed42a621a223ff
BLAKE2b-256 9767a1f221777eeb70bd8f64895827af3ce11ceb8724b2f9184d9e58cfd294d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for evmos_protobuf-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5b0a7d5e40654ea1c58a22cbc6ebf6417ebd7ac35b3538470533dd8edb444f91
MD5 8336f0f05f57c39b8f4ddf178e1d5c4a
BLAKE2b-256 5c7a3a39a2d8af57868d022cd451f49ce4965c6a359a8ed31d9e105c28a775ad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page