Skip to content

Commit

Permalink
chore(docs): document the sandbox_patch_state RPC method (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
iTranscend authored Dec 22, 2023
1 parent ff0af66 commit f5c5c3f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/methods/sandbox/patch_state.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
//! Patch account, access keys, contract code, or contract state.
//!
//! Only additions and mutations are supported. No deletions.
//!
//! Account, access keys, contract code, and contract states have different formats. See the example and docs for details about their format.
//!
//! ## Examples
//!
//! ```
//! use near_jsonrpc_client::{methods, JsonRpcClient};
//! use near_primitives::{state_record::StateRecord, account, types::AccountId, hash::CryptoHash};
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = JsonRpcClient::connect("http://localhost:3030");
//!
//! let request = methods::sandbox_patch_state::RpcSandboxPatchStateRequest {
//! records: vec![
//! StateRecord::Account {
//! account_id: "fido.testnet".parse::<AccountId>()?,
//! account: account::Account::new(179, 0, CryptoHash::default(), 264)
//! }
//! ],
//! };
//!
//! let response = client.call(request).await?;
//!
//! assert!(matches!(
//! response,
//! methods::sandbox_patch_state::RpcSandboxPatchStateResponse { .. }
//! ));
//! # Ok(())
//! # }
//! ```
use super::*;

pub use near_jsonrpc_primitives::types::sandbox::{
Expand Down

0 comments on commit f5c5c3f

Please sign in to comment.