Hard fork from Solana Dapp Starter https://github.com/solana-labs/dapp-scaffold/
  • TypeScript 88.3%
  • Less 4.3%
  • HTML 2.5%
  • Shell 2.4%
  • Rust 1.6%
  • Other 0.9%
Find a file
2021-11-29 07:41:36 -05:00
.github install linux deps on unit tests 2021-06-15 11:07:32 -05:00
program Merge pull request #20 from saber-hq/igm/github-actions 2021-07-24 04:42:29 +02:00
public feat: use token-list 2021-03-15 17:23:02 -05:00
src Initial Commit 2021-11-29 07:41:36 -05:00
.env feat: add rust template 2021-02-16 12:15:48 -06:00
.env.production feat: initial scaffold 2021-02-16 10:24:37 -06:00
.gitignore Add localnet using solana-test-validator 2021-05-07 21:38:40 +02:00
.gitpod.Dockerfile Create .gitpod.Dockerfile 2021-05-17 18:44:47 +02:00
.gitpod.yml Use Solana 1.6.12 everywhere 2021-06-15 11:01:57 -05:00
craco.config.js feat: initial scaffold 2021-02-16 10:24:37 -06:00
LICENSE Initial commit 2021-02-16 09:08:44 -06:00
package-lock.json chore(deps): bump @solana/spl-token-registry from 0.2.2 to 0.2.203 2021-07-24 02:47:10 +00:00
package.json Adds solana wallet adapter (#39) 2021-08-11 13:52:27 -05:00
README.md Update to 1.6.7 2021-05-07 21:23:08 +02:00
tsconfig.json Fix Jest test runner 2021-06-24 01:50:14 -06:00
yarn.lock Initial Commit 2021-11-29 07:41:36 -05:00

🏗 Solana App Scaffold

Scaffolding for a dapp built on Solana

Quickstart

git clone https://github.com/solana-labs/dapp-scaffold.git

cd dapp-scaffold

yarn


yarn start

Environment Setup

  1. Install Rust from https://rustup.rs/
  2. Install Solana v1.6.7 or later from https://docs.solana.com/cli/install-solana-cli-tools#use-solanas-install-tool
  3. Install Node
  4. Install NPM, Yarn

Build Smart Contract (compiled for BPF)

Run the following from the program/ subdirectory:

$ cargo build-bpf
$ cargo test-bpf

Directory structure

program

Solana program template in Rust

program/src/lib.rs

  • process_instruction function is used to run all calls issued to the smart contract

src/actions

Setup here actions that will interact with Solana programs using sendTransaction function

src/contexts

React context objects that are used propagate state of accounts across the application

src/hooks

Generic react hooks to interact with token program:

  • useUserBalance - query for balance of any user token by mint, returns:
    • balance
    • balanceLamports
    • balanceInUSD
  • useUserTotalBalance - aggregates user balance across all token accounts and returns value in USD
    • balanceInUSD
  • useAccountByMint
  • useTokenName
  • useUserAccounts

src/views

  • home - main page for your app
  • faucet - airdrops SOL on Testnet and Devnet