Document not found (404)
+This URL is invalid, sorry. Please use the navigation bar or search to continue.
+ +diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd5106f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_STORE diff --git a/404.html b/404.html new file mode 100644 index 0000000..a3ea7a4 --- /dev/null +++ b/404.html @@ -0,0 +1,167 @@ + + +
+ + +This URL is invalid, sorry. Please use the navigation bar or search to continue.
+ +Components are plain data structures (classes or structs) that contain data relevant to a specific aspect of an entity. They don't have any logic or methods. Examples of components could be a "Position" component containing x, y, z coordinates.
+Create a Position component with
+bolt component -n position
+
+which will add a new component to your workspace:
++ ++#![allow(unused)] +fn main() { +use bolt_lang::*; + +declare_id!("Fn1JzzEdyb55fsyduWS94mYHizGhJZuhvjX6DVvrmGbQ"); + +#[component(Position)] +#[program] +pub mod component_position { + use super::*; +} + +#[account] +#[bolt_account(component_id = "component-position")] +#[derive(Copy)] +pub struct Position { + pub x: i64, + pub y: i64, + pub z: i64, +} +} +
Systems contain the logic that processes and manipulates entities based on their components. A system will typically operate on all entities that have a specific set of components. For example, a "Movement" system might update the position of a "Position" component
+Create a movement system with with
+bolt system -n system-movement
+
+which will add a new system to your workspace:
++ ++#![allow(unused)] +fn main() { +use bolt_lang::*; + +declare_id!("FSa6qoJXFBR3a7ThQkTAMrC15p6NkchPEjBdd4n6dXxA"); + +#[system] +#[program] +pub mod system_movement { + use super::*; + + pub fn execute(ctx: Context<Component>, args_p: Vec<u8>) -> Result<Position> { + + let mut position = Position::from_account_info(&ctx.accounts.position)?; + + position.x += 1; + position.y += 1; + + Ok(position) + } +} + +// 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, +} +} +
This chapter walks you through the installation process and the folder structure of an anchor workspace.
+ +To initialize a new project, simply run:
+bolt init <new-workspace-name>
+
+This creates a new bolt workspace you can move into. The following are some of the important files in the folder:
+.anchor
folder: It includes the most recent program logs and a local ledger that is used for testingapp
folder: An empty folder that you can use to hold your frontend if you use a monorepoprograms
folder: This folder contains your programs. It can contain multiple but initially only contains a program with the same name as <new-workspace-name>
. This program already contains a lib.rs
file with some sample code.tests
folder: The folder that contains your E2E tests. It will already include a file that tests the sample code in the programs/<new-workspace-name>
.migrations
folder: In this folder you can save your deploy and migration scripts for your programs.Anchor.toml
file: This file configures workspace wide settings for your programs. Initially, it configures
+[programs.localnet]
)[registry]
)[provider]
)[scripts]
). The test
script is run when running anchor test
. You can run your own scripts with anchor run <script_name>
.Bolt is built on top of Anchor and supports all Anchor commands, in addition to some extensions. For the complete list of Anchor commands, refer to the Anchor book.
+ +Go here to install Rust.
+Go here to install Solana and then run solana-keygen new
to create a keypair at the default location. Anchor uses this keypair to run your program tests.
Go here to install Yarn.
+cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
+
+Install the 0.29.0 version of the CLI using avm
, and then set it to be the version to use.
avm install 0.29.0
+avm use 0.29.0
+
+Install Bolt
using Cargo.
cargo install --git https://github.com/magicblock-labs/bolt --locked --force
+
+On Linux systems you may need to install additional dependencies if cargo install fails. E.g. on Ubuntu:
+sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y pkg-config build-essential libudev-dev
+
+Verify the installation.
+bolt -h
+
+
+ The World Program includes instructions for creating world instances, entities, attaching components, and executing systems.
+The development of SDKs and client integrations is ongoing. However, the World Program is a standard anchor program with its IDL published on-chain. The Anchor IDL generator can be utilized to automatically generate clients.
+ +Welcome to The Bolt Book! ⚡
+++Bolt is an open-source project, currently in its early development phase, and warmly welcomes contributors. For additional resources, join the community on Discord.
+
This chapter covers what bolt is, how its documentation is structured, and what you should know to have a good time with this guide.
+If you find errors or something doesn't work, please report it here.
+ +