UNPKG

@nftgo/gorarity

Version:

An algorithm to calculate rarity of NFT(how special it is), based on Jaccard Distance.

20 lines (19 loc) 831 B
import { Collection, TokenRarity } from './models'; import { Scorer } from './scoring'; export declare class RarityRanker { private static defaultScorer; constructor(); /** * @description Ranks tokens in the collection with the default scorer implementation. * @param collection * @param scorer * @returns Array of TokenRarity objects with score, rank and token information sorted by rank. */ static rankCollection(collection: Collection, scorer?: Scorer): TokenRarity[]; /** * @description Set the ranking of token according to it's rarity socre. * @param tokenRarities Unordered array of tokens with rarity score information * @returns Ordered array of tokens sorted by score descending */ static setRarityRanks(tokenRarities: TokenRarity[]): TokenRarity[]; }