Skip to content
Merged
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
10 changes: 5 additions & 5 deletions .github/workflows/anchor-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,22 +206,22 @@ jobs:
# Pinned to match the anchor-lang/anchor-spl crate version the programs depend on.
# The key deliberately differs from the old avm-based one so a cache entry
# holding an avm-built binary is never restored over this.
key: anchor-cli-crates-io-${{ runner.os }}-1.2.0
- name: Install Anchor 1.2.0
key: anchor-cli-crates-io-${{ runner.os }}-1.2.1
- name: Install Anchor 1.2.1
run: |
export PATH="$HOME/.cargo/bin:$PATH"
# `anchor --version` can emit more than one line; read the first line only so
# a multi-line value never reaches downstream parsing.
current="$(anchor --version 2>/dev/null | head -n1 | awk '{print $2}' || true)"
if [ "$current" != "1.2.0" ]; then
if [ "$current" != "1.2.1" ]; then
# Install the CLI from crates.io rather than through avm, matching the
# Anchor v2 job. `cargo install --git ... avm` builds avm from the tip of
# anchor's main branch, so what CI installs drifts with whatever landed
# there. 1.2.0 is an ordinary published release — unlike the 2.0.0-rc.1
# there. 1.2.1 is an ordinary published release — unlike the 2.0.0-rc.1
# pre-release that forced the v2 job off avm — so the CLI comes straight
# from the registry. --locked builds it against its own published lockfile
# so the result does not drift with the registry either.
cargo install anchor-cli --version 1.2.0 --locked --force
cargo install anchor-cli --version 1.2.1 --locked --force
fi
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Install Surfpool
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to this repository are documented here.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [2026-10-15] - Anchor v1 examples on Anchor 1.2.1

Anchor 1.2.1 is a patch release of the v1 line. Its one change is an opt-in
`solana-v4` feature on `anchor-lang` for building against the Solana v4 crates; no
example turns it on, so no program or test source changed.

### Changed

- All 57 `anchor-v1/` examples move `anchor-lang` and `anchor-spl` from `1.2.0` to
`1.2.1`. Feature lists are unchanged.
- The Anchor v1 workflow installs and caches `anchor-cli 1.2.1` instead of `1.2.0`.
- Every `anchor-v1/` README, `CONTRIBUTING.md` and `docs/anchor-v2-migration.md`
name 1.2.1 as the v1 CLI to install.

## [2026-10-15] - solana-kite 0.6.1

### Changed
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ See [CHANGELOG.md](./CHANGELOG.md) for release history. This file had no changel

- Each example lives at `category/example-name/<framework>/`, e.g. `basics/counter/anchor/`.
- Supported frameworks: `anchor`, `anchor-v1`, `quasar`, `pinocchio`, `native`, `asm`. Use the existing layout as a reference.
- `anchor-v1/` is Anchor v1 (1.2.0), the current stable Anchor. `anchor/` is the same example
- `anchor-v1/` is Anchor v1 (1.2.1), the current stable Anchor. `anchor/` is the same example
on Anchor v2 (2.0.0-rc.1), the release candidate for the next major version, and is where new
Anchor work starts; the v1 copy tracks its v2 counterpart. A change to what an example does (a new handler, a new check, a
fix, a renamed field) goes into both copies, in the same pull request where practical, so a
Expand All @@ -34,7 +34,7 @@ See [CHANGELOG.md](./CHANGELOG.md) for release history. This file had no changel
Run an example's tests with the command for its framework, from the framework directory (e.g. `basics/counter/anchor/`):

