Sol.College

Full lesson

solana-front

What it does

From the project README:

You can use any normal anchor commands. Either move to the `anchor` directory and run the `anchor` command or prefix the command with `npm run`, eg: `npm run anchor`.
Original
alejandro99so/solana-front
SuperStack fork
Blockchains/solana-front @ a39c975
Stars
0
Last push (original)
2024-10-06
Languages
TypeScript, JavaScript, Rust, CSS
Detected stack
AnchorNext.jsweb3.js
Categories
Other
Licence
MIT

Architecture

37 source files. By extension: .tsx ×22, .ts ×9, .js ×5, .rs ×1.

Top-level directorySource files
web28
anchor7
(root)2

On-chain programs: anchor/programs/my-first

Dapp: deploying

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

alejandro99so/solana-front · anchor/programs/my-first/src/lib.rs L37–60 @ a39c975 · MIT · original
  #[account(mut)]  pub payer: Signer<'info>,   #[account(  init,  space = 8 + MyFirst::INIT_SPACE,  payer = payer  )]  pub my_first: Account<'info, MyFirst>,  pub system_program: Program<'info, System>,}#[derive(Accounts)]pub struct CloseMyFirst<'info> {  #[account(mut)]  pub payer: Signer<'info>,   #[account(  mut,  close = payer, // close account and return lamports to payer  )]  pub my_first: Account<'info, MyFirst>,} #[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
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