Skip to content

Commit 8d1f1a7

Browse files
authored
add hello solana asm example (#538)
* add hello solana asm example * improve test and fix cicd script * remove solana addres * fix biome
1 parent 9a2d126 commit 8d1f1a7

13 files changed

Lines changed: 1525 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ node_modules/
2020
**/*/yarn.lock
2121

2222
/target
23+
deploy

Cargo.lock

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ members = [
2121
"basics/hello-solana/native/program",
2222
"basics/hello-solana/anchor/programs/*",
2323
"basics/hello-solana/pinocchio/program",
24+
"basics/hello-solana/asm",
2425
"basics/pda-rent-payer/native/program",
2526
"basics/pda-rent-payer/pinocchio/program",
2627
"basics/pda-rent-payer/anchor/programs/*",

basics/hello-solana/asm/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
build/**/*
2+
deploy/**/*
3+
node_modules
4+
.sbpf
5+
.DS_Store
6+
.vscode
7+
keypair.json
8+
package-lock.json
9+
test-ledger
10+
yarn.lock
11+
target

basics/hello-solana/asm/Cargo.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[package]
2+
name = "hello-solana-asm-program"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
8+
[dev-dependencies]
9+
litesvm.workspace = true
10+
solana-instruction.workspace = true
11+
solana-keypair.workspace = true
12+
solana-native-token.workspace = true
13+
solana-pubkey.workspace = true
14+
solana-transaction.workspace = true
15+
solana-system-interface.workspace = true
16+
17+
18+
[features]
19+
test-sbf = []

basics/hello-solana/asm/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# hello-solana-asm-program
2+
3+
Created with [sbpf](https://github.com/blueshift-gg/sbpf)

basics/hello-solana/asm/cicd.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
# This script is for quick building & deploying of the program.
4+
# It also serves as a reference for the commands used for building & deploying Solana programs.
5+
# Run this bad boy with "bash cicd.sh" or "./cicd.sh"
6+
7+
sbpf build --deploy-dir ./tests/fixtures/
8+
solana program deploy ./tests/fixtures/hello-solana-asm-program.so
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"type": "module",
3+
"scripts": {
4+
"test": "pnpm ts-mocha -p ./tsconfig.json -t 1000000 ./tests/index.test.ts",
5+
"build-and-test": "sbpf build --deploy-dir ./tests/fixtures && pnpm test",
6+
"build": "sbpf build",
7+
"deploy": "solana program deploy ./program/target/so/hello_solana_program_pinocchio.so"
8+
},
9+
"dependencies": {
10+
"@solana/web3.js": "^1.98.4"
11+
},
12+
"devDependencies": {
13+
"@types/bn.js": "^5.2.0",
14+
"@types/chai": "^4.3.20",
15+
"@types/mocha": "^9.1.1",
16+
"@types/node": "^22.19.1",
17+
"chai": "^4.5.0",
18+
"mocha": "^9.2.2",
19+
"solana-bankrun": "^0.3.1",
20+
"ts-mocha": "^10.1.0",
21+
"typescript": "^4.9.5"
22+
}
23+
}

0 commit comments

Comments
 (0)