1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use super::*;

pub use near_jsonrpc_primitives::types::gas_price::{RpcGasPriceError, RpcGasPriceRequest};

pub type RpcGasPriceResponse = near_primitives::views::GasPriceView;

impl RpcHandlerResponse for RpcGasPriceResponse {}

impl RpcHandlerError for RpcGasPriceError {
    fn parse(value: serde_json::Value) -> Result<Self, serde_json::Error> {
        common::parse_unknown_block!(value => Self)
    }
}

impl RpcMethod for RpcGasPriceRequest {
    type Response = RpcGasPriceResponse;
    type Error = RpcGasPriceError;

    fn method_name(&self) -> &str {
        "gas_price"
    }

    fn params(&self) -> Result<serde_json::Value, io::Error> {
        Ok(json!([self.block_id]))
    }
}

impl private::Sealed for RpcGasPriceRequest {}