The PopRank SDK contains the building blocks needed to interact with and build on top of PopRank. In fact, the PopRank team uses the SDK to power https://poprank.io, @poprank/rankings
, @poprank/opensea
, and various other offerings.
The SDK is comprised of two main sections: client
and types
.
Install the NPM package.
yarn add @poprank/sdk
Import, configure, and instantiate the PopRank API client.
import { ClientConfig, PopRankClient } from '@poprank/sdk';
const config: ClientConfig = { // optional
timeout: 10_000
};
const client = new PopRankClient(config);
Note: ClientConfig
is a pass-through import of axios
's AxiosRequestConfig
. View all config options here.
Make calls to the PopRank API with the newly instantiated PopRank API client.
const nft = await client.getNFT('thewickedcraniums', 420);
All client methods can be found here. For in-depth documentation on all the PopRank endpoints, see our API documentation.
You can also directly reference PopRank types/models, like so.
const nft: Nft = {
collection: 'thewickedcraniums',
id: '420',
rating: 1196,
...
}
All types are found within the types directory.
As always, don't hesitate to reach out to the PopRank team on Twitter or Discord if you have any questions!