Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ See the [Anchor 0.29 release notes](https://www.anchor-lang.com/release-notes/0.
- spl: Re-export the `spl_token` crate ([#1665](https://github.com/coral-xyz/anchor/pull/1665)).
- lang, cli, spl: Update solana toolchain to v1.9.13 ([#1653](https://github.com/coral-xyz/anchor/pull/1653) and [#1751](https://github.com/coral-xyz/anchor/pull/1751)).
- lang: `Program` type now deserializes `programdata_address` only on demand ([#1723](https://github.com/coral-xyz/anchor/pull/1723)).
- ts: Make `Provider` an interface and adjust its signatures and add `AnchorProvider` implementor class ([#1707](https://github.com/coral-xyz/anchor/pull/1707)).
- ts: Make `Provider` an interface and adjust its signatures and add `AnchorProvider` implementer class ([#1707](https://github.com/coral-xyz/anchor/pull/1707)).
- spl: Change "to" to "from" in `token::burn` ([#1080](https://github.com/coral-xyz/anchor/pull/1080)).

## [0.23.0] - 2022-03-20
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ To jump straight to examples, go [here](https://github.com/coral-xyz/anchor/tree
| `anchor-spl` | CPI clients for SPL programs on Solana | [![crates](https://img.shields.io/crates/v/anchor-spl?color=blue)](https://crates.io/crates/anchor-spl) | [![Docs.rs](https://docs.rs/anchor-spl/badge.svg)](https://docs.rs/anchor-spl) |
| `anchor-client` | Rust client for Anchor programs | [![crates](https://img.shields.io/crates/v/anchor-client?color=blue)](https://crates.io/crates/anchor-client) | [![Docs.rs](https://docs.rs/anchor-client/badge.svg)](https://docs.rs/anchor-client) |
| `@coral-xyz/anchor` | TypeScript client for Anchor programs | [![npm](https://img.shields.io/npm/v/@coral-xyz/anchor.svg?color=blue)](https://www.npmjs.com/package/@coral-xyz/anchor) | [![Docs](https://img.shields.io/badge/docs-typedoc-blue)](https://coral-xyz.github.io/anchor/ts/index.html) |
| `@coral-xyz/anchor-cli` | CLI to support building and managing an Anchor workspace | [![npm](https://img.shields.io/npm/v/@coral-xyz/anchor-cli.svg?color=blue)](https://www.npmjs.com/package/@coral-xyz/anchor-cli) | [![Docs](https://img.shields.io/badge/docs-typedoc-blue)](https://coral-xyz.github.io/anchor/cli/commands.html) |
| `@coral-xyz/anchor-cli` | CLI to support building and managing an Anchor workspace | [![npm](https://img.shields.io/npm/v/@coral-xyz/anchor-cli.svg?color=blue)](https://www.npmjs.com/package/@coral-xyz/anchor-cli) | [![Docs](https://img.shields.io/badge/docs-typedoc-blue)](https://www.anchor-lang.com/docs/references/cli) |

## Note

Expand Down
2 changes: 1 addition & 1 deletion avm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ mod tests {
let expected = vec![version];
assert_eq!(read_installed_versions().unwrap(), expected);

// Should ignore this file because its not anchor- prefixed
// Should ignore this file because it's not anchor- prefixed
fs::File::create(AVM_HOME.join("bin").join("garbage").as_path()).unwrap();
assert_eq!(read_installed_versions().unwrap(), expected);
}
Expand Down
4 changes: 2 additions & 2 deletions docs/content/docs/basics/cpi.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description:
---

Cross Program Invocations (CPI) refer to the process of one program invoking
instructions of another program, which enables the composibility of Solana
instructions of another program, which enables the composability of Solana
programs.

This section will cover the basics of implementing CPIs in an Anchor program,
Expand Down Expand Up @@ -98,7 +98,7 @@ resulting in a successful SOL transfer.

Cross Program Invocations (CPIs) allow one program to invoke instructions on
another program. The process of implementing a CPI is the same as that of
creating a instruction where you must specify:
creating an instruction where you must specify:

1. The program ID of the program being called
2. The accounts required by the instruction
Expand Down
6 changes: 3 additions & 3 deletions docs/content/docs/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ To verify that the installation was successful, check the Yarn version:
yarn --version
```

You should the following output:
You should see the following output:

```
1.22.1
Expand Down Expand Up @@ -567,7 +567,7 @@ Keypair Path: /Users/test/.config/solana/id.json
Commitment: confirmed
```

The RPC URL and Websocket URL specific the Solana cluster the CLI will make
The RPC URL and Websocket URL specify the Solana cluster the CLI will make
requests to. By default this will be mainnet-beta.

You can update the Solana CLI cluster using the following commands:
Expand Down Expand Up @@ -614,7 +614,7 @@ Generating a new keypair

For added security, enter a BIP39 passphrase

NOTE! This passphrase improves security of the recovery seed phrae NOT the
NOTE! This passphrase improves security of the recovery seed phrase NOT the
keypair file itself, which is stored as insecure plain text

BIP39 Passphrase (empty for none):
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/tokens/basics/transfer-tokens.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ describe("token-example", () => {
console.log("Mint Account", mintAccount);
});

it("Mint Tokens", async () => {
it("Transfer Tokens", async () => {
const tx = await program.methods
.transferTokens()
.accounts({
Expand Down
8 changes: 4 additions & 4 deletions docs/content/docs/updates/release-notes/0-31-0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Program name: `my-program`
### Pass `cargo` args to IDL build

Both `anchor build` and `anchor idl build` commands pass the `cargo` arguments
to the underyling IDL build command. For example:
to the underlying IDL build command. For example:

```
anchor build -- --features my-feature
Expand Down Expand Up @@ -274,7 +274,7 @@ still allows empty discriminators because some non-Anchor programs, e.g. the SPL
Token program, don't have account discriminators. In that case, safety checks
should never depend on the discriminator.

Additionally, the IDL generation step also checks whether you have ambigious
Additionally, the IDL generation step also checks whether you have ambiguous
discriminators i.e. discriminators that can be used for multiple types. However,
you should still consider future possibilities, especially when working with
1-byte discriminators. For example, having an account with discriminator `[1]`
Expand Down Expand Up @@ -440,7 +440,7 @@ Building the IDL via the
[`build_idl`](https://github.com/coral-xyz/anchor/blob/v0.31.0/idl/src/build.rs#L119)
function made it impossible to extend its functionality e.g. add new parameters
without a breaking change. To solve this problem, there is a new way to build
IDLs programatically:
IDLs programmatically:

```rs
let idl = IdlBuilder::new().program_path(path).skip_lint(true).build()?;
Expand All @@ -457,7 +457,7 @@ The following issues with the IDL generation have been fixed:
- A bug where using tuple parameters in instructions would result in an
incorrect IDL ([#3294](https://github.com/coral-xyz/anchor/pull/3294))
- A bug where doc comments could trigger false-positives during module paths
convertion ([#3359](https://github.com/coral-xyz/anchor/pull/3359))
conversion ([#3359](https://github.com/coral-xyz/anchor/pull/3359))
- A bug where the generated IDL only has partial resolution information
([#3474](https://github.com/coral-xyz/anchor/pull/3474))
- Being unable to use constant identifiers as generic arguments
Expand Down
2 changes: 1 addition & 1 deletion lang/attribute/account/src/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn gen_lazy(strct: &syn::ItemStruct) -> syn::Result<TokenStream> {
let load_panic_docs = quote! {
/// # Panics
///
/// If there is an existing mutable reference crated by any of the `load_mut` methods.
/// If there is an existing mutable reference created by any of the `load_mut` methods.
};
let load_mut_panic_docs = quote! {
/// # Panics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn gen_internal_args_mod(idl: &Idl) -> proc_macro2::TokenStream {
/// An Anchor generated module containing the program's set of instructions, where each
/// method handler in the `#[program]` mod is associated with a struct defining the input
/// arguments to the method. These should be used directly, when one wants to serialize
/// Anchor instruction data, for example, when specifying instructions instructions on a
/// Anchor instruction data, for example, when specifying instructions on a
/// client.
pub mod args {
use super::*;
Expand Down
2 changes: 1 addition & 1 deletion lang/src/accounts/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::ops::Deref;
///
/// The type has a `programdata_address` function that will return `Option::Some`
/// if the program is owned by the [`BPFUpgradeableLoader`](https://docs.rs/solana-program/latest/solana_program/bpf_loader_upgradeable/index.html)
/// which will contain the `programdata_address` property of the `Program` variant of the [`UpgradeableLoaderState`](https://docs.rs/solana-program/latest/solana_program/bpf_loader_upgradeable/enum.UpgradeableLoaderState.html) enum.
/// which will contain the `programdata_address` property of the `Program` variant of the [`UpgradeableLoaderState`](https://docs.rs/solana-loader-v3-interface/latest/solana_loader_v3_interface/state/enum.UpgradeableLoaderState.html) enum.
///
/// # Table of Contents
/// - [Basic Functionality](#basic-functionality)
Expand Down
4 changes: 2 additions & 2 deletions lang/syn/src/codegen/accounts/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,7 @@ fn generate_get_token_account_space(mint: &Expr) -> proc_macro2::TokenStream {
}
}

// Generated code to create an account with with system program with the
// Generated code to create an account with system program with the
// given `space` amount of data, owned by `owner`.
//
// `seeds_with_nonce` should be given for creating PDAs. Otherwise it's an
Expand Down Expand Up @@ -1684,7 +1684,7 @@ pub fn generate_constraint_executable(
let name_str = f.ident.to_string();
let account_ref = generate_account_ref(f);

// because we are only acting on the field, we know it isnt optional at this point
// because we are only acting on the field, we know it isn't optional at this point
// as it was unwrapped in `generate_constraint`
quote! {
if !#account_ref.executable {
Expand Down
2 changes: 1 addition & 1 deletion lang/syn/src/parser/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl CrateContext {
Please add a `/// CHECK:` doc comment explaining why no checks through types are necessary.
Alternatively, for reasons like quick prototyping, you may disable the safety checks
by using the `skip-lint` option.
See https://www.anchor-lang.com/docs/the-accounts-struct#safety-checks for more information.
See https://www.anchor-lang.com/docs/basics/program-structure#account-validation for more information.
"#,
ctx.file.canonicalize().unwrap().display(),
span.start().line,
Expand Down
6 changes: 3 additions & 3 deletions tests/auction-house/programs/auction-house/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ pub mod auction_house {
&treasury_mint.key(),
)?;

// make sure you cant get rugged
// make sure you can't get rugged
if rec_acct.delegate.is_some() {
return err!(ErrorCode::BuyerATACannotHaveDelegate);
}
Expand Down Expand Up @@ -773,7 +773,7 @@ pub mod auction_house {
&[auction_house.bump],
];

// with the native account, the escrow is it's own owner,
// with the native account, the escrow is its own owner,
// whereas with token, it is the auction house that is owner.
let signer_seeds_for_royalties = if is_native {
escrow_signer_seeds
Expand Down Expand Up @@ -832,7 +832,7 @@ pub mod auction_house {
&treasury_mint.key(),
)?;

// make sure you cant get rugged
// make sure you can't get rugged
if seller_rec_acct.delegate.is_some() {
return err!(ErrorCode::SellerATACannotHaveDelegate);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/idl/tests/new-idl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ describe("New IDL", () => {
const pointX = new anchor.BN(1);
const pointY = new anchor.BN(2);
const named = await testAccountEnum({ named: { pointX, pointY } });
if (!named.fullEnum.named) throw new Error("Named not crated");
if (!named.fullEnum.named) throw new Error("Named not created");
assert(named.fullEnum.named.pointX.eq(pointX));
assert(named.fullEnum.named.pointY.eq(pointY));

// Unnamed
const tupleArg = [1, 2, 3, 4] as const;
const unnamed = await testAccountEnum({ unnamed: tupleArg });
if (!unnamed.fullEnum.unnamed) throw new Error("Unnamed not crated");
if (!unnamed.fullEnum.unnamed) throw new Error("Unnamed not created");
assert(
Object.entries(unnamed.fullEnum.unnamed).every(
([key, value]) => value === tupleArg[key as keyof typeof tupleArg]
Expand All @@ -233,7 +233,7 @@ describe("New IDL", () => {
unnamedStruct: tupleStructArg,
});
if (!unnamedStruct.fullEnum.unnamedStruct) {
throw new Error("Unnamed struct not crated");
throw new Error("Unnamed struct not created");
}
assert.strictEqual(
unnamedStruct.fullEnum.unnamedStruct[0].u8,
Expand Down
2 changes: 1 addition & 1 deletion tests/lockup/docs/lockups.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ if any at all.

To create a whitelisted program that receives withdrawals/deposits from/to the Lockup program,
one needs to implement the whitelist transfer interface, which assumes nothing about the
`instruction_data` but requires accounts to be provided in a specific [order](https://github.com/project-serum/serum-dex/blob/master/registry/program/src/deposit.rs#L18).
`instruction_data` but requires accounts to be provided in a specific order.

Take staking locked tokens as a working example.

Expand Down
6 changes: 3 additions & 3 deletions tests/lockup/docs/staking.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ to understand, contribute to, or modify the code.
Accounts are the pieces of state owned by a Solana program. For reference while reading, here are all
accounts used by the **Registry** program.

* `Registrar` - Analogous to an SPL token `Mint`, the `Registrar` defines a staking instance. It has its own pool, and it's own set of rewards distributed amongst its own set of stakers.
* `Registrar` - Analogous to an SPL token `Mint`, the `Registrar` defines a staking instance. It has its own pool, and its own set of rewards distributed amongst its own set of stakers.
* `Member` - Analogous to an SPL token `Account`, `Member` accounts represent a **beneficiary**'s (i.e. a wallet's) stake state. This account has several vaults, all of which represent the funds belonging to an individual user.
* `PendingWithdrawal` - A transfer out of the staking pool (poorly named since it's not a withdrawal out of the program. But a withdrawal out of the staking pool and into a `Member`'s freely available balances).
* `RewardVendor` - A reward that has been dropped onto stakers and is distributed pro rata to staked `Member` beneficiaries.
Expand Down Expand Up @@ -89,7 +89,7 @@ from the stake pool is complete, and the funds are ready to be used again.
Feel free to skip this section and jump to the **Reward Vendors** section if you want to
just see how rewards work.

One could imagine several ways to drop rewards onto a staking pool, each with there own downsides.
One could imagine several ways to drop rewards onto a staking pool, each with their own downsides.
Of course what you want is, for a given reward amount, to atomically snapshot the state
of the staking pool and to distribute it proportionally to all stake holders. Effectively,
an on chain program such as
Expand All @@ -116,7 +116,7 @@ This is not auditable or verifiable. And if you want to answer these questions,
complex off-chain protocols that require either fancy cryptography or effectively
recreating a BFT system off chain.

Another solution considerered was to use a uniswap-style AMM pool (without the swapping).
Another solution considered was to use a uniswap-style AMM pool (without the swapping).
This has a lot of advantages. First it's easy to reason about and implement in a single transaction.
To drop rewards globally onto the pool, one can deposit funds directly into the pool, in which case
the reward is automatically received by owners of the staking pool token upon redemption, a process
Expand Down
2 changes: 1 addition & 1 deletion tests/lockup/programs/lockup/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub mod lockup {
let cpi_ctx = CpiContext::from(&*ctx.accounts).with_signer(signer);
token::transfer(cpi_ctx, amount)?;

// Bookeeping.
// Bookkeeping.
let vesting = &mut ctx.accounts.vesting;
vesting.outstanding -= amount;

Expand Down
2 changes: 1 addition & 1 deletion tests/optional/tests/optional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ describe("Optional", () => {
.signers([dataAccountKeypair3])
.rpc();
assert.fail(
"Unexpected success in creating a transaction that should have failed with `ConstraintRaw` error"
"Unexpected success in creating a transaction that should have failed with `ConstraintAccountIsNone` error"
);
} catch (e) {
// @ts-ignore
Expand Down
2 changes: 1 addition & 1 deletion tests/zero-copy/programs/zero-copy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ pub struct Event {
// traits, so any types in method signatures must as well.
// 2. All types for zero copy deserialization are `#[repr(packed)]`. However,
// the implementation of AnchorSerialize (i.e. borsh), uses references
// to the fields it serializes. So if we were to just throw tehse derives
// to the fields it serializes. So if we were to just throw these derives
// onto the other `Event` struct, we would have references to
// `#[repr(packed)]` fields, which is unsafe. To avoid the unsafeness, we
// just use a separate type.
Expand Down
8 changes: 4 additions & 4 deletions ts/packages/anchor/tests/events.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ describe("Events", () => {
const logs = [
"Program J2XMGdW2qQLx7rAdwWtSZpTXDgAQ988BLP9QTgUZvm54 invoke [1]",
"Program log: Instruction: CancelListing",
"Program log: TRANSFERED SOME TOKENS",
"Program log: TRANSFERRED SOME TOKENS",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
"Program log: Instruction: Transfer",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2549 of 182795 compute units",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
"Program log: TRANSFERED SOME TOKENS",
"Program log: TRANSFERRED SOME TOKENS",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
"Program log: Instruction: CloseAccount",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1745 of 176782 compute units",
Expand Down Expand Up @@ -252,12 +252,12 @@ describe("Events", () => {
const logs = [
"Program 5VcVB7jEjdWJBkriXxayCrUUkwfhrPK3rXtnkxxUvMFP invoke [1]",
"Program log: Instruction: CancelListing",
"Program log: TRANSFERED SOME TOKENS",
"Program log: TRANSFERRED SOME TOKENS",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
"Program log: Instruction: Transfer",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2549 of 182795 compute units",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
"Program log: TRANSFERED SOME TOKENS",
"Program log: TRANSFERRED SOME TOKENS",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
"Program log: Instruction: CloseAccount",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1745 of 176782 compute units",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/spl-governance/program/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ pub enum ProposalState {
#[derive(AnchorSerialize, AnchorDeserialize)]
pub enum VoteType {
/// Single choice vote with mutually exclusive choices
/// In the SingeChoice mode there can ever be a single winner
/// In the SingleChoice mode there can ever be a single winner
/// If multiple options score the same highest vote then the Proposal is not resolved and considered as Failed
/// Note: Yes/No vote is a single choice (Yes) vote with the deny option (No)
SingleChoice,
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/spl-token/program/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ pub enum TokenError {
#[msg("Invalid number of required signers")]
InvalidNumberOfRequiredSigners,
/// State is uninitialized.
#[msg("State is unititialized")]
#[msg("State is uninitialized")]
UninitializedState,

// 10
Expand Down
Loading