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

@communitiesid/resolver

v0.0.8

Published

``` npm i @communitiesid/resolver ```

Downloads

1

Readme

Communities ID Resolver

Install

npm i @communitiesid/resolver

Usage

Initialze

import CommunitiesIDResolver from '@communitiesid/resolver';

const options: CommunitiesIDResolverInput = {
  goerli: {
    RPCUrl: "https://goerli.blockpi.network/v1/rpc/public",
    alchemyKey: "<your alchemy key for goerli network>",
    generateSigner: provider => new ethers.Wallet('<your private key>', provider)
  },
  mumbai: {
    RPCUrl: "https://polygon-mumbai.blockpi.network/v1/rpc/public",
    alchemyKey: "<your alchemy key for polygon mumbai network>",
    generateSigner: provider => new ethers.Wallet('<your private key>', provider)
  }
}

const resolver = new CommunitiesIDResolver(options);

Input

|Name|Type|Description|required| |---|---|---|---| |goerli.RPCUrl|string|The RPC url for goerli network|true| |goerli.alchemyKey|string|The Alchemy key for goerli network|true| |goerli.generateSigner|(provider: ethers.providers.Provider) => ethers.Signer|The function to generate signer, if not set, some write method (like mint) will fail |false| |mombai.RPCUrl|string|The RPC url for mombai network|true| |mombai.alchemyKey|string|The Alchemy key for mombai network|true| |mombai.generateSigner|(provider: ethers.providers.Provider) => ethers.Signer|The function to generate signer, if not set, some write method (like mint) will fail |false|

Methods

  • searchCommunity

Get the community info by name

Input:

|Name|Type|Description|required| |---|---|---|---| |name|string|The name of the community|true|

Output: Promise<Community | null>

Example:

const res = await resolver.searchCommunity('did')
  • searchMember

Get the member info by name

Input:

|Name|Type|Description|required| |---|---|---|---| |name|string|The name of the member, the format should be ${member}.${community}|true|

Output: Promise<Member | null>

Example:

const res = await resolver.searchMember('a.did')
  • getOwnerOfMember

Get the owner of a member

Input:

|Name|Type|Description|required| |---|---|---|---| |name|string|The name of the member, the format should be ${member}.${community}|true|

Output: Promise<string | null>

Example:

const res = await resolver.getOwnerOfMember('a.did')
  • getPrimaryDID

Get primary did of an address

Input:

|Name|Type|Description|required| |---|---|---|---| |address|string|The address of the member|true|

Output: Promise<string | null>

Example:

const res = await resolver.getPrimaryDID('0x0000000000000000000000000000000000000000')
  • getAllCommunities

Get all communities in specific chain

Input:

|Name|Type|Description|required| |---|---|---|---| |chain|'goerli' | 'mumbai'|The chain that you want to get communities|true|

Output: Promise<object[]>

Example:

const res = await resolver.getAllCommunities('goerli')
  • getAllCommunitiesOwnedByAddress

Get all communities owned by an address in specific chain

Input:

|Name|Type|Description|required| |---|---|---|---| |address|string|The address you want to get communities|true| |chain|'goerli' | 'mumbai'|The chain that you want to get communities|true|

Output: Promise<object[]>

Example:

const res = await resolver.getAllCommunitiesOwnedByAddress('0x0000000000000000000000000000000000000000', 'goerli')
  • getAllMembersOwnedByAddress

Get all members owned by an address in specific chain

Input:

|Name|Type|Description|required| |---|---|---|---| |address|string|The address you want to get members|true| |chain|'goerli' | 'mumbai'|The chain that you want to get members|true|

Output: Promise<object[]>

Example:

const res = await resolver.getAllMembersOwnedByAddress('0x0000000000000000000000000000000000000000', 'goerli')
  • getAllCommunitiesJoinedByAddress

Get all communities joined by an address in specific chain

Input:

|Name|Type|Description|required| |---|---|---|---| |address|string|The address you want to get communities|true| |chain|'goerli' | 'mumbai'|The chain that you want to get communities|true|

Output: Promise<object[]>

Example:

const res = await resolver.getAllCommunitiesJoinedByAddress('0x0000000000000000000000000000000000000000', 'goerli')
  • getAllMembersOwnedByCommunity

Get all members under specific community

Input:

|Name|Type|Description|required| |---|---|---|---| |name|string|TThe name of the community, if registry and chain is provided, the name will be ignored, and the query efficiency will improve|true| |registry|string|The registry of this community|false| |chain|'goerli' | 'mumbai'|The chain this community is on|false|

Output: Promise<object[]>

Example:

const res = await resolver.getAllMembersOwnedByCommunity('did')
const res = await resolver.getAllMembersOwnedByCommunity('', '0x123', 'mumbai')
  • mintMember Mint a member (This is a write method, the generateSigner function of the chain which this member on is required)

Input:

|Name|Type|Description|required| |---|---|---|---| |name|string|The name of the member|true| |address|string|The address that you want to mint this member to|true| |years|number|How many years do you want to mint|false, default 1 year|

Example:

const res = await resolver.mintMember('test.did', '0x123456')
  • updateMember

Update the info of specific member (This is a write method, the generateSigner function of the chain which this member on is required)

Input:

|Name|Type|Description|required| |---|---|---|---| |name|string|The name of the member|true| |data|UpdateMemberInput|The data you want to update|true|

Example:

const res = await resolver.updateMember('test.did', {
  description: 'test description',
  twitter: 'twi',
  discord: 'dis',
  telegram: 'tel',
  externalUrl: 'https://google.com'
})