Skip to content

OriginProtocol/rarity-analyser

 
 

Repository files navigation

Rarity analyser

Generates rarity data for an NFT collection.

Fork of rarity-analyser that doesn't use a DB or Filesystem

Usage

Import and then call with the NFT's metadata as the arg

import analyser from 'rarity-analyser'

analyser.analyse(metadata)

Interfaces

Token
interface Token {
  id: number
  name: string
  attributes: Attribute[] // Attribute field name can be configured in rarityConfig.ts
  image?: string
  description?: string
  image_data?: string
  external_url?: string
  animation_url?: string
  background_color?: string

  // The following fields are included in the analysed data
  rarity_score: number
  rank: number
  rarity_score_normalized: number
  rank_normalized: number
}
Attribute
interface Attribute {
  trait_type: number
  value: string

  // The following fields are included in the analysed data
  rarity_score: number
  rarity_score_normalized: number
  percentile: number
  count: number // Count of how many tokens have the value of this attribute
}

TODO

  • Use Github Actions to build & publish package on push
  • Get rid of global config file and make it an arg to the analyse function

About

An open source NFT rarity analyser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.7%
  • JavaScript 1.2%
  • Procfile 0.1%