diff --git a/src/basics/create-project.md b/src/basics/create-project.md index 1581ae0..bda583b 100644 --- a/src/basics/create-project.md +++ b/src/basics/create-project.md @@ -32,19 +32,20 @@ required to create a proper web assembly binary. The downside of this is that su be used as a dependency for other Rust crates - for now, it is not needed, but later we will show how to approach reusing contracts as dependencies. -Additionally, we added some core dependencies for smart contracts: the -[`cosmwasm-std`](https://docs.rs/cosmwasm-std/1.3.1/cosmwasm_std/). This crate is a +Additionally, we added some core dependencies for smart contracts: +- [`cosmwasm-std`](https://docs.rs/cosmwasm-std/1.3.1/cosmwasm_std/). This crate is a standard library for smart contracts. It provides essential utilities for communication with the outside world, helper functions, and types. Every smart contract we will build will use this dependency. -[`sylvia`](https://docs.rs/sylvia/0.7.0/sylvia/) - the crate we will learn in this +- [`sylvia`](https://docs.rs/sylvia/0.7.0/sylvia/) - the crate we will learn in this book. It provides us with three procedural macros: `entry_points`, `contract` and `interface`. I -will expand on them later in the book. [`schemars`](https://docs.rs/schemars/0.8.12/schemars/index.html) -- crate used to create JSON schema documents for our contracts. It is automatically derived on types +will expand on them later in the book. +- [`schemars`](https://docs.rs/schemars/0.8.12/schemars/index.html) - crate used to create JSON +schema documents for our contracts. It is automatically derived on types generated by `sylvia` and will be later used to provide nice API blockchain users who might not be rust devs. -[`cosmwasm-schema`](https://docs.rs/cosmwasm-schema/1.3.1/cosmwasm_schema/) - similiar +- [`cosmwasm-schema`](https://docs.rs/cosmwasm-schema/1.3.1/cosmwasm_schema/) - similiar to schemars. This crate expands on `schemars` and provides us with trait [`QueryResponses`](https://docs.rs/cosmwasm-schema/1.3.1/cosmwasm_schema/trait.QueryResponses.html) which ties query variants to their responses. I will expand on that later in the book. -[`serde`](https://docs.rs/serde/1.0.180/serde/) - +- [`serde`](https://docs.rs/serde/1.0.180/serde/) - diff --git a/src/basics/error_handling.md b/src/basics/error_handling.md index 63c4612..7a7f616 100644 --- a/src/basics/error_handling.md +++ b/src/basics/error_handling.md @@ -3,7 +3,7 @@ `StdError` provides useful variants related to the `CosmWasm` smart contract development. What if you would like to emit errors related to your business logic? -## Custom error +## Define custom error We start by adding a new dependency [`thiserror`](https://docs.rs/thiserror/1.0.44/thiserror/) to our `Cargo.toml`. diff --git a/src/basics/first-messages.md b/src/basics/first-messages.md index 476d9f8..a08f154 100644 --- a/src/basics/first-messages.md +++ b/src/basics/first-messages.md @@ -1,6 +1,6 @@ # Generating first messages -We have setup our dependencies. Now let's use them to create simple messages. +We have set up our dependencies. Now let's use them to create simple messages. ## Creating an instantiation message diff --git a/src/basics/multitest-intro.md b/src/basics/multitest-intro.md index 43fbada..c54c50e 100644 --- a/src/basics/multitest-intro.md +++ b/src/basics/multitest-intro.md @@ -71,13 +71,15 @@ fn instantiate() { `Sylvia` generates a lot of helpers for us to make testing as easy as possible. To simulate blockchain, we create `sylvia::multitest::App`. Then we will use it to store the code id -of our contract on the blockchain using `sylvia` generated `CodeId`. Code id identifies our contract on -the blockchain and allows us to instantiate the contract on it. We do that using `CodeId::instantiate` -method. It returns the `InstantiateProxy` type, allowing us to set some contract parameters on -a blockchain. You can inspect methods like `with_label(..)`, `with_funds(..)` or `with_admins(..)`. -Once all parameters are set you use `call` passing caller to it as an only argument. This will return -`Result`. Let's `unwrap` it as it is a testing environment and we expect it to -work correctly. +of our contract on the blockchain using `sylvia` generated `CodeId`. + +Code id identifies our contract on the blockchain and allows us to instantiate the contract on it. +We do that using `CodeId::instantiate` method. It returns the `InstantiateProxy` type, allowing us +to set some contract parameters on a blockchain. You can inspect methods like `with_label(..)`, +`with_funds(..)` or `with_admins(..)`. Once all parameters are set you use `call` passing caller to +it as an only argument. This will return `Result`. Let's `unwrap` it as it is a +testing environment and we expect it to work correctly. + Now that we have the proxy type we can call our `count` method on it. It will generate appropriate `QueryMsg` variant underneath and send to blockchain so that we don't have to do it ourselves and have business logic transparently shown in the test. We `unwrap` and extract the only field out of