mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-17 12:14:21 +01:00
* isInitialized update update walletInitialized to return true is walled.db exist, add walletLoaded that check if wallet property is nil * panic handler
26 lines
725 B
Go
26 lines
725 B
Go
package interceptors
|
|
|
|
import (
|
|
"github.com/ark-network/ark/server/pkg/macaroons"
|
|
middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
// UnaryInterceptor returns the unary interceptor
|
|
func UnaryInterceptor(svc *macaroons.Service) grpc.ServerOption {
|
|
return grpc.UnaryInterceptor(middleware.ChainUnaryServer(
|
|
unaryPanicRecoveryInterceptor(),
|
|
unaryLogger,
|
|
unaryMacaroonAuthHandler(svc),
|
|
))
|
|
}
|
|
|
|
// StreamInterceptor returns the stream interceptor with a logrus log
|
|
func StreamInterceptor(svc *macaroons.Service) grpc.ServerOption {
|
|
return grpc.StreamInterceptor(middleware.ChainStreamServer(
|
|
streamPanicRecoveryInterceptor(),
|
|
streamLogger,
|
|
streamMacaroonAuthHandler(svc),
|
|
))
|
|
}
|