Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ members = [
"basics/favorites/native/program",
"basics/favorites/pinocchio/program",
"basics/repository-layout/native/program",
"basics/repository-layout/pinocchio/program",
"basics/repository-layout/anchor/programs/*",
"basics/transfer-sol/native/program",
"basics/transfer-sol/pinocchio/program",
Expand Down
4 changes: 3 additions & 1 deletion basics/repository-layout/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ This is the typical layout for a Solana program as it grows in size and begins t

> Note: You can structure your Rust `src` folder however you wish - provided you follow Cargo's repository structure standards. You don't have to follow this pattern, but it's here so you can recognize other programs, too.

You can see that the structure for a `native` repository is very similar to that of the `anchor` repository. The only difference is the inclusion of a `processor.rs` in the `native` setup - one of the many things Anchor abstracts away for you!
You can see that the structure for a `native` repository is very similar to that of the `anchor` repository. The only difference is the inclusion of a `processor.rs` in the `native` setup - one of the many things Anchor abstracts away for you!

The `pinocchio` variant follows the same layout as `native` (with a `processor.rs`), but uses the lightweight [Pinocchio](https://github.com/anza-xyz/pinocchio) SDK in a `#![no_std]` crate and emits logs via `pinocchio-log` instead of `msg!`. The instruction data wire format matches the `native` version, so the same Borsh-encoded layout in the TypeScript tests works for both.
8 changes: 8 additions & 0 deletions basics/repository-layout/pinocchio/cicd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# This script is for quick building & deploying of the program.
# It also serves as a reference for the commands used for building & deploying Solana programs.
# Run this bad boy with "bash cicd.sh" or "./cicd.sh"

cargo build-sbf --manifest-path=./program/Cargo.toml --sbf-out-dir=./program/target/so
solana program deploy ./program/target/so/program.so
23 changes: 23 additions & 0 deletions basics/repository-layout/pinocchio/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"type": "module",
"scripts": {
"test": "pnpm ts-mocha -p ./tsconfig.json -t 1000000 ./tests/test.ts",
"build-and-test": "cargo build-sbf --manifest-path=./program/Cargo.toml --sbf-out-dir=./tests/fixtures && pnpm test",
"build": "cargo build-sbf --manifest-path=./program/Cargo.toml --sbf-out-dir=./program/target/so",
"deploy": "solana program deploy ./program/target/so/program.so"
},
"dependencies": {
"@solana/web3.js": "^1.98.4",
"borsh": "^2.0.0"
},
"devDependencies": {
"@types/bn.js": "^5.1.0",
"@types/chai": "^4.3.1",
"@types/mocha": "^9.1.1",
"chai": "^4.3.4",
"mocha": "^9.0.3",
"solana-bankrun": "^0.3.0",
"ts-mocha": "^10.0.0",
"typescript": "^4.3.5"
}
}
Loading