@coral-xyz/anchor
Advanced tools
Changelog
[0.30.1] - 2024-06-20
RUSTUP_TOOLCHAIN
environment variable (#2941).AVM_HOME
environment variable (#2917).avm list
when GitHub API rate limits are reached (#2962)--no-install
option to the init
command (#2945).TryFromIntError
for Error
to be able to propagate integer conversion errors (#2950).upgrade
command (#2998).spl-associated-token-account
crate (#2999).declare_program!
(#2997).idl convert
command (#3009).idl type
command (#3017).anchor_lang::pubkey
macro for declaring Pubkey
const values (#3021).anchor-syn
dependency (#3030).const
of program ID to declare_id!
and declare_program!
(#3019).maxSupportedTransactionVersion
in AnchorProvider.send*()
methods (#2922).anchor init
(#2929).Cargo.lock
of the project when generating idls for external types (#2946).declare_program!
(#2959).declare_program!
(#2965).Vec<u8>
type with declare_program!
(#2966).ProgramError::ArithmeticOverflow
not found error (#2975).declare_program!
(#2967).declare_program!
(#2977).unexpected_cfgs
build warning (#2992).declare_program!
(#2994).rust-version
from crate manifests (#3000).address
constraint with field expressions (#3034).bytemuckunsafe
account serialization with declare_program!
(#3037).Changelog
[0.30.0] - 2024-04-15
See the Anchor 0.30 release notes for a high-level overview of how to update.
init
and new
(#2698).deploy
(#2705).solana program deploy
command with anchor deploy
(#2709).InstructionData::write_to
implementation (#2733).#[interface(..)]
attribute for instruction discriminator overrides (#2728)..interface(..)
method for instruction discriminator overrides (#2728).anchor-lang
and CLI version compatibility (#2753).idl close
accepts optional --idl-address
parameter (#2760).workspace.members
and workspace.exclude
. (#2785).--test-template
option for init
command (#2805).anchor test
is able to run multiple commands (#2799).@coral-xyz/anchor
package and CLI version compatibility (#2813).repr
s (#2824).accountsPartial
method to keep the old accounts
method behavior (#2824).opts
parameter of AnchorProvider
constructor optional (#2843).--no-idl
flag to the build
command (#2847).prepend
option to MethodBuilder preInstructions
method (#2863).declare_program!
macro (#2857).deactivate_feature
flag to solana-test-validator
config in Anchor.toml (#2872).docs
field for constants (#2887).Event
utility type to get events from bytes (#2897).Lamports
trait operations (#2907).new_from_array
method to Hash
(#2682).resolver = "2"
) (#2676).provider.wallet
in Anchor.toml
(#2696).anchor_version
override (#2704).shmem
feature enabled (#2722).localhost
to 127.0.0.1
, NodeJS 17 IP resolution changes for IPv6 (#2725).try_to_vec
usage while setting the return data in order to reduce heap memory usage (#2744)migrate
command not working without global ts-node
installation (#2767).parse_logs_response
to prevent panics when more than 1 outer instruction exists in logs (#2856).stdsimd
feature compilation error from ahash
when installing the CLI using newer Rust versions (#2867).solana-program
dependency (#2900).TokenAccount
and Mint
Copy
(#2904).cargo build-sbf
the default build command (#2694).overflow-checks
flag (#2716).anchor-deprecated-state
feature (#2717).CLOSED_ACCOUNT_DISCRIMINATOR
(#2726).Option<u8>
rather than u8
(#2730).shared-memory
program (#2747).associated
, account.associated
and account.associatedAddress
methods (#2749).idl upgrade
command closes the IDL buffer account (#2760).--jest
option from the init
command (#2805).idl-build
feature in program Cargo.toml
(#2824).seeds
feature to resolution
and make it enabled by default (#2824).idl parse
command (#2824).idl-parse
and seeds
features (#2824).accounts
method to no longer accept resolvable accounts (#2824).Program
instances use camelCase for everything (#2824).programId
parameter of the Program
constructor (#2864).anchor-syn
crate to the new IDL crate (#2882).#[non_exhaustive]
to IDL enums (#2890).Changelog
[0.29.0] - 2023-10-16
See the Anchor 0.29 release notes for a high-level overview of how to update.
AccountInfo
(#2656).get_lamports
, add_lamports
and sub_lamports
methods for all account types (#2552).DynSigner
to simplify use of Client<C> where <C: Clone + Deref<Target = impl Signer>>
with Solana clap CLI utils that loads Signer
as Box<dyn Signer>
(#2550).anchor build
still uses parsing method to generate IDLs, use anchor idl build
to generate IDLs with the build method (#2011)..anchorversion
file to facilitate switching between different versions of the anchor-cli
(#2553).anchor.workspace.myProgram
, anchor.workspace.MyProgram
... (#2579).mpl-token-metadata
crate (#2583).TokenRecordAccount
for pNFTs (#2597).Box
the inner enums of anchor_lang::error::Error
to optimize anchor_lang::Result
(#2600).Program.addEventListener
method (#2627).IdlBuild
trait to implement IDL support for custom types (#2629).idl-build
feature. IDL build method will not work without enabling this feature when using anchor-spl
(#2629).test.upgradeable
, test.genesis.upgradeable
setting in Anchor.toml
to support testing upgradeable programs (#2642).1.17.0
, 1.16
remains supported (#2645).anchor-cli
installation from commit (#2659).toolchain
property in Anchor.toml
to override Anchor and Solana versions (#2649).assert
(#2535).const
in the InitSpace
macro (#2555).1.14
(#2572).anchor build --no-docs
adding docs to the IDL (#2575).associated_token::token_program
constraint (#2603).anchor account
command panicking outside of workspace (#2620).idl
feature has been replaced with idl-build
, idl-parse
and idl-types
features (#2011).parse
method now returns Result<Idl>
instead of Result<Option<Idl>>
(#2582).mpl-token-metadata
dependency to use the client SDK instead of the program crate (#2632).base64-js
dependency (#2635).IdlTypeDefinitionTy
enum has a new variant Alias
(#2637).1.14
is no longer supported, minimum required Solana version is 1.16.0
(#2645).anchor_version
and solana_version
property in Anchor.toml
that was being used in verifiable builds are moved inside toolchain
. They are now being used for all commands in the workspace, not just verifiable builds (#2649).Changelog
[0.28.0] - 2023-06-09
async
feature flag to use an asynchronous anchor-client (#2488).approve_collection_authority
, bubblegum_set_collection_size
, burn_edition_nft
, burn_nft
, revoke_collection_authority
, set_token_standard
, utilize
, unverify_sized_collection_item
, unverify_collection
(#2430)token_program
constraint to Token
, Mint
, and AssociatedToken
accounts in order to override required token_program
fields and use different token interface implementations in the same instruction (#2460)anchor init
and anchor new
take an option --solidity
which creates solidity code rather than rust. anchor build
and anchor test
work accordingly (#2421)idl set-buffer
, idl set-authority
and idl close
take an option --print-only
. which prints transaction in a base64 Borsh compatible format but not sent to the cluster. It's helpful when managing authority under a multisig, e.g., a user can create a proposal for a Custom Instruction
in SPL Governance (#2486).emit_cpi!
and #[event_cpi]
macros(behind event-cpi
feature flag) to store event logs in transaction metadata (#2438).keys sync
command to sync program id declarations (#2505).1.16.0
and specify maximum version of <1.17.0
(#2512).anchor deploy
command's --program-name
argument accepts program lib names (#2519).AccountClient
type to it's appropriate account type (#2440)program_id
, accounts
, ix_data
, remaining_accounts
in instruction arguments (#2464)metadata.address
generation in IDL after deploying with a custom keypair (#2485)anchor new
not updating Anchor.toml
(#2516).Changelog
[0.27.0] - 2023-03-08
MasterEditionAccount
account deserialization to spl metadata (#2393).InitSpace
derive macro to automatically calculate the space at the initialization of an account (#2346).env
option to verifiable builds (#2325).idl close
command to close a program's IDL account (#2329).idl init
now supports very large IDL files (#2329).transfer_checked
function (#2353).approve_checked
function (#2401).--skip-build
option to the verify command (#2387).--multithreaded
(#2321).async_rpc
a method which returns a nonblocking solana rpc client (#2322).rustls-tls
feature of reqwest
so that users don't need OpenSSL installed (#2385).VersionedTransaction
support. Methods in the Provider
class and Wallet
interface now use the argument tx: Transaction | VersionedTransaction
(#2427).--arch sbf
option to compile programs using cargo build-sbf
(#2398).Interface
and InterfaceAccount
types, related to token-2022 (#2386).AccountClient.fetchMultiple
match the account type being fetched (#2390)provider.simulate
will send the transaction with sigVerify: false
if no signers
are present (#2331).CpiAccount
, Loader
and ProgramAccount
(#2375).state
and interface
attributes (#2285).#[account(constraint = {})]
(#2379).account(zero_copy)
and zero_copy
attributes now derive the bytemuck::Pod
and bytemuck::Zeroable
traits instead of using unsafe impl
(#2330). This imposes useful restrictions on the type, like not having padding bytes and all fields being Pod
themselves. See bytemuck::Pod for details. This change requires adding bytemuck = { version = "1.4.0", features = ["derive", "min_const_generics"]}
to your cargo.toml
. Legacy applications can still use #[account(zero_copy(unsafe))]
and #[zero_copy(unsafe)]
for the old behavior.createProgramAddressSync
, findProgramAddressSync
(now available in @solana/web3.js
) and update associatedAddress
to be synchronous (#2357).Changelog
[0.26.0] - 2022-12-15
--run
to anchor test
for running a subset of test suites (#1828).transaction
functions to RequestBuilder (#1958).create_metadata_accounts_v3
and set_collection_size
wrappers (#2119).MetadataAccount
account deserialization. (#2014).update_primary_sale_happened_via_token
wrapper (#2173).sign_metadata
and remove_creator_verification
wrappers (#2175).initialize_account3
and initialize_mint2
(#2265).serum-dex
to openbook-dex
(#2308).has_one
relations inference so accounts mapped via has_one relationships no longer need to be provided (#2160)..prepare()
to builder pattern (#2160).freeze_delegated_account
and thaw_delegated_account
wrappers (#2164).feePayer
check to AnchorProvider
methods, so that anchor writes the provider's wallet as fee payer if fee payer isn't already set (#2186).AccountsClose
to make it safe to call manually (#2209).test.validator.geyser_plugin_config
support (#2016).account
subcommand to cli (#1923)ticks_per_slot
option to Validator args (#1875).seed
generation for byte string literals (#2125)..fetchNullable()
to be robust towards accounts only holding a balance (#2301).rent
from constraints (#2265).rent
from associated_token::Create
(#2265).Discriminator
and Owner
trait implementation for structures representing instructions (#1997).yarn build
in packages/anchor, see #2299 and #2306.Optional<Account<'info, T>>
. Shouldn't affect existing programs but may be a breaking change to tools that use the anchor generated IDL. #2101.@project-serum/anchor
to the @coral-xyz/anchor
package #2318.