diff --git a/subxt/src/tx/signer.rs b/subxt/src/tx/signer.rs index 90436f6868..5e4f90c418 100644 --- a/subxt/src/tx/signer.rs +++ b/subxt/src/tx/signer.rs @@ -14,12 +14,8 @@ use sp_runtime::traits::{ /// Signing transactions requires a [`Signer`]. This is responsible for /// providing the "from" account that the transaction is being signed by, -/// as well as actually signing a SCALE encoded payload. Optionally, a -/// signer can also provide the nonce for the transaction to use. +/// as well as actually signing a SCALE encoded payload. pub trait Signer { - /// Optionally returns a nonce. - fn nonce(&self) -> Option; - /// Return the "from" account ID. fn account_id(&self) -> &T::AccountId; @@ -37,7 +33,6 @@ pub trait Signer { #[derive(Clone, Debug)] pub struct PairSigner { account_id: T::AccountId, - nonce: Option, signer: P, } @@ -53,22 +48,7 @@ where pub fn new(signer: P) -> Self { let account_id = ::Signer::from(signer.public()).into_account(); - Self { - account_id, - nonce: None, - signer, - } - } - - /// Sets the nonce to a new value. By default, the nonce will - /// be retrieved from the node. Setting one here will override that. - pub fn set_nonce(&mut self, nonce: T::Index) { - self.nonce = Some(nonce); - } - - /// Increment the nonce. - pub fn increment_nonce(&mut self) { - self.nonce = self.nonce.map(|nonce| nonce + 1u32.into()); + Self { account_id, signer } } /// Returns the [`Pair`] implementation used to construct this. @@ -89,10 +69,6 @@ where P: Pair + 'static, P::Signature: Into + 'static, { - fn nonce(&self) -> Option { - self.nonce - } - fn account_id(&self) -> &T::AccountId { &self.account_id } diff --git a/subxt/src/tx/tx_client.rs b/subxt/src/tx/tx_client.rs index 494ec0f91a..346c5d9ed6 100644 --- a/subxt/src/tx/tx_client.rs +++ b/subxt/src/tx/tx_client.rs @@ -224,14 +224,11 @@ where Call: TxPayload, { // Get nonce from the node. - let account_nonce = if let Some(nonce) = signer.nonce() { - nonce - } else { - self.client - .rpc() - .system_account_next_index(signer.account_id()) - .await? - }; + let account_nonce = self + .client + .rpc() + .system_account_next_index(signer.account_id()) + .await?; self.create_signed_with_nonce(call, signer, account_nonce, other_params) }