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 directory | Source files |
|---|---|
web | 33 |
anchor | 7 |
(root) | 2 |
crossmint | 1 |
backend | 1 |
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.
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)]- Line 38
pub payer: Signer<'info>,: Requires this account to have signed the transaction. - Line 41
init,: Creates and pays for a new account. Space and payer must be specified. - 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.
| Directory | Command | Runs |
|---|---|---|
. | npm run dev | nx serve web |
. | npm run build | nx build web |
backend | npm run start | node server.js |
backend | npm run test | echo "Error: no test specified" && exit 1 |
anchor | anchor build | compile programs and generate IDLs |
anchor | anchor test | local validator + test suite |
anchor | anchor run test | ../node_modules/.bin/nx run anchor:jest |
What you could build from it
- Fork the SuperStack copy and extend it within the Other gaps listed on the idea page.
- Learn the pattern first: Program Derived Addresses (PDAs)
- Learn the pattern first: Cross-Program Invocations (CPIs)