Sol.College

Full lesson

solana-sandbox

What it does

From the project README:

Welcome to **NFT Discount Service**! This project is a web application using the Solana blockchain, designed to provide users with an intuitive and seamless experience for managing NFTs and claiming discounts based on their NFT holdings.
Original
aleksanderw1992/solana-sandbox
SuperStack fork
Blockchains/solana-sandbox @ 1af4d51
Stars
0
Last push (original)
2024-11-19
Languages
TypeScript, JavaScript, Rust, CSS, HTML, Procfile
Detected stack
AnchorMetaplexweb3.js
Categories
Other
Licence
MIT

Architecture

44 source files. By extension: .tsx ×28, .ts ×8, .js ×7, .rs ×1.

Top-level directorySource files
web33
anchor7
(root)2
crossmint1
backend1

On-chain programs: anchor/programs/solana-sandbox

Dapp: devnet deploy pending

⏳ Devnet deploy pending — goes live when the devnet wallet is topped up. This fork's own dapp is not deployed yet, so there is no program address or transaction to show. It is queued in dapp-queue.txt; once devnet SOL is available it is deployed, exercised with real devnet transactions, and this section switches to the live dapp at /dapps/solana-sandbox/. Until then, the lesson and step-by-step guide below are complete, and you can 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.

aleksanderw1992/solana-sandbox · anchor/programs/solana-sandbox/src/lib.rs L37–60 @ 1af4d51 · MIT · original
  #[account(mut)]  pub payer: Signer<'info>,   #[account(  init,  space = 8 + SolanaSandbox::INIT_SPACE,  payer = payer  )]  pub solana_sandbox: Account<'info, SolanaSandbox>,  pub system_program: Program<'info, System>,}#[derive(Accounts)]pub struct CloseSolanaSandbox<'info> {  #[account(mut)]  pub payer: Signer<'info>,   #[account(  mut,  close = payer, // close account and return lamports to payer  )]  pub solana_sandbox: Account<'info, SolanaSandbox>,} #[derive(Accounts)]
  1. Line 38 pub payer: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 41 init,: Creates and pays for a new account. Space and payer must be specified.
  3. Line 55 close = payer, // close account and return lamports to payer: Closes the account at the end of the instruction and refunds its lamports.

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 devnx serve web
.npm run buildnx build web
backendnpm run startnode server.js
backendnpm run testecho "Error: no test specified" && exit 1
anchoranchor buildcompile programs and generate IDLs
anchoranchor testlocal validator + test suite
anchoranchor run test../node_modules/.bin/nx run anchor:jest

What you could build from it