From 6485ff501283e9c0fc1db4be9d0f77e496811f77 Mon Sep 17 00:00:00 2001 From: AndrePanin Date: Wed, 9 Oct 2024 21:41:26 +0300 Subject: [PATCH] Update prerequisites (#188) --- docs/build/sails/sails.mdx | 5 ++ docs/examples/examples.mdx | 125 ++++++++++++++------------- docs/getting-started-in-5-minutes.md | 2 +- 3 files changed, 72 insertions(+), 60 deletions(-) diff --git a/docs/build/sails/sails.mdx b/docs/build/sails/sails.mdx index 31584fe..e8f6b0d 100644 --- a/docs/build/sails/sails.mdx +++ b/docs/build/sails/sails.mdx @@ -43,4 +43,9 @@ graph LR C-->F; D-->F; D-->E; +``` + +To install the latest version of the Sails library, use: +```bash +cargo install sails-cli ``` \ No newline at end of file diff --git a/docs/examples/examples.mdx b/docs/examples/examples.mdx index e616a08..5dbcc57 100644 --- a/docs/examples/examples.mdx +++ b/docs/examples/examples.mdx @@ -17,9 +17,11 @@ Programs can be written from scratch or built from provided examples. All program examples and JS applications have been tested in a stable environment with specific development tool versions necessary for implementing, building, and running programs and JS applications. + -Current stable release: `v1.4.2` +The **latest releases** of Gear librarires are avaible in the **[GitHub](https://github.com/gear-tech/gear/releases)**. @@ -34,7 +36,7 @@ Current stable release: `v1.4.2` - - + + + + + + + + - - + + @@ -84,15 +101,20 @@ Ensure connection to the Vara Network Testnet. Switch networks by clicking on th + + + + + - + - - + +
For example, on Ubuntu use: ```bash -sudo apt install -y build-essential clang cmake +sudo apt install -y build-essential clang cmake curl ``` On macOS, install a compiler toolset by running: ```bash @@ -47,6 +49,7 @@ xcode-select --install Rust stable +Install [Rustup](https://rustup.rs/) to get Rust compiler ready: ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` @@ -58,16 +61,30 @@ rustup target add wasm32-unknown-unknown
Gear Rust libraries: `gstd`, `gtest`, `gmeta`, `gclient`, `gear-wasm-builder`v1.4.2[Gear Sails](/docs/build/sails) librarylatest -Ensure the correct version is tagged in the `Cargo.toml` file of the program in use. For example: https://github.com/gear-foundation/dapps/blob/master/contracts/Cargo.toml +Install the latest version of Sails library: +```bash +cargo install sails-cli +``` +
[Gear Rust](/docs/build/gstd) libraries: `gstd`, `gtest`, `gclient`, `gear-wasm-builder`latest +The latest version is tagged in the `Cargo.toml` file autmatically when creating a new program (for example named 'vara-app'): +```bash +cargo sails new-program vara-app +```
Vara Network Testnet1.4.2Vara Network [Testnet](https://idea.gear-tech.io/programs?node=wss%3A%2F%2Ftestnet.vara.network)latest Ensure connection to the Vara Network Testnet. Switch networks by clicking on the network name in https://idea.gear-tech.io Gear JS API 0.38.1 Ensure this version is specified in the package.json file of the program repository
Sails JS0.1.8Ensure this version is specified in the package.json file of the program repository
Gear JS React Hooks0.10.70.13.0 Ensure this version is specified in the package.json file of the program repository
Gear JS UI Kit0.5.24Vara UI Kit0.0.11 Ensure this version is specified in the package.json file of the program repository
@@ -102,70 +124,54 @@ Windows users may encounter problems related to the installation of Rust compone It is highly recommended to use Linux or macOS for compiling Vara nodes and programs. ::: -
- Environment Versions History - -## Previous Environment Versions - -| Vara node version | Runtime version | Gear libraries version | Rust toolchain version | -| ----------------- | --------------- | ---------------------- | ---------------------- | -| v1.4.2 | 1420 | tag = "v1.4.2" | stable | -| v1.4.1 | 1410 | tag = "v1.4.1" | stable | -| v1.4.0 | 1400 | tag = "v1.4.0" | stable | -| v1.3.1 | 1310 | tag = "v1.3.1" | stable | -| v1.2.1 | 1210 | tag = "v1.2.1" | stable | -| v1.1.1 | 1110 | tag = "v1.1.1" | stable | -| v1.0.5 | 1050 | tag = "v1.0.5" | nightly-2023-09-18 | -| v1.0.2 | 1020 | tag = "v1.0.2" | nightly-2023-10-14 | -| v1.0.1 | 1010 | tag = "v1.0.1" | nightly-2023-10-14 | -| v1.0.0 | 1000 | tag = "v1.0.0" | nightly-2023-04-25 | -| v0.3.3 | 330 | tag = "v0.3.3" | nightly-2023-04-25 | -| v0.2.2 | 220 | rev = "946ac47" | nightly-2023-04-25 | -| v0.1.6 | 160 | rev = "78dfa07" | nightly-2023-04-25 | -| v0.1.4 | 140 | rev = "5c685d0" | nightly-2023-03-14 | - -
## First Steps -To create an app project, use the command **cargo**: +- Create a new project (named, for example - `vara-app`) by running: -```bash -cargo new gear-app --lib -``` + ```bash + cargo sails new-program vara-app + ``` -The project structure will be as follows: + Your `vara-app` directory tree should look like this -``` - └── gear-app // Program directory + ``` + vara-app │ - ├── src // Source files of the program - │ ├── maybe_some_file.rs // Additional module if needed - │ └── lib.rs // Main file of the program + ├── app + │ └── src + │ └── lib.rs │ - └── Cargo.toml // Manifest of the program -``` + ├── client + │ └── ... + │ + ├── src + │ └── lib.rs + │ + ├── tests + │ └── gtest.rs + │ + ├── build.rs + │ + ├── Cargo.toml + │ + └── README.md + ``` -Create a file `build.rs` with the following code: -```rust -fn main() { - gear_wasm_builder::build(); -} -``` + `Cargo.toml` file is a project manifest in Rust. The essential libraries required for compiling a project are automatically included there. -`Cargo.toml` is a project manifest in Rust, containing all metadata necessary for compiling the project. -Configure the `Cargo.toml` similarly to how it is configured in [dapp-template/Cargo.toml](https://github.com/gear-foundation/dapp-template/blob/master/Cargo.toml). Refer to [Getting Started](/docs/getting-started-in-5-minutes.md) for additional details. +- Write your program's code -## Building Rust Program +- Compile the Wasm program in the app folder: -Compile the program in the app folder: + ```bash + cargo build --release + ``` -```bash -cargo build --release -``` +Refer to [Getting Started](/docs/getting-started-in-5-minutes.md) for additional details. -The application should compile successfully, and the final file `target/wasm32-unknown-unknown/release/gear-app.wasm` should appear. + \ No newline at end of file diff --git a/docs/getting-started-in-5-minutes.md b/docs/getting-started-in-5-minutes.md index 9520a91..93ba794 100644 --- a/docs/getting-started-in-5-minutes.md +++ b/docs/getting-started-in-5-minutes.md @@ -82,7 +82,7 @@ Your `vara-app` directory tree should look like this: └── README.md ``` -In `Cargo.toml`, the essential libraries required for building your first project have been included: +In `Cargo.toml`, the essential libraries required for building your first project have been included, for example: ```rust title="vara-app/Cargo.toml" [workspace]