CandyPay SDK lets you effortlessly create NFT minting functions for Candy Machine v2 collections.

Overview

@candypay/sdk

CandyPay SDK lets you effortlessly create NFT minting functions for Candy Machine v2 collections. Simulate minting transactions for multiple use-cases like NFT collection launch, gasless mint and many more on Solana Blockchain!

Installation

To install the SDK, run the following command:

npm install @candypay/sdk
      or
yarn add @candypay/sdk

Documentation

The SDK currently has two core functions:

  • candypay.mint()
  • candypay.gasless()

candypay.mint()

The candypay.mint() function would generate required instructions by which user can mint NFTs spending minting costs and gas fees.

Parameters:

  • network: The Candy Machine's network, either mainnet-beta or devnet.
  • candyMachineID: The ID of the Candy Machine. The type of this parameter is string.
  • payer: The public key of the user who would pay the gas fees. In the case of this function, it would be the public key of the end-user. The type of this parameter is anchor.web3.PublicKey

Example:

import { candypay } from "@candypay/sdk";

const ixnArray = await candypay.mint(
  "devnet",
  "GrVSy3ZRbuw5ACbwSEMsj9gULk9MW7QPK1TUYcP6nLM",
  publicKey
);

const transaction = new Transaction().add(...ixnArray.instructions);

const { blockhash } = await connection.getRecentBlockhash();

transaction.recentBlockhash = blockhash;

transaction.feePayer = publicKey;

transaction.partialSign(ixnArray["mint"]);

const confirmation = await sendTransaction(transaction, connection);

Full snippet: https://github.com/candypay/sdk/blob/main/examples/solana-wallet-adapter/components/SendTxnButton.tsx

candypay.gasless()

The candypay.gasless() function would generate required instructions by which the user can mint NFTs without paying any gas fees or mint price. Gas fees here will be payed by the developer/platform by passing their keypair.

Parameters:

  • network: The Candy Machine's network, either mainnet-beta or devnet.
  • candyMachineID: The ID of the Candy Machine.
  • user: The public key of the user who would mint the NFTs. In the case of this function, it would be the public key of the end-user. The type of this parameter is anchor.web3.PublicKey
  • payer: The public key of the user who would pay the gas fees for the user. The type of this parameter is anchor.web3.PublicKey

Example:

import { candypay } from "@candypay/sdk";

const ixnArray = await candypay.gasless(
  "devnet",
  "GrVSy3ZRbuw5ACbwSEMsj9gULk9MW7QPK1TUYcP6nLM",
  payerAddress,
  publicKey
);

const transaction = new Transaction().add(...ixnArray.instructions);

const { blockhash } = await connection.getRecentBlockhash();

transaction.recentBlockhash = blockhash;

transaction.feePayer = payerAddress;

transaction.partialSign(ixnArray["mint"], payerKeypair);

const confirmation = await sendTransaction(transaction, connection);

Full snippet: https://github.com/candypay/sdk/blob/main/examples/solana-wallet-adapter/components/SendTxnGasless.tsx

Using the SDK with Next.js

Using our SDK with Next.js can sometimes run in build time error cause of Anchor library using the node native "fs" module. We highly recommend adding this export in next.config.js file before deployment:

module.exports = {
  webpack: (config, { isServer }) => {
    if (!isServer) {
      config.resolve.fallback.fs = false;
    }
    return config;
  },
};

Get in Touch

You might also like...

Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

Jan 3, 2023

🐲 Epic NFTs [UI] - Proyecto que te permitirá conectar tu billetera y acuñar un NFT, podrás revender el NFT en OpenSea. El NFT en sí se puede personalizar

🐲 Epic NFTs [UI] - Proyecto que te permitirá conectar tu billetera y acuñar un NFT, podrás revender el NFT en OpenSea. El NFT en sí se puede personalizar

🐲 Epic NFTs [UI] El proyecto se encuentra deployado en Vercel para que puedan verlo e interactuar con él, toda crítica o comentario se agradece, pued

Oct 22, 2022

Fullstack Dynamic NFT Mini Game built using 💎 Diamond Standard [EIP 2535] 🏃‍♀️Players can use Hero NFT to battle against Thanos ⚔ Heroes can be Healed by staking their NFT 🛡

Fullstack Dynamic NFT Mini Game built using 💎 Diamond Standard [EIP 2535]  🏃‍♀️Players can use Hero NFT to battle against Thanos ⚔ Heroes can be Healed by staking their NFT 🛡

💎 Fullstack Dynamic NFT Mini Game 🎮 💎 Using Diamond Standard Play On 💎 🎮 ⏩ http://diamond-dapp.vercel.app/ Project Description 📝 Fullstack Dynam

Dec 23, 2022

NFT Marketplace framework to build standalone NFT marketplace or inApp/inGame NFT marketplace

NFT Marketplace This project is a decentalized NFT Marketplace framework which is to be the baseline for you to build standalone NFT marketplace or in

Dec 19, 2022

