Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ochikov committed Jan 4, 2025
0 parents commit 8d04494
Show file tree
Hide file tree
Showing 51 changed files with 13,419 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
49 changes: 49 additions & 0 deletions .github/workflows/test-anchor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test and Build Anchor

on:
pull_request:
push:
branches: ['main']

jobs:
test-and-build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- uses: metadaoproject/setup-anchor@v2
with:
anchor-version: '0.30.1'
node-version: '20'
solana-cli-version: '1.18.9'

- name: Generate new keypair
run: solana-keygen new --no-bip39-passphrase

- name: Set solana target cluster to local
run: solana config set --url http://localhost:8899

- name: Check solana config
run: solana config get

- run: pnpm run anchor build
shell: bash

- run: pnpm run anchor test
shell: bash
31 changes: 31 additions & 0 deletions .github/workflows/test-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test and Build Web

on:
pull_request:
push:
branches: ['main']

jobs:
test-and-build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build project
run: pnpm build
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
tmp
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022-2024 Solana Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
153 changes: 153 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# Supercharging Solana dApp Development: Developer Tooling Overview

Welcome to the **Supercharging Solana dApp Development** workshop! This repository contains materials and code examples to help you explore the rich ecosystem of tools available for Solana dApp development.

This project was generated using `npx create-solana-dapp` with the following options:

- Framework: **Next.js**
- Styling: **TailwindCSS**
- Template: **Basic Project**

## Agenda

1. **Overview of Solana dApp Development**
- Where to start from
- Useful websites and tools
- What is the workflow of Solana dApp development
2. **Developer Tools and Their Use Cases**
- Frameworks
- Testing
- Monitoring
- FE Integration
- Code Quality
3. **Hands-On Demos**
- Switching between GitHub branches for each tool.
- Highlighting **Zest** for code coverage.

---

## Tools Covered

1. **Solana Playground**: Quick prototyping and experimentation.
2. **Anchor Framework** - For programs (smart contract) development.
3. **Bankrun** - Modern testing for Solana programs.
4. **Metaplex SDK** - Tools for NFTs and marketplaces.
5. **Helius API** - Real-time monitoring and transaction indexing.
6. **Solana Wallet Adapter** - Simplified wallet integration.
7. **Zest** - Code coverage for Solana projects.

---

## Description

### Slides

The slides for the workshop can be found in the [slides](./slides/) directory.

---

### Branches for Demos

Each branch in this repository contains a ready-to-use example with readme for the respective tool. Use the following branches:

- **`demo-solana-playground`**: Example using the Solana Playground.
- **`demo-anchor`**: Example using the Anchor framework.
- **`demo-bankrun`**: Testing Solana programs with Bankrun.
- **`demo-metaplex`**: NFT minting and marketplace setup.
- **`demo-wallet-integration`**: Wallet Adapter integration.
- **`demo-monitoring`**: Using Helius API for monitoring.
- **`demo-zest`**: Generating code coverage reports with Zest.

---

## What do you need

### Prerequisites

- Node v18.18.0 or higher

- Rust v1.77.2 or higher
- Anchor CLI 0.30.1 or higher
- Solana CLI 1.18.17 or higher

### Installation

#### Clone the repo

```shell
git clone https://github.com/ochikov/supercharging-solana-dapps.git
```

#### Install Dependencies

```shell
pnpm install
```

#### Start the web app

```
pnpm dev
```

## Apps

### anchor

This is a Solana program written in Rust using the Anchor framework.

#### Commands

You can use any normal anchor commands. Either move to the `anchor` directory and run the `anchor` command or prefix the command with `pnpm`, eg: `pnpm anchor`.

#### Sync the program id:

Running this command will create a new keypair in the `anchor/target/deploy` directory and save the address to the Anchor config file and update the `declare_id!` macro in the `./src/lib.rs` file of the program.

You will manually need to update the constant in `anchor/lib/basic-exports.ts` to match the new program id.

```shell
pnpm anchor keys sync
```

#### Build the program:

```shell
pnpm anchor-build
```

#### Start the test validator with the program deployed:

```shell
pnpm anchor-localnet
```

#### Run the tests

```shell
pnpm anchor-test
```

#### Deploy to Devnet

```shell
pnpm anchor deploy --provider.cluster devnet
```

### web

This is a React app that uses the Anchor generated client to interact with the Solana program.

#### Commands

Start the web app

```shell
pnpm dev
```

Build the web app

```shell
pnpm build
```
12 changes: 12 additions & 0 deletions anchor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.anchor
.DS_Store
target/debug
target/deploy
target/release
target/sbf-solana-solana
target/test-ledger
target/.rustc_info.json
**/*.rs.bk
node_modules
test-ledger
.yarn
7 changes: 7 additions & 0 deletions anchor/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.anchor
.DS_Store
target
node_modules
dist
build
test-ledger
29 changes: 29 additions & 0 deletions anchor/Anchor.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[toolchain]
anchor_version = "0.30.1"

[features]
resolution = true
skip-lint = false

[programs.localnet]
basic = "6z68wfurCMYkZG51s1Et9BJEd9nJGUusjHXNt4dGbNNF"

[registry]
url = "https://api.apr.dev"

[provider]
cluster = "Localnet"
wallet = "~/.config/solana/id.json"

[scripts]
test = "../node_modules/.bin/jest --preset ts-jest"

[test]
startup_wait = 5000
shutdown_wait = 2000
upgradeable = false

[test.validator]
bind_address = "127.0.0.1"
ledger = ".anchor/test-ledger"
rpc_port = 8899
Loading

0 comments on commit 8d04494

Please sign in to comment.