1、在runtime/Cargo.toml中添加依赖
pallet-nicks = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
2、在runtime/Cargo.toml配置std
"pallet-nicks/std",
3、在runtime/src/lib.rs中添加Nicks相关信息
impl pallet_nicks::Config for Runtime {
// The Balances pallet implements the ReservableCurrency trait.
// `Balances` is defined in `construct_runtime!` macro.
type Currency = Balances;
// Set ReservationFee to a value.
type ReservationFee = ConstU128<100>;
// No action is taken when deposits are forfeited.
type Slashed = ();
// Configure the FRAME System Root origin as the Nick pallet admin.
// https://paritytech.github.io/substrate/master/frame_system/enum.RawOrigin.html#variant.Root
type ForceOrigin = frame_system::EnsureRoot<AccountId>;
// Set MinLength of nick name to a desired value.
type MinLength = ConstU32<8>;
// Set MaxLength of nick name to a desired value.
type MaxLength = ConstU32<32>;
// The ubiquitous event type.
type RuntimeEvent = RuntimeEvent;
}
4、启动前端并作相关操作,参照英文文档