Skip to content

Commit 88eb529

Browse files
committed
steel bumped to 2.1.0
1 parent f6f3961 commit 88eb529

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

basics/account-data/steel/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ account-data-api = { path = "./api", version = "0.1.0" }
1717
bytemuck = "1.14"
1818
num_enum = "0.7"
1919
solana-program = "1.18"
20-
steel = "1.3"
20+
steel = "2.1.0"
2121
thiserror = "1.0"

basics/account-data/steel/program/src/initialize.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,30 @@ pub fn process_initialize_account(accounts: &[AccountInfo<'_>], data: &[u8]) ->
2828
return Err(ProgramError::NotEnoughAccountKeys);
2929
};
3030

31-
let bump = account_pda().1;
32-
3331
// validate accounts
3432
signer_info.is_signer()?;
35-
new_account_info.is_empty()?.is_writable()?.has_seeds(
36-
&[ACCOUNT],
37-
bump,
38-
&account_data_api::ID
39-
)?;
33+
new_account_info.is_empty()?.is_writable()?;
4034
system_program.is_program(&system_program::ID)?;
4135

4236
msg!("Program invoked. Creating a system account...");
4337
msg!(" New public key will be: {}", new_account_info.key);
44-
45-
// create account
38+
4639
create_account::<Data>(
47-
new_account_info,
48-
&ID,
49-
&[ACCOUNT, &[bump]],
50-
system_program,
51-
signer_info,
40+
new_account_info,
41+
system_program,
42+
signer_info,
43+
&ID,
44+
&[ACCOUNT]
5245
)?;
5346

47+
48+
5449
// set data
55-
let data_account = new_account_info.to_account_mut::<Data>(&ID)?;
50+
let data_account = new_account_info.as_account_mut::<Data>(&ID)?;
5651
data_account.name = args.name;
5752
data_account.house_number = args.house_number;
5853
data_account.city = args.city;
5954
data_account.street = args.street;
6055

61-
msg!("created and data set successfully.");
6256
Ok(())
6357
}

0 commit comments

Comments
 (0)