Search code examples
substratepolkadot

Unknown types found, no types for DepartmentDetails


I am trying to use struct in substrate

#[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,
}

In decl_stroage

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

Though node runs successfully without error, it give error with polkadotjs app, saying:
Unknown types found, no types for DepartmentDetails

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


Solution

  • Polkadot-js can only construct and display types that it understands. See the FAQ here.

    For development you can add custom type descriptions in the Settings > Developer tab.

    For production you can add type descriptions to your polkadot-js based UI via extending the types as described here.