From cd12ae30efff9070bd3b3ebdba2cca6b44ca4920 Mon Sep 17 00:00:00 2001
From: akorchyn <artur.yurii.korchynskyi@gmail.com>
Date: Thu, 8 Aug 2024 14:03:44 +0300
Subject: [PATCH 1/4] chore: updated near-* to 0.24.0

---
 Cargo.toml                                | 10 ++---
 examples/contract_change_method.rs        |  7 ++--
 examples/contract_change_method_commit.rs |  7 ++--
 examples/create_account.rs                | 14 ++++---
 examples/query_tx.rs                      | 51 ++++++++++-------------
 examples/send_tx.rs                       |  8 ++--
 examples/view_account.rs                  |  8 ++++
 rust-toolchain.toml                       |  6 +++
 8 files changed, 61 insertions(+), 50 deletions(-)
 create mode 100644 rust-toolchain.toml

diff --git a/Cargo.toml b/Cargo.toml
index 00d4fef..701f7a8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "near-jsonrpc-client"
-version = "0.10.1"
+version = "0.10.2"
 authors = ["Near Inc <hello@nearprotocol.com>"]
 edition = "2021"
 license = "MIT OR Apache-2.0"
@@ -19,10 +19,10 @@ thiserror = "1.0.37"
 serde_json = "1.0.85"
 lazy_static = "1.4.0"
 
-near-crypto = ">0.22,<0.24"
-near-primitives = ">0.22,<0.24"
-near-chain-configs = ">0.22,<0.24"
-near-jsonrpc-primitives = ">0.22,<0.24"
+near-crypto = ">0.22,<0.25"
+near-primitives = ">0.22,<0.25"
+near-chain-configs = ">0.22,<0.25"
+near-jsonrpc-primitives = ">0.22,<0.25"
 
 [dev-dependencies]
 tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
diff --git a/examples/contract_change_method.rs b/examples/contract_change_method.rs
index a77e308..8823cd4 100644
--- a/examples/contract_change_method.rs
+++ b/examples/contract_change_method.rs
@@ -1,7 +1,8 @@
+use near_crypto::Signer;
 use near_jsonrpc_client::{methods, JsonRpcClient};
 use near_jsonrpc_primitives::types::query::QueryResponseKind;
 use near_jsonrpc_primitives::types::transactions::{RpcTransactionError, TransactionInfo};
-use near_primitives::transaction::{Action, FunctionCallAction, Transaction};
+use near_primitives::transaction::{Action, FunctionCallAction, Transaction, TransactionV0};
 use near_primitives::types::BlockReference;
 use near_primitives::views::TxExecutionStatus;
 
@@ -39,7 +40,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     let other_account = utils::input("Enter the account to be rated: ")?;
     let rating = utils::input("Enter a rating: ")?.parse::<f32>()?;
 
