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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@clustersxyz/sdk

v0.4.3

Published

SDK for Clusters which resolves names, addresses, and wallets for finalized clusters.

Downloads

3,268

Readme

@clustersxyz/sdk · NPM npm (tag) npm bundle size Twitter URL

SDK for Clusters which resolves names, addresses, and wallets for finalized clusters.

Read more about the clusters.xyz via our documentation

Installation

npm install @clustersxyz/sdk viem

Setup

import { Clusters } from "@clustersxyz/sdk"

const clusters = new Clusters();

Usage

Check out our /examples folder for usage.

getName(address)

Get the cluster and wallet name based on an address

const clusterName = await clusters.getName('0x5755d1dcea21caa687339c305d143e6e78f96adf');

Returns

clusters/main

getAddress(name)

Get the wallet associated to a cluster name. You can pass just the cluster name or also include the wallet name as shown in the 2 examples.

const clusterAddress_Option1 = await clusters.getAddress('clusters/');
const clusterAddress_Option2 = await clusters.getAddress('clusters/main');

Returns

{
  "type": "evm",
  "address": "0x5755d1dcea21caa687339c305d143e6e78f96adf",
  "name": "clusters/main",
  "isVerified": true
}

getCluster(clusterName)

Get the cluster from a cluster name

const cluster = await clusters.getCluster('clusters/');

Returns

{
  "name": "clusters/",
  "wallets": [
    {
      "type": "evm",
      "address": "0x5755d1dcea21caa687339c305d143e6e78f96adf",
      "name": "clusters/main",
      "isVerified": true
    }
  ]
}

Bulk fetch

getNames(address[])

Get the cluster and wallet names from a list of addresses

const clusterName = await clusters.getNames([
    '0x5755d1dcea21caa687339c305d143e6e78f96adf',
    '0xccdead94e8cf17de32044d9701c4f5668ad0bef9'
])

Returns

[
  {
    address: "0x5755d1dcea21caa687339c305d143e6e78f96adf",
    name: "clusters/main"
  }, {
    address: "0xccdead94e8cf17de32044d9701c4f5668ad0bef9",
    name: "layerzero/main"
  }
]

getAddresses(name[])

Get the wallets associated to multiple cluster names. You can pass just the cluster name or also include the wallet name.

const clusterAddresses = await clusters.getAddresses([
    "clusters/",
    "clusters/main",
    "layerzero/",
    "layerzero/main"
]);

Returns

[
  {
    name: "clusters/",
    type: "evm",
    address: "0x5755d1dcea21caa687339c305d143e6e78f96adf",
    isVerified: true
  },
  {
    name: "clusters/main",
    type: "evm",
    address: "0x5755d1dcea21caa687339c305d143e6e78f96adf",
    isVerified: true
  },
  {
    name: "layerzero/",
    type: "evm",
    address: "0xccdead94e8cf17de32044d9701c4f5668ad0bef9",
    isVerified: true
  },
  {
    name: "layerzero/main",
    type: "evm",
    address: "0xccdead94e8cf17de32044d9701c4f5668ad0bef9",
    isVerified: true
  }
]

getClusters(clusterName[])

Get the clusters from a list of cluster names

const clusters = await clusters.getClusters([
    "clusters/",
    "layerzero/"
]);

Returns

[
  {
    name: "clusters/",
    wallets: [
      {
        name: "clusters/main",
        type: "evm",
        address: "0x5755d1dcea21caa687339c305d143e6e78f96adf",
        isVerified: true
      }
    ]
  },
  {
    name: "layerzero/",
    wallets: [
      {
        name: "layerzero/main",
        type: "evm",
        address: "0xccdead94e8cf17de32044d9701c4f5668ad0bef9",
        isVerified: true
      }
    ]
  }
]

Utilities

import { getImageUrl, getProfileUrl } from "@clustersxyz/sdk"

const imageUrl = getImageUrl("clusters/");
const profileUrl = getProfileUrl("clusters/");