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

Overview

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, customize, and deploy their own candy machine mint app to a custom domain, ultra fast.

A candy machine is an on-chain Solana program for managing fair mint. Fair mints:

  • Start and finish at the same time for everyone.
  • Won't accept your funds if they're out of NFTs to sell.

It builds on top of the the work started at https://github.com/exiled-apes/candy-machine-mint, abstracting away a few things (like having one-command shortcuts in the package.json that instantly setups dev env), improving DX and adding new tools for managing the source files.

Techwise, it builds on top of NextJS and TailwindCSS for the frontend (as well as Solana Labs toolchain and Serum Anchor libs for interacting with the Solana network); and Metaplex and Solana clis for deployment on the Solana network. It also adds Strapi as the nft-manager which is in reality used just as a UI for managing the JSON and PNG files. More details below.

Step-by-step tutorial

Check out this awesome guide by @nheingit which uses this repo and teaches how to ship your own Candy Machine: https://www.quicknode.com/guides/web3-sdks/how-to-mint-an-nft-on-solana-using-candy-machine

Getting Set Up

Prerequisites

  • Ensure you have recent versions of both node and yarn installed.

  • Follow the instructions here to install the Solana Command Line Toolkit.

  • Follow the instructions here to install the Metaplex Command Line Utility.

    • Installing the Command Line Package is currently an advanced task that will be simplified eventually.

NFT Manager

! NOTE: Be sure to an instance of postgresql running on port 6432. For ease of use, one is provided using docker + docker-compose by running yarn start-nft-manager-db

This repo features an NFT manager so you do not need to create all nfts by editing a JSON file that is powered by Strapi. Just run yarn nft-manager and add:

  • A collection
  • An NFT that links to that collection

! NOTE: Be sure to create an user, after you login with the admin account, that has the role "authenticated", username "admin" and pass "Admin123", as well as add all collections and upload related permissions to the "authenticated" role; otherwise, the yarn update-creator-all-rows and yarn generate-nft-sources commands will not work.

Then you are good to go: run yarn generate-nft-sources for generating the JSON and PNG files in the nfts-sources folder in the root of the project. Following that, you can go for deployment on production (section below) OR test it in dev using yarn setup-dev.

NFT Manager form default values

You are able to change the NFT manager form default values by editing the file ./nft-manager/api/nf-ts/models/nf-ts.settings.json.

Available Scripts

In the project root directory, you can run:

  • yarn nft-manager -- Setup development server of the NFT-Manager, which is a UI for managing all NFTs.

! - The following commands of the nft-manager needs the nft-manager running, so be sure to run yarn nft-manager before running them:

  • yarn update-creator-all-rows -- Set a new creator address to all NFT rows
  • yarn generate-nfts-sources -- Generate nft source files based on the nft-manager data; allow to generate randomized or DB index order

  • yarn setup-dev -- Setup development environment: needs solana and metaplex cli installed (it will create a new Solana wallet, drop some sols there, and upload the resources to the devnet Metaplex program, making it ready to test using yarn dev...). This command automatically generates the .env.local file for you with the start date, candy machine addresses, and treasury addresses.

Note: you still need to run yarn generate-nfts-sources for it to work.

ALERT: Running this command will replace your Solana devwallet generated before at ~/.config/solana/candyfactory-devnet.json as well as all previous environment stuff you had, like your .env.local. It is a nuke solution for resetting development environment. If you already have the setup done use the scripts declared in this command or tweak them (they are available in the devtools folder in the root of the project)

  • yarn dev -- Run NextJS devserver; it features a modal for connecting with Phantom, Solflare and Sollet (more can be added using the Solana Labs wallet library); minting of the NFT; success/error messages; and UI countdown based on the candy machine start date.

  • yarn deploy-mainnet -- Setup production environment: needs Solana and Metaplex cli installed. Refer to the #Deployment section below.
  • yarn build -- Bundle for production environment
  • yarn start -- Start production build project

Deployment

  • Don't forget to use the wallet you want to earn the mint value for both metaplex uploading (yarn deploy-mainnet) and in the NFT's creators.address[0] (NFT-Manager properties editor of a specific NFT) for earning the royaties.
  • You still need to run yarn generate-nfts-sources if you have not created the source files yet
  • You should have all your NFTs ready before deploying. Incremental deploying of NFTs is not supported right now. Feel free to add a PR tho if you find a solution for this

For deploying your collection on the mainnet just run yarn deploy-mainnet and answer the questions as prompted. It will store your wallet key in our path: ~/.config/solana/candyfactory-mainnet.json (if you want to edit that just tweak setup-solana-mainnet.sh). It is the same process as used for the development environment but asking for importing a Wallet PK (that should have enough SOLs and will be the one that will receive the mint value).

After the deployment is over, it will generate all envs that your frontend dApp needs in a file called .env.local.production in the root of the project. These env values should then be added as environment variables where you build your dAapp (if Vercel, you need to add to their ENVIROMENT VARIABLES config section).

Donate

The best way to support me is by minting one city at the project that started it all: https://worldcities.aiphotos.art/

Also, if possible, follow me on https://twitter.com/kevinfaveri_ and https://twitter.com/aiphotos_ (which is the art project that inspired this repository) :)

