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

@cardinal/namespaces

v6.0.0

Published

Cardinal namespaces SDK

Downloads

787

Readme

Cardinal Namespaces

License Release

Background

A namespace can be thought of as a rental dispenser with a templated set of parameters that allow the NFTs to be programmatically minted and rented on demand. Similar in ways to the Metaplex candy-machine, this works by minting the NFT and subsequently wrapping it in a token manager of the configured parameters. When it is returned to the namespace, it can be rented again by a new user.

  • Usernames
    • In renting a username from a given namespace, you may be renting the right to play a game, access a service, or participate in a DAO. The username comes in the form of a managed NFT that sits in your wallet for the duration of the rental.
  • Verified ownership
    • Holding a rented, managed NFT from a namespace that has previously verified your identity can allow you to assert proven ownership of something within that namespace.
  • Subscriptions
    • A namespace can be setup to offer subscription-based access to gated content. When a user attempts to access the content, the provider can trivially check for ownership of the NFT.
  • Keys / Tickets
    • A namespace could represent a room in a hotel for which temporary access could be rented out. The rented key could also have have a usage-based expiration and be used as a ticket to an event.
  • Badges / Certificates
    • A namespace could be setup to rent out badges or certifications to a specific set of users. A user could be approved by the namespace and subsequently claim their badge that could be verified as issued and managed by that namespace.

Packages

| Package | Description | Version | Docs | | :--------------------- | :---------------------------- | :------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------- | | cardinal-namespaces | On-demand NFT minting | Crates.io | Docs.rs | | @cardinal/namespaces | TypeScript SDK for namespaces | npm | Docs |

Addresses

Program addresses are the same on devnet, testnet, and mainnet-beta.

Getting Started

git clone https://github.com/cardinal-labs/cardinal-namespaces.git
cd cardinal-namespaces
make

Documentation

Namepsace

Namespaces are the base component of the protocol. A namespace is a PDA owned by the program that forms a logical grouping of NFTs under a common name. Often similar to a TLD (top-level domain), but the use of a namespace can vary widely. Essentially a namespace is the creator of tokens that belongs in the namespace. It contains an authority who can update the parameters of the namespace, and when users claim entries in a namespace, they are issued by the namespace.

#[account]
pub struct Namespace {
    pub bump: u8,
    pub name: String,
    pub update_authority: Pubkey,
    pub rent_authority: Pubkey,
    pub approve_authority: Option<Pubkey>,
    pub schema: u8,
    pub payment_amount_daily: u64,
    pub payment_mint: Pubkey,
    pub min_rental_seconds: i64,
    pub max_rental_seconds: Option<i64>,
    pub transferable_entries: bool,
}

Name Entry

Namespaces are a collection of name entries. Each name entry stores information related to a specific name in a namespace. Most importantly, the name is derived from the name and the namespace, so every entry is unique to a given namespace. The entry mostly serves to map a string name to an NFT (mint address). Whoever is the holder of that NFT has the ability to set the entry data and also map their address back to that name using the reverse_entry.

Name entry NFTs are dynamically generated using cardinal-generator.

Name entries are issued by the namespace according to the paramaters of the namespace. The namespaces use the cardinal-token-manager to create revocable and expiring NFTs that represent each entry. This setup allows for subscriptions, and revocable badges issued by a namespace.

#[account]
pub struct Entry {
    pub bump: u8,
    pub namespace: Pubkey,
    pub name: String,
    pub data: Option<Pubkey>,
    pub reverse_entry: Option<Pubkey>,
    pub mint: Pubkey,
    pub is_claimed: bool,
    pub claim_request_counter: u32,
}

Questions & Support

If you are developing using Cardinal namespaces contracts and libraries, feel free to reach out for support on Discord. We will work with you or your team to answer questions, provide development support and discuss new feature requests.

For issues please, file a GitHub issue.

https://discord.gg/cardinallabs

License

Cardinal Protocol is licensed under the GNU Affero General Public License v3.0.

In short, this means that any changes to this code must be made open source and available under the AGPL-v3.0 license, even if only used privately.