https://github.com/Nagaprasadvr/solana-native-starter
A solana native starter repo with batteries incuded
https://github.com/Nagaprasadvr/solana-native-starter
Last synced: 2 months ago
JSON representation
A solana native starter repo with batteries incuded
- Host: GitHub
- URL: https://github.com/Nagaprasadvr/solana-native-starter
- Owner: Nagaprasadvr
- Created: 2024-10-18T02:03:15.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-10-18T03:28:55.000Z (7 months ago)
- Last Synced: 2025-03-11T21:51:18.352Z (2 months ago)
- Language: TypeScript
- Size: 56.6 KB
- Stars: 18
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome - Nagaprasadvr/solana-native-starter - A solana native starter repo with batteries incuded (TypeScript)
README
# 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
```bash
git clone [email protected]:Nagaprasadvr/solana-native-starter.git
```### 2. Directory structure
- [program/](program/) - contains the rust program
- [src/](program/src/)
- [entrypoint.rs](program/src/entrypoint.rs) - the entrypoint of the program
- [lib.rs](program/src/lib.rs) - solana program lib crate
- [instruction.rs](program/src/instruction.rs) - all instructions are defined here**Note:** instructions are annotated with `#[accounts(...)]` `shank macros` which are required to generate client code
- [state.rs](program/src/state.rs) - all account states are defined here
**Note:** state is deriving `ShankAccount` which is required to generate client code
- [processor.rs](program/src/processor.rs) - the processor file
- [error.rs](program/src/error.rs) - program errors are listed here
- [helper.rs](program/src/helpers.rs) - helpers and constants for program- [js/](js/) - contains the js `client`
- [js/tests/](js/tests/) - contains the `tests` for the program
### 3. Setup
```bash
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
```bash
solana-test-validator
```### 5. Build and deploy the program
**Note:** change program name in [program/Cargo.toml](program/Cargo.toml) and [js/.solitarc.js](js/.solitarc.js) before deployment
```bash
bash ./cicd.sh
```dont forget to replace program id after program deployment in [prorgam/src/lib.rs](program/src//lib.rs)
### 6. Generate the client
```bash
bash ./gen-client.sh
```The generated client code is located in
[js/src/generated](js/src/generated/)### 7. Running Tests
```bash
cd js && bun run test
```