diff --git a/submodules/move-nft/grpc_query.go b/submodules/move-nft/grpc_query.go index 9dede6d..410b9ec 100644 --- a/submodules/move-nft/grpc_query.go +++ b/submodules/move-nft/grpc_query.go @@ -144,9 +144,14 @@ func (sm MoveNftSubmodule) getTokensByCollection(ctx context.Context, req *nftty return &v, nil }, ) + if err != nil { return nil, handleCollectionErr(err) } + res = slices.DeleteFunc(res, func(item *nfttypes.IndexedToken) bool { + return item == nil + }) + res = slices.Clip(res) return &nfttypes.QueryTokensResponse{ Tokens: res, @@ -238,6 +243,10 @@ func (sm MoveNftSubmodule) getTokensByAccountAndCollection(ctx context.Context, if err != nil { return nil, status.Error(codes.Internal, err.Error()) } + res = slices.DeleteFunc(res, func(item *nfttypes.IndexedToken) bool { + return item == nil + }) + res = slices.Clip(res) return &nfttypes.QueryTokensResponse{ Tokens: res, diff --git a/submodules/wasm-nft/grpc_query.go b/submodules/wasm-nft/grpc_query.go index 3a1ac42..5d277b2 100644 --- a/submodules/wasm-nft/grpc_query.go +++ b/submodules/wasm-nft/grpc_query.go @@ -147,6 +147,10 @@ func (sm WasmNFTSubmodule) getTokensByCollection(ctx context.Context, req *nftty if err != nil { return nil, handleCollectionErr(err) } + res = slices.DeleteFunc(res, func(item *nfttypes.IndexedToken) bool { + return item == nil + }) + res = slices.Clip(res) return &nfttypes.QueryTokensResponse{ Tokens: res, @@ -238,6 +242,10 @@ func (sm WasmNFTSubmodule) getTokensByAccountAndCollection(ctx context.Context, if err != nil { return nil, status.Error(codes.Internal, err.Error()) } + res = slices.DeleteFunc(res, func(item *nfttypes.IndexedToken) bool { + return item == nil + }) + res = slices.Clip(res) return &nfttypes.QueryTokensResponse{ Tokens: res,