-    let transaction = Transaction {
+    let transaction = TransactionV0 {
         signer_id: signer.account_id.clone(),
         public_key: signer.public_key.clone(),
         nonce: current_nonce + 1,
@@ -59,7 +60,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     };
 
     let request = methods::broadcast_tx_async::RpcBroadcastTxAsyncRequest {
-        signed_transaction: transaction.sign(&signer),
+        signed_transaction: Transaction::V0(transaction).sign(&Signer::InMemory(signer.clone())),
     };
 
     let sent_at = time::Instant::now();
diff --git a/examples/contract_change_method_commit.rs b/examples/contract_change_method_commit.rs
index db074eb..78e0b56 100644
--- a/examples/contract_change_method_commit.rs
+++ b/examples/contract_change_method_commit.rs
@@ -1,6 +1,7 @@
+use near_crypto::Signer;
 use near_jsonrpc_client::{methods, JsonRpcClient};
 use near_jsonrpc_primitives::types::query::QueryResponseKind;
-use near_primitives::transaction::{Action, FunctionCallAction, Transaction};
+use near_primitives::transaction::{Action, FunctionCallAction, Transaction, TransactionV0};
 use near_primitives::types::BlockReference;
 
 use serde_json::json;
@@ -36,7 +37,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     let other_account = utils::input("Enter the account to be rated: ")?;
     let rating = utils::input("Enter a rating: ")?.parse::<f32>()?;
 
-    let transaction = Transaction {
+    let transaction = TransactionV0 {
         signer_id: signer.account_id.clone(),
         public_key: signer.public_key.clone(),
         nonce: current_nonce + 1,
@@ -56,7 +57,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     };
 
     let request = methods::broadcast_tx_commit::RpcBroadcastTxCommitRequest {
-        signed_transaction: transaction.sign(&signer),
+        signed_transaction: Transaction::V0(transaction).sign(&Signer::InMemory(signer)),
     };
 
     let response = client.call(request).await?;
diff --git a/examples/create_account.rs b/examples/create_account.rs
index dce9ae0..0f01287 100644
--- a/examples/create_account.rs
+++ b/examples/create_account.rs
@@ -9,13 +9,15 @@
 //!
 //! This script is interactive.
 
+use near_crypto::Signer;
 use near_jsonrpc_client::methods::broadcast_tx_commit::RpcTransactionError;
 use near_jsonrpc_client::{methods, JsonRpcClient};
 use near_jsonrpc_primitives::types::query::QueryResponseKind;
 use near_jsonrpc_primitives::types::transactions::TransactionInfo;
 use near_primitives::hash::CryptoHash;
 use near_primitives::transaction::{
-    Action, AddKeyAction, CreateAccountAction, FunctionCallAction, Transaction, TransferAction,
+    Action, AddKeyAction, CreateAccountAction, FunctionCallAction, Transaction, TransactionV0,
+    TransferAction,
 };
 use near_primitives::types::{AccountId, BlockReference};
 use near_primitives::views::{FinalExecutionStatus, TxExecutionStatus};
@@ -124,7 +126,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
             utils::input("How much do you want to fund this account with (in Ⓝ units)? ")?
                 .parse()?;
         if deposit >= 0.0 {
-            break ((deposit * 1_000_000.0) as u128) * 1_000_000_000_000_000_000 as u128;
+            break ((deposit * 1_000_000.0) as u128) * 1_000_000_000_000_000_000_u128;
         }
         println!("(i) Enter a non-zero deposit value!");
     };
@@ -133,7 +135,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     let new_key_pair = near_crypto::SecretKey::from_random(near_crypto::KeyType::ED25519);
 
     let transaction = if is_sub_account {
-        Transaction {
+        TransactionV0 {
             signer_id: signer.account_id.clone(),
             public_key: signer.public_key.clone(),
             nonce: current_nonce + 1,
@@ -161,7 +163,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
         } else {
             Err("can only create non-sub accounts for mainnet / testnet\nconsider creating a sub-account instead")?
         };
-        Transaction {
+        TransactionV0 {
             signer_id: signer.account_id.clone(),
             public_key: signer.public_key.clone(),
             nonce: current_nonce + 1,
@@ -189,7 +191,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     println!("-------------------------------------------------------------");
 
     let request = methods::broadcast_tx_async::RpcBroadcastTxAsyncRequest {
-        signed_transaction: transaction.sign(&signer),
+        signed_transaction: Transaction::V0(transaction).sign(&Signer::InMemory(signer.clone())),
     };
 
     let sent_at = time::Instant::now();
@@ -228,7 +230,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
                     }
                     FinalExecutionStatus::SuccessValue(ref s) => {
                         // outcome.status != SuccessValue(`false`)
-                        if s == b"false" {
+                        if s.is_empty() {
                             println!("(i) Account successfully created after {}s", delta);
                         } else {
                             println!("{:#?}", outcome);
diff --git a/examples/query_tx.rs b/examples/query_tx.rs
index 28169a8..b97a27a 100644
--- a/examples/query_tx.rs
+++ b/examples/query_tx.rs
@@ -1,4 +1,7 @@
+use std::str::FromStr;
+
 use near_jsonrpc_client::methods;
+use near_primitives::{hash::CryptoHash, types::AccountId};
 
 mod utils;
 
@@ -57,6 +60,22 @@ pub fn specify_block_reference() -> std::io::Result<near_primitives::types::Bloc
     Ok(block_reference)
 }
 
+fn get_valid_input<T: FromStr>(
+    prompt: &str,
+    max_retries: usize,
+) -> Result<T, Box<dyn std::error::Error>> {
+    for _ in 0..max_retries {
+        let input = utils::input(prompt)?;
+        if let Ok(value) = input.parse() {
+            return Ok(value);
+        } else {
+            println!("(i) Invalid input!");
+        }
+    }
+
+    Err(format!("(i) Maximum number of retries ({}) reached", max_retries).into())
+}
+
 #[tokio::main]
 async fn main() -> Result<(), Box<dyn std::error::Error>> {
     env_logger::init();
@@ -64,35 +83,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     let client = utils::select_network()?;
 
     // tolerate only 3 retries for a non-failing transaction hash
-    'root: for _ in 1..=3 {
-        let tx_hash = 'tx_hash: loop {
-            // tolerate only 3 retries for a valid transaction hash
-            for _ in 1..=3 {
-                if let Ok(tx_hash) =
-                    utils::input("What transaction hash should we query? ")?.parse()
-                {
-                    break 'tx_hash tx_hash;
-                }
-                println!("(i) Invalid transaction hash!");
-            }
-
-            break 'root;
-        };
-
-        let account_id = 'account_id: loop {
-            // tolerate only 3 retries for a valid Account ID
-            for _ in 1..=3 {
-                if let Ok(account_id) =
-                    utils::input("What account signed this transaction? ")?.parse()
-                {
-                    break 'account_id account_id;
-                }
-                println!("(i) Invalid Account ID!");
-            }
-
-            break 'root;
-        };
-
+    for _ in 1..=3 {
+        let tx_hash: CryptoHash = get_valid_input("What transaction hash should we query", 3)?;
+        let account_id: AccountId = get_valid_input("What account signed this transaction", 3)?;
         let wait_until_str = utils::input("Enter the desired guaranteed execution status (can be one of: NONE, INCLUDED, INCLUDED_FINAL, EXECUTED, FINAL): ")?;
         let wait_until = serde_json::from_value(serde_json::json!(wait_until_str))?;
 
diff --git a/examples/send_tx.rs b/examples/send_tx.rs
index 141f395..d6dd3f5 100644
--- a/examples/send_tx.rs
+++ b/examples/send_tx.rs
@@ -1,7 +1,7 @@
 use near_jsonrpc_client::{methods, JsonRpcClient};
 use near_jsonrpc_primitives::types::query::QueryResponseKind;
 use near_jsonrpc_primitives::types::transactions::{RpcTransactionError, TransactionInfo};
-use near_primitives::transaction::{Action, FunctionCallAction, Transaction};
+use near_primitives::transaction::{Action, FunctionCallAction, Transaction, TransactionV0};
 use near_primitives::types::BlockReference;
 use near_primitives::views::TxExecutionStatus;
 use tokio::time;
@@ -39,7 +39,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     let other_account = utils::input("Enter the account to be rated: ")?;
     let rating = utils::input("Enter a rating: ")?.parse::<f32>()?;
 
-    let transaction = Transaction {
+    let transaction = Transaction::V0(TransactionV0 {
         signer_id: signer.account_id.clone(),
         public_key: signer.public_key.clone(),
         nonce: current_nonce + 1,
@@ -56,11 +56,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
             gas: 100_000_000_000_000, // 100 TeraGas
             deposit: 0,
         }))],
-    };
+    });
     let tx_hash = transaction.get_hash_and_size().0;
 
     let request = methods::send_tx::RpcSendTransactionRequest {
-        signed_transaction: transaction.sign(&signer),
+        signed_transaction: transaction.sign(&near_crypto::Signer::InMemory(signer.clone())),
         wait_until: wait_until.clone(),
     };
 
diff --git a/examples/view_account.rs b/examples/view_account.rs
index 9832fb4..8905cd6 100644
--- a/examples/view_account.rs
+++ b/examples/view_account.rs
@@ -24,5 +24,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
         println!("{:#?}", result);
     }
 
+    let request: methods::EXPERIMENTAL_protocol_config::RpcProtocolConfigRequest =
+        methods::EXPERIMENTAL_protocol_config::RpcProtocolConfigRequest {
+            block_reference: BlockReference::latest(),
+        };
+
+    let response = client.call(request).await?;
+    println!("{:#?}", response);
+
     Ok(())
 }
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
new file mode 100644
index 0000000..f2343a7
--- /dev/null
+++ b/rust-toolchain.toml
@@ -0,0 +1,6 @@
+[toolchain]
+# This specifies the version of Rust we use to build.
+# Individual crates in the workspace may support a lower version, as indicated by `rust-version` field in each crate's `Cargo.toml`.
+# The version specified below, should be at least as high as the maximum `rust-version` within the workspace.
+channel = "1.80.0"
+components = ["rustfmt", "clippy", "rust-analyzer"]

