From 3ce7630a7cad788241074e05ad2736ec1ae76930 Mon Sep 17 00:00:00 2001 From: mars Date: Thu, 10 Oct 2024 08:29:03 +0100 Subject: [PATCH] Initial commit for Solana Anchor RustRover template --- .cargo/config.toml | 13 ++ .cargo_generate.toml | 8 + .github/workflows/ci.yml | 47 +++++ .gitignore | 8 + .idea/.editorconfig | 17 ++ .idea/.gitignore | 5 + .idea/codeStyles/Project.xml | 9 + .idea/misc.xml | 8 + .idea/modules.xml | 8 + .idea/runConfigurations/AnchorBuild.xml | 7 + .idea/runConfigurations/AnchorDeploy.xml | 7 + .idea/runConfigurations/AnchorTest.xml | 7 + .idea/runConfigurations/RunWithEnv.xml | 10 + .idea/solana-anchor-rustrover-template.iml | 14 ++ .idea/vcs.xml | 6 + .prettierignore | 8 + Anchor.toml | 18 ++ Cargo.toml | 14 ++ README.md | 215 +++++++++++++++++++++ img.png | Bin 0 -> 16650 bytes migrations/deploy.ts | 12 ++ package.json | 24 +++ programs/{{project-name}}/Xargo.toml | 2 + programs/{{project-name}}/cargo.toml | 20 ++ programs/{{project-name}}/src/lib.rs | 15 ++ rust-toolchain.toml | 4 + rustfmt.toml | 6 + scripts/generate-keypair.sh | 14 ++ tests/{{project-name}}.ts | 13 ++ tsconfig.json | 10 + 30 files changed, 549 insertions(+) create mode 100644 .cargo/config.toml create mode 100644 .cargo_generate.toml create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 .idea/.editorconfig create mode 100644 .idea/.gitignore create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/runConfigurations/AnchorBuild.xml create mode 100644 .idea/runConfigurations/AnchorDeploy.xml create mode 100644 .idea/runConfigurations/AnchorTest.xml create mode 100644 .idea/runConfigurations/RunWithEnv.xml create mode 100644 .idea/solana-anchor-rustrover-template.iml create mode 100644 .idea/vcs.xml create mode 100644 .prettierignore create mode 100644 Anchor.toml create mode 100644 Cargo.toml create mode 100644 README.md create mode 100644 img.png create mode 100644 migrations/deploy.ts create mode 100644 package.json create mode 100644 programs/{{project-name}}/Xargo.toml create mode 100644 programs/{{project-name}}/cargo.toml create mode 100644 programs/{{project-name}}/src/lib.rs create mode 100644 rust-toolchain.toml create mode 100644 rustfmt.toml create mode 100644 scripts/generate-keypair.sh create mode 100644 tests/{{project-name}}.ts create mode 100644 tsconfig.json diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..92b51e7 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,13 @@ +[build] +target = "x86_64-unknown-linux-gnu" + +[term] +verbose = true + +[target.x86_64-unknown-linux-gnu] +rustflags = ["-C", "target-cpu=native", "-C", "opt-level=3"] + +[profile.release] +debug = true +lto = true +opt-level = "z" diff --git a/.cargo_generate.toml b/.cargo_generate.toml new file mode 100644 index 0000000..273fd86 --- /dev/null +++ b/.cargo_generate.toml @@ -0,0 +1,8 @@ +[template] +description = "A Solana Anchor project template optimized for IntelliJ RustRover" +version = "0.1.0" +repository = "https://github.com/mars-arch/solana-anchor-rustrover-template" + +[placeholders] +project-name = { type = "string", prompt = "Enter the project name" } +authors = { type = "string", prompt = "Enter the author name(s)" } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9017b5c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,47 @@ +name: Solana Anchor CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + name: Build and Test Solana Anchor Program + runs-on: ubuntu-latest + + steps: + # Checkout the repository + - name: Checkout code + uses: actions/checkout@v3 + + # Set up Rust environment + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: rustfmt, clippy + + # Install Solana CLI tools + - name: Install Solana CLI + run: | + sh -c "$(curl -sSfL https://release.solana.com/v1.10.31/install)" + + # Install Anchor CLI + - name: Install Anchor + run: | + cargo install --git https://github.com/coral-xyz/anchor anchor-cli --locked + + # Build the Anchor program + - name: Build Anchor program + run: | + anchor build + + # Run tests + - name: Run tests + run: | + anchor test + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..09d2dbf --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ + +.anchor +.DS_Store +solana-anchor-rustrover-template/target +**/*.rs.bk +node_modules +test-ledger +.yarn diff --git a/.idea/.editorconfig b/.idea/.editorconfig new file mode 100644 index 0000000..a36e478 --- /dev/null +++ b/.idea/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.rs] +indent_style = space +indent_size = 4 + +[*.ts] +indent_style = space +indent_size = 2 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..ea7ed09 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..dd39468 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..b201315 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..1730f1b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/AnchorBuild.xml b/.idea/runConfigurations/AnchorBuild.xml new file mode 100644 index 0000000..ac8253e --- /dev/null +++ b/.idea/runConfigurations/AnchorBuild.xml @@ -0,0 +1,7 @@ + + + + diff --git a/.idea/runConfigurations/AnchorDeploy.xml b/.idea/runConfigurations/AnchorDeploy.xml new file mode 100644 index 0000000..54d5eb9 --- /dev/null +++ b/.idea/runConfigurations/AnchorDeploy.xml @@ -0,0 +1,7 @@ + + + + diff --git a/.idea/runConfigurations/AnchorTest.xml b/.idea/runConfigurations/AnchorTest.xml new file mode 100644 index 0000000..f583022 --- /dev/null +++ b/.idea/runConfigurations/AnchorTest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/.idea/runConfigurations/RunWithEnv.xml b/.idea/runConfigurations/RunWithEnv.xml new file mode 100644 index 0000000..6b1f7ae --- /dev/null +++ b/.idea/runConfigurations/RunWithEnv.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/.idea/solana-anchor-rustrover-template.iml b/.idea/solana-anchor-rustrover-template.iml new file mode 100644 index 0000000..fe2d9d0 --- /dev/null +++ b/.idea/solana-anchor-rustrover-template.iml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..c8397c9 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..c1a0b75 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,8 @@ + +.anchor +.DS_Store +target +node_modules +dist +build +test-ledger diff --git a/Anchor.toml b/Anchor.toml new file mode 100644 index 0000000..3ce433d --- /dev/null +++ b/Anchor.toml @@ -0,0 +1,18 @@ +[toolchain] + +[features] +seeds = false +skip-lint = false + +[programs.localnet] +{{project-name}} = "7YukY8tuR2GLzxS9cieRBjwbMidudYcj8R5aACLsbJCw" + +[registry] +url = "https://api.apr.dev" + +[provider] +cluster = "Localnet" +wallet = "~/.config/solana/id.json" + +[scripts] +test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..158be60 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,14 @@ +[workspace] +members = [ + "programs/*" +] + +[profile.release] +overflow-checks = true +lto = "fat" +codegen-units = 1 + +[profile.release.build-override] +opt-level = 3 +incremental = false +codegen-units = 1 diff --git a/README.md b/README.md new file mode 100644 index 0000000..dc26758 --- /dev/null +++ b/README.md @@ -0,0 +1,215 @@ + +--- + +# Solana Anchor Template Optimized for RustRover (Ubuntu) + +This is a **cargo generate** template for developing Solana programs using the Anchor framework, optimized for **IntelliJ RustRover** on **Linux Ubuntu**. It provides a fully-configured development environment with ready-to-use run configurations, Rust toolchains, and build/test workflows. + +## Overview + +This template is designed to help developers quickly set up and start building Solana programs using the **Anchor framework** within **IntelliJ RustRover** on **Linux Ubuntu**. It includes pre-configured tools for building, testing, deploying, and formatting Rust-based Solana programs. + +### New Features Added + +- **Pre-configured Run Configurations** for quick access to building, testing, and deploying the program. + - **Anchor Build**: For compiling the Solana program. + - **Anchor Test**: To run your tests. + - **Anchor Deploy**: For deploying the program to a cluster (e.g., Devnet). + - **Run with Environment Variables**: Customized configuration to set up environment variables for the Solana cluster and wallet path. + +## Features + +- 🚀 **Pre-configured Anchor Framework** for Solana smart contract development. +- 🛠 **IntelliJ RustRover Optimized**: IntelliJ run configurations for building, testing, and deploying Solana programs. +- 🧰 **Rust Toolchains and Cargo Configurations**: Ensuring consistent builds and formats across different environments. +- ✅ **Rust formatting and linting**: Integrated `rustfmt` and `clippy` support to keep your code clean and efficient. + +## Prerequisites + +Before using this template, make sure you have the following dependencies installed on your **Linux Ubuntu** system: + +### 1. Install Rust + +Install the Rust programming language using `rustup`, the Rust toolchain installer: + +```bash +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +source $HOME/.cargo/env +``` + +Ensure that `cargo` (Rust’s package manager) is available in your terminal by running: + +```bash +cargo --version +``` + +### 2. Install Solana CLI + +The **Solana CLI** allows you to interact with the Solana network and deploy programs. To install the Solana CLI tools, run the following commands: + +```bash +sh -c "$(curl -sSfL https://release.solana.com/v1.10.31/install)" +``` + +Add Solana CLI to your environment by adding this line to your `~/.bashrc` or `~/.zshrc`: + +```bash +export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH" +``` + +Reload your terminal or source your `.bashrc`: + +```bash +source ~/.bashrc +``` + +Verify the Solana CLI installation: + +```bash +solana --version +``` + +### 3. Install Anchor CLI + +The **Anchor CLI** provides the necessary tools to develop Solana smart contracts using the Anchor framework. To install it, run the following command: + +```bash +cargo install --git https://github.com/coral-xyz/anchor anchor-cli --locked +``` + +Verify the installation: + +```bash +anchor --version +``` + +### 4. Install cargo-generate + +To use this template with `cargo generate`, you need to install **cargo-generate**: + +```bash +cargo install cargo-generate +``` + +Verify the installation: + +```bash +cargo generate --version +``` + +## Quick Start + +Once the prerequisites are installed, you can use this template to create a new project. + +1. Generate a new project using the template: + + ```bash + cargo generate --git https://github.com/yourusername/solana-anchor-rustrover-template.git --name {{project-name}} + cd {{project-name}} + ``` + +2. Build the project: + + ```bash + anchor build + ``` + +3. Run tests: + + ```bash + anchor test + ``` + +## Setting Up in IntelliJ RustRover (Ubuntu) + +1. **Install IntelliJ RustRover**: + Download and install IntelliJ RustRover from the [JetBrains website](https://www.jetbrains.com/rust/). + +2. **Open the Project**: + Open the generated project in **IntelliJ RustRover**. + +3. **Configure the Rust Toolchain**: + RustRover should automatically detect the Rust toolchain. If not, go to **Settings > Languages & Frameworks > Rust** and set the toolchain path to `~/.cargo/bin`. + +4. **Run Configurations**: + RustRover includes pre-configured run configurations to simplify development: + - **Anchor Build**: Builds the Solana program. + - **Anchor Test**: Runs the test suite. + - **Anchor Deploy**: Deploys the program to the Solana network. + - **Run with Env**: A custom run configuration that sets environment variables for the Solana cluster (`ANCHOR_PROVIDER_URL`) and wallet (`ANCHOR_WALLET`). + + You can access these configurations directly from the **Run/Debug** menu in RustRover. + +### Run Configuration Example + +![Run Configurations](./img.png) + +The run configurations are visible directly in the IDE, offering quick access to build, test, deploy, and custom environment variable runs. + +## Running the Project + +Once everything is set up, you can use the following commands to build, test, and deploy your Solana program. + +- **Build the project**: + ```bash + anchor build + ``` + +- **Run tests**: + ```bash + anchor test + ``` + +- **Deploy the program** (optional): + If you want to deploy the program to a Solana cluster (e.g., `devnet`), use the following command: + + ```bash + anchor deploy --provider.cluster devnet + ``` + +## Formatting and Linting + +This template is pre-configured with Rust's formatting and linting tools. You can use these commands to keep your code clean and optimized: + +- **Format your code** using `rustfmt`: + ```bash + cargo fmt + ``` + +- **Lint your code** using `clippy`: + ```bash + cargo clippy + ``` + +## Troubleshooting (Ubuntu Specific) + +### 1. Permissions Issues + +If you encounter any permissions issues while installing or running commands, prepend the command with `sudo`: + +```bash +sudo anchor build +``` + +### 2. PATH Issues + +If your terminal doesn’t recognize commands like `solana`, ensure that the **Solana CLI** path is added to your shell configuration file (`~/.bashrc` or `~/.zshrc`). Then, reload the terminal: + +```bash +source ~/.bashrc +``` + +### 3. Missing Dependencies + +Ensure you have installed all necessary libraries, including `libssl-dev`, `pkg-config`, and `build-essential`: + +```bash +sudo apt-get update +sudo apt-get install -y build-essential libssl-dev pkg-config +``` + +## License + +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details. + +--- diff --git a/img.png b/img.png new file mode 100644 index 0000000000000000000000000000000000000000..8b035b4d62097f4990bbc59e72e96815badaa71c GIT binary patch literal 16650 zcmbunby!th_bx1K1wlf(TS6qIHb{3$cS?674VzFpl$Mn4?iAdBba!`m_gVP*yw4lo z?>px@$3MJev1W}q=6&B|jJXVwdoPBJh>!T>$rEG=abblgPhfI^e;+@G1OCPxlwW)D zgnvjvSU|}|XKxNcOKI(%&vswS_qp%jDlHY<6~^g-=<8gZ_M+LW<9aQ&xN?y`YZ@NiQ$db=Sk*L!DfE#FS) zHj<9GPdvaT{k<;09|&^?u7iLAj6o>#I$|bl2d+UcmiV(!=8pI`k%+j!Q&mzdCg5o? zKdm0{RLe){2k^8GHt%=CXTKYMyh(oNjPlr~;3yJ3ccRosBEs+Z4%gd-3U9Jw%e6n;gF zCrED@=1kJUAtK<7((koafN>BK5MY#wB6py7427RHo}>zA;Sy`2#36z8@M zWe&-NUH^>FR!=Jv*jqKoj2=PYz`)4J7^Bud8>{qVHWG|Coo_Z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7eeDRAgIN~z4NjA*2WN4^lNam+o525Z@I*r7y>PLhp6~wx!-o+x literal 0 HcmV?d00001 diff --git a/migrations/deploy.ts b/migrations/deploy.ts new file mode 100644 index 0000000..82fb175 --- /dev/null +++ b/migrations/deploy.ts @@ -0,0 +1,12 @@ +// Migrations are an early feature. Currently, they're nothing more than this +// single deploy script that's invoked from the CLI, injecting a provider +// configured from the workspace's Anchor.toml. + +const anchor = require("@coral-xyz/anchor"); + +module.exports = async function (provider) { + // Configure client to use the provider. + anchor.setProvider(provider); + + // Add your deploy script here. +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..c5cffc2 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "{{project-name}}", + "version": "1.0.0", + "description": "Solana Anchor Program for {{project-name}}", + "scripts": { + "test": "ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts", + "lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w", + "lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check", + "postinstall": "bash ./scripts/generate-keypair.sh" + }, + "dependencies": { + "@coral-xyz/anchor": "^0.29.0" + }, + "devDependencies": { + "chai": "^4.3.4", + "mocha": "^9.0.3", + "ts-mocha": "^10.0.0", + "@types/bn.js": "^5.1.0", + "@types/chai": "^4.3.0", + "@types/mocha": "^9.0.0", + "typescript": "^4.3.5", + "prettier": "^2.6.2" + } +} diff --git a/programs/{{project-name}}/Xargo.toml b/programs/{{project-name}}/Xargo.toml new file mode 100644 index 0000000..42ce0ab --- /dev/null +++ b/programs/{{project-name}}/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] diff --git a/programs/{{project-name}}/cargo.toml b/programs/{{project-name}}/cargo.toml new file mode 100644 index 0000000..eab10f5 --- /dev/null +++ b/programs/{{project-name}}/cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "{{project-name}}" +version = "0.1.0" +edition = "2021" +authors = ["{{authors}}"] + +[lib] +crate-type = ["cdylib", "lib"] +name = "{{project-name}}" + +[dependencies] +anchor-lang = "0.29.0" + +[features] +no-entrypoint = [] +no-idl = [] +no-log-ix-name = [] +cpi = ["no-entrypoint"] +default = [] + diff --git a/programs/{{project-name}}/src/lib.rs b/programs/{{project-name}}/src/lib.rs new file mode 100644 index 0000000..1557657 --- /dev/null +++ b/programs/{{project-name}}/src/lib.rs @@ -0,0 +1,15 @@ +use anchor_lang::prelude::*; + +declare_id!("9f1FK7gDKaokYMyRxbakELTv2LXsK26qjJjPKAHHCQnB"); + +#[program] +pub mod {{project-name}} { +use super::*; + +pub fn initialize(ctx: Context) -> Result<()> { +Ok(()) +} +} + +#[derive(Accounts)] +pub struct Initialize {} diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..20e88fd --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "stable" +components = ["rustfmt", "clippy"] +profile = "minimal" diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..a6a277e --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,6 @@ +max_width = 100 +hard_tabs = false +tab_spaces = 4 +use_field_init_shorthand = true +newline_style = "Unix" +trailing_comma = "Always" diff --git a/scripts/generate-keypair.sh b/scripts/generate-keypair.sh new file mode 100644 index 0000000..e917f75 --- /dev/null +++ b/scripts/generate-keypair.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Ensure Solana CLI is installed +if ! command -v solana-keygen &> /dev/null +then + echo "Solana CLI could not be found. Please install it first." + exit 1 +fi + +# Generate a new keypair and save it to a file +KEYPAIR_FILE="./my-project-keypair.json" +solana-keygen new --outfile $KEYPAIR_FILE --no-passphrase + +echo "Keypair generated and saved to $KEYPAIR_FILE" diff --git a/tests/{{project-name}}.ts b/tests/{{project-name}}.ts new file mode 100644 index 0000000..c416845 --- /dev/null +++ b/tests/{{project-name}}.ts @@ -0,0 +1,13 @@ +import * as anchor from "@coral-xyz/anchor"; +import {Program} from "@coral-xyz/anchor"; +import {MyProject} from "../target/types/my_project"; + +describe("my_project", () => { + anchor.setProvider(anchor.AnchorProvider.env()); + const program = anchor.workspace.MyProject as Program; + + it("Is initialized!", async () => { + const tx = await program.methods.initialize().rpc(); + console.log("Your transaction signature", tx); + }); +}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..d6e2a73 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "types": ["node", "mocha", "chai"], + "typeRoots": ["./node_modules/@types"], + "lib": ["es2015"], + "module": "commonjs", + "target": "es6", + "esModuleInterop": true + } +}