planetmint-go/x/asset/keeper/query_get_cids_by_address.go
Jürgen Eckel 8fd9f213f3
77 rename asset hash to asset cid (#97)
* initial asset notarization restructuring
* adjusted test cases, two are still failing
* removed obsolete data structures

---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-09-27 16:35:31 +02:00

26 lines
671 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) GetCIDsByAddress(goCtx context.Context, req *types.QueryGetCIDsByAddressRequest) (*types.QueryGetCIDsByAddressResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
cids, found := k.GetCidsByAddress(ctx, req.GetAddress())
if !found {
return nil, status.Error(codes.NotFound, "no CIDs found")
}
return &types.QueryGetCIDsByAddressResponse{Cids: cids}, nil
}