Giter Club home page Giter Club logo

candy-machine-v2's Introduction

Candy Machine V2 Frontend

This is a barebones implementation of Candy Machine V2 frontend, intended for users who want to quickly get started selling Solana NFT's. Some code has been ported from the Fair Launch Protocol frontend in the Metaplex repo. This has been tested with Candy Machine programs on both devnet and mainnet-beta.

The app was built using Svelte + Vite and uses TailwindCSS for styles.

Getting started

Rename the .env.example file to .env and populate the following environment variables:

Required:

- VITE_APP_CANDY_MACHINE_ID=
- VITE_APP_SOLANA_NETWORK=
- VITE_APP_SOLANA_RPC_HOST=

Optional: Populate with your Google Analytics Measurement ID (in the format G-XXXXXXXXXX)

- VITE_APP_GOOGLE_ANALYTICS=

Example configuration

Devnet:

- VITE_APP_SOLANA_NETWORK=devnet
- VITE_APP_SOLANA_RPC_HOST=https://explorer-api.devnet.solana.com

Mainnet-beta:

- VITE_APP_SOLANA_NETWORK=mainnet-beta
- VITE_APP_SOLANA_RPC_HOST=https://api.mainnet-beta.solana.com

Edit the following variables in App.svelte to match your project:

- TITLE
- DESCRIPTION
- IMAGE_LINK
- HEADER_TITLE
- HEADER_LINK

Then run:

- yarn install
- yarn dev

Features

  • Automatically fetches items minted, total quantity and price from the candy machine state
  • Whitelist token detection and whitelist price updates
  • 'View on Solana Explorer' after transaction has been broadcasted
  • Confetti after a successful mint
  • Google Analytics tracking

candy-machine-v2's People

Contributors

alvinsga avatar psavva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

candy-machine-v2's Issues

Mint Multiple

Awesome work, thank you!!

Is it possible to enable minting multiple at a time?

Yarn dev error

when i run yarn dev no site is created
anyone have any idea?

multiple pages?

love this repo.. trying to make it work for myself but newer to dev work so bear with me if this is a dumb question.. not so much an issue.

how do I go about creating tabs like pictured here? I'd like to be able to add a few myself but am not quite sure how to do so. Are they separate components that render?

image

Newbie question-Integrating a theme

Thanks a lot for this awesome repository. I am almost done with my website and NFT project.

How can I integrate a frontend to this.
I tried buying a HTML theme and integrating but it is throwing errors when deploying to Vercel.

Thanks a lot for this release.
This is great.

getMetadata error

this block throws errors if "goLiveDate" is null

        state.data.goLiveDate.toNumber() < new Date().getTime() / 1000 &&
        (state.endSettings
          ? state.endSettings.endSettingType.date
            ? state.endSettings.number.toNumber() > new Date().getTime() / 1000
            : itemsRedeemed < state.endSettings.number.toNumber()
          : true),```

Errors while running the candy machine creation command

Hi Team,
I have been following the below article for setting up the minting website.
https://docs.metaplex.com/candy-machine-v2/creating-candy-machine

Currently, I am at the candy machine creation step but have been getting the below errors.

poorva@DESKTOP-9G4452V:/mnt/c/Users/Virtuos/Downloads/nft/metaplex$ ts-node /mnt/c/Users/Virtuos/Downloads/nft/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts upload -e devnet -k ~/.config/solana/pokemon-key.json -cp config.json -c example ./assets-pictures
/usr/lib/node_modules/ts-node/src/index.ts:820
return new TSError(diagnosticText, diagnosticCodes);
^
TSError: ⨯ Unable to compile TypeScript:
js/packages/cli/src/candy-machine-v2-cli.ts:4:10 - error TS2305: Module '"commander"' has no exported member 'InvalidArgumentError'.

4 import { InvalidArgumentError, program } from 'commander';
~~~~~~~~~~~~~~~~~~~~
js/packages/cli/src/candy-machine-v2-cli.ts:4:32 - error TS2305: Module '"commander"' has no exported member 'program'.

4 import { InvalidArgumentError, program } from 'commander';
~~~~~~~
js/packages/cli/src/candy-machine-v2-cli.ts:5:25 - error TS2307: Cannot find module '@project-serum/anchor' or its corresponding type declarations.

5 import * as anchor from '@project-serum/anchor';
~~~~~~~~~~~~~~~~~~~~~~~
js/packages/cli/src/candy-machine-v2-cli.ts:41:17 - error TS2307: Cannot find module 'loglevel' or its corresponding type declarations.

41 import log from 'loglevel';
~~~~~~~~~~

at createTSError (/usr/lib/node_modules/ts-node/src/index.ts:820:12)
at reportTSError (/usr/lib/node_modules/ts-node/src/index.ts:824:19)
at getOutput (/usr/lib/node_modules/ts-node/src/index.ts:1014:36)
at Object.compile (/usr/lib/node_modules/ts-node/src/index.ts:1322:43)
at Module.m._compile (/usr/lib/node_modules/ts-node/src/index.ts:1454:30)
at Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Object.require.extensions.<computed> [as .ts] (/usr/lib/node_modules/ts-node/src/index.ts:1458:12)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {

diagnosticCodes: [ 2305, 2305, 2307, 2307 ]
}

I tried downgrading the node versions as a part of the resolution for the above errors, but that too didn't work.

Kindly help!

Custom rpc

VITE_APP_CANDY_MACHINE_ID=
VITE_APP_SOLANA_NETWORK=
VITE_APP_SOLANA_RPC_HOST=
VITE_APP_GOOGLE_ANALYTICS=

if i dont have a custom rpc can i invalid the rpc host command?

Change monkeys

Hy, how could I change the monkeys with other images?

"blinking/flickering" page

Hy,
I edited your index.html and created my site using uikit.
I wrote my code around your minting button component<div id="app"></div> <script type="module" src="/src/main.ts"></script> <script> var global = global || window; </script>

when I test my application the page is blinking, as if it were loading several times, what is the cause of this behavior? It is like a "Flickering"

Issue with envinronment variables.

Hey there. First of all thanks for making this super cool repo!

When running "yarn dev", the site works perfect, everything works fine (minting, etc)

However, I tried to deploy the app after pushing it to my git repo. The deployment goes fine, however when I open the site it says: "An error occurred. Please check if your environment variables have been populated correctly and redeploy the application."

Any ideas of what it could be? I tried the candy-machine ID with the original candy-machine-v2 and the deploy went fine in that case.

Any help is appreciated!

Serving over HTTPS

How are you serving this over HTTPS?

When doing so with nginx as a reverse proxy, app is crashing with following error:

client.ts:28 WebSocket connection to 'wss://siteurl:3000/' failed:
(anonymous) @ client:188
client.ts:222 [vite] server connection lost. polling for restart...

vite doesn't build

I would like to try your nice app, but I am not used to work with Vite. I installed Vite using

apt-get install -y vite

When I tried to 'yarn build' the repository on my linux server I got the following message:

////////////////////////////////////////////////////////////
candy-machine-v2# yarn build
yarn run v1.22.17
$ vite build
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted
error Command failed with exit code 134.
///////////////////////////////////////////////////////////

Any suggestions how to continue? If this is not the proper channel to address this please let me know. Thank you.

Hosting over HTTPS

When hosting over https via custom domain, webpage constantly refreshing, any idea how to fix that?

Candy machine upload from images with Datahub an RPC Service

Hi everbody,
I am trying to upload my images and metadata with an apikey form Datahub, command:
npx ts-node js/packages/cli/src/candy-machine-v2-cli.ts upload -curl https://solana--devnet--rpc.datahub.figment.io/apikey/ MY APIKEY /health -e devnet -k ~/.config/solana/devnet.json -cp config.json -c boom ./assets

something is wrong with this command, output is :
errno: -4058,
syscall: 'scandir',
code: 'ENOENT',
path: 'https://solana--devnet--rpc.datahub.figment.io/apikey/ MY APIKEY /health'

can somebody please help out, its all for devnet, I d like to understand the mechanics before deploying on mainnet. Thanks in advance.

invalid date

Working fine on devnet, same configuration on mainnet says invalid date.
checked the metaplex standard for the candy machine

Node.js to v17.0.1 and issues with yarn start/ build candy-machine-ui/packages.json

I updated the script due to problems with the node.js. I found in the internet the following sollution given:
"scripts": {
"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts --openssl-legacy-provider build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"deploy:gh": "gh-pages -d ./build/ --repo https://github.com/pit-v/metaplex -t true --branch gh-pages-3",
"deploy": "cross-env ASSET_PREFIX=/metaplex/ yarn build && yarn deploy:gh"
},

Is that a good sollution? I have personally no idea. I am no developer... Greetings.

"An error occurred. Please check if your environment variables have been populated correctly and redeploy the application."

If you get this error even if your code is working fine locally, the answer could be that when you push to GitHub, for whatever Godforsaken reason, the .env file (that you changed from .env.example earlier) was pushed to the .gitignore file as text. DELETE THAT TEXT AND DO A NEW PUSH TO GITHUB AND VOILA.

Hope this helps at least a few, lol. Mad luv to the community builders! Thanks Alvinsga!! :)

wallet balance check doesn't work

caf7cc7a-e211-4553-8ec7-6c294bde9c84

There is a balance of 0.19sol. 0.1sol are needed to mint one. If I increase the balance to 0,5sol it works
Whitelisteprice 0.1 public price 0.5

stuck spinning after running yarn dev

love the project and succesfully launched it one time, decided i want to try adding my own gif file to the /public folder.. shut down yarn dev server, added new gif, changed code in app.svelte to reflect path and file name to new gif, saved, ran yarn dev and now the app won't load and its stuck spinning. let me know if theres any ideas to fix. interested in using in my front end project
image

Background

How exactly would I go about changing the background? Much luv on the work homie.

Mint doesn't work

Tried with devnet and mainnet
I have checked many times and I put everything in the env file correct and it says "transaction may fail" and then just doesn't mint
It shows the price and how many are left correctly just mint is broken, I have whitelist disabled in config and time is correct

captcha

Hy, when you will release captcha?

When i Mint i get errors and does not work

Hi thank your for the repo,

I was able to successfully deploy to vercel but when i Mint the transaction keeps failing,

do you have any recommendations to fix this issue?

Able to mint more than the amount of NFT's available

Bascially Title.

The counter is always at x/11 NFT's available, so i'm able to keep minting even though there are no more NFT's. How is this even possible using the candy machine and what could be a potential fix?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.