near_jsonrpc_client/methods/sandbox/fast_forward.rs
1//! Fast forwards a sandboxed node by a specific height.
2//!
3//! Fas forwarding allows one to skip to some point in the future and observe actions.
4//!
5//! ## Example
6//!
7//! ```
8//! use near_jsonrpc_client::{methods, JsonRpcClient};
9//!
10//! # #[tokio::main]
11//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
12//! let client = JsonRpcClient::connect("http://localhost:3030");
13//!
14//! let request = methods::sandbox_fast_forward::RpcSandboxFastForwardRequest {
15//! delta_height: 12,
16//! };
17//!
18//! let response = client.call(request).await?;
19//!
20//! assert!(matches!(
21//! response,
22//! methods::sandbox_fast_forward::RpcSandboxFastForwardResponse { .. }
23//! ));
24//! # Ok(())
25//! # }
26//! ```
27use super::*;
28
29pub use near_jsonrpc_primitives::types::sandbox::{
30 RpcSandboxFastForwardError, RpcSandboxFastForwardRequest, RpcSandboxFastForwardResponse,
31};
32
33impl RpcHandlerResponse for RpcSandboxFastForwardResponse {}
34
35impl RpcHandlerError for RpcSandboxFastForwardError {}
36
37impl RpcMethod for RpcSandboxFastForwardRequest {
38 type Response = RpcSandboxFastForwardResponse;
39 type Error = RpcSandboxFastForwardError;
40
41 fn method_name(&self) -> &str {
42 "sandbox_fast_forward"
43 }
44
45 fn params(&self) -> Result<serde_json::Value, io::Error> {
46 Ok(json!(self))
47 }
48}
49
50impl private::Sealed for RpcSandboxFastForwardRequest {}