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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mbkjs/candy-machine-minter

v2.0.5

Published

Candy machine bindings

Readme

Candy Machine client bindings

This is a candy-machine V2 client bindings. For more details on the candy-machine V2 take a look at here

APIs

These are the APIs that have been added for Candy-Machine V2 version.

Initialize the candy-machine from API

  1. Create the config data like for instance

    const data: CandyMachineData = {
      itemsAvailable: new anchor.BN(1000),
      uuid: null,
      symbol: 'MBKR',
      sellerFeeBasisPoints: 10,
      isMutable: true,
      maxSupply: new anchor.BN(2000),
      price: new anchor.BN(0.01),
      retainAuthority: true,
      gatekeeper: null,
      goLiveDate: new anchor.BN(1680888721),
      endSettings: null,
      whitelistMintSettings: {
        mode: { burnEveryTime: true, neverBurn: false },
        mint: deployedTokenWlMintAddress,
        presale: true,
        discountPrice: null,
      },
      hiddenSettings: null,
      creators: [
        {
          address: dummyKeypair.publicKey,
          verified: true,
          share: 100,
        },
      ],
    };
  2. Create the arguments for passing

    const args: CreateCandyMachineApiArgs = {
      connection: connection,
      wallet: dummyWallet,
      treasuryWallet: dummyWallet.publicKey,
      candyData: data,
      splToken: null,
    };
  3. Pass the arguments into the API

    const { candyMachineId, uuid, txId } = await api.createCandyMachineV2(args);

Get Candy-Machine state

For getting the candy-machine state, use the following API. Here is the example

  1. Prepare the argument

    const args: CandyMachineApiArgs = {
      connection: connection,
      wallet: dummyWallet,
      candyMachineId:
        candyMachineID != null
          ? new PublicKey(candyMachineID)
          : dummyKeypair.publicKey,
    };
  2. Pass the argument to the api to fetch the data

    const result = await api.getCandyMachineV2State(args);

Mint NFT using candy-machine V2

To mint an NFT you could use the following API. This API is using the whitelist settings described in this section. Note the user who is trying to mint the NFT should have atleast one-whitelist token for this example to work. But that said, this API can also be used with any settings that you have made when you first initialized the candy-machine

  1. Prepare the arguments

    const args: MintNftApiArgs = {
      wallet: dummyWallet, //payer wallet
      connection: connection,
      candyMachineId:
        candyMachineID != null
          ? new PublicKey(candyMachineID)
          : dummyKeypair.publicKey, // admin public key
    };
  2. Now mint the NFT like below

    const tx = await api.mintOneCandyMachineV2Nft(args);

Further Details

For more details on using the api, refer the api.spec.ts under tests folder in this repo.

Further improvements and contributing

If you want more APIs please let us know by creating an issue or create a PR if you want add more APIs related to Candy-Machine-V2