Skip to content

Commit

Permalink
Implement legacy RPC system_account_next_index (#1250)
Browse files Browse the repository at this point in the history
RPC system_account_next_index compensates for
extrinsics in transaction pool as opposed to
get_account_nonce which does not.
  • Loading branch information
simonsso authored Nov 9, 2023
1 parent 6332196 commit b8b56cb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions subxt/src/backend/legacy/rpc_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ impl<T: Config> LegacyRpcMethods<T> {
.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<u64, Error>
where
T::AccountId: Serialize,
{
self.client
.request("system_accountNextIndex", rpc_params![&account_id])
.await
}

/// Get a header
pub async fn chain_get_header(
&self,
Expand Down

0 comments on commit b8b56cb

Please sign in to comment.