发现未知类型,没有 DepartmentDetails 的类型

Unknown types found, no types for DepartmentDetails

我正在尝试在 substrate 中使用 struct

#[derive(PartialEq, Eq, PartialOrd, Ord, Default, Clone, Encode, Decode, RuntimeDebug)]
pub struct DepartmentDetails {
    pub name: Vec<u8>,
    pub location: Vec<u8>,
    pub details: Vec<u8>,
    pub departmentid: u128,
}

在decl_stroage

Department get(fn department_name): map hasher(blake2_128_concat) u128 => DepartmentDetails;

虽然节点成功运行没有错误,但它给 polkadotjs 应用程序报错,说:
发现未知类型,DepartmentDetails

没有类型

https://substrate.dev/recipes/structs.html

Polkadot-js 只能构造和显示它理解的类型。 请参阅常见问题解答 here

对于开发,您可以在 Settings > Developer 选项卡中添加自定义类型描述。

对于生产,您可以通过 here.

中描述的扩展类型,将类型描述添加到基于 UI 的 polkadot-js