Sol.College

Full lesson

breakout_demo_25

Demo created for Solana London Buildstation (aka Breakout) Hackathon.

What it does

From the project README:

You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
Original
saiph-meg/breakout_demo_25
SuperStack fork
Blockchains/breakout_demo_25 @ 39d6837
Stars
1
Last push (original)
2025-05-16
Languages
TypeScript, Rust, JavaScript
Detected stack
Next.js
Categories
Other
Licence
MIT

Architecture

45 source files. By extension: .ts ×28, .tsx ×12, .js ×3, .rs ×2.

Top-level directorySource files
src41
(root)2
SOL2

Dapp: deploying

This fork is queued for its own live dapp on Sol.College, with a Devnet/Mainnet switch. It appears here, at /dapps/breakout-demo-25/, 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.

saiph-meg/breakout_demo_25 · SOL/lib.rs L205–228 @ 39d6837 · MIT · original
#[instruction(id: u64)]pub struct CreateNFT<'info> {    #[account(mut)]    pub authority: Signer<'info>,    #[account(mut)]    pub payer: Signer<'info>,    #[account(     init,    payer = payer,     mint::decimals = 0,    mint::authority = authority,    mint::freeze_authority = authority,    seeds = ["mint".as_bytes(), id.to_le_bytes().as_ref()],     bump,    )]    pub mint: Account<'info, Mint>,    #[account(        init_if_needed,        payer = payer,        associated_token::mint = mint,        associated_token::authority = payer,    )]    pub token_account: Account<'info, TokenAccount>,    pub associated_token_program: Program<'info, AssociatedToken>,
  1. Line 208 pub authority: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 212 init,: Creates and pays for a new account. Space and payer must be specified.
  3. Line 217 seeds = ["mint".as_bytes(), id.to_le_bytes().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  4. Line 218 bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  5. Line 222 init_if_needed,: Creates the account only if it doesn't exist. Watch for re-initialisation bugs.
saiph-meg/breakout_demo_25 · SOL/lib_createnft.rs L109–132 @ 39d6837 · MIT · original
pub struct CreateNFT<'info> {    #[account(mut)]    pub authority: Signer<'info>,    #[account(mut)]    pub payer: Signer<'info>,    #[account(     init,    payer = payer,     mint::decimals = 0,    mint::authority = authority,    mint::freeze_authority = authority,    seeds = ["mint".as_bytes(), id.to_le_bytes().as_ref()],     bump,    )]    pub mint: Account<'info, Mint>,    #[account(        init_if_needed,        payer = payer,        associated_token::mint = mint,        associated_token::authority = payer,    )]    pub token_account: Account<'info, TokenAccount>,    pub associated_token_program: Program<'info, AssociatedToken>,    pub rent: Sysvar<'info, Rent>,
  1. Line 111 pub authority: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 115 init,: Creates and pays for a new account. Space and payer must be specified.
  3. Line 120 seeds = ["mint".as_bytes(), id.to_le_bytes().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  4. Line 121 bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  5. Line 125 init_if_needed,: Creates the account only if it doesn't exist. Watch for re-initialisation bugs.

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.

DirectoryCommandRuns
.npm run devnext dev
.npm run startnext start
.npm run buildnext build
.npm run linteslint --fix .

What you could build from it