Skip to content

Commit a3688e9

Browse files
committed
updated more doc files. changes after review
1 parent fe9a778 commit a3688e9

File tree

10 files changed

+146
-48
lines changed

10 files changed

+146
-48
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ The minor version will be incremented upon a breaking change and the patch versi
107107
- idl: Remove the conflicting account names check ([#4294](https://github.com/solana-foundation/anchor/pull/4294)).
108108
- deps: Update to Solana 3.0 ([#4031](https://github.com/solana-foundation/anchor/pull/4031)).
109109
- idl: Remove legacy IDL instructions and integrate Program Metadata for IDL management ([#3798](https://github.com/solana-foundation/anchor/pull/3798)).
110-
- ts: Rename TypeScript packages from `@coral-xyz/anchor` to `@anchor-lang/anchor` ([#4141](https://github.com/solana-foundation/anchor/pull/4141)).
110+
- ts: Rename TypeScript packages from `@coral-xyz/anchor` to `@anchor-lang/core` ([#4141](https://github.com/solana-foundation/anchor/pull/4141)).
111111
- lang: Remove program account info from CPI context ([#2762](https://github.com/solana-foundation/anchor/pull/2762)).
112112
- cli: Remove dependency on the external `solana` CLI; native implementations provided for balance, airdrop, address, deploy, and other commands ([#4099](https://github.com/solana-foundation/anchor/pull/4099)).
113113
- idl: Disallow multiple `#[error_code]` definitions in a single program ([#4300](https://github.com/solana-foundation/anchor/pull/4300)).

docs/content/docs/installation.mdx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ After installation, you should see output similar to the following:
2929
```
3030
Installed Versions:
3131
Rust: rustc 1.85.0 (4d91de4e4 2025-02-17)
32-
Solana CLI: solana-cli 2.1.15 (src:53545685; feat:3271415109, client:Agave)
33-
Anchor CLI: anchor-cli 0.32.1
32+
Solana CLI: solana-cli 3.1.10 (src:7bc9c805; feat:1620780344, client:Agave)
33+
Anchor CLI: anchor-cli 1.0.0
3434
Node.js: v23.9.0
3535
Yarn: 1.22.1
3636
@@ -413,9 +413,11 @@ If you see this error message, follow these steps:
413413

414414
#### Node.js and Yarn
415415

416-
Node.js and Yarn are required to run the default Anchor project test file
417-
(TypeScript) created with the `anchor init` command. (Rust test template is also
418-
available using `anchor init --test-template rust`)
416+
Node.js and Yarn are required for project initialization and when using
417+
a TypeScript-based test template (`mocha`, `jest`). The default test template
418+
(`litesvm`) does not run TypeScript tests, so they are not needed for
419+
day-to-day development once initialization is complete. They are expected to
420+
become fully optional in a future release.
419421

420422
<Accordions>
421423
<Accordion title="Node Installation">
@@ -727,8 +729,13 @@ anchor init my-project
727729
```
728730

729731
This command creates a new directory with the project name and initializes a new
730-
Anchor project with a modular Rust program structure and TypeScript test
731-
template.
732+
Anchor project with a modular Rust program structure. By default, tests are
733+
written in Rust using the [LiteSVM](https://github.com/LiteSVM/litesvm) crate.
734+
Use `--test-template` to choose a different template (`mollusk`, `mocha`, `jest`, etc):
735+
736+
```shell title="Terminal"
737+
anchor init my-project --test-template mollusk
738+
```
732739

733740
<Callout type="info">
734741

docs/content/docs/references/anchor-toml.mdx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ Override toolchain data in the workspace similar to
218218

219219
```toml
220220
[toolchain]
221-
anchor_version = "0.32.1" # `anchor-cli` version to use(requires `avm`)
221+
anchor_version = "1.0.0" # `anchor-cli` version to use(requires `avm`)
222222
solana_version = "3.1.11" # Solana version to use(applies to all Solana tools)
223223
package_manager = "yarn" # JS package manager to use
224224
```
@@ -258,3 +258,13 @@ post-test = "exit 1"
258258
# pre-deploy = []
259259
# post-deploy = []
260260
```
261+
262+
## registry (removed)
263+
264+
The `[registry]` section is no longer supported and has been removed in
265+
`1.0.0`. If your `Anchor.toml` contains this section, remove it:
266+
267+
```diff
268+
- [registry]
269+
- url = "https://anchor.projectserum.com"
270+
```

docs/content/docs/references/avm.mdx

Lines changed: 74 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ OPTIONS:
2020
-V, --version Print version information
2121

2222
SUBCOMMANDS:
23-
help Print this message or the help of the given subcommand(s)
24-
install Install a version of Anchor
25-
list List available versions of Anchor
26-
uninstall Uninstall a version of Anchor
27-
use Use a specific version of Anchor
23+
help Print this message or the help of the given subcommand(s)
24+
install Install a version of Anchor
25+
list List available versions of Anchor
26+
uninstall Uninstall a version of Anchor
27+
update Update to the latest Anchor version
28+
use Use a specific version of Anchor
29+
self-update Update avm itself to the latest version
2830
```
2931

3032
## Install
@@ -35,11 +37,21 @@ avm install <VERSION_OR_COMMIT>
3537

3638
Install the specified version of anchor-cli. The version argument should follow
3739
semver versioning. It is also possible to use `latest` as the version argument
38-
to install the latest version.
40+
to install the latest stable version, or `latest-pre-release` for the latest
41+
pre-release:
3942

40-
It's also possible to install based on a specific commit hash:
43+
```shell
44+
avm install latest
45+
avm install latest-pre-release
46+
```
47+
48+
It's also possible to install based on a specific commit hash or a pre-release
49+
version tag:
4150

4251
```shell
52+
# Specific pre-release
53+
avm install 1.0.0-rc.3
54+
4355
# <VERSION>-<COMMIT>
4456
avm install 0.30.1-cfe82aa682138f7c6c58bf7a78f48f7d63e9e466
4557

@@ -53,7 +65,14 @@ avm install cfe82aa
5365
## List
5466

5567
```shell
56-
avm list
68+
avm list [--pre-release]
69+
```
70+
71+
List available versions. Pass `--pre-release` to include pre-release versions
72+
in the output:
73+
74+
```shell
75+
avm list --pre-release
5776
```
5877

5978
## Uninstall
@@ -62,12 +81,57 @@ avm list
6281
avm uninstall <version>
6382
```
6483

84+
## Update
85+
86+
```shell
87+
avm update [--pre-release]
88+
```
89+
90+
Update to the latest stable version. Pass `--pre-release` to allow updating to
91+
the latest pre-release instead:
92+
93+
```shell
94+
avm update --pre-release
95+
```
96+
6597
## Use
6698

6799
```shell
68100
avm use <version>
69101
```
70102

71103
Use a specific version. This version will remain in use until you change it by
72-
calling the same command again. Similarly to `avm install`, you can also use
73-
`latest` for the version.
104+
calling the same command again. Similarly to `avm install`, you can use
105+
`latest` or `latest-pre-release` for the version argument:
106+
107+
```shell
108+
avm use latest
109+
avm use latest-pre-release
110+
```
111+
112+
## Self-update
113+
114+
```shell
115+
avm self-update [--pre-release] [--bleeding-edge]
116+
```
117+
118+
Update `avm` itself. By default installs the latest stable release of `avm`.
119+
120+
| Flag | Description |
121+
|------|-------------|
122+
| `--pre-release` | Update to the latest pre-release version instead of the latest stable |
123+
| `--bleeding-edge` | Build and install from the latest commit on the master branch (conflicts with `--pre-release`) |
124+
125+
```shell
126+
# Update avm to latest stable
127+
avm self-update
128+
129+
# Update avm to latest pre-release
130+
avm self-update --pre-release
131+
132+
# Install from the tip of master
133+
avm self-update --bleeding-edge
134+
```
135+
136+
`avm` will also passively warn you when it detects that a newer version of
137+
itself is available.

docs/content/docs/references/cli.mdx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,21 +160,23 @@ Generates the IDL for the program using the compilation method.
160160
### Idl Init
161161

162162
```shell
163-
anchor idl init -f <target/idl/program.json> <program-id>
163+
anchor idl init -f <target/idl/program.json> [program-id]
164164
```
165165

166166
Creates an idl account, writing the given `<target/idl/program.json>` file into
167167
a program owned account. By default, the size of the account is double the size
168168
of the IDL, allowing room for growth in case the idl needs to be upgraded in the
169169
future.
170170

171+
The `program-id` argument is optional — when omitted, `idl.address` is used.
172+
171173
### Idl Fetch
172174

173175
```shell
174176
anchor idl fetch -o <out-file.json> <program-id>
175177
```
176178

177-
Fetches an IDL from the configured blockchain. For example, make sure your
179+
Fetches an IDL from the configured blockchain. For example, make sure your
178180
`Anchor.toml` is pointing to the `mainnet` cluster and run
179181

180182
```shell
@@ -202,11 +204,12 @@ configured wallet must be the current authority.
202204
### Idl Upgrade
203205

204206
```shell
205-
anchor idl upgrade <program-id> -f <target/idl/program.json>
207+
anchor idl upgrade -f <target/idl/program.json>
206208
```
207209

208210
Upgrades the IDL file on chain to the new `target/idl/program.json` idl. The
209-
configured wallet must be the current authority.
211+
configured wallet must be the current authority. The `program-id` argument is
212+
optional — when omitted, `idl.address` is used.
210213

211214
```shell
212215
anchor idl set-authority -n <new-authority> -p <program-id>
@@ -327,7 +330,9 @@ Run an integration test suit against the configured cluster, deploying new
327330
versions of all workspace programs before running them.
328331

329332
If the configured network is a localnet, then automatically starts the
330-
localnetwork and runs the test.
333+
local network and runs the test. By default, [Surfpool](https://github.com/txtx/surfpool)
334+
is used as the local network backend. To use `solana-test-validator` instead,
335+
pass `--validator legacy`.
331336

332337
<Callout title="Note">
333338
Be sure to shutdown any other local validators, otherwise `anchor test` will fail to run.

docs/content/docs/tokens/basics/mint-tokens.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ pub fn mint_tokens(ctx: Context<MintTokens>, amount: u64) -> Result<()> {
343343
to: ctx.accounts.token_account.to_account_info(),
344344
authority: ctx.accounts.mint.to_account_info(),
345345
};
346-
let cpi_program = ctx.accounts.token_program.to_account_info();
346+
let cpi_program = ctx.accounts.token_program.key();
347347
// [!code highlight:2]
348348
let cpi_context = CpiContext::new(cpi_program, cpi_accounts).with_signer(signer_seeds);
349349
token_interface::mint_to(cpi_context, amount)?;

docs/content/docs/tokens/basics/transfer-tokens.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub mod token_example {
6666
to: ctx.accounts.recipient_token_account.to_account_info(),
6767
authority: ctx.accounts.signer.to_account_info(),
6868
};
69-
let cpi_program = ctx.accounts.token_program.to_account_info();
69+
let cpi_program = ctx.accounts.token_program.key();
7070
let cpi_context = CpiContext::new(cpi_program, cpi_accounts);
7171
// [!code highlight]
7272
token_interface::transfer_checked(cpi_context, amount, decimals)?;
@@ -129,7 +129,7 @@ pub fn transfer_tokens(ctx: Context<TransferTokens>, amount: u64) -> Result<()>
129129
};
130130

131131
// The program being invoked in the CPI
132-
let cpi_program = ctx.accounts.token_program.to_account_info();
132+
let cpi_program = ctx.accounts.token_program.key();
133133

134134
// Combine the accounts and program into a "CpiContext"
135135
let cpi_context = CpiContext::new(cpi_program, cpi_accounts);
@@ -172,7 +172,7 @@ pub mod token_example {
172172
to: ctx.accounts.token_account.to_account_info(),
173173
authority: ctx.accounts.mint.to_account_info(),
174174
};
175-
let cpi_program = ctx.accounts.token_program.to_account_info();
175+
let cpi_program = ctx.accounts.token_program.key();
176176
let cpi_context = CpiContext::new(cpi_program, cpi_accounts).with_signer(signer_seeds);
177177
token_interface::mint_to(cpi_context, amount)?;
178178
Ok(())
@@ -190,7 +190,7 @@ pub mod token_example {
190190
to: ctx.accounts.recipient_token_account.to_account_info(),
191191
authority: ctx.accounts.sender_token_account.to_account_info(),
192192
};
193-
let cpi_program = ctx.accounts.token_program.to_account_info();
193+
let cpi_program = ctx.accounts.token_program.key();
194194
let cpi_context = CpiContext::new(cpi_program, cpi_accounts).with_signer(signer_seeds);
195195
token_interface::transfer_checked(cpi_context, amount, decimals)?;
196196
Ok(())

docs/content/docs/updates/changelog.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ patch version will be incremented for features.
165165
management
166166
([#3798](https://github.com/solana-foundation/anchor/pull/3798)).
167167
- ts: Rename TypeScript packages from `@coral-xyz/anchor` to
168-
`@anchor-lang/anchor`
168+
`@anchor-lang/core`
169169
([#4141](https://github.com/solana-foundation/anchor/pull/4141)).
170170
- lang: Remove program account info from CPI context
171171
([#2762](https://github.com/solana-foundation/anchor/pull/2762)).

docs/content/docs/updates/release-notes/1-0-0.mdx

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ the
2626
Otherwise, bootstrap using `cargo install`:
2727

2828
```sh
29-
cargo install avm --git https://github.com/solana-foundation/anchor --tag v1.0.0 --locked
29+
cargo install avm --git https://github.com/solana-foundation/anchor --locked
3030
```
3131

3232
2. Update `anchor-cli`:
@@ -272,11 +272,23 @@ pub struct MigrateMyAccount<'info> {
272272

273273
The account is deserialized as `From`, and serialized back as `To` on exit.
274274

275-
### `declare_program!` instruction parser
275+
### `declare_program!` improvements
276276

277-
`declare_program!` now generates a typed instruction parser alongside the CPI
278-
helpers. Use `my_program::parsers::Instruction::try_from_bytes` to decode any
279-
instruction belonging to the program from its raw bytes.
277+
The `utils` module generated by `declare_program!` has been renamed to
278+
`parsers`. Update any existing references:
279+
280+
```diff
281+
- my_program::utils::Account::try_from_bytes(&data)?;
282+
+ my_program::parsers::Account::parse(&data)?;
283+
284+
- my_program::utils::Event::try_from_bytes(&data)?;
285+
+ my_program::parsers::Event::parse(&data)?;
286+
```
287+
288+
`declare_program!` also now generates a typed instruction parser alongside the
289+
CPI helpers. Use `my_program::parsers::Instruction::parse` with a
290+
`solana_instruction::Instruction` to decode any instruction belonging to the
291+
program.
280292

281293
### Use `declare_program!` with only `anchor_client`
282294

@@ -299,7 +311,7 @@ pub fn my_handler<'a, 'b, 'c, 'info>(
299311
// After (v1)
300312
pub fn my_handler<'info>(ctx: Context<'info, MyAccounts<'info>>) -> Result<()> { ... }
301313
// or simply (when the lifetime is inferred)
302-
pub fn my_handler(ctx: Context<MyAccounts<'_>>) -> Result<()> { ... }
314+
pub fn my_handler(ctx: Context<MyAccounts>) -> Result<()> { ... }
303315
```
304316

305317
### Deprecate `AccountInfo` in `Accounts` macro
@@ -311,7 +323,9 @@ type.
311323
### Relaxed PDA seed syntax
312324

313325
The seed expressions accepted inside `seeds = [...]` constraints are now more
314-
flexible and support a broader set of Rust expressions.
326+
flexible and support a broader set of Rust expressions. Note that more complex seed expressions reduce the likelihood of seeds being
327+
representable in the IDL and of successful automatic account resolution on
328+
the client side.
315329

316330
### Owner check on account reload
317331

@@ -327,14 +341,9 @@ validation when the concrete program type is not known statically:
327341
pub program: Program<'info>,
328342
```
329343

330-
### `common::close` accepts references
331-
332-
The `common::close` utility now accepts both owned and referenced account
333-
infos, removing the need for manual `.to_account_info()` calls at call sites.
334-
335344
### `Owners` exported from `prelude`
336345

337-
`anchor_lang::prelude::Owners` is now re-exported from the prelude, so you no
346+
`anchor_lang::Owners` is now re-exported from the prelude, so you no
338347
longer need a separate `use` statement for it.
339348

340349
### Borsh upgraded to 1.5.7
@@ -388,11 +397,14 @@ changes.
388397
`program.on::<Event>(|event, slot| { ... })` now accepts `FnMut` closures,
389398
allowing you to capture mutable state from the surrounding scope.
390399

391-
### All public API types exported
400+
### Reduced re-exports from `anchor-client`
392401

393-
All types used in the public API surface of `anchor-client` are now
394-
re-exported, so you no longer need to hunt for the correct sub-crate to import
395-
them from.
402+
`anchor-client` previously re-exported the entirety of `solana-sdk`, which
403+
made it easy to discover types but pulled in a large dependency. It now only
404+
re-exports the types that are directly part of its public API. If you were
405+
relying on transitive `solana-sdk` types through `anchor-client`, you will
406+
need to add the relevant crates (`solana-account`, `solana-pubkey`, etc.) as
407+
explicit dependencies.
396408

397409
---
398410

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"title": "Release Notes",
3-
"pages": ["0-32-1", "0-32-0", "0-31-1", "0-31-0", "0-30-1", "0-30-0", "0-29-0"]
3+
"pages": ["1-0-0", "0-32-1", "0-32-0", "0-31-1", "0-31-0", "0-30-1", "0-30-0", "0-29-0"]
44
}

0 commit comments

Comments
 (0)