From f22e697e5c920567d02110e07dd6c2c724bf6f1c Mon Sep 17 00:00:00 2001
From: akorchyn <artur.yurii.korchynskyi@gmail.com>
Date: Thu, 8 Aug 2024 14:06:00 +0300
Subject: [PATCH 2/4] removed testing log

---
 examples/view_account.rs | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/examples/view_account.rs b/examples/view_account.rs
index 8905cd6..9832fb4 100644
--- a/examples/view_account.rs
+++ b/examples/view_account.rs
@@ -24,13 +24,5 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
         println!("{:#?}", result);
     }
 
-    let request: methods::EXPERIMENTAL_protocol_config::RpcProtocolConfigRequest =
-        methods::EXPERIMENTAL_protocol_config::RpcProtocolConfigRequest {
-            block_reference: BlockReference::latest(),
-        };
-
-    let response = client.call(request).await?;
-    println!("{:#?}", response);
-
     Ok(())
 }

From 1ec9ba722cca389e1daf3777d9024a10ed5a887e Mon Sep 17 00:00:00 2001
From: Artur Yurii Korchynskyi <42449190+akorchyn@users.noreply.github.com>
Date: Thu, 8 Aug 2024 14:33:49 +0300
Subject: [PATCH 3/4] Update Cargo.toml

