This projects aims to serve as a forwarder for Cosmos SDK enabled gRPC endpoints.
Step 1 (OPTIONAL). Install external tooling (golangci-lint, etc.):
make installStep 2 (OPTIONAL). Setup project for local testing (code lint, runs tests, builds all needed binaries):
make allStep 3. Run gRPC server:
make run-serverStep 4. Run gRPC client (in a separate terminal session):
make run-clientNOTE
Instead of having a file called
test_grpc.gothere is a file calledservice_handler_test.gowhere the comparison between the local server and the public Cosmos SDK gRPC endpoint. This is because having it this way gets it picked up bygo testcommand.
Step 5. Change gRPC endpoint:
- At
<project-root>/.env.distand<projec-root>/.env.test.distyou can find the following environment variables:
SERVER_NAME=cosmos-grpc-forwarder
SERVER_HOST=localhost
SERVER_PORT=8080
LOG_LEVEL=debug
LOG_FORMAT=json
COSMOS_SDK_GRPC_ENDPOINT=grpc.osmosis.zone:9090COSMOS_SDK_GRPC_ENDPOINTcould be easily swapped for another Cosmos SDK enabled mainnet or testnet endpoint and it should work just fine.- After modification run the tests again with
make testto verify compatibility.
Step 0. Install pre-commit:
pip install pre-commit
# For macOS users.
brew install pre-commitThen run pre-commit install to setup git hook scripts.
Used hooks can be found here.
NOTE
pre-commitaids in running checks (end of file fixing, markdown linting, go linting, runs go tests, json validation, etc.) before you perform your git commits.
Step 1. Install external tooling (golangci-lint, etc.):
make installStep 2. Setup project for local testing (code lint, runs tests, builds all needed binaries):
make allStep 3. Other commands:
# Re-generate proto stubs.
make proto-gen
# Lint proto files.
makke proto-lintNOTE
All binaries can be found in
<project_root>/bindirectory. Usemake cleanto delete old binaries.
NOTE
Check Makefile for other useful commands.