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

问题描述

我正在尝试在基板中使用结构

#[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;

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

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

解决方法

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

对于开发,您可以在 Settings > Developer 标签中添加自定义类型说明。

对于生产,您可以通过扩展 here 中描述的类型,向基于 polkadot-js 的 UI 添加类型描述。