diff --git a/src/getting_started/create_component.md b/src/getting_started/create_component.md index 9bbee06..9c7933b 100644 --- a/src/getting_started/create_component.md +++ b/src/getting_started/create_component.md @@ -15,14 +15,7 @@ use bolt_lang::*; declare_id!("Fn1JzzEdyb55fsyduWS94mYHizGhJZuhvjX6DVvrmGbQ"); -#[component(Position)] -#[program] -pub mod component_position { - use super::*; -} - -#[account] -#[bolt_account(component_id = "component-position")] +#[component] #[derive(Copy)] pub struct Position { pub x: i64, diff --git a/src/getting_started/create_system.md b/src/getting_started/create_system.md index af16037..654e26f 100644 --- a/src/getting_started/create_system.md +++ b/src/getting_started/create_system.md @@ -12,6 +12,7 @@ which will add a new system to your workspace: ```rust use bolt_lang::*; +use component_position::Position; declare_id!("FSa6qoJXFBR3a7ThQkTAMrC15p6NkchPEjBdd4n6dXxA"); @@ -20,28 +21,20 @@ declare_id!("FSa6qoJXFBR3a7ThQkTAMrC15p6NkchPEjBdd4n6dXxA"); pub mod system_movement { use super::*; - pub fn execute(ctx: Context, args_p: Vec) -> Result { + pub fn execute(ctx: Context, args_p: Vec) -> Result { - let mut position = Position::from_account_info(&ctx.accounts.position)?; + let position = &mut ctx.accounts.position; position.x += 1; position.y += 1; - Ok(position) + Ok(ctx.accounts) } -} - -// Define the Account to parse from the component -#[derive(Accounts)] -pub struct Component<'info> { - /// CHECK: check that the component is the expected account - pub position: AccountInfo<'info>, -} -#[component_deserialize] -pub struct Position { - pub x: i64, - pub y: i64, - pub z: i64, + // Define the input components + #[system_input] + pub struct Components { + pub position: Position, + } } ``` \ No newline at end of file