npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

collection-slug

v0.2.9

Published

🧸 🤖 Determine the collection slug for a collection on OpenSea.

Downloads

308

Readme

collection-slug

🧸 🤖 Determine the collection slug for a collection on OpenSea.

At the time of writing, the OpenSea API:

  • does not serve information about layer twos like Arbitrum and Optimism
  • will prevent you from querying for collection data when only knowing the contractAddress and not a corresponding tokenId
  • relies upon a centrally-planned api key distribution system which restricts access to intrepid explorers
  • shrewdly prevents you from querying GraphQL using the now deprecated opensea-submarine⚠️
  • will throttle you to oblivion if you exceed 4 req/s and your backoff period will increase quadratically as a penalty for repeat offenders
  • protected their webpages against scrapers by firewalling requests behind CloudFlare and DOM obfuscation

And yet, everyone who works with NFTs all need collection_slugs, desperately, every one of us. We need collection_slugs like fish need water. 🐟

I was researching how to bypass these limitations and encountered an article that suggested we could work around such access restrictions by using archived copies of webpages... So here we are. OpenSea collection slugs, powered by the Wayback Machine. They're surprisingly timely, even for newly trending collections. Let's go.

getting started 🚀

You can install using Yarn:

yarn add bottleneck collection-slug

Depending on your runtime, you'll need to ensure some kind of variation of fetch is globally available. This is polyfilled onto the window object by default on browsers and React Native, whereas on Node.js you'll need to install node-fetch.

import { fetchCollectionSlug, Network } from 'collection-slug';

void (async () => {
  try {
    const collectionSlug: string = await fetchCollectionSlug({
      contractAddress: '0xef0182dc0574cd5874494a120750fd222fdb909a',
      network: Network.ETHEREUM /* default */,
    });
    
    console.log(collectionSlug); // 'rumble-kong-league'
  } catch (e) {
    console.error(e); // not indexed by the wayback machine
    process.exitCode = 1;
  }
})();

You can also do the inverse:

import { fetchContractAddress } from 'collection-slug';

void (async () => {
  try {
    const contractAddress: string = await fetchContractAddress({
      collectionSlug: 'renftlabs',
    });
    console.log(contractAddress); // '0x0db8c099b426677f575d512874d45a767e9acc3c'
  } catch (e) {
    console.error(e); // not indexed by the wayback machine
    process.exitCode = 1;
  }
})();

From my experimentation, the Wayback Machine has a very generous rate limit policy. I managed to retain a sustained ~112 slugs-per-minute without error.

license ✌️

CC0-1.0