Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiet1618 committed Dec 8, 2023
1 parent a18b8f6 commit f287ed1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/controllers/data.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export class DataController {

const listDataWithNft = await Promise.all(listDataInfo.map(async data => {
const nft = listNft.find(nft => nft.id === data.id && nft.addressCollection === data.addressCollection);
const price = await getTokenPrice(data.addressCollection, String(data.id));
const promptPrice = await getPromptPrice(data.addressCollection, String(data.id));
return {
id: nft.id,
addressCollection: nft.addressCollection,
Expand All @@ -76,6 +78,14 @@ export class DataController {
meta: data.meta,
image: nft.image,
attributes: nft.attributes,
price: {
avax: price[0].toString(),
usd: price[1].toString(),
},
promptPrice: {
avax: promptPrice[0].toString(),
usd: promptPrice[1].toString(),
},
owner: user,
eNft: false,
}
Expand All @@ -85,6 +95,8 @@ export class DataController {
const listDataENft = await this.eNftService.getENftByAddressCollection(addressENft);
const listDataInfoENft = await this.eNftService.findENftsByListObjectIdWithCollection(listDataENft.map(data => ({ id: data, addressCollection: addressENft })));
const listDataWithENft = await Promise.all(listDataInfoENft.map(async nft => {
const price = await getTokenPrice(nft.addressCollection, String(nft.id));
const promptPrice = await getPromptPrice(nft.addressCollection, String(nft.id));
return {
id: nft.id,
addressCollection: nft.addressCollection,
Expand All @@ -93,6 +105,14 @@ export class DataController {
meta: nft.meta,
image: nft.image,
attributes: nft.attributes,
price: {
avax: price[0].toString(),
usd: price[1].toString(),
},
promptPrice: {
avax: promptPrice[0].toString(),
usd: promptPrice[1].toString(),
},
owner: user,
eNft: true,
}
Expand Down

0 comments on commit f287ed1

Please sign in to comment.