---
# System prepended metadata

title: Issues with types

---

# Issues with types

Currently the types of the traceBlock rpc response are not easily digestable by polkadot-js.

### Example 1
```
"block_hash": "BlockId::Hash(0x01e0f6f63cddbfaaac47c34632ed72f5e76eeaab8eab96e1ce1bb1fe047ef8d5)"
```

would prefer to be
```
"blockHash": {
    "value": "0x01e0f6f63cddbfaaac47c34632ed72f5e76eeaab8eab96e1ce1bb1fe047ef8d5",
    "type": "BlockHash"
}
```

### Example 2

I have to do the following logic to decode `AccountInfo` storage item

```typescript
private systemAccountEvents(): EventWithAccountInfo[] {
    return this.eventsWithName()
        .filter((e) => e.keyName?.name == 'system::account')
        .map((e) => {
            // key = h(system) + h(account) + h(address) + address
            // Remove the storage key + account hash
            const addressRaw = e.values.string_values.key?.slice(96);

            const address = this.registry.createType(
                'Address',
                `0x${addressRaw}`
            );

            const { method } = e.values.string_values;
            const accountInfoEncoded =
                method === 'Get'
                    ? (e?.values?.string_values?.result as string)
                    : (e?.values?.string_values?.value as string);

            let accountInfo;

            if (accountInfoEncoded?.slice(0, 5) === 'Some(') {
                const len = accountInfoEncoded.length;
                const scale = accountInfoEncoded.slice(5, len - 1);
                accountInfo = this.registry.createType(
                    'AccountInfo',
                    `0x${scale}`
                );
            } else {
                throw 'Expect there to always be some account info';
            }

            return { ...e, accountInfo, address };
        });
}

```

Prefferable instead is if I could just dump in the `values?.string_values?.value` to polkadot-js with `createType('AccountInfo', values?.string_values?.value)`. 

In order for that to work I think the easiest thing would be if the value was entirely `scale` encoded.