I have the following struct, where Characters is the newtype idiom around Vec<u8>
.
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)]
pub struct OperationData {
config: BTreeMap<Characters, Vec<Characters>>
}
Now, If I submit an extrinsic call to save such structure:
{
config: { hasher: [ 'Sha2_256', 'Blake3_256' ] },
}
The structure is stored correctly but upon reading (for instance in polkadot ui) I get:
{
config: {
0x686173686572: [
Sha2_256
Blake3_256
]
}
}
It appears that the call to Struct.toHuman()
does not attempt any conversion of the UTF-8 hex-encoded bytes of the key of the map entry:
h a s h e r
68 61 73 68 65 72
It does, however, decode the bytes inside the value of the map entry.
Is there a way to indicate the decoder to decode the map entry keys as well? Any good reason why Map keys are disregarded despite their type association?