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

buddy.drops

v0.1.1

Published

[![npm version](https://badge.fury.io/js/buddy.drops.svg)](https://badge.fury.io/js/buddy.drops) ![NPM License](https://img.shields.io/npm/l/buddy.drops) [![Static Badge](https://img.shields.io/badge/twitter-BuddyLinkApp-blue?logo=x&logoColor=white)](http

Downloads

10

Readme

Buddy.Drops SDK

npm version NPM License Static Badge Static Badge

The official typescript SDK for Buddy.Drops by Buddy.Link!

This package contains infrastructure and helpers for using Buddy Drops for raffle launches.

How to use

1) Install Package

Use the command npm i buddy.drops to install the package as a dependency.

2) Setup the initial state

In your layout.tsx or highest app layer file, import the initBuddyDrops() function with:

import { initBuddyDrops } from 'buddy.drops'

Within global scope (outside of the component) simply run

initBuddyDrops();

You will then be able to access to hook within any component.

3) useBuddyDrops hook

You can use the main hook within any subcomponent to get the data you need with:

import { useBuddyDrops } from 'buddy.drops'

And then proceed to use it within your component like this:

const MyComponent = () => {
  const { 
    step, prevStep, nextStep,
    phase, prevPhase, nextPhase,
    timer, pause, value, rewards, 
    tickets, reduceValue, addValue,
    buyTickets, errors, mock, sold,
    inputProps, onChange, onBlur,
    
  } = useBuddyDrops();
  
  return (
    <div>
      {`Your Code Goes Here`}
    </div>
  )
};

Example implementations

Please visit the open-source example on Github.

Initial State

Here is an outline of what each function and state does from the useBuddyDrops hook.

step

The current step in the onboarding flow for the user. This is different from the phase of the mint, which is where the mint timer is at between whitelist, public sale, waiting, and claim phase.

prevStep

Use this function to go to the previous onboarding step on the front-end.

nextStep

Use this function to go to the next onboarding step on the front-end.

phase

The current phase of the public mint. The possible states are PHASE_WHITELIST, PHASE_PUBLIC_SALE, PHASE_WAIT, and PHASE_CLAIM.

prevPhase

Use this function to decrement the front-end to the previous mint phase.

nextPhase

Use this function to increment the front-end to the next mint phase.

timer

When the mock state is enabled, sends the remaining hour, minute, and second of the public phase. Not currently recommended for production.

pause

When the mock state is enabled, sends the remaining hour, minute, and seconds of the waiting phase. Not currently recommended for production.

value

The number of tickets a person wishes to purchase.

reduceValue

Reduce the number of tickets a person would like to purchase by 1.

addValue

Increment the number of tickets a person would like to purchase by 1.

rewards

An array of rewards that the user has received during the claim phase.

tickets

The number of tickets a user has already purchased and owns.

buyTickets

Buy tickets (number in value) which increases the number of tickets immediately while in mock state.

errors

An array of error objects which have a type, and a message. Things like maximum exceeded tickets, or other errors will be added here.

mock

Enabled by default for now, to disable add an object to the initBuddyDrops function with {[MOCK_DEBUG]: false} which you can import from buddy.drops.

sold

This will return the total number of tickets sold for the mint.

inputProps

Use this object in your input to simply set the value, like this: <input {...inputProps}/>.

onChange

Use this to manage the onChange events for your input like this: <input onChange={e => onChange(e, min_tickets, max_tickets)}.

onBlur

Use this to manage the onBlur events for your input like this: <input onBlur={e => onBlur(e, min_ticketes)}.

Additional Resources

Looking for the main SDK?

Other Resources: