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

@boxfish-studio/candymachine-client-sdk

v1.0.0

Published

Metaplex Candy Machine Client SDK

Downloads

28

Readme

Disclaimer: The SDK is currently a pre-alpha version

About

The Candymachine Client SDK offers all functionalities of the former Metaplex Candy Machine CLI but on a standalone pure Typescript client-side library that can run on any browser.

IMPORTANT: This SDK is only compatible with the Candy Machine V2. The Candy Machine V1 or V3 are not compatible.

Features

  • Create a Candy Machine V2 with multiple and configurable settings:
    • Captcha enabled/disabled.
    • Mutability on the NFTs.
    • Price, number of NFTs.
    • Authority.
    • NFTs hosted on Arweave.
    • Time and date to start the minting.
  • Update any Candy Machine V2 in which you are the authority and have the cache file.
  • Explore any Candy Machine V2, view the minted NFTs, remaining NFTs to mint...
  • Mint a NFT from the Candy Machine V2.
  • Available on Solana's Mainnet and Devnet networks.
  • Fully compatible with React and NextJS.

Built with

  • Typescript
  • Metaplex
  • Anchor from Serum
  • Solana web3.js

Installation

$ npm i @boxfish-studio/candymachine-client-sdk
$ yarn add @boxfish-studio/candymachine-client-sdk
$ pnpm add @boxfish-studio/candymachine-client-sdk

How to use

Upload your first Candy Machine v2

  1. Import uploadV2, loadCandyProgramV2, StorageType, verifyAssets functions and enums:
import { uploadV2, loadCandyProgramV2, StorageType, verifyAssets } from '@boxfish-studio/candymachine-client-sdk'

async function createCandyMachineV2() {
        let candyMachine: string = ''
        const config: ICandyMachineConfig = {
            price: 1,
            number: 200,
            gatekeeper: null,
            solTreasuryAccount: ******************, // where the NFTs initial sale SOL will go to
            splTokenAccount: null,
            splToken: null,
            goLiveDate: "21 Jul 2023 16:00:00 GMT",
            endSettings: null,
            whitelistMintSettings: null,
            hiddenSettings: null,
            storage: StorageType.Arweave,
            ipfsInfuraProjectId: null,
            ipfsInfuraSecret: null,
            nftStorageKey: null,
            awsS3Bucket: null,
            noRetainAuthority: false,
            noMutable: false,
            arweaveJwk: null,
            batchSize: null,
            pinataGateway: null,
            pinataJwt: null,
            uuid: null,
        }
        // files being all the assets uploaded to the page: [0.json, 0.png, 1.json, 1.png....]
        const { supportedFiles, elemCount } = verifyAssets(files, config.storage, config.number)

        const provider = new AnchorProvider(connection, anchorWallet, {
            preflightCommitment: 'recent',
        })

        const anchorProgram = await loadCandyProgramV2(provider)

        const {
            storage,
            nftStorageKey,
            ipfsInfuraProjectId,
            number,
            ipfsInfuraSecret,
            pinataJwt,
            pinataGateway,
            arweaveJwk,
            awsS3Bucket,
            retainAuthority,
            mutable,
            batchSize,
            price,
            splToken,
            treasuryWallet,
            gatekeeper,
            endSettings,
            hiddenSettings,
            whitelistMintSettings,
            goLiveDate,
            uuid,
        } = await getCandyMachineV2Config(publicKey, config, anchorProgram)

        try {
            const _candyMachine = await uploadV2({
                files: supportedFiles,
                cacheName: 'example',
                env: "devnet",
                totalNFTs: elemCount,
                gatekeeper,
                storage,
                retainAuthority,
                mutable,
                batchSize,
                price,
                treasuryWallet,
                anchorProgram,
                walletKeyPair: anchorWallet, // from react solana wallet package
                endSettings,
                hiddenSettings,
                whitelistMintSettings,
                goLiveDate,
                rateLimit: null,
            })

            if (typeof _candyMachine === 'string') candyMachine = _candyMachine
            console.log("Candy machine v2 successfully created!")
        } catch (err) {
            console.error("Error during candy machine v2 upload.")
        }

    }

Acknowledgements

This SDK has been built thanks to Metaplex's Candy Machine CLI.

License

Apache 2.0 © Boxfish Studio