Skip to content

Commit bbfab89

Browse files
committed
improve getSingleNFt
1 parent 5ea0def commit bbfab89

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

src/endpoints/nfts/nft.service.ts

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -267,23 +267,29 @@ export class NftService {
267267
return undefined;
268268
}
269269

270-
if (nft.type && nft.type.in(
271-
NftType.SemiFungibleESDT, NftType.MetaESDT,
272-
NftSubType.DynamicSemiFungibleESDT, NftSubType.DynamicMetaESDT
273-
)) {
274-
await this.applySupply(nft);
275-
}
276-
277-
await this.applyNftOwner(nft);
278-
279-
await this.applyNftAttributes(nft);
270+
const types = [
271+
NftType.SemiFungibleESDT,
272+
NftType.MetaESDT,
273+
NftSubType.DynamicSemiFungibleESDT,
274+
NftSubType.DynamicMetaESDT,
275+
];
280276

281-
await this.applyAssetsAndTicker(nft);
277+
await Promise.all([
278+
(async () => {
279+
if (nft.type && types.includes(nft.type as NftType | NftSubType)) {
280+
await this.applySupply(nft);
281+
}
282+
})(),
283+
this.applyAssetsAndTicker(nft),
284+
this.processNft(nft),
285+
(async () => {
286+
await this.applyNftOwner(nft);
287+
await this.applyNftAttributes(nft);
288+
})(),
289+
]);
282290

283291
await this.applyUnlockFields(nft);
284292

285-
await this.processNft(nft);
286-
287293
return nft;
288294
}
289295

0 commit comments

Comments
 (0)