mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-01 19:56:39 +00:00
26 lines
673 B
Go
26 lines
673 B
Go
package keeper
|
|
|
|
import (
|
|
"context"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/planetmint/planetmint-go/x/asset/types"
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/status"
|
|
)
|
|
|
|
func (k Keeper) GetNotarizedAsset(goCtx context.Context, req *types.QueryGetNotarizedAssetRequest) (*types.QueryGetNotarizedAssetResponse, error) {
|
|
if req == nil {
|
|
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
|
}
|
|
|
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
|
|
|
asset, found := k.GetAsset(ctx, req.GetCid())
|
|
if !found {
|
|
return nil, status.Error(codes.NotFound, "cid not found")
|
|
}
|
|
|
|
return &types.QueryGetNotarizedAssetResponse{Cid: asset.GetCid()}, nil
|
|
}
|