This projects aims to serve as a forwarder for Cosmos SDK enabled gRPC endpoints.
Step 1 (OPTIONAL). Install external tooling (golangci-lint, etc.):
make install
Step 2 (OPTIONAL). Setup project for local testing (code lint, runs tests, builds all needed binaries):
make all
Step 3. Run gRPC server:
make run-server
Step 4. Run gRPC client (in a separate terminal session):
make run-client
NOTE
Instead of having a file called
test_grpc.go
there is a file calledservice_handler_test.go
where 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 test
command.
Step 5. Change gRPC endpoint:
- At
<project-root>/.env.dist
and<projec-root>/.env.test.dist
you 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:9090
COSMOS_SDK_GRPC_ENDPOINT
could 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 test
to verify compatibility.
Step 0. Install pre-commit:
pip install pre-commit
# For macOS users.
brew install pre-commit
Then run pre-commit install
to setup git hook scripts.
Used hooks can be found here.
NOTE
pre-commit
aids 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 install
Step 2. Setup project for local testing (code lint, runs tests, builds all needed binaries):
make all
Step 3. Other commands:
# Re-generate proto stubs.
make proto-gen
# Lint proto files.
makke proto-lint
NOTE
All binaries can be found in
<project_root>/bin
directory. Usemake clean
to delete old binaries.
NOTE
Check Makefile for other useful commands.