From 968bda8b340d54ccfeb714c8120637c3d8a2a227 Mon Sep 17 00:00:00 2001 From: Traian Anghel Date: Thu, 9 Jun 2022 12:23:36 +0300 Subject: [PATCH] Remove NFT type filter from gateway (#672) --- src/endpoints/esdt/esdt.address.service.ts | 25 ---------------------- 1 file changed, 25 deletions(-) diff --git a/src/endpoints/esdt/esdt.address.service.ts b/src/endpoints/esdt/esdt.address.service.ts index e83841088..b8e89ad2f 100644 --- a/src/endpoints/esdt/esdt.address.service.ts +++ b/src/endpoints/esdt/esdt.address.service.ts @@ -54,10 +54,6 @@ export class EsdtAddressService { return await this.getNftsForAddressFromGateway(address, filter, pagination); } - if (filter.type) { - return await this.getNftsForAddressWithTypeFilter(address, filter, pagination); - } - if (source === EsdtDataSource.elastic || AddressUtils.isSmartContractAddress(address)) { return await this.getNftsForAddressFromElastic(address, filter, pagination); } @@ -65,28 +61,7 @@ export class EsdtAddressService { return await this.getNftsForAddressFromGateway(address, filter, pagination); } - private async getNftsForAddressWithTypeFilter(address: string, filter: NftFilter, pagination: QueryPagination): Promise { - if (AddressUtils.isSmartContractAddress(address)) { - const nftType = (filter.type ?? '').split(','); - filter.type = undefined; - let allEsdts = await this.getNftsForAddressFromElastic(address, filter, { from: 0, size: 10000 }); - allEsdts = allEsdts.filter(x => nftType.includes(x.type)); - allEsdts = allEsdts.slice(pagination.from, pagination.from + pagination.size); - return allEsdts; - } - - const allEsdts = await this.getNftsForAddressFromGateway(address, filter, pagination); - return allEsdts; - } - async getNftCountForAddressFromElastic(address: string, filter: NftFilter): Promise { - // temporary fix until we have type on the accountsesdt elastic collection - if (filter.type) { - const allEsdts = await this.getNftsForAddressWithTypeFilter(address, filter, { from: 0, size: 10000 }); - return allEsdts.length; - } - - const elasticQuery = this.nftService.buildElasticNftFilter(filter, undefined, address); return await this.elasticService.getCount('accountsesdt', elasticQuery); }