cfx_rpc/
parity.rs

1use crate::EthApi;
2use async_trait::async_trait;
3use cfx_rpc_eth_api::ParityApiServer;
4use cfx_rpc_eth_types::{BlockId, Receipt};
5use jsonrpsee::core::RpcResult;
6
7pub struct ParityApi {
8    inner: EthApi,
9}
10
11impl ParityApi {
12    pub fn new(inner: EthApi) -> Self { Self { inner } }
13}
14
15#[async_trait]
16impl ParityApiServer for ParityApi {
17    async fn block_receipts(
18        &self, block_id: BlockId,
19    ) -> RpcResult<Option<Vec<Receipt>>> {
20        self.inner
21            .get_block_receipts(block_id)
22            .map(|val| Some(val))
23            .map_err(|e| e.into())
24    }
25}