CHANGELOG
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.
[0.30.1] - 2024-06-20
Features
- idl: Allow overriding the idl build toolchain with the
RUSTUP_TOOLCHAINenvironment variable (#2941). - avm: Support customizing the installation location using
AVM_HOMEenvironment variable (#2917). - avm: Optimize
avm listwhen GitHub API rate limits are reached (#2962) - idl, ts: Add accounts resolution for associated token accounts (#2927).
- cli: Add
--no-installoption to theinitcommand (#2945). - lang: Implement
TryFromIntErrorforErrorto be able to propagate integer conversion errors (#2950). - idl: Add ability to convert legacy IDLs (#2986).
- ts: Extract Anchor error codes into their own package (#2983).
- cli: Add additional solana arguments to the
upgradecommand (#2998). - spl: Export
spl-associated-token-accountcrate (#2999). - lang: Support legacy IDLs with
declare_program!(#2997). - cli: Add
idl convertcommand (#3009). - cli: Add
idl typecommand (#3017). - lang: Add
anchor_lang::pubkeymacro for declaringPubkeyconst values (#3021). - cli: Sync program ids on the initial build (#3023).
- idl: Remove
anchor-syndependency (#3030). - lang: Add
constof program ID todeclare_id!anddeclare_program!(#3019). - idl: Add separate spec crate (#3036).
Fixes
- lang: Eliminate variable allocations that build up stack space for token extension code generation (#2913).
- ts: Fix incorrect
maxSupportedTransactionVersioninAnchorProvider.send*()methods (#2922). - cli: Use npm's configured default license for new projects made with
anchor init(#2929). - cli: add filename to 'Unable to read keypair file' errors (#2932).
- idl: Fix path resolution of the
Cargo.lockof the project when generating idls for external types (#2946). - idl: Fix potential panic on external type resolution (#2954).
- lang: Fix using defined types in instruction parameters with
declare_program!(#2959). - lang: Fix using const generics with
declare_program!(#2965). - lang: Fix using
Vec<u8>type withdeclare_program!(#2966). - lang: Fix
ProgramError::ArithmeticOverflownot found error (#2975). - lang: Fix using optional accounts with
declare_program!(#2967). - lang: Fix instruction return type generation with
declare_program!(#2977). - cli: Fix IDL write getting corrupted from retries (#2964).
- idl: Fix
unexpected_cfgsbuild warning (#2992). - lang: Make tuple struct fields public in
declare_program!(#2994). - Remove
rust-versionfrom crate manifests (#3000). - cli: Fix upgradeable program clones (#3010).
- ts: Fix using IDLs that have defined types as generic arguments (#3016).
- idl: Fix generation with unsupported expressions (#3033).
- idl: Fix using
addressconstraint with field expressions (#3034). - lang: Fix using
bytemuckunsafeaccount serialization withdeclare_program!(#3037).
Breaking
[0.30.0] - 2024-04-15
Features
- cli: Allow force
initandnew(#2698). - cli: Add verifiable option when
deploy(#2705). - cli: Add support for passing arguments to the underlying
solana program deploycommand withanchor deploy(#2709). - lang: Add
InstructionData::write_toimplementation (#2733). - lang: Add
#[interface(..)]attribute for instruction discriminator overrides (#2728). - ts: Add
.interface(..)method for instruction discriminator overrides (#2728). - cli: Check
anchor-langand CLI version compatibility (#2753). - ts: Add missing IDL PDA seed types (#2752).
- cli:
idl closeaccepts optional--idl-addressparameter (#2760). - cli: Add support for simple wildcard patterns in Anchor.toml's
workspace.membersandworkspace.exclude. (#2785). - cli: Add
--test-templateoption forinitcommand (#2805). - cli:
anchor testis able to run multiple commands (#2799). - cli: Check
@coral-xyz/anchorpackage and CLI version compatibility (#2813). - cli: Accept package name as program name (#2816).
- cli: Add ability to build and test only a specified program (#2823).
- idl: Add new IDL spec (#2824).
- idl: Add support for
reprs (#2824). - idl: Add support for expression evaluation (#2824).
- idl: Add support for using external types when generating the IDL (#2824).
- idl, ts: Add unit and tuple struct support (#2824).
- idl, ts: Add generics support (#2824).
- ts: Add
accountsPartialmethod to keep the oldaccountsmethod behavior (#2824). - ts: Make
optsparameter ofAnchorProviderconstructor optional (#2843). - cli: Add
--no-idlflag to thebuildcommand (#2847). - cli: Add priority fees to idl commands (#2845).
- ts: Add
prependoption to MethodBuilderpreInstructionsmethod (#2863). - lang: Add
declare_program!macro (#2857). - cli: Add
deactivate_featureflag tosolana-test-validatorconfig in Anchor.toml (#2872). - idl: Add
docsfield for constants (#2887). - idl: Store deployment addresses for other clusters (#2892).
- lang: Add
Eventutility type to get events from bytes (#2897). - lang, spl: Add support for token extensions (#2789).
- lang: Return overflow error from
Lamportstrait operations (#2907).
Fixes
- syn: Add missing
new_from_arraymethod toHash(#2682). - cli: Switch to Cargo feature resolver(
resolver = "2") (#2676). - cli: Fix using user specific path for
provider.walletinAnchor.toml(#2696). - syn: Fix IDL constant seeds parsing (#2699).
- cli: Display errors if toolchain override restoration fails (#2700).
- cli: Fix commit based
anchor_versionoverride (#2704). - spl: Fix compilation with
shmemfeature enabled (#2722). - cli: Localhost default test validator address changes from
localhostto127.0.0.1, NodeJS 17 IP resolution changes for IPv6 (#2725). - lang: Eliminate temporary Vec allocations when serializing data with discriminant and set the default capacity to 256 bytes (#2691).
- lang: Allow custom lifetime in Accounts structure (#2741).
- lang: Remove
try_to_vecusage while setting the return data in order to reduce heap memory usage (#2744) - cli: Show installation progress if Solana tools are not installed when using toolchain overrides (#2757).
- ts: Fix formatting enums (#2763).
- cli: Fix
migratecommand not working without globalts-nodeinstallation (#2767). - client, lang, spl, syn: Enable all features for docs.rs build (#2774).
- ts: Fix construction of field layouts for type aliased instruction arguments (#2821)
- idl: Fix IDL (#2824).
- idl, ts: Make casing consistent (#2824).
- ts: Fix not being able to use numbers in instruction, account, or event names in some cases due to case conversion (#2824).
- cli: Fix excessive test validator requests (#2828).
- client: Fix
parse_logs_responseto prevent panics when more than 1 outer instruction exists in logs (#2856). - avm, cli: Fix
stdsimdfeature compilation error fromahashwhen installing the CLI using newer Rust versions (#2867). - spl: Fix not being able to deserialize newer token 2022 extensions (#2876).
- spl: Remove
solana-programdependency (#2900). - spl: Make
TokenAccountandMintCopy(#2904). - ts: Add missing errors (#2906).
Breaking
- cli: Make
cargo build-sbfthe default build command (#2694). - cli: Require explicit
overflow-checksflag (#2716). - ts: Remove
anchor-deprecated-statefeature (#2717). - lang: Remove
CLOSED_ACCOUNT_DISCRIMINATOR(#2726). - lang: Make bumps of optional accounts
Option<u8>rather thanu8(#2730). - spl: Remove
shared-memoryprogram (#2747). - ts: Remove
associated,account.associatedandaccount.associatedAddressmethods (#2749). - cli:
idl upgradecommand closes the IDL buffer account (#2760). - cli: Remove
--jestoption from theinitcommand (#2805). - cli: Require
idl-buildfeature in programCargo.toml(#2824). - cli: Rename
seedsfeature toresolutionand make it enabled by default (#2824). - cli: Remove
idl parsecommand (#2824). - idl: Change IDL spec (#2824).
- syn: Remove
idl-parseandseedsfeatures (#2824). - ts: Change
accountsmethod to no longer accept resolvable accounts (#2824). - ts:
Programinstances use camelCase for everything (#2824). - ts: Remove discriminator functions (#2824).
- ts: Remove
programIdparameter of theProgramconstructor (#2864). - idl, syn: Move IDL types from the
anchor-syncrate to the new IDL crate (#2882). - idl: Add
#[non_exhaustive]to IDL enums (#2890).
[0.29.0] - 2023-10-16
Features
- lang: Change all accounts to have a reference to
AccountInfo(#2656). - lang: Add
get_lamports,add_lamportsandsub_lamportsmethods for all account types (#2552). - client: Add a helper struct
DynSignerto simplify use ofClient<C> where <C: Clone + Deref<Target = impl Signer>>with Solana clap CLI utils that loadsSignerasBox<dyn Signer>(#2550). - lang: Allow CPI calls matching an interface without pinning program ID (#2559).
- cli, lang: Add IDL generation through compilation.
anchor buildstill uses parsing method to generate IDLs, useanchor idl buildto generate IDLs with the build method (#2011). - avm: Add support for the
.anchorversionfile to facilitate switching between different versions of theanchor-cli(#2553). - ts: Add ability to access workspace programs independent of the casing used, e.g.
anchor.workspace.myProgram,anchor.workspace.MyProgram... (#2579). - bench: Add benchmarking for program binary size (#2591).
- spl: Export
mpl-token-metadatacrate (#2583). - spl: Add
TokenRecordAccountfor pNFTs (#2597). - ts: Add support for unnamed(tuple) enum in accounts (#2601).
- cli: Add program template with multiple files for instructions, state... (#2602).
- bench: Add benchmarking for stack memory usage (#2617).
- lang:
Boxthe inner enums ofanchor_lang::error::Errorto optimizeanchor_lang::Result(#2600). - ts: Add strong type support for
Program.addEventListenermethod (#2627). - syn: Add
IdlBuildtrait to implement IDL support for custom types (#2629). - spl: Add
idl-buildfeature. IDL build method will not work without enabling this feature when usinganchor-spl(#2629). - lang: Add support for type aliases in IDLs (#2637).
- cli: Add
test.upgradeable,test.genesis.upgradeablesetting inAnchor.tomlto support testing upgradeable programs (#2642). - cli, client, lang, spl: Update Solana toolchain and dependencies to
1.17.0,1.16remains supported (#2645). - spl: Add support for memo program (#2661).
- avm: Add
anchor-cliinstallation from commit (#2659). - cli: Add
toolchainproperty inAnchor.tomlto override Anchor and Solana versions (#2649).
Fixes
- ts: Packages no longer depend on
assert(#2535). - lang: Support for
constin theInitSpacemacro (#2555). - cli: Support workspace inheritance (#2570).
- client: Compile with Solana
1.14(#2572). - cli: Fix
anchor build --no-docsadding docs to the IDL (#2575). - ts: Load workspace programs on-demand rather than loading all of them at once (#2579).
- lang: Fix
associated_token::token_programconstraint (#2603). - cli: Fix
anchor accountcommand panicking outside of workspace (#2620). - lang: IDL named enum variant fields are now camelCase as opposed to snake_case, consistent with the other IDL types (#2633).
- avm: Remove excessive panics and handle the errors gracefully (#2671).
Breaking
- lang: Switch to type safe bumps in context (#2542).
- syn:
idlfeature has been replaced withidl-build,idl-parseandidl-typesfeatures (#2011). - syn: IDL
parsemethod now returnsResult<Idl>instead ofResult<Option<Idl>>(#2582). - spl: Update
mpl-token-metadatadependency to use the client SDK instead of the program crate (#2632). - ts: Remove
base64-jsdependency (#2635). - syn:
IdlTypeDefinitionTyenum has a new variantAlias(#2637). - cli, client, lang, spl: Solana
1.14is no longer supported, minimum required Solana version is1.16.0(#2645). - cli:
anchor_versionandsolana_versionproperty inAnchor.tomlthat was being used in verifiable builds are moved insidetoolchain. They are now being used for all commands in the workspace, not just verifiable builds (#2649).
[0.28.0] - 2023-06-09
Features
- client: Add
asyncfeature flag to use an asynchronous anchor-client (#2488). - spl: Add metadata wrappers
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) - spl: Add
token_programconstraint toToken,Mint, andAssociatedTokenaccounts in order to override requiredtoken_programfields and use different token interface implementations in the same instruction (#2460) - cli: Add support for Solidity programs.
anchor initandanchor newtake an option--soliditywhich creates solidity code rather than rust.anchor buildandanchor testwork accordingly (#2421) - bench: Add benchmarking for compute units usage (#2466)
- cli:
idl set-buffer,idl set-authorityandidl closetake 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 aCustom Instructionin SPL Governance (#2486). - lang: Add
emit_cpi!and#[event_cpi]macros(behindevent-cpifeature flag) to store event logs in transaction metadata (#2438). - cli: Add
keys synccommand to sync program id declarations (#2505). - cli: Create new programs with correct program ids (#2509).
- cli, client, lang, spl: Update Solana toolchain and dependencies to
1.16.0and specify maximum version of<1.17.0(#2512). - cli:
anchor deploycommand's--program-nameargument accepts program lib names (#2519).
Fixes
- ts: Narrowed
AccountClienttype to it's appropriate account type (#2440) - lang: Fix inability to use identifiers
program_id,accounts,ix_data,remaining_accountsin instruction arguments (#2464) - cli: Fix incorrect
metadata.addressgeneration in IDL after deploying with a custom keypair (#2485) - cli: IDL commands no longer hang when the payer doesn't have funds to pay for the transaction fee (#2492)
- cli: Fix
anchor newnot updatingAnchor.toml(#2516). - client, lang, spl: Allow wider range of dependency versions to reduce dependency issues (#2524).
Breaking
- lang: Identifiers that are intended for internal usage(
program_id,accounts,ix_data,remaining_accounts) have been renamed with__prefix (#2464) - spl: Remove the
metadata::create_metadata_account_v2deprecated wrapper since it was removed from token metadata program (#2480)
[0.27.0] - 2023-03-08
Features
- spl: Add
MasterEditionAccountaccount deserialization to spl metadata (#2393). - lang: Add the
InitSpacederive macro to automatically calculate the space at the initialization of an account (#2346). - cli: Add
envoption to verifiable builds (#2325). - cli: Add
idl closecommand to close a program's IDL account (#2329). - cli:
idl initnow supports very large IDL files (#2329). - spl: Add
transfer_checkedfunction (#2353). - spl: Add
approve_checkedfunction (#2401). - cli: Add
--skip-buildoption to the verify command (#2387). - client: Add support for multithreading to the rust client: use flag
--multithreaded(#2321). - client: Add
async_rpca method which returns a nonblocking solana rpc client (#2322). - avm, cli: Use the
rustls-tlsfeature ofreqwestso that users don't need OpenSSL installed (#2385). - ts: Add
VersionedTransactionsupport. Methods in theProviderclass andWalletinterface now use the argumenttx: Transaction | VersionedTransaction(#2427). - cli: Add
--arch sbfoption to compile programs usingcargo build-sbf(#2398). - land: Support multiple programs with the same interface using
InterfaceandInterfaceAccounttypes, related to token-2022 (#2386).
Fixes
- ts: Make the return type of
AccountClient.fetchMultiplematch the account type being fetched (#2390) - cli: Don't regenerate idl in read_all_programs(). (#2332).
- ts:
provider.simulatewill send the transaction withsigVerify: falseif nosignersare present (#2331). - cli: Failing commands will return the correct exit status. (#2370).
- idl: Update the IDL program to use non-deprecated account types (#2365).
- ts: Enum fields weren't being converted from snake_case to camelCase (#2378).
- lang/cli: Update to solana-program version 1.14.16 and rust version 1.60, appears to still be incompatible with 1.15 CLI (#2420).
Breaking
- lang: Remove deprecated account types:
CpiAccount,LoaderandProgramAccount(#2375). - lang: Remove
stateandinterfaceattributes (#2285). - lang: Remove deprecated literal constraint which has been replaced by
#[account(constraint = {})](#2379). - lang:
account(zero_copy)andzero_copyattributes now derive thebytemuck::Podandbytemuck::Zeroabletraits instead of usingunsafe impl(#2330). This imposes useful restrictions on the type, like not having padding bytes and all fields beingPodthemselves. See bytemuck::Pod for details. This change requires addingbytemuck = { version = "1.4.0", features = ["derive", "min_const_generics"]}to yourcargo.toml. Legacy applications can still use#[account(zero_copy(unsafe))]and#[zero_copy(unsafe)]for the old behavior. - ts: Remove
createProgramAddressSync,findProgramAddressSync(now available in@solana/web3.js) and updateassociatedAddressto be synchronous (#2357).
[0.26.0] - 2022-12-15
Features
- cli: Add
--runtoanchor testfor running a subset of test suites (#1828). - client: Add
transactionfunctions to RequestBuilder (#1958). - spl: Add
create_metadata_accounts_v3andset_collection_sizewrappers (#2119). - spl: Add
MetadataAccountaccount deserialization. (#2014). - spl: Add
update_primary_sale_happened_via_tokenwrapper (#2173). - spl: Add
sign_metadataandremove_creator_verificationwrappers (#2175). - spl: Add
initialize_account3andinitialize_mint2(#2265). - spl: Change
serum-dextoopenbook-dex(#2308). - lang: Add parsing for consts from impl blocks for IDL PDA seeds generation (#2128).
- lang: Account closing reassigns to system program and reallocates (#2169).
- ts: Add coders for SPL programs (#2143).
- ts: Add
has_onerelations inference so accounts mapped via has_one relationships no longer need to be provided (#2160). - ts: Add ability to set args after setting accounts and retrieving pubkeys (#2160).
- ts: Add
.prepare()to builder pattern (#2160). - spl: Add
freeze_delegated_accountandthaw_delegated_accountwrappers (#2164). - ts: Add
feePayercheck toAnchorProvidermethods, so that anchor writes the provider's wallet as fee payer if fee payer isn't already set (#2186). - ts: Add nested PDA inference (#2194).
- ts: Add ability to resolve missing accounts with a custom resolver (#2194).
- ts: Update the Solana web3 library used by anchor ts to version 1.64.0 (#2220).
- lang: Updates
AccountsCloseto make it safe to call manually (#2209). - lang: Update rust used in the repo version 1.62 (#2272).
- cli: Allow custom cluster config (#2271).
- ts: Add optional flag to parseLogs to throw an error on decoding failure (#2043).
- cli: Add
test.validator.geyser_plugin_configsupport (#2016). - cli: Add
accountsubcommand to cli (#1923) - cli: Add
ticks_per_slotoption to Validator args (#1875).
Fixes
- lang: Fix parsing for bytes literals in the IDL (#2261).
- lang: Fix IDL
seedgeneration for byte string literals (#2125). - ts: Update seeds inference to allow nested user defined structs within the seeds (#2198).
- event: Fix multiple event listeners with the same name (#2165).
- lang: Prevent the payer account from being initialized as a program account (#2284).
- ts: Fixing breaking change where null or undefined wallet throws an error (#2303).
- ts: Fixed
.fetchNullable()to be robust towards accounts only holding a balance (#2301). - lang: Only add public enums to the IDL (#2309).
- lang: Fix heap intensive error mapping (#2313).
Breaking
- ts: SPL coders have been removed from the main Anchor package. (#2155)
- lang: Remove
rentfrom constraints (#2265). - spl: Remove
rentfromassociated_token::Create(#2265). - lang: Add
DiscriminatorandOwnertrait implementation for structures representing instructions (#1997). - ts: '@coral-xyz/borsh' package is now part of the yarn monorepo (#2290). The borsh package needs to be built before the anchor package can be built but this should happen automatically when running
yarn buildin packages/anchor, see #2299 and #2306. - lang: Add support for optionally passing in accounts using the syntax
Optional<Account<'info, T>>. Shouldn't affect existing programs but may be a breaking change to tools that use the anchor generated IDL. #2101. - ts: Switch from
@project-serum/anchorto the@coral-xyz/anchorpackage #2318.
[0.25.0] - 2022-07-05
Features
- lang: Add
realloc,realloc::payer, andrealloc::zeroas a new constraint group for program accounts (#1986). - lang: Add
PartialEqandEqforanchor_lang::Error(#1544). - cli: Add
--skip-buildtoanchor publish(#1786). - cli: Add
--program-keypairtoanchor deploy(#1786). - cli: Add compilation optimizations to cli template (#1807).
- cli:
buildnow adds docs to idl. This can be turned off with--no-docs(#1561). - cli: Add
bandtaliases forbuildandtestrespectively (#1823). - spl: Add more derived traits to
TokenAccounttoMint(#1818). - spl: Add
sync_nativetoken program CPI wrapper function (#1833). - cli: Allow passing arguments to an underlying script with
anchor run(#1914). - ts: Implement a coder for system program (#1920).
- ts: Add
program.coder.typesfor encoding/decoding user-defined types (#1931). - client: Add
send_with_spinner_and_configfunction to RequestBuilder (#1926). - ts: Implement a coder for SPL associated token program (#1939).
- ts: verbose error for missing
ANCHOR_WALLETvariable when usingNodeWallet.local()(#1958). - ts: Add
MethodsBuilder#accountsStrictfor strict typing on ix account input (#2019). - Update solana dependencies to 1.10.29 (#2027).
Fixes
- cli: Fix
anchor keys listreading thetargetfolder in the wrong path (#2063). - cli: Move
overflow-checksinto workspaceCargo.tomlso that it will not be ignored by compiler (#1806). - lang: Fix missing account name information when deserialization fails when using
initorzero(#1800). - ts: Expose the wallet's publickey on the Provider (#1845).
Breaking
- ts: Change
BROWSERenv variable toANCHOR_BROWSER(#1233). - ts: Add transaction signature to
EventCallbackparameters (#1851). - ts: Change
EventParser#parseLogsimplementation to be a generator instead of callback function (#2018). - lang: Adds a new
&mut reallocs: BTreeSet<Pubkey>argument toAccounts::try_accounts(#1986).
[0.24.2] - 2022-04-13
Fixes
- lang: Fix
returnsbeing serialized asnullinstead ofundefinedin IDL (#1782).
[0.24.1] - 2022-04-12
Fixes
- lang: Fix
anchor buildfailing ifTest.tomlincluded a relative path that didn't exist yet because it's created byanchor build(#1772). - cli: Update js/ts template to use new
AnchorProviderclass (#1770).
[0.24.0] - 2022-04-12
Features
- lang: Add support for multiple test suites with separate local validators (#1681).
- lang: Add return values to CPI client (#1598).
- ts: Add view functions (#1695).
- avm: New
avm updatecommand to update the Anchor CLI to the latest version (#1670). - cli: Update js/ts templates to use new
program.methodssyntax (#1732). - cli: Workspaces created with
anchor initnow come with theprettierformatter and scripts included (#1741). - ts: Add
pubkeysfunction to methods builder to get all instruction account addresses (#1733). - ts: Export
LangErrorCodeandLangErrorMessagefromerror.ts(#1756).
Fixes
- avm:
avm installno longer downloads the version if already installed in the machine (#1670). - cli: make
anchor testfail when used with--skip-deployoption and without--skip-local-validatoroption but there already is a running validator (#1675). - lang: Return proper error instead of panicking if account length is smaller than discriminator in functions of
(Account)Loader(#1678). - cli: Add
@types/bn.jstodevDependenciesin cli template (#1712). - ts: Event listener no longer crashes on Program Upgrade or any other unexpected log (#1757).
Breaking
- avm:
avm installswitches to the newly installed version after installation finishes (#1670). - spl: Re-export the
spl_tokencrate (#1665). - lang, cli, spl: Update solana toolchain to v1.9.13 (#1653 and #1751).
- lang:
Programtype now deserializesprogramdata_addressonly on demand (#1723). - ts: Make
Provideran interface and adjust its signatures and addAnchorProviderimplementor class (#1707). - spl: Change "to" to "from" in
token::burn(#1080).
[0.23.0] - 2022-03-20
Features
- cli: Add
anchor cleancommand that's the same ascargo cleanbut preserves keypairs insidetarget/deploy(#1470). - cli: Running
anchor initnow initializes a new git repository for the workspace. This can be disabled with the--no-gitflag (#1605). - cli: Add support for
anchor idl fetchto work outside anchor workspace (#1509). - cli: [[test.validator.clone]] also clones the program data account of programs owned by the bpf upgradeable loader (#1481).
- lang: Add new
AccountSysvarMismatcherror code and test cases for sysvars (#1535). - lang: Replace
std::io::Cursorwith a customWriteimpl that uses the Solana mem syscalls (#1589). - lang: Add
require_neq,require_keys_neq,require_gt, andrequire_gtecomparison macros (#1622). - lang: Handle arrays with const as size in instruction data (#1623.
- spl: Add support for revoke instruction (#1493).
- ts: Add provider parameter to
Spl.tokenfactory method (#1597).
Fixes
- ts: Fix the loss of strict typing using the
methodsnamespace on builder functions (#1539). - spl: Update
spl/governanceto use new errors (#1582). - client: Fix
Cluster'sFromStrimplementation (#1362). - lang: Implement
KeyforPubkeyagain, soassociated_token::*constraints can use pubkey targets again (#1601). - lang: Adjust error code so
#[error_code]works with just importinganchor_lang::error_code(#1610). - ts: Fix
spl-tokencoder account parsing (#1604). - cli: Fix
npm installfallback ifyarninstall doesn't work (#1643). - lang: Fix bug where
owner = <target>would not compile because of missing type annotation (#1648). - ts: Adjust
sendandsimulatefunctions inprovider.ts, so they use the return value ofWallet.signTransaction(#1527).
Breaking
- ts: Mark
transaction,instruction,simulateandrpcprogram namespaces as deprecated in favor ofmethods(#1539). - ts: No longer allow manual setting of globally resolvable program public keys in
methods#accounts(). ([#1548][https://github.com/coral-xyz/anchor/pull/1548]) - lang/ts: Events are now emitted using the
sol_log_datasyscall (#1608). - lang: Remove space calculation using
#[derive(Default)](#1519). - lang: Add support for logging expected and actual values and pubkeys. Add
require_eqandrequire_keys_eqmacros. Add default error code torequiremacro (#1572). - lang: Add
system_programCPI wrapper functions. Makesystem_programmodule public instead of re-exportingsystem_program::System(#1629). - cli:
avm useno long prompts [y/n] if an install is needed first - it just tells the user toavm install(#1565) - ts: Add
AnchorErrorwith program stack and also a program stack for non-AnchorErrorerrors (#1640).AnchorErroris not returned forprocessedtx that haveskipPreflightset totrue(it falls back toProgramErroror the raw solana library error).
[0.22.1] - 2022-02-28
Fixes
- cli: Fix rust template (#1488).
- lang: Handle array sizes with variable sizes in events and array size casting in IDL parsing (#1485)
[0.22.0] - 2022-02-20
Features
- lang: Add check that declared id == program id (#1451).
- ts: Added float types support (#1425).
- cli: Add
--skip-lintoption to disable check linting introduced in (#1452) for rapid prototyping (#1482).
Fixes
- ts: Allow nullable types for
Option<T>mapped types (#1428).
Breaking
- lang: Enforce that the payer for an init-ed account be marked
mut(#1271). - lang: All error-related code is now in the error module (#1426).
- lang: Require doc comments when using AccountInfo or UncheckedAccount types (#1452).
- lang: add
error!anderr!macro andResulttype (#1462). This change will break most programs. Do the following to upgrade: _ change allProgramResult's toResult<()>_ change#[error]to#[error_code]_ change allErr(MyError::SomeError.into())toErr(error!(MyError::SomeError))and allErr(ProgramError::SomeProgramError)toErr(ProgramError::SomeProgramError.into())orErr(Error::from(ProgramError::SomeProgramError).with_source(source!()))to provide file and line source of the error (with_sourceis most useful withProgramErrors.error!already adds source information for custom and anchor internal errors). _ change allsolana_program::program::invoke()tosolana_program::program::invoke().map_err(Into::into)andsolana_program::program::invoke_signed()tosolana_program::program::invoke_signed().map_err(Into::into)
[0.21.0] - 2022-02-07
Fixes
- ts: Fix the root type declaration of the
Wallet/NodeWalletclass (#1363). - ts: Improve type mapping of Account fields into Typescript with additional support for
Option<T>andVec<String>types (#1393).
Features
- lang: Add
seeds::programconstraint for specifying which program_id to use when deriving PDAs (#1197). - lang:
Contextnow has a newbumps: BTree<String, u8>argument, mapping account name to bump seed "found" by the accounts context. This allows one to access bump seeds without having to pass them in from the client or recalculate them in the handler (#1367). - lang, ts: Automatically infer PDA addresses (#1331).
- ts: Remove error logging in the event parser when log websocket encounters a program error (#1313).
- ts: Add new
methodsnamespace to the program client, introducing a more ergonomic builder API (#1324). - ts: Add registry utility for fetching the latest verified build (#1371).
- cli: Expose the solana-test-validator --account flag in Anchor.toml via [[test.validator.account]] (#1366).
- cli: Add avm, a tool for managing anchor-cli versions (#1385).
Breaking
- lang: Put
init_if_neededbehind a feature flag to decrease wrong usage (#1258). - lang: rename
loader_accountmodule toaccount_loadermodule (#1279) - lang: The
Accountstrait'stry_accountsmethod now has an additionalbumps: &mut BTreeMap<String, u8>argument, which accumulates bump seeds (#1367). - lang: Providing
bump = <target>targets withinitwill now error. Oninitonly, it is required to usebumpwithout a target and access the seed inside function handlers viactx.bumps.get("<pda-account-name"). For subsequent seeds constraints (without init), it is recommended to store the bump on your account and use it as abump = <target>target to minimize compute units used (#1380). - ts:
Coderis now an interface and the existing class has been renamed toBorshCoder. This change allows the generation of Anchor clients for non anchor programs (#1259). - cli: [[test.clone]] key in Anchor.toml is renamed to [[test.validator.clone]] (#1366).
[0.20.1] - 2022-01-09
Fixes
- lang: Improved error msgs when required programs are missing when using the
initconstraint(#1257)
Features
- lang: Allow repr overrides for zero copy accounts (#1273).
[0.20.0] - 2022-01-06
Fixes
- lang:
init_if_needednow checks rent exemption when init is not needed (#1250). - lang: Add missing owner check when
associated_token::authorityis used (#1240). - ts: Add type declarations for conditional
workspaceandWalletexports (#1137). - ts: Change commitment message
recenttoprocessedandmaxtofinalized(#1128) - ts: fix
translateAddresswhich currently leads to failing browser code. Now usesPublicKeyconstructor instead of prototype chain constructor name checking which doesn't work in the presence of code minifying/mangling(#1138) - lang: add missing check that verifies that account is ATA when using
init_if_neededand init is not needed(#1221)
Features
- lang: Add
programdata_address: Option<Pubkey>field toProgramaccount. Will be populated if account is a program owned by the upgradable bpf loader (#1125) - lang,ts,ci,cli,docs: update solana toolchain to version 1.8.5(#1133).
- lang: Account wrappers for non-Anchor programs no longer have to implement the
serializefunction because it has a default impl now. Similarly, they no longer have to implementtry_deserializewhich now delegates totry_deserialize_uncheckedby default(#1156). - lang: Add
set_innermethod toAccount<'a, T>to enable easy updates (#1177). - lang: Handle arrays with const as length (#968).
- ts: Add optional commitment argument to
fetchandfetchMultiple(#1171). - lang: Implement
AsRef<T>forAccount<'a, T>(#1173) - cli: Add
anchor expandcommand which wraps aroundcargo expand(#1160)
Breaking
- client: Client::new and Client::new_with_options now accept
Rc<dyn Signer>instead ofKeypair(#975). - lang, ts: Change error enum name and message for 'wrong program ownership' account validation (#1154).
- lang: Change from
#[repr(packed)]to#[repr(C)]for zero copy accounts (#1106). - lang: Account types can now be found either in the
preludemodule or theaccountsmodule but not longer directly under the root. Deprecated account types are no longer imported by the prelude (#1208).
[0.19.0] - 2021-12-08
Fixes
- lang: Add
deprecatedattribute toProgramAccount(#1014). - cli: Add version number from programs
Cargo.tomlinto extracted IDL (#1061). - lang: Add
deprecatedattribute toLoader(#1078). - lang: the
init_if_neededattribute now checks that given attributes (e.g. space, owner, token::authority etc.) are validated even when init is not needed (#1096).
Features
- lang: Add
ErrorCode::AccountNotInitializederror to separate the situation when the account has the wrong owner from when it does not exist (#1024). - lang: Called instructions now log their name by default. This can be turned off with the
no-log-ix-nameflag (#1057). - lang:
ProgramDataandUpgradableLoaderStatecan now be passed intoAccountas generics. see UpgradeableLoaderState.UpgradableLoaderStatecan also be matched on to getProgramData, but whenProgramDatais used instead, anchor does the serialization and checking that it is actually program data for you (#1095). - ts: Add better error msgs in the ts client if something wrong (i.e. not a pubkey or a string) is passed in as an account in an instruction accounts object (#1098).
- ts: Add inputs
postInstructionsandpreInstructionsas a replacement for (the now deprecated)instructions(#1007). - ts: Add
getAccountInfohelper method to account namespace/client (#1084).
Breaking
- lang, ts: Error codes have been mapped to new numbers to allow for more errors per namespace (#1096).
[0.18.2] - 2021-11-14
- cli: Replace global JavaScript dependency installs with local.
Features
- lang: Add
SystemAccount<'info>account type for generic wallet addresses or accounts owned by the system program (#954)
Fixes
- cli: fix dns in NODE_OPTIONS (#928).
- cli: output TypeScript IDL in
idl parsesubcommand (#941). - cli: Add fields
osandcputo npm package@project-serum/anchor-cli(#976). - cli: Allow specify output directory for TypeScript IDL (#940).
Breaking
- spl: Move permissioned markets into dex repository (#962).
[0.18.0] - 2021-10-24
Features
- cli: Add support for configuration options for
solana-test-validatorin Anchor.toml (#834). - cli:
target/typesdirectory 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_authoritykeyword for mint initialization within#[derive(Accounts)](#835). - lang: Add
AccountLoadertype forzero_copyaccounts 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).
Breaking
- lang: Accounts marked with the
#[account(signer)]constraint now enforce signer when the"cpi"feature is enabled (#849).
[0.17.0] - 2021-10-03
Features
- cli: Add
localnetcommand for starting a localsolana-test-validatorwith the workspace deployed (#820).
Breaking
CpiContextaccounts 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).
[0.16.2] - 2021-09-27
Features
- lang: Add
--detachflag toanchor test(#770). - lang: Add
associated_tokenkeyword 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).
Fixes
- lang: Generated
AccountMetas for Rust clients now properly set theisSignerfield (#762).
[0.16.1] - 2021-09-17
Fixes
- lang:
Signertype now sets isSigner to true in the IDL (#750).
[0.16.0] - 2021-09-16
Features
- lang:
Programtype introduced for executable accounts (#705). - lang:
Signertype introduced for signing accounts where data is not used (#705). - lang:
UncheckedAccounttype introduced as a preferred alias forAccountInfo(#745).
Breaking Changes
- lang:
#[account(owner = <pubkey>)]now requires aPubkeyinstead of an account (#691).
[0.15.0] - 2021-09-07
Features
- lang: Add new
Accounttype to replaceProgramAccountandCpiAccount, both of which are deprecated (#686). - lang:
Boxcan be used withAccounttypes to reduce stack usage (#686). - lang: Add
Ownertrait, which is automatically implemented by all#[account]structs (#686). - lang: Check that ProgramAccount writable before mut borrow (
anchor-debugonly) (#681).
Breaking Changes
- lang: All programs must now define their program id in source via
declare_id!(#686).
[0.14.0] - 2021-09-02
Features
- lang: Ignore
Unnamedstructs 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>forAccountInfowrappers (#652). - lang: Optimize
trait Keyby removingAccountInfocloning (#652). - cli, client, lang: Update solana toolchain to v1.7.11 (#653).
Breaking Changes
- 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 launchcommand (#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:
bumpmust be provided when using theseedsconstraint. 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_inithas been removed fromLoader,ProgramAccount, andCpiAccountand replaced withtry_from_unchecked(#641). - lang: Remove
AccountsInittrait (#641). - lang:
try_frommethods forProgramAccount,Loader, andProgramStatenow take in an additionalprogram_id: &Pubkeyparameter (#660).
[0.13.2] - 2021-08-11
Fixes
- cli: Fix
anchor initcommand "Workspace not found" regression (#598).
[0.13.1] - 2021-08-10
Features
- cli: Programs embedded into genesis during tests will produce program logs (#594).
Fixes
- cli: Allows Cargo.lock to exist in workspace subdirectories when publishing (#593).
[0.13.0] - 2021-08-08
Features
- 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_versionfield to the Anchor.toml for specifying the anchor docker image to use for verifiable builds (#570). - cli: Adds a root level
solana_versionfield 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).
Breaking
- 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 workspace root (#570).
[0.12.0] - 2021-08-03
Features
- cli: Add keys
members/excludein configprogramssection (#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).
Breaking Changes
- ts: Use
hexby default for decoding Instruction (#547). - lang:
CpiAccount::reloadmutates the existing struct instead of returning a new one (#526). - cli: Anchor.toml now requires an explicit
[scripts]test command (#550).
[0.11.1] - 2021-07-09
Features
- lang: Adds
requiremacro 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
bumpkeyword is added to the accounts constraints, which is used to add an optional bump seed to the end of aseedsarray. When used in conjunction with bothinitandseeds, then the program executesfind_program_addressto assert that the given bump is the canonical bump (#483).
Fixes
- lang: Preserve all instruction data for fallback functions (#483).
- ts: Event listener not firing when creating associated accounts (#356).
[0.11.0] - 2021-07-03
Features
- 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).
Breaking Changes
- cli: Remove
.specsuffix on TypeScript tests files (#441). - lang: Remove
belongs_toconstraint (#459).
[0.10.0] - 2021-06-27
Features
- 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 viaseedsorassociated(#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).
Breaking Changes
- cli: Remove
--yarnflag in favor of usingnpx(#432).
[0.9.0] - 2021-06-15
Features
- lang: Instruction data is now available to accounts constraints (#386).
- lang: Initialize program derived addresses with accounts constraints (#386).
Breaking Changes
- lang: Event field names in IDLs are now mixed case. (#379).
- lang: Accounts trait now accepts an additional
&[u8]parameter (#386).
[0.8.0] - 2021-06-10
Features
- cli: Add
--program-nameoption 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).
Fixes
- lang: Allows one to use
remaining_accountswithCpiContextby implementing theToAccountMetastrait onCpiContext(#351).
Breaking
- 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).
[0.7.0] - 2021-05-31
Features
- cli: Add global options for override Anchor.toml values (#313).
- spl: Add
SetAuthorityinstruction (#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.workspaceclients (#310).
Breaking Changes
- ts: Retrieving deserialized accounts from the
<program>.account.<my-account>and<program>.statenamespaces now require explicitly invoking thefetchAPI. For example,program.account.myAccount(<address>)andprogram.state()is nowprogram.account.myAccount.fetch(<address>)andprogram.state.fetch()(#322). - lang:
#[account(associated)]now requiresinitto 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 instruction sighash to be a single colon
:to be consistent with accounts (#321). - lang: Associated constraints no longer automatically implement
mut(#341). - lang: Associated
spaceconstraints must now be literal integers instead of literal strings (#341).
[0.6.0] - 2021-05-23
Features
- ts: Add
program.simulatenamespace (#266). - ts: Introduce
Addresstype, allowing one to use Base 58 encoded strings in public APIs (#304). - ts: Replace deprecated
web3.Accountwithweb3.Signerin public APIs (#296). - ts: Generated
anchor.workspaceclients 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-buildflag to test command (301). - cli: Add
anchor shellcommand to spawn a node shell populated with an Anchor.toml based environment (#303).
Breaking Changes
- cli: The Anchor.toml's
walletandclustersettings must now be under the[provider]table (#305). - ts: Event coder
decodeAPI changed to decode strings directly instead of buffers (#292). - ts: Event coder
encodeAPI removed (#292).
[0.5.0] - 2021-05-07
Features
- client: Adds support for state instructions (#248).
- lang: Add
anchor-debugfeature flag for logging (#253). - ts: Add support for u16 (#255).
Breaking Changes
- client: Renames
RequestBuilder::newtoRequestBuilder::from(#248). - lang: Renames the generated
instruction::state::Ctorstruct toinstruction::state::New(#248).
[0.4.5] - 2021-04-29
- spl: Add serum DEX CPI client (#224).
[0.4.4] - 2021-04-18
Features
- lang: Allows one to specify multiple
withtargets when creating associated accounts (#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).
[0.4.3] - 2021-04-13
Features
- 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).
Fixes
- lang: Unused
#[account]s are now parsed into the IDL correctly (#177).
[0.4.2] - 2021-04-10
Features
- cli: Fund Anchor.toml configured wallet when testing (#164).
- spl: Add initialize_account instruction for spl tokens (#166).
[0.4.1] - 2021-04-06
- cli: Version verifiable docker builder (#145).
[0.4.0] - 2021-04-04
Features
- 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).
Breaking Changes
- client: Replace url str with
Clusterstruct when constructing clients (#89). - lang: Changes the account discriminator of
IdlAccountto 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).
[0.3.0] - 2021-03-12
Features
- 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).
Breaking Changes
- lang: Removes
IdlInstruction::Clear(#107).
Fixes
- cli: Propagates mocha test exit status on error (79b791).
[0.2.1] - 2021-02-11
Features
- cli: Embed workspace programs into local validator genesis when testing (733ec3).
- cli: Stream program logs to
.anchor/program-logsdirectory 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).
[0.2.0] - 2021-02-08
Features
- lang: Adds the ability to create and use CPI program interfaces (#66).
Breaking Changes
- lang, client, ts: Migrate from rust enum based method dispatch to a variant of sighash (#64).
[0.1.0] - 2021-01-31
Initial release.
Includes
- lang:
anchor-langcrate 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-splcrate providing CPI clients for Anchor programs. - client:
anchor-clientcrate providing Rust clients for Anchor programs. - ts:
@project-serum/anchorpackage for generating TypeScript clients. - cli: Command line interface for managing Anchor programs.