Import a Pallet
Last updated
Last updated
This guide demonstrates how to quickly integrate both local and external pallets in a runtime. For more detailed step-by-step instructions, see .
This guide illustrates:
How to include a custom local pallet that implements an event and a call for the runtime.
How to include an external pallet from Crates.io
in the runtime.
Create a local pallet called pallet_something
.
Import this pallet by adding the following to /runtime/src/lib.rs
:
Configure your pallet's runtime implementation. Assume the local pallet only has the Event
and Call
types exposed to the runtime. Add the following to /runtime/src/lib.rs
:
Declare your pallet for the :
Update /runtime/Cargo.toml
In /runtime/Cargo.toml
, include your pallet as a local dependency in std
and add runtime-benchmarks
. For example:
To add an external pallet, you use a similar method to the one you used with the local pallet, but you must include all of the types your pallet exposes. You must also include the relevant parameter types and constants. For examples of how to declare parameters and constants, see .
The following is an example of how you would add an external pallet to the /runtime/Cargo.toml
dependencies if the pallet is hosted on :