isAuction()
/**
* Check if the Collective Portrait is up for auction.
*
* @remarks
* The Collective Portrait is up for auction if the current time is greater than the valid until time + grace period and less than the valid until time + grace period + auction epoch.
* This function is written such that it can terminate early if it finds a false.
*
* @param {CollectivePortraitName | number} identity - The name of the Collective Portrait that the user would like to check if it is up for auction.
* @returns {boolean} - Whether the Collective Portrait is up for auction.
* @beta
* @async
*/
isAuction(identity: CollectivePortraitName | number): boolean {
const validUntil = this.getValidUntil(identity);
const currentBlock = this.portrait.portraitProvider.getBlockNumber();
const timestamp =
this.portrait.portraitProvider.getBlock(currentBlock).timestamp;
return validUntil > timestamp
? false
: this.getAuctionStartTime(identity) > timestamp
? false
: this.getAuctionEndTime(identity) > timestamp
? false
: true;
}
Last updated