Skip to content

Commit 0f90aa4

Browse files
committed
create-account/steel - cargo fmt
1 parent 7c22d8d commit 0f90aa4

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ no-entrypoint = []
1111
cpi = ["no-entrypoint"]
1212

1313
[dependencies]
14-
solana-program = "=1.18.17"
15-
steel = "2.0"
14+
solana-program = "1.18.17"
15+
steel = "2.1"
1616
bytemuck = "1.14"
1717
num_enum = "0.7"
1818
cross-program-invocation-steel-lever = { path = "../lever", features = ["cpi"] }

basics/cross-program-invocation/steel/programs/hand/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ pub fn process_instruction(
1818
let set_power_status_data = SetPowerStatus::try_from_bytes(data)?;
1919

2020
let ix = Instruction::new_with_bytes(
21-
*lever_program.key, // program id of the callee
22-
&set_power_status_data.to_bytes(), // the instuction data,
21+
*lever_program.key, // program id of the callee
22+
&set_power_status_data.to_bytes(), // the instuction data,
2323
vec![AccountMeta::new(*power.key, false)], // accounts needed to execute the instruction
2424
);
2525

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ no-entrypoint = []
1111
cpi = ["no-entrypoint"]
1212

1313
[dependencies]
14-
solana-program = "=1.18.17"
15-
steel = "2.0"
14+
solana-program = "1.18.17"
15+
steel = "2.1"
1616
bytemuck = "1.14"
1717
num_enum = "0.7"

basics/cross-program-invocation/steel/programs/lever/src/instructions.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub struct InitializeLever {
2020
}
2121

2222
impl InitializeLever {
23-
pub fn process(program_id: &Pubkey, accounts: &[AccountInfo], data: &[u8]) -> ProgramResult {
23+
pub fn process(accounts: &[AccountInfo], data: &[u8]) -> ProgramResult {
2424
let on = Self::try_from_bytes(data)?.on;
2525

2626
let [power_info, user, system_program] = accounts else {
@@ -37,12 +37,12 @@ impl InitializeLever {
3737
power_info.key,
3838
lamports_required,
3939
account_span as u64,
40-
program_id,
40+
&crate::ID,
4141
),
4242
&[user.clone(), power_info.clone(), system_program.clone()],
4343
)?;
4444

45-
let power = power_info.as_account_mut::<PowerStatus>(program_id)?;
45+
let power = power_info.as_account_mut::<PowerStatus>(&crate::ID)?;
4646

4747
power.on = on;
4848

@@ -63,14 +63,14 @@ pub struct SetPowerStatus {
6363
}
6464

6565
impl SetPowerStatus {
66-
pub fn process(program_id: &Pubkey, accounts: &[AccountInfo], data: &[u8]) -> ProgramResult {
66+
pub fn process(accounts: &[AccountInfo], data: &[u8]) -> ProgramResult {
6767
let name = SetPowerStatus::try_from_bytes(data)?.name;
6868

6969
let [power_info] = accounts else {
7070
return Err(ProgramError::NotEnoughAccountKeys);
7171
};
7272

73-
let power = power_info.as_account_mut::<PowerStatus>(program_id)?;
73+
let power = power_info.as_account_mut::<PowerStatus>(&crate::ID)?;
7474

7575
// switch power status
7676
power.switch()?;

basics/cross-program-invocation/steel/programs/lever/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub use instructions::*;
33

44
use steel::*;
55

6-
declare_id!("z7msBPQHDJjTvdQRoEcKyENgXDhSRYeHieN1ZMTqo35");
6+
declare_id!("E64FVeubGC4NPNF2UBJYX4AkrVowf74fRJD9q6YhwstN");
77

88
#[cfg(not(feature = "no-entrypoint"))]
99
entrypoint!(process_instruction);
@@ -13,11 +13,11 @@ pub fn process_instruction(
1313
accounts: &[AccountInfo],
1414
data: &[u8],
1515
) -> ProgramResult {
16-
let (ix, data) = parse_instruction(program_id, program_id, data)?;
16+
let (ix, data) = parse_instruction(&crate::ID, program_id, data)?;
1717

1818
match ix {
19-
SteelInstruction::InitializeLever => InitializeLever::process(program_id, accounts, data),
20-
SteelInstruction::SetPowerStatus => SetPowerStatus::process(program_id, accounts, data),
19+
SteelInstruction::InitializeLever => InitializeLever::process(accounts, data),
20+
SteelInstruction::SetPowerStatus => SetPowerStatus::process(accounts, data),
2121
}
2222
}
2323

basics/cross-program-invocation/steel/tests/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import * as borsh from 'borsh';
55
import { start } from 'solana-bankrun';
66

77
describe('CPI Example', async () => {
8-
const LEVER_PROGRAM_ID = PublicKey.unique();
9-
const HAND_PROGRAM_ID = PublicKey.unique();
8+
const LEVER_PROGRAM_ID = new PublicKey('E64FVeubGC4NPNF2UBJYX4AkrVowf74fRJD9q6YhwstN');
9+
const HAND_PROGRAM_ID = new PublicKey('z7msBPQHDJjTvdQRoEcKyENgXDhSRYeHieN1ZMTqo35');
1010
const powerAccount = Keypair.generate();
1111

1212
const context = await start(

0 commit comments

Comments
 (0)