# Brainstorm... ## 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 }; }); } ``` ## Planned balance transfer extrinsics with operations [Inspiration schema for the `Operation` type](https://github.com/coinbase/rosetta-specifications/blob/master/models/Operation.yaml) ```javascript { method: { module: "balances", method: "transfer" }, siganture: { .. } nonce: 0, args: { dest: "Bob checksum address" }, tip: 0 hash: "block hash", info: { paysFee: "12345" } events: [...], operations: [ { operation_id: { blockHash: “block hash” phase: { extrinsicIndex: 0 }, operartionIndex: 0 }, storage: { pallet: "system", item: "AccountData", field: "free" // Omit for now } status: “Succesus” address: “Alice checksum address” amount: { value: “-1000”, currency: { symbol: “DOT” } } }, { operation_id: { block_hash: “block hash” phase: { extrinsic_index: 0 }, operartion_index: 1 }, storage: { pallet: "system", item: "AccountData", field: "free" } status: “Succesus” address: “Bob checksum address” amount: { value: “1000”, currency: { symbol: “DOT” } } }, ... something for fee to block author ] } ```