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.
- lang: Add
SystemAccount<'info>
account type for generic wallet addresses or accounts owned by the system program (#954)
- cli: fix dns in NODE_OPTIONS (#928).
- cli: output TypeScript IDL in
idl parse
subcommand (#941). - cli: Add fields
os
andcpu
to npm package@project-serum/anchor-cli
(#976). - cli: Allow specify output directory for TypeScript IDL (#940).
- cli: Add support for configuration options for
solana-test-validator
in Anchor.toml (#834). - cli:
target/types
directory now created on build to store a TypeScript types file for each program's IDL (#795). - ts:
Program<T>
can now be typed with an IDL type (#795). - lang: Add
mint::freeze_authority
keyword for mint initialization within#[derive(Accounts)]
(#835). - lang: Add
AccountLoader
type forzero_copy
accounts with support for CPI (#792). - lang: Add
#[account(init_if_needed)]
keyword for allowing one to invoke the same instruction even if the account was created already (#906). - lang: Add custom errors support for raw constraints (#905).
- lang, cli, spl: Update solana toolchain to v1.8.0 (#886).
- lang: Add custom errors support for
signer
,mut
,has_one
,owner
, raw constraints andaddress
(#905, #913).
- lang: Accounts marked with the
#[account(signer)]
constraint now enforce signer when the"cpi"
feature is enabled (#849).
- cli: Add
localnet
command for starting a localsolana-test-validator
with the workspace deployed (#820).
CpiContext
accounts must now be used with the accounts struct generated in thecrate::cpi::accounts::*
module. These structs correspond to the accounts context for each instruction, except that each field is of typeAccountInfo
(#824).
- lang: Add
--detach
flag toanchor test
(#770). - lang: Add
associated_token
keyword for initializing associated token accounts within#[derive(Accounts)]
(#790). - cli: Allow passing through cargo flags for build command (#719).
- cli: Allow passing through cargo flags for test, verify, and publish commands (#804).
- lang: Generated
AccountMeta
s for Rust clients now properly set theisSigner
field (#762).
- lang:
Signer
type now sets isSigner to true in the IDL (#750).
- lang:
Program
type introduced for executable accounts (#705). - lang:
Signer
type introduced for signing accounts where data is not used (#705). - lang:
UncheckedAccount
type introduced as a preferred alias forAccountInfo
(#745).
- lang:
#[account(owner = <pubkey>)]
now requires aPubkey
instead of an account (#691).
- lang: Add new
Account
type to replaceProgramAccount
andCpiAccount
, both of which are deprecated (#686). - lang:
Box
can be used withAccount
types to reduce stack usage (#686). - lang: Add
Owner
trait, which is automatically implemented by all#[account]
structs (#686). - lang: Check that ProgramAccount writable before mut borrow (
anchor-debug
only) (#681).
- lang: All programs must now define their program id in source via
declare_id!
(#686).
- lang: Ignore
Unnamed
structs instead of panic (#605). - lang: Add constraints for initializing mint accounts as pdas,
#[account(init, seeds = [...], mint::decimals = <expr>, mint::authority = <expr>)]
(#562). - lang: Add
AsRef<AccountInfo>
forAccountInfo
wrappers (#652). - lang: Optimize
trait Key
by removingAccountInfo
cloning (#652). - cli, client, lang: Update solana toolchain to v1.7.11 (#653).
- lang: Change
#[account(init, seeds = [...], token = <expr>, authority = <expr>)]
to#[account(init, token::mint = <expr> token::authority = <expr>)]
(#562). - lang:
#[associated]
and#[account(associated = <target>, with = <target>)]
are both removed (#612). - cli: Removed
anchor launch
command (#634). - lang:
#[account(init)]
now creates the account inside the same instruction to be consistent with initializing PDAs. To maintain the old behavior ofinit
, replace it with#[account(zero)]
(#641). - lang:
bump
must be provided when using theseeds
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 byPubkey::find_program_address
(#641). - lang:
try_from_init
has been removed fromLoader
,ProgramAccount
, andCpiAccount
and replaced withtry_from_unchecked
(#641). - lang: Remove
AccountsInit
trait (#641). - lang:
try_from
methods forProgramAccount
,Loader
, andProgramState
now take in an additionalprogram_id: &Pubkey
parameter (#660).
- cli: Fix
anchor init
command "Workspace not found" regression (#598).
- cli: Programs embedded into genesis during tests will produce program logs (#594).
- cli: Allows Cargo.lock to exist in workspace subdirectories when publishing (#593).
- cli: Adds a
[registry]
section in the Anchor toml (#570). - cli: Adds the
anchor login <api-token>
command (#570). - cli: Adds the
anchor publish <package>
command (#570). - cli: Adds a root level
anchor_version
field to the Anchor.toml for specifying the anchor docker image to use for verifiable builds (#570). - cli: Adds a root level
solana_version
field to the Anchor.toml for specifying the solana toolchain to use for verifiable builds (#570). - lang: Dynamically fetch rent sysvar for when using
init
(#587).
- cli:
[clusters.<network>]
Anchor.toml section has been renamed to[programs.<network>]
(#570). - cli:
[workspace]
member and exclude arrays must now be filepaths relative to the workpsace root (#570).
- cli: Add keys
members
/exclude
in configprograms
section (#546). - cli: Allow program address configuration for test command through
clusters.localnet
(#554). - lang: IDLs are now parsed from the entire crate (#517).
- spl: Dex permissioned markets proxy (#519, #543).
- ts: Use
hex
by default for decoding Instruction (#547). - lang:
CpiAccount::reload
mutates the existing struct instead of returning a new one (#526). - cli: Anchor.toml now requires an explicit
[scripts]
test command (#550).
- lang: Adds
require
macro for specifying assertions that return error codes on failure (#483). - lang: Allow one to specify arbitrary programs as the owner when creating PDA (#483).
- lang: A new
bump
keyword is added to the accounts constraints, which is used to add an optional bump seed to the end of aseeds
array. When used in conjunction with bothinit
andseeds
, then the program executesfind_program_address
to assert that the given bump is the canonical bump (#483).
- lang: Preserve all instruction data for fallback functions (#483).
- ts: Event listener not firing when creating associated accounts (#356).
- lang: Add fallback functions (#457).
- lang: Add feature flag for using the old state account discriminator. This is a temporary flag for those with programs built prior to v0.7.0 but want to use the latest Anchor version. Expect this to be removed in a future version (#446).
- lang: Add generic support to Accounts (#496).
- cli: Remove
.spec
suffix on TypeScript tests files (#441). - lang: Remove
belongs_to
constraint (#459).
- lang: Add
#[account(address = <expr>)]
constraint for asserting the address of an account (#400). - lang: Add
#[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 viaseeds
orassociated
(#400). - lang: Add
associated_seeds!
macro for generating signer seeds for CPIs signed by an#[account(associated = <target>)]
account (#400). - cli: Add
[scripts]
section to the Anchor.toml for specifying workspace scripts that can be run viaanchor run <script>
(#400). - cli:
[clusters.<network>]
table entries can now also use{ address = <base58-str>, idl = <filepath-str> }
to specify workspace programs (#400).
- cli: Remove
--yarn
flag in favor of usingnpx
(#432).
- lang: Instruction data is now available to accounts constraints (#386).
- lang: Initialize program derived addresses with accounts constraints (#386).
- lang: Event field names in IDLs are now mixed case. (#379).
- lang: Accounts trait now accepts an additional
&[u8]
parameter (#386).
- cli: Add
--program-name
option for build command to build a single program at a time (#362). - cli, client: Parse custom cluster urls from str (#369).
- cli, client, lang: Update solana toolchain to v1.7.1 (#368).
- ts: Instruction decoding and formatting (#372).
- lang: Add
#[account(close = <destination>)]
constraint for closing accounts and sending the rent exemption lamports to a specified destination account (#371).
- lang: Allows one to use
remaining_accounts
withCpiContext
by implementing theToAccountMetas
trait onCpiContext
(#351).
- lang, ts: Framework defined error codes are introduced, reserving error codes 0-300 for Anchor, and 300 and up for user defined error codes (#354).
- cli: Add global options for override Anchor.toml values (#313).
- spl: Add
SetAuthority
instruction (#307). - spl: Add init and close open orders instructions (#245).
- lang:
constraint = <expression>
added as a replacement for (the now deprecated) string literal constraints (#341). - lang: Span information is now preserved, providing informative compiler error messages (#341).
- ts: Address metadata is now optional for
anchor.workspace
clients (#310).
- ts: Retrieving deserialized accounts from the
<program>.account.<my-account>
and<program>.state
namespaces now require explicitly invoking thefetch
API. For example,program.account.myAccount(<adddress>)
andprogram.state()
is nowprogram.account.myAccount.fetch(<address>)
andprogram.state.fetch()
(#322). - lang:
#[account(associated)]
now requiresinit
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). - lang, ts: Change account discriminator pre-image of the
#[state]
account discriminator to be namespaced by "state:" (#320). - lang, ts: Change domain delimiters for the pre-image of the instruciton sighash to be a single colon
:
to be consistent with accounts (#321). - lang: Associated constraints no longer automatically implement
mut
(#341). - lang: Associated
space
constraints must now be literal integers instead of literal strings (#341).
- ts: Add
program.simulate
namespace (#266). - ts: Introduce
Address
type, allowing one to use Base 58 encoded strings in public APIs (#304). - ts: Replace deprecated
web3.Account
withweb3.Signer
in public APIs (#296). - ts: Generated
anchor.workspace
clients can now be customized per network with[cluster.<slug>]
in the Anchor.toml (#308). - cli: Add yarn flag to test command (#267).
- cli: Add
--skip-build
flag to test command (301). - cli: Add
anchor shell
command to spawn a node shell populated with an Anchor.toml based environment (#303).
- cli: The Anchor.toml's
wallet
andcluster
settings must now be under the[provider]
table (#305). - ts: Event coder
decode
API changed to decode strings directly instead of buffers (#292). - ts: Event coder
encode
API removed (#292).
- client: Adds support for state instructions (#248).
- lang: Add
anchor-debug
feature flag for logging (#253). - ts: Add support for u16 (#255).
- client: Renames
RequestBuilder::new
toRequestBuilder::from
(#248). - lang: Renames the generated
instruction::state::Ctor
struct toinstruction::state::New
(#248).
- spl: Add serum DEX CPI client (#224).
- lang: Allows one to specify multiple
with
targets when creating associated acconts (#197). - lang, ts: Add array support (#202).
- lang: Zero copy deserialization for accounts (#202, #206).
- lang, spl, cli, client: Upgrade solana toolchain to 1.6.6 (#210).
- lang: CPI clients for program state instructions (#43).
- lang: Add
#[account(owner = <program>)]
constraint (#178). - lang, cli, ts: Add
#[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
(andassociatedAddress
) method (#186).
- lang: Unused
#[account]
s are now parsed into the IDL correctly (#177).
- cli: Fund Anchor.toml configured wallet when testing (#164).
- spl: Add initialize_account instruction for spl tokens (#166).
- cli: Version verifiable docker builder (#145).
- cli: Specify test files to run (#118).
- lang: Allow overriding the
#[state]
account's size (#121). - lang, client, ts: Add event emission and subscriptions (#89).
- lang/account: Allow namespacing account discriminators (#128).
- cli: TypeScript migrations (#132).
- lang: Add
#[account(executable)]
attribute (#140).
- client: Replace url str with
Cluster
struct when constructing clients (#89). - lang: Changes the account discriminator of
IdlAccount
to be namespaced by"internal"
(#128). - lang, spl, cli: Upgrade solana toolchain to 1.6.3, a major version upgrade even though only the minor version is incremented. This allows for the removal of
-#![feature(proc_macro_hygiene)]
. (#139).
- ts: Allow preloading instructions for state rpc transactions (cf9c84).
- ts: Export sighash coder function (734c75).
- cli: Specify programs to embed into local validator genesis via Anchor.toml while testing (b3803a).
- cli: Allow skipping the creation of a local validator when testing against localnet (#93).
- cli: Adds support for tests with Typescript (#94).
- cli: Deterministic and verifiable builds (#100).
- cli, lang: Add write buffers for IDL upgrades (#107).
- lang: Removes
IdlInstruction::Clear
(#107).
- cli: Propagates mocha test exit status on error (79b791).
- cli: Embed workspace programs into local validator genesis when testing (733ec3).
- cli: Stream program logs to
.anchor/program-logs
directory when testing (ce5ca7). - spl: Add shared memory api (d92cb1).
- lang/attribute/access-control: Allow specifying multiple modifier functions (845df6).
- lang/syn: Allow state structs that don't have a ctor or impl block (just trait implementations) (a78000).
- ts: Add instruction method to state namespace (627c27).
- lang/syn, ts: Add support for u128 and i128 (#83).
- lang: Adds the ability to create and use CPI program interfaces (#66).
- lang, client, ts: Migrate from rust enum based method dispatch to a variant of sighash (#64).
Initial release.
- lang:
anchor-lang
crate providing a Rust eDSL for Solana. - lang/attribute/access-control: Internal attribute macro for function modifiers.
- lang/attribute/account: Internal attribute macro for defining Anchor accounts.
- lang/attribute/error: Internal attribute macro for defining Anchor program errors.
- lang/attribute/program: Internal attribute macro for defining an Anchor program.
- lang/attribute/state: Internal attribute macro for defining an Anchor program state struct.
- lang/derive/accounts: Internal derive macro for defining deserialized account structs.
- lang/syn: Internal crate for parsing the Anchor eDSL, generating code, and an IDL.
- spl:
anchor-spl
crate providing CPI clients for Anchor programs. - client:
anchor-client
crate providing Rust clients for Anchor programs. - ts:
@project-serum/anchor
package for generating TypeScript clients. - cli: Command line interface for managing Anchor programs.