Full lesson
Candy-Blinks
- Original
- JohnPaulPabelico/Candy-Blinks
- SuperStack fork
- Blockchains/Candy-Blinks @
88bf53d - Stars
- 1
- Last push (original)
- 2024-10-22
- Languages
- TypeScript, CSS, Shell, JavaScript, Dockerfile
- Detected stack
- MetaplexNext.jsSolana Actionsweb3.js
- Categories
- NFTs & Digital Assets
- Licence
- Apache-2.0
- Homepage
- https://candy-mint.vercel.app
Architecture
165 source files. By extension: .tsx ×97, .ts ×66, .js ×2.
| Top-level directory | Source files |
|---|---|
candyblinks | 56 |
dapp | 45 |
landing | 35 |
backend | 29 |
Dapp: deploying
This fork is queued for its own live dapp on Sol.College, with a Devnet/Mainnet switch. It appears here, at /dapps/candy-blinks/, once it is deployed and checked on devnet. Until then, run it locally with the commands below.
Key code, explained
Excerpts chosen automatically where the code uses the most Solana concepts, pinned to the fork's commit.
candyblinks/app/blinks/mint/[handle]/route.ts L1–24 @ 88bf53d · Apache-2.0 · originalimport { ACTIONS_CORS_HEADERS, ActionGetResponse, ActionPostRequest, ActionPostResponse, createPostResponse,} from "@solana/actions";import { mintTransaction, getBlink } from "./utils";import client from "@/app/lib/blinksightsClient"; export const GET = async ( req: Request, { params }: { params: { handle: string } }) => { const handle = params.handle; try { console.log("fetching blink"); console.log(getBlink); const blinksData = await getBlink(handle); if (blinksData.length === 0) { console.error("No blinks found for the given handle"); throw new Error("No blinks found for the given handle");- Line 3
ActionGetResponse,: The metadata a Blink client renders (title, icon, buttons). - Line 5
ActionPostResponse,: Returns the serialized transaction the wallet will sign.
candyblinks/app/blinks/mint/[handle]/tip/[amount]/spl-transfer.ts L1–23 @ 88bf53d · Apache-2.0 · originalimport { ComputeBudgetProgram, Connection, LAMPORTS_PER_SOL, PublicKey, SystemProgram, Transaction, TransactionMessage, VersionedTransaction, clusterApiUrl,} from "@solana/web3.js";import { ENDPOINT } from "../../utils";const { TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID,} = require("@solana/spl-token");const splToken = require("@solana/spl-token"); type TransferSolTransactionParam = { from: string; amount: number; // to: string};- Line 2
ComputeBudgetProgram,: Sets the compute-unit limit or price (priority fee). - Line 14
TOKEN_2022_PROGRAM_ID,: Targets the Token-2022 program instead of the original Token Program.
How to run, build and test
These commands come from the repo's own manifests (package.json scripts, Anchor.toml, Cargo, go.mod, Makefile). Check the README for prerequisites and environment variables.
| Directory | Command | Runs |
|---|---|---|
dapp | npm run dev | next dev |
dapp | npm run start | next start |
dapp | npm run build | next build |
dapp | npm run lint | next lint |
landing | npm run dev | next dev |
landing | npm run start | next start |
landing | npm run build | next build |
landing | npm run lint | next lint |
candyblinks | npm run dev | next dev |
candyblinks | npm run start | next start |
candyblinks | npm run build | next build |
candyblinks | npm run lint | next lint |
backend | npm run dev | yarn nodemon ./index.ts |
backend | npm run build | yarn tsc |
backend | npm run test | yarn jest |
What you could build from it
- Fork the SuperStack copy and extend it within the NFTs & Digital Assets gaps listed on the idea page.
- Learn the pattern first: NFTs with Metaplex
- Learn the pattern first: Compressed NFTs and state compression
- Learn the pattern first: Token-2022 (Token Extensions)