Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/core-api/src/controllers/delegates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Hapi from "@hapi/hapi";
import { Identifiers } from "../identifiers";
import { BlockResource, BlockWithTransactionsResource } from "../resources";
import {
blockCriteriaSchemaObject,
DelegateCriteria,
delegateCriteriaSchemaObject,
DelegateResource,
Expand Down Expand Up @@ -88,8 +89,12 @@ export class DelegatesController extends Controller {
return notFound("Delegate not found");
}

const blockCriteria = {
...(this.getQueryCriteria(request.query, blockCriteriaSchemaObject) as Contracts.Shared.OrBlockCriteria),
generatorPublicKey: delegateResource.publicKey,
};

if (request.query.transform) {
const blockCriteria = { generatorPublicKey: delegateResource.publicKey };
const blockWithSomeTransactionsListResult = await this.blockHistoryService.listByCriteriaJoinTransactions(
blockCriteria,
{ typeGroup: Enums.TransactionTypeGroup.Core, type: Enums.TransactionType.MultiPayment },
Expand All @@ -100,7 +105,6 @@ export class DelegatesController extends Controller {

return this.toPagination(blockWithSomeTransactionsListResult, BlockWithTransactionsResource, true);
} else {
const blockCriteria = { generatorPublicKey: delegateResource.publicKey };
const blockListResult = await this.blockHistoryService.listByCriteria(
blockCriteria,
this.getListingOrder(request),
Expand Down