Skip to content

Nagaprasadvr/solana-native-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solana Native Starter

This is a solana native starter project with batteries included

Steps to start (Please use wsl or linux for smooth devux)

1. clone the repo

git clone git@github.com:Nagaprasadvr/solana-native-starter.git

2. Directory structure

  • program/ - contains the rust program

  • src/

    • entrypoint.rs - the entrypoint of the program

    • lib.rs - solana program lib crate

    • instruction.rs - all instructions are defined here

      Note: instructions are annotated with #[accounts(...)] shank macros which are required to generate client code

    • state.rs - all account states are defined here

      Note: state is deriving ShankAccount which is required to generate client code

    • processor.rs - the processor file

    • error.rs - program errors are listed here

    • helper.rs - helpers and constants for program

  • js/ - contains the js client

  • js/tests/ - contains the tests for the program

3. Setup

sudo chmod +rwx cicd.sh && sudo chmod +rwx gen-client.sh #for first time to provide permissions

4. Run the solana test validator for deployment and testing

solana-test-validator

5. Build and deploy the program

Note: change program name in program/Cargo.toml and js/.solitarc.js before deployment

bash ./cicd.sh

dont forget to replace program id after program deployment in prorgam/src/lib.rs

6. Generate the client

bash ./gen-client.sh

The generated client code is located in js/src/generated

7. Running Tests

cd js && bun run test

About

A solana native starter repo with batteries incuded

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published