Skip to content

Commit 9ac35e4

Browse files
authored
feat(lazer): add anchor based example for solana (#52)
* chore: add vanilla anchor * chore: separate rust toolchains * feat: add anchor based example contract * fix: update non-anchor solana contract * feat: add ci * refactor: format the code * fix ci * trigger ci * fix: add cwd to pnpm action * fix ci again * add test * chore: add readme and final touches
1 parent cb02c49 commit 9ac35e4

21 files changed

+5026
-9
lines changed

.github/workflows/ci-lazer-anchor.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: "Lazer Anchor contract test"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
paths:
8+
- lazer/solana-anchor/
9+
- .github/workflows/ci-lazer-anchor.yml
10+
11+
jobs:
12+
lazer-anchor-example-test:
13+
name: Lazer Anchor example contract test
14+
runs-on: ubuntu-22.04
15+
defaults:
16+
run:
17+
working-directory: lazer/solana-anchor/
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions-rust-lang/setup-rust-toolchain@v1
21+
with:
22+
toolchain: 1.82.0
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: 22
26+
- uses: pnpm/action-setup@v4
27+
name: Install pnpm
28+
with:
29+
version: 10
30+
run_install: |
31+
recursive: false
32+
cwd: lazer/solana-anchor/
33+
- name: Install Solana Cli
34+
run: |
35+
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"
36+
echo "$HOME/.local/share/solana/install/active_release/bin" >> "$GITHUB_PATH"
37+
- name: Set Solana Cli version
38+
run: agave-install init 1.18.26
39+
- name: Create Solana key
40+
run: solana-keygen new --no-bip39-passphrase
41+
- name: Install Anchor
42+
run: |
43+
rustup install 1.79.0
44+
rustup install nightly-2025-04-15
45+
RUSTFLAGS= cargo +1.79.0 install --git https://github.com/coral-xyz/anchor --tag v0.30.1 --locked anchor-cli
46+
- name: Run anchor tests
47+
run: pnpm run test:anchor
File renamed without changes.

lazer/solana-anchor/.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.anchor
2+
.DS_Store
3+
target
4+
**/*.rs.bk
5+
node_modules
6+
test-ledger
7+
.yarn

lazer/solana-anchor/.prettierignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.anchor
2+
.DS_Store
3+
target
4+
node_modules
5+
dist
6+
build
7+
test-ledger

lazer/solana-anchor/Anchor.toml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[features]
2+
resolution = true
3+
skip-lint = false
4+
5+
[programs.localnet]
6+
solana_anchor = "FpmpVrP57C6ADT8d4dQp9TkM1vmxohZJ5WEQQc9RGLPY"
7+
8+
[registry]
9+
url = "https://api.apr.dev"
10+
11+
[provider]
12+
cluster = "Localnet"
13+
wallet = "~/.config/solana/id.json"
14+
15+
[scripts]
16+
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
17+
18+
[test]
19+
[[test.genesis]]
20+
address = "pytd2yyk641x7ak7mkaasSJVXh6YYZnC7wTmtgAyxPt"
21+
program = "fixtures/pyth_lazer_solana_contract.so"

0 commit comments

Comments
 (0)