diff --git a/basics/program-derived-addresses/steel/Cargo.toml b/basics/program-derived-addresses/steel/Cargo.toml index 1352bc6f1..fe03a6fd3 100644 --- a/basics/program-derived-addresses/steel/Cargo.toml +++ b/basics/program-derived-addresses/steel/Cargo.toml @@ -17,5 +17,5 @@ program-derived-addresses-api = { path = "./api", version = "0.1.0" } bytemuck = "1.14" num_enum = "0.7" solana-program = "1.18" -steel = "1.3" +steel = "2.1" thiserror = "1.0" diff --git a/basics/program-derived-addresses/steel/program/src/create.rs b/basics/program-derived-addresses/steel/program/src/create.rs index 08c470dd8..c2a77f639 100644 --- a/basics/program-derived-addresses/steel/program/src/create.rs +++ b/basics/program-derived-addresses/steel/program/src/create.rs @@ -14,14 +14,10 @@ pub fn process_create(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResul return Err(ProgramError::NotEnoughAccountKeys); }; - // get expected pda - let pda = page_visits_pda(user_info.key); - // validations signer_info.is_signer()?; pages_visit_info.is_empty()?.is_writable()?.has_seeds( &[SEED, &user_info.key.as_ref()], - pda.1, &program_derived_addresses_api::ID, )?; system_program.is_program(&system_program::ID)?; @@ -29,13 +25,13 @@ pub fn process_create(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResul // create account create_account::( pages_visit_info, - &program_derived_addresses_api::ID, - &[SEED, user_info.key.as_ref(), &[pda.1]], system_program, signer_info, + &program_derived_addresses_api::ID, + &[SEED, user_info.key.as_ref()], )?; - let info = pages_visit_info.to_account_mut::(&program_derived_addresses_api::ID)?; + let info = pages_visit_info.as_account_mut::(&program_derived_addresses_api::ID)?; info.page_visits = page_visits.page_visits; info.bump = page_visits.bump; diff --git a/basics/program-derived-addresses/steel/program/src/increment.rs b/basics/program-derived-addresses/steel/program/src/increment.rs index 6fe6f869a..684d73fb6 100644 --- a/basics/program-derived-addresses/steel/program/src/increment.rs +++ b/basics/program-derived-addresses/steel/program/src/increment.rs @@ -10,7 +10,7 @@ pub fn process_increment(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramR return Err(ProgramError::NotEnoughAccountKeys); }; - let info = page_visit_info.to_account_mut::(&program_derived_addresses_api::ID)?; + let info = page_visit_info.as_account_mut::(&program_derived_addresses_api::ID)?; // increment page visits info.increment_visits();