---
 Cargo.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Cargo.toml b/Cargo.toml
index 701f7a8..a20194c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "near-jsonrpc-client"
-version = "0.10.2"
+version = "0.10.1"
 authors = ["Near Inc <hello@nearprotocol.com>"]
 edition = "2021"
 license = "MIT OR Apache-2.0"

From 38548d4892021ebedb80dab989c35da00f7e4e84 Mon Sep 17 00:00:00 2001
From: akorchyn <artur.yurii.korchynskyi@gmail.com>
Date: Thu, 8 Aug 2024 15:07:18 +0300
Subject: [PATCH 4/4] fixed doctest, and proper value for create_accoutn

---
 examples/create_account.rs         | 87 ++++++++++++++++--------------
 src/methods/broadcast_tx_async.rs  |  8 +--
 src/methods/broadcast_tx_commit.rs |  8 +--
 src/methods/send_tx.rs             |  8 +--
 4 files changed, 58 insertions(+), 53 deletions(-)

diff --git a/examples/create_account.rs b/examples/create_account.rs
index 0f01287..055a9c6 100644
--- a/examples/create_account.rs
+++ b/examples/create_account.rs
@@ -134,27 +134,30 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     let is_sub_account = new_account_id.is_sub_account_of(&signer.account_id);
     let new_key_pair = near_crypto::SecretKey::from_random(near_crypto::KeyType::ED25519);
 
