Skip to content
Merged
Show file tree
Hide file tree
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
19 changes: 6 additions & 13 deletions src/common/elastic.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,7 @@ export class ElasticService {
};

async getAccountEsdtByIdentifier(identifier: string) {
const elasticQueryAdapter: ElasticQuery = new ElasticQuery();
elasticQueryAdapter.condition.must = [
QueryType.Match('identifier', identifier, QueryOperator.AND),
]

const elasticQuery = buildElasticQuery(elasticQueryAdapter);

let documents = await this.getDocuments('accountsesdt', elasticQuery);

return documents.map((document: any) => this.formatItem(document, 'identifier'));
return this.getAccountEsdtByIdentifiers([ identifier ]);
}

async getTokensByIdentifiers(identifiers: string[]) {
Expand All @@ -126,12 +117,14 @@ export class ElasticService {
pagination.size = 10000;
elasticQueryAdapter.pagination = pagination;


const elasticQuery = buildElasticQuery(elasticQueryAdapter);

let documents = await this.getDocuments('accountsesdt', elasticQuery);
const documents = await this.getDocuments('accountsesdt', elasticQuery);

return documents.map((document: any) => this.formatItem(document, 'identifier'));
let result = documents.map((document: any) => this.formatItem(document, 'identifier'));
result.reverse();

return result;
}

async getAccountEsdtByAddress(address: string, from: number, size: number, token: string | undefined) {
Expand Down
1 change: 0 additions & 1 deletion src/endpoints/nfts/nft.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export class NftService {
const { from, size } = queryPagination;

let nfts = await this.getNftsInternal(from, size, filter, undefined);


if (withOwner) {
const accountsEsdts = await this.elasticService.getAccountEsdtByIdentifiers(nfts.map(({identifier}) => identifier));
Expand Down