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

@verto/tippar

v1.0.2

Published

Tipping for Profit-Sharing Communities made easy

Downloads

5

Readme

Tippar

A simple library to select which PST token holder receives a tip. With the addition of SmartWeave contracts being able to custody different types of PSTs, there now needs to be a way for tips to be distributed to contracts in addition to wallets.

How it works

Tippar chooses token holders from contract(s) in recursion until a wallet is selected. Take note of the following examples:

A tip needs to be given to a token holder in Contract A

Tippar Process:

select holder from contract (A)
if holder === contract (B)
  select new holder from contract (B)
  if new holder === wallet
    return new holder
  else
    ...continue recursion

Real-World Example:

An ArDrive user is sending a tip to an ArDrive holder. If the random token-holder selected to receive the tip is the Verto Contract, a new token-holder is calculated from the users who hold a balance of VRT. This means that the ArDrive tip will now be sent to the VRT token holder.

Usage

yarn add @verto/tippar

chooseRecipient

async function chooseRecipient(client: Arweave, contract: string, mode?: string): Promise<string>
  • client: Arweave client instance
  • contract: Profit-Sharing token contract to choose holder from
  • mode?: Optional parameter for setting type of selection
    • "weightedRandom": Select token holder based on a weighted-random
    • "greatest": Select token holder from the the greatest balance
    • Defaults to "weightedRandom"

Example:

import { chooseRecipient } from "@verto/tippar;

async function someUserInteraction() {
  ...
  const tipReceiver = await chooseRecipient(arweaveClient, pstContract);
  console.log(`Wallet of tip receiver: ${tipReceiver}`);
  ...
}

Contributing

Any and all contributions are welcome. Feel free to make a PR with any updates for fixes.