Introduction to Sylvia
Sylvia
(opens in a new tab) is a framework for building CosmWasm smart contracts
with a high level of abstraction.
It's built on top of crates such as cosmwasm-std
(opens in a new tab) and
cw-multi-test
(opens in a new tab).
It allows the users to focus purely on business logic by generating message structures, specifying how their API is (de)serialized, or how to handle message dispatching. Instead, the API of your contract is a set of traits you implement on your contract type.
The framework generates things like entry point structures, functions dispatching the messages, or
even helpers for MultiTest
. It allows for better control of interfaces,
including validating their completeness in compile time.
Sylvia consists of two crates:
sylvia
(opens in a new tab) - Crate the users should use. Exposes all of the macros from thesylvia-derive
and provides some additional utilities.sylvia-derive
(opens in a new tab) - Contains all of the Sylvia macros. Do not add this as a dependency on your contract.
While using Sylvia consider using reexported crates like cosmwasm-std
and cw-multi-test
instead
of adding those dependencies yourself as this would lead you to smaller dependencies to maintain.
You can visit docs.rs
(opens in a new tab) to learn about the types exposed in
the Sylvia.