Bootstrap an NFT minting site with Merkle tree whitelists.

🖌️ nft-merkle-whitelist-scaffold Bootstrap an NFT minting site with merkle tree whitelists. Go to nft-merkle-whitelist.vercel.app to see the latest d

Dec 24, 2022

This is NFT minting and marketplace website.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Oct 10, 2022

Elven Tools Dapp - Elrond blockckchain frontend dapp demo. Primarily for NFT minting, but it can be used for other purposes.

Elven Tools Dapp Docs: elven.tools/docs/landing-page.html Demo: dapp-demo.elven.tools Sneak peek: youtu.be/ATSxD3mD4dc The Dapp is built using Nextjs

Jan 1, 2023

Ethereum NFT minting bot 🍌 🔥

Mineth – Open source Ethereum bot for minting NFTs. This repository provides a code for deploying it on server and calling from your local network. Fo

Aug 6, 2022

Use signature-based minting to allow users who have contributed to your github repositories to claim an NFT!

GitHub contributors NFT rewards This project demonstrates how you can build a full-stack web3 application that allows github contributors of certain r

Nov 5, 2022
Releases(1.1.0)
  • 1.1.0(Nov 3, 2022)

    What's Changed

    • Fix mainnet-beta RPC URL by @JuanRdBO in https://github.com/candypay/sdk/pull/1
    • Better types and robust SDK API
    • The SDK now returns much information regarding the transaction, take a look at the latest docs over https://github.com/candypay/sdk#readme

    Breaking Changes

    • The mint module has been renamed to candyMachine module.

      // Before
      const { instructions, mint } = await sdk.mint.mint({
        candyMachineID: "GrVSy3ZRbuw5ACbwSEMsj9gULk9MW7QPK1TUYcP6nLM",
        network: "devnet",
        payer,
      });
      
      // After
      const { transaction, mint } = await sdk.candyMachine.mint({
        candyMachineId: new anchor.web3.PublicKey("GrVSy3ZRbuw5ACbwSEMsj9gULk9MW7QPK1TUYcP6nLM"),
        network: "devnet",
        user: anchor.web3.Keypair.fromSecretKey(base58.decode(process.env.PAYER_SECRET_KEY!)),
      });
      
    • The candyMachine module's functions now return the transaction object instead of the instructions object

    New Contributors

    • @JuanRdBO made their first contribution in https://github.com/candypay/sdk/pull/1
    Source code(tar.gz)
    Source code(zip)
Owner
Candy Pay
The next generation NFT minting experience, levering Solana Pay
Candy Pay
Yet another library for generating NFT artwork, uploading NFT assets and metadata to IPFS, deploying NFT smart contracts, and minting NFT collections

eznft Yet another library for generating NFT artwork, uploading NFT assets and metadata to IPFS, deploying NFT smart contracts, and minting NFT collec

null 3 Sep 21, 2022
Solana blockchain candy machine app boilerplate on top of Metaplex Candy Machine. NextJS, Tailwind, Anchor, SolanaLabs.React, dev/mainnet automation scripts.

NFT Candy Factory NOTE: This repo will prob only work on unix-based environments. The NFT Candy Factory project is designed to let users fork, customi

Kevin Faveri 261 Dec 30, 2022
This repo contains instructions on how to create your NFT in Solana(using Metaplex and Candy Machine) and mint it using your custom front-end Dapp

Solana-NFT minting Dapp Create your own NFT's on Solana, and mint them from your custom front-end Dapp. Tools used Metaplex -> Metaplex is the NFT sta

Udit Sankhadasariya 12 Nov 2, 2022
Candy Shop is a JavaScript library that allows DAOs, NFT projects and anyone to create an NFT marketplace on Solana in minutes!

Candy Shop (IN BETA) Intro Candy Shop is a JavaScript library that allows DAOs, NFT projects and anyone to create an NFT marketplace on Solana in minu

LIQNFT 111 Dec 15, 2022
The Basement SDK has sensible defaults and flexibility to allow you to get the data you want efficiently and effortlessly.

Basement SDK The Basement SDK has sensible defaults and flexibility to allow you to get the data you want efficiently and effortlessly. Installation B

Basement for Developers 10 Dec 6, 2022
Create your own custom NFT minting page using thirdweb's NFT Drop contract

Customizable NFT Drop Minting Page In this example, you can create your own NFT Drop minting page just by customising the template with your branding,

thirdweb examples 59 Dec 24, 2022
Get any Candy Machine ID in seconds with this npm module!

What Does it do? Grabs Candy Machine ID of any v1 or v2 candy machine websites. Installation npm i candymachinescraper --save Example Usage // Get Can

Oscar Gomez 9 Oct 26, 2022
Wonka JS is the easiest way to mint Metaplex's Candy Machine NFTs with APIs.

Wonka JS Wonka JS is the easiest way to mint from Candy Machine and fetch NFTs through JS APIs. You can see an end to end example in Next.js demo proj

Wonka Labs 71 Nov 3, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022