wormhole/wormchain/x/wormhole/keeper/grpc_query_config.go

25 lines
617 B
Go

package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/wormhole-foundation/wormchain/x/wormhole/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) Config(c context.Context, req *types.QueryGetConfigRequest) (*types.QueryGetConfigResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
val, found := k.GetConfig(ctx)
if !found {
return nil, status.Error(codes.InvalidArgument, "not found")
}
return &types.QueryGetConfigResponse{Config: val}, nil
}