Giter Club home page Giter Club logo

dapp-scaffold's Introduction

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

dapp-scaffold's People

Contributors

bartosz-lipinski avatar macalinao avatar arrowana avatar joncinque avatar rmshea avatar johnrees avatar johnnieskywalker avatar tina1998612 avatar ebramanti avatar gabedottl avatar kevinrodriguez-io avatar max-block avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.