github.com/NpoolPlatform/chain-middleware@v0.0.0-20240228100535-eb1bcf896eb9/api/app/coin/exist.go (about) 1 package appcoin 2 3 import ( 4 "context" 5 6 appcoin1 "github.com/NpoolPlatform/chain-middleware/pkg/mw/app/coin" 7 "github.com/NpoolPlatform/go-service-framework/pkg/logger" 8 npool "github.com/NpoolPlatform/message/npool/chain/mw/v1/app/coin" 9 10 "google.golang.org/grpc/codes" 11 "google.golang.org/grpc/status" 12 ) 13 14 func (s *Server) ExistCoinConds(ctx context.Context, in *npool.ExistCoinCondsRequest) (*npool.ExistCoinCondsResponse, error) { 15 handler, err := appcoin1.NewHandler( 16 ctx, 17 appcoin1.WithConds(in.Conds), 18 ) 19 if err != nil { 20 logger.Sugar().Errorw( 21 "ExistCoinConds", 22 "In", in, 23 "Error", err, 24 ) 25 return &npool.ExistCoinCondsResponse{}, status.Error(codes.InvalidArgument, err.Error()) 26 } 27 28 info, err := handler.ExistCoinConds(ctx) 29 if err != nil { 30 logger.Sugar().Errorw( 31 "ExistCoinConds", 32 "In", in, 33 "Error", err, 34 ) 35 return &npool.ExistCoinCondsResponse{}, status.Error(codes.Internal, err.Error()) 36 } 37 38 return &npool.ExistCoinCondsResponse{ 39 Info: info, 40 }, nil 41 }