-    let transaction = if is_sub_account {
-        TransactionV0 {
-            signer_id: signer.account_id.clone(),
-            public_key: signer.public_key.clone(),
-            nonce: current_nonce + 1,
-            receiver_id: new_account_id.clone(),
-            block_hash: latest_hash,
-            actions: vec![
-                Action::CreateAccount(CreateAccountAction {}),
-                Action::AddKey(Box::new(AddKeyAction {
-                    access_key: near_primitives::account::AccessKey {
-                        nonce: 0,
-                        permission: near_primitives::account::AccessKeyPermission::FullAccess,
-                    },
-                    public_key: new_key_pair.public_key(),
-                })),
-                Action::Transfer(TransferAction {
-                    deposit: initial_deposit,
-                }),
-            ],
-        }
+    let (transaction, expected_output) = if is_sub_account {
+        (
+            TransactionV0 {
+                signer_id: signer.account_id.clone(),
+                public_key: signer.public_key.clone(),
+                nonce: current_nonce + 1,
+                receiver_id: new_account_id.clone(),
+                block_hash: latest_hash,
+                actions: vec![
+                    Action::CreateAccount(CreateAccountAction {}),
+                    Action::AddKey(Box::new(AddKeyAction {
+                        access_key: near_primitives::account::AccessKey {
+                            nonce: 0,
+                            permission: near_primitives::account::AccessKeyPermission::FullAccess,
+                        },
+                        public_key: new_key_pair.public_key(),
+                    })),
+                    Action::Transfer(TransferAction {
+                        deposit: initial_deposit,
+                    }),
+                ],
+            },
+            vec![],
+        )
     } else {
         let contract_id = if client.server_addr().ends_with("testnet.near.org") {
             "testnet".parse()?
@@ -163,24 +166,27 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
         } else {
             Err("can only create non-sub accounts for mainnet / testnet\nconsider creating a sub-account instead")?
         };
-        TransactionV0 {
-            signer_id: signer.account_id.clone(),
-            public_key: signer.public_key.clone(),
-            nonce: current_nonce + 1,
-            receiver_id: contract_id,
-            block_hash: latest_hash,
-            actions: vec![Action::FunctionCall(Box::new(FunctionCallAction {
-                method_name: "create_account".to_string(),
-                args: json!({
-                    "new_account_id": new_account_id,
-                    "new_public_key": new_key_pair.public_key(),
-                })
-                .to_string()
-                .into_bytes(),
-                gas: 300_000_000_000_000,
-                deposit: initial_deposit,
-            }))],
-        }
+        (
+            TransactionV0 {
+                signer_id: signer.account_id.clone(),
+                public_key: signer.public_key.clone(),
+                nonce: current_nonce + 1,
+                receiver_id: contract_id,
+                block_hash: latest_hash,
+                actions: vec![Action::FunctionCall(Box::new(FunctionCallAction {
+                    method_name: "create_account".to_string(),
+                    args: json!({
+                        "new_account_id": new_account_id,
+                        "new_public_key": new_key_pair.public_key(),
+                    })
+                    .to_string()
+                    .into_bytes(),
+                    gas: 300_000_000_000_000,
+                    deposit: initial_deposit,
+                }))],
+            },
+            b"true".to_vec(),
+        )
     };
 
     println!("=============================================================");
@@ -229,8 +235,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
                         break;
                     }
                     FinalExecutionStatus::SuccessValue(ref s) => {
-                        // outcome.status != SuccessValue(`false`)
-                        if s.is_empty() {
+                        if s == &expected_output {
                             println!("(i) Account successfully created after {}s", delta);
                         } else {
                             println!("{:#?}", outcome);
diff --git a/src/methods/broadcast_tx_async.rs b/src/methods/broadcast_tx_async.rs
index 92d4724..e19a226 100644
--- a/src/methods/broadcast_tx_async.rs
+++ b/src/methods/broadcast_tx_async.rs
@@ -11,7 +11,7 @@
 //! ```no_run
 //! use near_jsonrpc_client::{methods, JsonRpcClient};
 //! use near_primitives::types::{AccountId};
-//! use near_primitives::transaction::{Action, FunctionCallAction, Transaction};
+//! use near_primitives::transaction::{Action, FunctionCallAction, Transaction, TransactionV0};
 //! use near_crypto::SecretKey;
 //! use core::str::FromStr;
 //! use serde_json::json;
@@ -28,7 +28,7 @@
 //! let other_account = "rpc_docs.testnet".parse::<AccountId>()?;
 //! let rating = "4.5".parse::<f32>()?;
 //!
-//! let transaction = Transaction {
+//! let transaction = Transaction::V0(TransactionV0 {
 //!     signer_id: signer.account_id.clone(),
 //!     public_key: signer.public_key.clone(),
 //!     nonce: 10223934 + 1,
@@ -45,10 +45,10 @@
 //!         gas: 100_000_000_000_000, // 100 TeraGas
 //!         deposit: 0,
 //!     }))],
-//! };
+//! });
 //!
 //! let request = methods::broadcast_tx_async::RpcBroadcastTxAsyncRequest {
-//!     signed_transaction: transaction.sign(&signer)
+//!     signed_transaction: transaction.sign(&near_crypto::Signer::InMemory(signer))
 //! };
 //! # Ok(())
 //! # }
diff --git a/src/methods/broadcast_tx_commit.rs b/src/methods/broadcast_tx_commit.rs
index c3bc79e..15166c6 100644
--- a/src/methods/broadcast_tx_commit.rs
+++ b/src/methods/broadcast_tx_commit.rs
@@ -14,7 +14,7 @@
 //! 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 near_primitives::transaction::{Action, FunctionCallAction, Transaction, TransactionV0};
 //! use serde_json::json;
 //!
 //! # #[tokio::main]
@@ -29,7 +29,7 @@
 //! let other_account = "rpc_docs.testnet".parse::<AccountId>()?;
 //! let rating = "4.5".parse::<f32>()?;
 //!
-//! let transaction = Transaction {
+//! let transaction = Transaction::V0(TransactionV0 {
 //!     signer_id: signer.account_id.clone(),
 //!     public_key: signer.public_key.clone(),
 //!     nonce: 904565 + 1,
@@ -46,10 +46,10 @@
 //!         gas: 100_000_000_000_000, // 100 TeraGas
 //!         deposit: 0,
 //!     }))],
-//! };
+//! });
 //!
 //! let request = methods::broadcast_tx_commit::RpcBroadcastTxCommitRequest {
-//!     signed_transaction: transaction.sign(&signer)
+//!     signed_transaction: transaction.sign(&near_crypto::Signer::InMemory(signer))
 //! };
 //! # Ok(())
 //! # }
diff --git a/src/methods/send_tx.rs b/src/methods/send_tx.rs
index 8ce1ec7..decd370 100644
--- a/src/methods/send_tx.rs
+++ b/src/methods/send_tx.rs
@@ -14,7 +14,7 @@
 //! 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 near_primitives::transaction::{Action, FunctionCallAction, Transaction, TransactionV0};
 //! use serde_json::json;
 //!
 //! # #[tokio::main]
@@ -30,7 +30,7 @@
 //! let other_account = "rpc_docs.testnet".parse::<AccountId>()?;
 //! let rating = "4.5".parse::<f32>()?;
 //!
-//! let transaction = Transaction {
+//! let transaction = Transaction::V0(TransactionV0 {
 //!     signer_id: signer.account_id.clone(),
 //!     public_key: signer.public_key.clone(),
 //!     nonce: 904565 + 1,
@@ -47,10 +47,10 @@
 //!         gas: 100_000_000_000_000, // 100 TeraGas
 //!         deposit: 0,
 //!     }))],
-//! };
+//! });
 //!
 //! let request = methods::send_tx::RpcSendTransactionRequest {
-//!     signed_transaction: transaction.sign(&signer),
+//!     signed_transaction: transaction.sign(&near_crypto::Signer::InMemory(signer)),
 //!     wait_until: TxExecutionStatus::IncludedFinal,
 //! };
 //! # Ok(())