- **Anchor v2** (in `anchor/`): `anchor test` (runs `cargo test`, per the `[scripts]` table in `Anchor.toml`), with the v2 CLI: `cargo install anchor-cli --version 2.0.0-rc.1 --locked`.
- **Anchor v1** (in `anchor-v1/`): the same `anchor test`, with the v1 CLI: `avm install 1.2.0 && avm use 1.2.0`. Selecting the wrong CLI is the usual cause of a confusing build failure in these directories.
- **Anchor v1** (in `anchor-v1/`): the same `anchor test`, with the v1 CLI: `avm install 1.2.1 && avm use 1.2.1`. Selecting the wrong CLI is the usual cause of a confusing build failure in these directories.
Anchor v1 tests send v1 transactions (4,096 bytes, resource limits in the message) through
`solana-kite` 0.6. Its senders take a last `compute_unit_limit: Option<u32>`: pass `None` and kite
simulates the transaction and sends it with the compute units the simulation used. A test that needs the
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Working, tested, up-to-date examples of common Solana programs (what other chain

Each example is available in one or more of the following frameworks:

- [⚓ Anchor v1](https://www.anchor-lang.com/) - the most popular framework for Solana development, in its current major version. Lives in `anchor-v1/`. Install with `avm install 1.2.0 && avm use 1.2.0`, build with `anchor build`, test with `anchor test`.
- [⚓ Anchor v1](https://www.anchor-lang.com/) - the most popular framework for Solana development, in its current major version. Lives in `anchor-v1/`. Install with `avm install 1.2.1 && avm use 1.2.1`, build with `anchor build`, test with `anchor test`.
- [⚓ Anchor v2](https://www.anchor-lang.com/) - the next major version of Anchor, a ground-up rewrite that is not yet released. Lives in `anchor/`, alongside the v1 copy of the same example, and builds on the release candidate: install with `cargo install anchor-cli --version 2.0.0-rc.1 --locked`, then the same `anchor build` / `anchor test`.
- [💫 Quasar](https://quasar-lang.com/docs) - a newer, more performant framework with Anchor-compatible ergonomics. Build with `quasar build`, test with `quasar test`.
- [🤥 Pinocchio](https://github.com/anza-xyz/pinocchio) - a zero-copy, zero-allocation library for Solana programs. Build with `cargo build-sbf --manifest-path=./program/Cargo.toml`, test with `cargo test --manifest-path=./program/Cargo.toml`.
Expand Down
4 changes: 2 additions & 2 deletions basics/account-data/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Account Data (Anchor)

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Store and retrieve arbitrary data in a Solana [account](https://solana.com/docs/terminology#account) owned by this [program](https://solana.com/docs/terminology#program).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
4 changes: 2 additions & 2 deletions basics/checking-accounts/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Checking Accounts (Anchor)

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Validate that accounts passed into an [instruction](https://solana.com/docs/terminology#instruction) meet signer, owner, and address constraints before handler logic runs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
4 changes: 2 additions & 2 deletions basics/close-account/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Close Account

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Two [instruction handlers](https://solana.com/docs/terminology#instruction-handler): `create_user` initializes a [PDA](https://solana.com/docs/terminology#program-derived-address-pda) `User` [account](https://solana.com/docs/terminology#account), and `close_user` closes it and returns the [rent](https://solana.com/docs/terminology#rent) to the user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
4 changes: 2 additions & 2 deletions basics/counter/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Counter (Anchor)

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Increment a global counter stored in a [PDA](https://solana.com/docs/terminology#program-derived-address-pda). [Anchor](https://solana.com/docs/terminology#anchor) adds an explicit `initialize` handler that the native variant handles differently.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
4 changes: 2 additions & 2 deletions basics/create-account/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Create Account (Anchor)

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Create new onchain accounts and fund them for rent exemption using the System Program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
4 changes: 2 additions & 2 deletions basics/cross-program-invocation/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Cross-Program Invocation (Anchor)

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Invoke another program from this one (hand program calls lever program) using CPI.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
4 changes: 2 additions & 2 deletions basics/favorites/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Favorites (Anchor)

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Store per-user favorites in a [PDA](https://solana.com/docs/terminology#program-derived-address-pda). [Account](https://solana.com/docs/terminology#account) constraints ensure each user can only modify their own data.
Expand Down
2 changes: 1 addition & 1 deletion basics/favorites/anchor-v1/programs/favorites/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = {version = "1.2.0", features = ["init-if-needed"]}
anchor-lang = {version = "1.2.1", features = ["init-if-needed"]}

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
4 changes: 2 additions & 2 deletions basics/hello-solana/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Hello Solana (Anchor)

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Minimal program that logs a greeting. Introduces transactions, instructions, and program entrypoints.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
4 changes: 2 additions & 2 deletions basics/pda-rent-payer/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# PDA Rent Payer (Anchor)

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Use a [PDA](https://solana.com/docs/terminology#program-derived-address-pda) to pay [rent](https://solana.com/docs/terminology#rent) when creating another account.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
4 changes: 2 additions & 2 deletions basics/processing-instructions/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Processing Instructions (Anchor)

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Pass arguments into an [instruction handler](https://solana.com/docs/terminology#instruction-handler) and use them in program logic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
4 changes: 2 additions & 2 deletions basics/program-derived-addresses/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Program Derived Addresses (Anchor)

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Derive and use PDAs as deterministic account addresses for program-owned state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
4 changes: 2 additions & 2 deletions basics/pyth/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Pyth Price Feeds (Anchor)

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Read a [Pyth](https://pyth.network/) price feed account and log price, confidence, and exponent.
Expand Down
2 changes: 1 addition & 1 deletion basics/pyth/anchor-v1/programs/pythexample/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ custom-panic = []


[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
# Self-dependency with no-entrypoint: host test builds otherwise export a
Expand Down
4 changes: 2 additions & 2 deletions basics/realloc/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Realloc (Anchor)

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Grow or shrink account data when variable-length storage is required.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
4 changes: 2 additions & 2 deletions basics/rent/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Rent (Anchor)

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Calculate account size and the minimum rent-exempt [lamport](https://solana.com/docs/terminology#lamport) balance.
Expand Down
2 changes: 1 addition & 1 deletion basics/rent/anchor-v1/programs/rent-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
4 changes: 2 additions & 2 deletions basics/repository-layout/anchor-v1/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Repository Layout (Anchor)

> [!NOTE]
> This is the **Anchor v1** copy of this example, on Anchor 1.2.0, the current
> This is the **Anchor v1** copy of this example, on Anchor 1.2.1, the current
> stable Anchor release. Every `anchor` command on this page needs the v1 CLI:
> `avm install 1.2.0 && avm use 1.2.0`. The Anchor v2 version of this example is in
> `avm install 1.2.1 && avm use 1.2.1`. The Anchor v2 version of this example is in
> [`../anchor`](../anchor/).

Organize a larger program across modules (state, instructions, errors) instead of a single file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom-heap = []
custom-panic = []

[dependencies]
anchor-lang = "1.2.0"
anchor-lang = "1.2.1"

[dev-dependencies]
litesvm = "0.16.0"
Expand Down
Loading
Loading