Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issues with auction status and auction duration #85

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Fixes issues with ended auctions on graph data
  • Loading branch information
neokry committed Mar 24, 2022
commit d526b0242c4d80462a6777d22d11a354a08e5811
10 changes: 9 additions & 1 deletion src/backends/zora-graph/GraphAuctionDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ export class GraphAuctionDataSource implements GraphAuctionInterface {
return addCurrencyInfo(response.currentBid.amount);
}

// final bid
if (response.previousBids && response.previousBids.length) {
const finalBid = response.previousBids.find((bid) => bid.bidType === 'Final');
return formatBid(finalBid).amount;
}

return addCurrencyInfo(response.reservePrice);
};

Expand All @@ -143,7 +149,9 @@ export class GraphAuctionDataSource implements GraphAuctionInterface {
return formatBid(response.currentBid);
}
if (response.previousBids && response.previousBids.length) {
const topBid = response.previousBids[response.previousBids.length - 1];
const topBid = [...response.previousBids].sort(
(a, b) => parseInt(b.amount) - parseInt(a.amount)
)[0];
return formatBid(topBid);
}
return undefined;
Expand Down