All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Note: Version 0 of Semantic Versioning is handled differently from version 1 and above. The minor version will be incremented upon a breaking change and the patch version will be incremented for features.
associated_token::authority
is used (#1240).workspace
and Wallet
exports (#1137).recent
to processed
and max
to finalized
(#1128)translateAddress
which currently leads to failing browser code. Now uses PublicKey
constructor instead of prototype chain constructor name checking which doesn't work in the presence of code minifying/mangling(#1138)init_if_needed
and init is not needed(#1221)programdata_address: Option<Pubkey>
field to Program
account. Will be populated if account is a program owned by the upgradable bpf loader (#1125)serialize
function because it has a default impl now. Similarly, they no longer have to implement try_deserialize
which now delegates to try_deserialize_unchecked
by default(#1156).set_inner
method to Account<'a, T>
to enable easy updates (#1177).fetch
and fetchMultiple
(#1171).AsRef<T>
for Account<'a, T>
(#1173)anchor expand
command which wraps around cargo expand
(#1160)Rc<dyn Signer>
instead of Keypair
(#975).#[repr(packed)]
to #[repr(C)]
for zero copy accounts (#1106).deprecated
attribute to ProgramAccount
(#1014).Cargo.toml
into extracted IDL (#1061).deprecated
attribute to Loader
(#1078).init_if_needed
attribute now checks that given attributes (e.g. space, owner, token::authority etc.) are validated even when init is not needed (#1096).ErrorCode::AccountNotInitialized
error to separate the situation when the account has the wrong owner from when it does not exist (#1024).no-log-ix-name
flag (#1057).ProgramData
and UpgradableLoaderState
can now be passed into Account
as generics. see UpgradeableLoaderState. UpgradableLoaderState
can also be matched on to get ProgramData
, but when ProgramData
is used instead, anchor does the serialization and checking that it is actually program data for you (#1095).postInstructions
and preInstructions
as a replacement for (the now deprecated) instructions
(#1007).getAccountInfo
helper method to account namespace/client (#1084).SystemAccount<'info>
account type for generic wallet addresses or accounts owned by the system program (#954)idl parse
subcommand (#941).os
and cpu
to npm package @project-serum/anchor-cli
(#976).solana-test-validator
in Anchor.toml (#834).target/types
directory now created on build to store a TypeScript types file for each program's IDL (#795).Program<T>
can now be typed with an IDL type (#795).mint::freeze_authority
keyword for mint initialization within #[derive(Accounts)]
(#835).AccountLoader
type for zero_copy
accounts with support for CPI (#792).#[account(init_if_needed)]
keyword for allowing one to invoke the same instruction even if the account was created already (#906).signer
, mut
, has_one
, owner
, raw constraints and address
(#905, #913).#[account(signer)]
constraint now enforce signer when the "cpi"
feature is enabled (#849).localnet
command for starting a local solana-test-validator
with the workspace deployed (#820).CpiContext
accounts must now be used with the accounts struct generated in the crate::cpi::accounts::*
module. These structs correspond to the accounts context for each instruction, except that each field is of type AccountInfo
(#824).--detach
flag to anchor test
(#770).associated_token
keyword for initializing associated token accounts within #[derive(Accounts)]
(#790).AccountMeta
s for Rust clients now properly set the isSigner
field (#762).Signer
type now sets isSigner to true in the IDL (#750).Program
type introduced for executable accounts (#705).Signer
type introduced for signing accounts where data is not used (#705).UncheckedAccount
type introduced as a preferred alias for AccountInfo
(#745).#[account(owner = <pubkey>)]
now requires a Pubkey
instead of an account (#691).Account
type to replace ProgramAccount
and CpiAccount
, both of which are deprecated (#686).Box
can be used with Account
types to reduce stack usage (#686).Owner
trait, which is automatically implemented by all #[account]
structs (#686).anchor-debug
only) (#681).declare_id!
(#686).Unnamed
structs instead of panic (#605).#[account(init, seeds = [...], mint::decimals = <expr>, mint::authority = <expr>)]
(#562).AsRef<AccountInfo>
for AccountInfo
wrappers (#652).trait Key
by removing AccountInfo
cloning (#652).#[account(init, seeds = [...], token = <expr>, authority = <expr>)]
to #[account(init, token::mint = <expr> token::authority = <expr>)]
(#562).#[associated]
and #[account(associated = <target>, with = <target>)]
are both removed (#612).anchor launch
command (#634).#[account(init)]
now creates the account inside the same instruction to be consistent with initializing PDAs. To maintain the old behavior of init
, replace it with #[account(zero)]
(#641).bump
must be provided when using the seeds
constraint. This has been added as an extra safety constraint to ensure that whenever a PDA is initialized via a constraint the bump used is the one created by Pubkey::find_program_address
(#641).try_from_init
has been removed from Loader
, ProgramAccount
, and CpiAccount
and replaced with try_from_unchecked
(#641).AccountsInit
trait (#641).try_from
methods for ProgramAccount
, Loader
, and ProgramState
now take in an additional program_id: &Pubkey
parameter (#660).anchor init
command "Workspace not found" regression (#598).[registry]
section in the Anchor toml (#570).anchor login <api-token>
command (#570).anchor publish <package>
command (#570).anchor_version
field to the Anchor.toml for specifying the anchor docker image to use for verifiable builds (#570).solana_version
field to the Anchor.toml for specifying the solana toolchain to use for verifiable builds (#570).init
(#587).[clusters.<network>]
Anchor.toml section has been renamed to [programs.<network>]
(#570).[workspace]
member and exclude arrays must now be filepaths relative to the workpsace root (#570).members
/ exclude
in config programs
section (#546).clusters.localnet
(#554).hex
by default for decoding Instruction (#547).CpiAccount::reload
mutates the existing struct instead of returning a new one (#526).[scripts]
test command (#550).require
macro for specifying assertions that return error codes on failure (#483).bump
keyword is added to the accounts constraints, which is used to add an optional bump seed to the end of a seeds
array. When used in conjunction with both init
and seeds
, then the program executes find_program_address
to assert that the given bump is the canonical bump (#483)..spec
suffix on TypeScript tests files (#441).belongs_to
constraint (#459).#[account(address = <expr>)]
constraint for asserting the address of an account (#400).#[account(init, token = <mint-target>, authority = <token-owner-target>...)]
constraint for initializing SPL token accounts as program derived addresses for the program. Can be used when initialized via seeds
or associated
(#400).associated_seeds!
macro for generating signer seeds for CPIs signed by an #[account(associated = <target>)]
account (#400).[scripts]
section to the Anchor.toml for specifying workspace scripts that can be run via anchor run <script>
(#400).[clusters.<network>]
table entries can now also use { address = <base58-str>, idl = <filepath-str> }
to specify workspace programs (#400).--yarn
flag in favor of using npx
(#432).&[u8]
parameter (#386).--program-name
option for build command to build a single program at a time (#362).#[account(close = <destination>)]
constraint for closing accounts and sending the rent exemption lamports to a specified destination account (#371).remaining_accounts
with CpiContext
by implementing the ToAccountMetas
trait on CpiContext
(#351).SetAuthority
instruction (#307).constraint = <expression>
added as a replacement for (the now deprecated) string literal constraints (#341).anchor.workspace
clients (#310).<program>.account.<my-account>
and <program>.state
namespaces now require explicitly invoking the fetch
API. For example, program.account.myAccount(<adddress>)
and program.state()
is now program.account.myAccount.fetch(<address>)
and program.state.fetch()
(#322).#[account(associated)]
now requires init
to be provided to create an associated account. If not provided, then the address will be assumed to exist, and a constraint will be added to ensure the correctness of the address (#318).#[state]
account discriminator to be namespaced by "state:" (#320).:
to be consistent with accounts (#321).mut
(#341).space
constraints must now be literal integers instead of literal strings (#341).program.simulate
namespace (#266).Address
type, allowing one to use Base 58 encoded strings in public APIs (#304).web3.Account
with web3.Signer
in public APIs (#296).anchor.workspace
clients can now be customized per network with [cluster.<slug>]
in the Anchor.toml (#308).--skip-build
flag to test command (301).anchor shell
command to spawn a node shell populated with an Anchor.toml based environment (#303).wallet
and cluster
settings must now be under the [provider]
table (#305).decode
API changed to decode strings directly instead of buffers (#292).encode
API removed (#292).anchor-debug
feature flag for logging (#253).RequestBuilder::new
to RequestBuilder::from
(#248).instruction::state::Ctor
struct to instruction::state::New
(#248).with
targets when creating associated acconts (#197).#[account(owner = <program>)]
constraint (#178).#[account(associated = <target>)]
and #[associated]
attributes for creating associated program accounts within programs. The TypeScript package can fetch these accounts with a new <program>.account.<account-name>.associated
(and associatedAddress
) method (#186).#[account]
s are now parsed into the IDL correctly (#177).#[state]
account's size (#121).#[account(executable)]
attribute (#140).Cluster
struct when constructing clients (#89).IdlAccount
to be namespaced by "internal"
(#128).-#![feature(proc_macro_hygiene)]
. (#139).IdlInstruction::Clear
(#107)..anchor/program-logs
directory when testing (ce5ca7).Initial release.
anchor-lang
crate providing a Rust eDSL for Solana.anchor-spl
crate providing CPI clients for Anchor programs.anchor-client
crate providing Rust clients for Anchor programs.@project-serum/anchor
package for generating TypeScript clients.