Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/ingestors/highlight/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class HighlightIngestor implements MintIngestor {
throw new MintIngestorError(MintIngestionErrorName.MissingRequiredData, 'Id not available');
}

const totalPriceWei = await getHighlightMintPriceInWei(+vectorId, resources.alchemy);
const totalPriceWei = await getHighlightMintPriceInWei(+vectorId, resources.alchemy, collection.standard || collection.contractKind);

if (!totalPriceWei) {
throw new MintIngestorError(MintIngestionErrorName.MissingRequiredData, 'Price not available');
Expand Down
1 change: 1 addition & 0 deletions src/ingestors/highlight/offchain-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const getHighlightCollectionById = async (
status
baseUri
onChainBaseUri
standard
}
}
`,
Expand Down
8 changes: 6 additions & 2 deletions src/ingestors/highlight/onchain-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ const getContract = async (alchemy: Alchemy): Promise<Contract> => {
return contract;
};

export const getHighlightMintPriceInWei = async (vectorId: number, alchemy: Alchemy): Promise<string | undefined> => {
export const getHighlightMintPriceInWei = async (
vectorId: number,
alchemy: Alchemy,
standard: 'ERC721' | 'ERC1155',
): Promise<string | undefined> => {
try {
const contract = await getContract(alchemy);
const data = await contract.functions.getAbridgedVector(vectorId);
const { pricePerToken } = data[0];

const fee = 800000000000000;
const fee = standard.toUpperCase() === 'ERC721' ? 800000000000000 : 400000000000000;
const totalFee = parseInt(pricePerToken.toString()) + fee;

return `${totalFee}`;
Expand Down
2 changes: 2 additions & 0 deletions src/ingestors/highlight/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export type CollectionByAddress1 = {
description: string;
sampleImages: string[];
creator: string;
contractKind: 'erc721' | 'erc1155'
standard: "ERC1155" | "ERC721"
};

export type CollectionByAddress2 = {
Expand Down