Skip to content

Commit

Permalink
docs: Format text
Browse files Browse the repository at this point in the history
  • Loading branch information
jawoznia committed Aug 4, 2023
1 parent a47e468 commit 39c935b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
15 changes: 8 additions & 7 deletions src/basics/create-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/) -
2 changes: 1 addition & 1 deletion src/basics/error_handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion src/basics/first-messages.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
16 changes: 9 additions & 7 deletions src/basics/multitest-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<ContractProxy, ..>`. 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<ContractProxy, ..>`. 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
Expand Down

0 comments on commit 39c935b

Please sign in to comment.