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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! Fast forwards a sandboxed node by a specific height.
//!
//! Fas forwarding allows one to skip to some point in the future and observe actions.
//!
//! ## Example
//!
//! ```
//! use unc_jsonrpc_client::{methods, JsonRpcClient};
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = JsonRpcClient::connect("http://localhost:3030");
//!
//! let request = methods::sandbox_fast_forward::RpcSandboxFastForwardRequest {
//!     delta_height: 12,
//! };
//!
//! let response = client.call(request).await?;
//!
//! assert!(matches!(
//!     response,
//!     methods::sandbox_fast_forward::RpcSandboxFastForwardResponse { .. }
//! ));
//! # Ok(())
//! # }
//! ```
use super::*;

pub use unc_jsonrpc_primitives::types::sandbox::{
    RpcSandboxFastForwardError, RpcSandboxFastForwardRequest, RpcSandboxFastForwardResponse,
};

impl RpcHandlerResponse for RpcSandboxFastForwardResponse {}

impl RpcHandlerError for RpcSandboxFastForwardError {}

impl RpcMethod for RpcSandboxFastForwardRequest {
    type Response = RpcSandboxFastForwardResponse;
    type Error = RpcSandboxFastForwardError;

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

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

impl private::Sealed for RpcSandboxFastForwardRequest {}