微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决发现未知类型,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 添加类型描述。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。