planetmint-go/x/der/keeper/query_nft.go
Jürgen Eckel 03211743fc
Inspellning registration support (#499)
* added DER module
* scaffold type --module der DER zigbeeID dirigeraID dirigeraMAC plmntAddress liquidAddress
* ./ignite scaffold message registerDER der:DER --module der
* changed URL
* storing DER
* added query
* added liquid der asset type
* added der asset notarization logic
* added nft notarization for DER
* added nft query
* added query and fixed linter aspects
* added store testcases to the der module
* added test cases adjusted to the linter requirements
* addd ignite generate code changes
* added metadata json instead of specific data

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2025-05-26 15:52:33 +02:00

26 lines
650 B
Go

package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/x/der/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) Nft(goCtx context.Context, req *types.QueryNftRequest) (*types.QueryNftResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
derNft, found := k.LookupLiquidDerAsset(ctx, req.ZigbeeID)
if !found {
return nil, status.Error(codes.NotFound, "error zigbeeID not found: "+req.ZigbeeID)
}
return &types.QueryNftResponse{DerNft: &derNft}, nil
}