Skip to content

laurentHYZ/dapp-scaffold

This branch is 67 commits behind solana-labs/dapp-scaffold:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

00aa49c ยท Aug 11, 2021

History

67 Commits
Jun 15, 2021
Jul 24, 2021
Mar 15, 2021
Aug 11, 2021
Feb 16, 2021
Feb 16, 2021
May 7, 2021
May 17, 2021
Jun 15, 2021
Feb 16, 2021
May 7, 2021
Feb 16, 2021
Jul 24, 2021
Aug 11, 2021
Jun 24, 2021
Aug 11, 2021

Repository files navigation

๐Ÿ— 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

About

Scaffolding for a dapp built on Solana

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 88.0%
  • Less 4.4%
  • HTML 2.5%
  • Shell 2.5%
  • Rust 1.6%
  • CSS 0.6%
  • Other 0.4%