From 41560a6a6e543f34c516c89080e39e13f3c16be6 Mon Sep 17 00:00:00 2001 From: Fredrik Simonsson Date: Thu, 9 Nov 2023 17:56:56 +0900 Subject: [PATCH] Implement legacy RPC system_account_next_index RPC system_account_next_index compensates for extrinsics in transaction pool as opposed to get_account_nonce which does not. --- subxt/src/backend/legacy/rpc_methods.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/subxt/src/backend/legacy/rpc_methods.rs b/subxt/src/backend/legacy/rpc_methods.rs index b4f619f4f4..4dde85ee98 100644 --- a/subxt/src/backend/legacy/rpc_methods.rs +++ b/subxt/src/backend/legacy/rpc_methods.rs @@ -138,6 +138,18 @@ impl LegacyRpcMethods { .await } + /// Fetch next nonce for an Account + /// + /// Return account nonce adjusted for extrinsics currently in transaction pool + pub async fn system_account_next_index(&self, account_id: &T::AccountId) -> Result + where + T::AccountId: Serialize, + { + self.client + .request("system_accountNextIndex", rpc_params![&account_id]) + .await + } + /// Get a header pub async fn chain_get_header( &self,