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

@rarible/royalties-registry

v0.8.6

Published

- struct Part[] {address account; uint value} - simple one-level structure to save address author and their part. ### Methods RoyaltiesRegistry is a separate contract, which provides interface: **getRoyalties**() and methods: **setProviderByToken**(), *

Downloads

18

Readme

Royalties Provider (contract RoyaltiesRegistry)

Need to know before:

  • struct Part[] {address account; uint value} - simple one-level structure to save address author and their part.

Methods

RoyaltiesRegistry is a separate contract, which provides interface: getRoyalties() and methods: setProviderByToken(), setRoyaltiesByToken(), setRoyaltiesByTokenAndTokenId(). Methods can be called by Owner contract RoyaltiesRegistry or by Owner contract (token), which address set as input parameter token.

Royalties Provider - any contract, which supports IRoyaltiesProvider interface. In this way any contract can inherit IRoyaltiesProvider interface and realize own method getRoyalties(). Address Royalties Provider contract will appear in ProviderRoyalties hash storage(use further PHS) after calling method setProviderByToken().

getRoyalties(address token, uint tokenId) returns(Part[] memory royalties);

  • Input parameter: token - address token;
  • Input parameter: tokenId - token Id;
  • Returns: royalties - Part[] array royalties.

Algorithm getRoyalties() consists of three parts:

  1. Check RoyaltiesRegistry hash storage(use further RHS), if find royalties by token or tokenId, return royalties.
  2. Check PHS by input token. If find a contract address in PHS, check contract supports IRoyaltiesProvider interface, get royalties by IRoyaltiesProvider interface, save royalties in RHS, return royalties.
  3. Check contract royalties by token and tokenId. If contract supports RoyaltiesV1 or RoyaltiesV2 interface, get royalties by one of supported interfaces (RoyaltiesV1 or RoyaltiesV2), save royalties in RHS, return royalties.

setProviderByToken(address token, address provider); Save address provider in PHS. This method don`t update RHS. If it necessary to save royalties in RHS, user need to call method setRoyaltiesByTokenAndTokenId().

  • Input parameter: token - address token;
  • Input parameter: tokenId - token Id.

setRoyaltiesByTokenAndTokenId(address token, uint tokenId, Part[] memory royalties); Save royalties in RHS.

  • Input parameter: token - address token;
  • Input parameter: tokenId - token Id;
  • Input parameter: royalties - array royalties, each item content author address and author part.

setRoyaltiesByToken(address token, Part[] memory royalties); Save royalties in RHS.

  • Input parameter: token - address token;
  • Input parameter: royalties - array royalties, each item content author address and author part.