github.com/cosmos/cosmos-sdk@v0.50.10/runtime/services.go (about) 1 package runtime 2 3 import ( 4 "context" 5 6 appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" 7 autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" 8 reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" 9 "cosmossdk.io/core/comet" 10 "cosmossdk.io/core/header" 11 12 "github.com/cosmos/cosmos-sdk/runtime/services" 13 sdk "github.com/cosmos/cosmos-sdk/types" 14 "github.com/cosmos/cosmos-sdk/types/module" 15 ) 16 17 func (a *App) registerRuntimeServices(cfg module.Configurator) error { 18 // no app config service if user is using app.yaml / app.json 19 // it is as in v0.52, this whole query service does not exist at all. 20 if a.appConfig != nil { 21 appv1alpha1.RegisterQueryServer(cfg.QueryServer(), services.NewAppQueryService(a.appConfig)) 22 } 23 autocliv1.RegisterQueryServer(cfg.QueryServer(), services.NewAutoCLIQueryService(a.ModuleManager.Modules)) 24 25 reflectionSvc, err := services.NewReflectionService() 26 if err != nil { 27 return err 28 } 29 reflectionv1.RegisterReflectionServiceServer(cfg.QueryServer(), reflectionSvc) 30 31 return nil 32 } 33 34 var _ comet.BlockInfoService = cometInfoService{} 35 36 type cometInfoService struct{} 37 38 func (cometInfoService) GetCometBlockInfo(ctx context.Context) comet.BlockInfo { 39 return sdk.UnwrapSDKContext(ctx).CometInfo() 40 } 41 42 var _ header.Service = headerInfoService{} 43 44 type headerInfoService struct{} 45 46 func (headerInfoService) GetHeaderInfo(ctx context.Context) header.Info { 47 return sdk.UnwrapSDKContext(ctx).HeaderInfo() 48 }