Skip to content

Commit 40aed81

Browse files
authored
chore: bumped versions (#378)
* bumped versions * updated setup-anchor action * token 2022 version bump * --force keygen in action for fresh builds * bump spl-token-2022 in nft-meta-data-pointer * ignored nft-meta-data-pointer
1 parent c354e85 commit 40aed81

File tree

62 files changed

+5324
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+5324
-168
lines changed

.github/.ghaignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,12 @@ tokens/escrow/anchor
2929

3030
# not live
3131
tokens/token-2022/group/anchor
32+
33+
# error in tests
34+
tokens/external-delegate-token-master/anchor
35+
36+
# build failed - program outdated
37+
tokens/token-2022/metadata/anchor
38+
39+
# dependency issues
40+
tokens/token-2022/nft-meta-data-pointer/anchor-example/anchor

.github/workflows/anchor.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,15 @@ jobs:
104104
failed_projects: ${{ steps.set-failed.outputs.failed_projects }}
105105
steps:
106106
- uses: actions/checkout@v4
107-
- uses: heyAyushh/setup-anchor@v4.4
107+
- uses: heyAyushh/setup-anchor@v0.31
108108
with:
109-
anchor-version: 0.30.1
109+
anchor-version: 0.31.1
110110
solana-cli-version: stable
111-
node-version: 20.x
112-
use-avm: false
113111
- name: Display Versions and Install pnpm
114112
run: |
115113
solana -V
116-
solana-keygen new --no-bip39-passphrase
114+
# it's okay to use --force in github action since all programs are tested in isolation
115+
solana-keygen new --no-bip39-passphrase --force
117116
rustc -V
118117
anchor -V
119118
npm i -g pnpm

Cargo.lock

Lines changed: 23 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

basics/account-data/anchor/programs/anchor-program-example/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ no-log-ix-name = []
1717
idl-build = ["anchor-lang/idl-build"]
1818

1919
[dependencies]
20-
anchor-lang = "0.30.1"
20+
anchor-lang = "0.31.1"

basics/checking-accounts/anchor/programs/anchor-program-example/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ no-log-ix-name = []
1717
idl-build = ["anchor-lang/idl-build"]
1818

1919
[dependencies]
20-
anchor-lang = "0.30.0"
20+
anchor-lang = "0.31.1"

basics/close-account/anchor/programs/close-account/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ no-log-ix-name = []
1717
idl-build = ["anchor-lang/idl-build"]
1818

1919
[dependencies]
20-
anchor-lang = "0.30.0"
20+
anchor-lang = "0.31.1"

basics/counter/anchor/programs/counter_anchor/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ no-log-ix-name = []
1717
idl-build = ["anchor-lang/idl-build"]
1818

1919
[dependencies]
20-
anchor-lang = "0.30.0"
20+
anchor-lang = "0.31.1"

basics/create-account/anchor/programs/create-system-account/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ no-log-ix-name = []
1717
idl-build = ["anchor-lang/idl-build"]
1818

1919
[dependencies]
20-
anchor-lang = "0.30.0"
20+
anchor-lang = "0.31.1"

basics/cross-program-invocation/anchor/programs/hand/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ no-log-ix-name = []
1717
idl-build = ["anchor-lang/idl-build"]
1818

1919
[dependencies]
20-
anchor-lang = "0.30.0"
20+
anchor-lang = "0.31.1"

basics/cross-program-invocation/anchor/programs/lever/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ no-log-ix-name = []
1717
idl-build = ["anchor-lang/idl-build"]
1818

1919
[dependencies]
20-
anchor-lang = "0.30.0"
20+
anchor-lang = "0.31.1"

basics/favorites/anchor/programs/favorites/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ default = []
1717
idl-build = ["anchor-lang/idl-build"]
1818

1919
[dependencies]
20-
anchor-lang = {version = "0.30.1", features = ["init-if-needed"]}
20+
anchor-lang = {version = "0.31.1", features = ["init-if-needed"]}
2121
solana-program = "=2.0.3"

basics/favorites/native/program/src/instructions/create_pda.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
1+
use crate::state::Favorites;
12
use borsh::BorshSerialize;
23
use solana_program::{
34
account_info::{next_account_info, AccountInfo},
4-
pubkey::Pubkey,
5-
program_error::ProgramError,
65
entrypoint::ProgramResult,
7-
system_instruction,
86
msg,
97
program::invoke_signed,
8+
program_error::ProgramError,
9+
pubkey::Pubkey,
1010
rent::Rent,
11-
sysvar::Sysvar
11+
system_instruction,
12+
sysvar::Sysvar,
1213
};
13-
use crate::state::Favorites;
1414

15-
pub fn create_pda(
16-
program_id: &Pubkey,
17-
accounts: &[AccountInfo],
18-
data: Favorites
19-
) -> ProgramResult {
15+
pub fn create_pda(program_id: &Pubkey, accounts: &[AccountInfo], data: Favorites) -> ProgramResult {
2016
let account_iter = &mut accounts.iter();
2117
let user = next_account_info(account_iter)?; // the user who's signing the transaction
2218
let favorite_account = next_account_info(account_iter)?; // The target account that will be created in the process
2319
let system_program = next_account_info(account_iter)?;
2420

25-
// deriving the favorite pda
26-
let (favorite_pda, favorite_bump) = Pubkey::find_program_address(&[b"favorite", user.key.as_ref()], program_id);
21+
// deriving the favorite pda
22+
let (favorite_pda, favorite_bump) =
23+
Pubkey::find_program_address(&[b"favorite", user.key.as_ref()], program_id);
2724

2825
// Checking if the favorite account is same as the derived favorite pda
2926
if favorite_account.key != &favorite_pda {
@@ -46,13 +43,17 @@ pub fn create_pda(
4643

4744
invoke_signed(
4845
&ix,
49-
&[user.clone(), favorite_account.clone(), system_program.clone()],
46+
&[
47+
user.clone(),
48+
favorite_account.clone(),
49+
system_program.clone(),
50+
],
5051
&[&[b"favorite", user.key.as_ref(), &[favorite_bump]]],
5152
)?;
5253

5354
// Serialize and store the data
5455
data.serialize(&mut &mut favorite_account.data.borrow_mut()[..])?;
55-
msg!("{:#?}",data);
56+
msg!("{:#?}", data);
5657
} else {
5758
return Err(ProgramError::AccountAlreadyInitialized.into());
5859
}
Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,35 @@
1+
use crate::state::Favorites;
2+
use borsh::BorshDeserialize;
13
use solana_program::{
4+
account_info::{next_account_info, AccountInfo},
25
entrypoint::ProgramResult,
3-
account_info::{ AccountInfo, next_account_info},
46
msg,
7+
program_error::ProgramError,
58
pubkey::Pubkey,
6-
program_error::ProgramError
79
};
8-
use borsh::BorshDeserialize;
9-
use crate::state::Favorites;
10-
1110

12-
pub fn get_pda(
13-
program_id: &Pubkey,
14-
accounts: &[AccountInfo],
15-
) -> ProgramResult {
11+
pub fn get_pda(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
1612
let account_iter = &mut accounts.iter();
1713
let user = next_account_info(account_iter)?;
1814
let favorite_account = next_account_info(account_iter)?;
1915

20-
// deriving the favorite pda
21-
let (favorite_pda, _) = Pubkey::find_program_address(&[b"favorite", user.key.as_ref()], program_id);
16+
// deriving the favorite pda
17+
let (favorite_pda, _) =
18+
Pubkey::find_program_address(&[b"favorite", user.key.as_ref()], program_id);
2219

2320
// Checking if the favorite account is same as the derived favorite pda
2421
if favorite_account.key != &favorite_pda {
25-
return Err(ProgramError::IncorrectProgramId);
22+
return Err(ProgramError::IncorrectProgramId);
2623
};
27-
24+
2825
let favorites = Favorites::try_from_slice(&favorite_account.data.borrow())?;
2926

30-
msg!("User {}'s favorite number is {}, favorite color is: {}, and their hobbies are {:#?}", user.key, favorites.number, favorites.color, favorites.hobbies);
27+
msg!(
28+
"User {}'s favorite number is {}, favorite color is: {}, and their hobbies are {:#?}",
29+
user.key,
30+
favorites.number,
31+
favorites.color,
32+
favorites.hobbies
33+
);
3134
Ok(())
32-
}
35+
}

basics/favorites/native/program/src/instructions/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ pub mod create_pda;
22
pub mod get_pda;
33

44
use create_pda::*;
5-
use get_pda::*;
5+
use get_pda::*;
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
use solana_program::entrypoint;
22

3-
pub mod state;
43
pub mod instructions;
54
pub mod processor;
5+
pub mod state;
66

77
use processor::process_instruction;
88

99
entrypoint!(process_instruction);
10-
11-
12-

basics/favorites/native/program/src/processor.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
use solana_program::{
2-
account_info::AccountInfo,
3-
entrypoint::ProgramResult,
4-
pubkey::Pubkey,
5-
};
1+
use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
62

73
use crate::instructions::{create_pda::*, get_pda::*};
84
use crate::state::Favorites;
@@ -23,7 +19,7 @@ pub fn process_instruction(
2319

2420
match instruction {
2521
FavoritesInstruction::CreatePda(data) => create_pda(program_id, accounts, data),
26-
FavoritesInstruction::GetPda => get_pda(program_id,accounts),
22+
FavoritesInstruction::GetPda => get_pda(program_id, accounts),
2723
}?;
2824

2925
Ok(())

basics/favorites/native/program/src/state.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ use borsh::{BorshDeserialize, BorshSerialize};
44
pub struct Favorites {
55
pub number: u64,
66
pub color: String,
7-
pub hobbies: Vec<String>
7+
pub hobbies: Vec<String>,
88
}
99

1010
#[derive(BorshDeserialize, BorshSerialize)]
11-
pub struct GetFavorites {
12-
}
13-
11+
pub struct GetFavorites {}

basics/hello-solana/anchor/programs/hello-solana/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ no-log-ix-name = []
1717
idl-build = ["anchor-lang/idl-build"]
1818

1919
[dependencies]
20-
anchor-lang = "0.30.0"
20+
anchor-lang = "0.31.1"

0 commit comments

Comments
 (0)