- OpenAPI for service api/contractbind/v1/api.swagger.json
- entrypoint for go server cmd/server/main.go
- docker image deploy/contractbind.dockerfile
- k8s (helm) configuration deploy,deploy/templates/deployment.yaml
- GRPC API implementation pkg/api/api.go
- Contract bindings for Go pkg/contracts/commit_reveal.go
- Contract test using popular Go BDD framework pkg/contracts/crowdfund_test.go
- GRPC/GRPC-HTTP-Gateway protobuf definitions proto/contractbind/v1/api.proto
- GRPC configurations buf.gen.yaml
- Taskfile (like makefile) Taskfile.yaml
Before you begin, make sure you have the following prerequisites:
- Task runner installed (https://taskfile.dev/installation/)
- Docker installed to build and package the service.
- Helm (https://helm.sh/) installed for Kubernetes deployment and management.
- kubectl (Kubernetes command-line tool) configured to interact with your Kubernetes cluster.
- Go for development installed (https://go.dev/doc/install)
- Buf for managing protobuf files installed (https://buf.build/docs/installation)
task build
will build application image and chart and store it at ./buildtask deploy
will install or upgrade helm deployment, requires to runtask build
first (be sure that values deploy/values/default.yaml are correctly populated, and extended for production enviroment)task logs
will show logs of running helm deployment, requires to runtask deploy
firsttask port-forward
will port forward to service of running helm deployment, reachable at http://127.0.0.1:8080, requires to runtask deploy
firsttask clean
will perform clean up, remove helm deployment and build artefactstask gen
will generate abi and bin for solidity contract, generate Go contract bindings, generate protobuf bindings for go, generate open API filestask dev-mac
will install all dev requirements (macOS/linux-homebrew only supported)
Run go test -timeout 30s -v ./...
for tests on emulated eth backend
To perform integrational test you need to have blockchain running, server running, and then test it via HTTP calls
- Open three terminal windows in root repository folder
- Run
task testnet
in first, to run local etherium node API - Run
task local-run
in second, to run server at localhost:80 - Run
go test -timeout 30s -count 1 -run ^TestAPI$ ./testing -v
in third, to run test
-
Put your contract into ./contracts
-
https://github.com/ic-n/ethcontractbind/blob/main/proto/contractbind/v1/api.proto#L19
// TODO: define your custom api
// TODO: implement API
// TODO: implement contract test
// TODO: implement testing make api calls
- Remove TODO section from this file :)