reth
reth copied to clipboard
chore(sdk): add helper trait to node API to simplify type definition
Ref https://github.com/paradigmxyz/reth/issues/9555
Building unit tests for any type that inherits from FullNodeComponents
is too costly. Replacing the trait bound N: FullNodeComponents
with N: NodeCore
in type definitions, enables testing without importing a massive framework of unused mock node components. This, without scarfing the aggregate generic N
for a long list of generics and with it DevX.
- Adds helper traits
reth_node_api::NodeCore
andreth_node_api::NodeTy
, with blanket implementation for all types that implreth_node_api::FullNodeComponents
andreth_node_api::NodeTypes
respectively. - Replaces
reth_optimism_rpc::OpEthApi<N: FullNodeComponents>
withOpEthApi<N: NodeCore>