A fundamental pattern that all runtime engineers should internalize over time.
Learn the steps for integrating a pallet to your runtime.
- Including a custom pallet that implements an event and a call for runtime.
- Including a pallet from Crates.io to a runtime.
This guide is an extension to the "Add a Pallet to Your Runtime" tutorial, intended as a resource for developers new to Substrate looking to quickly integrate a pallet to their runtime. It covers adding both local and external pallets to a runtime.
Assuming a pallet called
pallet_something is created, the first step is to import it in
2. Include it in
Configure your pallet's runtime implementation. Assuming the local pallet only has
Call types exposed to the runtime:
Then, declare your pallet and the items it exposes in
construct_runtime!, including the additional
types for the runtime macro:
The same pattern applies as for declaring a local pallet, except you must ensure you include all the types your pallet exposes.
In addition, don't forget to include relevant parameter types and constants if relevant. See this examples on how
/runtime/Cargo.toml, include your pallet as a local dependency, include it in
std and add
Assuming the pallet is hosted in parity.crates.io, adding it to the runtime would look like this: