From b8b56cb9c424cd30caa4ae0795b88ef04b48d4c8 Mon Sep 17 00:00:00 2001 From: Fredrik Simonsson Date: Thu, 9 Nov 2023 19:08:01 +0900 Subject: [PATCH] Implement legacy RPC system_account_next_index (#1250) 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,