Skip to content

Commit

Permalink
Setup TCK server (#836)
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Mindov <[email protected]>
  • Loading branch information
rokn authored Dec 7, 2023
1 parent c2b90b5 commit 74c39e6
Show file tree
Hide file tree
Showing 5 changed files with 3,285 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tck/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Go SDK TCK server

This is a server that implements the [SDK TCK specification](https://github.com/hashgraph/hedera-sdk-tck/) for the Go SDK.

## Running the server

To run the server you need to run

```
go run cmd/server.go
```

This will start the server on port **80**. You can change the port by setting the `TCK_PORT` environment variable or by adding a .env file with the same variable.
36 changes: 36 additions & 0 deletions tck/cmd/server.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package main

import (
"github.com/creachadair/jrpc2/handler"
"github.com/creachadair/jrpc2/jhttp"
"github.com/hashgraph/hedera-sdk-go/tck/methods"
"github.com/joho/godotenv"
"net/http"
"os"
)

func main() {
// Load dotenv
_ = godotenv.Load()

// Initialize the SDK service
sdkService := new(methods.SDKService)

// Create a new RPC server
assigner := handler.Map{
"setup": handler.New(sdkService.Setup),
"reset": handler.New(sdkService.Reset),
}
bridge := jhttp.NewBridge(assigner, nil)

// Listen and redirect to bridge
http.HandleFunc("/", bridge.ServeHTTP)
port := os.Getenv("TCK_PORT")
if port == "" {
port = "80"
}
err := http.ListenAndServe(":"+port, nil)
if err != nil {
panic(err)
}
}
46 changes: 46 additions & 0 deletions tck/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
module github.com/hashgraph/hedera-sdk-go/tck

go 1.21.3

require (
github.com/creachadair/jrpc2 v1.1.2
github.com/hashgraph/hedera-sdk-go/v2 v2.32.0
)

require (
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
github.com/creachadair/mds v0.3.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/ethereum/go-ethereum v1.13.5 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/hashgraph/hedera-protobufs-go v0.2.1-0.20230720072335-ed5726877e99 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rs/zerolog v1.31.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
Loading

0 comments on commit 74c39e6

Please sign in to comment.