cosmos-sdk/runtime/comet.go
Matt Kocubinski a6bc921c9a
refactor: fetch CometInfo from service (#20238)
Co-authored-by: Marko <marko@baricevic.me>
2024-05-03 01:14:22 +00:00

24 lines
654 B
Go

package runtime
import (
"context"
corecomet "cosmossdk.io/core/comet"
sdk "github.com/cosmos/cosmos-sdk/types"
)
var _ corecomet.Service = &ContextAwareCometInfoService{}
// ContextAwareCometInfoService provides CometInfo which is embedded as a value in a Context.
// This the legacy (server v1, baseapp) way of accessing CometInfo at the module level.
type ContextAwareCometInfoService struct{}
func (c ContextAwareCometInfoService) CometInfo(ctx context.Context) corecomet.Info {
return sdk.UnwrapSDKContext(ctx).CometInfo()
}
func NewContextAwareCometInfoService() *ContextAwareCometInfoService {
return &ContextAwareCometInfoService{}
}