|
6 | 6 | "net"
|
7 | 7 | "net/http"
|
8 | 8 |
|
9 |
| - grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" |
| 9 | + grpcMiddleware "github.com/grpc-ecosystem/go-grpc-middleware" |
10 | 10 | "github.com/grpc-ecosystem/grpc-gateway/runtime"
|
11 | 11 | log "github.com/sirupsen/logrus"
|
12 | 12 | "github.com/zoobc/zoobc-core/api/handler"
|
@@ -56,7 +56,7 @@ func startGrpcServer(
|
56 | 56 | }
|
57 | 57 | grpcServer := grpc.NewServer(
|
58 | 58 | grpc.Creds(creds),
|
59 |
| - grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer( |
| 59 | + grpc.UnaryInterceptor(grpcMiddleware.ChainUnaryServer( |
60 | 60 | interceptor.NewServerRateLimiterInterceptor(constant.MaxAPIRequestPerSecond),
|
61 | 61 | interceptor.NewServerInterceptor(
|
62 | 62 | logger,
|
@@ -167,6 +167,14 @@ func startGrpcServer(
|
167 | 167 | )})
|
168 | 168 | // Set GRPC handler for health check
|
169 | 169 | rpcService.RegisterHealthCheckServiceServer(grpcServer, &handler.HealthCheckHandler{})
|
| 170 | + |
| 171 | + // Set GRPC handler for account dataset |
| 172 | + rpcService.RegisterAccountDatasetServiceServer(grpcServer, &handler.AccountDatasetHandler{ |
| 173 | + Service: service.NewAccountDatasetService( |
| 174 | + query.NewAccountDatasetsQuery(), |
| 175 | + queryExecutor, |
| 176 | + ), |
| 177 | + }) |
170 | 178 | // run grpc-gateway handler
|
171 | 179 | go func() {
|
172 | 180 | if err := grpcServer.Serve(serv); err != nil {
|
@@ -243,5 +251,6 @@ func runProxy(apiPort, rpcPort int) error {
|
243 | 251 | _ = rpcService.RegisterEscrowTransactionServiceHandlerFromEndpoint(ctx, mux, fmt.Sprintf("localhost:%d", rpcPort), opts)
|
244 | 252 | _ = rpcService.RegisterMultisigServiceHandlerFromEndpoint(ctx, mux, fmt.Sprintf("localhost:%d", rpcPort), opts)
|
245 | 253 | _ = rpcService.RegisterHealthCheckServiceHandlerFromEndpoint(ctx, mux, fmt.Sprintf("localhost:%d", rpcPort), opts)
|
| 254 | + _ = rpcService.RegisterAccountDatasetServiceHandlerFromEndpoint(ctx, mux, fmt.Sprintf("localhost:%d", rpcPort), opts) |
246 | 255 | return http.ListenAndServe(fmt.Sprintf(":%d", apiPort), mux)
|
247 | 256 | }
|
0 commit comments