@poprank/sdk
Version:
PopRank API client and types
89 lines (88 loc) • 2.66 kB
TypeScript
import { Chain } from './general';
import { Trait } from './traits';
/**
* Collection categories
*/
export declare type Category = 'avatar' | 'gaming' | 'gen-art';
/**
* Type of collection, aka whether it lives on `poprank.io`
* or prelaunch.poprank.io
*/
export declare type CollectionType = 'default' | 'prelaunch';
/**
* All of a collection's traits grouped by trait_type
*/
export declare type GroupedTraits = Record<string, Trait[]>;
/**
* All up stats around how many NFTs have been in rounds
*/
export interface Exposure {
totalItemsSeen: number;
totalPercentSeen: number;
totalItems: number;
}
export declare const collectionStates: readonly ["not-enough"];
/**
* State of this collection's "aesthetic ranking reliability"
*/
export declare type CollectionState = typeof collectionStates[number];
/**
* Exposure stats for a specific collection
*/
export interface CollectionSeenness {
/**
* Num of times NFTs have been seen in collection
*/
seen: number;
/**
* Number of rounds played
*/
validPlayed: number;
/**
* Percentage of the collection's NFTs that have been in one or more
* rounds
*/
percentSeen: number;
}
/**
* Base attributes for the collection
*/
export interface CollectionBase {
readonly slug: string;
readonly address: string;
readonly profileUrl: string;
readonly featureUrl: string;
readonly name: string;
readonly description: string;
}
/** Maps directly to `Collections` SQL relation */
export interface Collection extends CollectionBase {
readonly size: number;
readonly threshold: number;
readonly active: boolean;
/**
* JSON string of all traits
*/
readonly traits: GroupedTraits;
/** Our database has a `featured:int` column, where it's either undefined (not featured),
or the 1-indexed position of the feature. Aka `featured:1` means it's our main feature,
2,3,4 are our secondary 3 */
readonly featured: number;
readonly timestamp: string;
readonly sample_id: string;
readonly chain: Chain[];
/** JSON array of the categories, eg [""] */
readonly categories: Category[];
readonly lastUpdated: number;
readonly collectionType: CollectionType;
/**
* Array of addresses that are allowed to see this collection.
* A defined value here = this is a private collection
*/
readonly privateAddresses?: string[];
readonly floorPrice?: number;
}
export declare type CollectionWithSeen = CollectionSeenness & Collection;
export declare type CollectionWithSeenAndTotalRounds = CollectionWithSeen & {
totalRounds: number;
};