0

In my pallet have created a custom new-type, in the same fashion as AccountId32:

#[derive(Encode, Decode, Clone, PartialEq, Eq, Ord, PartialOrd, Debug, MaxEncodedLen, TypeInfo)]
pub struct GenericId(BoundedVec<u8, MaxGenericIdLenGet>);

The type can be converted From<GenericId> for BoundedVec<u8, MaxGenericIdLenGet> and From<BoundedVec<u8, MaxGenericIdLenGet>> for GenericId. I would expect it to show up in the polkadot-js explorer as GenericId (AccountId32 indeed shows up), but it shows as Bytes instead.

How do I make GenericId show up not as Bytes?

1 Answer 1

1

I am afraid you can't do this.

The TypeInfo will explain this type as BoundedVec<u8, MaxGenericIdLenGet>.

So, it shows bytes in the PolkadotApps.


Why H256 work?

In fact, H256 is [u8; 32].

But PolkadotApps makes some wrap for it.

Then it could be displayed as 0x00... instead of [0,...].


If you want to do this.

IIUC, you've to tweak the PolkadotJS about how it deals with GenericId.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.