Hire

If you want to hire me to develop your candy machine application on the Solana or Ethereum blockchain feel free to reach me through the email [email protected]

Comments
  • yarn setup-dev displaying errors

    yarn setup-dev displaying errors

    Hi Kevin, thank you for taking your time to share knowledge and hence prepare the solana nft candy factory. I have everything working fine but when i run 'yarn set-dev' i run into the error below.

    PS C:\Users\user\Desktop\nft_sol\solana-candy-factory> yarn setup-dev yarn run v1.22.5 $ yarn setup-solana-dev && yarn setup-metaplex-dev && yarn setup-envs-dev $ ./devtools/dev/setup-solana-dev.sh $ node ./devtools/dev/setup-metaplex-dev.js Type mint price [default 1 sol]: Type start date of the minting [default 16 Sep 2021 00:00:00]: 'sh' is not recognized as an internal or external command, operable program or batch file. $ node ./devtools/dev/setup-envs-dev.js C:\Users\user\Desktop\nft_sol\solana-candy-factory\devtools\dev\setup-envs-dev.js:33 NEXT_PUBLIC_TREASURY_ADDRESS = fileContent.toString().split('\n')[4].split(' ')[1].trim(); ^

    TypeError: Cannot read property 'split' of undefined at C:\Users\user\Desktop\nft_sol\solana-candy-factory\devtools\dev\setup-envs-dev.js:33:75 at Array.forEach () at C:\Users\user\Desktop\nft_sol\solana-candy-factory\devtools\dev\setup-envs-dev.js:13:9 at FSReqCallback.oncomplete (fs.js:180:23) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

    opened by advanztek 20
  • Buffer overrun (re-open)

    Buffer overrun (re-open)

    Hi Kevin! I got this error when I tried deploying mainnet for 10 items. Writing indices 0-9 saving config line 0-9 failed RangeError: encoding overruns Buffer at Blob.encode... I noticed a similar problem on devnet, where I could only batch 8 items at one time.

    I have not deleted the cache for mainnet. I was charged a bit of Sol as well. What should I do next?

    I am reading the other issue on restarting uploads.

    opened by edwinzeng2005 19
  • Cannot read property 'trim' of undefined when running yarn setup-dev

    Cannot read property 'trim' of undefined when running yarn setup-dev

    Hello,

    Loving your project.

    When running yarn setup-dev i get the error Cannot read property 'trim' of undefined

    It's coming from around line 26 /devtools/dev/setup-envs-dev.js and looks like /logs/dev/candy-machine-start-date.txt is not being populated by the update_candy_machine command.

    everything else seems to be working smoothly!

    opened by ZEAL-MATCH-LTD 14
  • Upload was not successful, rerunning

    Upload was not successful, rerunning

    Hi @kevinfaveri, thanks for your great effort on this project.

    I run into this error after uploading and about 6 SOL has already been deducted. However I deployed it on the devnet and everything worked fine.

    Writing indices 1720-1729 Writing indices 730-739 Writing indices 1730-1739 Writing indices 740-749 Writing indices 1740-1749 Writing indices 750-759 Writing indices 1750-1759 Writing indices 760-769 Writing indices 1760-1769 Writing indices 770-779 Writing indices 1770-1779 Writing indices 780-789 Writing indices 1780-1789 Writing indices 790-799 Writing indices 1790-1799 Writing indices 800-809 Writing indices 1800-1809 Writing indices 810-819 Writing indices 1810-1819 Writing indices 820-829 Writing indices 1820-1829 Writing indices 830-839 Writing indices 1830-1839 Writing indices 840-849 Writing indices 1840-1849 Writing indices 850-859 Writing indices 1850-1859 Writing indices 860-869 Writing indices 1860-1869 Writing indices 870-879 Writing indices 1870-1879 Writing indices 880-889 Writing indices 1880-1889 Writing indices 890-899 Writing indices 1890-1899 Writing indices 900-909 Writing indices 1900-1909 Writing indices 910-919 Writing indices 1910-1919 Writing indices 920-929 Writing indices 1920-1929 Writing indices 930-939 Writing indices 1930-1939 Writing indices 940-949 Writing indices 1940-1949 Writing indices 950-959 Writing indices 1950-1959 Writing indices 960-969 Writing indices 1960-1969 Writing indices 970-979 Writing indices 1970-1979 Writing indices 980-989 Writing indices 1980-1989 Writing indices 990-999 Writing indices 1990-1999 Done. Successful = false.

    Please what should I do right now. Am really frustrated. THank you.

    opened by advanztek 12
  • Reopen - Update-creator-all-rows promise rejection

    Reopen - Update-creator-all-rows promise rejection

    Originally posted by @kevinfaveri in https://github.com/kevinfaveri/solana-candy-factory/issues/16#issuecomment-929708622

    Reopening. It definitely is different. Permissions should be fine.

    C:\Users\XXXXXX\Documents\GitHub\solana-candy-factory>yarn update-creator-all-rows yarn run v1.22.10 $ cd ./nft-manager && yarn update-creator-all-rows $ node ./scripts/update-creator-all-rows (node:21136) UnhandledPromiseRejectionWarning: Error at Strapi.request (C:\Users\XXXXXX\Documents\GitHub\solana-candy-factory\nft-manager\node_modules\strapi-sdk-javascript\build\main\lib\sdk.js:59:23) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async Strapi.login (C:\Users\XXXXXX\Documents\GitHub\solana-candy-factory\nft-manager\node_modules\strapi-sdk-javascript\build\main\lib\sdk.js:93:32) at async updateCreatorAllRows (C:\Users\XXXXXX\Documents\GitHub\solana-candy-factory\nft-manager\scripts\update-creator-all-rows.js:32:3) (Use node --trace-warnings ... to show where the warning was created) (node:21136) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:21136) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. Done in 0.34s.

    I pulled fork starting from 4676f11b11f806db8ba42c69c8591922e4fcef05

    Will leave this here too:

    image

    opened by atomicstorm-hca 12
  • Error when running yarn update-creator-all-rows

    Error when running yarn update-creator-all-rows

    I get this error when running the update-creator command.

    $ node ./scripts/update-creator-all-rows (node:3303) UnhandledPromiseRejectionWarning: Error: [object Object] at Strapi.request (/root/solana-candy-factory/nft-manager/node_modules/strapi-sdk-javascript/build/main/lib/sdk.js:59:23) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async Strapi.login (/root/solana-candy-factory/nft-manager/node_modules/strapi-sdk-javascript/build/main/lib/sdk.js:93:32) at async updateCreatorAllRows (/root/solana-candy-factory/nft-manager/scripts/update-creator-all-rows.js:32:3) (Use node --trace-warnings ... to show where the warning was created) (node:3303) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:3303) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. Done in 0.47s.

    Not sure why.

    opened by smwein 12
  • Strapi Not Found

    Strapi Not Found

    Hi!

    When I got to run "yarn nft-manager" I get the following error:

    "Error loading the local develop command. Strapi might not be installed in your "node_modules". You may need to run "npm install" error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command."

    I have Strapi installed. Not sure what I'm doing wrong. Thanks for any help!

    opened by BigPappy098 10
  • Upload failed after 1200 successful ones

    Upload failed after 1200 successful ones

    Received this after only 1200 files uploaded and it still charged me 18 SOL??? Is this SOL lost or are these images still usable? How do I use them and upload the rest?

    \node_modules\rpc-websockets\dist\lib\client.js:392 this.socket.close(code || 1000, data); ^ TypeError: Cannot read properties of undefined (reading 'close') at Client.close (C:\Users\gagew\metaplex\js\node_modules\rpc-websockets\dist\lib\client.js:392:19) at Timeout._onTimeout (C:\Users\gagew\metaplex\js\node_modules@solana\web3.js\src\connection.ts:3820:30) at listOnTimeout (node:internal/timers:557:17) at processTimers (node:internal/timers:500:7)

    opened by gw19191 7
  • 'yarn setup-dev' upload always fails.

    'yarn setup-dev' upload always fails.

    When running yarn setup-dev after generating my sources, I get a loop of the same error. I have let this sit for several minutes and it always fails. I've ran it multiple times with the same process and I have never gotten it to work.

    It seems like a Cloud Function is throwing an exception. Can we run this function locally instead, and is it open source?

    upload was not successful, rerunning
    Error uploading file 3 FetchError: invalid json response body at https://us-central1-principal-lane-200702.cloudfunctions.net/uploadFile4 reason: Unexpected token E in JSON at position 0
        at /snapshot/js/node_modules/node-fetch/lib/index.js:272:32
        at runMicrotasks (<anonymous>)
        at processTicksAndRejections (internal/process/task_queues.js:95:5) {
      type: 'invalid-json'
    }
    Transaction simulation failed: Error processing Instruction 0: Program failed to complete 
        Program cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ invoke [1]
        Program log: libstd rust_begin_panic
        Program log: panicked at 'range end index 971 out of range for slice of length 255', nft-candy-machine/src/lib.rs:318:18
        Program cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ consumed 200000 of 200000 compute units
        Program failed to complete: BPF program panicked
        Program cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ failed: Program failed to complete
    saving config line 0-2 failed SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Program failed to complete
        at Connection.sendEncodedTransaction (/snapshot/js/node_modules/@solana/web3.js/lib/index.cjs.js:4863:13)
        at runMicrotasks (<anonymous>)
        at processTicksAndRejections (internal/process/task_queues.js:95:5)
        at async Connection.sendRawTransaction (/snapshot/js/node_modules/@solana/web3.js/lib/index.cjs.js:4822:20)
        at async Object.sendAndConfirmRawTransaction (/snapshot/js/node_modules/@solana/web3.js/lib/index.cjs.js:6649:21)
        at async Provider.send (/snapshot/js/node_modules/@project-serum/anchor/dist/cjs/provider.js:84:22)
        at async Object.rpc [as addConfigLines] (/snapshot/js/node_modules/@project-serum/anchor/dist/cjs/program/namespace/rpc.js:11:31) {
      logs: [
        'Program cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ invoke [1]',
        'Program log: libstd rust_begin_panic',
        "Program log: panicked at 'range end index 971 out of range for slice of length 255', nft-candy-machine/src/lib.rs:318:18",
        'Program cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ consumed 200000 of 200000 compute units',
        'Program failed to complete: BPF program panicked',
        'Program cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ failed: Program failed to complete'
      ]
    }
    
    opened by fletchertyler914 7
  • i tryed to remain item counter and price viewer.

    i tryed to remain item counter and price viewer.

    \src\utils\candy-machine.ts
    import * as anchor from "@project-serum/anchor";
    
    import {
      MintLayout,
      TOKEN_PROGRAM_ID,
      Token,
    } from "@solana/spl-token";
    import { LAMPORTS_PER_SOL } from "@solana/web3.js";
    export const CANDY_MACHINE_PROGRAM = new anchor.web3.PublicKey(
      "cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ"
    );
    
    const SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = new anchor.web3.PublicKey(
      "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
    );
    
    const TOKEN_METADATA_PROGRAM_ID = new anchor.web3.PublicKey(
      "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
    );
    
    export interface CandyMachine {
      id: anchor.web3.PublicKey,
      connection: anchor.web3.Connection;
      program: anchor.Program;
    }
    
    interface CandyMachineState {
      candyMachine: CandyMachine;
      itemsAvailable: number;
      itemsRedeemed: number;
      itemsRemaining: number;
      goLiveDate: Date,
      price: number,
    }
    
    export const awaitTransactionSignatureConfirmation = async (
      txid: anchor.web3.TransactionSignature,
      timeout: number,
      connection: anchor.web3.Connection,
      commitment: anchor.web3.Commitment = "recent",
      queryStatus = false
    ): Promise<anchor.web3.SignatureStatus | null | void> => {
      let done = false;
      let status: anchor.web3.SignatureStatus | null | void = {
        slot: 0,
        confirmations: 0,
        err: null,
      };
      let subId = 0;
      status = await new Promise(async (resolve, reject) => {
        setTimeout(() => {
          if (done) {
            return;
          }
          done = true;
          console.log("Rejecting for timeout...");
          reject({ timeout: true });
        }, timeout);
        try {
          subId = connection.onSignature(
            txid,
            (result: any, context: any) => {
              done = true;
              status = {
                err: result.err,
                slot: context.slot,
                confirmations: 0,
              };
              if (result.err) {
                console.log("Rejected via websocket", result.err);
                reject(status);
              } else {
                console.log("Resolved via websocket", result);
                resolve(status);
              }
            },
            commitment
          );
        } catch (e) {
          done = true;
          console.error("WS error in setup", txid, e);
        }
        while (!done && queryStatus) {
          // eslint-disable-next-line no-loop-func
          (async () => {
            try {
              const signatureStatuses = await connection.getSignatureStatuses([
                txid,
              ]);
              status = signatureStatuses && signatureStatuses.value[0];
              if (!done) {
                if (!status) {
                  console.log("REST null result for", txid, status);
                } else if (status.err) {
                  console.log("REST error for", txid, status);
                  done = true;
                  reject(status.err);
                } else if (!status.confirmations) {
                  console.log("REST no confirmations for", txid, status);
                } else {
                  console.log("REST confirmation for", txid, status);
                  done = true;
                  resolve(status);
                }
              }
            } catch (e) {
              if (!done) {
                console.log("REST connection error: txid", txid, e);
              }
            }
          })();
          await sleep(2000);
        }
      });
    
      //@ts-ignore
      if (connection._signatureSubscriptions[subId]) {
        connection.removeSignatureListener(subId);
      }
      done = true;
      console.log("Returning status", status);
      return status;
    }
    
    /* export */ const createAssociatedTokenAccountInstruction = (
      associatedTokenAddress: anchor.web3.PublicKey,
      payer: anchor.web3.PublicKey,
      walletAddress: anchor.web3.PublicKey,
      splTokenMintAddress: anchor.web3.PublicKey
    ) => {
      const keys = [
        { pubkey: payer, isSigner: true, isWritable: true },
        { pubkey: associatedTokenAddress, isSigner: false, isWritable: true },
        { pubkey: walletAddress, isSigner: false, isWritable: false },
        { pubkey: splTokenMintAddress, isSigner: false, isWritable: false },
        {
          pubkey: anchor.web3.SystemProgram.programId,
          isSigner: false,
          isWritable: false,
        },
        { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
        {
          pubkey: anchor.web3.SYSVAR_RENT_PUBKEY,
          isSigner: false,
          isWritable: false,
        },
      ];
      return new anchor.web3.TransactionInstruction({
        keys,
        programId: SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID,
        data: Buffer.from([]),
      });
    }
    
    export const getCandyMachineState = async (
      anchorWallet: anchor.Wallet,
      candyMachineId: anchor.web3.PublicKey,
      connection: anchor.web3.Connection,
    ): Promise<CandyMachineState> => {
      const provider = new anchor.Provider(connection, anchorWallet, {
        preflightCommitment: "recent",
      });
    
      const idl = await anchor.Program.fetchIdl(
        CANDY_MACHINE_PROGRAM,
        provider
      );
    
      const program = new anchor.Program(idl, CANDY_MACHINE_PROGRAM, provider);
      const candyMachine = {
        id: candyMachineId,
        connection,
        program,
      }
      const state: any = await program.account.candyMachine.fetch(candyMachineId);
      console.log('state.data', state.data);
      const itemsAvailable = state.data.itemsAvailable.toNumber();
      const itemsRedeemed = state.itemsRedeemed.toNumber();
      const itemsRemaining = itemsAvailable - itemsRedeemed;
      const price = state.data.price.toNumber() * 0.000000001;
    
      let goLiveDate = state.data.goLiveDate.toNumber();
      goLiveDate = new Date(goLiveDate * 1000);
    
      return {
        candyMachine,
        itemsAvailable,
        itemsRedeemed,
        itemsRemaining,
        goLiveDate,
    	price,
      };
    }
    
    const getMasterEdition = async (
      mint: anchor.web3.PublicKey
    ): Promise<anchor.web3.PublicKey> => {
      return (
        await anchor.web3.PublicKey.findProgramAddress(
          [
            Buffer.from("metadata"),
            TOKEN_METADATA_PROGRAM_ID.toBuffer(),
            mint.toBuffer(),
            Buffer.from("edition"),
          ],
          TOKEN_METADATA_PROGRAM_ID
        )
      )[0];
    };
    
    const getMetadata = async (
      mint: anchor.web3.PublicKey
    ): Promise<anchor.web3.PublicKey> => {
      return (
        await anchor.web3.PublicKey.findProgramAddress(
          [
            Buffer.from("metadata"),
            TOKEN_METADATA_PROGRAM_ID.toBuffer(),
            mint.toBuffer(),
          ],
          TOKEN_METADATA_PROGRAM_ID
        )
      )[0];
    };
    
    const getTokenWallet = async (
      wallet: anchor.web3.PublicKey,
      mint: anchor.web3.PublicKey
    ) => {
      return (
        await anchor.web3.PublicKey.findProgramAddress(
          [wallet.toBuffer(), TOKEN_PROGRAM_ID.toBuffer(), mint.toBuffer()],
          SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID
        )
      )[0];
    };
    
    export const mintOneToken = async (
      candyMachine: CandyMachine,
      config: anchor.web3.PublicKey,
      payer: anchor.web3.PublicKey,
      treasury: anchor.web3.PublicKey,
    ): Promise<string> => {
      const mint = anchor.web3.Keypair.generate();
      const token = await getTokenWallet(payer, mint.publicKey);
      const { connection, program } = candyMachine;
      const metadata = await getMetadata(mint.publicKey);
      const masterEdition = await getMasterEdition(mint.publicKey);
    
      const rent = await connection.getMinimumBalanceForRentExemption(
        MintLayout.span
      );
    
      return await program.rpc.mintNft({
        accounts: {
          config,
          candyMachine: candyMachine.id,
          payer: payer,
          wallet: treasury,
          mint: mint.publicKey,
          metadata,
          masterEdition,
          mintAuthority: payer,
          updateAuthority: payer,
          tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID,
          tokenProgram: TOKEN_PROGRAM_ID,
          systemProgram: anchor.web3.SystemProgram.programId,
          rent: anchor.web3.SYSVAR_RENT_PUBKEY,
          clock: anchor.web3.SYSVAR_CLOCK_PUBKEY,
        },
        signers: [mint],
        instructions: [
          anchor.web3.SystemProgram.createAccount({
            fromPubkey: payer,
            newAccountPubkey: mint.publicKey,
            space: MintLayout.span,
            lamports: rent,
            programId: TOKEN_PROGRAM_ID,
          }),
          Token.createInitMintInstruction(
            TOKEN_PROGRAM_ID,
            mint.publicKey,
            0,
            payer,
            payer
          ),
          createAssociatedTokenAccountInstruction(
            token,
            payer,
            payer,
            mint.publicKey
          ),
          Token.createMintToInstruction(
            TOKEN_PROGRAM_ID,
            mint.publicKey,
            token,
            payer,
            [],
            1
          ),
        ],
      });
    }
    
    export const shortenAddress = (address: string, chars = 4): string => {
      return `${address.slice(0, chars)}...${address.slice(-chars)}`;
    };
    
    const sleep = (ms: number): Promise<void> => {
      return new Promise((resolve) => setTimeout(resolve, ms));
    }`
    
    `
    \src\hooks\use-candy-machine.ts
    
    import { useEffect, useState } from "react";
    import * as anchor from "@project-serum/anchor";
    import { awaitTransactionSignatureConfirmation, CandyMachine, getCandyMachineState, mintOneToken } from "../utils/candy-machine";
    import { useWallet } from "@solana/wallet-adapter-react";
    import toast from 'react-hot-toast';
    import useWalletBalance from "./use-wallet-balance";
    import { LAMPORTS_PER_SOL } from "@solana/web3.js";
    
    const treasury = new anchor.web3.PublicKey(
      process.env.NEXT_PUBLIC_TREASURY_ADDRESS!
    );
    
    const config = new anchor.web3.PublicKey(
      process.env.NEXT_PUBLIC_CANDY_MACHINE_CONFIG!
    );
    
    const candyMachineId = new anchor.web3.PublicKey(
      process.env.NEXT_PUBLIC_CANDY_MACHINE_ID!
    );
    
    const rpcHost = process.env.NEXT_PUBLIC_SOLANA_RPC_HOST!;
    const connection = new anchor.web3.Connection(rpcHost);
    
    const txTimeout = 30000;
    
    export default function useCandyMachine() {
      const [, setBalance] = useWalletBalance()
      const [candyMachine, setCandyMachine] = useState<CandyMachine>();
      const wallet = useWallet();
      const [isMinting, setIsMinting] = useState(false); // true when user got to press MINT
      const [isSoldOut, setIsSoldOut] = useState(false); // true when items remaining is zero
      const [counter, setCounter] = useState<any>({});
      const [price, setPrice] = useState<number | null>(null);
      const [mintStartDate, setMintStartDate] = useState(new Date(parseInt(process.env.NEXT_PUBLIC_CANDY_START_DATE!, 10)));
    
      useEffect(() => {
        (async () => {
          if (
            !wallet ||
            !wallet.publicKey ||
            !wallet.signAllTransactions ||
            !wallet.signTransaction
          ) {
            return;
          }
    
          const anchorWallet = {
            publicKey: wallet.publicKey,
            signAllTransactions: wallet.signAllTransactions,
            signTransaction: wallet.signTransaction,
          } as anchor.Wallet;
    
          const { candyMachine, goLiveDate, itemsRemaining, itemsAvailable, price } =
            await getCandyMachineState(
              anchorWallet,
              candyMachineId,
              connection
            );
    
          setIsSoldOut(itemsRemaining === 0);
          setMintStartDate(goLiveDate);
          setCandyMachine(candyMachine);
          setCounter({
            itemsRemaining,
            itemsAvailable
          });
          setPrice(price);
        })();
      }, [wallet, candyMachineId, connection]);
    
      const onMint = async () => {
        try {
          setIsMinting(true);
          if (wallet.connected && candyMachine?.program && wallet.publicKey) {
            const mintTxId = await mintOneToken(
              candyMachine,
              config,
              wallet.publicKey,
              treasury
            );
    
            const status = await awaitTransactionSignatureConfirmation(
              mintTxId,
              txTimeout,
              connection,
              "singleGossip",
              false
            );
    
            if (!status?.err) {
              toast.success("Congratulations! Mint succeeded!")
            } else {
              toast.error("Mint failed! Please try again!")
            }
          }
        } catch (error: any) {
          let message = error.msg || "Minting failed! Please try again!";
          if (!error.msg) {
            if (error.message.indexOf("0x138")) {
            } else if (error.message.indexOf("0x137")) {
              message = `SOLD OUT!`;
            } else if (error.message.indexOf("0x135")) {
              message = `Insufficient funds to mint. Please fund your wallet.`;
            }
          } else {
            if (error.code === 311) {
              message = `SOLD OUT!`;
              setIsSoldOut(true);
            } else if (error.code === 312) {
              message = `Minting period hasn't started yet.`;
            }
          }
          toast.error(message)
        } finally {
          if (wallet?.publicKey) {
            const balance = await connection.getBalance(wallet?.publicKey);
            setBalance(balance / LAMPORTS_PER_SOL);
          }
          setIsMinting(false);
        }
      };
    
    
      return { isSoldOut, mintStartDate, isMinting, onMint }
    }`
    
    `
    \src\pages\mint.tsx
    
    import Head from 'next/head'
    import { Navbar } from '../components/Navbar';
    import { useState } from "react";
    import { Toaster } from 'react-hot-toast';
    import { useWallet } from "@solana/wallet-adapter-react";
    
    import {
      shortenAddress,
    } from "../utils/candy-machine";
    import useCandyMachine from '../hooks/use-candy-machine';
    import useWalletBalance from '../hooks/use-wallet-balance';
    import Countdown from 'react-countdown';
    import { WalletMultiButton } from '@solana/wallet-adapter-react-ui';
    
    
    const Mint = () => {
      const [balance] = useWalletBalance()
      const [isActive, setIsActive] = useState(false); // true when countdown completes
      const wallet = useWallet();
      const [counter, setCounter] = useState<any>({});
      const [price, setPrice] = useState<number | null>(null);
      const { isSoldOut, mintStartDate, isMinting, onMint } = useCandyMachine()
    
      return (
        <main className="">
          <Toaster />
          <Head>
            <title>Solana Candy Machine</title>
            <meta name="description" content="Solana Candy Machine is an open-source project using NextJS, 
              Metaplex protocol which serve as an example app for a NFT candy machine app." />
            <link rel="icon" href="/favicon.ico" />
          </Head>
    	  <Navbar />
    	  <div>
              <br />
    	  {!!counter && (
            <>
              Items available: {counter.itemsRemaining} / {counter.itemsAvailable}
              <br />
              <br />
              <br />
              <br />
            </>
          )}
    	  </div>
          <div className="flex justify-center">
            {wallet.connected &&
              <button className="px-8 py-1.5 rounded bg-blue-400 text-white font-bold hover:bg-blue-600 hover:text-white"
                disabled={isSoldOut || isMinting || !isActive}
                onClick={onMint}
              >
                {isSoldOut ? (
                  "SOLD OUT"
                ) : isActive ?
                  <span>MINT {price} Sol {isMinting && ""}</span> :
                  <Countdown
                    date={mintStartDate}
                    onMount={({ completed }) => completed && setIsActive(true)}
                    onComplete={() => setIsActive(true)}
                    renderer={renderCounter}
                  />
                }
              </button>
            }
          </div>
        </main>
      );
    };
    
    const renderCounter = ({ days, hours, minutes, seconds, completed }: any) => {
      return (
        <span>
          {hours} hours, {minutes} minutes, {seconds} seconds
        </span>
      );
    };
    
    export default Mint;
    
    
    
    `
    
    but not work...
    opened by Cyncra 6
  • Issue while uploading ~700 files

    Issue while uploading ~700 files

    Hi,

    I am getting the following error while uploading :

    Writing indices 670-678 saving config line 660-669 failed ProgramError: at Function.parse (E:\Blockchains\Solana\Libraries\metaplex\js\node_modules@project-serum\anchor\src\error.ts:30:14) at Object.rpc [as addConfigLines] (E:\Blockchains\Solana\Libraries\metaplex\js\node_modules@project-serum\anchor\src\program\namespace\rpc.ts:23:42) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:95:5) { code: 303, msg: 'Index greater than length!'

    Can anyone help?

    opened by rohanm19 5
  • Hello! Having A Buffer OverFlow issue// Can't Recall To See Where I am Going Wrong.

    Hello! Having A Buffer OverFlow issue// Can't Recall To See Where I am Going Wrong.

    This is the HASHLIPS naming Function, Not sure if it related to my name being long? const basePath = process.cwd(); const { MODE } = require(${basePath}/constants/blend_mode.js); const { NETWORK } = require(${basePath}/constants/network.js);

    const network = NETWORK.sol;

    // General metadata for Ethereum ->Section is Cross PlatForm const namePrefix = "Creatures"; const description = "Deply Sol"; const baseUri = "ipfs://NewUriToReplace"; //BaseURI is not important in SOL

    const solanaMetadata = { symbol: "TCC", seller_fee_basis_points: 350, // Define how much % you want from secondary market sales 1000 = 10% external_url: "https://www.youtube.com/c/hashlipsnft", //Creator Section get's fee split Between Addresses Account's creators: [ { address: "", share: 100, }, ], };

    // If you have selected Solana then the collection starts from 0 automatically const layerConfigurations = [ { growEditionSizeTo: 99, layersOrder: [ { name: "Background" }, { name: "Eyeball" }, { name: "Eye color" }, { name: "Iris" }, { name: "Shine" }, { name: "Bottom lid" }, { name: "Top lid" }, ], }, ];

    Writing indices 0-9 saving config line 0-9 failed RangeError: encoding overruns Buffer at Blob.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:2325:13) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1113:25 at Array.reduce (<anonymous>) at Sequence.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1112:22) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) Writing indices 10-19 saving config line 10-19 failed RangeError: encoding overruns Buffer at Blob.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:2325:13) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1113:25 at Array.reduce (<anonymous>) at Sequence.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1112:22) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) Writing indices 20-29 saving config line 20-29 failed RangeError: encoding overruns Buffer at Blob.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:2325:13) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1113:25 at Array.reduce (<anonymous>) at Sequence.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1112:22) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) Writing indices 30-39 saving config line 30-39 failed RangeError: encoding overruns Buffer at Blob.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:2325:13) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1113:25 at Array.reduce (<anonymous>) at Sequence.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1112:22) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) Writing indices 40-49 saving config line 40-49 failed RangeError: encoding overruns Buffer at Blob.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:2325:13) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1113:25 at Array.reduce (<anonymous>) at Sequence.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1112:22) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) Writing indices 50-59 saving config line 50-59 failed RangeError: encoding overruns Buffer at Blob.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:2325:13) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1113:25 at Array.reduce (<anonymous>) at Sequence.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1112:22) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) Writing indices 60-69 saving config line 60-69 failed RangeError: encoding overruns Buffer at Blob.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:2325:13) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1113:25 at Array.reduce (<anonymous>) at Sequence.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1112:22) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) s:1263:26) at C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1113:25 at Array.reduce (<anonymous>) at Sequence.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1112:22) at Structure.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\buffer-layout\lib\Layout.js:1263:26) at WrappedLayout.encode (C:\Users\ssand\Documents\Code\Solana\metaplex-master\metaplex-master\js\node_modules\@project-serum\borsh\src\index.ts:104:24) Writing indices 90-98 Done. Successful = false. ended at: 2022-02-11T15:13:28.946Z. time taken: 00:03:48

    opened by slimmsyd 0
  • Error: ENOENT: no such file or directory, open './.cache/devnet-temp'

    Error: ENOENT: no such file or directory, open './.cache/devnet-temp'

    While running yarn setup-dev

    I'm having an issue getting this setup on Ubuntu. It looks like a file is missing. I tried creating an empty file and removing the check for the file but it creates errors for NEXT_PUBLIC_CANDY_MACHINE_CONFIG

    $ node ./devtools/dev/setup-envs-dev.js
    internal/fs/utils.js:314
        throw err;
        ^
    
    Error: ENOENT: no such file or directory, open './.cache/devnet-temp'
        at Object.openSync (fs.js:498:3)
        at Object.readFileSync (fs.js:394:35)
        at /home/ubuntu/solana-candy-factory/devtools/dev/setup-envs-dev.js:42:31
        at FSReqCallback.oncomplete (fs.js:180:23) {
      errno: -2,
      syscall: 'open',
      code: 'ENOENT',
      path: './.cache/devnet-temp'
    }
    
    opened by paul-atx 1
  • Draft: Support permissioned candymachines - Basic

    Draft: Support permissioned candymachines - Basic

    Demonstrate how to integrate a UI with a permissioned candymachine using this fork.

    TODO before merge - more testing to ensure backwards compatibility. Until the metaplex fork is merged, have a switch on the program ID, so that gated and non-gated candymachines are supported

    opened by dankelleher 3
Owner
Kevin Faveri
Always hungry Software Engineer
Kevin Faveri
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
Quickly create an anchor program from templates and setup anchor dev environment.

Create Anchor App Quickly create an anchor program from templates and setup anchor dev environment. Example Installation npm i -g @create-anchor-app/c

null 24 Nov 28, 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
NFT vending machine proof of concept built on Solana Pay, Metaplex, Phantom Mobile and Next.js.

Solana NFT Vending Machine This is a proof of concept of an NFT vending machine built using Solana Pay, Metaplex, Phantom Mobile, and Next.js. This wa

Matt Rosenzweig 55 Dec 15, 2022
solana-base-app is a base level, including most of the common features and wallet connectivity, try using `npx solana-base-app react my-app`

solana-base-app solana-base-app is for Solana beginners to get them up and running fast. To start run : run npx solana-base-app react my-app change th

UjjwalGupta49 33 Dec 27, 2022
Components and tools for building DeFi dapps on Solana + Anchor. Public domain license.

Solana DeFi Framework Components and tools for building DeFi dapps on Solana + Anchor. Public domain license. Status Pre-pre-pre-alpha. Contributing A

null 4 Mar 28, 2022
A tool for generating solana web3 clients from anchor IDLs.

anchor-client-gen Generate typescript solana web3 clients from anchor IDLs. Installation # npm $ npm install --global anchor-client-gen # yarn $ yarn

Krešimir Klas 97 Dec 17, 2022
The best Solana Program Template (No Anchor!)

The Best Solana Program Template Includes Shank/Solita SDK generation, Amman support, scripts, .github configuration, and more! Environment Setup Inst

Sammy 50 Dec 24, 2022
A full-featured Solana Metaplex Candymachine client-side library in Typescript

Candymachine Client SDK A full-featured Solana Metaplex Candymachine client-side library in Typescript Disclaimer: The SDK is currently a pre-alpha ve

Boxfish Studio 36 Nov 10, 2022
A messaging app built on top of Solana blockchain where you can store and view your messages.

Message App on Solana ?? This Message application written Rust using Anchor ⚓ Setting up the Environment: Rust Installation curl --proto '=https' --tl

Ritesh 10 Oct 2, 2022
Boilerplate starter template for a new TON blockchain project - FunC contracts, JS tests, compilation and deployment scripts

TON Starter Template - Contracts Starter template for a new TON project - FunC contracts, JS tests, compilation and deployment scripts Overview This p

TON DeFi Ecosystem 44 Dec 17, 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
HackMIT 2022. 2nd Place in Blockchain for Society sponsored by Jump Crypto. A revolutionary web application that leverages machine learning and blockchain technology to improve the crowdsourcing experience!

?? Wikisafe ?? Wikisafe is a revolutionary new crowdsourcing web application that innovates the process of crowdsourcing information. This application

Benson Liu 5 Dec 8, 2022
In this repository, I try to perform a mainnet fork and then simulate popular smart contract exploits on various DEFI Protocols using Hardhat Framework.

defiHacks_via_Hardhat 1. Alchemix Access Control Bug Any user could have called setWhitelist() to give an attacker the ability to call the harvest fun

null 34 Dec 27, 2022
Pull a smart contract from mainnet onto your local chain.

hardhat-copy hardhat-copy helps you import an Ethereum mainnet smart contract onto your local Hardhat node, enabling you to rapidly experiment with pr

Alexander Thomas 6 Aug 21, 2022
A new generation GUI automation framework for Web and Desktop Application Testing and Automation.

Clicknium-docs Clicknium is a new generation GUI automation framework for all types of applications. It provides easy and smooth developer experience

null 109 Dec 19, 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
CandyPay SDK lets you effortlessly create NFT minting functions for Candy Machine v2 collections.

@candypay/sdk CandyPay SDK lets you effortlessly create NFT minting functions for Candy Machine v2 collections. Simulate minting transactions for mult

Candy Pay 33 Nov 16, 2022
Automation scripts I use for my Bitburner gameplay videos.

Bitburner Automation Note: I release a new piece of code when I finish a video segment in the series. If it's a multi-part series, the scripts will no

Chris Rabe 68 Dec 25, 2022