Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fixed doc tests after the recent crate updates #135

Merged
merged 2 commits into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/methods/broadcast_tx_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//!
//! A full example on how to use `broadcast_tx_async` method can be found at [`contract_change_method`](https://github.com/near/near-jsonrpc-client-rs/blob/master/examples/contract_change_method.rs).
//!
//! ```
//! ```no_run
//! use near_jsonrpc_client::{methods, JsonRpcClient};
//! use near_primitives::types::{AccountId};
//! use near_primitives::transaction::{Action, FunctionCallAction, Transaction};
Expand All @@ -17,7 +17,7 @@
//! use serde_json::json;
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.testnet.near.org");
//!
//! let signer_account_id = "fido.testnet".parse::<AccountId>()?;
Expand All @@ -34,7 +34,7 @@
//! nonce: 10223934 + 1,
//! receiver_id: "nosedive.testnet".parse::<AccountId>()?,
//! block_hash: "AUDcb2iNUbsmCsmYGfGuKzyXKimiNcCZjBKTVsbZGnoH".parse()?,
//! actions: vec![Action::FunctionCall(FunctionCallAction {
//! actions: vec![Action::FunctionCall(Box::new(FunctionCallAction {
//! method_name: "rate".to_string(),
//! args: json!({
//! "account_id": other_account,
Expand All @@ -44,7 +44,7 @@
//! .into_bytes(),
//! gas: 100_000_000_000_000, // 100 TeraGas
//! deposit: 0,
//! })],
//! }))],
//! };
//!
//! let request = methods::broadcast_tx_async::RpcBroadcastTxAsyncRequest {
Expand Down
14 changes: 7 additions & 7 deletions src/methods/broadcast_tx_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,32 @@
//!
//! ## Example
//!
//! ```
//! ```no_run
//! use near_jsonrpc_client::{methods, JsonRpcClient};
//! use near_jsonrpc_primitives::types::{query::QueryResponseKind, transactions::TransactionInfo};
//! use near_primitives::types::{AccountId, BlockReference};
//! use near_primitives::transaction::{Action, FunctionCallAction, Transaction};
//! use serde_json::json;
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.testnet.near.org");
//!
//! let signer_account_id = "fido.testnet".parse::<AccountId>()?;
//! let signer_secret_key = "ed25519:12dhevYshfiRqFSu8DSfxA27pTkmGRv6C5qQWTJYTcBEoB7MSTyidghi5NWXzWqrxCKgxVx97bpXPYQxYN5dieU".parse()?;
//!
//! let signer = near_crypto::InMemorySigner::from_secret_key(signer_account_id, signer_secret_key);
//!
//!
//! let other_account = "rpc_docs.testnet".parse::<AccountId>()?;
//! let rating = "4.5".parse::<f32>()?;
//!
//!
//! let transaction = Transaction {
//! signer_id: signer.account_id.clone(),
//! public_key: signer.public_key.clone(),
//! nonce: 904565 + 1,
//! receiver_id: "nosedive.testnet".parse::<AccountId>()?,
//! block_hash: "AUDcb2iNUbsmCsmYGfGuKzyXKimiNcCZjBKTVsbZGnoH".parse()?,
//! actions: vec![Action::FunctionCall(FunctionCallAction {
//! actions: vec![Action::FunctionCall(Box::new(FunctionCallAction {
//! method_name: "rate".to_string(),
//! args: json!({
//! "account_id": other_account,
Expand All @@ -45,8 +45,8 @@
//! .into_bytes(),
//! gas: 100_000_000_000_000, // 100 TeraGas
//! deposit: 0,
//! })],
//! };
//! }))],
//! };
//!
//! let request = methods::broadcast_tx_commit::RpcBroadcastTxCommitRequest {
//! signed_transaction: transaction.sign(&signer)
Expand Down
14 changes: 7 additions & 7 deletions src/methods/experimental/changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//! use near_primitives::{views::StateChangesRequestView, types::{BlockReference, BlockId}};
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.testnet.near.org");
//!
//! let request = methods::EXPERIMENTAL_changes::RpcStateChangesInBlockByTypeRequest {
Expand All @@ -40,7 +40,7 @@
//! use near_primitives::{views::StateChangesRequestView, types::{BlockReference, BlockId, AccountWithPublicKey}};
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.testnet.near.org");
//!
//! let request = methods::EXPERIMENTAL_changes::RpcStateChangesInBlockByTypeRequest {
Expand All @@ -55,8 +55,8 @@
//! account_id: "rpc_docs.testnet".parse()?,
//! public_key: "ed25519:FxGiXr6Dgn92kqBqbQzuoYdKngiizCnywpaN7ALar3Vv".parse()?,
//! }
//!
//! ],
//!
//! ],
//! }
//! };
//!
Expand All @@ -77,7 +77,7 @@
//! use near_primitives::{views::StateChangesRequestView, types::{BlockReference, BlockId}};
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.testnet.near.org");
//!
//! let request = methods::EXPERIMENTAL_changes::RpcStateChangesInBlockByTypeRequest {
Expand All @@ -104,7 +104,7 @@
//! use near_primitives::{views::StateChangesRequestView, types::{BlockReference, BlockId}};
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.testnet.near.org");
//!
//! let request = methods::EXPERIMENTAL_changes::RpcStateChangesInBlockByTypeRequest {
Expand All @@ -131,7 +131,7 @@
//! use near_primitives::{views::StateChangesRequestView, types::{BlockReference, BlockId, StoreKey}, hash::CryptoHash};
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.testnet.near.org");
//!
//! let request = methods::EXPERIMENTAL_changes::RpcStateChangesInBlockByTypeRequest {
Expand Down
8 changes: 4 additions & 4 deletions src/methods/experimental/check_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//!
//! ## Example
//!
//! ```
//! ```no_run
//! use near_jsonrpc_client::{methods, JsonRpcClient};
//! use near_jsonrpc_primitives::types::{query::QueryResponseKind, transactions};
//! use near_primitives::types::{AccountId, BlockReference};
Expand All @@ -16,7 +16,7 @@
//! use serde_json::json;
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.testnet.near.org");
//!
//! let signer_account_id = "fido.testnet".parse::<AccountId>()?;
Expand All @@ -33,7 +33,7 @@
//! nonce: 904565 + 1,
//! receiver_id: "nosedive.testnet".parse::<AccountId>()?,
//! block_hash: "AUDcb2iNUbsmCsmYGfGuKzyXKimiNcCZjBKTVsbZGnoH".parse()?,
//! actions: vec![Action::FunctionCall(FunctionCallAction {
//! actions: vec![Action::FunctionCall(Box::new(FunctionCallAction {
//! method_name: "rate".to_string(),
//! args: json!({
//! "account_id": other_account,
Expand All @@ -43,7 +43,7 @@
//! .into_bytes(),
//! gas: 100_000_000_000_000, // 100 TeraGas
//! deposit: 0,
//! })],
//! }))],
//! };
//!
//! let request = methods::EXPERIMENTAL_check_tx::RpcCheckTxRequest {
Expand Down
4 changes: 2 additions & 2 deletions src/methods/experimental/protocol_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//!
//! Returns the protocol config of the blockchain at a given block.
//!
//! ```
//! ```no_run
//! use near_jsonrpc_client::{methods, JsonRpcClient};
//! use near_primitives::types::{BlockReference, BlockId};
//!
Expand All @@ -15,7 +15,7 @@
//! let client = JsonRpcClient::connect("https://archival-rpc.mainnet.near.org");
//!
//! let request = methods::EXPERIMENTAL_protocol_config::RpcProtocolConfigRequest {
//! block_reference: BlockReference::BlockId(BlockId::Height(47988413))
//! block_reference: BlockReference::BlockId(BlockId::Height(100_000_000))
//! };
//!
//! let response = client.call(request).await?;
Expand Down
2 changes: 1 addition & 1 deletion src/methods/experimental/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! use near_jsonrpc_primitives::types::receipts::ReceiptReference;
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.mainnet.near.org");
//!
//! let request = methods::EXPERIMENTAL_receipt::RpcReceiptRequest {
Expand Down
6 changes: 3 additions & 3 deletions src/methods/experimental/tx_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
//! use near_primitives::views;
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.mainnet.near.org");
//! let tx_hash = "B9aypWiMuiWR5kqzewL9eC96uZWA3qCMhLe67eBMWacq".parse()?;
//!
//! let request = methods::EXPERIMENTAL_tx_status::RpcTransactionStatusRequest {
//! transaction_info: methods::EXPERIMENTAL_tx_status::TransactionInfo::TransactionId {
//! hash: tx_hash,
//! account_id: "itranscend.near".parse()?,
//! tx_hash,
//! sender_account_id: "itranscend.near".parse()?,
//! }
//! };
//!
Expand Down
2 changes: 1 addition & 1 deletion src/methods/experimental/validators_ordered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! use near_primitives::types::BlockId;
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.mainnet.near.org");
//!
//! let request = methods::EXPERIMENTAL_validators_ordered::RpcValidatorsOrderedRequest {
Expand Down
2 changes: 1 addition & 1 deletion src/methods/gas_price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
//! use near_primitives::types::BlockId;
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.mainnet.near.org");
//!
//! let request = methods::gas_price::RpcGasPriceRequest {
Expand Down
2 changes: 1 addition & 1 deletion src/methods/next_light_client_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! use near_jsonrpc_client::{methods, JsonRpcClient};
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.mainnet.near.org");
//!
//! let request = methods::next_light_client_block::RpcLightClientNextBlockRequest {
Expand Down
9 changes: 5 additions & 4 deletions src/methods/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//! use near_primitives::{types::{BlockReference, BlockId}, views::QueryRequest};
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.mainnet.near.org");
//!
//! let request = methods::query::RpcQueryRequest {
Expand All @@ -48,7 +48,7 @@
//! use near_primitives::{types::{BlockReference, BlockId}, views::QueryRequest};
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.testnet.near.org");
//!
//! let request = methods::query::RpcQueryRequest {
Expand Down Expand Up @@ -83,7 +83,8 @@
//! block_reference: BlockReference::latest(),
//! request: QueryRequest::ViewState {
//! account_id: "nosedive.testnet".parse()?,
//! prefix: StoreKey::from(vec![])
//! prefix: StoreKey::from(vec![]),
//! include_proof: false,
//! }
//! };
//!
Expand Down Expand Up @@ -133,7 +134,7 @@
//! use near_primitives::{types::{BlockReference, BlockId}, views::QueryRequest};
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.testnet.near.org");
//!
//! let request = methods::query::RpcQueryRequest {
Expand Down
8 changes: 4 additions & 4 deletions src/methods/validators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
//! use near_primitives::types::{EpochReference, EpochId, BlockReference, Finality};
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let client = JsonRpcClient::connect("https://archival-rpc.mainnet.near.org");
//!
//! let request = methods::validators::RpcValidatorRequest {
//! epoch_reference: EpochReference::EpochId(EpochId {
//! 0: "9xrjdZmgjoVkjVE3ui7tY37x9Mkw5wH385qNXE6cho7T".parse()?,
//! })
//! epoch_reference: EpochReference::EpochId(
//! "9xrjdZmgjoVkjVE3ui7tY37x9Mkw5wH385qNXE6cho7T".parse()?,
//! )
//! };
//!
//! let response = client.call(request).await?;
Expand Down
Loading