scs / substrate-api-client

Library for connecting to substrate API over WebSockets
Apache License 2.0
259 stars 122 forks source link

Investigate if the config used by the API should take the substrate runtime changes #633

Open echevrier opened 1 year ago

echevrier commented 1 year ago

The runtime changed in substrate:

haerdib commented 1 year ago

Just noting previously stated observations regarding the Block type: We could remove Header and BlockNumber from our Config. Could look like:

type Block = Block<Header<u32, BlakeTwo256>, OpaqueExtrinsic>; 

(or define some types for better readability outside of Config struct)

Pro:

If one defines the config by self, then one could take the Block type directly from Runtime, and does not need to define Header and Blocknumber.

Config {
..... 

type Block = my_node_runtime::Runtime::Block;
...

}

Disadvantage:

The "inner" types can not be accessed anymore with simple Config::Header but a little more complex with somethign like Conifg::<Block as BlockTrait>::Header.